feat: add production Core runtime modes

This commit is contained in:
thanhnv
2026-07-24 12:16:11 +07:00
parent e359989a74
commit eb3525456f
13 changed files with 659 additions and 397 deletions
+21 -4
View File
@@ -62,10 +62,18 @@ release tooling. Source repository vẫn giữ tests để kiểm chứng chính
### 2. Adopt vào repository hiện hữu
CASAN tách rõ hai quyết định:
| Phạm vi | Ý nghĩa |
|---|---|
| `--level core` (mặc định) | Capability áp dụng cho project: governance Core, không thêm domain-pack/CI |
| `--runtime managed` (mặc định project mới) | Dùng Core global đã pin version/hash; repo nhẹ, nâng cấp tập trung |
| `--runtime vendored` | Copy Core production-only vào `.casan/runtime/casan-core`; phù hợp offline/air-gapped/self-contained |
```bash
cd <project-root>
# Chỉ thêm governance config/hooks; không thêm domain-pack hoặc CI template
# Production mặc định: managed Core
casan init --client claude,codex --mode enforce
casan doctor
@@ -83,8 +91,15 @@ casan init --level core --client claude,codex
casan init --level core --client vscode-copilot --vscode-install yes
casan init --level core --client all
casan init --level devkit --client claude,codex
# Project phải tự chứa Core (offline/air-gapped)
casan init --runtime vendored --client claude,codex
```
Output `init` và `casan level show` luôn hiển thị runtime mode cùng đường dẫn
thực tế. Chạy lại `init` giữ mode hiện tại; chỉ đổi khi truyền rõ
`--runtime managed` hoặc `--runtime vendored`.
Với Codex, sau init phải mở `/hooks`, kiểm tra và trust đúng project hook hash.
### 3. Dùng project bình thường
@@ -148,8 +163,9 @@ flowchart TB
## Cấu trúc cài đặt thực tế
CASAN dùng mô hình hybrid: policy code nằm ở global installation; project chỉ
giữ bootstrap, pin và state riêng.
CASAN mặc định dùng managed runtime: policy code nằm ở global installation,
project giữ bootstrap, pin và state riêng. Với `--runtime vendored`, cùng Core
production-only được đặt tại `.casan/runtime/casan-core`.
```mermaid
flowchart TB
@@ -283,7 +299,8 @@ casan uninstall --remove-vscode-extension
`uninstall` xóa workflow CASAN trong `.gitea`, xóa các scaffold file CASAN còn
nguyên checksum và tự dọn thư mục cha khi đã rỗng. Workflow/file của project,
scaffold file đã chỉnh sửa và `.casan-bak` được giữ lại để tránh mất dữ liệu.
Lệnh cũng không mặc định gỡ VS Code extension dùng chung cho các project khác.
Vendored Core trong `.casan/runtime/casan-core` cũng được xóa. Lệnh không mặc
định gỡ VS Code extension dùng chung cho các project khác.
Khi nâng cấp CASAN: