@elvis1513/auto-coding-skill 4.1.2 → 4.1.4

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.
@@ -24,6 +24,8 @@ def command(
24
24
  check: bool = True,
25
25
  input_text: str | None = None,
26
26
  ) -> subprocess.CompletedProcess[str]:
27
+ env = os.environ.copy()
28
+ env.setdefault("CODEX_THREAD_ID", "concurrency-test-owner")
27
29
  result = subprocess.run(
28
30
  list(args),
29
31
  cwd=cwd,
@@ -32,6 +34,7 @@ def command(
32
34
  input=input_text,
33
35
  capture_output=True,
34
36
  timeout=30,
37
+ env=env,
35
38
  )
36
39
  if check and result.returncode != 0:
37
40
  raise AssertionError(
@@ -188,6 +191,13 @@ class AutoCodingConcurrencyTests(unittest.TestCase):
188
191
  )
189
192
  return fingerprint
190
193
 
194
+ def claim_direct(self, repo: Path, *owned_paths: str) -> str:
195
+ args: list[str] = ["classify", "--task-kind", "change", "--claim-direct", "--json"]
196
+ for path in owned_paths:
197
+ args.extend(["--planned-path", path])
198
+ payload = json.loads(self.ap(repo, *args).stdout)
199
+ return payload["direct_claim"]["id"]
200
+
191
201
  def commit_push(self, repo: Path, task_id: str, message: str) -> subprocess.CompletedProcess[str]:
192
202
  self.approve_task(repo, task_id)
193
203
  return self.ap(repo, "commit-push", task_id, "--msg", message)
@@ -444,6 +454,98 @@ class AutoCodingConcurrencyTests(unittest.TestCase):
444
454
  self.assertIn("does not need a machine task lifecycle", output)
445
455
  self.assertNotIn("initialization is incomplete", output)
446
456
 
457
+ def test_continue_direct_can_adopt_owned_changes_for_new_review_lifecycle(self) -> None:
458
+ _, repo, remote = self.make_repo("adaptive", require_review=False)
459
+ claim = self.claim_direct(repo, "shared.txt")
460
+ (repo / "shared.txt").write_text("continued direct\n", encoding="utf-8")
461
+ started = self.ap(
462
+ repo,
463
+ "task-start",
464
+ "DIRECT-CONTINUE",
465
+ "--owned-path",
466
+ "shared.txt",
467
+ "--continue-direct",
468
+ "--direct-claim",
469
+ claim,
470
+ "--review-required",
471
+ )
472
+ self.assertIn("execution_mode=direct", started.stdout)
473
+ status = json.loads(
474
+ self.ap(repo, "task-status", "DIRECT-CONTINUE", "--json").stdout
475
+ )["tasks"][0]
476
+ self.assertEqual("direct", status["execution_mode"])
477
+ missing_reviewer = self.ap(
478
+ repo,
479
+ "task-review",
480
+ "DIRECT-CONTINUE",
481
+ "--verdict",
482
+ "approved",
483
+ "--diff-fingerprint",
484
+ status["current_diff_fingerprint"],
485
+ check=False,
486
+ )
487
+ self.assertNotEqual(0, missing_reviewer.returncode)
488
+ self.assertIn("explicit --reviewer", missing_reviewer.stdout + missing_reviewer.stderr)
489
+ pushed = self.commit_push(repo, "DIRECT-CONTINUE", "DIRECT-CONTINUE: update")
490
+ self.assertIn("execution_mode=direct", pushed.stdout)
491
+ self.assertEqual("continued direct", git_output(remote, "show", "refs/heads/dev:shared.txt"))
492
+
493
+ claim = self.claim_direct(repo, "shared.txt")
494
+ (repo / "shared.txt").write_text("owned again\n", encoding="utf-8")
495
+ (repo / "unrelated.txt").write_text("unknown\n", encoding="utf-8")
496
+ rejected = self.ap(
497
+ repo,
498
+ "task-start",
499
+ "DIRECT-CONTINUE-BLOCKED",
500
+ "--owned-path",
501
+ "shared.txt",
502
+ "--continue-direct",
503
+ "--direct-claim",
504
+ claim,
505
+ "--review-required",
506
+ check=False,
507
+ )
508
+ self.assertNotEqual(0, rejected.returncode)
509
+ self.assertIn("unrelated.txt", rejected.stdout + rejected.stderr)
510
+ self.assertFalse(self.registry_manifest_path(repo, "DIRECT-CONTINUE-BLOCKED").exists())
511
+
512
+ def test_reviewer_cannot_be_current_writer(self) -> None:
513
+ _, repo, _ = self.make_repo()
514
+ self.ap(
515
+ repo,
516
+ "task-start",
517
+ "SELF-REVIEW",
518
+ "--base",
519
+ "origin/dev",
520
+ "--owned-path",
521
+ "src",
522
+ "--isolated",
523
+ "--review-required",
524
+ "--writer",
525
+ "self-reviewer",
526
+ )
527
+ worktree = self.task_worktree(repo, "SELF-REVIEW")
528
+ payload = worktree / "src" / "payload.txt"
529
+ payload.parent.mkdir(parents=True, exist_ok=True)
530
+ payload.write_text("changed\n", encoding="utf-8")
531
+ status = json.loads(
532
+ self.ap(worktree, "task-status", "SELF-REVIEW", "--json").stdout
533
+ )["tasks"][0]
534
+ rejected = self.ap(
535
+ worktree,
536
+ "task-review",
537
+ "SELF-REVIEW",
538
+ "--verdict",
539
+ "approved",
540
+ "--diff-fingerprint",
541
+ status["current_diff_fingerprint"],
542
+ "--reviewer",
543
+ "self-reviewer",
544
+ check=False,
545
+ )
546
+ self.assertNotEqual(0, rejected.returncode)
547
+ self.assertIn("writer lease holder", rejected.stdout + rejected.stderr)
548
+
447
549
  def test_schema_one_task_status_fails_closed_with_migration_recovery(self) -> None:
448
550
  _, repo, _ = self.make_repo()
449
551
  self.start_task(repo, "LEGACY-SCHEMA")
@@ -2,6 +2,8 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  import argparse
5
+ import json
6
+ import os
5
7
  import subprocess
6
8
  import sys
7
9
  import tempfile
@@ -217,6 +219,7 @@ class AutoCodingProfileTests(unittest.TestCase):
217
219
  "result_contract",
218
220
  "stages",
219
221
  "constraints",
222
+ "optional_roles",
220
223
  ]:
221
224
  self.assertIn(field, plan["agent_plan"])
222
225
 
@@ -233,8 +236,12 @@ class AutoCodingProfileTests(unittest.TestCase):
233
236
  self.assertEqual(["src/frontend/LoginPage.tsx"], plan["classification_files"])
234
237
  self.assertTrue(plan["intent_provided"])
235
238
  self.assertEqual(["auth", "release_or_tooling", "ui"], plan["intent_categories"])
239
+ self.assertEqual(["auth", "release_or_tooling"], plan["intent_risk_candidates"])
236
240
  self.assertTrue(plan["needs_browser"])
237
- self.assertEqual(["reviewer"], plan["recommended_agents"])
241
+ self.assertEqual("standard", plan["profile"])
242
+ self.assertFalse(plan["review_required"])
243
+ self.assertEqual([], plan["recommended_agents"])
244
+ self.assertEqual([], plan["optional_agents"])
238
245
  self.assertNotIn("browser_debugger", plan["recommended_agents"])
239
246
  self.assertNotIn("docs_researcher", plan["recommended_agents"])
240
247
  self.assertNotIn("新增登录鉴权页面并发布", str(plan))
@@ -271,7 +278,9 @@ class AutoCodingProfileTests(unittest.TestCase):
271
278
  )
272
279
  self.assertFalse(plan["mechanism_plan"]["lifecycle_required"])
273
280
  self.assertIn("read_only_subagents", plan["mechanism_plan"]["optional_when_beneficial"])
281
+ self.assertNotIn("parallel_fixers", plan["mechanism_plan"]["optional_when_beneficial"])
274
282
  self.assertIn("task_lifecycle", plan["mechanism_plan"]["forbidden"])
