@elvis1513/auto-coding-skill 4.1.1 → 4.1.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.
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from "node:child_process";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const here = path.dirname(fileURLToPath(import.meta.url));
8
+ const repoRoot = path.resolve(here, "..", "..");
9
+ const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
10
+ const packed = spawnSync(
11
+ npmCommand,
12
+ ["pack", "--dry-run", "--json", "--ignore-scripts"],
13
+ { cwd: repoRoot, encoding: "utf8" },
14
+ );
15
+
16
+ if (packed.status !== 0) {
17
+ process.stderr.write(packed.stderr || packed.stdout || "npm pack --dry-run failed\n");
18
+ process.exit(packed.status || 1);
19
+ }
20
+
21
+ let payload;
22
+ try {
23
+ payload = JSON.parse(packed.stdout);
24
+ } catch (error) {
25
+ process.stderr.write(`Cannot parse npm pack output: ${error.message}\n`);
26
+ process.exit(1);
27
+ }
28
+
29
+ const files = payload?.[0]?.files?.map(item => String(item.path || "")) || [];
30
+ const forbidden = files.filter(file =>
31
+ /(^|\/)__pycache__(\/|$)/.test(file) || /\.py[cod]$/i.test(file),
32
+ );
33
+ if (forbidden.length > 0) {
34
+ process.stderr.write(`Generated Python cache leaked into package:\n- ${forbidden.join("\n- ")}\n`);
35
+ process.exit(1);
36
+ }
37
+
38
+ process.stdout.write(`[package-check] OK files=${files.length}\n`);
package/cli/src/index.js CHANGED
@@ -1125,15 +1125,15 @@ function projectStatus(project, assetSkill, assetAgents){
1125
1125
  if (isolationState.present && !["adaptive", "worktree"].includes(frontmatterScalarValue(isolationState.value).toLowerCase())) {
1126
1126
  invalidConfigTokens.push("concurrency.isolation (must be adaptive or worktree)");
1127
1127
  }
1128
- for (const [pathParts, maximum] of [
1129
- [["validation", "max_command_seconds"], 120],
1130
- [["validation", "max_total_seconds"], 180],
1128
+ for (const pathParts of [
1129
+ ["validation", "max_command_seconds"],
1130
+ ["validation", "max_total_seconds"],
1131
1131
  ]) {
1132
1132
  const state = frontmatterPathState(text, pathParts);
1133
1133
  if (!state.present) continue;
1134
1134
  const value = Number(frontmatterScalarValue(state.value));
1135
- if (!Number.isFinite(value) || value <= 0 || value > maximum) {
1136
- invalidConfigTokens.push(`${pathParts.join(".")} (must be > 0 and <= ${maximum})`);
1135
+ if (!Number.isFinite(value) || value <= 0) {
1136
+ invalidConfigTokens.push(`${pathParts.join(".")} (must be > 0)`);
1137
1137
  }
1138
1138
  }
1139
1139
  const commandState = frontmatterPathState(text, ["validation", "max_command_seconds"]);
@@ -420,6 +420,79 @@ class AutoCodingConcurrencyTests(unittest.TestCase):
420
420
  self.assertEqual(before, git_output(repo, "rev-parse", "HEAD"))
421
421
  self.assertFalse(self.registry_manifest_path(repo, "DIRECT-NOOP").exists())
422
422
 
423
+ def test_unnecessary_lifecycle_rejects_before_access_or_fetch_checks(self) -> None:
424
+ _, repo, _ = self.make_repo("adaptive", require_review=False)
425
+ engineering = repo / "docs" / "ENGINEERING.md"
426
+ text = engineering.read_text(encoding="utf-8")
427
+ engineering.write_text(text.replace("front-pass", "", 1), encoding="utf-8")
428
+ git(repo, "add", "docs/ENGINEERING.md")
429
+ git(repo, "commit", "-qm", "invalidate access for preflight test")
430
+ git(repo, "push", "-q", "origin", "dev")
431
+
432
+ result = self.ap(
433
+ repo,
434
+ "task-start",
435
+ "DIRECT-PREFLIGHT",
436
+ "--base",
437
+ "origin/branch-that-must-not-be-fetched",
438
+ "--owned-path",
439
+ "shared.txt",
440
+ check=False,
441
+ )
442
+ output = result.stdout + result.stderr
443
+ self.assertNotEqual(0, result.returncode)
444
+ self.assertIn("does not need a machine task lifecycle", output)
445
+ self.assertNotIn("initialization is incomplete", output)
446
+
447
+ def test_continue_direct_can_adopt_owned_changes_for_new_review_lifecycle(self) -> None:
448
+ _, repo, remote = self.make_repo("adaptive", require_review=False)
449
+ (repo / "shared.txt").write_text("continued direct\n", encoding="utf-8")
450
+ started = self.ap(
451
+ repo,
452
+ "task-start",
453
+ "DIRECT-CONTINUE",
454
+ "--owned-path",
455
+ "shared.txt",
456
+ "--continue-direct",
457
+ "--review-required",
458
+ )
459
+ self.assertIn("execution_mode=direct", started.stdout)
460
+ status = json.loads(
461
+ self.ap(repo, "task-status", "DIRECT-CONTINUE", "--json").stdout
462
+ )["tasks"][0]
463
+ self.assertEqual("direct", status["execution_mode"])
464
+ missing_reviewer = self.ap(
465
+ repo,
466
+ "task-review",
467
+ "DIRECT-CONTINUE",
468
+ "--verdict",
469
+ "approved",
470
+ "--diff-fingerprint",
471
+ status["current_diff_fingerprint"],
472
+ check=False,
473
+ )
474
+ self.assertNotEqual(0, missing_reviewer.returncode)
475
+ self.assertIn("explicit --reviewer", missing_reviewer.stdout + missing_reviewer.stderr)
476
+ pushed = self.commit_push(repo, "DIRECT-CONTINUE", "DIRECT-CONTINUE: update")
477
+ self.assertIn("execution_mode=direct", pushed.stdout)
478
+ self.assertEqual("continued direct", git_output(remote, "show", "refs/heads/dev:shared.txt"))
479
+
480
+ (repo / "shared.txt").write_text("owned again\n", encoding="utf-8")
481
+ (repo / "unrelated.txt").write_text("unknown\n", encoding="utf-8")
482
+ rejected = self.ap(
483
+ repo,
484
+ "task-start",
485
+ "DIRECT-CONTINUE-BLOCKED",
486
+ "--owned-path",
487
+ "shared.txt",
488
+ "--continue-direct",
489
+ "--review-required",
490
+ check=False,
491
+ )
492
+ self.assertNotEqual(0, rejected.returncode)
493
+ self.assertIn("unrelated.txt", rejected.stdout + rejected.stderr)
494
+ self.assertFalse(self.registry_manifest_path(repo, "DIRECT-CONTINUE-BLOCKED").exists())
495
+
423
496
  def test_schema_one_task_status_fails_closed_with_migration_recovery(self) -> None:
424
497
  _, repo, _ = self.make_repo()
425
498
  self.start_task(repo, "LEGACY-SCHEMA")
@@ -2,6 +2,7 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  import argparse
5
+ import json
5
6
  import subprocess
6
7
  import sys
7
8
  import tempfile
@@ -217,6 +218,7 @@ class AutoCodingProfileTests(unittest.TestCase):
217
218
  "result_contract",
218
219
  "stages",
219
220
  "constraints",
221
+ "optional_roles",
220
222
  ]:
221
223
  self.assertIn(field, plan["agent_plan"])
222
224
 
@@ -233,8 +235,12 @@ class AutoCodingProfileTests(unittest.TestCase):
233
235
  self.assertEqual(["src/frontend/LoginPage.tsx"], plan["classification_files"])
234
236
  self.assertTrue(plan["intent_provided"])
235
237
  self.assertEqual(["auth", "release_or_tooling", "ui"], plan["intent_categories"])
238
+ self.assertEqual(["auth", "release_or_tooling"], plan["intent_risk_candidates"])
236
239
  self.assertTrue(plan["needs_browser"])
237
- self.assertEqual(["reviewer"], plan["recommended_agents"])
240
+ self.assertEqual("standard", plan["profile"])
241
+ self.assertFalse(plan["review_required"])
242
+ self.assertEqual([], plan["recommended_agents"])
243
+ self.assertEqual([], plan["optional_agents"])
238
244
  self.assertNotIn("browser_debugger", plan["recommended_agents"])
239
245
  self.assertNotIn("docs_researcher", plan["recommended_agents"])
240
246
  self.assertNotIn("新增登录鉴权页面并发布", str(plan))
@@ -243,6 +249,7 @@ class AutoCodingProfileTests(unittest.TestCase):
243
249
  repo, cfg = self.make_repo()
244
250
  plan = self.plan(repo, cfg, planned_paths=["src/widget.py"])
245
251
  self.assertEqual("standard", plan["profile"])
252
+ self.assertEqual("change", plan["task_kind"])
246
253
  self.assertEqual("changed", plan["selected_scope"])
247
254
  self.assertEqual("dev", plan["effective_mode"])
248
255
  self.assertEqual([], plan["recommended_agents"])
@@ -269,7 +276,63 @@ class AutoCodingProfileTests(unittest.TestCase):
269
276
  plan["mechanism_plan"]["required"],
270
277
  )
271
278
  self.assertFalse(plan["mechanism_plan"]["lifecycle_required"])
272
- self.assertIn("task_lifecycle", plan["mechanism_plan"]["not_required"])
279
+ self.assertIn("read_only_subagents", plan["mechanism_plan"]["optional_when_beneficial"])
280
+ self.assertIn("task_lifecycle", plan["mechanism_plan"]["forbidden"])
281
+
282
+ def test_intent_only_classifies_read_only_change_and_terminal_work(self) -> None:
283
+ repo, cfg = self.make_repo()
284
+ read_only = self.plan(repo, cfg, intent="Explain how authentication currently works")
285
+ self.assertEqual("read_only", read_only["task_kind"])
286
+ self.assertEqual("none", read_only["execution_mode"])
287
+ self.assertEqual(["analysis"], read_only["mechanism_plan"]["required"])
288
+ self.assertIn(
289
+ "read_only_subagents",
290
+ read_only["mechanism_plan"]["optional_when_beneficial"],
291
+ )
292
+ self.assertIn("commit_push", read_only["mechanism_plan"]["forbidden"])
293
+
294
+ change = self.plan(repo, cfg, intent="Fix the login redirect bug")
295
+ self.assertEqual("change", change["task_kind"])
296
+ self.assertEqual("direct", change["execution_mode"])
297
+ self.assertIn("commit_push", change["mechanism_plan"]["required"])
298
+
299
+ chinese_change = self.plan(repo, cfg, intent="请解决并优化登录跳转问题")
300
+ self.assertEqual("change", chinese_change["task_kind"])
301
+
302
+ forced_read_only = self.plan(
303
+ repo,
304
+ cfg,
305
+ intent="Fix wording in the explanation",
306
+ requested_task_kind="read_only",
307
+ )
308
+ self.assertEqual("read_only", forced_read_only["task_kind"])
309
+
310
+ terminal = self.plan(
311
+ repo,
312
+ cfg,
313
+ intent="reconcile the completed task ledger",
314
+ )
315
+ self.assertEqual("terminal_maintenance", terminal["task_kind"])
316
+ self.assertEqual(
317
+ ["analysis", "targeted_consistency_check", "commit_push"],
318
+ terminal["mechanism_plan"]["required"],
319
+ )
320
+ self.assertIn("task_lifecycle", terminal["mechanism_plan"]["forbidden"])
321
+
322
+ with self.assertRaises(APError):
323
+ self.plan(
324
+ repo,
325
+ cfg,
326
+ planned_paths=["src/payment/service.py"],
327
+ requested_task_kind="terminal_maintenance",
328
+ )
329
+ with self.assertRaises(APError):
330
+ self.plan(
331
+ repo,
332
+ cfg,
333
+ planned_paths=["src/widget.py"],
334
+ requested_task_kind="none",
335
+ )
273
336
 
274
337
  def test_execution_mode_is_none_direct_isolated_or_parallel(self) -> None:
275
338
  repo, cfg = self.make_repo()
@@ -293,6 +356,84 @@ class AutoCodingProfileTests(unittest.TestCase):
293
356
  self.assertTrue(parallel["review_required"])
294
357
  self.assertIn("fixer", parallel["recommended_agents"])
295
358
  self.assertIn("parallel_fixers", parallel["mechanism_plan"]["required"])
359
+ self.assertEqual("orchestrated-subagents", parallel["agent_plan"]["strategy"])
360
+
361
+ def test_continue_direct_accepts_only_declared_current_task_dirt(self) -> None:
362
+ repo, cfg = self.make_repo()
363
+ target = repo / "src" / "widget.py"
364
+ target.parent.mkdir(parents=True, exist_ok=True)
365
+ target.write_text("task change\n", encoding="utf-8")
366
+
367
+ default = self.plan(repo, cfg, planned_paths=["src/widget.py"])
368
+ self.assertEqual("isolated", default["execution_mode"])
369
+ continued = self.plan(
370
+ repo,
371
+ cfg,
372
+ planned_paths=["src/widget.py"],
373
+ continue_direct=True,
374
+ )
375
+ self.assertEqual("direct", continued["execution_mode"])
376
+ self.assertTrue(continued["continued_direct"])
377
+ self.assertEqual([], continued["dirty_outside_plan"])
378
+
379
+ (repo / "unrelated.txt").write_text("other writer\n", encoding="utf-8")
380
+ blocked = self.plan(
381
+ repo,
382
+ cfg,
383
+ planned_paths=["src/widget.py"],
384
+ continue_direct=True,
385
+ )
386
+ self.assertEqual("isolated", blocked["execution_mode"])
387
+ self.assertEqual(["unrelated.txt"], blocked["dirty_outside_plan"])
388
+
389
+ def test_risk_intent_is_candidate_while_paths_and_rules_control_escalation(self) -> None:
390
+ repo, cfg = self.make_repo()
391
+ ui = self.plan(
392
+ repo,
393
+ cfg,
394
+ planned_paths=["frontend/src/LoginPage.tsx"],
395
+ intent="修复登录跳转问题",
396
+ )
397
+ self.assertEqual("standard", ui["profile"])
398
+ self.assertFalse(ui["review_required"])
399
+ self.assertEqual(["auth"], ui["intent_risk_candidates"])
400
+ self.assertEqual(["browser_debugger"], ui["optional_agents"])
401
+
402
+ backend = self.plan(repo, cfg, planned_paths=["backend/auth/service.py"])
403
+ self.assertEqual("high-risk", backend["profile"])
404
+ self.assertTrue(backend["review_required"])
405
+ self.assertEqual(["explorer"], backend["optional_agents"])
406
+
407
+ cfg["risk"] = {
408
+ "rules": [
409
+ {
410
+ "name": "sensitive-login-ui",
411
+ "paths": ["frontend/src/LoginPage.tsx"],
412
+ "profile": "high-risk",
413
+ }
414
+ ]
415
+ }
416
+ configured = self.plan(repo, cfg, planned_paths=["frontend/src/LoginPage.tsx"])
417
+ self.assertEqual("high-risk", configured["profile"])
418
+
419
+ order = self.plan(repo, cfg, planned_paths=["backend/orders/sort_order.py"])
420
+ self.assertNotIn("payment", order["categories"])
421
+
422
+ def test_generated_agent_strategies_match_contract_schema(self) -> None:
423
+ schema = json.loads(
424
+ (REPO_ROOT / "src" / "auto-coding-skill" / "data" / "contracts" / "orchestration-v1.schema.json")
425
+ .read_text(encoding="utf-8")
426
+ )
427
+ allowed = set(schema["$defs"]["agentPlan"]["properties"]["strategy"]["enum"])
428
+ repo, cfg = self.make_repo()
429
+ for kwargs in [
430
+ {"planned_paths": ["src/widget.py"]},
431
+ {"planned_paths": ["backend/auth/service.py"]},
432
+ {"planned_paths": ["src/widget.py"], "parallel_writers": 2},
433
+ ]:
434
+ with self.subTest(kwargs=kwargs):
435
+ plan = self.plan(repo, cfg, **kwargs)
436
+ self.assertIn(plan["agent_plan"]["strategy"], allowed)
296
437
 
297
438
  def test_validation_routes_collect_all_commands_and_reject_unmapped_code(self) -> None:
298
439
  repo, cfg = self.make_repo()
@@ -312,7 +453,7 @@ class AutoCodingProfileTests(unittest.TestCase):
312
453
  ap._validate_validation_plan(cfg, ap._validation_plan(cfg, ["contracts/api.yaml"]))
313
454
  self.assertIn("no validation route", str(context.exception))
314
455
 
315
- def test_final_gate_budget_is_hard_bounded_and_times_out(self) -> None:
456
+ def test_final_gate_budget_is_configurable_and_times_out(self) -> None:
316
457
  cfg = base_config()
317
458
  cfg["validation"] = {
318
459
  "on_unmapped": "error",
@@ -335,10 +476,42 @@ class AutoCodingProfileTests(unittest.TestCase):
335
476
  )
336
477
  self.assertIn("timed out", str(context.exception))
337
478
 
338
- cfg["validation"]["max_command_seconds"] = 121
479
+ cfg["validation"]["max_command_seconds"] = 240
480
+ cfg["validation"]["max_total_seconds"] = 300
481
+ self.assertEqual(
482
+ {"command_seconds": 240.0, "total_seconds": 300.0},
483
+ ap._final_gate_budget(cfg),
484
+ )
485
+
486
+ cfg["validation"]["max_total_seconds"] = 200
339
487
  with self.assertRaises(APError) as context:
340
488
  ap._final_gate_budget(cfg)
341
- self.assertIn("cannot exceed 120", str(context.exception))
489
+ self.assertIn("cannot exceed validation.max_total_seconds", str(context.exception))
490
+
491
+ def test_route_timeout_uses_smallest_matching_budget(self) -> None:
492
+ cfg = base_config()
493
+ cfg["commands"] = {"one": "true", "two": "true"}
494
+ cfg["validation"] = {
495
+ "on_unmapped": "error",
496
+ "max_command_seconds": 120,
497
+ "max_total_seconds": 180,
498
+ "routes": [
499
+ {
500
+ "name": "all-src",
501
+ "paths": ["src/**"],
502
+ "commands": ["one", "two"],
503
+ "timeout_seconds": 90,
504
+ },
505
+ {
506
+ "name": "python",
507
+ "paths": ["**/*.py"],
508
+ "commands": ["two"],
509
+ "timeout_seconds": 30,
510
+ },
511
+ ],
512
+ }
513
+ plan = ap._validation_plan(cfg, ["src/widget.py"])
514
+ self.assertEqual({"one": 90.0, "two": 30.0}, plan["command_timeouts"])
342
515
 
343
516
  def test_test_only_change_resolves_micro(self) -> None:
344
517
  repo, cfg = self.make_repo("tests/widget_test.py")
@@ -486,7 +486,7 @@ function testBridgeIsGeneric() {
486
486
  run("python3", [assetAp, "--repo", repo, "install", "--bridges"]);
487
487
  assert(exists(path.join(repo, "AGENTS.md")), "generic bridge should be created");
488
488
  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");
489
+ assert(bridge.includes("Every delegated fixer or parallel writer owns a task ID/worktree"), "bridge should expose delegated-writer isolation");
490
490
  assert(bridge.includes("integrates in dependency order"), "bridge should expose dependency ordering");
491
491
  for (const filename of [`CO${"DEX.md"}`, `CLA${"UDE.md"}`]) {
492
492
  assert(!exists(path.join(repo, filename)), "client-named bridge should not be created");
@@ -733,7 +733,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
733
733
 
734
734
  const engineering = path.join(repo, "docs", "ENGINEERING.md");
735
735
  const initial = fs.readFileSync(engineering, "utf8");
736
- const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.1\.1 -->/;
736
+ const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.1\.3 -->/;
737
737
  const endMarker = "<!-- auto-coding-skill:managed-workflow:end -->";
738
738
  assert(startPattern.test(initial), "new projects should include a versioned managed workflow marker");
739
739
  assert(initial.includes(endMarker), "new projects should include the managed workflow end marker");
@@ -752,7 +752,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
752
752
  const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
753
753
  const dryResult = JSON.parse(dryRun.stdout).results[0];
754
754
  assert(dryResult.managedWorkflow.state === "stale", `dry-run should expose stale workflow state: ${dryRun.stdout}`);
755
- assert(dryResult.managedWorkflow.version === "4.1.1", "dry-run should expose the target workflow version");
755
+ assert(dryResult.managedWorkflow.version === "4.1.3", "dry-run should expose the target workflow version");
756
756
  assert(dryResult.actions.some(item => item.action === "would-update" && item.path === "docs/ENGINEERING.md"), "dry-run should plan the managed body update");
757
757
  assert(fs.readFileSync(engineering, "utf8") === customized, "dry-run must not write ENGINEERING.md");
758
758
 
@@ -762,14 +762,14 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
762
762
  const updatedEnd = updated.indexOf(endMarker) + endMarker.length;
763
763
  assert(updated.slice(0, updatedStart) === outsideBefore, "sync must preserve frontmatter and content before the managed block byte-for-byte");
764
764
  assert(updated.slice(updatedEnd) === outsideAfter, "sync must preserve content after the managed block byte-for-byte");
765
- assert(updated.includes("version=4.1.1"), "sync should install the current managed workflow version");
765
+ assert(updated.includes("version=4.1.3"), "sync should install the current managed workflow version");
766
766
  assert(updated.includes("The frontmatter contract is:"), "sync should refresh stale managed workflow content");
767
767
 
768
768
  fillRequiredAccess(repo);
769
769
  const status = run("node", [cli, "status", "--projects", repo, "--json"]);
770
770
  const statusResult = JSON.parse(status.stdout).results[0];
771
771
  assert(statusResult.managedWorkflow.state === "current", `status should expose current managed workflow state: ${status.stdout}`);
772
- assert(statusResult.managedWorkflow.version === "4.1.1", "status should expose the installed managed workflow version");
772
+ assert(statusResult.managedWorkflow.version === "4.1.3", "status should expose the installed managed workflow version");
773
773
 
774
774
  const beforeSecondSync = fs.readFileSync(engineering, "utf8");
775
775
  const second = run("node", [cli, "sync", "--projects", repo, "--json"]);
@@ -797,7 +797,7 @@ function testLegacyEngineeringMigrationPreservesExistingBody() {
797
797
  assert(dryResult.actions.find(item => item.path === "docs/ENGINEERING.md")?.detail.includes("preserved-custom"), "custom legacy action should be labeled preserved-custom");
798
798
  run("node", [cli, "sync", "--projects", repo]);
799
799
  const migrated = fs.readFileSync(engineering, "utf8");
800
- assert(migrated.includes("version=4.1.1"), "legacy migration should insert the current managed workflow");
800
+ assert(migrated.includes("version=4.1.3"), "legacy migration should insert the current managed workflow");
801
801
  assert(migrated.includes(legacyNote), "legacy migration must preserve the complete existing body");
802
802
  const migratedStart = migrated.indexOf("<!-- auto-coding-skill:managed-workflow:start");
803
803
  const migratedEnd = migrated.indexOf(endMarker) + endMarker.length;
@@ -901,7 +901,7 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
901
901
  run("node", [cli, "sync", "--projects", repo]);
902
902
  const agents = path.join(repo, "AGENTS.md");
903
903
  const initial = fs.readFileSync(agents, "utf8");
904
- assert(initial.includes("managed-agents:start version=4.1.1"), "new projects should receive the versioned root AGENTS block");
904
+ assert(initial.includes("managed-agents:start version=4.1.3"), "new projects should receive the versioned root AGENTS block");
905
905
 
906
906
  const custom = [
907
907
  "# Project rules",
@@ -920,12 +920,12 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
920
920
 
921
921
  run("node", [cli, "sync", "--projects", repo]);
922
922
  const migrated = fs.readFileSync(agents, "utf8");
923
- assert(migrated.includes("managed-agents:start version=4.1.1"), "AGENTS migration should install the current managed block");
923
+ assert(migrated.includes("managed-agents:start version=4.1.3"), "AGENTS migration should install the current managed block");
924
924
  assert(!migrated.includes("Preserve this repository-specific rule exactly."), "root AGENTS must contain no project-specific tail");
925
925
  assert(!migrated.includes("must execute `commands.gate_full`"), "known official conflicting rule should be removed");
926
926
  const canonical = fs.readFileSync(path.join(repoRoot, "cli", "assets", "skill", "data", "templates", "bridges", "AGENTS.md"), "utf8");
927
927
  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.1.md");
928
+ const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.1.3.md");
929
929
  assert(fs.readFileSync(archive, "utf8").includes("Preserve this repository-specific rule exactly."), "previous AGENTS content must be archived once");
930
930
  const stable = fs.readFileSync(agents);
931
931
  run("node", [cli, "sync", "--projects", repo]);
@@ -984,7 +984,7 @@ function testEngineeringFrameworkAllowsProjectFactsButRejectsDuplicateWorkflow()
984
984
  const migrationResult = JSON.parse(migration.stdout).results[0];
985
985
  assert(migrationResult.managedWorkflow.state === "stale", "known duplicate sections should use controlled migration");
986
986
  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.1")), "controlled section cleanup should archive the previous ENGINEERING file");
987
+ assert(migrationResult.actions.some(item => item.action === "would-archive" && item.path.includes("ENGINEERING.pre-4.1.3")), "controlled section cleanup should archive the previous ENGINEERING file");
988
988
  run("node", [cli, "sync", "--projects", repo]);
989
989
  assert(!fs.readFileSync(engineering, "utf8").includes("Known obsolete workflow"), "known duplicate workflow section should be removed");
990
990
 
@@ -996,14 +996,14 @@ function testEngineeringFrameworkAllowsProjectFactsButRejectsDuplicateWorkflow()
996
996
  }
997
997
 
998
998
  function testReleaseVersionMarkersStayInSync() {
999
- const expected = "4.1.1";
999
+ const expected = "4.1.3";
1000
1000
  const pkg = JSON.parse(fs.readFileSync(path.join(repoRoot, "package.json"), "utf8"));
1001
1001
  const lock = JSON.parse(fs.readFileSync(path.join(repoRoot, "package-lock.json"), "utf8"));
1002
1002
  const policy = JSON.parse(fs.readFileSync(
1003
1003
  path.join(repoRoot, "src", "auto-coding-skill", "data", "policies", "workflow-migrations-v1.json"),
1004
1004
  "utf8",
1005
1005
  ));
1006
- assert(pkg.version === expected, "package version must match the 4.1.1 release");
1006
+ assert(pkg.version === expected, "package version must match the 4.1.3 release");
1007
1007
  assert(lock.version === expected && lock.packages[""].version === expected, "package-lock versions must match");
1008
1008
  assert(policy.managed_versions.engineering === expected && policy.managed_versions.agents === expected, "managed workflow versions must match");
1009
1009
  for (const rel of [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elvis1513/auto-coding-skill",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
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": {
@@ -15,11 +15,14 @@
15
15
  "LICENSE"
16
16
  ],
17
17
  "scripts": {
18
+ "clean:cache": "find cli src -type d -name '__pycache__' -prune -exec rm -rf {} +",
19
+ "prepack": "npm run clean:cache",
20
+ "check:package": "npm run clean:cache && node cli/src/check-package.js",
18
21
  "test": "node -c cli/src/index.js && node -c cli/src/sync-assets.js && node -c cli/tests/index.test.js && node cli/tests/index.test.js && python3 -c \"import ast, pathlib; files = ['cli/assets/skill/scripts/ap.py', 'cli/assets/skill/scripts/core.py', 'cli/assets/skill/scripts/http_checks.py', 'cli/assets/skill/scripts/scaffold_templates.py']; [ast.parse(pathlib.Path(rel).read_text(encoding='utf-8'), filename=rel, feature_version=(3, 11)) for rel in files]; print('python311-asset-grammar-ok')\" && python3 -m py_compile cli/assets/skill/scripts/ap.py cli/assets/skill/scripts/core.py cli/assets/skill/scripts/http_checks.py cli/assets/skill/scripts/scaffold_templates.py && python3 cli/tests/ap_profiles_test.py && python3 cli/tests/ap_concurrency_test.py && python3 -c \"import pathlib, tomllib; files = sorted(pathlib.Path('cli/assets/agents').glob('*.toml')); [tomllib.loads(path.read_text(encoding='utf-8')) for path in files]; print('asset-agent-toml-ok')\" && find cli -type d -name '__pycache__' -prune -exec rm -rf {} +",
19
22
  "test:src": "python3 -c \"import ast, pathlib; files = ['src/auto-coding-skill/scripts/ap.py', 'src/auto-coding-skill/scripts/core.py', 'src/auto-coding-skill/scripts/http_checks.py', 'src/auto-coding-skill/scripts/scaffold_templates.py']; [ast.parse(pathlib.Path(rel).read_text(encoding='utf-8'), filename=rel, feature_version=(3, 11)) for rel in files]; print('python311-src-grammar-ok')\" && python3 -m py_compile src/auto-coding-skill/scripts/ap.py src/auto-coding-skill/scripts/core.py src/auto-coding-skill/scripts/http_checks.py src/auto-coding-skill/scripts/scaffold_templates.py && python3 -c \"import pathlib, tomllib; files = sorted(pathlib.Path('src/agents').glob('*.toml')); [tomllib.loads(path.read_text(encoding='utf-8')) for path in files]; print('src-agent-toml-ok')\" && find src -type d -name '__pycache__' -prune -exec rm -rf {} +",
20
23
  "check:assets": "node cli/src/sync-assets.js --check",
21
24
  "sync-assets": "node cli/src/sync-assets.js",
22
- "release:check": "npm run check:assets && npm run test:src && npm run test && npm pack --dry-run"
25
+ "release:check": "npm run check:assets && npm run test:src && npm run test && npm run check:package"
23
26
  },
24
27
  "license": "MIT",
25
28
  "publishConfig": {