nccgs 2.0.0-rc.2 → 2.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
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 public 2.0.0-rc.2 release candidate, distributed through npm's next tag.
4
+ This is the public 2.0.0-rc.3 release candidate, distributed through npm's next tag.
5
5
  It is not stable promotion. The package README and changelog describe release scope.
6
6
  Project-specific authorizations, provider sessions, budgets and internal development
7
7
  history are retained separately, outside the public package. Nothing in this file
@@ -1 +1 @@
1
- 2.0.0-rc.2
1
+ 2.0.0-rc.3
@@ -1,6 +1,6 @@
1
1
  # NCCGS 2.0 RC — implementation and operation
2
2
 
3
- Version: **2.0.0-rc.2**. Target executor: **Claude Code**.
3
+ Version: **2.0.0-rc.3**. Target executor: **Claude Code**.
4
4
  Framework tests and scoped native delivery evidence exist. Fresh end-to-end
5
5
  qualification of this exact RC and published-1.3 upgrade qualification are pending. Read [MEMORY.md](../MEMORY.md) before interpreting evaluation results.
6
6
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0-rc.3 — 2026-10-07
4
+
5
+ Published-1.3.0 upgrade correction on next; latest remains unchanged.
6
+
7
+ - Fixed false overrides when a role generated by a 1.3.0 profile becomes a managed
8
+ file in 2.0. Existing generated fingerprints now identify unchanged agent files;
9
+ later user edits and explicit overrides still require review.
10
+ - RC2 qualification exposed the issue in quality, balanced and inherit profiles.
11
+ The astra-claude path was unaffected. Original failed results are retained.
12
+ - Release qualification uses the published 1.3.0 archive and the exact candidate
13
+ archive across four model profiles, owner settings and open task history,
14
+ override preservation, dry runs, explicit execution migration, rollback and
15
+ refusal of changed configuration/backups. See docs/UPGRADE-QUALIFICATION.md.
16
+ - A new task executed by Claude Code through this exact release remains pending;
17
+ this correction does not promote stable or change the frozen game evaluation.
18
+
3
19
  ## 2.0.0-rc.2 — 2026-10-07
4
20
 
5
21
  Release documentation follow-up on next; latest remains unchanged.
package/MEMORY.md CHANGED
@@ -1,7 +1,7 @@
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 public 2.0.0-rc.2 release candidate, distributed through npm's next tag.
4
+ This is the public 2.0.0-rc.3 release candidate, distributed through npm's next tag.
5
5
  It is not stable promotion. See README.md and CHANGELOG.md for release scope.
6
6
  Project-specific authorizations, provider sessions, budgets and internal development
7
7
  history are retained separately, outside the public package. Nothing in this file
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NCCGS — New Claude Code Game Studio
2
2
 
3
- **2.0.0-rc.2** is a release candidate for standalone game-development orchestration
3
+ **2.0.0-rc.3** is a release candidate for standalone game-development orchestration
4
4
  in **Claude Code**, published on npm's **next** channel. The stable/latest channel
5
5
  is not promoted by this release.
6
6
 
@@ -21,7 +21,8 @@ and negative findings remain preserved in the development evidence.
21
21
  The release source includes the reviewed fixes to reviewer capacity, handoff schema
22
22
  guidance and standalone command syntax. The game case used a frozen framework with
23
23
  a session-only reviewer capacity override. This exact RC has not yet completed a
24
- fresh full game task or a published-1.3.0 upgrade qualification. Use a disposable
24
+ fresh full game task. Published-1.3.0 upgrade scope is documented in
25
+ [upgrade qualification](docs/UPGRADE-QUALIFICATION.md). Use a disposable
25
26
  project or backed-up copy while evaluating it. See [release status](docs/RELEASE-STATUS.md), [Vietnamese quick start](docs/HUONG-DAN-MIGRATE-VA-SU-DUNG.md), [release notes](CHANGELOG.md),
26
27
  [upgrading](UPGRADING.md), [delivery acceptance](.claude/nccgs/protocols/delivery-acceptance.md)
