Add selectable CASAN IDE integrations

This commit is contained in:
thanhnv
2026-07-23 23:04:54 +07:00
parent ff4e9d5a53
commit ce708fafe5
28 changed files with 1658 additions and 407 deletions
@@ -8,9 +8,9 @@ carries an H1→H7 trace and an H6 record.
- The hook command resolves the repo root via `$CLAUDE_PROJECT_DIR`, so **no
machine-specific path is committed**.
- It invokes `packages/casan-harness/adapters/claude-code/claude_hook.py`, a thin
renderer that calls the core bridge. The bridge **never runs a model** — Claude
remains the sole model executor (single-model invariant).
- It invokes `.casan/casan-hook.py`. That bootstrap reads project config,
resolves the pinned global harness, verifies its live hash, then dispatches
the thin Claude renderer. The bridge **never runs a model**.
- This is a **`project_hook`** integration: strong for a trusted project, but a
member who can edit `.claude/settings.json` can disable it. For organization
enforcement use a managed/pinned deployment (`managed_hook`) — see
@@ -19,18 +19,16 @@ carries an H1→H7 trace and an H6 record.
## Install (cross-platform)
```bash
packages/casan-devkit/install.sh --target <repo> --project <id>
# then enable the agentic client hooks:
cp packages/casan-devkit/templates/claude/settings.json <repo>/.claude/settings.json
cd <repo>
casan init --client claude --mode enforce
casan doctor --client claude
```
Windows: use `packages/casan-devkit/windows/install-agentic.ps1 -Client claude`.
## Feature flags (environment)
| Variable | Default | Meaning |
|---|---|---|
| `CASAN_AGENTIC_BRIDGE_ENABLED` | `1` | Master on/off. |
| `CASAN_AGENTIC_ENFORCEMENT_MODE` | `observe` | `observe` (telemetry-only, never certified) → `enforce` (gates + certification). |
| `CASAN_AGENTIC_ENFORCEMENT_MODE` | `enforce` via init | `observe` (telemetry-only) or `enforce`. |
| `CASAN_AGENTIC_INTEGRATION_MODE` | `project_hook` | `project_hook` / `managed_hook` / `casan_owned`. |
| `CASAN_AGENTIC_CLIENT_ALLOWLIST` | (unset) | Comma list; clients outside it are `observed_only`. |
@@ -1,12 +1,12 @@
{
"//": "CASAN Plan-20 Claude Code project hooks. Commit this as .claude/settings.json in the target repo (the devkit installer does this). Commands self-resolve the repo root via $CLAUDE_PROJECT_DIR — no machine-specific path is baked in. Secrets and absolute paths must NOT be added here.",
"//": "CASAN Plan-20 Claude Code project hooks. The project-local bootstrap resolves and integrity-checks the pinned global harness. Secrets and machine-specific paths must NOT be added here.",
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "python3 \"$CLAUDE_PROJECT_DIR/packages/casan-harness/adapters/claude-code/claude_hook.py\" --event UserPromptSubmit",
"command": "python3 \"$CLAUDE_PROJECT_DIR/.casan/casan-hook.py\" --client claude --event UserPromptSubmit",
"timeout": 15
}
]
@@ -18,7 +18,7 @@
"hooks": [
{
"type": "command",
"command": "python3 \"$CLAUDE_PROJECT_DIR/packages/casan-harness/adapters/claude-code/claude_hook.py\" --event PreToolUse",
"command": "python3 \"$CLAUDE_PROJECT_DIR/.casan/casan-hook.py\" --client claude --event PreToolUse",
"timeout": 15
}
]
@@ -30,7 +30,7 @@
"hooks": [
{
"type": "command",
"command": "python3 \"$CLAUDE_PROJECT_DIR/packages/casan-harness/adapters/claude-code/claude_hook.py\" --event PostToolUse",
"command": "python3 \"$CLAUDE_PROJECT_DIR/.casan/casan-hook.py\" --client claude --event PostToolUse",
"timeout": 15
}
]
@@ -41,7 +41,7 @@
"hooks": [
{
"type": "command",
"command": "python3 \"$CLAUDE_PROJECT_DIR/packages/casan-harness/adapters/claude-code/claude_hook.py\" --event Stop",
"command": "python3 \"$CLAUDE_PROJECT_DIR/.casan/casan-hook.py\" --client claude --event Stop",
"timeout": 15
}
]