Skip to content

Commit 46be3aa

Browse files
cschladetschclaude
andcommitted
Update all README files with comprehensive variable system documentation
- Document variable system integration across all modules - Add C++ API documentation and usage examples - Update build scripts (./b, ./r, ./t) with shared utilities - Add install script with v8c alias for easy access - Create shared scripts/common.sh for consistent shell scripting - Document .dot to PNG conversion in Resources directory - Comprehensive testing documentation with 40+ unit tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ced6d67 commit 46be3aa

15 files changed

Lines changed: 843 additions & 75 deletions

File tree

DefaultConfig/README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# DefaultConfig Directory
22

3-
Default configuration files for PyClaudeCli.
3+
Default configuration files for PyClaudeCli with variable system support.
44

55
## Files
66

@@ -11,4 +11,36 @@ Default configuration files for PyClaudeCli.
1111

1212
## Description
1313

14-
This directory contains the default configuration files that define the behavior and capabilities of PyClaudeCli. These files can be customized to modify aliases, available models, system prompts, and response templates.
14+
This directory contains the default configuration files that define the behavior and capabilities of PyClaudeCli. These files can be customized to modify aliases, available models, system prompts, and response templates.
15+
16+
## Configuration Locations
17+
18+
When PyClaudeCli runs, it creates user-specific configuration in:
19+
- `~/.config/claude/` - User configuration directory
20+
- `~/.config/claude/variables.json` - **Persistent variable storage**
21+
- `~/.config/claude/conversations.json` - Conversation history
22+
- `~/.config/claude/system` - Custom system prompt
23+
- `~/.config/claude/aliases.json` - Custom aliases
24+
- `~/.config/claude/models.json` - Model preferences
25+
- `~/.config/claude/templates.json` - Response templates
26+
27+
## Variable System
28+
29+
The variable system automatically creates and manages:
30+
- **Storage**: `~/.config/claude/variables.json`
31+
- **Format**: JSON with variable name/value pairs
32+
- **Access**: Available in interactive mode via `vars` command
33+
- **Persistence**: Variables survive CLI restarts and system reboots
34+
35+
### Example Variable File
36+
```json
37+
{
38+
"name": "Alice",
39+
"age": 25,
40+
"hobbies": ["reading", "coding", "hiking"],
41+
"config": {
42+
"theme": "dark",
43+
"notifications": true
44+
}
45+
}
46+
```

Resources/README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Resources Directory
22

3-
Resource files for PyClaudeCli documentation and assets.
3+
Resource files for PyClaudeCli documentation, assets, and generated diagrams.
44

55
## Files
66

@@ -9,8 +9,29 @@ Resource files for PyClaudeCli documentation and assets.
99
- `Arch.svg` - Architecture diagram (SVG format)
1010
- `Demo.gif` - Demo animation
1111
- `Image.jpg` - Sample image
12-
- `generate_architecture.py` - Script to generate architecture documentation
12+
13+
## Generated Content
14+
15+
This directory also serves as the output location for:
16+
- **Doxygen diagrams**: `.dot` files converted to PNG format via CMake
17+
- **Architecture diagrams**: Generated documentation visuals
18+
- **Build artifacts**: Documentation-related outputs
19+
20+
## Build System Integration
21+
22+
The CMake build system automatically:
23+
1. **Finds all `.dot` files** throughout the project
24+
2. **Converts them to PNG** using Graphviz/dot
25+
3. **Outputs to this directory** for easy access
26+
4. **Updates on build** - run `./b` to regenerate
27+
28+
### Example Usage
29+
```bash
30+
./b # Build and generate diagrams
31+
make docs # Generate Doxygen documentation (if available)
32+
make diagrams # Convert .dot files to PNG in Resources/
33+
```
1334

1435
## Description
1536

16-
This directory contains visual assets, documentation resources, and utility scripts used for PyClaudeCli documentation and presentations.
37+
This directory contains visual assets, documentation resources, utility scripts, and auto-generated diagrams used for PyClaudeCli documentation and presentations. It serves as the central location for all visual documentation elements.