27
28
  and [portable framework decisions](MEMORY.md).
@@ -69,14 +70,14 @@ Requirements: Claude Code and Node.js 18+. Unity CLI/Pipeline is needed for live
69
70
  Unity operations. Run against a disposable Unity project first:
70
71
 
71
72
  ```powershell
72
- npx --yes nccgs@2.0.0-rc.2 install --project "D:\path\to\UnityProject" --dry-run
73
- npx --yes nccgs@2.0.0-rc.2 install --project "D:\path\to\UnityProject"
74
- npx --yes nccgs@2.0.0-rc.2 doctor --project "D:\path\to\UnityProject"
73
+ npx --yes nccgs@2.0.0-rc.3 install --project "D:\path\to\UnityProject" --dry-run
74
+ npx --yes nccgs@2.0.0-rc.3 install --project "D:\path\to\UnityProject"
75
+ npx --yes nccgs@2.0.0-rc.3 doctor --project "D:\path\to\UnityProject"
75
76
  ```
76
77
 
77
78
  Use nccgs@next to follow candidate releases, or pin the exact version above for
78
79
  repeatability. Use update for an existing installation only after reviewing its
79
- dry run and backup. Published-1.3.0 upgrade qualification is still pending for this RC.
80
+ dry run and backup. See [the tested upgrade matrix](docs/UPGRADE-QUALIFICATION.md) and its limits.
80
81
  The installer preserves customized files and unrelated Claude settings, records
81
82
  overrides and backs up replacements. Do not use --force as an ordinary update path.
82
83
 
@@ -84,7 +85,7 @@ New installs default to standalone with `claude-standalone`. Existing installati
84
85
  without execution.json remain compatibility. To migrate explicitly:
85
86
 
86
87
  ```powershell
87
- npx --yes nccgs@2.0.0-rc.2 migrate-execution --project "D:\path\to\UnityProject" --to standalone --model-profile claude-standalone --dry-run
88
+ npx --yes nccgs@2.0.0-rc.3 migrate-execution --project "D:\path\to\UnityProject" --to standalone --model-profile claude-standalone --dry-run
88
89
  ```
89
90
 
90
91
  Inspect the dry run, then remove `--dry-run`. Omitting `--model-profile` preserves
@@ -96,7 +97,7 @@ task handling. Updating files never converts an old approval into a new one.
96
97
  Start a task session with native permissions already selected:
97
98
 
98
99
  ```powershell
99
- npx --yes nccgs@2.0.0-rc.2 run --project "D:\path\to\UnityProject"
100
+ npx --yes nccgs@2.0.0-rc.3 run --project "D:\path\to\UnityProject"
100
101
  ```
101
102
 
102
103
  New installations default to task autonomy `full`. Existing installations keep
package/UPGRADING.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Upgrading NCCGS 2.0 RC
2
2
 
3
- Current candidate: **2.0.0-rc.2** on npm **next**. `latest` remains on the stable
3
+ Current candidate: **2.0.0-rc.3** on npm **next**. `latest` remains on the stable
4
4
  release line. Pin an exact version when reproducing an installation.
5
5
  Read [release status](docs/RELEASE-STATUS.md) for what has and has not been verified.
6
6
 
@@ -13,9 +13,9 @@ Read [release status](docs/RELEASE-STATUS.md) for what has and has not been veri
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
15
 
16
- **Published-1.3.0 upgrade qualification is pending.** The commands below document
17
- the supported interface; they are not evidence that this upgrade has passed.
18
- Try a complete copy of the project before applying an RC to active work.
16
+ **Published-1.3.0 upgrade qualification is covered for the tested fixture matrix.**
17
+ See [upgrade qualification](docs/UPGRADE-QUALIFICATION.md) for scope and the RC2
18
+ issue corrected in RC3. Try a complete copy before applying an RC to active work.
19
19
 
20
20
  ## New installation
21
21
 
@@ -24,9 +24,9 @@ Unity project with Assets, Packages and ProjectSettings. Live Unity operations
24
24
  also require the appropriate Unity Editor/CLI integration.
25
25
 
26
26
  ```powershell
27
- npx --yes nccgs@2.0.0-rc.2 install --project "D:\path\to\UnityProject" --dry-run
28
- npx --yes nccgs@2.0.0-rc.2 install --project "D:\path\to\UnityProject"
29
- npx --yes nccgs@2.0.0-rc.2 doctor --project "D:\path\to\UnityProject"
27
+ npx --yes nccgs@2.0.0-rc.3 install --project "D:\path\to\UnityProject" --dry-run
28
+ npx --yes nccgs@2.0.0-rc.3 install --project "D:\path\to\UnityProject"
29
+ npx --yes nccgs@2.0.0-rc.3 doctor --project "D:\path\to\UnityProject"
30
30
  ```
31
31
 
32
32
  New installations select standalone execution and the claude-standalone model
@@ -41,9 +41,9 @@ open task records and evidence. Stop active NCCGS sessions before applying an
41
41
  update. Do not update a frozen evaluation in place.
42
42
 
43
43
  ```powershell
44
- npx --yes nccgs@2.0.0-rc.2 update --project "D:\path\to\ProjectCopy" --dry-run
45
- npx --yes nccgs@2.0.0-rc.2 update --project "D:\path\to\ProjectCopy"
46
- npx --yes nccgs@2.0.0-rc.2 doctor --project "D:\path\to\ProjectCopy"
44
+ npx --yes nccgs@2.0.0-rc.3 update --project "D:\path\to\ProjectCopy" --dry-run
45
+ npx --yes nccgs@2.0.0-rc.3 update --project "D:\path\to\ProjectCopy"
46
+ npx --yes nccgs@2.0.0-rc.3 doctor --project "D:\path\to\ProjectCopy"
47
47
  ```
48
48
 
49
49
  Inspect the dry-run changes before the second command. Ordinary updates preserve
@@ -67,20 +67,21 @@ After installing/updating, migrate only when the owner intends to adopt standalo
67
67
  Review any active task's pinned obligations before changing policy.
68
68
 
69
69
  ```powershell
70
- npx --yes nccgs@2.0.0-rc.2 migrate-execution --project "D:\path\to\ProjectCopy" --to standalone --model-profile claude-standalone --dry-run
70
+ npx --yes nccgs@2.0.0-rc.3 migrate-execution --project "D:\path\to\ProjectCopy" --to standalone --model-profile claude-standalone --dry-run
71
71
  ```
72
72
 
73
73
  Inspect the result, then repeat without `--dry-run` to apply. Omit
74
74
  `--model-profile` to preserve model routes. An update alone does not perform this
75
75
  migration. Schema-1 tasks retain their original gates/history; do not relabel them
76
- as schema-2, reuse stale approvals or reset consumed attempts. Finish under the
77
- pinned policy or explicitly scope subsequent work with retained lineage/evidence.
76
+ as schema-2, reuse stale approvals or reset consumed attempts. A changed pipeline can block resuming an old task. Finish it before upgrading,
77
+ or explicitly scope subsequent work with retained lineage/evidence; updating or
78
+ rolling back execution settings does not re-approve an old task.
78
79
 
79
80
  The command archives configuration under `.nccgs/backups/execution/<ID>`. To
80
81
  preview restoration of that execution migration:
81
82
 
82
83
  ```powershell
83
- npx --yes nccgs@2.0.0-rc.2 migrate-execution --project "D:\path\to\ProjectCopy" --rollback "MIGRATION_UUID" --dry-run
84
+ npx --yes nccgs@2.0.0-rc.3 migrate-execution --project "D:\path\to\ProjectCopy" --rollback "MIGRATION_UUID" --dry-run
84
85
  ```
85
86
 
86
87
  Use the actual printed UUID; remove `--dry-run` only after reviewing the preview.
@@ -94,7 +95,7 @@ not an atomic transaction and may require manual recovery.
94
95
  ## Start and review work
95
96
 
96
97
  ```powershell
97
- npx --yes nccgs@2.0.0-rc.2 run --project "D:\path\to\UnityProject"
98
+ npx --yes nccgs@2.0.0-rc.3 run --project "D:\path\to\UnityProject"
98
99
  ```
99
100
 
100
101
  Use `/status` in Claude Code to inspect obligations. Use `/migrate-project` when
@@ -105,4 +106,4 @@ game quality, completion of a task or human acceptance.
105
106
  Existing projects that intentionally use Astra/Fable keep their configured chain.
106
107
  See [compatibility gates](.claude/nccgs/protocols/task-gates.md). Historical 1.4/1.5
107
108
  guides describe their original versions; this document governs the current RC's
108
- installation commands and release status.
109
+ installation commands and release status.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0-rc.2
1
+ 2.0.0-rc.3
@@ -1,8 +1,9 @@
1
1
  # Hướng dẫn cài đặt và sử dụng NCCGS 2.0 RC
2
2
 
3
- Bản hiện tại: **2.0.0-rc.2**, kênh npm **next**. `latest` là kênh stable riêng.
4
- Đây là ứng viên phát hành; chưa kiểm chứng nâng cấp từ npm 1.3.0 hoặc chạy trọn một
5
- đầu việc mới bằng chính RC này. Xem [trạng thái phát hành](RELEASE-STATUS.md).
3
+ Bản hiện tại: **2.0.0-rc.3**, kênh npm **next**. `latest` là kênh stable riêng.
4
+ Đây là ứng viên phát hành. Nâng cấp từ npm 1.3.0 đã được kiểm chứng trong phạm vi
5
+ [các tình huống thử](UPGRADE-QUALIFICATION.md); chạy trọn một đầu việc mới bằng
6
+ chính RC 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).
6
7
 
7
8
  ## Cài mới vào bản sao dự án
8
9
 
@@ -11,9 +12,9 @@ Chức năng điều khiển Unity cần thêm Editor/CLI phù hợp. Thay đư
11
12
  dự án của bạn; đọc kết quả xem trước rồi mới áp dụng:
12
13
 
13
14
  ```powershell
14
- npx --yes nccgs@2.0.0-rc.2 install --project "D:\path\to\UnityProject" --dry-run
15
- npx --yes nccgs@2.0.0-rc.2 install --project "D:\path\to\UnityProject"
16
- npx --yes nccgs@2.0.0-rc.2 doctor --project "D:\path\to\UnityProject"
15
+ npx --yes nccgs@2.0.0-rc.3 install --project "D:\path\to\UnityProject" --dry-run
16
+ npx --yes nccgs@2.0.0-rc.3 install --project "D:\path\to\UnityProject"
17
+ npx --yes nccgs@2.0.0-rc.3 doctor --project "D:\path\to\UnityProject"
17
18
  ```
18
19
 
19
20
  Có thể dùng `nccgs@next` để theo RC mới nhất; dùng số phiên bản cụ thể để tái lập.
@@ -35,7 +36,7 @@ mở lại phiên Claude Code.
35
36
  ## Bắt đầu một đầu việc rõ ràng
36
37
 
37
38
  ```powershell
38
- npx --yes nccgs@2.0.0-rc.2 run --project "D:\path\to\UnityProject"
39
+ npx --yes nccgs@2.0.0-rc.3 run --project "D:\path\to\UnityProject"
39
40
  ```
40
41
 
41
42
  Trong Claude Code, cung cấp mục tiêu, phạm vi, yêu cầu cố định, phần được phép sửa
@@ -55,4 +56,4 @@ mong muốn, không phải bằng chứng model thực chạy. Chỉ gọi chuy
55
56
  Đạt test chưa tự động nghĩa là DONE. Phải có bằng chứng đúng source/contract,
56
57
  review hợp lệ và mọi gate áp dụng đều đạt. Nghiệm thu kỹ thuật và quyết định nghiệm
57
58
  thu của người dùng được ghi riêng. Một lượt thất bại phải được giữ cùng chi phí,
58
- nguyên nhân và kết quả sửa lại.
59
+ nguyên nhân và kết quả sửa lại.
@@ -1,16 +1,16 @@
1
1
  # NCCGS 2.0 RC release status
2
2
 
3
- Current candidate: **2.0.0-rc.2**. Release channel: **next**. Latest/stable is not
3
+ Current candidate: **2.0.0-rc.3**. Release channel: **next**. Latest/stable is not
4
4
  promoted by this candidate. Pin the exact version for reproducible evaluation.
5
5
 
6
6
  ## What the evidence supports
7
7
 
8
8
  | Check | Status and scope |
9
9
  |---|---|
10
- | Framework functional regression | Previous maintained source: 183 PASS, 0 FAIL, 6 Windows symlink skips across 189 tests. RC2 changes metadata/docs only; runtime implementation is compared with RC1 during packaging. |
10
+ | Framework functional regression | Previous maintained source: 183 PASS, 0 FAIL, 6 Windows symlink skips across 189 tests. RC3 changes installer recognition of previously generated agents and adds a focused regression. Installer/policy suites and exact-archive upgrade qualification are rerun for this change. |
11
11
  | Scoped native delivery V2 case | 24/24 criteria,137 EditMode,52 PlayMode and independent unconditional Claude Code PASS. Operator-assisted; used a frozen framework with a session-only reviewer capacity override. |
12
12
  | RC package integrity | Release procedure verifies version consistency, public contents, documentation links, and install/doctor on a fresh disposable fixture using the packed archive. This is not an upgrade or provider task test. |
13
- | Upgrade from published npm 1.3.0 | PENDING — separate qualification step. Documented commands do not prove the upgrade. |
13
+ | Upgrade from published npm 1.3.0 | Qualified within the disposable fixture matrix; RC2 exposed a generated-agent issue corrected in RC3. See [scope and limits](UPGRADE-QUALIFICATION.md). |
14
14
  | Fresh task through this exact RC | PENDING — separate qualification step. Earlier delivery evidence is not attributed to a new run. |
15
15
  | Human third-party acceptance | Separate decision; not supplied by installation, tests or this release status. |
16
16
  | Broad game quality/productivity | Not established. No universal quality, balance, cost or efficiency claim. |
@@ -29,14 +29,16 @@ change current defaults or add new delivery gates. Current installation guidance
29
29
  is in [UPGRADING.md](../UPGRADING.md) and the
30
30
  [Vietnamese quick start](HUONG-DAN-MIGRATE-VA-SU-DUNG.md).
31
31
 
32
- ## RC2 change scope
32
+ ## RC3 change scope
33
33
 
34
34
  RC1 already standardized package metadata and removed private memory. RC2 finishes
35
35
  public documentation: current standalone defaults, exact-version npm commands,
36
36
  separate update/migration/rollback instructions, current role counts and visible
37
- historical boundaries. No runtime JavaScript, model routing, game code, acceptance
38
- threshold or frozen evaluation is changed. See [changelog](../CHANGELOG.md).
37
+ historical boundaries. Those RC2 documentation edits changed no runtime JavaScript, model routing, game
38
+ code, acceptance threshold or frozen evaluation. RC3 changes the installer only
39
+ and adds its regression; no game or frozen evaluation is changed. See [changelog](../CHANGELOG.md).
39
40
 
40
41
  The major candidate communicates standalone defaults and explicit policy migration
41
42
  from the older compatibility workflow. Existing task obligations are retained.
