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
+18 -6
View File
@@ -1,7 +1,7 @@
# CASAN Plan-21 — Hybrid Global Install + `casan init`
> Ngày lập: 2026-07-23
> Trạng thái: **IMPLEMENTED — global install + `casan init` + pin/verify + level-aware + merge-safe (41/41 test)**
> Trạng thái: **IMPLEMENTED + HARDENED — global install + selectable IDE init + pinned global bootstrap + VS Code `@casan` + merge-safe (60/60 hybrid acceptance)**
> Liên quan: [Plan-20](CASAN_PLAN_20_AGENTIC_CLIENT_INTEGRATION.md) (adapter/hook là base phổ quát), [CASAN_INSTALL_HYBRID.md](../casan/CASAN_INSTALL_HYBRID.md)
## 1. Mục tiêu
@@ -27,7 +27,7 @@ harness global thao tác đúng trên state của dự án hiện tại.
## 3. Pin + Verify (giữ đảm bảo Plan-16 khi harness ở ngoài repo)
- Installer tính **hash toàn vẹn gate-code** (`scripts/bash`, `scripts/python`,
`security`, `level5`) và ghi `.harness-hash`.
`security`, `level5`, `adapters`, `schemas`) và ghi `.harness-hash`.
- `casan init` **pin** version + hash vào `.casan/version.lock`.
- `casan verify-harness` **tính lại live** từ file thật và so với pin → phát hiện
drift/tamper (rc 3). Không tin hash cache.
@@ -42,7 +42,7 @@ harness global thao tác đúng trên state của dự án hiện tại.
| Integrity hash primitive | `packages/casan-harness/scripts/python/harness_hash.py` |
| `casan init` / `verify` | `packages/casan-devkit/casan-init.py` |
| CLI wiring | `bin/casan` (`init`, `verify-harness`) |
| Acceptance suite | `packages/casan-devkit/tests/hybrid-install-tests.sh` — **41/41 PASS** |
| Acceptance suite | `packages/casan-devkit/tests/hybrid-install-tests.sh` — **60/60 PASS** |
| Adoption doc | `docs/casan/CASAN_INSTALL_HYBRID.md` |
### Level selection (4 packaging levels) & safe adoption
@@ -52,10 +52,17 @@ harness global thao tác đúng trên state của dự án hiện tại.
`.casan-level`; launcher self-locates its own install (no cross-home talk).
- `casan init --level 1..4`: L1 = gate + Plan-20 hooks only; L2 = + CI workflow +
domain-pack; L3 = L2 base + preview note; L4 = refused. `casan level show`/`set`.
- `casan init` trên TTY hiển thị menu chọn `claude`, `codex`,
`vscode-copilot`; automation dùng repeatable/comma-separated `--client`.
- **Merge, not clobber:** `init` merges Plan-20 hooks into an existing
`.claude/settings.json` / `.codex/{hooks.json,config.toml}` idempotently,
preserving the project's own hooks/agents/skills. Never re-indexes or rewrites
the project shell.
`.claude/settings.json` / `.codex/hooks.json` idempotently, preserving the
project's own hooks/agents/skills. Legacy CASAN-only TOML blocks are removed
precisely; user TOML is preserved. Never re-indexes or rewrites the project shell.
- **Global-hook bootstrap:** hook chỉ gọi `.casan/casan-hook.py`; bootstrap tự
load enforcement config, resolve harness global và verify live hash trước khi
dispatch. Không còn đường dẫn sai `packages/casan-harness` trong consumer repo.
- **VS Code/Copilot:** build/install dependency-free VSIX đóng góp explicit
`@casan` Chat Participant. Built-in Copilot không bị claim là global-intercept.
- **Source-hub guardrail:** `init` refuses to adopt a CASAN source hub into itself
(would block the developing agent); `--force` overrides.
@@ -65,6 +72,11 @@ harness global thao tác đúng trên state của dự án hiện tại.
- ✅ `casan init` ghi CHỈ config per-project; **không** copy harness.
- ✅ `version.lock` pin đúng hash; `verify-harness` ok khi sạch, drift (rc 3) khi tamper.
- ✅ Bridge Plan-20 chạy qua harness global, state ghi vào `.specify` của dự án.
- ✅ Generated Claude/Codex commands được acceptance test thực thi end-to-end
qua harness global; Codex template dùng current nested command-hook schema.
- ✅ `casan doctor` kiểm tra pin/bootstrap/client smoke/VS Code extension state.
- ✅ Claude Code 2.1.197 black-box: prompt injection bị UserPromptSubmit hook
chặn, `duration_api_ms=0`, token/cost = 0.
- ✅ Project id mặc định theo tên thư mục, được sanitize.
## 6. Còn lại / bước tiếp