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
+6
-1
@@ -92,7 +92,12 @@ $binDir = Join-Path $CasanHome 'bin'
|
||||
New-Item -ItemType Directory -Force -Path $binDir | Out-Null
|
||||
$launcherPs1 = @'
|
||||
$ErrorActionPreference = "Stop"
|
||||
$CasanHome = if ($env:CASAN_HOME) { $env:CASAN_HOME } else { Join-Path $env:LOCALAPPDATA "casan" }
|
||||
# Self-locate THIS install from the launcher's own path (<home>\bin\casan.ps1) so a
|
||||
# specific launcher always uses ITS install regardless of any ambient CASAN_HOME.
|
||||
$selfHome = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
if ((Test-Path (Join-Path $selfHome "current")) -or (Test-Path (Join-Path $selfHome "versions"))) {
|
||||
$CasanHome = $selfHome
|
||||
} elseif ($env:CASAN_HOME) { $CasanHome = $env:CASAN_HOME } else { $CasanHome = Join-Path $env:LOCALAPPDATA "casan" }
|
||||
$cur = Join-Path $CasanHome "current"
|
||||
if (-not (Test-Path $cur)) { Write-Error "casan: no install at $cur (run install.ps1)"; exit 1 }
|
||||
$env:CASAN_HARNESS_ROOT = Join-Path $cur "packages\casan-harness"
|
||||
|
||||
Reference in New Issue
Block a user