@elvis1513/auto-coding-skill 3.0.4 → 4.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.
@@ -136,8 +136,20 @@ function fillRequiredAccess(repo, password = "local-dev-password") {
136
136
  ' username: "nexus-frontend-user"',
137
137
  ` password: ${JSON.stringify(password)}`,
138
138
  ].join("\n");
139
- const updated = text.replace(/^access:\r?\n[\s\S]*?(?=^concurrency:)/m, `${block}\n\n`);
140
- assert(updated !== text || text.includes(password), "required access block should be replaceable");
139
+ const withAccess = text.replace(/^access:\r?\n[\s\S]*?(?=^concurrency:)/m, `${block}\n\n`);
140
+ const updated = withAccess
141
+ .replace(' project_fast: ""', ' project_fast: "true"')
142
+ .replace(
143
+ " routes: []",
144
+ [
145
+ " routes:",
146
+ ' - name: "project-code"',
147
+ ' paths: ["**"]',
148
+ ' exclude: ["*.md", "docs/**"]',
149
+ ' commands: ["project_fast"]',
150
+ ].join("\n"),
151
+ );
152
+ assert(updated !== text || text.includes(password), "required project values should be replaceable");
141
153
  fs.writeFileSync(engineering, updated);
142
154
  }
143
155
 