283
+ self.assertIn("parallel_fixers", plan["mechanism_plan"]["forbidden"])
275
284
 
276
285
  def test_intent_only_classifies_read_only_change_and_terminal_work(self) -> None:
277
286
  repo, cfg = self.make_repo()
@@ -313,6 +322,21 @@ class AutoCodingProfileTests(unittest.TestCase):
313
322
  )
314
323
  self.assertIn("task_lifecycle", terminal["mechanism_plan"]["forbidden"])
315
324
 
325
+ with self.assertRaises(APError):
326
+ self.plan(
327
+ repo,
328
+ cfg,
329
+ planned_paths=["src/payment/service.py"],
330
+ requested_task_kind="terminal_maintenance",
331
+ )
332
+ with self.assertRaises(APError):
333
+ self.plan(
334
+ repo,
335
+ cfg,
336
+ planned_paths=["src/widget.py"],
337
+ requested_task_kind="none",
338
+ )
339
+
316
340
  def test_execution_mode_is_none_direct_isolated_or_parallel(self) -> None:
317
341
  repo, cfg = self.make_repo()
318
342
  self.assertEqual("none", self.plan(repo, cfg)["execution_mode"])
@@ -335,6 +359,178 @@ class AutoCodingProfileTests(unittest.TestCase):
335
359
  self.assertTrue(parallel["review_required"])
336
360
  self.assertIn("fixer", parallel["recommended_agents"])
337
361
  self.assertIn("parallel_fixers", parallel["mechanism_plan"]["required"])
362
+ self.assertEqual("orchestrated-subagents", parallel["agent_plan"]["strategy"])
363
+
364
+ def test_continue_direct_accepts_only_declared_current_task_dirt(self) -> None:
365
+ repo, cfg = self.make_repo()
366
+ claim = ap._create_direct_claim(
367
+ repo,
368
+ cfg,
369
+ ["src/widget.py"],
370
+ os.environ.get("CODEX_THREAD_ID") or "profile-test-owner",
371
+ )
372
+ target = repo / "src" / "widget.py"
373
+ target.parent.mkdir(parents=True, exist_ok=True)
374
+ target.write_text("task change\n", encoding="utf-8")
375
+
376
+ default = self.plan(repo, cfg, planned_paths=["src/widget.py"])
377
+ self.assertEqual("isolated", default["execution_mode"])
378
+ continued = self.plan(
379
+ repo,
380
+ cfg,
381
+ planned_paths=["src/widget.py"],
382
+ continue_direct=True,
383
+ direct_claim_id=claim["claim_id"],
384
+ )
385
+ self.assertEqual("direct", continued["execution_mode"])
386
+ self.assertTrue(continued["continued_direct"])
387
+ self.assertEqual([], continued["dirty_outside_plan"])
388
+
389
+ (repo / "unrelated.txt").write_text("other writer\n", encoding="utf-8")
390
+ with self.assertRaises(APError) as context:
391
+ self.plan(
392
+ repo,
393
+ cfg,
394
+ planned_paths=["src/widget.py"],
395
+ continue_direct=True,
396
+ direct_claim_id=claim["claim_id"],
397
+ )
398
+ self.assertIn("outside the clean direct claim", str(context.exception))
399
+
400
+ def test_continue_direct_requires_a_clean_pre_write_claim(self) -> None:
401
+ repo, cfg = self.make_repo()
402
+ (repo / "unknown.txt").write_text("pre-existing user change\n", encoding="utf-8")
403
+ with self.assertRaises(APError) as context:
404
+ ap._create_direct_claim(repo, cfg, ["."], "profile-test-owner")
405
+ self.assertIn("before the first write", str(context.exception))
406
+ with self.assertRaises(APError) as context:
407
+ self.plan(repo, cfg, planned_paths=["."], continue_direct=True)
408
+ self.assertIn("requires --direct-claim", str(context.exception))
409
+
410
+ def test_risk_intent_is_candidate_while_paths_and_rules_control_escalation(self) -> None:
411
+ repo, cfg = self.make_repo()
412
+ ui = self.plan(
413
+ repo,
414
+ cfg,
415
+ planned_paths=["frontend/src/LoginPage.tsx"],
416
+ intent="修复登录跳转问题",
417
+ )
418
+ self.assertEqual("standard", ui["profile"])
419
+ self.assertFalse(ui["review_required"])
420
+ self.assertEqual(["auth"], ui["intent_risk_candidates"])
421
+ self.assertEqual(["browser_debugger"], ui["optional_agents"])
422
+
423
+ backend = self.plan(repo, cfg, planned_paths=["backend/auth/service.py"])
424
+ self.assertEqual("high-risk", backend["profile"])
425
+ self.assertTrue(backend["review_required"])
426
+ self.assertEqual(["explorer"], backend["optional_agents"])
427
+
428
+ cfg["risk"] = {
429
+ "rules": [
430
+ {
431
+ "name": "sensitive-login-ui",
432
+ "paths": ["frontend/src/LoginPage.tsx"],
433
+ "profile": "high-risk",
434
+ }
435
+ ]
436
+ }
437
+ configured = self.plan(repo, cfg, planned_paths=["frontend/src/LoginPage.tsx"])
438
+ self.assertEqual("high-risk", configured["profile"])
439
+
440
+ order = self.plan(repo, cfg, planned_paths=["backend/orders/sort_order.py"])
441
+ self.assertNotIn("payment", order["categories"])
442
+
443
+ def test_high_confidence_intent_and_backend_login_escalate_without_ui_false_positive(self) -> None:
444
+ repo, cfg = self.make_repo()
445
+ for intent, category in [
446
+ ("修改数据库迁移", "db"),
447
+ ("修改后端鉴权权限", "auth"),
448
+ ("修改支付结算逻辑", "payment"),
449
+ ("修改生产网关配置", "gateway"),
450
+ ]:
451
+ with self.subTest(intent=intent):
452
+ plan = self.plan(repo, cfg, intent=intent)
453
+ self.assertEqual("high-risk", plan["profile"])
454
+ self.assertTrue(plan["review_required"])
455
+ self.assertIn(category, plan["high_confidence_intent_categories"])
456
+
457
+ backend_login = self.plan(
458
+ repo,
459
+ cfg,
460
+ planned_paths=["backend/login_handler.go"],
461
+ intent="修复登录处理",
462
+ )
463
+ self.assertEqual("high-risk", backend_login["profile"])
464
+ self.assertTrue(backend_login["review_required"])
465
+
466
+ login_ui = self.plan(
467
+ repo,
468
+ cfg,
469
+ planned_paths=["frontend/LoginPage.tsx"],
470
+ intent="修复登录页面跳转",
471
+ )
472
+ self.assertEqual("standard", login_ui["profile"])
473
+ self.assertFalse(login_ui["review_required"])
474
+
475
+ def test_generated_agent_strategies_match_contract_schema(self) -> None:
476
+ schema = json.loads(
477
+ (REPO_ROOT / "src" / "auto-coding-skill" / "data" / "contracts" / "orchestration-v1.schema.json")
478
+ .read_text(encoding="utf-8")
479
+ )
480
+ allowed = set(schema["$defs"]["agentPlan"]["properties"]["strategy"]["enum"])
481
+ repo, cfg = self.make_repo()
482
+ for kwargs in [
483
+ {"planned_paths": ["src/widget.py"]},
484
+ {"planned_paths": ["backend/auth/service.py"]},
485
+ {"planned_paths": ["src/widget.py"], "parallel_writers": 2},
486
+ ]:
487
+ with self.subTest(kwargs=kwargs):
488
+ plan = self.plan(repo, cfg, **kwargs)
489
+ self.assertIn(plan["agent_plan"]["strategy"], allowed)
490
+ ap._validate_orchestration_contract("classify", plan)
491
+
492
+ def test_agent_assignment_and_result_contracts_are_machine_enforced(self) -> None:
493
+ fingerprint = "a" * 64
494
+ assignment = {
495
+ "contract_version": 1,
496
+ "node_id": "reviewer-1",
497
+ "task_id": "T001",
498
+ "role": "reviewer",
499
+ "base_sha": "HEAD",
500
+ "scope": "review owned diff",
501
+ "depends_on": [],
502
+ "acceptance": ["review current fingerprint"],
503
+ "diff_base": "HEAD~1",
504
+ "diff_head": "HEAD",
505
+ "diff_fingerprint": fingerprint,
506
+ "owning_fixer": "fixer-1",
507
+ }
508
+ ap._validate_orchestration_contract("assignment", assignment)
509
+ self_review = dict(assignment, node_id="fixer-1")
510
+ with self.assertRaises(APError):
511
+ ap._validate_orchestration_contract("assignment", self_review)
512
+
513
+ result = {
514
+ "contract_version": 1,
515
+ "node_id": "reviewer-1",
516
+ "role": "reviewer",
517
+ "task_id": "T001",
518
+ "base_sha": "HEAD~1",
519
+ "status": "completed",
520
+ "summary": "reviewed",
521
+ "depends_on": [],
522
+ "owned_paths": [],
523
+ "changed_paths": [],
524
+ "diff_fingerprint": fingerprint,
525
+ "evidence": ["diff reviewed"],
526
+ "findings": [],
527
+ "verdict": "approved",
528
+ "risks": [],
529
+ "next_owner": "main",
530
+ }
531
+ ap._validate_orchestration_contract("result", result)
532
+ with self.assertRaises(APError):
533
+ ap._validate_orchestration_contract("result", dict(result, diff_fingerprint=""))
338
534
 
