feat: harden CASAN production install lifecycle

This commit is contained in:
thanhnv
2026-07-24 11:11:44 +07:00
parent c7671ab198
commit 114340c719
48 changed files with 1036 additions and 165 deletions
+17 -9
View File
@@ -28,7 +28,6 @@ if [[ -z "${HARNESS:-}" || ! -d "$HARNESS" ]]; then
exit 1
fi
BASH_DIR="$HARNESS/scripts/bash"
TESTS_DIR="$HARNESS/tests"
CASAN_APP_ROOT="${CASAN_APP_ROOT:-$(cd "$HARNESS/../.." && pwd)}"
VERSION_FILE="$_self/../VERSION"
[[ -f "$VERSION_FILE" ]] || VERSION_FILE="$HARNESS/../../VERSION"
@@ -43,12 +42,12 @@ Usage: casan <command> [args]
Commands:
init [--client ...] [--project id] Adopt CASAN and select Claude/Codex/VS Code integrations
uninstall [--purge] Remove CASAN from this project (preserves user config)
doctor [--client ...] Verify configured hooks, pin, adapters, and VS Code route
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)
test Run the core harness test suite (run-casan4)
gate Run production checks from the project manifest
verify Verify audit chain + tool audit + policy bundle
reuse Verify multi-project harness reuse (registry)
project validate [--manifest path] Validate a project manifest and quality profile
@@ -56,7 +55,7 @@ Commands:
prompt verify Verify the adopted prompt-enforcement contract
prompt trace <trace-id> Verify that a prompt trace is H1-H7 certified
pipeline [--manifest path] Run the manifest-driven SRS→test pipeline
dashboard [port] Serve the AgentOps dashboard (default 8787)
dashboard [port] Serve the AgentOps dashboard (Platform only)
version Print version
help This help
@@ -72,6 +71,9 @@ case "$cmd" in
init)
[[ -f "$DEVKIT_ROOT/casan-init.py" ]] || { echo "casan: init requires the casan-devkit package" >&2; exit 1; }
exec python3 "$DEVKIT_ROOT/casan-init.py" init "$@" ;;
uninstall)
[[ -f "$DEVKIT_ROOT/casan-init.py" ]] || { echo "casan: uninstall requires the casan-devkit package" >&2; exit 1; }
exec python3 "$DEVKIT_ROOT/casan-init.py" uninstall "$@" ;;
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 "$@" ;;
@@ -89,11 +91,12 @@ case "$cmd" in
esac ;;
run) exec bash "$BASH_DIR/casan-harness.sh" "$@" ;;
gate)
if [[ -n "${CASAN_PROJECT_MANIFEST:-}${CASAN_PROJECT_ID:-}" ]]; then
exec bash "$BASH_DIR/project-gate.sh" "$@"
if [[ -z "${CASAN_PROJECT_MANIFEST:-}${CASAN_PROJECT_ID:-}" \
&& ! -f "$CASAN_APP_ROOT/apps/okr/domain/project.manifest.json" ]]; then
echo "casan: gate requires CASAN_PROJECT_MANIFEST or CASAN_PROJECT_ID" >&2
exit 64
fi
exec bash "$BASH_DIR/ci-harness-gate.sh" "$@" ;;
test) exec bash "$TESTS_DIR/run-casan4-harness-tests.sh" "$@" ;;
exec bash "$BASH_DIR/project-gate.sh" "$@" ;;
verify)
rc=0
bash "$BASH_DIR/verify-audit-chain.sh" "$@" || rc=$?
@@ -125,7 +128,12 @@ case "$cmd" in
RUNNER="$CASAN_APP_ROOT/scripts/run-casan-pipeline.mjs"
[[ -f "$RUNNER" ]] || { echo "casan: pipeline runner is not installed" >&2; exit 1; }
exec node "$RUNNER" "$@" ;;
dashboard) exec bash "$BASH_DIR/dashboard-serve.sh" "$@" ;;
dashboard)
[[ -f "$BASH_DIR/dashboard-serve.sh" ]] || {
echo "casan: dashboard requires the Platform bundle" >&2
exit 1
}
exec bash "$BASH_DIR/dashboard-serve.sh" "$@" ;;
version|-v|--version) version ;;
help|-h|--help) usage ;;
*) echo "casan: unknown command '$cmd'" >&2; usage >&2; exit 64 ;;