feat(install): level-aware casan init + merge-safe adoption + hub guardrail
Answers the 3 adoption questions (Plan-21 follow-up):
1) LEVEL SELECTION (4 packaging levels, packaging/levels.json):
- install.sh --level core|devkit; platform refused (preview service),
enterprise refused (future). Level recorded in .casan-level.
- casan init --level 1..4: L1=gate+Plan-20 hooks only; L2=+CI+domain-pack;
L3=L2 base+preview note; L4=refused. New `casan level show|set`.
- levels.json core now includes adapters/ + schemas/ + install scripts.
2) EXISTING SHELLS (agents/skills): init MERGES Plan-20 hooks into an existing
.claude/settings.json and .codex/{hooks.json,config.toml} idempotently
instead of clobbering — preserves the project's own hooks/agents/skills and
unrelated keys. Re-running never duplicates the CASAN hook.
3) NO RE-INDEX / NO SHELL REWRITE: init only adds config; it does not parse or
index code and does not rewrite the project shell.
Safety fixes after a test accidentally ran init in the real repo:
- launcher shim now SELF-LOCATES its install from its own path (no ambient
CASAN_HOME cross-talk).
- casan init REFUSES to adopt a CASAN source hub into itself (--force to
override), so the Plan-20 hooks can't block the developing agent.
- test always runs init inside throwaway dirs; +source-hub guard test.
hybrid-install-tests.sh: 41/41 PASS.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
8450f8ca1a
commit
ff4e9d5a53
@@ -42,7 +42,8 @@ casan — CASAN governance harness CLI ($(version))
|
||||
Usage: casan <command> [args]
|
||||
|
||||
Commands:
|
||||
init [--project id] [--client all] Adopt CASAN into THIS project (config only, hybrid model)
|
||||
init [--level 1..4] [--project id] Adopt CASAN into THIS project (config only, hybrid model)
|
||||
level <show|set 1..4> Show / change the project's packaging level
|
||||
verify-harness Verify the resolved harness matches the project pin
|
||||
run <in> <out> [action] [-- cmd...] Run a step through the harness (H4→H5→H6→exec→H4-out)
|
||||
gate Run the full CI harness gate (all suites)
|
||||
@@ -73,6 +74,15 @@ case "$cmd" in
|
||||
verify-harness)
|
||||
[[ -f "$DEVKIT_ROOT/casan-init.py" ]] || { echo "casan: verify-harness requires the casan-devkit package" >&2; exit 1; }
|
||||
exec python3 "$DEVKIT_ROOT/casan-init.py" verify "$@" ;;
|
||||
level)
|
||||
[[ -f "$DEVKIT_ROOT/casan-init.py" ]] || { echo "casan: level requires the casan-devkit package" >&2; exit 1; }
|
||||
sub="${1:-show}"; shift || true
|
||||
case "$sub" in
|
||||
show) exec python3 "$DEVKIT_ROOT/casan-init.py" level --show "$@" ;;
|
||||
set) n="${1:-devkit}"; shift || true
|
||||
exec python3 "$DEVKIT_ROOT/casan-init.py" init --level "$n" "$@" ;;
|
||||
*) echo "casan: usage: casan level <show|set <1..4>>" >&2; exit 64 ;;
|
||||
esac ;;
|
||||
run) exec bash "$BASH_DIR/casan-harness.sh" "$@" ;;
|
||||
gate)
|
||||
if [[ -n "${CASAN_PROJECT_MANIFEST:-}${CASAN_PROJECT_ID:-}" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user