42
- RC2 does not complete the two pending qualification steps or promote stable.
43
+ RC3 corrects one installer defect exposed by upgrade qualification. The exact-RC
44
+ Claude Code task remains pending; stable is not promoted.
@@ -0,0 +1,45 @@
1
+ # Published 1.3.0 upgrade qualification
2
+
3
+ Target: **2.0.0-rc.3**. This is installation/configuration qualification on Windows
4
+ with Node.js 24.12.0 using the published npm 1.3.0 archive and the exact RC3 archive.
5
+ It does not establish Node 18, macOS/Linux, provider execution or gameplay results.
6
+
7
+ ## Tested scope
8
+
9
+ - Fresh 1.3.0 installations with astra-claude, quality, balanced and inherit profiles;
10
+ update dry run, actual update, doctor and repeat update without content drift.
11
+ - Owner source, project policy, custom Claude instructions/agents, local settings,
12
+ explicit permissions, environment and custom hooks sharing a managed hook group.
13
+ - A task created by the real 1.3.0 CLI, with explicitly synthetic history/allowance
14
+ sentinels: task bytes and evidence are retained; an incomplete task cannot close.
15
+ - Edited and deleted managed files are preserved and require migration review.
16
+ A successful update exit does not waive a failing doctor or approve overrides.
17
+ - Malformed settings are rejected before project writes.
18
+ - Explicit standalone migration, dry runs and exact restoration of captured
19
+ configuration; later edits and altered backup hashes prevent rollback.
20
+ - Recovery from a complete pre-upgrade project backup, verified by file hashes and
21
+ the old doctor. Execution rollback alone is not a framework downgrade.
22
+
23
+ ## RC2 finding and correction
24
+
25
+ RC2 falsely treated nccgs-game-designer as a local override when upgrading clean
26
+ quality, balanced or inherit installations. The old profile had generated that
27
+ agent outside its managed-file list; RC2 started managing it but ignored the
28
+ recorded generation fingerprint. RC3 accepts unchanged recorded generated bytes
29
+ as an update baseline. Real edits and explicit override records remain protected.
30
+
31
+ Use RC3 directly from a backed-up 1.3.0 installation. If RC2 already recorded a
32
+ pending override, review/rebase it through the documented migration workflow or
33
+ recover the complete pre-upgrade backup before retrying RC3. Do not use --force
34
+ or approve all overrides merely to suppress this warning.
35
+
36
+ ## Limits that still apply
37
+
38
+ Ordinary update preserves model selection and compatibility obligations; adopting
39
+ standalone is explicit. Preserving task bytes does not make old approvals current.
40
+ The new pipeline can block an old task from resuming; finish before upgrading or
41
+ create explicitly scoped continuation work while retaining history and evidence.
42
+
43
+ Fixtures have Unity directory markers and sentinel source files. No Unity Editor
44
+ or Claude worker is launched. The native exact-RC task is a separate pending step.
45
+ Automated fixture results are not third-party human acceptance.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nccgs",
3
- "version": "2.0.0-rc.2",
3
+ "version": "2.0.0-rc.3",
4
4
  "description": "Unity-first game-studio operating system for Claude Code",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -88,6 +88,7 @@ const overrideManifestPath = projectPath(".nccgs/framework-overrides.json");
88
88
  // even when a pre-existing file would otherwise be preserved or skipped.
89
89
  for (const relative of ["CLAUDE.md", ".claude/settings.json", ".nccgs/project.yaml", ".nccgs/execution.json", ".nccgs/backups", ".nccgs/agent-activation.json"]) projectPath(relative);
90
90
  const previousInstallState = readJsonIfPresent(installStatePath, "NCCGS install state");
91
+ const previousActivation = readJsonIfPresent(projectPath(".nccgs/agent-activation.json"), "NCCGS agent activation state");
91
92
  const executionFile = projectPath(".nccgs/execution.json");
92
93
  const previousExecution = readJsonIfPresent(executionFile, "NCCGS execution policy");
93
94
  const existingProjectPolicy = fs.existsSync(projectPath(".nccgs/project.yaml"));
@@ -308,6 +309,15 @@ function planFrameworkFile(item) {
308
309
  }
309
310
  if (equivalentFiles(item.source, item.destination)) return { ...item, action: "current", override: null };
