@piagent/platform 1.0.0 → 1.0.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/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  This file records release-facing changes for Pi Agent Platform. Copy the relevant version block into GitHub Releases when publishing a tag.
4
4
 
5
+ ## v1.0.2 - 2026-07-25
6
+
7
+ Install and uninstall become two commands each. The five-command sequence was never the shortest path; it was the only one that produced a project configuration a teammate could use.
8
+
9
+ ### Added
10
+
11
+ - Added `piagent-uninstall`, which removes the Pi package this platform registered and nothing else. It reports by default and only acts on `--apply`, matching how install and migration already work. `--with-addons` also removes the pinned add-ons, `--with-host` the Pi host, and `--project <path>` a project's profile, lock, and runtime state. It recognises every source shape the platform has been installed as, including installs from before the namespace rename, so an old registration still comes out. Credentials, trust decisions, sessions, todos, and project memory are never removed at any flag combination; files written from templates and then edited are reported rather than deleted, and only the entry pointing at this platform is dropped from a project's `.pi/settings.json`.
12
+
13
+ ### Fixed
14
+
15
+ - `piagent-setup` running from an installed package now writes `npm:@piagent/platform@<version>` into project settings instead of the directory it happens to be installed in. Project settings are meant to be committed, and an install path means nothing on a teammate's machine. A working checkout has no published identity to point at, so it still falls back to the local path and still says so.
16
+
17
+ ### Changed
18
+
19
+ - Documentation now leads with `npm install -g @piagent/platform` followed by `piagent-setup`, which installs the pinned Pi host itself. The five-command sequence remains, described as the explicit path for a reviewed team rollout rather than as the only way in.
20
+
21
+ ## v1.0.1 - 2026-07-25
22
+
23
+ Documentation release. v1.0.0 reached the npm registry but no document told anyone it was there, so every install instruction still pointed at the Git source.
24
+
25
+ ### Changed
26
+
27
+ - The terminal helper now installs from the registry: `npm install -g --ignore-scripts @piagent/platform@1.0.1`. This replaces the `github:Vt-mmm/piagent#vX.Y.Z` form in the README, the docs site, and every install, update, and rollback flow. Installing from Git still works and produces the same files; the registry path additionally carries a provenance attestation npm can verify.
28
+ - Added an `npm` release channel with a real source, and narrowed `enterprise-npm` to what it actually describes: a fork published under a different scope.
29
+ - Recorded why `stable` still resolves the Pi package to a commit SHA rather than an npm version. Tag-to-SHA resolution is checked against `PIAGENT_EXPECTED_RELEASE_COMMIT`, and a registry version range cannot express that check, so pointing `stable` at npm would remove it rather than replace it.
30
+ - Aligned `repository.url` in both manifests with the form npm stores. Publishing rewrote the field and warned, which left the manifest in the repository disagreeing with the manifest on the registry.
31
+
5
32
  ## v1.0.0 - 2026-07-25
6
33
 
7
34
  Breaking release. The `company` namespace is replaced by `piagent` with no alias layer, and `apiVersion` becomes a stable contract. Existing projects convert their local state with one migration command; both names never work at once.
package/README.md CHANGED
@@ -109,22 +109,33 @@ Supported for this release:
109
109
  | Native Windows | Not a team-rollout target yet; terminal helpers and shell policy rely on Bash/POSIX semantics. |
110
110
  | WSL2 | Experimental and not release-gated yet. |
111
111
 
112
- Node.js `>=22.19.0` and Pi Coding Agent `0.81.1` are required. Pi Coding Agent is installed as a Node CLI; the project release matrix above defines which OS/CPU surfaces this platform has verified.
112
+ Node.js `>=22.19.0` is required. Two commands:
113
+
114
+ ```bash
115
+ npm install -g @piagent/platform
116
+ piagent-setup
117
+ ```
118
+
119
+ `piagent-setup` installs the exact Pi Coding Agent host this release pins, installs the Pi package, initializes the current directory, and runs the doctor. Run it from the project you want to set up. It also installs the MCP baseline and subagents; pass `--no-mcp` and `--no-subagents` to skip them, or `--global-only` to install nothing into a project.
120
+
121
+ Because it is running from an installed package, the source it writes into `.pi/settings.json` is `npm:@piagent/platform@<version>`, which means the same thing on a teammate's machine.
122
+
123
+ To install each component explicitly instead — for a pinned team rollout where every step is reviewed:
113
124
 
114
125
  ```bash
115
126
  node --version # >= 22.19.0
116
127
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
117
- npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
128
+ npm install -g --ignore-scripts @piagent/platform@1.0.2
118
129
  piagent-install --stable --dry-run
119
130
  piagent-install --stable
120
131
  ```
121
132
 
122
- The npm command installs the `piagent-*` terminal helpers. `piagent-install --stable` then resolves the helper's release tag to a commit SHA and installs the matching Pi package. In its output, `currentRelease` is the version of the terminal helper currently executing.
133
+ `piagent-install --stable` resolves the helper's release tag to a commit SHA and installs the matching Pi package. In its output, `currentRelease` is the version of the terminal helper currently executing. The project release matrix above defines which OS/CPU surfaces this platform has verified.
123
134
 
124
135
  If you only need to install the Pi package and do not need the `piagent-*` terminal commands, pin the current release tag or a reviewed commit directly:
125
136
 
126
137
  ```bash
127
- pi install git:github.com/Vt-mmm/piagent@v1.0.0
138
+ pi install git:github.com/Vt-mmm/piagent@v1.0.2
128
139
  ```
129
140
 
130
141
  From a checked-out platform repo, the same helper is available as a script:
@@ -138,7 +149,7 @@ For a full update, update the exact Pi host first, then the npm-global helper, t
138
149
 
139
150
  ```bash
140
151
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
141
- npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z
152
+ npm install -g --ignore-scripts @piagent/platform@X.Y.Z
142
153
  piagent-install --stable --dry-run
143
154
  piagent-install --stable
144
155
  ```
@@ -163,6 +174,28 @@ Optional Herdr integration:
163
174
  herdr integration install pi
164
175
  ```
165
176
 
177
+ ## Uninstall
178
+
179
+ `piagent-uninstall` reports what it would remove and exits. It only acts with `--apply`, because it edits Pi settings that other tools also write to.
180
+
181
+ ```bash
182
+ piagent-uninstall
183
+ piagent-uninstall --apply
184
+ ```
185
+
186
+ That removes the Pi package this platform registered. Everything beyond it is opt-in:
187
+
188
+ ```bash
189
+ piagent-uninstall --apply --with-addons # pi-mcp-adapter, pi-subagents, pi-web-access
190
+ piagent-uninstall --apply --with-host # the Pi Coding Agent host
191
+ piagent-uninstall --apply --project /path/to/project # a project's profile, lock, and runtime state
192
+ npm uninstall -g @piagent/platform # the npm-global helper, removed separately
193
+ ```
194
+
195
+ Removal targets what is registered in Pi's settings rather than what the current version installs, so a package registered by an older release still comes out.
196
+
197
+ Credentials, trust decisions, sessions, todos, and project memory are never removed, at any flag combination. Files written from a template and then edited — `AGENTS.md`, `.pi/settings.json`, `.pi/project-context.md` and the like — are listed for review rather than deleted. A project's `.pi/settings.json` keeps every setting except the package entry pointing at this platform.
198
+
166
199
  ## Daily use
167
200
 
168
201
  ```bash
@@ -423,7 +456,7 @@ Most projects do not need shell init. Use this only when you want to pre-create
423
456
  ```bash
424
457
  bash /path/to/piagent/scripts/setup.sh /path/to/project \
425
458
  --profile be-readonly-fe \
426
- --package-source git:github.com/Vt-mmm/piagent@v1.0.0 \
459
+ --package-source git:github.com/Vt-mmm/piagent@v1.0.2 \
427
460
  --mcp-preset core \
428
461
  --subagents-preset safe
429
462
  ```
@@ -538,7 +571,7 @@ This repository intentionally excludes:
538
571
 
539
572
  ## Maturity
540
573
 
541
- The current package version is read from package metadata and release tags. Personal machines may follow the unpinned package source when accepting ongoing updates; production/team quickstarts and committed project settings should pin an explicit tag such as `v1.0.0` or a reviewed commit.
574
+ The current package version is read from package metadata and release tags. Personal machines may follow the unpinned package source when accepting ongoing updates; production/team quickstarts and committed project settings should pin an explicit tag such as `v1.0.2` or a reviewed commit.
542
575
 
543
576
  Ready for:
544
577
 
@@ -380,10 +380,10 @@ Các lệnh này chạy ngoài Pi.
380
380
  | Command | Dùng khi nào |
381
381
  |---|---|
382
382
  | `npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1` | Cài Pi CLI tương thích với release hiện tại. |
383
- | `npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
384
- | `pi install git:github.com/Vt-mmm/piagent@v1.0.0` | Cài pinned release khi cần reproducible team setup. |
383
+ | `npm install -g --ignore-scripts @piagent/platform@1.0.2` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
384
+ | `pi install git:github.com/Vt-mmm/piagent@v1.0.2` | Cài pinned release khi cần reproducible team setup. |
385
385
  | `pi install git:github.com/Vt-mmm/piagent` | Cài latest package platform cho máy cá nhân/sandbox. |
386
- | Cài exact Pi host của release, rồi `npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z` và `piagent-install --stable` | Full update: đồng bộ host, npm-global helper và Pi package. v1.0.0 yêu cầu Pi `0.81.1`. |
386
+ | Cài exact Pi host của release, rồi `npm install -g --ignore-scripts @piagent/platform@X.Y.Z` và `piagent-install --stable` | Full update: đồng bộ host, npm-global helper và Pi package. v1.0.2 yêu cầu Pi `0.81.1`. |
387
387
  | Cài exact Pi host ghi trong release cũ, rồi helper `vPREVIOUS` và `piagent-install --stable` | Full rollback; đánh giá dependency risk của host cũ trước khi hạ version. |
388
388
  | `piagent-install --stable --dry-run` | Preview Pi package matching với helper hiện tại; stable resolve tag → commit SHA. |
389
389
  | `piagent-install --stable` | Cài Pi package matching với helper hiện tại bằng resolved commit SHA. |
@@ -410,6 +410,10 @@ Các lệnh này chạy ngoài Pi.
410
410
  | `piagent-setup <project> --with-web-access` | Setup project + optional web access cho research subagents. |
411
411
  | `piagent-usage /path/to/project` | Lấy exact session usage từ terminal khác. |
412
412
  | `piagent-doctor /path/to/project --strict-share` | Kiểm tra project có share/open-source được không. |
413
+ | `piagent-uninstall` | Báo cáo những gì sẽ được gỡ. Dry run, không đụng gì. |
414
+ | `piagent-uninstall --apply` | Gỡ Pi package của platform khỏi Pi settings global. |
415
+ | `piagent-uninstall --apply --with-addons --with-host` | Gỡ thêm pi-mcp-adapter, pi-subagents, pi-web-access và Pi host. |
416
+ | `piagent-uninstall --apply --project /path/to/project` | Gỡ thêm state của platform trong project: profile, lock, `piagent-state/`. |
413
417
  | `piagent-benchmark ...` | Ghi quality benchmark bằng package bin. |
414
418
  | `bash scripts/verify-local.sh` | Verify repo platform trước khi commit/tag. |
415
419
  | `bash scripts/verify-local.sh --offline` | Verify trong CI/máy sạch, bỏ qua local Pi model catalog. |
@@ -14,9 +14,10 @@ Repo này phải chạy được cho nhiều project/domain khác nhau. Vì vậ
14
14
 
15
15
  | Use case | Package source |
16
16
  |---|---|
17
- | Team pinned release | `git:github.com/Vt-mmm/piagent@v1.0.0` |
17
+ | Team pinned release | `git:github.com/Vt-mmm/piagent@v1.0.2` |
18
18
  | Personal/sandbox dev | `git:github.com/Vt-mmm/piagent` |
19
- | Enterprise npm | `npm:@your-scope/platform@x.y.z` |
19
+ | Registry distribution | `npm:@piagent/platform@1.0.2` |
20
+ | Enterprise npm (fork under another scope) | `npm:@your-scope/platform@x.y.z` |
20
21
  | Local platform dev | `/path/to/piagent` |
21
22
 
22
23
  Latest tiện cho máy cá nhân muốn nhận cập nhật nhanh. Pin tag/commit cho `.pi/settings.json` trong project nghiêm túc để tránh workflow đổi bất ngờ giữa các developer.
@@ -25,7 +26,7 @@ Latest tiện cho máy cá nhân muốn nhận cập nhật nhanh. Pin tag/commi
25
26
 
26
27
  | Channel | Command | Target | Policy |
27
28
  |---|---|---|---|
28
- | `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.0.0` | Install the Pi package matching the helper. |
29
+ | `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.0.2` | Install the Pi package matching the helper. |
29
30
  | `exact` | `bash scripts/install-global.sh --version vX.Y.Z --resolve-tag` | Requested tag resolved to commit SHA | Pi-package-only rollout, rollback, and incident recovery. |
30
31
  | `dev` | `bash scripts/install-global.sh --dev` | Moving Git source | Personal/sandbox only; do not commit into project settings. |
31
32
  | `local` | `bash scripts/install-global.sh --local` | Current checkout path | Platform development only. |
@@ -52,7 +53,7 @@ Root `package.json` có `pi` manifest trỏ tới:
52
53
  Do đó team có thể:
53
54
 
54
55
  ```bash
55
- pi install git:github.com/Vt-mmm/piagent@v1.0.0
56
+ pi install git:github.com/Vt-mmm/piagent@v1.0.2
56
57
  ```
57
58
 
58
59
  Không cần biết internal folder `packages/piagent-core`. Source không pin chỉ dành cho personal/sandbox như bảng channel ở trên.
@@ -64,12 +65,12 @@ Team nên install global package một lần:
64
65
  ```bash
65
66
  node --version # >= 22.19.0
66
67
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
67
- npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
68
+ npm install -g --ignore-scripts @piagent/platform@1.0.2
68
69
  piagent-install --stable --dry-run
69
70
  piagent-install --stable
70
71
  ```
71
72
 
72
- `pi install git:github.com/Vt-mmm/piagent@v1.0.0` vẫn hợp lệ nếu chỉ cần cài Pi package. Lệnh đó không tự tạo các binary terminal `piagent-*`; muốn có helper global thì dùng `npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0`.
73
+ `pi install git:github.com/Vt-mmm/piagent@v1.0.2` vẫn hợp lệ nếu chỉ cần cài Pi package. Lệnh đó không tự tạo các binary terminal `piagent-*`; muốn có helper global thì dùng `npm install -g --ignore-scripts @piagent/platform@1.0.2`.
73
74
 
74
75
  Support matrix hiện tại: macOS Apple Silicon + Bash và Linux x64 + Bash đã được verify; macOS Intel + Bash và Linux ARM64 + Bash là supported target cần chạy smoke trước rollout; native Windows chưa phải target rollout team; WSL2 experimental. Chi tiết và version runtime nằm trong [release/install policy](release-install-policy.md).
75
76
 
@@ -102,7 +103,7 @@ Nếu muốn commit sẵn `.pi/piagent-profile.json` vào repo hoặc bootstrap
102
103
  ```bash
103
104
  bash scripts/setup.sh /path/to/project \
104
105
  --profile be-readonly-fe \
105
- --package-source git:github.com/Vt-mmm/piagent@v1.0.0 \
106
+ --package-source git:github.com/Vt-mmm/piagent@v1.0.2 \
106
107
  --mcp-preset core \
107
108
  --subagents-preset safe
108
109
  ```
@@ -175,7 +176,7 @@ Full platform update phải đồng bộ Pi host, npm-global helper và Pi packa
175
176
 
176
177
  ```bash
177
178
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
178
- npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z
179
+ npm install -g --ignore-scripts @piagent/platform@X.Y.Z
179
180
  piagent-install --stable --dry-run
180
181
  piagent-install --stable
181
182
  piagent-doctor /path/to/project --strict-share
@@ -186,7 +187,7 @@ Full rollback dùng cùng flow với target trước đó. Lấy exact host vers
186
187
  ```bash
187
188
  TARGET_PI_VERSION=x.y.z
188
189
  npm install -g --ignore-scripts "@earendil-works/pi-coding-agent@$TARGET_PI_VERSION"
189
- npm install -g --ignore-scripts github:Vt-mmm/piagent#vPREVIOUS
190
+ npm install -g --ignore-scripts @piagent/platform@PREVIOUS
190
191
  piagent-install --stable --dry-run
191
192
  piagent-install --stable
192
193
  piagent-doctor /path/to/project --strict-share
@@ -18,12 +18,12 @@ Support matrix release hiện tại: macOS Apple Silicon + Bash và Linux x64 +
18
18
  ```bash
19
19
  node --version # >= 22.19.0
20
20
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
21
- npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
21
+ npm install -g --ignore-scripts @piagent/platform@1.0.2
22
22
  piagent-install --stable --dry-run
23
23
  piagent-install --stable
24
24
  ```
25
25
 
26
- Khi seed `.pi/settings.json` cho team/repo cần audit lặp lại, giữ package source dạng pinned tag như `git:github.com/Vt-mmm/piagent@v1.0.0`. Máy cá nhân có thể dùng `git:github.com/Vt-mmm/piagent` để theo latest.
26
+ Khi seed `.pi/settings.json` cho team/repo cần audit lặp lại, giữ package source dạng pinned tag như `git:github.com/Vt-mmm/piagent@v1.0.2`. Máy cá nhân có thể dùng `git:github.com/Vt-mmm/piagent` để theo latest.
27
27
 
28
28
  Nếu đang ở source checkout của platform, dùng helper theo channel để preview trước khi đổi:
29
29
 
@@ -38,7 +38,7 @@ Full update phải đồng bộ exact Pi host trước, rồi npm-global helper
38
38
 
39
39
  ```bash
40
40
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
41
- npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z
41
+ npm install -g --ignore-scripts @piagent/platform@X.Y.Z
42
42
  piagent-install --stable --dry-run
43
43
  piagent-install --stable
44
44
  piagent-doctor /path/to/project --strict-share
@@ -99,7 +99,7 @@ install package once
99
99
 
100
100
  ```bash
101
101
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
102
- npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
102
+ npm install -g --ignore-scripts @piagent/platform@1.0.2
103
103
  piagent-install --stable --dry-run
104
104
  piagent-install --stable
105
105
  ```
@@ -269,7 +269,7 @@ Không phải daily default. Dùng khi muốn tạo sẵn `.pi` files cho projec
269
269
  bash /path/to/piagent/scripts/setup.sh /path/to/project \
270
270
  --project-only \
271
271
  --profile auto \
272
- --package-source git:github.com/Vt-mmm/piagent@v1.0.0 \
272
+ --package-source git:github.com/Vt-mmm/piagent@v1.0.2 \
273
273
  --mcp-preset core \
274
274
  --subagents-preset safe
275
275
  ```
@@ -842,11 +842,15 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
842
842
 
843
843
  | Command | Dùng để |
844
844
  |---|---|
845
- | `npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
846
- | `pi install git:github.com/Vt-mmm/piagent@v1.0.0` | Install pinned release cho reproducible team setup. |
845
+ | `npm install -g --ignore-scripts @piagent/platform@1.0.2` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
846
+ | `pi install git:github.com/Vt-mmm/piagent@v1.0.2` | Install pinned release cho reproducible team setup. |
847
847
  | `pi install git:github.com/Vt-mmm/piagent` | Install latest platform package cho máy cá nhân/sandbox. |
848
- | Cài exact Pi host của release, rồi `npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z` và `piagent-install --stable` | Full update: đồng bộ host, terminal helper và Pi package. v1.0.0 yêu cầu Pi `0.81.1`. |
848
+ | Cài exact Pi host của release, rồi `npm install -g --ignore-scripts @piagent/platform@X.Y.Z` và `piagent-install --stable` | Full update: đồng bộ host, terminal helper và Pi package. v1.0.2 yêu cầu Pi `0.81.1`. |
849
849
  | Cài exact Pi host ghi trong release cũ, rồi helper `vPREVIOUS` và `piagent-install --stable` | Full rollback; đánh giá lại dependency findings của host cũ trước khi hạ version. |
850
+ | `piagent-uninstall` | Báo cáo sẽ gỡ những gì. Dry run, không đụng gì. |
851
+ | `piagent-uninstall --apply` | Gỡ Pi package của platform khỏi Pi settings global. |
852
+ | `piagent-uninstall --apply --with-addons --with-host` | Gỡ thêm add-on đã pin và Pi host. |
853
+ | `piagent-uninstall --apply --project <path>` | Gỡ thêm profile, lock và `piagent-state/` của project. Không đụng credential, trust, session, todo, `.pi/memory/`. |
850
854
  | `piagent-install --stable --dry-run` | Preview Pi package matching với helper hiện tại; stable resolve tag → commit SHA. |
851
855
  | `piagent-install --stable` | Apply Pi package matching với helper hiện tại bằng resolved commit SHA. |
852
856
  | `piagent-install --version vX.Y.Z --resolve-tag` | Chỉ đổi Pi package; terminal helper giữ nguyên version. |
@@ -936,7 +940,7 @@ Mở lại Pi session sau khi install.
936
940
  Cài lại terminal helper đúng release rồi kiểm tra `PATH`:
937
941
 
938
942
  ```bash
939
- npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
943
+ npm install -g --ignore-scripts @piagent/platform@1.0.2
940
944
  command -v piagent-install
941
945
  ```
942
946
 
@@ -42,7 +42,7 @@ pi install /path/to/piagent
42
42
 
43
43
  - `0.1.x`: local/internal pilot.
44
44
  - `0.2.x`: có guard ổn định và docs team.
45
- - `1.0.0`: đủ security review, MCP registry, adapter schema versioned.
45
+ - `1.0.2`: đủ security review, MCP registry, adapter schema versioned.
46
46
 
47
47
  ## Không publish
48
48
 
@@ -26,22 +26,33 @@ Support matrix của release hiện tại:
26
26
  | Native Windows | Chưa phải target rollout team; helper/shell policy cần Bash/POSIX semantics. |
27
27
  | WSL2 | Experimental, chưa release-gate. |
28
28
 
29
- Node.js phải từ `22.19.0` trở lên và Pi Coding Agent phải là `0.81.1`.
29
+ Node.js phải từ `22.19.0` trở lên. Hai lệnh:
30
+
31
+ ```bash
32
+ npm install -g @piagent/platform
33
+ piagent-setup
34
+ ```
35
+
36
+ Chạy `piagent-setup` ngay trong thư mục project. Nó tự cài đúng Pi Coding Agent `0.81.1` mà release này pin, cài Pi package, khởi tạo `.pi/`, rồi chạy doctor. Nó cũng cài MCP baseline và subagents; thêm `--no-mcp`, `--no-subagents` nếu không cần, hoặc `--global-only` nếu chưa muốn đụng project nào.
37
+
38
+ Vì chạy từ package đã cài, source ghi vào `.pi/settings.json` là `npm:@piagent/platform@<version>` — portable, commit được.
39
+
40
+ Muốn cài tay từng lớp để kiểm soát chặt hơn:
30
41
 
31
42
  ```bash
32
43
  node --version # >= 22.19.0
33
44
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
34
- npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
45
+ npm install -g --ignore-scripts @piagent/platform@1.0.2
35
46
  piagent-install --stable --dry-run
36
47
  piagent-install --stable
37
48
  ```
38
49
 
39
- Lệnh trên cài Pi CLI, cài terminal command `piagent-*`, rồi install Pi Agent Platform bằng stable release đã resolve tag thành commit SHA. Trong output installer, `currentRelease` là version của terminal helper đang chạy. `v1.0.0` là release hiện tại của docs này.
50
+ Lệnh trên cài Pi CLI, cài terminal command `piagent-*`, rồi install Pi Agent Platform bằng stable release đã resolve tag thành commit SHA. Trong output installer, `currentRelease` là version của terminal helper đang chạy. `v1.0.2` là release hiện tại của docs này.
40
51
 
41
52
  Nếu chỉ cần cài package vào Pi và không cần terminal command helper:
42
53
 
43
54
  ```bash
44
- pi install git:github.com/Vt-mmm/piagent@v1.0.0
55
+ pi install git:github.com/Vt-mmm/piagent@v1.0.2
45
56
  ```
46
57
 
47
58
  Nếu đang ở source checkout của platform, có thể preview và áp stable bằng helper:
@@ -57,7 +68,7 @@ Khi update toàn bộ platform, cập nhật exact Pi host trước rồi dùng
57
68
 
58
69
  ```bash
59
70
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
60
- npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z
71
+ npm install -g --ignore-scripts @piagent/platform@X.Y.Z
61
72
  piagent-install --stable --dry-run
62
73
  piagent-install --stable
63
74
  ```
@@ -218,7 +229,7 @@ Nếu chưa có profile/tech stack, dùng select-style flow để tránh agent t
218
229
  bash /path/to/piagent/scripts/setup.sh /path/to/project \
219
230
  --project-only \
220
231
  --profile auto \
221
- --package-source git:github.com/Vt-mmm/piagent@v1.0.0 \
232
+ --package-source git:github.com/Vt-mmm/piagent@v1.0.2 \
222
233
  --mcp-preset core \
223
234
  --subagents-preset safe
224
235
  ```
@@ -241,7 +252,7 @@ Script bash chỉ dùng khi muốn preseed config vào repo:
241
252
  ```bash
242
253
  bash /path/to/piagent/scripts/setup.sh /path/to/project \
243
254
  --profile be-readonly-fe \
244
- --package-source git:github.com/Vt-mmm/piagent@v1.0.0 \
255
+ --package-source git:github.com/Vt-mmm/piagent@v1.0.2 \
245
256
  --mcp-preset core \
246
257
  --subagents-preset safe
247
258
  ```
@@ -340,6 +351,28 @@ bash "$PIAGENT_PLATFORM_HOME/packages/piagent-core/skills/piagent-source-cache/c
340
351
 
341
352
  Các việc này là credential/trust boundary, không nên automation mù.
342
353
 
354
+ ## Gỡ cài đặt
355
+
356
+ `piagent-uninstall` mặc định là dry run: nó in ra sẽ gỡ những gì rồi thoát, không đụng vào đâu cả. Thêm `--apply` mới thực hiện.
357
+
358
+ ```bash
359
+ piagent-uninstall
360
+ piagent-uninstall --apply
361
+ ```
362
+
363
+ Mặc định chỉ gỡ Pi package của platform khỏi Pi settings global. Muốn gỡ rộng hơn:
364
+
365
+ ```bash
366
+ piagent-uninstall --apply --with-addons # + pi-mcp-adapter, pi-subagents, pi-web-access
367
+ piagent-uninstall --apply --with-host # + Pi Coding Agent host
368
+ piagent-uninstall --apply --project /path/to/project # + profile, lock, piagent-state/ của project
369
+ npm uninstall -g @piagent/platform # helper npm-global, gỡ riêng
370
+ ```
371
+
372
+ Có những thứ nó **không bao giờ** xoá, kể cả khi bật hết cờ: `auth.json`, `trust.json`, `sessions/`, `todos/`, và `.pi/memory/`. Đó là dữ liệu của anh chứ không phải state của platform. `AGENTS.md`, `.pi/settings.json`, `project-context.md` cũng được giữ vì sinh ra từ template rồi anh sửa tiếp — script liệt kê chúng ra để anh tự quyết.
373
+
374
+ Với `.pi/settings.json` nó chỉ bỏ đúng entry trỏ tới platform trong `packages`, phần còn lại giữ nguyên.
375
+
343
376
  ## Tài liệu chính
344
377
 
345
378
  - Command reference: `docs/command-reference-vietnamese.md`
@@ -10,7 +10,7 @@ This file is the canonical install, update, rollback, and release checklist. Oth
10
10
 
11
11
  All supported environments require Node.js `>=22.19.0` and Pi Coding Agent `0.81.1`. The Pi host is installed as a Node CLI; Pi Agent Platform still defines its own release matrix because the terminal helpers and shell policy rely on Bash/POSIX behavior.
12
12
 
13
- | Surface | Status for v1.0.0 | Rollout guidance |
13
+ | Surface | Status for v1.0.2 | Rollout guidance |
14
14
  |---|---|---|
15
15
  | macOS Apple Silicon (`darwin/arm64`) + Bash | Verified for this release. | Safe default for team rollout after normal project smoke tests. |
16
16
  | Linux x64 + Bash | Verified in GitHub Actions. | Safe default for CI/server usage after normal project smoke tests. |
@@ -24,7 +24,7 @@ All supported environments require Node.js `>=22.19.0` and Pi Coding Agent `0.81
24
24
  | Component | Installed by | Provides |
25
25
  |---|---|---|
26
26
  | Pi host runtime | `npm install -g --ignore-scripts @earendil-works/pi-coding-agent@<exact-version>` | The compatible `pi` executable. |
27
- | Terminal helper | `npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z` | `piagent-*` commands on `PATH`. |
27
+ | Terminal helper | `npm install -g --ignore-scripts @piagent/platform@X.Y.Z` | `piagent-*` commands on `PATH`. |
28
28
  | Pi package | `piagent-install`, or `pi install ...` | Extensions, prompts, skills, and subagents loaded by Pi. |
29
29
 
30
30
  These three components are versioned independently. A full install, update, or rollback must use the exact Pi host declared by the target release, then install the target terminal helper, then let that helper install its matching Pi package. `piagent-install` changes only the Pi package; it does not replace the Pi host or the npm-global terminal helper currently executing. In installer output, `currentRelease` is the terminal helper package version.
@@ -33,14 +33,17 @@ These three components are versioned independently. A full install, update, or r
33
33
 
34
34
  | Channel | Source shape | Mutability | Use when |
35
35
  |---|---|---:|---|
36
- | `stable` | `git:github.com/Vt-mmm/piagent@<resolved-commit-sha>` from `v1.0.0` | Fixed after resolution | Default for team rollout. |
36
+ | `stable` | `git:github.com/Vt-mmm/piagent@<resolved-commit-sha>` from `v1.0.2` | Fixed after resolution | Default for team rollout. |
37
37
  | `exact` | Tag, reviewed commit, or a tag resolved with `--resolve-tag` | Fixed when using a commit SHA | Pi-package-only roll forward, rollback, or reproduction. |
38
38
  | `dev` | `git:github.com/Vt-mmm/piagent` | Moving | Personal machine or sandbox only. |
39
39
  | `local` | `/path/to/piagent` | Local workspace | Platform development and dry-run validation. |
40
- | `enterprise-npm` | `npm:@your-scope/platform@x.y.z` | Fixed | Private registry distribution when available. |
40
+ | `npm` | `npm:@piagent/platform@x.y.z` | Fixed | Registry distribution. Use when the machine has no Git access to this repository. |
41
+ | `enterprise-npm` | `npm:@your-scope/platform@x.y.z` | Fixed | Private registry distribution when a fork is published under another scope. |
41
42
 
42
43
  `--stable` reads the helper package version from its own `package.json`, resolves that release tag through GitHub, and installs the resulting commit SHA. If the tag cannot be resolved, install fails closed. Release CI additionally sets `PIAGENT_EXPECTED_RELEASE_COMMIT`; the installer then rejects a tag that resolves anywhere except the commit being verified.
43
44
 
45
+ The terminal helper installs from the registry while `stable` still resolves the Pi package to a commit SHA. That difference is deliberate. The helper is a published tarball whose provenance attestation is what ties it back to a commit, and npm verifies that. The Pi package instead relies on tag-to-SHA resolution checked against `PIAGENT_EXPECTED_RELEASE_COMMIT`, which is a separate chain that a registry version range cannot express. Pointing `stable` at an npm version would drop that check rather than replace it, so the `npm` channel exists for machines without Git access to this repository, not as the default.
46
+
44
47
  Exactly one CLI package selector is accepted: `--package-source`, `--channel`, `--stable`, `--dev`, `--local`, `--version`, or `--tag`. The first CLI selector may replace environment defaults; a second CLI selector is rejected before any install command is printed or executed.
45
48
 
46
49
  ## First install — full platform
@@ -50,7 +53,7 @@ Use this flow when the team needs both terminal commands and the Pi package:
50
53
  ```bash
51
54
  node --version # >= 22.19.0
52
55
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
53
- npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
56
+ npm install -g --ignore-scripts @piagent/platform@1.0.2
54
57
  piagent-install --stable --dry-run
55
58
  piagent-install --stable
56
59
  ```
@@ -58,8 +61,8 @@ piagent-install --stable
58
61
  The stable preview and apply output includes:
59
62
 
60
63
  ```text
61
- currentRelease: v1.0.0 (helper package version)
62
- tag: v1.0.0
64
+ currentRelease: v1.0.2 (helper package version)
65
+ tag: v1.0.2
63
66
  resolvedCommit: <40-char-sha>
64
67
  source: git:github.com/Vt-mmm/piagent@<40-char-sha>
65
68
  ```
@@ -76,7 +79,7 @@ bash scripts/install-global.sh --stable
76
79
  Use this only when terminal commands are not needed:
77
80
 
78
81
  ```bash
79
- pi install git:github.com/Vt-mmm/piagent@v1.0.0
82
+ pi install git:github.com/Vt-mmm/piagent@v1.0.2
80
83
  ```
81
84
 
82
85
  Direct `pi install` does not create `piagent-*` commands on `PATH`.
@@ -87,7 +90,7 @@ Update the exact supported Pi host first, then the npm-global helper, then let t
87
90
 
88
91
  ```bash
89
92
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
90
- npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z
93
+ npm install -g --ignore-scripts @piagent/platform@X.Y.Z
91
94
  piagent-install --stable --dry-run
92
95
  piagent-install --stable
93
96
  piagent-doctor /path/to/project --strict-share
@@ -120,7 +123,7 @@ Rollback the host, helper, and Pi package together. Determine the exact host ver
120
123
  ```bash
121
124
  TARGET_PI_VERSION=x.y.z # replace from vPREVIOUS release policy before execution
122
125
  npm install -g --ignore-scripts "@earendil-works/pi-coding-agent@$TARGET_PI_VERSION"
123
- npm install -g --ignore-scripts github:Vt-mmm/piagent#vPREVIOUS
126
+ npm install -g --ignore-scripts @piagent/platform@PREVIOUS
124
127
  piagent-install --stable --dry-run
125
128
  piagent-install --stable
126
129
  piagent-doctor /path/to/project --strict-share
@@ -138,6 +141,44 @@ piagent-install --version vPREVIOUS --resolve-tag
138
141
  piagent-doctor /path/to/project --strict-share
139
142
  ```
140
143
 
144
+ ## Uninstall
145
+
146
+ Rollback moves between releases. Uninstall leaves entirely, and it is the flow a team member or an external user reaches for when this platform is no longer wanted on their machine.
147
+
148
+ `piagent-uninstall` reports and exits; `--apply` performs the removal. The default is a report because the command edits Pi's global settings, which other tools also write to.
149
+
150
+ ```bash
151
+ piagent-uninstall
152
+ piagent-uninstall --apply
153
+ ```
154
+
155
+ Each additional layer is opt-in, so leaving the platform never takes the Pi host or a project's history with it by surprise:
156
+
157
+ ```bash
158
+ piagent-uninstall --apply --with-addons # pi-mcp-adapter, pi-subagents, pi-web-access
159
+ piagent-uninstall --apply --with-host # the exact Pi Coding Agent host
160
+ piagent-uninstall --apply --project /path/to/project # a project's profile, lock, and runtime state
161
+ npm uninstall -g @piagent/platform # the npm-global helper, removed separately
162
+ ```
163
+
164
+ Removal reads the package entries registered in Pi's settings rather than assuming what the running version installs. A machine that first installed the platform before the namespace rename still has that older entry removed.
165
+
166
+ ### What uninstall will not remove
167
+
168
+ These are operator data, not platform state, and no flag combination deletes them:
169
+
170
+ | Kept | Why |
171
+ |---|---|
172
+ | `.pi/auth.json`, `.pi/trust.json` | Credentials and trust decisions. Re-earning them is not a cleanup step. |
173
+ | `.pi/sessions/`, `.pi/todos/` | Work history that predates and outlives the platform. |
174
+ | `.pi/memory/` | Accumulated project memory. Deleting it destroys work the platform only stored. |
175
+
176
+ Files written from a template and then edited in place — `AGENTS.md`, `REVIEW_GUIDELINES.md`, `.mcp.json`, `.pi/settings.json`, `.pi/mcp.json`, `.pi/project-context.md`, `.pi/context-index.json`, `.pi/tech-stack.json` — are listed rather than deleted, because by the time uninstall runs they hold project content rather than template content.
177
+
178
+ `.pi/settings.json` is Pi's file, not this platform's. Uninstall drops only the `packages` entry pointing here and leaves every other setting untouched.
179
+
180
+ The global MCP baseline at `$PI_CODING_AGENT_DIR/mcp.json` and the subagent config beside it are shared files that may have been edited after install. `--with-addons` reports their paths instead of resetting them.
181
+
141
182
  ## Canonical release checklist
142
183
 
143
184
  Production docs must never advertise a tag that cannot yet be installed.
@@ -154,6 +195,24 @@ Before broad team access, a repository administrator must enable these external
154
195
 
155
196
  Verify these settings in GitHub **Settings → Rules** and **Settings → Code security and analysis**. Treat any missing control as an explicit rollout blocker, not as a passing source-code gate. Repository rules also close the remaining mutability risk of bootstrap-by-tag; tag-to-SHA resolution inside `piagent-install` alone cannot protect the helper package before it starts.
156
197
 
198
+ ### Required npm publishing controls
199
+
200
+ The publish workflow authenticates with the `NPM_TOKEN` repository secret. That token needs three things, and read-and-write access alone is not enough:
201
+
202
+ 1. Read and write access to the `@piagent` scope.
203
+ 2. **Bypass two-factor authentication** enabled on the token. When the npm account requires 2FA for publishing, the registry rejects the upload with `E403 ... two-factor authentication or granular access token with bypass 2fa enabled is required`. CI cannot answer a 2FA prompt, so this is the only way a workflow can publish.
204
+ 3. An expiry date the maintainer tracks. An expired token fails as an authentication error that does not say the token expired.
205
+
206
+ The workflow reaches the registry only at its final step, so every gate can pass and the release can still stop there. A failed upload publishes nothing, but the provenance attestation is signed and written to the public transparency log first, so a failed attempt still leaves a public record of the repository, commit, and workflow.
207
+
208
+ Fix the token, then re-run the failed job on the same tag so the publish step still sees a tag ref:
209
+
210
+ ```bash
211
+ gh run rerun <run-id> --failed
212
+ ```
213
+
214
+ Re-running the workflow from a branch instead skips publishing, because the publish step requires a tag ref.
215
+
157
216
  1. Update package versions, `CHANGELOG.md`, install examples, and docs metadata on a release-candidate branch.
158
217
  2. Verify the exact release-candidate source:
159
218
 
@@ -21,7 +21,7 @@ This document covers the packaged guard, project profiles, capability locks, ins
21
21
  - The operator, operating-system account, Pi host, and explicitly trusted project repository are trusted to execute code.
22
22
  - Project-local Pi resources are loaded only after Pi project trust or an explicit operator override.
23
23
  - A human remains available to approve destructive and external-provider actions.
24
- - Supported release verification covers macOS Apple Silicon + Bash, Linux x64 + Bash, Node.js `>=22.19.0`, and the exact Pi host version declared by the release. macOS Intel + Bash and Linux ARM64 + Bash are supported targets that need local smoke verification before broad rollout. Native Windows is not a team-rollout target for v1.0.0, and WSL2 is experimental/unverified.
24
+ - Supported release verification covers macOS Apple Silicon + Bash, Linux x64 + Bash, Node.js `>=22.19.0`, and the exact Pi host version declared by the release. macOS Intel + Bash and Linux ARM64 + Bash are supported targets that need local smoke verification before broad rollout. Native Windows is not a team-rollout target for v1.0.2, and WSL2 is experimental/unverified.
25
25
  - Registry, GitHub, model-provider, MCP-provider, and Vercel controls are external dependencies. Their account security and platform guarantees are not replaced by this repository.
26
26
 
27
27
  ## Threat actors and failure modes
@@ -9,7 +9,7 @@ Một thành viên mới không cần biết local path của maintainer. Luồn
9
9
  ```bash
10
10
  node --version # >= 22.19.0
11
11
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
12
- npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
12
+ npm install -g --ignore-scripts @piagent/platform@1.0.2
13
13
  piagent-install --stable
14
14
  cd /path/to/project
15
15
  pi
@@ -41,7 +41,7 @@ Mặc định team dùng stable helper:
41
41
  ```bash
42
42
  node --version # >= 22.19.0
43
43
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
44
- npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
44
+ npm install -g --ignore-scripts @piagent/platform@1.0.2
45
45
  piagent-install --stable --dry-run
46
46
  piagent-install --stable
47
47
  ```
@@ -66,7 +66,7 @@ Full update phải đồng bộ exact Pi host trước, sau đó terminal helper
66
66
 
67
67
  ```bash
68
68
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
69
- npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z
69
+ npm install -g --ignore-scripts @piagent/platform@X.Y.Z
70
70
  piagent-install --stable --dry-run
71
71
  piagent-install --stable
72
72
  piagent-doctor /path/to/project --strict-share
@@ -83,6 +83,20 @@ pi install npm:@your-scope/platform@x.y.z
83
83
 
84
84
  Không cần chạy bash để set profile cho từng project.
85
85
 
86
+ ### Rời platform
87
+
88
+ Thành viên rời team hoặc máy không dùng platform nữa thì gỡ bằng `piagent-uninstall`. Mặc định nó chỉ báo cáo; `--apply` mới thực hiện:
89
+
90
+ ```bash
91
+ piagent-uninstall
92
+ piagent-uninstall --apply
93
+ piagent-uninstall --apply --with-addons --with-host # gỡ luôn add-on và Pi host
94
+ piagent-uninstall --apply --project /path/to/project # gỡ state platform trong project
95
+ npm uninstall -g @piagent/platform
96
+ ```
97
+
98
+ Credential, trust, session, todo và `.pi/memory/` không bị xoá ở bất kỳ tổ hợp cờ nào. `.pi/settings.json` chỉ mất đúng entry trỏ tới platform. Chi tiết trong [release/install policy](release-install-policy.md).
99
+
86
100
  ## Bước 2 — mở project và login OAuth
87
101
 
88
102
  ```bash
@@ -798,7 +798,7 @@
798
798
  <span>Pi Agent Platform</span>
799
799
  </a>
800
800
  <div class="top-actions">
801
- <span class="pill"><span class="pill-dot"></span>v1.0.0 docs</span>
801
+ <span class="pill"><span class="pill-dot"></span>v1.0.2 docs</span>
802
802
  <a class="button social" href="https://github.com/Vt-mmm/piagent" target="_blank" rel="noopener noreferrer" aria-label="Mở GitHub repository">
803
803
  <svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
804
804
  <path d="M7 17 17 7M9 7h8v8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
@@ -927,14 +927,14 @@
927
927
  <p class="section-kicker">Quickstart</p>
928
928
  <h2>Step by step cho thành viên mới</h2>
929
929
  <p class="section-lead">
930
- Luồng dưới đây là đường đi chuẩn cho team: chuẩn bị Node.js và Pi Coding Agent, cài Pi Agent Platform bằng release tag đã pin, kiểm tra compatibility, mở repo, chọn profile, bật quyền phù hợp, chạy task, rồi verify bằng command thật. Bản latest chỉ nên dùng cho máy cá nhân hoặc sandbox chấp nhận cập nhật nhanh.
930
+ Luồng dưới đây là đường đi chuẩn cho team: chuẩn bị Node.js và Pi Coding Agent, cài Pi Agent Platform từ npm registry theo version đã pin, kiểm tra compatibility, mở repo, chọn profile, bật quyền phù hợp, chạy task, rồi verify bằng command thật. Bản latest chỉ nên dùng cho máy cá nhân hoặc sandbox chấp nhận cập nhật nhanh.
931
931
  </p>
932
932
 
933
933
  <div class="steps">
934
934
  <article class="step">
935
935
  <div>
936
936
  <h3>Chuẩn bị runtime</h3>
937
- <p>Dùng Node.js 22.19.0 trở lên và Pi Coding Agent <span class="inline-code">0.81.1</span>. Pi Agent Platform <span class="inline-code">v1.0.0</span> đang pin compatibility với runtime này và công bố support matrix theo OS/CPU riêng cho platform helper.</p>
937
+ <p>Dùng Node.js 22.19.0 trở lên và Pi Coding Agent <span class="inline-code">0.81.1</span>. Pi Agent Platform <span class="inline-code">v1.0.2</span> đang pin compatibility với runtime này và công bố support matrix theo OS/CPU riêng cho platform helper.</p>
938
938
  <div class="table-wrap compact-table">
939
939
  <table>
940
940
  <thead>
@@ -974,16 +974,24 @@ pi --version</code></pre>
974
974
  <article class="step">
975
975
  <div>
976
976
  <h3>Cài Pi Agent Platform có pin</h3>
977
- <p>Team nên cài npm-global helper trước, rồi dùng helper đó resolve stable tag thành commit SHA và cài Pi package matching. Trong output, <span class="inline-code">currentRelease</span> là version của terminal helper đang chạy. Direct Pi install chỉ dùng khi không cần command <span class="inline-code">piagent-*</span>.</p>
977
+ <p>Đường ngắn nhất là hai lệnh: cài helper từ npm, rồi chạy <span class="inline-code">piagent-setup</span> ngay trong thư mục project. Lệnh đó tự cài đúng Pi host mà release này pin, cài Pi package, khởi tạo <span class="inline-code">.pi/</span> và chạy doctor. Nó cũng cài sẵn MCP baseline và subagents; thêm <span class="inline-code">--no-mcp</span>, <span class="inline-code">--no-subagents</span> nếu không muốn, hoặc <span class="inline-code">--global-only</span> nếu chưa đụng tới project nào.</p>
978
978
  <div class="command-card">
979
- <header><span>Stable helper install</span><button class="clip-btn" data-clip="npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0&#10;piagent-install --stable --dry-run&#10;piagent-install --stable">Lấy lệnh</button></header>
980
- <pre><code>npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
979
+ <header><span>Hai lệnh</span><button class="clip-btn" data-clip="npm install -g @piagent/platform&#10;piagent-setup">Lấy lệnh</button></header>
980
+ <pre><code>npm install -g @piagent/platform
981
+ piagent-setup</code></pre>
982
+ </div>
983
+ <p>Vì chạy từ package đã cài, source ghi vào <span class="inline-code">.pi/settings.json</span> là <span class="inline-code">npm:@piagent/platform@&lt;version&gt;</span> — giá trị này có nghĩa như nhau trên máy đồng đội, nên commit được.</p>
984
+ <p>Muốn kiểm soát từng lớp thì cài tay: helper trước, rồi dùng helper đó resolve stable tag thành commit SHA và cài Pi package matching. Trong output, <span class="inline-code">currentRelease</span> là version của terminal helper đang chạy. Direct Pi install chỉ dùng khi không cần command <span class="inline-code">piagent-*</span>.</p>
985
+ <p>Hai thành phần này lấy từ hai nguồn khác nhau, và đó là chủ ý. Helper là tarball đã publish nên npm verify được provenance attestation gắn với commit build ra nó. Pi package thì dựa vào việc resolve tag thành commit SHA rồi đối chiếu với <span class="inline-code">PIAGENT_EXPECTED_RELEASE_COMMIT</span> — một phép kiểm mà version range của registry không diễn đạt được. Trỏ <span class="inline-code">stable</span> sang npm là bỏ phép kiểm đó chứ không phải thay nó, nên nguồn <span class="inline-code">git:</span> được giữ nguyên. Máy không có quyền Git tới repo này thì dùng channel <span class="inline-code">npm:@piagent/platform@x.y.z</span>.</p>
986
+ <div class="command-card">
987
+ <header><span>Stable helper install</span><button class="clip-btn" data-clip="npm install -g --ignore-scripts @piagent/platform@1.0.2&#10;piagent-install --stable --dry-run&#10;piagent-install --stable">Lấy lệnh</button></header>
988
+ <pre><code>npm install -g --ignore-scripts @piagent/platform@1.0.2
981
989
  piagent-install --stable --dry-run
982
990
  piagent-install --stable</code></pre>
983
991
  </div>
984
992
  <div class="command-card">
985
- <header><span>Direct Pi package only</span><button class="clip-btn" data-clip="pi install git:github.com/Vt-mmm/piagent@v1.0.0">Lấy lệnh</button></header>
986
- <pre><code>pi install git:github.com/Vt-mmm/piagent@v1.0.0</code></pre>
993
+ <header><span>Direct Pi package only</span><button class="clip-btn" data-clip="pi install git:github.com/Vt-mmm/piagent@v1.0.2">Lấy lệnh</button></header>
994
+ <pre><code>pi install git:github.com/Vt-mmm/piagent@v1.0.2</code></pre>
987
995
  </div>
988
996
  </div>
989
997
  </article>
@@ -993,9 +1001,9 @@ piagent-install --stable</code></pre>
993
1001
  <h3>Update hoặc rollback đúng cả ba thành phần</h3>
994
1002
  <p>Full update/rollback phải dùng exact Pi host của release target, đổi npm-global helper, rồi apply stable Pi package từ chính helper đó. Lệnh <span class="inline-code">--version ... --resolve-tag</span> chỉ đổi Pi package và giữ host/helper hiện tại.</p>
995
1003
  <div class="command-card">
996
- <header><span>Full platform target</span><button class="clip-btn" data-clip="npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1&#10;npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z&#10;piagent-install --stable --dry-run&#10;piagent-install --stable">Lấy lệnh</button></header>
1004
+ <header><span>Full platform target</span><button class="clip-btn" data-clip="npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1&#10;npm install -g --ignore-scripts @piagent/platform@X.Y.Z&#10;piagent-install --stable --dry-run&#10;piagent-install --stable">Lấy lệnh</button></header>
997
1005
  <pre><code>npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
998
- npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z
1006
+ npm install -g --ignore-scripts @piagent/platform@X.Y.Z
999
1007
  piagent-install --stable --dry-run
1000
1008
  piagent-install --stable</code></pre>
1001
1009
  </div>
@@ -1019,6 +1027,26 @@ pi update --extensions</code></pre>
1019
1027
  </div>
1020
1028
  </article>
1021
1029
 
1030
+ <article class="step">
1031
+ <div>
1032
+ <h3>Gỡ cài đặt khi không dùng nữa</h3>
1033
+ <p><span class="inline-code">piagent-uninstall</span> mặc định chỉ in ra sẽ gỡ những gì rồi thoát; phải thêm <span class="inline-code">--apply</span> nó mới thực hiện, vì nó sửa Pi settings mà công cụ khác cũng ghi vào. Mặc định chỉ gỡ Pi package của platform; add-on, Pi host và state trong project đều là opt-in.</p>
1034
+ <div class="command-card">
1035
+ <header><span>Gỡ</span><button class="clip-btn" data-clip="piagent-uninstall&#10;piagent-uninstall --apply&#10;npm uninstall -g @piagent/platform">Lấy lệnh</button></header>
1036
+ <pre><code>piagent-uninstall # chỉ báo cáo
1037
+ piagent-uninstall --apply # gỡ Pi package của platform
1038
+ piagent-uninstall --apply --with-addons --with-host # + add-on và Pi host
1039
+ piagent-uninstall --apply --project /path/to/project # + state trong project
1040
+ npm uninstall -g @piagent/platform # helper npm-global</code></pre>
1041
+ </div>
1042
+ <p>Nó gỡ theo những gì đang đăng ký trong Pi settings chứ không theo những gì bản hiện tại cài, nên package do release cũ đăng ký vẫn ra được.</p>
1043
+ <div class="callout ok-callout">
1044
+ <strong>Không bao giờ bị xoá</strong>
1045
+ <p>Credential, trust, session, todo và <span class="inline-code">.pi/memory/</span> được giữ nguyên ở mọi tổ hợp cờ — đó là dữ liệu của người dùng, không phải state của platform. Các file sinh từ template rồi sửa tiếp như <span class="inline-code">AGENTS.md</span>, <span class="inline-code">.pi/settings.json</span>, <span class="inline-code">project-context.md</span> chỉ được liệt kê để tự quyết. Với <span class="inline-code">.pi/settings.json</span>, chỉ đúng entry trỏ tới platform bị bỏ khỏi <span class="inline-code">packages</span>.</p>
1046
+ </div>
1047
+ </div>
1048
+ </article>
1049
+
1022
1050
  <article class="step">
1023
1051
  <div>
1024
1052
  <h3>Mở repo dự án</h3>
@@ -1178,12 +1206,14 @@ npm run typecheck</code></pre>
1178
1206
 
1179
1207
  <div class="callout">
1180
1208
  <strong>Redaction cần kiểm toán độc lập</strong>
1181
- <p>Các benchmark hiện tại là kiểm thử synthetic/internal cho regression và release gate, chưa tương đương external security audit. Dự án công khai <a href="https://github.com/Vt-mmm/piagent/blob/main/docs/security-threat-model.md" target="_blank" rel="noopener noreferrer">threat model và attack-vector map</a>; phạm vi OS/shell rộng hơn, parser fuzzing, third-party audit, signed provenance và LTS vẫn là các mức bảo đảm cao hơn chưa được claim.</p>
1209
+ <p>Các benchmark hiện tại là kiểm thử synthetic/internal cho regression và release gate, chưa tương đương external security audit. Dự án công khai <a href="https://github.com/Vt-mmm/piagent/blob/main/docs/security-threat-model.md" target="_blank" rel="noopener noreferrer">threat model và attack-vector map</a>; phạm vi OS/shell rộng hơn, parser fuzzing, third-party audit và LTS vẫn là các mức bảo đảm cao hơn chưa được claim. Signed provenance thì đã có: mỗi bản publish lên npm mang attestation ký qua sigstore từ GitHub Actions, buộc tarball về đúng commit và workflow tạo ra nó.</p>
1182
1210
  </div>
1183
1211
 
1184
1212
  <div class="callout">
1185
1213
  <strong>Dependency gate tách hai lớp</strong>
1186
- <p>Release kiểm toán riêng dependency tree nhỏ của terminal helper và cây exact Pi host + pinned add-on. Gate hiện có 0 high/critical; npm vẫn báo 11 moderate dependency paths thuộc hai advisory upstream: encoded-backslash path traversal trên Windows trong Hono adapter và protobuf parser DoS. Native Windows/WSL2 chưa nằm trong matrix rollout team, nhưng dự án vẫn theo dõi cả hai thay vì gọi runtime là “0 vulnerability”.</p>
1214
+ <p>Release kiểm toán riêng dependency tree nhỏ của terminal helper và cây exact Pi host + pinned add-on. Helper tree hiện sạch hoàn toàn. Cây Pi host có 1 high và 11 moderate, và dự án nói thẳng con số đó thay vì gọi runtime là “0 vulnerability”.</p>
1215
+ <p>Bản high là <span class="inline-code">GHSA-mh99-v99m-4gvg</span> trong <span class="inline-code">brace-expansion</span> — DoS, không leo quyền, không lộ dữ liệu. Repo này không sửa được: Pi host publish kèm <span class="inline-code">npm-shrinkwrap.json</span> ghim version dính lỗi, mà shrinkwrap đã publish thì thắng <span class="inline-code">overrides</span> của consumer. Mọi bản Pi đã phát hành đều dính một advisory brace-expansion, nên pin bản cũ chỉ đổi lỗi này lấy lỗi khác. Vì vậy gate miễn trừ đúng một advisory có tên, kèm lý do ghi trong mã nguồn, và tự đỏ lại khi hết hạn rà soát <span class="inline-code">2026-08-25</span> hoặc ngay khi upstream vá xong. Mọi high/critical khác vẫn chặn.</p>
1216
+ <p>11 moderate còn lại thuộc hai advisory upstream: encoded-backslash path traversal trên Windows trong Hono adapter, và protobuf parser DoS. Native Windows/WSL2 chưa nằm trong matrix rollout team, nhưng dự án vẫn theo dõi cả hai.</p>
1187
1217
  </div>
1188
1218
  </section>
1189
1219
 
@@ -1474,9 +1504,9 @@ npm run typecheck</code></pre>
1474
1504
  <pre><code>piagent-setup --mcp-preset core --subagents-preset safe</code></pre>
1475
1505
  </article>
1476
1506
  <article class="command-card">
1477
- <header><span>Full update</span><button class="clip-btn" data-clip="npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1&#10;npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z&#10;piagent-install --stable --dry-run&#10;piagent-install --stable">Lấy lệnh</button></header>
1507
+ <header><span>Full update</span><button class="clip-btn" data-clip="npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1&#10;npm install -g --ignore-scripts @piagent/platform@X.Y.Z&#10;piagent-install --stable --dry-run&#10;piagent-install --stable">Lấy lệnh</button></header>
1478
1508
  <pre><code>npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
1479
- npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z
1509
+ npm install -g --ignore-scripts @piagent/platform@X.Y.Z
1480
1510
  piagent-install --stable --dry-run
1481
1511
  piagent-install --stable</code></pre>
1482
1512
  </article>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piagent/platform",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -11,7 +11,7 @@
11
11
  "homepage": "https://piagent.io.vn",
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://github.com/Vt-mmm/piagent.git"
14
+ "url": "git+https://github.com/Vt-mmm/piagent.git"
15
15
  },
16
16
  "keywords": [
17
17
  "pi-package",
@@ -47,6 +47,7 @@
47
47
  "bin": {
48
48
  "piagent-setup": "scripts/piagent-cli.mjs",
49
49
  "piagent-install": "scripts/piagent-cli.mjs",
50
+ "piagent-uninstall": "scripts/piagent-cli.mjs",
50
51
  "piagent-init": "scripts/piagent-cli.mjs",
51
52
  "piagent-doctor": "scripts/piagent-cli.mjs",
52
53
  "piagent-benchmark": "scripts/piagent-cli.mjs",
@@ -93,8 +94,8 @@
93
94
  }
94
95
  },
95
96
  "devDependencies": {
96
- "@types/node": "^22.13.14",
97
- "typescript": "^5.8.3"
97
+ "@types/node": "^26.1.1",
98
+ "typescript": "^7.0.2"
98
99
  },
99
100
  "workspaces": [
100
101
  "packages/*"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piagent/core",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "license": "MIT",
@@ -8,7 +8,7 @@
8
8
  "homepage": "https://piagent.io.vn",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/Vt-mmm/piagent.git",
11
+ "url": "git+https://github.com/Vt-mmm/piagent.git",
12
12
  "directory": "packages/piagent-core"
13
13
  },
14
14
  "keywords": [
@@ -15,7 +15,7 @@ Package source examples:
15
15
  # Installs the stable tag after resolving it to a commit SHA.
16
16
 
17
17
  # Pin a specific release:
18
- scripts/install-global.sh --version v1.0.0 --resolve-tag
18
+ scripts/install-global.sh --version v1.0.2 --resolve-tag
19
19
 
20
20
  # Preview the planned install/update without changing user config:
21
21
  scripts/install-global.sh --stable --dry-run
@@ -123,7 +123,7 @@ detect_runtime_surface() {
123
123
  printf 'native-windows/%s (not release-gated; terminal helpers require Bash semantics)' "$arch_name"
124
124
  ;;
125
125
  *)
126
- printf '%s/%s (outside v1.0.0 release matrix)' "$os_name" "$arch_name"
126
+ printf '%s/%s (outside v1.0.2 release matrix)' "$os_name" "$arch_name"
127
127
  ;;
128
128
  esac
129
129
  }
@@ -131,7 +131,7 @@ detect_runtime_surface() {
131
131
  warn_runtime_surface_if_needed() {
132
132
  local surface="$1"
133
133
  case "$surface" in
134
- *"supported target"*|*"experimental"*|*"not release-gated"*|*"outside v1.0.0 release matrix"*)
134
+ *"supported target"*|*"experimental"*|*"not release-gated"*|*"outside v1.0.2 release matrix"*)
135
135
  echo "WARN: runtime surface is $surface." >&2
136
136
  echo "WARN: For team rollout, run piagent-doctor plus the project smoke/verify suite on this machine before relying on it." >&2
137
137
  ;;
