Skip to content

Commit 4ad77a2

Browse files
authored
Merge pull request #5 from bluemoonfoundry/autocompletion_support
Add comprehensive autocomplete support for Pro and Interactive modes
2 parents 7925fcc + 9b1981b commit 4ad77a2

16 files changed

Lines changed: 4644 additions & 104 deletions

CLAUDE.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pip install -e .
1717
pip install -e ".[dev]"
1818
```
1919

20-
This creates console scripts: `vangard`, `vangard-cli`, `vangard-interactive`, `vangard-server`, `vangard-gui`
20+
This creates console scripts: `vangard`, `vangard-cli`, `vangard-interactive`, `vangard-server`, `vangard-gui`, `vangard-pro`
2121

2222
### Running Tests
2323
```bash
@@ -31,7 +31,7 @@ pytest tests/ -m command # Individual command tests
3131
pytest tests/ -m "not slow" # Exclude slow tests
3232

3333
# Run tests in a specific directory
34-
pytest tests/commands/ # All command tests (122 tests)
34+
pytest tests/commands/ # All command tests (137 tests)
3535
pytest tests/unit/ # Unit tests (39 tests)
3636
pytest tests/integration/ # Integration tests (8 tests)
3737

@@ -87,22 +87,24 @@ Note: The script generates `config_reference.md`, not `ARGS.md`. Both files may
8787
- **Interactive** (`interactive.py`): Shell with prompt-toolkit, command completion, and history
8888
- **Server** (`server.py`): FastAPI web server with dynamically generated REST endpoints
8989
- **GUI** (`gui.py`): Simple graphical interface
90+
- **Pro** (`pro.py`): Modern web interface with dark theme, dynamic forms, and real-time feedback
9091

9192
### Command Execution Flow
9293

9394
1. User runs command via any interface: `vangard-cli [command] [args]` or `python -m vangard.cli [command] [args]`
94-
2. Interface layer (`cli.py`, `interactive.py`, `server.py`, or `gui.py`) loads config and builds parser
95+
2. Interface layer (`cli.py`, `interactive.py`, `server.py`, `gui.py`, or `pro.py`) loads config and builds parser
9596
3. Parser identifies command and its associated Python class from `config.yaml`
9697
4. Command class instantiated, `process()` method called
97-
5. `BaseCommand.exec_remote_script()` spawns DAZ Studio subprocess
98-
6. Python args converted to JSON, passed to .dsa script via `-scriptArg`
99-
7. DAZ Studio executes the .dsa script with provided arguments
98+
5. `BaseCommand.exec_remote_script()` determines execution mode:
99+
- **Subprocess mode** (default): Spawns DAZ Studio with script path and JSON args via `-scriptArg`
100+
- **Server mode**: Sends POST request to DAZ Script Server plugin at `/execute` endpoint
101+
6. DAZ Studio executes the .dsa script with provided arguments
100102

101103
### Test Organization
102104

103105
```
104106
tests/
105-
├── commands/ # 122 tests - One test file per command class
107+
├── commands/ # 137 tests - One test file per command class
106108
├── unit/ # 39 tests - Core framework and utility tests
107109
├── integration/ # 8 tests - Cross-component integration tests
108110
├── contract/ # Contract/interface tests
@@ -112,26 +114,37 @@ tests/
112114
└── conftest.py # Pytest configuration and shared fixtures
113115
```
114116

115-
The test suite totals 164 automated tests. E2E and manual tests are excluded from default runs.
117+
The test suite totals 179 automated tests. E2E and manual tests are excluded from default runs.
116118

117119
### Key Base Classes
118120

119121
**BaseCommand** (`vangard/commands/BaseCommand.py`)
120122
- All command classes inherit from this abstract base class
121123
- `__init__(parser, config)`: Initializes with optional parser and config references
122124
- `process(args)`: Main execution method that subclasses can override for custom behavior. Default implementation calls `exec_default_script()`
123-
- `exec_default_script(args)`: Executes .dsa script with the same name as the command class
124-
- `exec_remote_script(script_name, script_vars, daz_command_line)`: Static method that spawns DAZ Studio subprocess with specified script and JSON arguments
125+
- `exec_default_script(args)`: Convenience method that calls `exec_remote_script()` with a script name matching the class name
126+
- `exec_remote_script(script_name, script_vars, daz_command_line)`: Static method that executes scripts via subprocess or DAZ Script Server based on `DAZ_SCRIPT_SERVER_ENABLED` environment variable
125127
- `to_dict(args, exclude)`: Static method that converts argparse.Namespace to dict, automatically excluding framework keys ('command', 'class_to_run')
126128

127129
**Important**: When creating a new command, you typically only need to create the class and the .dsa script. The default `process()` implementation handles everything unless you need custom Python-side logic.
128130

129131
## Environment Setup
130132

131133
Required environment variables (typically in `.env` file):
134+
135+
**Subprocess Mode (Default)**:
132136
- `DAZ_ROOT`: Absolute path to DAZ Studio executable
137+
- Windows: `C:/Program Files/DAZ 3D/DAZStudio4/DAZStudio.exe`
138+
- macOS: `/Applications/DAZ 3D/DAZStudio4 64-bit/DAZStudio.app/Contents/MacOS/DAZStudio`
133139
- `DAZ_ARGS`: Optional additional arguments for DAZ Studio
134140

141+
**DAZ Script Server Mode (Optional)**:
142+
- `DAZ_SCRIPT_SERVER_ENABLED`: Set to `true` to enable server mode (default: `false`)
143+
- `DAZ_SCRIPT_SERVER_HOST`: Server host (default: `127.0.0.1`)
144+
- `DAZ_SCRIPT_SERVER_PORT`: Server port (default: `18811`)
145+
146+
Note: DAZ Script Server is a separate plugin available at https://github.com/bluemoonfoundry/vangard-daz-script-server. When enabled, commands are sent as POST requests to `http://<host>:<port>/execute` with JSON payload containing `scriptFile` (absolute path) and `args` (JSON object) instead of spawning DAZ Studio subprocesses.
147+
135148
## Running the Application
136149

137150
After installing with `pip install -e .`, use the console scripts:
@@ -152,6 +165,10 @@ vangard server
152165
# GUI mode
153166
vangard-gui
154167
vangard gui
168+
169+
# Pro Mode - modern web interface (runs on http://127.0.0.1:8000)
170+
vangard-pro
171+
vangard pro
155172
```
156173

157174
Alternative (without installation):
@@ -160,6 +177,7 @@ python -m vangard.cli [command] [args]
160177
python -m vangard.interactive
161178
python -m vangard.server
162179
python -m vangard.gui
180+
python -m vangard.pro
163181
# or
164182
python -m vangard.main cli [command] [args]
165183
```
@@ -210,6 +228,15 @@ python -m vangard.main cli [command] [args]
210228
- DSA script files: `CommandNameSU.dsa` (matches class name)
211229
- CLI command names: Use kebab-case (e.g., `load-scene`, `batch-render`)
212230

231+
## Pro Mode Static Files
232+
233+
Pro mode serves static files from `vangard/static/`:
234+
- `index.html`: Main Pro interface
235+
- `css/styles.css`: Styling and theme definitions
236+
- `js/app.js`: Frontend JavaScript, including command icons and form generation
237+
238+
These files are automatically included via `package_data` in setup.py and served by `vangard/pro.py` using FastAPI's static file mounting. To customize the Pro interface appearance or add command icons, edit these files. See [PRO_MODE.md](PRO_MODE.md) for detailed customization instructions.
239+
213240
## Testing Notes
214241

215242
Test assets located in `test/` directory include:

0 commit comments

Comments
 (0)