310
311
  if (!force && previous && matchesFingerprint(item.destination, previous)) return { ...item, action: "replace", override: null };
312
+ // Older profiles could generate optional agents outside install-state.files.
313
+ // When a later package starts managing one, its recorded generated bytes are
314
+ // a valid baseline. Real local edits and explicit overrides still need review.
315
+ const generated = previousActivation?.schemaVersion === 1 && item.relative.startsWith(".claude/agents/")
316
+ ? { sha256: previousActivation.generated?.[item.relative], canonicalSha256: previousActivation.generatedCanonical?.[item.relative] }
317
+ : null;
318
+ if (!force && previousInstallState && !previous && !existingOverride && matchesFingerprint(item.destination, generated)) {
319
+ return { ...item, action: "replace", override: null };
320
+ }
311
321
  if (force) return { ...item, action: "force-replace", override: null };
312
322
  return { ...item, action: "preserve", override: buildOverride(item, existingOverride, upstream, "preserve") };
313
323
  }
@@ -459,6 +459,44 @@ test("update replaces untouched files, preserves local overrides, and doctor gat
459
459
  }
460
460
  });
461
461
 
462
+ test("update adopts unchanged generated agents newly tracked by the package, preserving real edits", () => {
463
+ const f = safetyFixture("nccgs-generated-adoption-");
464
+ try {
465
+ const installed = f.run("install", "--model-profile", "quality");
466
+ assert.equal(installed.status, 0, installed.stderr || installed.stdout);
467
+ const relative = ".claude/agents/nccgs-game-designer.md";
468
+ const file = path.join(f.project, relative);
469
+ const stateFile = path.join(f.project, ".claude/nccgs/install-state.json");
470
+ const generatedFile = path.join(f.project, ".nccgs/agent-activation.json");
471
+ const original = fs.readFileSync(file, "utf8");
472
+ // Older packages can generate a profile's optional agent without listing it
473
+ // in install-state.files. A later package can make that agent a core file.
474
+ const state = JSON.parse(fs.readFileSync(stateFile, "utf8"));
475
+ state.files = state.files.filter(item => item.relative !== relative);
476
+ fs.writeFileSync(stateFile, JSON.stringify(state));
477
+ const update = f.run("update");
478
+ assert.equal(update.status, 0, update.stderr || update.stdout);
479
+ const doctor = f.run("doctor");
480
+ assert.equal(doctor.status, 0, doctor.stderr || doctor.stdout);
481
+ assert.equal(fs.readFileSync(file, "utf8"), original);
482
+ assert.ok(JSON.parse(fs.readFileSync(stateFile)).files.some(item => item.relative === relative));
483
+
484
+ // A stored generated hash alone must never authorize replacing later edits.
485
+ const nextState = JSON.parse(fs.readFileSync(stateFile, "utf8"));
486
+ nextState.files = nextState.files.filter(item => item.relative !== relative);
487
+ fs.writeFileSync(stateFile, JSON.stringify(nextState));
488
+ assert.ok(JSON.parse(fs.readFileSync(generatedFile)).generated[relative]);
489
+ const customized = original + "\nOwner instruction: keep the custom design rule.\n";
490
+ fs.writeFileSync(file, customized);
491
+ const preserved = f.run("update");
492
+ assert.equal(preserved.status, 0, preserved.stderr || preserved.stdout);
493
+ assert.equal(fs.readFileSync(file, "utf8"), customized);
494
+ const manifest = JSON.parse(fs.readFileSync(path.join(f.project, ".nccgs/framework-overrides.json")));
495
+ assert.equal(manifest.overrides.find(item => item.path === relative).status, "pending_review");
496
+ assert.equal(f.run("doctor").status, 1);
497
+ } finally { f.dispose(); }
498
+ });
499
+
462
500
  test("doctor accepts a legacy CRLF raw hash after Git normalizes the file to LF", () => {
463
501
  const temp = fs.mkdtempSync(path.join(os.tmpdir(), "nccgs-eol-test-"));
464
502
  try {