339
535
  def test_validation_routes_collect_all_commands_and_reject_unmapped_code(self) -> None:
340
536
  repo, cfg = self.make_repo()
@@ -219,7 +219,9 @@ function testMinimalSyncConvergesWithinBudget() {
219
219
  const files = listProjectFiles(repo);
220
220
  const lines = files.reduce((total, file) => total + fs.readFileSync(file, "utf8").split(/\r?\n/).length, 0);
221
221
  assert(files.length <= 23, `minimal scaffold file budget exceeded: ${files.length}`);
222
- assert(lines <= 10800, `minimal scaffold line budget exceeded: ${lines}`);
222
+ // Deterministic direct-claim and orchestration-contract guards replace model-only
223
+ // assertions in 4.1.4; keep a measured ceiling without forcing opaque code.
224
+ assert(lines <= 11200, `minimal scaffold line budget exceeded: ${lines}`);
223
225
  const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
224
226
  assert(engineering.includes("profile: \"auto\""), "engineering should enable adaptive profiles");
225
227
  assert(engineering.includes("isolation: \"adaptive\""), "engineering should default to adaptive clean-branch/worktree isolation");
@@ -486,7 +488,7 @@ function testBridgeIsGeneric() {
486
488
  run("python3", [assetAp, "--repo", repo, "install", "--bridges"]);
487
489
  assert(exists(path.join(repo, "AGENTS.md")), "generic bridge should be created");
488
490
  const bridge = fs.readFileSync(path.join(repo, "AGENTS.md"), "utf8");
489
- assert(bridge.includes("Every writing agent owns a distinct task ID, worktree"), "bridge should expose writer isolation");
491
+ assert(bridge.includes("Every delegated fixer or parallel writer owns a task ID/worktree"), "bridge should expose delegated-writer isolation");
490
492
  assert(bridge.includes("integrates in dependency order"), "bridge should expose dependency ordering");
491
493
  for (const filename of [`CO${"DEX.md"}`, `CLA${"UDE.md"}`]) {
492
494
  assert(!exists(path.join(repo, filename)), "client-named bridge should not be created");
@@ -733,7 +735,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
733
735
 
734
736
  const engineering = path.join(repo, "docs", "ENGINEERING.md");
735
737
  const initial = fs.readFileSync(engineering, "utf8");
736
- const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.1\.2 -->/;
738
+ const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.1\.4 -->/;
737
739
  const endMarker = "<!-- auto-coding-skill:managed-workflow:end -->";
738
740
  assert(startPattern.test(initial), "new projects should include a versioned managed workflow marker");
739
741
  assert(initial.includes(endMarker), "new projects should include the managed workflow end marker");
@@ -752,7 +754,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
752
754
  const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
753
755
  const dryResult = JSON.parse(dryRun.stdout).results[0];
754
756
  assert(dryResult.managedWorkflow.state === "stale", `dry-run should expose stale workflow state: ${dryRun.stdout}`);
755
- assert(dryResult.managedWorkflow.version === "4.1.2", "dry-run should expose the target workflow version");
757
+ assert(dryResult.managedWorkflow.version === "4.1.4", "dry-run should expose the target workflow version");
756
758
  assert(dryResult.actions.some(item => item.action === "would-update" && item.path === "docs/ENGINEERING.md"), "dry-run should plan the managed body update");
757
759
  assert(fs.readFileSync(engineering, "utf8") === customized, "dry-run must not write ENGINEERING.md");
758
760
 
@@ -762,14 +764,14 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
762
764
  const updatedEnd = updated.indexOf(endMarker) + endMarker.length;
763
765
  assert(updated.slice(0, updatedStart) === outsideBefore, "sync must preserve frontmatter and content before the managed block byte-for-byte");
764
766
  assert(updated.slice(updatedEnd) === outsideAfter, "sync must preserve content after the managed block byte-for-byte");
765
- assert(updated.includes("version=4.1.2"), "sync should install the current managed workflow version");
767
+ assert(updated.includes("version=4.1.4"), "sync should install the current managed workflow version");
766
768
  assert(updated.includes("The frontmatter contract is:"), "sync should refresh stale managed workflow content");
767
769
 
768
770
  fillRequiredAccess(repo);
769
771
  const status = run("node", [cli, "status", "--projects", repo, "--json"]);
770
772
  const statusResult = JSON.parse(status.stdout).results[0];
771
773
  assert(statusResult.managedWorkflow.state === "current", `status should expose current managed workflow state: ${status.stdout}`);
772
- assert(statusResult.managedWorkflow.version === "4.1.2", "status should expose the installed managed workflow version");
774
+ assert(statusResult.managedWorkflow.version === "4.1.4", "status should expose the installed managed workflow version");
773
775
 
774
776
  const beforeSecondSync = fs.readFileSync(engineering, "utf8");
775
777
  const second = run("node", [cli, "sync", "--projects", repo, "--json"]);
@@ -797,7 +799,7 @@ function testLegacyEngineeringMigrationPreservesExistingBody() {
797
799
  assert(dryResult.actions.find(item => item.path === "docs/ENGINEERING.md")?.detail.includes("preserved-custom"), "custom legacy action should be labeled preserved-custom");
798
800
  run("node", [cli, "sync", "--projects", repo]);
799
801
  const migrated = fs.readFileSync(engineering, "utf8");
800
- assert(migrated.includes("version=4.1.2"), "legacy migration should insert the current managed workflow");
802
+ assert(migrated.includes("version=4.1.4"), "legacy migration should insert the current managed workflow");
801
803
  assert(migrated.includes(legacyNote), "legacy migration must preserve the complete existing body");
802
804
  const migratedStart = migrated.indexOf("<!-- auto-coding-skill:managed-workflow:start");
803
805
  const migratedEnd = migrated.indexOf(endMarker) + endMarker.length;
@@ -901,7 +903,7 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
901
903
  run("node", [cli, "sync", "--projects", repo]);
902
904
  const agents = path.join(repo, "AGENTS.md");
903
905
  const initial = fs.readFileSync(agents, "utf8");
904
- assert(initial.includes("managed-agents:start version=4.1.2"), "new projects should receive the versioned root AGENTS block");
906
+ assert(initial.includes("managed-agents:start version=4.1.4"), "new projects should receive the versioned root AGENTS block");
905
907
 
906
908
  const custom = [
907
909
  "# Project rules",
@@ -920,12 +922,12 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
920
922
 
921
923
  run("node", [cli, "sync", "--projects", repo]);
922
924
  const migrated = fs.readFileSync(agents, "utf8");
923
- assert(migrated.includes("managed-agents:start version=4.1.2"), "AGENTS migration should install the current managed block");
925
+ assert(migrated.includes("managed-agents:start version=4.1.4"), "AGENTS migration should install the current managed block");
924
926
  assert(!migrated.includes("Preserve this repository-specific rule exactly."), "root AGENTS must contain no project-specific tail");
925
927
  assert(!migrated.includes("must execute `commands.gate_full`"), "known official conflicting rule should be removed");
926
928
  const canonical = fs.readFileSync(path.join(repoRoot, "cli", "assets", "skill", "data", "templates", "bridges", "AGENTS.md"), "utf8");
927
929
  assert(migrated === canonical, "root AGENTS must be byte-identical to the packaged canonical file");
928
- const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.1.2.md");
930
+ const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.1.4.md");
929
931
  assert(fs.readFileSync(archive, "utf8").includes("Preserve this repository-specific rule exactly."), "previous AGENTS content must be archived once");
930
932
  const stable = fs.readFileSync(agents);
931
933
  run("node", [cli, "sync", "--projects", repo]);
@@ -984,7 +986,7 @@ function testEngineeringFrameworkAllowsProjectFactsButRejectsDuplicateWorkflow()
984
986
  const migrationResult = JSON.parse(migration.stdout).results[0];
985
987
  assert(migrationResult.managedWorkflow.state === "stale", "known duplicate sections should use controlled migration");
986
988
  assert(migrationResult.managedWorkflow.migrations.includes("engineering-section-delivery-flow"), "known section migration should be explicit");
987
- assert(migrationResult.actions.some(item => item.action === "would-archive" && item.path.includes("ENGINEERING.pre-4.1.2")), "controlled section cleanup should archive the previous ENGINEERING file");
989
+ assert(migrationResult.actions.some(item => item.action === "would-archive" && item.path.includes("ENGINEERING.pre-4.1.4")), "controlled section cleanup should archive the previous ENGINEERING file");
988
990
  run("node", [cli, "sync", "--projects", repo]);
989
991
  assert(!fs.readFileSync(engineering, "utf8").includes("Known obsolete workflow"), "known duplicate workflow section should be removed");
990
992
 
@@ -996,16 +998,20 @@ function testEngineeringFrameworkAllowsProjectFactsButRejectsDuplicateWorkflow()
996
998
  }
997
999
 
998
1000
  function testReleaseVersionMarkersStayInSync() {
999
- const expected = "4.1.2";
1001
+ const expected = "4.1.4";
1000
1002
  const pkg = JSON.parse(fs.readFileSync(path.join(repoRoot, "package.json"), "utf8"));
1001
1003
  const lock = JSON.parse(fs.readFileSync(path.join(repoRoot, "package-lock.json"), "utf8"));
1002
1004
  const policy = JSON.parse(fs.readFileSync(
1003
1005
  path.join(repoRoot, "src", "auto-coding-skill", "data", "policies", "workflow-migrations-v1.json"),
1004
1006
  "utf8",
1005
1007
  ));
1006
- assert(pkg.version === expected, "package version must match the 4.1.2 release");
1008
+ assert(pkg.version === expected, "package version must match the 4.1.4 release");
1007
1009
  assert(lock.version === expected && lock.packages[""].version === expected, "package-lock versions must match");
1008
1010
  assert(policy.managed_versions.engineering === expected && policy.managed_versions.agents === expected, "managed workflow versions must match");
1011
+ const publishWorkflow = fs.readFileSync(path.join(repoRoot, ".github", "workflows", "npm-publish.yml"), "utf8");
1012
+ assert(publishWorkflow.includes("tags:\n - \"v*\""), "npm publish must run from version tag pushes");
1013
+ assert(publishWorkflow.includes("Verify release identity"), "npm publish must bind the tag to package version");
1014
+ assert(publishWorkflow.includes("Check npm registry") && publishWorkflow.includes("Verify npm publication"), "npm publish must be idempotent and registry-verified");
1009
1015
  for (const rel of [
1010
1016
  "src/auto-coding-skill/data/templates/ENGINEERING.md",
1011
1017
  "src/auto-coding-skill/data/templates/bridges/AGENTS.md",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elvis1513/auto-coding-skill",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
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": {