@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
6
6
  const scriptByCommand = {
7
7
  "piagent-setup": "scripts/setup.sh",
8
8
  "piagent-install": "scripts/install-global.sh",
9
+ "piagent-uninstall": "scripts/uninstall-global.sh",
9
10
  "piagent-init": "scripts/init-project.sh",
10
11
  "piagent-doctor": "scripts/team-doctor.sh",
11
12
  "piagent-benchmark": "scripts/quality-benchmark.sh",
package/scripts/setup.sh CHANGED
@@ -244,6 +244,20 @@ NODE
244
244
  fi
245
245
  fi
246
246
 
247
+ # Running from an installed package rather than a checkout. The name and
248
+ # version on disk are exactly what a teammate resolves from the registry, so
249
+ # they are a portable source; the install path is not, and project settings
250
+ # are meant to be committed.
251
+ if [[ "$PLATFORM_ROOT" == */node_modules/* ]]; then
252
+ local installed_name installed_version
253
+ installed_name="$(node -e 'const fs=require("node:fs"); process.stdout.write(JSON.parse(fs.readFileSync(process.argv[1], "utf8")).name ?? "");' "$PLATFORM_ROOT/package.json")"
254
+ installed_version="$(node -e 'const fs=require("node:fs"); process.stdout.write(JSON.parse(fs.readFileSync(process.argv[1], "utf8")).version ?? "");' "$PLATFORM_ROOT/package.json")"
255
+ if [[ -n "$installed_name" && "$installed_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([+-][0-9A-Za-z.-]+)?$ ]]; then
256
+ printf 'npm:%s@%s\n' "$installed_name" "$installed_version"
257
+ return
258
+ fi
259
+ fi
260
+
247
261
  echo "WARN: No exact package source provided." >&2
248
262
  echo "WARN: using local platform path; do not commit project .pi/settings.json with this value for team rollout." >&2
249
263
  printf '%s\n' "$PLATFORM_ROOT"
@@ -137,7 +137,7 @@ function runtimeMatrixStatus() {
137
137
  surface: `${platform}/${arch}`,
138
138
  status: "outside-release-matrix",
139
139
  teamRolloutReady: false,
140
- note: "This runtime is outside the documented v1.0.0 support matrix."
140
+ note: "This runtime is outside the documented v1.0.2 support matrix."
141
141
  };
142
142
  }
143
143
 
@@ -0,0 +1,228 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Removes what this platform installed, and nothing else.
5
+ #
6
+ # Uninstall is reported before it is performed, for the same reason install is:
7
+ # the two touch shared Pi state that other tools also write to. Anything this
8
+ # script cannot prove it installed is listed for the operator instead of being
9
+ # deleted.
10
+
11
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
12
+ PI_AGENT_DIR="${PI_CODING_AGENT_DIR:-"${HOME}/.pi/agent"}"
13
+ GLOBAL_SETTINGS="$PI_AGENT_DIR/settings.json"
14
+
15
+ APPLY=false
16
+ WITH_ADDONS=false
17
+ WITH_HOST=false
18
+ PROJECT_PATH=""
19
+
20
+ PLATFORM_PACKAGE="@piagent/platform"
21
+ ADDON_PACKAGES=("pi-mcp-adapter" "pi-subagents" "pi-web-access")
22
+ PI_HOST_PACKAGE="@earendil-works/pi-coding-agent"
23
+
24
+ usage() {
25
+ cat <<'USAGE'
26
+ Usage:
27
+ piagent-uninstall [--apply] [--with-addons] [--with-host] [--project <path>]
28
+
29
+ Removes the Pi package this platform installed from Pi's global settings.
30
+
31
+ (default) Dry run. Reports what would be removed and exits 0.
32
+ --apply Perform the removal.
33
+ --with-addons Also remove pi-mcp-adapter, pi-subagents, and pi-web-access.
34
+ --with-host Also uninstall the global Pi Coding Agent host.
35
+ --project <path> Also remove this platform's state from a project.
36
+
37
+ Never removed, at any flag combination: credentials, trust decisions, sessions,
38
+ todos, and project memory. Those are operator data, not platform state.
39
+ USAGE
40
+ }
41
+
42
+ while [[ $# -gt 0 ]]; do
43
+ case "$1" in
44
+ --apply) APPLY=true; shift ;;
45
+ --with-addons) WITH_ADDONS=true; shift ;;
46
+ --with-host) WITH_HOST=true; shift ;;
47
+ --project)
48
+ if [[ $# -lt 2 || -z "${2:-}" ]]; then
49
+ echo "Missing value for --project" >&2
50
+ exit 2
51
+ fi
52
+ PROJECT_PATH="$2"
53
+ shift 2
54
+ ;;
55
+ -h|--help) usage; exit 0 ;;
56
+ *)
57
+ echo "Unknown argument: $1" >&2
58
+ usage >&2
59
+ exit 2
60
+ ;;
61
+ esac
62
+ done
63
+
64
+ print_cmd() {
65
+ printf '+'
66
+ for arg in "$@"; do printf ' %q' "$arg"; done
67
+ printf '\n'
68
+ }
69
+
70
+ run_cmd() {
71
+ print_cmd "$@"
72
+ if [[ "$APPLY" == true ]]; then
73
+ "$@"
74
+ fi
75
+ }
76
+
77
+ # Reads the package sources Pi has registered, so removal targets what is
78
+ # actually installed rather than what this version happens to install today. An
79
+ # older release registered a different source shape, and it still has to come
80
+ # out.
81
+ platform_sources() {
82
+ [[ -f "$GLOBAL_SETTINGS" ]] || return 0
83
+ node --input-type=module - "$GLOBAL_SETTINGS" <<'NODE'
84
+ import fs from "node:fs";
85
+
86
+ let settings;
87
+ try {
88
+ settings = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
89
+ } catch {
90
+ process.exit(0);
91
+ }
92
+ const packages = Array.isArray(settings.packages) ? settings.packages : [];
93
+ // Every shape this platform has ever been installed as: the scoped npm
94
+ // package, the Git source, and a local checkout path.
95
+ const owned = /(@piagent\/platform|[/:]piagent(@|$|#)|Vt-mmm\/piagent|pi-company-platform)/;
96
+ for (const entry of packages) {
97
+ if (typeof entry === "string" && owned.test(entry)) process.stdout.write(`${entry}\n`);
98
+ }
99
+ NODE
100
+ }
101
+
102
+ addon_sources() {
103
+ [[ -f "$GLOBAL_SETTINGS" ]] || return 0
104
+ node --input-type=module - "$GLOBAL_SETTINGS" "${ADDON_PACKAGES[@]}" <<'NODE'
105
+ import fs from "node:fs";
106
+
107
+ let settings;
108
+ try {
109
+ settings = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
110
+ } catch {
111
+ process.exit(0);
112
+ }
113
+ const names = process.argv.slice(3);
114
+ const packages = Array.isArray(settings.packages) ? settings.packages : [];
115
+ for (const entry of packages) {
116
+ if (typeof entry !== "string") continue;
117
+ if (names.some((name) => entry.includes(name))) process.stdout.write(`${entry}\n`);
118
+ }
119
+ NODE
120
+ }
121
+
122
+ echo "Pi Agent Platform uninstall"
123
+ echo " mode: $([[ "$APPLY" == true ]] && echo apply || echo "dry run")"
124
+ echo " settings: $GLOBAL_SETTINGS"
125
+ echo " addons: $WITH_ADDONS"
126
+ echo " host: $WITH_HOST"
127
+ [[ -n "$PROJECT_PATH" ]] && echo " project: $PROJECT_PATH"
128
+ echo
129
+
130
+ if ! command -v pi >/dev/null 2>&1; then
131
+ echo "WARN: pi is not on PATH; skipping Pi package removal." >&2
132
+ echo "WARN: reinstall the host or remove entries from $GLOBAL_SETTINGS by hand." >&2
133
+ else
134
+ found=false
135
+ while IFS= read -r source; do
136
+ [[ -z "$source" ]] && continue
137
+ found=true
138
+ echo "Removing platform package:"
139
+ run_cmd pi remove "$source"
140
+ done < <(platform_sources)
141
+ if [[ "$found" == false ]]; then
142
+ echo "No platform package found in Pi settings; nothing to remove."
143
+ fi
144
+
145
+ if [[ "$WITH_ADDONS" == true ]]; then
146
+ addon_found=false
147
+ while IFS= read -r source; do
148
+ [[ -z "$source" ]] && continue
149
+ addon_found=true
150
+ echo "Removing add-on:"
151
+ run_cmd pi remove "$source"
152
+ done < <(addon_sources)
153
+ if [[ "$addon_found" == false ]]; then
154
+ echo "No pinned add-on found in Pi settings."
155
+ fi
156
+ # The MCP baseline and subagent config are shared files that the operator
157
+ # may have edited after install, so they are reported rather than reset.
158
+ echo "Left in place, review by hand if no longer wanted:"
159
+ echo " $PI_AGENT_DIR/mcp.json"
160
+ echo " $PI_AGENT_DIR/extensions/subagent/config.json"
161
+ fi
162
+ fi
163
+
164
+ if [[ "$WITH_HOST" == true ]]; then
165
+ echo
166
+ if command -v npm >/dev/null 2>&1; then
167
+ echo "Uninstalling Pi host:"
168
+ run_cmd npm uninstall -g "$PI_HOST_PACKAGE"
169
+ else
170
+ echo "WARN: npm is not on PATH; cannot uninstall $PI_HOST_PACKAGE." >&2
171
+ fi
172
+ fi
173
+
174
+ if [[ -n "$PROJECT_PATH" ]]; then
175
+ echo
176
+ if [[ ! -d "$PROJECT_PATH" ]]; then
177
+ echo "FAIL: project path does not exist: $PROJECT_PATH" >&2
178
+ exit 1
179
+ fi
180
+ PROJECT_PATH="$(cd "$PROJECT_PATH" && pwd)"
181
+ echo "Project state in $PROJECT_PATH:"
182
+
183
+ # Files this platform alone writes and owns.
184
+ for relative in ".pi/piagent-profile.json" ".pi/piagent-profile.lock.json"; do
185
+ [[ -e "$PROJECT_PATH/$relative" ]] && run_cmd rm -f "$PROJECT_PATH/$relative"
186
+ done
187
+ if [[ -d "$PROJECT_PATH/.pi/piagent-state" ]]; then
188
+ run_cmd rm -rf "$PROJECT_PATH/.pi/piagent-state"
189
+ fi
190
+
191
+ # settings.json belongs to Pi, not to this platform. Only the package entry
192
+ # pointing here comes out; everything else the operator configured stays.
193
+ if [[ -f "$PROJECT_PATH/.pi/settings.json" ]]; then
194
+ echo "+ drop platform package entry from $PROJECT_PATH/.pi/settings.json"
195
+ if [[ "$APPLY" == true ]]; then
196
+ node --input-type=module - "$PROJECT_PATH/.pi/settings.json" <<'NODE'
197
+ import fs from "node:fs";
198
+
199
+ const target = process.argv[2];
200
+ const settings = JSON.parse(fs.readFileSync(target, "utf8"));
201
+ if (Array.isArray(settings.packages)) {
202
+ const owned = /(@piagent\/platform|[/:]piagent(@|$|#)|Vt-mmm\/piagent|pi-company-platform)/;
203
+ const kept = settings.packages.filter((entry) => !(typeof entry === "string" && owned.test(entry)));
204
+ if (kept.length > 0) settings.packages = kept;
205
+ else delete settings.packages;
206
+ fs.writeFileSync(target, `${JSON.stringify(settings, null, 2)}\n`);
207
+ }
208
+ NODE
209
+ fi
210
+ fi
211
+
212
+ # Written from templates at init, then edited by whoever used the project.
213
+ # Deleting them would take the operator's work with them.
214
+ echo "Left in place because they carry project content:"
215
+ for relative in "AGENTS.md" "REVIEW_GUIDELINES.md" ".mcp.json" ".pi/settings.json" ".pi/mcp.json" \
216
+ ".pi/project-context.md" ".pi/context-index.json" ".pi/tech-stack.json" ".pi/tech-context" ".pi/memory"; do
217
+ [[ -e "$PROJECT_PATH/$relative" ]] && echo " $relative"
218
+ done
219
+ fi
220
+
221
+ echo
222
+ if [[ "$APPLY" == true ]]; then
223
+ echo "Uninstall complete."
224
+ echo "The npm-global helper is separate and stays until you remove it:"
225
+ echo " npm uninstall -g $PLATFORM_PACKAGE"
226
+ else
227
+ echo "Dry run only. Nothing was removed. Re-run with --apply to perform it."
228
+ fi
@@ -148,6 +148,7 @@ required_files=(
148
148
  "$ROOT/scripts/verify-vercel-link.mjs"
149
149
  "$ROOT/scripts/piagent-cli.mjs"
150
150
  "$ROOT/scripts/init-project.sh"
151
+ "$ROOT/scripts/uninstall-global.sh"
151
152
  "$ROOT/scripts/setup.sh"
152
153
  "$ROOT/scripts/team-doctor.sh"
153
154
  "$ROOT/scripts/link-project.sh"
@@ -179,6 +180,7 @@ required_files=(
179
180
  "$ROOT/tests/runtime-advisories.test.mjs"
180
181
  "$ROOT/scripts/check-runtime-advisories.mjs"
181
182
  "$ROOT/tests/migrate-project-state.test.mjs"
183
+ "$ROOT/tests/uninstall-global.test.mjs"
182
184
  "$ROOT/tests/import-agent-instructions.test.mjs"
183
185
  "$ROOT/evals/golden/enforcement-decisions.json"
184
186
  )
@@ -305,10 +307,22 @@ for (const [sourceName, versionName, packageName] of pins) {
305
307
  }
306
308
  }
307
309
  NODE
308
- grep -F 'actions/checkout@11d5960a326750d5838078e36cf38b85af677262' "$ROOT/.github/workflows/verify.yml" "$ROOT/.github/workflows/codeql.yml" >/dev/null
309
- grep -F 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' "$ROOT/.github/workflows/verify.yml" >/dev/null
310
- grep -F 'github/codeql-action/init@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81' "$ROOT/.github/workflows/codeql.yml" >/dev/null
311
- grep -F 'github/codeql-action/analyze@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81' "$ROOT/.github/workflows/codeql.yml" >/dev/null
310
+ # Each reviewed action revision is asserted by hand so that a swapped action is
311
+ # a verification failure rather than a silent change. A dependency bot updating
312
+ # an action therefore needs the pin here updated in the same change; without a
313
+ # message naming the pin, that failure reads as an unexplained exit.
314
+ require_action_pin() {
315
+ local pin="$1"
316
+ shift
317
+ if ! grep -F "$pin" "$@" >/dev/null; then
318
+ echo "reviewed GitHub Actions pin $pin is missing from ${*#"$ROOT/"}; update this pin in the same change that bumps the action" >&2
319
+ exit 1
320
+ fi
321
+ }
322
+ require_action_pin 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1' "$ROOT/.github/workflows/verify.yml" "$ROOT/.github/workflows/codeql.yml"
323
+ require_action_pin 'actions/setup-node@820762786026740c76f36085b0efc47a31fe5020' "$ROOT/.github/workflows/verify.yml"
324
+ require_action_pin 'github/codeql-action/init@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81' "$ROOT/.github/workflows/codeql.yml"
325
+ require_action_pin 'github/codeql-action/analyze@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81' "$ROOT/.github/workflows/codeql.yml"
312
326
  grep -F 'git cat-file -t "refs/tags/$RELEASE_TAG"' "$ROOT/.github/workflows/verify.yml" >/dev/null
313
327
  if grep -R -E '^[[:space:]]*uses:[[:space:]]+[^@[:space:]]+@(main|master|v[0-9]+([.][0-9]+)*)[[:space:]]*(#.*)?$' "$ROOT/.github/workflows" >/dev/null; then
314
328
  echo "GitHub Actions workflow contains a mutable action reference" >&2
@@ -465,6 +479,7 @@ bash -n "$ROOT/scripts/configure-mcp.sh"
465
479
  bash -n "$ROOT/scripts/configure-subagents.sh"
466
480
  bash -n "$ROOT/scripts/install-global.sh"
467
481
  bash -n "$ROOT/scripts/init-project.sh"
482
+ bash -n "$ROOT/scripts/uninstall-global.sh"
468
483
  bash -n "$ROOT/scripts/setup.sh"
469
484
  if [[ "$OFFLINE" == true || "${PIAGENT_VERIFY_OFFLINE:-}" == "1" || "${CI:-}" == "true" ]]; then
470
485
  echo "WARN: skipping local Pi model catalog check in offline/CI mode" >&2
@@ -55,7 +55,11 @@ if (rootPackage.name !== "@piagent/platform") fail("root package must be named @
55
55
  if (rootPackage.private) fail("root package must not be private; publishing is intended");
56
56
  if (rootPackage.publishConfig?.access !== "public") fail("scoped package must declare publishConfig.access=public");
57
57
  if (rootPackage.publishConfig?.provenance !== true) fail("root package must publish with provenance");
58
- if (rootPackage.repository?.url !== "https://github.com/Vt-mmm/piagent.git") fail("root package repository URL is not canonical");
58
+ // The git+ prefix is npm's own normalization. Publishing without it succeeds
59
+ // but rewrites the field, which leaves the manifest in the repository saying
60
+ // something different from the manifest on the registry.
61
+ if (rootPackage.repository?.url !== "git+https://github.com/Vt-mmm/piagent.git") fail("root package repository URL is not canonical");
62
+ if (corePackage.repository?.url !== rootPackage.repository.url) fail("core package repository URL does not match the root package");
59
63
  if (rootPackage.dependencies && Object.keys(rootPackage.dependencies).length > 0) fail("root package has unexpected runtime dependencies");
60
64
  if (packageLock.name !== rootPackage.name || packageLock.packages?.[""]?.name !== rootPackage.name) fail("package-lock root identity does not match package.json");
61
65
  if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version ?? "")) fail("package.json version is not a supported release version");