@@ -197,25 +209,25 @@ function testMinimalSyncConvergesWithinBudget() {
197
209
  assert(before.status !== 0, "status should fail before core scaffold exists");
198
210
  run("node", [cli, "sync", "--projects", repo]);
199
211
 
200
- for (const rel of ["docs/ENGINEERING.md", "docs/tasks/taskbook.md", "docs/tasks/closure-log.md", "docs/tools/autopipeline/ap.py"]) {
212
+ for (const rel of ["docs/ENGINEERING.md", "docs/tools/autopipeline/ap.py"]) {
201
213
  assert(exists(path.join(repo, rel)), `missing core scaffold file: ${rel}`);
202
214
  }
203
- for (const rel of ["docs/interfaces/api.md", "docs/design/_TEMPLATE-DD.md", "docs/testing/regression-matrix.md", "docs/tools/autopipeline/core.py", "docs/tools/autopipeline/http_checks.py"]) {
215
+ for (const rel of ["docs/tasks/taskbook.md", "docs/tasks/closure-log.md", "docs/interfaces/api.md", "docs/design/_TEMPLATE-DD.md", "docs/testing/regression-matrix.md", "docs/tools/autopipeline/core.py", "docs/tools/autopipeline/http_checks.py"]) {
204
216
  assert(!exists(path.join(repo, rel)), `optional/duplicate file should not be installed: ${rel}`);
205
217
  }
206
218
 
207
219
  const files = listProjectFiles(repo);
208
220
  const lines = files.reduce((total, file) => total + fs.readFileSync(file, "utf8").split(/\r?\n/).length, 0);
209
221
  assert(files.length <= 23, `minimal scaffold file budget exceeded: ${files.length}`);
210
- assert(lines <= 10000, `minimal scaffold line budget exceeded: ${lines}`);
222
+ assert(lines <= 10800, `minimal scaffold line budget exceeded: ${lines}`);
211
223
  const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
212
224
  assert(engineering.includes("profile: \"auto\""), "engineering should enable adaptive profiles");
213
225
  assert(engineering.includes("isolation: \"adaptive\""), "engineering should default to adaptive clean-branch/worktree isolation");
214
226
  assert(engineering.includes('completion: "push"'), "engineering should complete normal development at push");
215
- assert(engineering.includes('gate_changed: "git diff --check"'), "generic projects should receive the fast diff gate");
227
+ assert(engineering.includes('project_fast: ""'), "generic projects should expose an optional project-fast command");
216
228
  assert(engineering.includes(`name: "${path.basename(repo)}"`), "project name should be initialized automatically");
217
- assert(engineering.includes("## Subagent orchestration"), "engineering should install the orchestration contract");
218
- assert(engineering.includes("Never run two writers in one worktree"), "engineering should enforce one writer per worktree");
229
+ assert(engineering.includes("## Design, review, and subagents"), "engineering should install adaptive orchestration guidance");
230
+ assert(engineering.includes("concurrent writers always use separate task IDs/worktrees"), "engineering should enforce one writer per worktree");
219
231
  const fixer = fs.readFileSync(path.join(repo, ".agents", "agents", "fixer.toml"), "utf8");
220
232
  const reviewer = fs.readFileSync(path.join(repo, ".agents", "agents", "reviewer.toml"), "utf8");
221
233
  const browserDebugger = fs.readFileSync(path.join(repo, ".agents", "agents", "browser-debugger.toml"), "utf8");
@@ -277,8 +289,8 @@ function testStatusRejectsLegacyGateEscalation() {
277
289
  run("node", [cli, "sync", "--projects", repo]);
278
290
  const engineeringPath = path.join(repo, "docs", "ENGINEERING.md");
279
291
  const engineering = fs.readFileSync(engineeringPath, "utf8").replace(
280
- ' full_on_unknown: false\n no_change_scope: "changed"\n profile_log:',
281
- ' full_on_unknown: "true"\n full_on: ["prod_config"]\n no_change_scope: "changed"\n rules:\n - match: ["Jenkinsfile"]\n scope: "full"\n commands: ["gate_full"]\n profile_log:',
292
+ "validation:\n",
293
+ 'gate:\n full_on_unknown: "true"\n full_on: ["prod_config"]\n rules:\n - match: ["Jenkinsfile"]\n scope: "full"\n commands: ["gate_full"]\n\nvalidation:\n',
282
294
  );
283
295
  fs.writeFileSync(engineeringPath, engineering);
284
296
  const status = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
@@ -295,7 +307,7 @@ function testOrdinaryNodeTestIsNotPromotedToAutomaticGate() {
295
307
  run("node", [cli, "init"], { cwd: repo });
296
308
  run("node", [cli, "sync", "--projects", repo]);
297
309
  const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
298
- assert(engineering.includes('gate_changed: "git diff --check"'), "ordinary test must not replace the fast default gate");
310
+ assert(engineering.includes('project_fast: ""'), "ordinary test must not be promoted to the project-fast command");
299
311
  assert(!engineering.includes("gate_standard:"), "ordinary test must not seed an automatic standard gate");
300
312
  assert(!engineering.includes("gate_full:"), "ordinary test must not seed an automatic full gate");
301
313
 
@@ -310,7 +322,7 @@ function testOrdinaryNodeTestIsNotPromotedToAutomaticGate() {
310
322
  const doctor = run("python3", [launcher, "--repo", repo, "doctor"], { check: false });
311
323
  assert(doctor.status === 0, `high-risk paths must not expand the local gate: ${doctor.stdout}\n${doctor.stderr}`);
312
324
  const gate = run("python3", [launcher, "--repo", repo, "light-gate", "--scope", "changed"]);
313
- assert(!gate.stdout.includes("[run] gate_changed"), "the default diff gate must not run twice");
325
+ assert(gate.stdout.includes("[run] project_fast"), "the configured project-fast route should run");
314
326
  assert((gate.stdout.match(/\[diff-check\] OK/g) || []).length === 1, "the built-in fast diff gate should run exactly once");
315
327
  const expanded = run("python3", [launcher, "--repo", repo, "light-gate", "--scope", "full"], { check: false });
316
328
  assert(expanded.status !== 0 && expanded.stderr.includes("invalid choice"), "light-gate must reject standard/full scopes instead of silently downgrading them");
@@ -470,14 +482,14 @@ function testBridgeIsGeneric() {
470
482
  run("python3", [assetAp, "--repo", repo, "install", "--bridges"]);
471
483
  assert(exists(path.join(repo, "AGENTS.md")), "generic bridge should be created");
472
484
  const bridge = fs.readFileSync(path.join(repo, "AGENTS.md"), "utf8");
473
- assert(bridge.includes("Never run two writers in one worktree"), "bridge should expose writer isolation");
474
- assert(bridge.includes("integrated"), "bridge should expose dependency ordering");
485
+ assert(bridge.includes("Each parallel writer gets one registered worktree"), "bridge should expose writer isolation");
486
+ assert(bridge.includes("integrates by dependency order"), "bridge should expose dependency ordering");
475
487
  for (const filename of [`CO${"DEX.md"}`, `CLA${"UDE.md"}`]) {
476
488
  assert(!exists(path.join(repo, filename)), "client-named bridge should not be created");
477
489
  }
478
490
  }
479
491
 
480
- function testUpgradeCleansManagedBridgeExtrasOnly() {
492
+ function testUpgradeCleansAllManagedSkillExtras() {
481
493
  const repo = tmpdir("upgrade-extra");
482
494
  run("git", ["init", "-q"], { cwd: repo });
483
495
  run("node", [cli, "init", "--force"], { cwd: repo });
@@ -486,7 +498,7 @@ function testUpgradeCleansManagedBridgeExtrasOnly() {
486
498
  writeFile(path.join(repo, ".agents", "skills", "auto-coding-skill", "custom.txt"), "custom\n");
487
499
  run("python3", [assetAp, "--repo", repo, "upgrade", "--write"]);
488
500
  assert(!exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "data", "templates", "bridges", "OLD.md")), "managed bridge extra should be removed");
489
- assert(exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "custom.txt")), "non-managed extra should remain");
501
+ assert(!exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "custom.txt")), "fully managed Skill extras should be removed");
490
502
  }
491
503
 
492
504
  function testOptionalDocsAndLegacyToolsDoNotCauseDrift() {
@@ -595,7 +607,7 @@ function testUpgradeInitializesNewEngineeringDefaults() {
595
607
 
596
608
  const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
597
609
  assert(engineering.includes(`name: "${path.basename(repo)}"`), "upgrade should initialize a newly created project name");
598
- assert(engineering.includes('gate_changed: "npm run test:changed"'), "upgrade should infer only a dedicated changed-scope test");
610
+ assert(engineering.includes('project_fast: "npm run test:changed"'), "upgrade should infer only a dedicated changed-scope test");
599
611
  assert(!engineering.includes("gate_standard:"), "upgrade must not infer an automatic standard gate");
600
612
  assert(!engineering.includes("gate_full:"), "upgrade must not infer an automatic full gate");
601
613
  }
@@ -633,14 +645,12 @@ function testUpgradeMigratesLegacyAutomaticGateToFastDefault() {
633
645
 
634
646
  run("python3", [assetAp, "--repo", repo, "upgrade", "--write"]);
635
647
  const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
636
- assert(engineering.includes("gate_changed: git diff --check"), "upgrade should replace the v3 auto-seeded npm test gate");
648
+ assert(/project_fast:\s*(?:''|"")/.test(engineering), "upgrade should not promote an ordinary npm test to the project-fast gate");
637
649
  assert(engineering.includes("mode: dev"), "upgrade should migrate verify mode to fast development mode");
638
650
  assert(engineering.includes("completion: push"), "upgrade should add push completion");
639
651
  assert(engineering.includes("isolation: adaptive"), "upgrade should migrate legacy isolation to adaptive");
640
- for (const key of ["default_scope", "fallback_scope", "no_change_scope"]) {
641
- assert(engineering.includes(`${key}: changed`), `upgrade should migrate gate.${key} to changed`);
642
- }
643
- assert(engineering.includes("full_on_unknown: false"), "upgrade should disable automatic full escalation");
652
+ assert(engineering.includes("on_unmapped: error"), "upgrade should fail closed when changed code has no validation route");
653
+ assert(engineering.includes("rules: []"), "upgrade should remove legacy automatic gate escalation rules");
644
654
  }
645
655
 
646
656
  function testRemovedVerificationFlagsFailFast() {
@@ -719,7 +729,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
719
729
 
720
730
  const engineering = path.join(repo, "docs", "ENGINEERING.md");
721
731
  const initial = fs.readFileSync(engineering, "utf8");
722
- const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=3\.0\.3 -->/;
732
+ const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.1\.0 -->/;
723
733
  const endMarker = "<!-- auto-coding-skill:managed-workflow:end -->";
724
734
  assert(startPattern.test(initial), "new projects should include a versioned managed workflow marker");
725
735
  assert(initial.includes(endMarker), "new projects should include the managed workflow end marker");
@@ -728,7 +738,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
728
738
  .replace("workflow:\n", "# project-frontmatter-comment\nworkflow:\n")
729
739
  .replace(startPattern, "project note before managed workflow\n<!-- auto-coding-skill:managed-workflow:start version=3.0.0 -->")
730
740
  .replace(endMarker, `${endMarker}\nproject note after managed workflow`)
731
- .replace("## Execution profiles", "## Stale managed workflow");
741
+ .replace("## Delivery levels", "## Stale managed workflow");
732
742
  writeFile(engineering, customized);
733
743
  const staleStart = customized.indexOf("<!-- auto-coding-skill:managed-workflow:start");
734
744
  const staleEnd = customized.indexOf(endMarker) + endMarker.length;
@@ -738,7 +748,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
738
748
  const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
739
749
  const dryResult = JSON.parse(dryRun.stdout).results[0];
740
750
  assert(dryResult.managedWorkflow.state === "stale", `dry-run should expose stale workflow state: ${dryRun.stdout}`);
741
- assert(dryResult.managedWorkflow.version === "3.0.3", "dry-run should expose the target workflow version");
751
+ assert(dryResult.managedWorkflow.version === "4.1.0", "dry-run should expose the target workflow version");
742
752
  assert(dryResult.actions.some(item => item.action === "would-update" && item.path === "docs/ENGINEERING.md"), "dry-run should plan the managed body update");
743
753
  assert(fs.readFileSync(engineering, "utf8") === customized, "dry-run must not write ENGINEERING.md");
744
754
 
@@ -748,14 +758,14 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
748
758
  const updatedEnd = updated.indexOf(endMarker) + endMarker.length;
749
759
  assert(updated.slice(0, updatedStart) === outsideBefore, "sync must preserve frontmatter and content before the managed block byte-for-byte");
750
760
  assert(updated.slice(updatedEnd) === outsideAfter, "sync must preserve content after the managed block byte-for-byte");
751
- assert(updated.includes("version=3.0.3"), "sync should install the current managed workflow version");
752
- assert(updated.includes("## Execution profiles"), "sync should refresh stale managed workflow content");
761
+ assert(updated.includes("version=4.1.0"), "sync should install the current managed workflow version");
762
+ assert(updated.includes("## Delivery levels"), "sync should refresh stale managed workflow content");
753
763
 
754
764
  fillRequiredAccess(repo);
755
765
  const status = run("node", [cli, "status", "--projects", repo, "--json"]);
756
766
  const statusResult = JSON.parse(status.stdout).results[0];
757
767
  assert(statusResult.managedWorkflow.state === "current", `status should expose current managed workflow state: ${status.stdout}`);
758
- assert(statusResult.managedWorkflow.version === "3.0.3", "status should expose the installed managed workflow version");
768
+ assert(statusResult.managedWorkflow.version === "4.1.0", "status should expose the installed managed workflow version");
759
769
 
760
770
  const beforeSecondSync = fs.readFileSync(engineering, "utf8");
761
771
  const second = run("node", [cli, "sync", "--projects", repo, "--json"]);
@@ -772,7 +782,7 @@ function testLegacyEngineeringMigrationPreservesExistingBody() {
772
782
  const start = current.indexOf("<!-- auto-coding-skill:managed-workflow:start");
773
783
  const endMarker = "<!-- auto-coding-skill:managed-workflow:end -->";
774
784
  const end = current.indexOf(endMarker) + endMarker.length;
775
- const legacyNote = "\n## Legacy project-specific workflow\n\nKeep this project note exactly.\n";
785
+ const legacyNote = "\n## Legacy project facts\n\nKeep this project note exactly.\n";
776
786
  const legacy = `${current.slice(0, start)}${legacyNote}${current.slice(end)}`;
777
787
  writeFile(engineering, legacy);
778
788
 
@@ -783,7 +793,7 @@ function testLegacyEngineeringMigrationPreservesExistingBody() {
783
793
  assert(dryResult.actions.find(item => item.path === "docs/ENGINEERING.md")?.detail.includes("preserved-custom"), "custom legacy action should be labeled preserved-custom");
784
794
  run("node", [cli, "sync", "--projects", repo]);
785
795
  const migrated = fs.readFileSync(engineering, "utf8");
786
- assert(migrated.includes("version=3.0.3"), "legacy migration should insert the current managed workflow");
796
+ assert(migrated.includes("version=4.1.0"), "legacy migration should insert the current managed workflow");
787
797
  assert(migrated.includes(legacyNote), "legacy migration must preserve the complete existing body");
788
798
  const migratedStart = migrated.indexOf("<!-- auto-coding-skill:managed-workflow:start");
789
799
  const migratedEnd = migrated.indexOf(endMarker) + endMarker.length;
@@ -813,7 +823,7 @@ function testOfficialLegacyEngineeringBodyIsReplacedWithoutDuplication() {
813
823
  const migrated = fs.readFileSync(engineering, "utf8");
814
824
  assert(migrated.startsWith(customizedFrontmatter), "official legacy migration must preserve YAML frontmatter byte-for-byte");
815
825
  assert((migrated.match(/auto-coding-skill:managed-workflow:start/g) || []).length === 1, "official legacy migration should install exactly one managed workflow");
816
- assert((migrated.match(/^## Execution profiles$/gm) || []).length === 1, "official legacy migration must replace rather than duplicate the old workflow body");
826
+ assert((migrated.match(/^## Delivery levels$/gm) || []).length === 1, "official legacy migration must replace rather than duplicate the old workflow body");
817
827
 
818
828
  const stable = fs.readFileSync(engineering, "utf8");
819
829
  run("node", [cli, "sync", "--projects", repo]);
@@ -848,44 +858,16 @@ function testMalformedManagedMarkersFailClosed() {
848
858
  }
849
859
  }
850
860
 
851
- function testSkillOnlySyncTouchesOnlySkill() {
852
- const repo = tmpdir("skill-only-sync");
861
+ function testPartialSkillSyncIsRejectedWithoutWrites() {
862
+ const repo = tmpdir("partial-skill-sync");
853
863
  run("git", ["init", "-q"], { cwd: repo });
854
864
  run("node", [cli, "init"], { cwd: repo });
855
865
  run("node", [cli, "sync", "--projects", repo]);
856
866
  const skill = path.join(repo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
857
- const agent = path.join(repo, ".agents", "agents", "explorer.toml");
858
- const engineering = path.join(repo, "docs", "ENGINEERING.md");
859
- const launcher = path.join(repo, "docs", "tools", "autopipeline", "ap.py");
860
867
  writeFile(skill, "stale skill\n");
861
- writeFile(agent, `${fs.readFileSync(agent, "utf8")}\n# user-agent-sentinel\n`);
862
- writeFile(engineering, `${fs.readFileSync(engineering, "utf8")}\nproject-engineering-sentinel\n`);
863
- writeFile(launcher, `${fs.readFileSync(launcher, "utf8")}\n# user-launcher-sentinel\n`);
864
- const untouched = new Map([[agent, fs.readFileSync(agent)], [engineering, fs.readFileSync(engineering)], [launcher, fs.readFileSync(launcher)]]);
865
-
866
- const dryRun = run("node", [cli, "sync", "--projects", repo, "--components", "skill", "--dry-run", "--json"]);
867
- const dryResult = JSON.parse(dryRun.stdout).results[0];
868
- assert(dryResult.components === "skill", "skill-only dry-run should expose its component scope");
869
- assert(dryResult.actions.length === 1 && dryResult.actions[0].path === ".agents/skills/auto-coding-skill", "skill-only dry-run must plan only the skill directory");
870
- assert(fs.readFileSync(skill, "utf8") === "stale skill\n", "skill-only dry-run must not write the skill");
871
-
872
- run("node", [cli, "sync", "--projects", repo, "--components", "skill"]);
873
- assert(fs.readFileSync(skill, "utf8").includes("# Auto Coding Skill"), "skill-only sync should refresh the managed skill");
874
- for (const [file, content] of untouched) {
875
- assert(fs.readFileSync(file).equals(content), `skill-only sync must not touch ${file}`);
876
- }
877
-
878
- const invalid = run("node", [cli, "sync", "--projects", repo, "--components", "docs"], { check: false });
879
- assert(invalid.status !== 0 && invalid.stderr.includes("--components"), "sync should reject unknown component scopes");
880
- const conflicting = run("node", [cli, "sync", "--projects", repo, "--components", "skill", "--reset-agent-models"], { check: false });
881
- assert(conflicting.status !== 0, "skill-only sync should reject irrelevant agent reset options");
882
-
883
- writeFile(skill, "legacy-task-sentinel\n");
884
- writeFile(path.join(repo, ".git", "auto-coding-skill", "tasks", "T-LEGACY.json"), JSON.stringify({ schema: 1, task_id: "T-LEGACY" }));
885
- const blocked = run("node", [cli, "sync", "--projects", repo, "--components", "skill"], { check: false });
886
- assert(blocked.status !== 0 && blocked.stderr.includes("schema < 2"), "skill-only sync must block registered legacy tasks");
887
- assert(blocked.stderr.includes("3.0.0 runtime") && blocked.stderr.includes("will not infer or auto-claim"), "legacy task error should give safe completion guidance");
888
- assert(fs.readFileSync(skill, "utf8") === "legacy-task-sentinel\n", "blocked skill-only sync must not write the skill");
868
+ const rejected = run("node", [cli, "sync", "--projects", repo, "--components", "skill"], { check: false });
869
+ assert(rejected.status !== 0 && rejected.stderr.includes("removed in 4.1"), "partial sync must explain whole-install convergence");
870
+ assert(fs.readFileSync(skill, "utf8") === "stale skill\n", "rejected partial sync must not write the skill");
889
871
  }
890
872
 
891
873
  function testLegacyTaskPreflightRejectsWholeBatchAtomically() {
@@ -901,7 +883,7 @@ function testLegacyTaskPreflightRejectsWholeBatchAtomically() {
901
883
  writeFile(firstSkill, "first-project-sentinel\n");
902
884
  writeFile(secondAgent, `${fs.readFileSync(secondAgent, "utf8")}\n# second-project-sentinel\n`);
903
885
  const secondAgentBefore = fs.readFileSync(secondAgent);
904
- writeFile(path.join(second, ".git", "auto-coding-skill", "tasks", "T-V3.json"), JSON.stringify({ schema: 1, task_id: "T-V3" }));
886
+ writeFile(path.join(second, ".git", "auto-coding-skill", "tasks", "T-V3.json"), JSON.stringify({ schema: 3, task_id: "T-V3", state: "active" }));
905
887
 
906
888
  const result = run("node", [cli, "sync", "--projects", `${first},${second}`], { check: false });
907
889
  assert(result.status !== 0 && result.stderr.includes("entire sync batch"), "one legacy task should reject the complete multi-project batch");
@@ -909,13 +891,13 @@ function testLegacyTaskPreflightRejectsWholeBatchAtomically() {
909
891
  assert(fs.readFileSync(secondAgent).equals(secondAgentBefore), "batch preflight must not write the project containing the legacy task");
910
892
  }
911
893
 
912
- function testManagedAgentsMigrationPreservesCustomRules() {
894
+ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
913
895
  const repo = tmpdir("managed-agents-document");
914
896
  run("node", [cli, "init"], { cwd: repo });
915
897
  run("node", [cli, "sync", "--projects", repo]);
916
898
  const agents = path.join(repo, "AGENTS.md");
917
899
  const initial = fs.readFileSync(agents, "utf8");
918
- assert(initial.includes("managed-agents:start version=3.0.3"), "new projects should receive the versioned root AGENTS block");
900
+ assert(initial.includes("managed-agents:start version=4.1.0"), "new projects should receive the versioned root AGENTS block");
919
901
 
920
902
  const custom = [
921
903
  "# Project rules",
@@ -928,13 +910,19 @@ function testManagedAgentsMigrationPreservesCustomRules() {
928
910
  const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
929
911
  const plan = JSON.parse(dryRun.stdout).results[0].managedAgentsDocument;
930
912
  assert(plan.state === "legacy-custom", `unmarked custom AGENTS should be migrated: ${dryRun.stdout}`);
931
- assert(plan.migrations.includes("agents-v22-govchain-full"), "known official full-gate rule should be selected by exact migration id");
913
+ assert(plan.migrations.includes("agents-whole-file-replacement"), "AGENTS should use the whole-file convergence migration");
914
+ const dryActions = JSON.parse(dryRun.stdout).results[0].actions;
915
+ assert(dryActions.some(item => item.action === "would-archive"), "dry-run should expose the historical AGENTS archive");
932
916
 
933
917
  run("node", [cli, "sync", "--projects", repo]);
934
918
  const migrated = fs.readFileSync(agents, "utf8");
935
- assert(migrated.includes("managed-agents:start version=3.0.3"), "AGENTS migration should install the current managed block");
936
- assert(migrated.includes("Preserve this repository-specific rule exactly."), "AGENTS migration must preserve unrelated custom rules");
919
+ assert(migrated.includes("managed-agents:start version=4.1.0"), "AGENTS migration should install the current managed block");
920
+ assert(!migrated.includes("Preserve this repository-specific rule exactly."), "root AGENTS must contain no project-specific tail");
937
921
  assert(!migrated.includes("must execute `commands.gate_full`"), "known official conflicting rule should be removed");
922
+ const canonical = fs.readFileSync(path.join(repoRoot, "cli", "assets", "skill", "data", "templates", "bridges", "AGENTS.md"), "utf8");
923
+ assert(migrated === canonical, "root AGENTS must be byte-identical to the packaged canonical file");
924
+ const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.1.0.md");
925
+ assert(fs.readFileSync(archive, "utf8").includes("Preserve this repository-specific rule exactly."), "previous AGENTS content must be archived once");
938
926
  const stable = fs.readFileSync(agents);
939
927
  run("node", [cli, "sync", "--projects", repo]);
940
928
  assert(fs.readFileSync(agents).equals(stable), "managed AGENTS sync should be idempotent");
@@ -950,14 +938,14 @@ function testUnknownWorkflowConflictFailsWholeBatchBeforeWrites() {
950
938
  }
951
939
  const firstSkill = path.join(first, ".agents", "skills", "auto-coding-skill", "SKILL.md");
952
940
  writeFile(firstSkill, "batch-sentinel\n");
953
- const secondAgents = path.join(second, "AGENTS.md");
954
- fs.appendFileSync(secondAgents, "\n- High-risk changes\n must run the real full gate before push.\n");
941
+ const secondEngineering = path.join(second, "docs", "ENGINEERING.md");
942
+ fs.appendFileSync(secondEngineering, "\nHigh-risk changes must run the real full gate before push.\n");
955
943
 
956
944
  const status = run("node", [cli, "status", "--projects", second, "--json"], { check: false });
957
945
  assert(status.status !== 0, "status must be non-ok for an unknown conflicting workflow rule");
958
- const statusPlan = JSON.parse(status.stdout).results[0].managedAgentsDocument;
946
+ const statusPlan = JSON.parse(status.stdout).results[0].managedWorkflow;
959
947
  assert(statusPlan.state === "conflict", `status should expose the document conflict: ${status.stdout}`);
960
- assert(statusPlan.conflicts[0].file === "AGENTS.md" && statusPlan.conflicts[0].line > 0, "status conflict should include file and line");
948
+ assert(statusPlan.conflicts[0].file === "docs/ENGINEERING.md" && statusPlan.conflicts[0].line > 0, "status conflict should include file and line");
961
949
 
962
950
  const sync = run("node", [cli, "sync", "--projects", `${first},${second}`], { check: false });
963
951
  assert(sync.status !== 0 && sync.stderr.includes("entire sync batch before writes"), "one unknown conflict must reject the complete batch");
@@ -977,6 +965,53 @@ function testEngineeringMarkerBoundaryIsNormalized() {
977
965
  assert(normalized.includes(`${marker}\n# Project-specific workflow\n`), "sync should normalize a heading glued to the managed end marker");
978
966
  }
979
967
 
968
+ function testEngineeringFrameworkAllowsProjectFactsButRejectsDuplicateWorkflow() {
969
+ const repo = tmpdir("engineering-framework");
970
+ run("node", [cli, "init"], { cwd: repo });
971
+ run("node", [cli, "sync", "--projects", repo]);
972
+ fillRequiredAccess(repo);
973
+ const engineering = path.join(repo, "docs", "ENGINEERING.md");
974
+ fs.appendFileSync(engineering, "\n# Project Facts\n\n## Repository boundaries\n\n- backend owns APIs.\n");
975
+ const projectFactsStatus = run("node", [cli, "status", "--projects", repo, "--json"]);
976
+ assert(JSON.parse(projectFactsStatus.stdout).results[0].managedWorkflow.state === "current", "project fact sections should remain outside the managed block");
977
+
978
+ fs.appendFileSync(engineering, "\n## Delivery flow\n\n1. Known obsolete workflow.\n");
979
+ const migration = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
980
+ const migrationResult = JSON.parse(migration.stdout).results[0];
981
+ assert(migrationResult.managedWorkflow.state === "stale", "known duplicate sections should use controlled migration");
982
+ assert(migrationResult.managedWorkflow.migrations.includes("engineering-section-delivery-flow"), "known section migration should be explicit");
983
+ assert(migrationResult.actions.some(item => item.action === "would-archive" && item.path.includes("ENGINEERING.pre-4.1.0")), "controlled section cleanup should archive the previous ENGINEERING file");
984
+ run("node", [cli, "sync", "--projects", repo]);
985
+ assert(!fs.readFileSync(engineering, "utf8").includes("Known obsolete workflow"), "known duplicate workflow section should be removed");
986
+
987
+ fs.appendFileSync(engineering, "\n## Team workflow\n\n1. Unknown competing workflow.\n");
988
+ const duplicateStatus = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
989
+ assert(duplicateStatus.status !== 0, "duplicate workflow sections must make status non-current");
990
+ const plan = JSON.parse(duplicateStatus.stdout).results[0].managedWorkflow;
991
+ assert(plan.state === "conflict" && plan.conflicts.some(item => item.ruleId === "duplicate-managed-workflow-section"), "duplicate workflow conflict should identify the docs framework rule");
992
+ }
993
+
994
+ function testReleaseVersionMarkersStayInSync() {
995
+ const expected = "4.1.0";
996
+ const pkg = JSON.parse(fs.readFileSync(path.join(repoRoot, "package.json"), "utf8"));
997
+ const lock = JSON.parse(fs.readFileSync(path.join(repoRoot, "package-lock.json"), "utf8"));
998
+ const policy = JSON.parse(fs.readFileSync(
999
+ path.join(repoRoot, "src", "auto-coding-skill", "data", "policies", "workflow-migrations-v1.json"),
1000
+ "utf8",
1001
+ ));
1002
+ assert(pkg.version === expected, "package version must match the 4.1.0 release");
1003
+ assert(lock.version === expected && lock.packages[""].version === expected, "package-lock versions must match");
1004
+ assert(policy.managed_versions.engineering === expected && policy.managed_versions.agents === expected, "managed workflow versions must match");
1005
+ for (const rel of [
1006
+ "src/auto-coding-skill/data/templates/ENGINEERING.md",
1007
+ "src/auto-coding-skill/data/templates/bridges/AGENTS.md",
1008
+ "cli/assets/skill/data/templates/ENGINEERING.md",
1009
+ "cli/assets/skill/data/templates/bridges/AGENTS.md",
1010
+ ]) {
1011
+ assert(fs.readFileSync(path.join(repoRoot, rel), "utf8").includes(`version=${expected}`), `${rel}: missing ${expected} marker`);
1012
+ }
1013
+ }
1014
+
980
1015
  testPreflightAvoidsPartialInstall();
981
1016
  testDestVariants();
982
1017
  testLauncherFallsBackToGlobalRuntime();
@@ -991,7 +1026,7 @@ testInvalidManagedAgentModelsFailStatusAndAreDroppedOnSync();
991
1026
  testModelTextInsideInstructionsIsNotPromotedToOverride();
992
1027
  testCommandSpecificArgumentsAreRejectedBeforeWrites();
993
1028
  testBridgeIsGeneric();
994
- testUpgradeCleansManagedBridgeExtrasOnly();
1029
+ testUpgradeCleansAllManagedSkillExtras();
995
1030
  testOptionalDocsAndLegacyToolsDoNotCauseDrift();
996
1031
  testOptionalScaffoldIsOnDemandAndIdempotent();
997
1032
  testTestingScaffoldMatchesCheckMatrixSchema();
@@ -1007,10 +1042,12 @@ testManagedEngineeringSyncIsControlledAndIdempotent();
1007
1042
  testLegacyEngineeringMigrationPreservesExistingBody();
1008
1043
  testOfficialLegacyEngineeringBodyIsReplacedWithoutDuplication();
1009
1044
  testMalformedManagedMarkersFailClosed();
1010
- testSkillOnlySyncTouchesOnlySkill();
1045
+ testPartialSkillSyncIsRejectedWithoutWrites();
1011
1046
  testLegacyTaskPreflightRejectsWholeBatchAtomically();
1012
- testManagedAgentsMigrationPreservesCustomRules();
1047
+ testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules();
1013
1048
  testUnknownWorkflowConflictFailsWholeBatchBeforeWrites();
1014
1049
  testEngineeringMarkerBoundaryIsNormalized();
1050
+ testEngineeringFrameworkAllowsProjectFactsButRejectsDuplicateWorkflow();
1051
+ testReleaseVersionMarkersStayInSync();
1015
1052
 
1016
1053
  console.log("cli-installer-regression-ok");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elvis1513/auto-coding-skill",
3
- "version": "3.0.4",
4
- "description": "CLI installer for an isolated .agents engineering workflow with parallel Git worktrees, fast local gates, push-based completion, and safe cleanup.",
3
+ "version": "4.1.0",
4
+ "description": "CLI installer for a delivery-first .agents workflow with adaptive Git isolation, routed changed-scope validation, risk-based review, push completion, and safe cleanup.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "autocoding": "cli/src/index.js"
@@ -1,17 +0,0 @@
1
- # Closure Log
2
-
3
- Record one development closure per task. `DEV-CLOSED` means the fast local gate
4
- passed and the code was pushed. Jenkins, deployment, and owner acceptance happen
5
- later and do not change the coding closure.
6
-
7
- ## <TASK_ID> — <Title> — YYYY-MM-DD HH:MM
8
-
9
- - Commit:
10
- - Effective profile: micro | standard | high-risk
11
- - Fast local gate:
12
- - Target push:
13
- - External build/deploy/acceptance: owner-managed
14
- - Result: DEV-CLOSED
15
- - Follow-up:
16
-
17
- ---
@@ -1,30 +0,0 @@
1
- # Taskbook
2
-
3
- Keep active tasks here. Archive closed history when the configured ledger budget
4
- is reached. Add DD/ADR or other optional documents only when classification says
5
- they are useful.
6
-
7
- ## Task T0001 — <Title>
8
-
9
- - Status: Planned | Designing | Implementing | Checking | Pushed | Blocked
10
- - Scope:
11
- - Orchestrator:
12
- - Owning fixer:
13
- - Registered worktree / branch:
14
- - Owned paths:
15
- - Depends on integrated tasks:
16
- - Reviewer / stable diff:
17
- - Review verdict: pending | approved | changes-requested
18
- - Non-goals:
19
- - Effective profile: micro | standard | high-risk
20
- - Classification reasons:
21
- - Existing owner / reuse points:
22
- - Minimal design:
23
- - Development acceptance criteria:
24
- - Fast local gate evidence:
25
- - Commit / target push:
26
- - Follow-up:
27
-
28
- ---
29
-
30
- Append new active tasks below.