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
+29 -1
View File
@@ -42,6 +42,11 @@ Installer sẽ:
- Tạo launcher `casan` (tự định vị install của chính nó) và đưa lên PATH
(`~/.local/bin` hoặc `$CASAN_HOME/bin`).
Installer dùng allowlist `packaging/runtime-layout.json`. Runtime global không
chứa `tests/`, legacy `level5/`, internal test/CI runners, Platform dashboard/local
lab, source docs hay bản sao installer. Policy cần thiết đã được chuẩn hóa vào
`packages/casan-harness/config/`.
> Windows cần **Git for Windows (Git Bash)** để *chạy* harness (xem
> [CASAN_AGENTIC_CLIENTS_WINDOWS.md](CASAN_AGENTIC_CLIENTS_WINDOWS.md)) — không
> cần WSL2. Cả hai OS cần `python3`.
@@ -94,6 +99,16 @@ Tham số `--client` có thể lặp hoặc comma-separated:
tiếp trong terminal, CLI hiển thị menu chọn. Trong automation không có TTY,
mặc định tương thích ngược là `claude,codex`.
Các command dành cho người vận hành (`init`, `doctor`, `verify-harness`,
`level show`, `uninstall`) mặc định in bản tóm tắt dễ đọc. Thêm `--json` sau
command để lấy payload đầy đủ cho automation, ví dụ:
```bash
casan init --client claude,codex --json
casan doctor --json
casan level show --json
```
`--mode observe|enforce` mặc định `enforce`; dùng `observe` chỉ cho pilot
telemetry-only. `--integration-mode` nhận
`project_hook|managed_hook|casan_owned`; `--target <dir>` mặc định là thư mục
@@ -154,6 +169,18 @@ casan doctor --client codex
casan doctor --client vscode-copilot
```
### Gỡ khỏi project
```bash
casan uninstall
```
Command này xóa CASAN project hooks, bootstrap và config nhưng giữ nguyên hook
người dùng, CI/domain files, `.casan-bak`, VS Code extension dùng chung và
`.specify` evidence. Dùng `--purge` nếu chủ động muốn xóa runtime logs/state;
dùng `--remove-vscode-extension` nếu chắc chắn không project nào khác trên máy
còn dùng route `@casan`.
## 3. Pin + Verify (giữ đảm bảo bảo mật khi harness ở ngoài repo)
Vì harness không nằm trong repo, dự án **pin** version + hash gate-code lúc
@@ -163,7 +190,8 @@ Vì harness không nằm trong repo, dự án **pin** version + hash gate-code l
casan verify-harness
```
- Khớp → `status: ok` (rc 0).
- Khớp → hiển thị `Harness integrity verified` (rc 0); `--json` trả
`"status": "ok"`.
- Harness global bị đổi/tamper so với pin → `HARNESS_INTEGRITY_DRIFT` (rc 3).
`verify-harness` **luôn tính lại hash từ file thật** (không tin hash cache), nên