pan-stack-cli 0.1.5 → 0.2.2

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,217 +1,71 @@
1
1
  # pan-stack-cli
2
2
 
3
- Global CLI for PAN Stack workspaces. Install once, use in any project that has
4
- `.project.yaml`.
3
+ Global CLI for PAN Stack workspaces (`pan`). Cài một lần, dùng mọi project có `.project.yaml`.
4
+
5
+ > **Tài liệu:** [docs/README.md](./docs/README.md) — overview, kiến trúc, tra lệnh đầy đủ.
6
+ > Planning: `btp-csdl-cc/docs/projects/PANCLI/`.
5
7
 
6
8
  ```bash
7
9
  npm i -g pan-stack-cli
8
- # or from source before npm publish:
9
- npm i -g /path/to/pan-stack-cli
10
+ # hoặc từ source:
11
+ npm i -g /path/to/apps/pan-stack-tools/pan-stack-cli
10
12
  ```
11
13
 
12
- ## What is PAN Stack?
13
-
14
- PAN Stack is a **workspace shell** for coding with AI agents — not a monorepo that
15
- contains every product repository. The stack repo holds:
16
-
17
- - Agent skills and prompts (`.claude`, `.cursor`, `.codex`)
18
- - Workspace manifests (`.project.yaml`, `.pan.yaml`)
19
- - Team docs and coordination files
20
-
21
- Product source code lives in separate repositories listed in `.project.yaml`. The
22
- `pan` CLI ties them together: clone all repos, run git ops across the workspace,
23
- and execute project commands defined in `.pan.yaml`.
14
+ ## PAN Stack là gì?
24
15
 
25
- ```text
26
- bookshop-stack/ # PAN Stack workspace (shell)
27
- .project.yaml # Which repos belong to this workspace
28
- .pan.yaml # Workspace-level pan commands
29
- .claude/skills/ # Claude Code skills
30
- .cursor/skills/ # Cursor agent skills
31
- .codex/skills/ # Codex agent skills
32
- apps/
33
- web/ # bookshop-web (cloned product repo)
34
- api/ # bookshop-api (cloned product repo)
35
- ```
16
+ Lớp **điều phối** AI agent stack — skills, manifest, lệnh workspace — **không** chứa toàn bộ source sản phẩm. Repo sản phẩm liệt kê trong `.project.yaml`; `pan clone` kéo về `apps/`.
36
17
 
37
- Run `pan create` to scaffold this layout with the shared `writing-guidelines`
38
- skill pre-installed for all three agent folders.
39
-
40
- ## Requirements
18
+ ## Yêu cầu
41
19
 
42
20
  - Node.js 18+
43
- - Git (for `pan clone`, `pull`, `sync-main`, `fetch`, `push`, `grv`, `gst`)
44
-
45
- ## Windows support
21
+ - Git (Git for Windows + bash cho lệnh `shell:` trong `.pan.yaml`)
46
22
 
47
- Built-in commands (`create`, `clone`, `pull`, `sync-main`, `push`, `fetch`, `grv`, `gst`) run on
48
- Windows, macOS, and Linux. Notes for Windows:
49
-
50
- - `shell:` blocks in `.pan.yaml` run through **bash** on all platforms (Git Bash on
51
- Windows, system bash on macOS/Linux). Use `exec:` for simple one-liners (`npm test`)
52
- when possible; those work without Bash.
53
- - Install **Git for Windows** if bash is not already on `PATH`.
54
- - Set `PAN_PROJECT_ROOTS` with **semicolon** separators (`C:\work\a;C:\work\b`).
55
- Do not use `:` — it conflicts with drive letters.
56
- - Optional: set `PAN_GIT_BASH` to the full path of `bash.exe` if Git is installed in
57
- a non-standard location.
58
-
59
- ## Bootstrap a new workspace
23
+ ## Bootstrap nhanh
60
24
 
61
25
  ```bash
62
26
  mkdir ~/work && cd ~/work
63
- pan create # prompts for folder name
64
- # or
65
- pan create bookshop-stack # non-interactive
66
-
27
+ pan create bookshop-stack
67
28
  cd bookshop-stack
68
- # Edit .project.yaml — replace repo_url_to_be_filled with real URLs
29
+ # Sửa .project.yaml — URL repo thật
69
30
  pan clone
70
- pan install
71
31
  ```
72
32
 
73
- `pan create` fails if the target folder already exists.
74
-
75
- ## Configuration files
33
+ `pan create` cần **registry server** (`PAN_SKILL_REGISTRY_URL`, mặc định `http://localhost:4600`).
76
34
 
77
- Two files drive the CLI. Keep responsibilities separate:
35
+ ## Lệnh built-in (tóm tắt)
78
36
 
79
- | File | Role |
37
+ | Nhóm | Lệnh |
80
38
  |------|------|
