feat: add production init wizard UX

This commit is contained in:
thanhnv
2026-07-24 12:30:37 +07:00
parent eb3525456f
commit bfebfa9d39
7 changed files with 597 additions and 255 deletions
+9 -7
View File
@@ -60,17 +60,19 @@ pwsh .\install.ps1
cd C:\work\my-project
# Menu chọn Claude / Codex / VS Code Copilot
# Project mới: menu chọn Managed/Vendored, sau đó chọn client
casan init
# Hoặc non-interactive, chọn chính xác client
casan init --client claude,codex --mode enforce
casan init --client vscode-copilot --mode enforce --vscode-install yes
# Hoặc non-interactive, chọn chính xác runtime và client
casan init --non-interactive --runtime managed --client claude,codex --mode enforce
casan init --non-interactive --runtime vendored --client vscode-copilot --mode enforce --vscode-install yes
```
`init` merge CASAN handlers vào config hiện hữu, ghi bootstrap
`.casan\casan-hook.py`, pin harness global, và tạo VSIX `@casan` khi Copilot
được chọn. Bootstrap tự load `config.json`; không cần source env thủ công.
`.casan\casan-hook.py`, pin Core runtime đã resolve, và tạo VSIX `@casan` khi
Copilot được chọn. Managed dùng global installation; Vendored copy Core
production-only vào `.casan\runtime\casan-core`. Bootstrap tự load
`config.json`; không cần source env thủ công.
> Đường dẫn có dấu cách được xử lý đúng (ví dụ `C:\Users\Nguyen Van A\project`).
@@ -117,5 +119,5 @@ cho automation tương thích cũ.
| Codex không chạy hook | Chưa qua trust review | Mở repo trong Codex, chấp nhận trust; chạy lại doctor |
| Turn hiện `observed_only` | Đang ở observe mode hoặc client ngoài allowlist | Chạy lại `casan init --mode enforce --client ...` |
| Token/cost là `null` | Client chưa cấp nguồn usage đáng tin | Đúng theo thiết kế — không bịa số; `telemetry_quality=partial` |
| `casan doctor` báo integrity/bootstrap missing | Global install hoặc project init chưa đầy đủ | Chạy lại `install.ps1`, rồi `casan init` |
| `casan doctor` báo integrity/bootstrap missing | Runtime đã chọn hoặc project init chưa đầy đủ | Managed: chạy lại `install.ps1`; Vendored: chạy `casan init --runtime vendored`; sau đó chạy doctor |
| Mọi turn hiện `observed_only` trên Windows | Không có `bash` (thiếu Git Bash) → gate H4/H2 không chạy | Cài Git for Windows hoặc set `CASAN_AGENTIC_BASH`; `doctor` sẽ báo `gates_runnable=true` |