Split the POSIX CLI into modules
linux/claude-mode was 3,035 lines. It is now 177: the paths and flags, a loader, and the command dispatch. Everything else moved, verbatim, into twelve files under linux/lib/, one per concern - output, core, preflight, sessions, switch, catalogue, commands, doctor, presets, menu, setup, repair. The move was done by line range with a check that every original line landed in exactly one file; the only thing that changed place is the switch's running-sessions question, which now sits with session detection. The CLI finds lib/, cm-json.py and cm-vault.sh beside itself, following the ~/.local/bin symlink, so a checkout runs its own code rather than the installed version's (it used to mix the two). The key helper path written into settings.json is still the installed one. linux/install.sh ships bin/lib/, clearing old modules first so a removed one cannot linger. The package build copies linux/ recursively, which a flat copy would not. tests/cli/test_install.sh runs the real installer into a sandbox home: every file lands, the symlink runs, a reinstall keeps edited presets and drops a stale module. docs/architecture.md lists the modules. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -72,6 +72,11 @@ install -m 0755 "$SRC/claude-mode" "$ROOT/bin/claude-mode"
|
||||
install -m 0755 "$SRC/claude-key-helper.sh" "$ROOT/bin/claude-key-helper.sh"
|
||||
install -m 0644 "$SRC/cm-json.py" "$ROOT/bin/cm-json.py"
|
||||
install -m 0644 "$SRC/cm-vault.sh" "$ROOT/bin/cm-vault.sh"
|
||||
# The CLI is split across lib/*.sh, loaded from beside bin/claude-mode. Cleared
|
||||
# first, so a module removed from the source does not linger and get loaded.
|
||||
mkdir -p "$ROOT/bin/lib"
|
||||
rm -f "$ROOT/bin/lib/"*.sh
|
||||
for f in "$SRC"/lib/*.sh; do install -m 0644 "$f" "$ROOT/bin/lib/"; done
|
||||
green 'copied claude-mode + helpers'
|
||||
|
||||
# cm_version() reads this; without it every health.json reported 0.0.0.
|
||||
|
||||
Reference in New Issue
Block a user