@nalvietnam/avatar-cli 3.19.1 → 3.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,14 +1,16 @@
1
1
  # @nalvietnam/avatar-cli
2
2
 
3
- AI harness CLI for NAL Vietnam engineering. Implements the Avatar architecture defined in [`avatar-cli-implementation_4.html`](../init-doc/avatar-cli-implementation_4.html).
3
+ AI harness CLI for NAL Vietnam engineering. Kiến trúc v3 (multi-repo workspace + pack tarball qua Supabase) mô tả trong [`docs/avatar-v3-multi-repo-architecture-and-pack-distribution.html`](docs/avatar-v3-multi-repo-architecture-and-pack-distribution.html).
4
4
 
5
5
  ## v3 — Trạng thái hiện tại
6
6
 
7
7
  avatar-cli v3 mang 3 thay đổi lớn:
8
8
 
9
- - **Pack distribution qua Supabase tarball** — pack tải dưới dạng tarball ký số từ
10
- edge function `get-pack` (signed URL, xác thực `id_token` Google NAL), giải nén
11
- vào `.claude/pack/`. Không còn git submodule.
9
+ - **Pack distribution qua Supabase tarball** — pack tải dưới dạng tarball từ edge
10
+ function `get-pack` (signed URL, xác thực `id_token` Google NAL), giải nén vào
11
+ `.claude/pack/`. Toàn vẹn kiểm bằng **SHA-256 soft-verify**: CLI so digest tarball
12
+ tải về với digest backend trả — backend chưa trả digest thì CLI **cảnh báo rồi bỏ
13
+ qua verify, pack vẫn cài** (không phải chữ ký số, không chặn cài). Không còn git submodule.
12
14
  - **Multi-repo workspace** — 1 workspace chứa nhiều repo code trong `src/<name>`
13
15
  (thêm bằng `avatar add repo`).
14
16
  - **Google SSO login** — `avatar login` (workspace `@nal.vn` / `nal-software.com`).
@@ -34,7 +36,7 @@ npm install -g @nalvietnam/avatar-cli
34
36
 
35
37
  ```bash
36
38
  avatar --help # liệt kê toàn bộ 20 commands
37
- avatar --version # 3.17.0
39
+ avatar --version # ví dụ output — nguồn sự thật là package.json
38
40
 
39
41
  # Lần đầu — đăng nhập Google SSO (workspace @nal.vn / nal-software.com)
40
42
  avatar login
@@ -105,14 +107,28 @@ avatar-cli/
105
107
 
106
108
  ## Google OAuth setup
107
109
 
108
- Client ID và Client Secret được hardcode trong `src/lib/google-oauth-device-flow.ts`.
110
+ **Client Secret KHÔNG nằm trong CLI.** Từ **v3.16.0**, mọi call OAuth (device code / poll /
111
+ refresh / revoke) đi qua Edge Function `auth-device` trên `avatar-supabase`; secret lưu ở
112
+ Supabase secrets `NAL_GOOGLE_CLIENT_SECRET`, CLI không bao giờ thấy nó.
113
+
114
+ Thứ **có** trong `src/lib/google-oauth-device-flow.ts` là **Client ID** — đây là public
115
+ identifier, không phải secret. CLI giữ nó để verify claim `aud` của `id_token`.
109
116
 
110
117
  OAuth Client tạo trong Google Cloud Console:
111
118
  - Project: `avatar-cli`
112
119
  - Application type: **TV and Limited Input devices**
113
120
  - Hosted domain: `nal.vn` và `nal-software.com` (2 Google Workspace riêng biệt, đều được chấp nhận — xem `ALLOWED_HOSTED_DOMAINS`)
114
121
 
115
- Rotate secret: Console → APIs & Services → Credentials → OAuth client → Reset Secret → cập nhật `GOOGLE_CLIENT_SECRET` trong source.
122
+ **Rotate secret** = việc server-side, KHÔNG cần release CLI:
123
+
124
+ ```bash
125
+ # Console → APIs & Services → Credentials → OAuth client → Reset Secret
126
+ supabase secrets set NAL_GOOGLE_CLIENT_SECRET=<secret-mới>
127
+ ```
128
+
129
+ Nếu đổi hẳn OAuth client trên Console: cập nhật Client ID trong
130
+ `src/lib/google-oauth-device-flow.ts` **và** cả 2 secrets `NAL_GOOGLE_CLIENT_ID` /
131
+ `NAL_GOOGLE_CLIENT_SECRET` phía Supabase.
116
132
 
117
133
  ## Dev workflow
118
134
 
@@ -125,6 +141,6 @@ npm run build # production bundle vào dist/
125
141
 
126
142
  ## Liên quan
127
143
 
128
- - Blueprint kiến trúc: [`../init-doc/avatar-blueprint-v1_10.html`](../init-doc/avatar-blueprint-v1_10.html)
129
- - Implementation spec: [`../init-doc/avatar-cli-implementation_4.html`](../init-doc/avatar-cli-implementation_4.html)
130
- - Knowledge pack: [`../team-ai-pack/`](../team-ai-pack/) — tải dưới dạng tarball ký số từ Supabase edge function `get-pack` (signed URL, xác thực `id_token` Google NAL) khi `avatar init` / `avatar sync`, giải nén vào `.claude/pack/`
144
+ - Kiến trúc v3 (multi-repo + pack distribution): [`docs/avatar-v3-multi-repo-architecture-and-pack-distribution.html`](docs/avatar-v3-multi-repo-architecture-and-pack-distribution.html)
145
+ - Tham chiếu lệnh: [`docs/avatar-cli-commands-reference.html`](docs/avatar-cli-commands-reference.html)
146
+ - Knowledge pack: [`../team-ai-pack/`](../team-ai-pack/) — tải dưới dạng tarball từ Supabase edge function `get-pack` (signed URL, xác thực `id_token` Google NAL, SHA-256 soft-verify) khi `avatar init` / `avatar sync`, giải nén vào `.claude/pack/`