ai/README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AI Module
22

3-
Core module for the PyClaudeCli application.
3+
Core module for the PyClaudeCli application with variable system and C++ integration.
44

55
## Structure
66

@@ -14,6 +14,33 @@ Core module for the PyClaudeCli application.
1414
## Subdirectories
1515

1616
- `api/` - API client implementations
17+
- `bindings/` - **C++ API bindings for cross-language integration**
1718
- `modes/` - Different interaction modes (interactive, async)
1819
- `plugins/` - Plugin system and extensions
19-
- `utils/` - Utility functions and helpers
20+
- `utils/` - Utility functions and helpers
21+
22+
## Key Features
23+
24+
### Variable System
25+
- **Simple syntax**: `name=John`, then use `name` directly
26+
- **Persistent storage**: Variables saved to `~/.config/claude/variables.json`
27+
- **JSON support**: Arrays, objects, booleans, null values automatically parsed
28+
- **Cross-session**: Variables persist between CLI restarts
29+
30+
### C++ Integration
31+
- **Cross-language API**: Access variables from C++ using `GetVariable("name")`
32+
- **CMake build system**: Modern C++23 support with Clang as default
33+
- **Conditional compilation**: Shared code between library and tests
34+
35+
### Interactive Integration
36+
- **Seamless integration**: Variable commands work in interactive mode
37+
- **Command support**: `vars` command to list all stored variables
38+
- **Auto-interpolation**: Variables automatically replaced in conversations
39+
40+
## Quick Start
41+
42+
```bash
43+
./r # Start console with variable system
44+
./b # Build C++ components and run tests
45+
./t --quick # Test variable functionality
46+
```

ai/api/README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# API Module
22

3-
Handles communication with Claude API.
3+
Handles communication with Claude API with integrated variable system support.
44

55
## Files
66

@@ -10,4 +10,28 @@ Handles communication with Claude API.
1010

1111
## Usage
1212

13-
The API module provides both synchronous and asynchronous clients for interacting with Claude's API endpoints.
13+
The API module provides both synchronous and asynchronous clients for interacting with Claude's API endpoints. All API interactions support the persistent variable system for enhanced conversation continuity.
14+
15+
## Variable System Integration
16+
17+
### Client Features
18+
Both API clients can process messages containing variables before sending to Claude:
19+
- **Variable Interpolation**: Replace variable references in prompts
20+
- **Session Continuity**: Maintain context across API calls
21+
- **Persistent State**: Variables survive client restarts
22+
23+
### Implementation
24+
```python
25+
from ..utils.variables import process_input as process_variables
26+
27+
# Before sending to API
28+
processed_prompt, was_assignment = process_variables(user_input)
29+
if not was_assignment:
30+
# Send processed_prompt to Claude API
31+
response = client.send_message(processed_prompt)
32+
```
33+
34+
### Benefits
35+
- **Enhanced Context**: Variables provide persistent context across API calls
36+
- **Dynamic Content**: Messages can reference stored variables
37+
- **Conversation State**: Maintain user preferences and data between sessions