81
- | `.project.yaml` | Workspace manifest — lists `repositories` (name, url, path). **No commands.** |
82
- | `.pan.yaml` | `pan` commands — at workspace root and/or inside each child repo |
83
-
84
- ### `.project.yaml` example
85
-
86
- ```yaml
87
- project: bookshop-stack
88
- managed_by: your-team
89
-
90
- stack:
91
- repo: https://github.com/example/bookshop-stack.git
92
-
93
- repositories:
94
- - name: bookshop-web
95
- description: Customer-facing web application
96
- url: https://github.com/example/bookshop-web.git
97
- path: apps/web
98
- - name: bookshop-api
99
- description: REST API service
100
- url: https://github.com/example/bookshop-api.git
101
- path: apps/api
102
- ```
103
-
104
- ### `.pan.yaml` — workspace root
105
-
106
- Orchestration commands. Paths are relative to the workspace root. Use
107
- `PAN_WORKSPACE_ROOT` in shell blocks:
108
-
109
- ```yaml
110
- commands:
111
- install:
112
- alias: i
113
- description: Install dependencies across cloned repositories
114
- shell: |
115
- set -euo pipefail
116
- root="${PAN_WORKSPACE_ROOT}"
117
- for dir in apps/web apps/api; do
118
- [[ -d "$root/$dir" ]] || { echo "Missing: $root/$dir" >&2; exit 1; }
119
- (cd "$root/$dir" && npm install)
120
- done
121
-
122
- test:
123
- default: web
124
- description: Run tests (web | api)
125
- targets:
126
- web:
127
- cwd: apps/web
128
- exec: npm test
129
- api:
130
- cwd: apps/api
131
- exec: npm test
132
- ```
39
+ | Workspace | `create`, `language` / `lang` |
40
+ | Git bulk | `clone`, `pull`, `push`, `fetch`, `checkout`, `mr`, `sync-main`, `gst`, `branch`, `grv` |
41
+ | Git menu | `git` (TTY chọn lệnh) |
42
+ | Agent | `ai`, `skills` |
43
+ | Pan Studio | `ui` (login, clone, sync, …) |
44
+ | Pan Plans | `plan`, `task`, `project`, `usecase`, `testcase`, `decision` |
45
+ | Khác | `serve`, `stats`, `select` |
133
46
 
134
- ### `.pan.yaml` — child repo
47
+ Gõ `pan` không tham số (TTY) → menu chọn project → chọn lệnh.
135
48
 
136
- Place a `.pan.yaml` inside a cloned repo. `cwd` / `exec` are relative to that
137
- repo's root:
49
+ **Tra cứu đầy đủ:** [docs/guides/cli-reference.md](./docs/guides/cli-reference.md) (~870 dòng — options, `.pan.yaml`, Pan Plans, Windows, …).
138
50
 
139
- ```yaml
140
- commands:
141
- dev:
142
- description: Start local dev server
143
- exec: npm run dev
51
+ ## Phát triển local
144
52
 
145
- lint:
146
- shell: |
147
- set -euo pipefail
148
- npm run lint
53
+ ```bash
54
+ cd apps/pan-stack-tools/pan-stack-cli
55
+ npm install
56
+ npm test
57
+ npm run build
58
+ npm link # hoặc npm i -g .
149
59
  ```
150
60
 
151
- Aliases: `alias: i` or `aliases: i, ins` (comma-separated).
152
-
153
- ## Built-in git commands
154
-
155
- Read `repositories` from the nearest `.project.yaml` (walk-up from cwd):
156
-
157
- | Command | Action |
158
- |---------|--------|
159
- | `pan clone` | Clone all repositories in the manifest |
160
- | `pan pull` | Pull all cloned repositories |
161
- | `pan sync-main [repo\|all]` (`pan sm`) | Fetch + merge `origin/main` into current branch (interactive picker; conflict summary) |
162
- | `pan fetch` | Fetch all remotes |
163
- | `pan push` | Push all repos (`-u origin HEAD` by default) |
164
- | `pan grv` | `git remote -v` for workspace + each child repo |
165
- | `pan gst` | `git status` for workspace + each child repo |
166
-
167
- Git options:
168
-
169
- - `--base-dir DIR` — base for relative repo paths (default: directory containing `.project.yaml`)
170
- - `--dry-run` — print commands only
171
- - `[manifest]` — manifest path (default: `.project.yaml`)
172
-
173
- Works from child repo directories — the CLI walks up to find `.project.yaml`.
174
-
175
- ## Project commands
176
-
177
- The CLI loads **all** `.pan.yaml` files in the workspace (root + each
178
- `repositories[].path`). When the same command name appears in multiple repos,
179
- use `--project <name>` or pick interactively.
180
-
181
- ### Environment variables
182
-
183
- | Variable | Meaning |
184
- |----------|---------|
185
- | `PAN_WORKSPACE_ROOT` | Directory containing `.project.yaml` |
186
- | `PAN_REPO_ROOT` | Directory containing the active `.pan.yaml` |
187
- | `PAN_PROJECT_ROOT` | Alias of `PAN_WORKSPACE_ROOT` |
188
- | `PAN_ARG_1`, … | Arguments after the command name |
189
-
190
- ### Registry (optional)
191
-
192
- - `PAN_PROJECT_ROOTS` — extra workspace roots (`;` on Windows, `:` or `;` on Unix)
193
- - `~/.pan/projects` — one workspace root per line
61
+ Chi tiết: [docs/how-to/npm-development.md](./docs/how-to/npm-development.md) · [docs/how-to/npm-release.md](./docs/how-to/npm-release.md).
194
62
 
195
63
  ## Package layout
196
64
 
197
65
  ```text
198
66
  pan-stack-cli/
199
- bin/pan.js # CLI entry
200
- lib/
201
- create.js # pan create scaffold
202
- discover.js # workspace discovery
203
- platform.js # Windows/cross-platform helpers
204
- manifest.js # YAML parsing
205
- run-command.js # command execution
206
- git/ # clone, pull, sync-main, push, fetch, grv, gst
207
- templates/workspace/ # pan create template
208
- references/ # npm publish docs
67
+ ├── bin/pan.js # bundle (esbuild)
68
+ ├── tools/pan-stack-cli/ # core CLI source
69
+ ├── tools/pan-stack-plan/ # Pan Plans
70
+ └── docs/ # tài liệu
209
71
  ```
210
-
211
- ## Local development
212
-
213
- Install globally from source: [references/npm-development.md](references/npm-development.md).
214
-
215
- ## Publish to npm
216
-
217
- See [references/npm-release.md](references/npm-release.md).