52 lines
1.8 KiB
Markdown
52 lines
1.8 KiB
Markdown
|
|
Where Wrappers Are Created
|
||
|
|
|
||
|
|
Location: scripts/install-cli.nu in the create_wrappers() function (lines 187-222)
|
||
|
|
|
||
|
|
Why We Have .real Suffix
|
||
|
|
|
||
|
|
The wrapper system works like this:
|
||
|
|
|
||
|
|
User runs: workspace --help
|
||
|
|
↓
|
||
|
|
~/.cargo/bin/workspace (NuShell wrapper script - 864 bytes)
|
||
|
|
↓
|
||
|
|
Sets up environment variables (WORKSPACE_CONFIG_PATH, WORKSPACE_CONFIG_DIR, WORKSPACE_DATA_DIR)
|
||
|
|
Discovers configuration files from multiple locations
|
||
|
|
↓
|
||
|
|
Calls: ~/.cargo/bin/workspace.real (actual compiled Rust binary - 7.1 MB)
|
||
|
|
↓
|
||
|
|
Returns: Output to user
|
||
|
|
|
||
|
|
The 2-File System:
|
||
|
|
|
||
|
|
1. workspace (wrapper script)
|
||
|
|
|
||
|
|
- Small NuShell script (864 bytes)
|
||
|
|
- Sets up environment before running the real binary
|
||
|
|
- Automatically discovers config files from:
|
||
|
|
- ~/.config/core/workspace.toml
|
||
|
|
- .project/workspace.toml
|
||
|
|
- .vapora/workspace.toml
|
||
|
|
|
||
|
|
2. workspace.real (real binary)
|
||
|
|
|
||
|
|
- Compiled Rust binary (7.1 MB)
|
||
|
|
- The actual executable from cargo install
|
||
|
|
- Runs with environment variables set by the wrapper
|
||
|
|
|
||
|
|
Why This Design?
|
||
|
|
|
||
|
|
1. Configuration Discovery - The wrapper finds configs before the Rust binary runs
|
||
|
|
2. Environment Setup - Automatically sets WORKSPACE_CONFIG_DIR and WORKSPACE_DATA_DIR
|
||
|
|
3. User Transparency - Users run workspace --help normally, wrapper is invisible
|
||
|
|
4. Separation of Concerns - Script layer handles config, binary handles logic
|
||
|
|
|
||
|
|
Current Status:
|
||
|
|
|
||
|
|
✅ workspace → NuShell wrapper → workspace.real (Rust binary)
|
||
|
|
✅ syntaxis-tui → NuShell wrapper → syntaxis-tui.real (Rust binary)
|
||
|
|
✅ syntaxis-dashboard → Direct binary (no wrapper needed - library component)
|
||
|
|
✅ syntaxis-api → Direct binary (runs on port 3001)
|
||
|
|
|
||
|
|
This is a clean, production-grade approach to managing CLI tools with configuration discovery! 🎉
|