feat: add explicit droid runtime alias surface

This commit is contained in:
Tam Nhu Tran committed 2026-03-23 13:44:32 -04:00
1 parent 19c1e1da4f
commit 160be319d0
17 files changed
+229 -85

No files matched your search

+2 -1
View File
@@ -200,7 +200,8 @@ Resolves which adapter to use via `resolveTargetType()`:
↓
2. Profile config: profileConfig.target field
↓
3. argv[0] detection (busybox pattern):
3. argv[0] detection (runtime alias pattern):
- ccs-droid → droid
- ccsd → droid
- ccs → default
↓
+1 -1
View File
@@ -246,7 +246,7 @@ The targets module provides an extensible interface for dispatching profiles to
2. **Target Resolution** - Priority order:
- `--target <cli>` flag (CLI argument)
- Per-profile `target` field (from config.yaml)
- `argv[0]` detection (busybox pattern: `ccsd` → droid)
- `argv[0]` detection (runtime alias pattern: `ccs-droid` / `ccsd` → droid)
- Default: `claude`
3. **Implementations:**
+5 -4
View File
@@ -86,11 +86,12 @@ Spawn Target Process
- Spawns: `droid -m custom:ccs-<profile> <args>`
- Model config includes baseUrl, apiKey, provider
**Binary alias pattern (busybox-style):**
**Runtime alias pattern (argv[0]-style):**
```
ccs → Target: claude (default)
ccsd → Target: droid (auto-selected via argv[0])
ccs → Target: claude (default)
ccs-droid → Target: droid (explicit alias)
ccsd → Target: droid (legacy shortcut)
```
For details on the adapter architecture, see [Target Adapters](./target-adapters.md).
@@ -392,7 +393,7 @@ See [Provider Flows](./provider-flows.md) → Authentication Flow section.
|
+---> Creates symlink: ccs --> dist/ccs.js
|
+---> Binary alias: ccsd → ccs (auto-selects droid target)
+---> Runtime aliases: ccs-droid / ccsd → ccs (auto-select droid target)
|
+---> First run creates: ~/.ccs/
```
+17 -8
View File
@@ -79,8 +79,9 @@ CCS resolves which adapter to use via priority-ordered checks:
glm:
target: droid
3. argv[0] detection (busybox pattern) — binary name mapping
└─ ccsd (symlink/batch file) → droid
3. argv[0] detection (runtime alias pattern) — binary name mapping
└─ ccs-droid (explicit alias) → droid
└─ ccsd (legacy shortcut) → droid
└─ ccs (regular command) → default
4. Fallback: 'claude' — lowest priority
@@ -351,22 +352,30 @@ ccs --target droid glm
(credentials loaded from ~/.factory/settings.json)
```
### Binary Alias Pattern
### Runtime Alias Pattern
```bash
# Create alias/symlink to auto-select droid target
# Built-in alias: ccsd
# Create aliases/symlinks to auto-select droid target
ln -s /path/to/ccs /path/to/ccs-droid
ln -s /path/to/ccs /path/to/ccsd
# Usage
ccs-droid glm
→ Target: droid (detected from argv[0])
→ droid -m custom:ccs-glm "args..."
# Legacy shortcut still works
ccsd glm
→ Target: droid (detected from argv[0])
→ droid -m custom:ccs-glm "args..."
```
On Windows, `ccsd.cmd`, `ccsd.bat`, `ccsd.ps1`, and `ccsd.exe` wrappers are also recognized.
On Windows, `ccs-droid.cmd`, `ccsd.cmd`, `ccsd.bat`, `ccsd.ps1`, and `ccsd.exe` wrappers are also recognized.
Additional alias names can be configured at runtime via `CCS_DROID_ALIASES` (comma-separated). Example: `CCS_DROID_ALIASES=ccs-droid,mydroid`.
Additional alias names can be configured at runtime via `CCS_TARGET_ALIASES`
(preferred, `target=alias1,alias2;...`) or legacy `CCS_DROID_ALIASES`
(comma-separated). Example:
`CCS_TARGET_ALIASES=droid=mydroid,team-droid`
---
@@ -612,7 +621,7 @@ ccs --target claude help
ccs --target droid help
# Test argv[0] detection
ccsd help
ccs-droid help
```
---