@nalvietnam/avatar-cli 1.0.0
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 +104 -0
- package/bin/avatar.js +4 -0
- package/dist/index.js +1025 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
- package/src/hooks/post-merge.sh.tpl +24 -0
- package/src/hooks/pre-push.sh.tpl +33 -0
- package/src/templates/CLAUDE.md.tpl +40 -0
- package/src/templates/gitignore.tpl +4 -0
- package/src/templates/project/architecture.md.tpl +27 -0
- package/src/templates/project/conventions.md.tpl +27 -0
- package/src/templates/project/domain.md.tpl +23 -0
- package/src/templates/project/gotchas.md.tpl +28 -0
- package/src/templates/project/tech-stack.md.tpl +32 -0
- package/src/templates/settings.json.tpl +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# @nalvietnam/avatar-cli
|
|
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).
|
|
4
|
+
|
|
5
|
+
## Cài đặt
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Local development (clone repo)
|
|
9
|
+
cd avatar-cli
|
|
10
|
+
npm install
|
|
11
|
+
npm run build
|
|
12
|
+
npm link # makes `avatar` available globally pointing at this checkout
|
|
13
|
+
|
|
14
|
+
# Sau này khi đã publish:
|
|
15
|
+
npm install -g @nalvietnam/avatar-cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Sử dụng
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
avatar --help # liệt kê toàn bộ 13 commands
|
|
22
|
+
avatar --version # 1.0.0
|
|
23
|
+
|
|
24
|
+
# Lần đầu — đăng nhập Google SSO (workspace @nal.vn)
|
|
25
|
+
avatar login
|
|
26
|
+
|
|
27
|
+
# Khởi tạo Avatar trong dự án
|
|
28
|
+
avatar init # interactive wizard
|
|
29
|
+
avatar init --mode=internal # NAL nội bộ — files commit cùng code
|
|
30
|
+
avatar init --mode=client \
|
|
31
|
+
--client-repo=git@github.com:org/client-repo.git \
|
|
32
|
+
--workspace-name=avatar-client-workspace
|
|
33
|
+
|
|
34
|
+
# Snapshot
|
|
35
|
+
avatar status
|
|
36
|
+
|
|
37
|
+
# Chẩn đoán
|
|
38
|
+
avatar doctor
|
|
39
|
+
avatar doctor --fix
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Trạng thái implement
|
|
43
|
+
|
|
44
|
+
| Command | Trạng thái | Milestone |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `login` | ✅ implement thật (Google OAuth Device Flow) | 03 |
|
|
47
|
+
| `init` (3 mode) | ✅ implement thật | 05 + 07 |
|
|
48
|
+
| `status` | ✅ implement thật | 08 |
|
|
49
|
+
| `doctor` | ✅ implement thật | 08 |
|
|
50
|
+
| `sync` | ⏳ stub | 08 |
|
|
51
|
+
| `scan` | ⏳ stub (5 scanner cũng stub) | 06 |
|
|
52
|
+
| `review` | ⏳ stub | 08 |
|
|
53
|
+
| `restore` | ⏳ stub | 08 |
|
|
54
|
+
| `commit` | ⏳ stub | 07 |
|
|
55
|
+
| `tools list/install/remove` | ⏳ stub | 09 |
|
|
56
|
+
| `secrets list/set/get/rm/check` | ⏳ stub | 09 |
|
|
57
|
+
| `mcp-run` (hidden) | ⏳ stub | 09 |
|
|
58
|
+
|
|
59
|
+
## Cấu trúc thư mục
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
avatar-cli/
|
|
63
|
+
├── bin/avatar.js # Shebang entry, loads dist/index.js
|
|
64
|
+
├── src/
|
|
65
|
+
│ ├── index.ts # Bootstrap commander + register 13 commands
|
|
66
|
+
│ ├── commands/ # 1 file per CLI subcommand
|
|
67
|
+
│ ├── scanners/ # 5 project scanners (stub)
|
|
68
|
+
│ ├── lib/ # Utilities: oauth, git, fs, templates, ...
|
|
69
|
+
│ ├── hooks/ # post-merge + pre-push shell templates
|
|
70
|
+
│ ├── templates/ # CLAUDE.md, settings.json, project knowledge
|
|
71
|
+
│ └── types/ # Zod schemas
|
|
72
|
+
├── test/ # vitest suites (TBD)
|
|
73
|
+
├── package.json
|
|
74
|
+
├── tsconfig.json
|
|
75
|
+
├── tsup.config.ts
|
|
76
|
+
├── biome.json
|
|
77
|
+
└── vitest.config.ts
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Google OAuth setup
|
|
81
|
+
|
|
82
|
+
Client ID và Client Secret được hardcode trong `src/lib/google-oauth-device-flow.ts`.
|
|
83
|
+
|
|
84
|
+
OAuth Client tạo trong Google Cloud Console:
|
|
85
|
+
- Project: `avatar-cli`
|
|
86
|
+
- Application type: **TV and Limited Input devices**
|
|
87
|
+
- Hosted domain: `nal.vn`
|
|
88
|
+
|
|
89
|
+
Rotate secret: Console → APIs & Services → Credentials → OAuth client → Reset Secret → cập nhật `GOOGLE_CLIENT_SECRET` trong source.
|
|
90
|
+
|
|
91
|
+
## Dev workflow
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm run dev # tsup --watch
|
|
95
|
+
npm run test # vitest
|
|
96
|
+
npm run lint # biome check
|
|
97
|
+
npm run build # production bundle vào dist/
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Liên quan
|
|
101
|
+
|
|
102
|
+
- Blueprint kiến trúc: [`../init-doc/avatar-blueprint-v1_10.html`](../init-doc/avatar-blueprint-v1_10.html)
|
|
103
|
+
- Implementation spec: [`../init-doc/avatar-cli-implementation_4.html`](../init-doc/avatar-cli-implementation_4.html)
|
|
104
|
+
- Knowledge pack: [`../team-ai-pack/`](../team-ai-pack/) (sẽ là `github.com:LukeNALS/team-ai-pack.git` submodule khi `avatar init`)
|
package/bin/avatar.js
ADDED