nccgs 2.0.0 → 2.1.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.
@@ -1,9 +1,10 @@
1
1
  # NCCGS — portable framework decisions
2
2
 
3
3
  NCCGS means **New Claude Code Game Studio** and targets **Claude Code**.
4
- This is the prepared 2.0.0 stable package. It has not been published.
5
- Local preparation does not change npm tags. Native RC4 qualification is scoped
6
- to its frozen archive; see README.md and CHANGELOG.md for evidence boundaries.
4
+ This is the unpublished 2.1.0 source, adding reversible project uninstallation.
5
+ The earlier 2.0.0 release was published on 2026-10-28; its archive is unchanged.
6
+ Local preparation does not change npm tags. Native qualification remains scoped
7
+ to its frozen archives; see README.md and CHANGELOG.md for evidence boundaries.
7
8
  Project-specific authorizations, provider sessions, budgets and internal development
8
9
  history are retained separately, outside the public package. Nothing in this file
9
10
  authorizes spending, provider access or changes to a user's project by itself.
@@ -20,6 +21,9 @@ authorizes spending, provider access or changes to a user's project by itself.
20
21
  remains unknown. Never infer execution from a requested alias or a handoff marker.
21
22
  - Preserve failed attempts, negative reviews, task history, evidence and consumed
22
23
  allowances. An update, migration, retry or new report must not reset spent budgets.
24
+ - Uninstall only from an external terminal after sessions and owned work stop.
25
+ Preserve game source, custom files and .nccgs history/budgets. Uninstall never
26
+ closes tasks, waives review/acceptance or authorizes deleting retained records.
23
27
  - Known-solution or contaminated benchmark baselines remain reference-only; do not
24
28
  score them as independent NCCGS runs.
25
29
 
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.1.0
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { json, loadPipeline } from "./policy.mjs";
5
+ import { acquireInstallationLease } from "./installation-guard.mjs";
5
6
 
6
7
  export function renderAgent(template, route) {
7
8
  const match = template.match(/^---\r?\n([\s\S]*?)\r?\n---/);
@@ -98,6 +99,8 @@ export function generated(project) {
98
99
  return outputs;
99
100
  }
100
101
  export function compile(project, write = false) {
102
+ const lease = write ? acquireInstallationLease(project, "nccgs-policy") : null;
103
+ try {
101
104
  const differences = [];
102
105
  for (const [relative, content] of generated(project)) {
103
106
  const file = path.join(project, relative);
@@ -106,6 +109,7 @@ export function compile(project, write = false) {
106
109
  if (write) { fs.mkdirSync(path.dirname(file), { recursive: true }); fs.writeFileSync(file, content, "utf8"); }
107
110
  }
108
111
  return differences;
112
+ } finally { lease?.release(); }
109
113
  }
110
114
  if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
111
115
  const project = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
@@ -4,6 +4,7 @@ import { fileURLToPath } from "node:url";
4
4
  import { atomicJson, hash, json, profilePolicy, contained, resolveExecution } from "./policy.mjs";
5
5
  import { renderAgent } from "./compile-policy.mjs";
6
6
  import { fingerprintFile } from "./integrity.mjs";
7
+ import { acquireInstallationLease } from "./installation-guard.mjs";
7
8
 
8
9
  const args = process.argv.slice(2);
9
10
  const values = flag => args.flatMap((arg, index) => {
@@ -12,6 +13,8 @@ const values = flag => args.flatMap((arg, index) => {
12
13
  return [args[index + 1]];
13
14
  });
14
15
  const project = path.resolve(values("--project")[0] || path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../.."));
16
+ const lease = acquireInstallationLease(project, "nccgs-agents");
17
+ try {
15
18
  const explicit = values("--profile")[0];
16
19
  const { name, profile, pipeline } = profilePolicy(project, explicit);
17
20
  // Profile changes never change the execution policy or pending task obligations.
@@ -90,3 +93,4 @@ console.log(`NCCGS model profile '${name}' configured; ${writes.length} agent fi
90
93
  console.log("Model configuration records requested aliases/effort only. Runtime resolution requires Claude Code observation; execution policy and existing task approvals are unchanged.");
91
94
  if (legacyPolicy && !policyPattern.test(oldPolicy)) console.log("Legacy project policy preserved; model selection is stored in activation/install metadata until explicit policy migration.");
92
95
  for (const warning of warnings) console.warn(warning);
96
+ } finally { lease.release(); }
@@ -0,0 +1,55 @@
1
+ import fs from "node:fs";
2
+ import crypto from "node:crypto";
3
+ import { containedPath } from "./paths.mjs";
4
+ import { acquireLock, ownerState } from "./process-lock.mjs";
5
+
6
+ const unverifiedAdmission = cause => new Error("NCCGS installation admission is busy or unverified; the lock may be changing or unreadable. Retry after other work finishes; inspect permissions or retained lock records if it persists.", { cause });
7
+
8
+ export function assertInstallationAvailable(project, ownToken = null) {
9
+ for (const relative of [".nccgs/uninstall.lock", ".nccgs/uninstall.lock.recovery"]) {
10
+ const lock = containedPath(project, relative);
11
+ if (fs.existsSync(lock)) {
12
+ let record;
13
+ try {
14
+ record = JSON.parse(fs.readFileSync(lock, "utf8"));
15
+ if (!record || typeof record !== "object" || Array.isArray(record)) throw new Error("Invalid lock record");
16
+ } catch (error) { throw unverifiedAdmission(error); }
17
+ if (relative === ".nccgs/uninstall.lock" && ownToken && record.token === ownToken) continue;
18
+ if (ownerState(record) !== "dead")
19
+ throw new Error(record.operation === "installation-admission"
20
+ ? "NCCGS installation admission is busy or unverified; another launch or configuration is being admitted. Retry after it finishes."
21
+ : "NCCGS uninstall is active or unverified; wait for it to finish before starting other work.");
22
+ }
23
+ }
24
+ const directory = containedPath(project, ".nccgs/uninstall");
25
+ if (!fs.existsSync(directory)) return;
26
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
27
+ const folder = containedPath(project, `.nccgs/uninstall/${entry.name}`);
28
+ if (!fs.statSync(folder).isDirectory()) continue;
29
+ const file = containedPath(project, `.nccgs/uninstall/${entry.name}/manifest.json`);
30
+ if (!fs.existsSync(file)) continue;
31
+ const manifest = JSON.parse(fs.readFileSync(file, "utf8"));
32
+ if (!["completed", "restored", "cancelled"].includes(manifest.status))
33
+ throw new Error(`Interrupted uninstall ${entry.name}; inspect its backup and use uninstall --rollback before starting other work.`);
34
+ }
35
+ }
36
+
37
+ // Serialize admission with uninstall/rollback. No new cooperating writer can
38
+ // leave a transient lease during apply/restore; the session lease then protects
39
+ // the entire operation after this short gate is released. Nested configurators
40
+ // may register their own leases without holding the gate for their lifetime.
41
+ export function acquireInstallationLease(project, operation) {
42
+ assertInstallationAvailable(project);
43
+ let gate;
44
+ try { gate = acquireLock(containedPath(project, ".nccgs/uninstall.lock"), { operation: "installation-admission" }); }
45
+ catch (error) {
46
+ // A competing admission may have arrived after the first check. Explain the
47
+ // current holder without retrying, taking over, or changing its lease.
48
+ assertInstallationAvailable(project);
49
+ throw unverifiedAdmission(error);
50
+ }
51
+ try {
52
+ assertInstallationAvailable(project, gate.record.token);
53
+ return acquireLock(containedPath(project, `.nccgs/sessions/${crypto.randomUUID()}.lock`), { operation });
54
+ } finally { gate.release(); }
55
+ }
package/CHANGELOG.md CHANGED
@@ -1,8 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.0 — Unreleased
4
+
5
+ - Handle the final LOW diagnostic finding: empty, incomplete, unreadable or
6
+ disappearing admission locks refuse with an actionable message, preserving
7
+ the original error cause. Keep ownership checks and explicit retry unchanged.
8
+
9
+ - Resolve the follow-up review's two low-severity observations: distinguish
10
+ admission contention from active uninstall, and record session recovery as an
11
+ immutable pending receipt plus a separate success/failure outcome. Missing or
12
+ malformed outcomes remain unconfirmed; prior attempts and reviews stay intact.
13
+
14
+ - Resolve the first independent maintenance review's four findings: add explicit
15
+ hash-bound operator recovery for crashed launcher leases with immutable receipts;
16
+ retain unknown process-state refusal and all task/job/run ownership checks.
17
+ Serialize run/install/agent/migration/policy admissions against uninstall,
18
+ cancel pre-mutation refusals without stranded receipts, and return backup IDs
19
+ even when empty-directory cleanup produces warnings. Historical negative review
20
+ and packages stay unchanged; the corrected archive requires fresh qualification.
21
+
22
+ - Add `nccgs uninstall --project DIR`, a read-only `--dry-run` and guarded
23
+ `--rollback ID`. Remove unchanged inventoried framework files and exact NCCGS
24
+ hooks/imports; preserve customized files, shared Claude preferences, game source
25
+ and the full `.nccgs` policy/task/review/evidence/budget history.
26
+ - Save every removed/replaced byte in a project-local uninstall receipt before
27
+ changing files. Refuse unsafe paths, ambiguous custom hooks, active/unverified
28
+ work and rollback over later user edits; attempt restoration on write failure.
29
+ - Register `nccgs run` sessions so uninstallation cannot race a new managed
30
+ launch. An interrupted uninstall blocks launch/update until recovery. No process
31
+ is killed and no task, acceptance requirement, review or budget is reset.
32
+ - The published 2.0.0 archive remains unchanged. This feature receives local
33
+ framework and installation tests; it is not a new Claude Code/Unity benchmark.
34
+ See [uninstall and recovery](docs/UNINSTALL.md).
35
+
3
36
  ## 2.0.0 — 2026-10-28
4
37
 
5
- Prepared stable package; unpublished. Local preparation does not move npm tags.
38
+ Published to npm on 2026-10-28. The following notes describe its original
39
+ preparation scope; the exact publication and native qualification have separate
40
+ frozen receipts. No new version is published by preparing 2.1.0.
6
41
 
7
42
  - Publish existing external operator Editor start, graceful shutdown command and
8
43
  settled stop receipts into immutable reviewer-readable project bundles. Preserve
package/MEMORY.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # NCCGS — portable framework decisions
2
2
 
3
3
  NCCGS means **New Claude Code Game Studio** and targets **Claude Code**.
4
- This is the prepared 2.0.0 stable package. It has not been published.
5
- Local preparation does not change npm tags. Native RC4 qualification is scoped
6
- to its frozen archive; see README.md and CHANGELOG.md for evidence boundaries.
4
+ This is the unpublished 2.1.0 source, adding reversible project uninstallation.
5
+ The earlier 2.0.0 release was published on 2026-10-28; its archive is unchanged.
6
+ Local preparation does not change npm tags. Native qualification remains scoped
7
+ to its frozen archives; see README.md and CHANGELOG.md for evidence boundaries.
7
8
  Project-specific authorizations, provider sessions, budgets and internal development
8
9
  history are retained separately, outside the public package. Nothing in this file
9
10
  authorizes spending, provider access or changes to a user's project by itself.
@@ -20,6 +21,9 @@ authorizes spending, provider access or changes to a user's project by itself.
20
21
  remains unknown. Never infer execution from a requested alias or a handoff marker.
21
22
  - Preserve failed attempts, negative reviews, task history, evidence and consumed
22
23
  allowances. An update, migration, retry or new report must not reset spent budgets.
24
+ - Uninstall only from an external terminal after sessions and owned work stop.
25
+ Preserve game source, custom files and .nccgs history/budgets. Uninstall never
26
+ closes tasks, waives review/acceptance or authorizes deleting retained records.
23
27
  - Known-solution or contaminated benchmark baselines remain reference-only; do not
24
28
  score them as independent NCCGS runs.
25
29
 
package/README.md CHANGED
@@ -1,12 +1,13 @@
1
1
  # NCCGS — New Claude Code Game Studio
2
2
 
3
- **2.0.0** is a prepared stable package for standalone game-development
4
- orchestration in **Claude Code**. It is not published and does not move npm tags.
5
- It includes handoff automation, bounded task slicing and Unity repair, protected
3
+ **2.1.0** is the unpublished next package for standalone game-development
4
+ orchestration in **Claude Code**. It adds reversible project uninstallation;
5
+ the published **2.0.0** archive remains unchanged. Local preparation moves no npm tags.
6
+ It retains handoff automation, bounded task slicing and Unity repair, protected
6
7
  final-review allocation, managed Unity settlement and exact first-import output
7
8
  declarations. New repair steps block unsaved loaded scenes before execution.
8
9
  See [handoff operations](docs/HANDOFF-AUTOMATION.md), [bounded repair](docs/BOUNDED-REPAIR.md),
9
- [task slicing](docs/TASK-SLICING.md) and [release notes](CHANGELOG.md).
10
+ [task slicing](docs/TASK-SLICING.md), [uninstallation](docs/UNINSTALL.md) and [release notes](CHANGELOG.md).
10
11
 
11
12
  Claude Code handles intake, planning, specialist dispatch, testing, independent
12
13
  review and reporting. External review can be configured separately. This major
@@ -25,9 +26,14 @@ This is scoped workflow evidence, not broad game-quality or productivity proof.
25
26
  Version 2.0.0 keeps those runtime guards and adds a receipt publisher so external
26
27
  Editor stop evidence is available inside the reviewer's project. It does not
27
28
  operate processes or alter acceptance. See [Editor evidence](docs/EDITOR-SESSION-EVIDENCE.md).
28
- Release receipts separately record archive tests, installation/upgrades and
29
- independent maintenance review. Preparation does not publish npm or claim a new
30
- full Unity game run through the stable archive. Frozen history remains intact.
29
+ The exact 2.0.0 archive subsequently passed its scoped native Unity qualification
30
+ and was published on 2026-10-28. Frozen release receipts retain its tests and
31
+ independent reviews. The new 2.1.0 uninstaller receives local filesystem/CLI tests;
32
+ that does not claim another Claude Code/Unity run. The first independent maintenance
33
+ review required four fixes; this candidate adds those fixes and awaits qualification
34
+ of its exact archive, including a fresh independent review. Earlier verdicts remain
35
+ unchanged in their separate receipts.
36
+ Frozen history remains intact.
31
37
  See [release status](docs/RELEASE-STATUS.md), [upgrading](UPGRADING.md),
32
38
  [Vietnamese quick start](docs/HUONG-DAN-MIGRATE-VA-SU-DUNG.md) and [decisions](MEMORY.md).
33
39
 
@@ -68,7 +74,7 @@ The studio retains 47 roles (13 active by default, including Game Designer), 36
68
74
  rules, lifecycle hooks and unmodified official Unity Skills. Enable specialists
69
75
  when their expertise resolves a concrete problem; do not dispatch the whole studio.
70
76
 
71
- ## Try the prepared stable package
77
+ ## Try the local 2.1.0 package
72
78
 
73
79
  Requirements: Claude Code and Node.js 18+. Unity CLI/Pipeline is needed for live
74
80
  Unity operations. Run against a disposable Unity project first:
@@ -76,14 +82,14 @@ Unity operations. Run against a disposable Unity project first:
76
82
  Use the locally prepared archive and its accompanying SHA-256 manifest:
77
83
 
78
84
  ```powershell
79
- $NccgsArchive = "D:\path\to\nccgs-2.0.0.tgz"
85
+ $NccgsArchive = "D:\path\to\nccgs-2.1.0.tgz"
80
86
  npx --yes --package "$NccgsArchive" nccgs install --project "D:\path\to\UnityProject" --dry-run
81
87
  npx --yes --package "$NccgsArchive" nccgs install --project "D:\path\to\UnityProject"
82
88
  npx --yes --package "$NccgsArchive" nccgs doctor --project "D:\path\to\UnityProject"
83
89
  ```
84
90
 
85
- Before publication, use this local archive. After publication, pin nccgs@2.0.0
86
- for repeatability; npm tags are not changed by this preparation. Use update for an existing installation only after reviewing its
91
+ Before 2.1.0 publication, use this local archive. Published nccgs@2.0.0 does not
92
+ include the uninstall command. Use update for an existing installation only after reviewing its
87
93
  dry run and backup. See [the tested upgrade matrix](docs/UPGRADE-QUALIFICATION.md) and its limits.
88
94
  The installer preserves customized files and unrelated Claude settings, records
89
95
  overrides and backs up replacements. Do not use --force as an ordinary update path.
@@ -139,6 +145,23 @@ Independent review uses Opus/high. These aliases are requested routes. Real Clau
139
145
  model resolution and provider access must be verified in the target session.
140
146
  Historical `astra-claude` routes remain available under compatibility execution.
141
147
 
148
+ ## Remove NCCGS when it is no longer needed
149
+
150
+ Close Claude Code sessions, then preview and apply from an external terminal:
151
+
152
+ ```powershell
153
+ npx --yes --package "$NccgsArchive" nccgs uninstall --project "D:\path\to\UnityProject" --dry-run
154
+ npx --yes --package "$NccgsArchive" nccgs uninstall --project "D:\path\to\UnityProject"
155
+ ```
156
+
157
+ This also supports an existing 2.0.0 installation without updating it first.
158
+ Game source, customized files and `.nccgs` history/budgets remain. The command
159
+ removes unchanged managed files and exact framework hooks/imports, saves a backup
160
+ and refuses active or uncertain work. Use `uninstall --rollback ID` to restore
161
+ that backup when no later edits conflict. Shared permission/model settings stay
162
+ because their ownership was not recorded by earlier installers.
163
+ See [details and recovery](docs/UNINSTALL.md).
164
+
142
165
  ## Maintainer verification and limits
143
166
 
144
167
  These commands run from a source/package checkout. They are not extra steps for
package/UPGRADING.md CHANGED
@@ -1,7 +1,7 @@
1
- # Upgrading NCCGS 2.0.0
1
+ # Upgrading NCCGS 2.1.0
2
2
 
3
- Current prepared stable package: **2.0.0**, unpublished. Preparation does not change
4
- npm `next` or `latest`. Use the local archive for reproducible evaluation.
3
+ Current source: **2.1.0**, unpublished. Version 2.0.0 was published on 2026-10-28.
4
+ Preparation does not change npm tags. Use the local 2.1.0 archive for evaluation.
5
5
  Read [release status](docs/RELEASE-STATUS.md) for what has and has not been verified.
6
6
 
7
7
  ## Choose the operation
@@ -12,6 +12,8 @@ Read [release status](docs/RELEASE-STATUS.md) for what has and has not been veri
12
12
  | Existing NCCGS installation | `update` | Updates managed files; preserves project-owned policy and customizations |
13
13
  | Intentionally adopt standalone execution | `migrate-execution --to standalone` | Explicitly changes execution configuration; separate from updating files |
14
14
  | Resume work | `run` | Launches Claude Code with the project's configured obligations |
15
+ | Stop using NCCGS in this project | `uninstall` | Removes unchanged framework files/hooks; retains source, customizations and history |
16
+ | Undo removal | `uninstall --rollback ID` | Restores verified backup bytes, refusing later edits |
15
17
 
16
18
  **Historical published-1.3.0 → RC3 upgrade qualification covers its tested fixture matrix.**
17
19
  See [upgrade qualification](docs/UPGRADE-QUALIFICATION.md) for scope and the RC2
@@ -26,7 +28,7 @@ Unity project with Assets, Packages and ProjectSettings. Live Unity operations
26
28
  also require the appropriate Unity Editor/CLI integration.
27
29
 
28
30
  ```powershell
29
- $NccgsArchive = "D:\path\to\nccgs-2.0.0.tgz"
31
+ $NccgsArchive = "D:\path\to\nccgs-2.1.0.tgz"
30
32
  npx --yes --package "$NccgsArchive" nccgs install --project "D:\path\to\UnityProject" --dry-run
31
33
  npx --yes --package "$NccgsArchive" nccgs install --project "D:\path\to\UnityProject"
32
34
  npx --yes --package "$NccgsArchive" nccgs doctor --project "D:\path\to\UnityProject"
@@ -66,6 +68,10 @@ that selects the published stable channel, not this unpublished local archive.
66
68
 
67
69
  ## Optional execution-policy migration
68
70
 
71
+ For removal instead of migration, use [uninstall and recovery](docs/UNINSTALL.md).
72
+ The 2.1.0 CLI can remove an existing 2.0.0 installation directly. Removing or
73
+ reinstalling never resets prior task, review, acceptance or budget obligations.
74
+
69
75
  After installing/updating, migrate only when the owner intends to adopt standalone.
70
76
  Review any active task's pinned obligations before changing policy.
71
77
 
@@ -108,5 +114,5 @@ game quality, completion of a task or human acceptance.
108
114
 
109
115
  Existing projects that intentionally use Astra/Fable keep their configured chain.
110
116
  See [compatibility gates](.claude/nccgs/protocols/task-gates.md). Historical 1.4/1.5
111
- guides describe their original versions; this document governs the current 2.0.0 package's
117
+ guides describe their original versions; this document governs the current 2.1.0 package's
112
118
  installation commands and release status.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.1.0
@@ -1,12 +1,13 @@
1
- # Hướng dẫn cài đặt và sử dụng NCCGS 2.0.0
1
+ # Hướng dẫn cài đặt và sử dụng NCCGS 2.1.0
2
2
 
3
- Gói stable đang chuẩn bị: **2.0.0**, chưa phát hành npm.
4
- Dùng gói cục bộ cùng mã SHA-256 đi kèm; việc chuẩn bị không đổi các kênh npm.
3
+ Mã nguồn tiếp theo: **2.1.0**, chưa phát hành npm; bổ sung lệnh gỡ NCCGS.
4
+ Bản **2.0.0** đã phát hành ngày 28/10/2026 và được giữ nguyên.
5
+ Dùng gói 2.1.0 cục bộ cùng mã SHA-256 đi kèm; việc chuẩn bị không đổi các kênh npm.
5
6
  Biên bản operator dừng Editor phải được đưa vào hồ sơ reviewer bằng
6
7
  [hướng dẫn bằng chứng Editor](EDITOR-SESSION-EVIDENCE.md).
7
- Đây là gói stable đang chuẩn bị. Nâng cấp từ npm 1.3.0 đã được kiểm chứng trong phạm vi
8
- [các tình huống thử](UPGRADE-QUALIFICATION.md); chạy trọn một đầu việc mới bằng
9
- chính gói stable này vẫn là bước riêng chưa hoàn tất. Xem [trạng thái phát hành](RELEASE-STATUS.md).
8
+ Kiểm thử tính năng gỡ là kiểm thử framework; không được tính thành một lượt
9
+ Claude Code/Unity mới. Các bằng chứng cũ vẫn gắn với đúng gói đã kiểm chứng.
10
+ Xem [trạng thái phát hành](RELEASE-STATUS.md).
10
11
 
11
12
  ## Cài mới vào bản sao dự án
12
13
 
@@ -15,7 +16,7 @@ Chức năng điều khiển Unity cần thêm Editor/CLI phù hợp. Thay đư
15
16
  dự án của bạn; đọc kết quả xem trước rồi mới áp dụng:
16
17
 
17
18
  ```powershell
18
- $NccgsArchive = "D:\path\to\nccgs-2.0.0.tgz"
19
+ $NccgsArchive = "D:\path\to\nccgs-2.1.0.tgz"
19
20
  npx --yes --package "$NccgsArchive" nccgs install --project "D:\path\to\UnityProject" --dry-run
20
21
  npx --yes --package "$NccgsArchive" nccgs install --project "D:\path\to\UnityProject"
21
22
  npx --yes --package "$NccgsArchive" nccgs doctor --project "D:\path\to\UnityProject"
@@ -37,6 +38,34 @@ execution policy, dùng `migrate-execution --to standalone --dry-run` theo hư
37
38
  Không tự đổi task cũ, xóa lịch sử hay đặt lại số lượt đã dùng. Sau thay hook/cấu hình,
38
39
  mở lại phiên Claude Code.
39
40
 
41
+ ## Gỡ NCCGS khi không còn dùng
42
+
43
+ Đóng các phiên Claude Code và chờ worker/kiểm tra kết thúc. Từ terminal bên ngoài,
44
+ dùng gói 2.1.0 cục bộ để xem trước rồi gỡ khỏi đúng dự án:
45
+
46
+ ```powershell
47
+ npx --yes --package "$NccgsArchive" nccgs uninstall --project "D:\path\to\UnityProject" --dry-run
48
+ npx --yes --package "$NccgsArchive" nccgs uninstall --project "D:\path\to\UnityProject"
49
+ ```
50
+
51
+ Có thể gỡ trực tiếp dự án đã cài 2.0.0, không cần nâng cấp trước. Lệnh chỉ xóa
52
+ tệp quản lý còn nguyên bản và tháo hook/import NCCGS; giữ mã game, tệp tùy chỉnh,
53
+ lịch sử task/review/nghiệm thu/chi phí và cấu hình trong `.nccgs`. Các thiết lập
54
+ Claude dùng chung được giữ vì bản cũ chưa ghi nhận quyền sở hữu từng giá trị.
55
+
56
+ Kết quả trả về mã `id` của bản sao lưu. Để khôi phục, dùng cùng gói với
57
+ `uninstall --project DIR --rollback ID --dry-run`, sau đó bỏ `--dry-run`.
58
+ Khôi phục sẽ bị chặn nếu tệp đã được sửa tiếp. Lệnh không dừng tiến trình, không
59
+ xóa lịch sử và không hoàn lại ngân sách. Xem [chi tiết](UNINSTALL.md).
60
+
61
+ Nếu launcher bị dừng bất thường, dùng `recover-session --id UUID --dry-run` để
62
+ xem khóa. Chỉ xác nhận `--confirm-process-tree-stopped` sau khi operator đã kiểm
63
+ tra toàn bộ cây tiến trình thực sự dừng; PID chết không đủ để suy ra điều đó.
64
+ Lệnh yêu cầu đúng mã băm xem trước và lý do, lưu nguyên khóa cùng biên bản,
65
+ không chạm khóa task/job/run. Các lệnh agent/migration/policy cũng bị chặn trong
66
+ lúc gỡ. Gỡ bị chặn trước khi sửa tệp được ghi là `cancelled`; lỗi dọn thư mục
67
+ rỗng chỉ là cảnh báo và vẫn trả về mã rollback.
68
+
40
69
  ## Bắt đầu một đầu việc rõ ràng
41
70
 
42
71
  ```powershell
@@ -64,14 +93,14 @@ nguyên nhân và kết quả sửa lại.
64
93
 
65
94
  ## Hỗ trợ handoff, Unity repair và chia nhỏ task trong NCCGS 2.0.0
66
95
 
67
- Source hiện có thêm các hỗ trợ chưa phát hành lên npm. Coordinator dùng
96
+ Các hỗ trợ đã có từ 2.0.0 được giữ nguyên trong 2.1.0. Coordinator dùng
68
97
  `task dispatch-prompt` để lấy prompt và khung bàn giao PARTIAL cho lượt đã đăng ký.
69
98
  Worker có thể dùng `task handoff-validate` để phát hiện lỗi cấu trúc trước khi kết
70
99
  thúc; repair worker theo giới hạn riêng của gói repair. Sau khi reviewer hoàn thành,
71
100
  coordinator dùng `task record-review` để ghi đúng kết luận từ handoff đã ghim,
72
101
  qua đầy đủ cổng kiểm tra hiện có. Các lệnh này không tự chấp thuận hay đóng task.
73
102
  Xem [cú pháp và giới hạn](HANDOFF-AUTOMATION.md). Dùng source/package mới theo quy
74
- trình nâng cấp; các lệnh ở trên dùng chính gói 2.0.0 cục bộ chưa phát hành.
103
+ trình nâng cấp; các lệnh ở trên dùng chính gói 2.1.0 cục bộ chưa phát hành.
75
104
 
76
105
  Repair cũ giữ nguyên. Gói mới `unity-code` cho sửa/tạo tối đa 8 tệp mã; `unity-editor`
77
106
  cho sửa scene/prefab/asset bằng thao tác Editor đã chốt trước. Tệp mới phải được
@@ -1,10 +1,27 @@
1
- # NCCGS 2.0.0 stable preparation
2
-
3
- Prepared stable package: **2.0.0**, unpublished. No npm publication or tag mutation
4
- has occurred. The release directory contains the exact local archive, SHA-256,
5
- regression/install/upgrade results and a separate maintenance review.
6
-
7
- ## Current evidence boundary
1
+ # NCCGS release status
2
+
3
+ Current source: **2.1.0**, unpublished. It adds reversible project uninstallation,
4
+ safe backup/rollback and launch/update protection during interrupted removal.
5
+ See [removal semantics](UNINSTALL.md). Local tests do not claim a new native
6
+ Claude Code/Unity run. The first independent maintenance review returned
7
+ CHANGES_REQUIRED. This candidate adds logged operator session reconciliation,
8
+ shared admission locking for configuration writers, pre-mutation cancellation
9
+ and best-effort directory cleanup. Its exact archive requires fresh full
10
+ regression and independent review; the earlier negative verdict is retained.
11
+
12
+ Version **2.0.0** was published on 2026-10-28 after exact-archive qualification.
13
+ The frozen publication receipt verified npm metadata and downloaded bytes,
14
+ fresh consumer installation and all 472 packaged files. Its archive SHA-256 is
15
+ `008df044b2486b273dbd0716782823b60da9750a676fa41cd4651a0e2f149cf3`.
16
+ Its maintenance audit and native Unity case completed with independent PASS;
17
+ the Unity case retained all 28 criteria/385 assertions, handoff, repair and the
18
+ unsaved-scene guard. Detailed private task/provider/cost receipts stay outside
19
+ the public package. That evidence does not transfer to 2.1.0 automatically.
20
+
21
+ ## Historical 2.0.0 preparation evidence
22
+
23
+ The preparation-time notes below are retained for context. Their pending stable
24
+ run/publication statements were superseded by the exact 2.0.0 completion above.
8
25
 
9
26
  - Exact RC4 archive SHA-256: a1db9783f3f4077c742cbc346d0fa935c438fdd783e13c058e13b0bd0521bbf6.
10
27
  The 2026-10-28 native Claude Code case qualified dirty-scene refusal, subsequent
@@ -0,0 +1,134 @@
1
+ # Remove NCCGS from a project
2
+
3
+ `uninstall` is available in the **unpublished 2.1.0 package**. The published
4
+ 2.0.0 CLI does not have this command. Use the local 2.1.0 archive (or its source
5
+ CLI) to remove an existing 2.0.0 installation; no preliminary update is needed.
6
+
7
+ Close Claude Code sessions and let managed workers/verification finish first.
8
+ Run from an external terminal. The command checks recorded process ownership,
9
+ dispatches, runs and jobs; it never kills processes, settles jobs or closes tasks.
10
+ Sessions launched directly with `claude`, or with older launchers, may have no
11
+ session record, so they must also be closed by the operator.
12
+
13
+ ## Preview and remove
14
+
15
+ ```powershell
16
+ $NccgsArchive = "D:\path\to\nccgs-2.1.0.tgz"
17
+ npx --yes --package "$NccgsArchive" nccgs uninstall --project "D:\path\to\UnityProject" --dry-run
18
+ npx --yes --package "$NccgsArchive" nccgs uninstall --project "D:\path\to\UnityProject"
19
+ ```
20
+
21
+ From this source checkout, use `node scripts/cli.mjs uninstall --project DIR`
22
+ with the same options. Always name the intended project. The package refuses
23
+ to uninstall its own source directory.
24
+
25
+ The preview writes nothing and lists files to remove, shared files to edit and
26
+ modified/unknown inventoried files to preserve. There is no `--force` or history
27
+ purge option. A repeated uninstall reports `NOT_INSTALLED` after successful removal.
28
+
29
+ | Item | Result |
30
+ |---|---|
31
+ | Unchanged inventoried NCCGS/Unity skills, agents, protocols and tools | Removed after fingerprint checks |
32
+ | Optional generated NCCGS agents | Removed only if their recorded fingerprints still match |
33
+ | Customized or unknown managed files; unrelated files in `.claude` | Kept in place |
34
+ | Exact NCCGS hooks and canonical import in `CLAUDE.md` | Removed; unrelated hooks and owner text kept |
35
+ | Unchanged NCCGS bootstrap `CLAUDE.md` | Removed |
36
+ | Game source, scenes, prefabs, packages and project settings | Unchanged |
37
+ | `.nccgs` policy, task history, reviews, evidence, budgets and prior backups | Kept byte for byte |
38
+ | Generic Claude permission/model preferences | Kept; older installers did not track their ownership |
39
+
40
+ A retained custom NCCGS skill or agent may still be discoverable by Claude and
41
+ may refer to removed tools. The output identifies those files for manual review;
42
+ they are not silently deleted. Unknown non-inventoried owner files are never
43
+ claimed as NCCGS-owned. Customized compound hooks/imports must be separated by
44
+ the owner before removal, because automatically editing them could lose behavior.
45
+
46
+ ## Backup and recovery
47
+
48
+ Removal prints an `id` and saves a manifest plus original file bytes beneath
49
+ `.nccgs/uninstall/<id>/`. Keep that directory if you may need recovery.
50
+
51
+ ```powershell
52
+ npx --yes --package "$NccgsArchive" nccgs uninstall --project "D:\path\to\UnityProject" --rollback "PRINTED-UUID" --dry-run
53
+ npx --yes --package "$NccgsArchive" nccgs uninstall --project "D:\path\to\UnityProject" --rollback "PRINTED-UUID"
54
+ npx --yes --package "$NccgsArchive" nccgs doctor --project "D:\path\to\UnityProject"
55
+ ```
56
+
57
+ Use the same package for recovery. All backup hashes and destination files are
58
+ checked before restoration; a later edit or damaged backup causes refusal. The
59
+ receipt and history remain after restoration. A write failure attempts automatic
60
+ restoration; an interrupted operation requires inspection and explicit rollback.
61
+ New launch/install/update operations refuse an incomplete uninstall receipt.
62
+ Do not delete locks or receipts merely to bypass this check.
63
+
64
+ Agent reconfiguration, execution migration and policy regeneration also participate
65
+ in the uninstall admission lock. New cooperating operations cannot register a
66
+ session while removal/rollback holds this lock. A refusal before any managed file
67
+ is changed leaves a `cancelled` receipt with its diagnostic and backups; it does
68
+ not require rollback. After changes begin, normal ownership checks still apply to
69
+ restoration. Unrecorded/older concurrent operations require operator inspection.
70
+ Failure to remove an empty directory is a warning after successful removal; the
71
+ result still returns the backup path and rollback ID.
72
+
73
+ Two launches/configuration commands can briefly contend for the admission lock.
74
+ This reports `installation admission is busy or unverified`, rather than claiming
75
+ an uninstall is running. Retry once the other operation finishes; the command
76
+ does not retry automatically or take over a live/unverified lock.
77
+ Empty, incomplete, unreadable or disappearing lock records also produce the
78
+ busy/unverified diagnostic, retaining the original cause for inspection. They
79
+ never authorize admission or automatic recovery. A holder that releases before
80
+ the error recheck still results in refusal; retry explicitly once work settles.
81
+
82
+ ## Recover a crashed launcher lease
83
+
84
+ Closing a terminal forcibly or a crash can leave a `nccgs run` lease in
85
+ `.nccgs/sessions/<UUID>.lock`. An unmanaged child's descendants cannot be proven
86
+ stopped merely because its launcher and child PIDs are dead. Uninstall therefore
87
+ continues to refuse this unknown state automatically.
88
+
89
+ The external operator can explicitly reconcile **only that launcher lease**:
90
+
91
+ ```powershell
92
+ npx --yes --package "$NccgsArchive" nccgs recover-session --project "D:\path\to\UnityProject" --id "SESSION-UUID" --dry-run
93
+ ```
94
+
95
+ Independently inspect and stop the entire session process tree first, including
96
+ any child that spawned before its PID was recorded. Rebooting the host and checking
97
+ that the session has not restarted is one way to establish that boundary. Only
98
+ when this is true, use the preview's SHA-256 and record how it was confirmed:
99
+
100
+ ```powershell
101
+ npx --yes --package "$NccgsArchive" nccgs recover-session --project "D:\path\to\UnityProject" --id "SESSION-UUID" --sha256 "HASH-FROM-PREVIEW" --confirm-process-tree-stopped --reason "Describe how the full session tree was confirmed stopped"
102
+ ```
103
+
104
+ This is a human/operator attestation, **not automatic descendant proof**. The
105
+ command refuses live/unverified recorded PIDs, a foreign host, changed hashes,
106
+ wrong operation, unsafe IDs and invocation inside Claude Code. It archives the
107
+ exact original lease and a receipt with the operator's reason under
108
+ `.nccgs/session-recoveries/<id>/`. It never kills a process or edits task/job/run
109
+ locks, verdicts, history or budgets. Other active/unknown work still blocks
110
+ uninstall. A missing child PID during `spawning` explicitly remains unobserved
111
+ in the receipt; the operator must establish shutdown independently before confirming.
112
+ Keep the receipts and retry the original uninstall/rollback only after all work
113
+ has settled. There is no age-based or automatic eviction of unknown leases.
114
+
115
+ Each recovery writes an immutable `receipt.json` with status `pending` before
116
+ moving the lease, then a separate `outcome.json` with status `completed` or
117
+ `failed`. The outcome identifies the pending receipt by SHA-256. A rename failure
118
+ leaves the original lease in place and records the error; it is not a successful
119
+ recovery. If a crash or write failure leaves no valid outcome, completion remains
120
+ unconfirmed: inspect both the original lease and the archive, retaining every
121
+ record. The lease may already have moved if recording completion failed. A pending
122
+ receipt alone never proves success, and the command does not report success when
123
+ it cannot record completion. Retrying a failed move creates a new receipt; it
124
+ does not overwrite the earlier attempt.
125
+
126
+ Reinstalling later reuses retained policy and task records. It does not replenish
127
+ spent money, turns, reviews or time. Restoring an old uninstall must not overwrite
128
+ a subsequent installation. Removal/rollback is a maintenance action, not a task
129
+ PASS, independent review, acceptance decision or a new allowance.
130
+
131
+ The command removes the project integration only. It does not uninstall Claude
132
+ Code, Unity, Node.js, global npm packages or npm's cache, and makes no provider
133
+ calls. Symlinks/junctions, malformed records and uncertain process ownership fail
134
+ closed rather than permitting deletion outside the checked project.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nccgs",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Unity-first game-studio operating system for Claude Code",
5
5
  "license": "MIT",
6
6
  "type": "module",