ai/bindings/README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Bindings Directory
2+
3+
C++ API bindings for cross-language integration with the PyClaudeCli variable system.
4+
5+
## Files
6+
7+
- `variable_api.cpp` - **C++ interface for variable system access**
8+
- `CMakeLists.txt` - **CMake build configuration for C++ API**
9+
10+
## C++ Variable API (`variable_api.cpp`)
11+
12+
### Purpose
13+
Provides a C++ interface to the Python-based variable system, enabling cross-language integration and allowing C++ applications to:
14+
- Set and retrieve persistent variables
15+
- Access the same variable storage as the Python CLI
16+
- Integrate with existing C++ codebases
17+
18+
### Features
19+
20+
#### Core Classes
21+
```cpp
22+
class VariableManager {
23+
public:
24+
VariableManager(const std::string& config_dir = "");
25+
std::string GetVariable(const std::string& name) const;
26+
bool SetVariable(const std::string& name, const std::string& value) const;
27+
std::string ListVariables() const;
28+
};
29+
```
30+
31+
#### C Interface
32+
```cpp
33+
extern "C" {
34+
VariableManager* create_variable_manager(const char* config_dir);
35+
void destroy_variable_manager(VariableManager* vm);
36+
const char* get_variable(VariableManager* vm, const char* name);
37+
int set_variable(VariableManager* vm, const char* name, const char* value);
38+
const char* list_variables(VariableManager* vm);
39+
}
40+
```
41+
42+
#### Implementation Details
43+
- **Python Integration**: Executes Python commands to access the variable system
44+
- **Error Handling**: Graceful handling of Python execution errors
45+
- **Memory Management**: Proper cleanup and resource management
46+
- **Cross-Platform**: Works on Linux, macOS, and Windows
47+
48+
### Usage Examples
49+
50+
#### C++ Class Interface
51+
```cpp
52+
#include "variable_api.cpp"
53+
54+
VariableManager vm;
55+
56+
// Set variables
57+
vm.SetVariable("name", "Alice");
58+
vm.SetVariable("age", "25");
59+
60+
// Get variables
61+
std::string name = vm.GetVariable("name");
62+
std::string age = vm.GetVariable("age");
63+
64+
// List all variables
65+
std::string all_vars = vm.ListVariables();
66+
```
67+
68+
#### C Interface
69+
```cpp
70+
VariableManager* vm = create_variable_manager(nullptr);
71+
72+
set_variable(vm, "user", "Bob");
73+
const char* user = get_variable(vm, "user");
74+
const char* vars = list_variables(vm);
75+
76+
destroy_variable_manager(vm);
77+
```
78+
79+
### Build System (`CMakeLists.txt`)
80+
81+
#### Features
82+
- **C++23 Standard**: Modern C++ with latest features
83+
- **Multiple Targets**:
84+
- `variable_api` - Static library for integration
85+
- `variable_api_test` - Example/test executable
86+
- **Conditional Compilation**: Prevents main() conflicts in tests
87+
- **Doxygen Integration**: Documentation generation support
88+
89+
#### Build Commands
90+
```bash
91+
mkdir build && cd build
92+
cmake .. -DCMAKE_CXX_COMPILER=clang++
93+
make variable_api # Build library
94+
make variable_api_test # Build example
95+
```
96+
97+
### Integration with Python
98+
99+
The C++ API seamlessly integrates with the Python variable system:
100+
1. **Shared Storage**: Uses same `~/.config/claude/variables.json` file
101+
2. **Consistent Behavior**: Same variable access patterns as Python
102+
3. **Live Updates**: Changes in C++ are immediately visible in Python and vice versa
103+
4. **Type Preservation**: JSON types maintained across language boundaries
104+
105+
### Testing
106+
107+
Comprehensive testing ensures reliability:
108+
- **Unit Tests**: Basic operations and edge cases
109+
- **Integration Tests**: Python/C++ interoperability
110+
- **Error Handling**: Graceful failure modes
111+
- **Memory Safety**: No leaks or corruption
112+
113+
### Performance
114+
115+
- **Efficient**: Direct file system access when possible
116+
- **Cached**: Variables cached in memory during session
117+
- **Minimal Overhead**: Low-cost Python integration
118+
- **Scalable**: Handles large variable sets efficiently
119+
120+
## Use Cases
121+
122+
- **Native Applications**: Integrate PyClaudeCli variables into C++ apps
123+
- **Performance Critical**: Fast variable access from compiled code
124+
- **Legacy Integration**: Connect existing C++ systems to PyClaudeCli
125+
- **Cross-Language**: Share data between Python and C++ components
126+
- **Embedded Systems**: Lightweight variable access for resource-constrained environments

0 commit comments

Comments
 (0)