@elvis1513/auto-coding-skill 3.0.3 → 4.0.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.
- package/README.md +131 -324
- package/cli/assets/agents/explorer.toml +1 -1
- package/cli/assets/agents/fixer.toml +4 -4
- package/cli/assets/agents/reviewer.toml +11 -12
- package/cli/assets/skill/SKILL.md +95 -223
- package/cli/assets/skill/data/policies/workflow-migrations-v1.json +3 -3
- package/cli/assets/skill/data/templates/ENGINEERING.md +137 -292
- package/cli/assets/skill/data/templates/bridges/AGENTS.md +26 -13
- package/cli/assets/skill/scripts/ap.py +665 -193
- package/cli/src/index.js +13 -13
- package/cli/tests/ap_concurrency_test.py +47 -14
- package/cli/tests/ap_profiles_test.py +55 -22
- package/cli/tests/index.test.js +52 -31
- package/package.json +2 -2
package/cli/src/index.js
CHANGED
|
@@ -172,7 +172,7 @@ function compareDirs(src, dst, options = {}){
|
|
|
172
172
|
return diffs;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
const CORE_DOCS = [
|
|
175
|
+
const CORE_DOCS = [];
|
|
176
176
|
|
|
177
177
|
function isEscapedAt(text, index){
|
|
178
178
|
let slashes = 0;
|
|
@@ -380,7 +380,7 @@ function inferredGateCommands(project){
|
|
|
380
380
|
const scripts = parsed?.scripts;
|
|
381
381
|
if (!scripts || typeof scripts !== "object") return {};
|
|
382
382
|
return typeof scripts["test:changed"] === "string" && scripts["test:changed"].trim()
|
|
383
|
-
? {
|
|
383
|
+
? { project_fast: "npm run test:changed" }
|
|
384
384
|
: {};
|
|
385
385
|
} catch {
|
|
386
386
|
return {};
|
|
@@ -393,7 +393,7 @@ function renderEngineeringTemplate(templateText, project){
|
|
|
393
393
|
`project:\n name: ${JSON.stringify(path.basename(path.resolve(project)))}`,
|
|
394
394
|
);
|
|
395
395
|
for (const [key, gate] of Object.entries(inferredGateCommands(project))) {
|
|
396
|
-
rendered = rendered.replace(` ${key}: "
|
|
396
|
+
rendered = rendered.replace(` ${key}: ""`, ` ${key}: ${JSON.stringify(gate)}`);
|
|
397
397
|
}
|
|
398
398
|
return rendered;
|
|
399
399
|
}
|
|
@@ -829,7 +829,7 @@ function registeredLegacyTasks(project){
|
|
|
829
829
|
continue;
|
|
830
830
|
}
|
|
831
831
|
const schema = Number(manifest?.schema ?? 0);
|
|
832
|
-
if (!Number.isFinite(schema) || schema <
|
|
832
|
+
if (!Number.isFinite(schema) || schema < 3) {
|
|
833
833
|
legacy.push({ project: root, manifest: entry.name, schema: Number.isFinite(schema) ? schema : "invalid" });
|
|
834
834
|
}
|
|
835
835
|
}
|
|
@@ -841,9 +841,9 @@ function assertNoLegacyRegisteredTasks(projects){
|
|
|
841
841
|
if (!legacy.length) return;
|
|
842
842
|
const locations = legacy.map(item => `${item.project}:${item.manifest}(schema=${item.schema})`).join(", ");
|
|
843
843
|
die(
|
|
844
|
-
"refusing the entire sync batch because registered auto-coding tasks use schema <
|
|
845
|
-
+ `${locations}\nFinish, integrate, and clean these tasks with the currently installed 3.
|
|
846
|
-
+ "sync will not
|
|
844
|
+
"refusing the entire sync batch because registered auto-coding tasks use schema < 3: "
|
|
845
|
+
+ `${locations}\nFinish, integrate, and clean these tasks with the currently installed 3.x runtime before upgrading. `
|
|
846
|
+
+ "sync will not change the lifecycle semantics of an in-flight task.",
|
|
847
847
|
);
|
|
848
848
|
}
|
|
849
849
|
|
|
@@ -1017,6 +1017,7 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
1017
1017
|
const managedWorkflow = publicEngineeringPlan(engineeringPlan);
|
|
1018
1018
|
const managedAgentsDocument = publicEngineeringPlan(agentsDocumentPlan);
|
|
1019
1019
|
const requiredConfigPaths = [
|
|
1020
|
+
{ label: "workflow.skill_version", path: ["workflow", "skill_version"] },
|
|
1020
1021
|
{ label: "workflow.mode", path: ["workflow", "mode"] },
|
|
1021
1022
|
{ label: "workflow.profile", path: ["workflow", "profile"] },
|
|
1022
1023
|
{ label: "workflow.completion", path: ["workflow", "completion"] },
|
|
@@ -1028,6 +1029,10 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
1028
1029
|
{ label: "concurrency.cleanup_merged", path: ["concurrency", "cleanup_merged"] },
|
|
1029
1030
|
{ label: "concurrency.delete_remote_branch", path: ["concurrency", "delete_remote_branch"] },
|
|
1030
1031
|
{ label: "concurrency.disposable_ignored", path: ["concurrency", "disposable_ignored"] },
|
|
1032
|
+
{ label: "commands.project_fast", path: ["commands", "project_fast"], filled: true },
|
|
1033
|
+
{ label: "validation.on_unmapped", path: ["validation", "on_unmapped"] },
|
|
1034
|
+
{ label: "validation.routes", path: ["validation", "routes"] },
|
|
1035
|
+
{ label: "risk.rules", path: ["risk", "rules"] },
|
|
1031
1036
|
{ label: "project.name", path: ["project", "name"], filled: true },
|
|
1032
1037
|
{ label: "access.project.frontend.url", path: ["access", "project", "frontend", "url"], filled: true },
|
|
1033
1038
|
{ label: "access.project.frontend.username", path: ["access", "project", "frontend", "username"], filled: true },
|
|
@@ -1047,11 +1052,6 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
1047
1052
|
{ label: "access.nexus.frontend.url", path: ["access", "nexus", "frontend", "url"], filled: true },
|
|
1048
1053
|
{ label: "access.nexus.frontend.username", path: ["access", "nexus", "frontend", "username"], filled: true },
|
|
1049
1054
|
{ label: "access.nexus.frontend.password", path: ["access", "nexus", "frontend", "password"], filled: true },
|
|
1050
|
-
{ label: "docs.taskbook", path: ["docs", "taskbook"] },
|
|
1051
|
-
{ label: "docs.closure_log", path: ["docs", "closure_log"] },
|
|
1052
|
-
{ label: "docs.active_task_dir", path: ["docs", "active_task_dir"] },
|
|
1053
|
-
{ label: "docs.task_closure_dir", path: ["docs", "task_closure_dir"] },
|
|
1054
|
-
{ label: "docs.task_evidence_dir", path: ["docs", "task_evidence_dir"] },
|
|
1055
1055
|
];
|
|
1056
1056
|
let missingConfigPaths = requiredConfigPaths.map(item => item.label);
|
|
1057
1057
|
let unfilledConfigTokens = [];
|
|
@@ -1082,7 +1082,7 @@ function projectStatus(project, assetSkill, assetAgents){
|
|
|
1082
1082
|
for (const rel of CORE_DOCS) {
|
|
1083
1083
|
if (!exists(path.join(root, "docs", rel))) missingDocs.push(path.join("docs", rel));
|
|
1084
1084
|
}
|
|
1085
|
-
const skillDiffs = exists(skillDir) ? compareDirs(assetSkill, skillDir, { includeExtra:
|
|
1085
|
+
const skillDiffs = exists(skillDir) ? compareDirs(assetSkill, skillDir, { includeExtra: true }) : [{ path: ".agents/skills/auto-coding-skill", status: "missing" }];
|
|
1086
1086
|
const agentStatus = exists(agentsDir)
|
|
1087
1087
|
? compareManagedAgents(assetAgents, agentsDir)
|
|
1088
1088
|
: { diffs: [{ path: ".agents/agents", status: "missing" }], bindings: [] };
|
|
@@ -79,6 +79,11 @@ def base_config(isolation: str | object = "adaptive") -> dict:
|
|
|
79
79
|
"no_change_scope": "changed",
|
|
80
80
|
"rules": [],
|
|
81
81
|
},
|
|
82
|
+
"risk": {
|
|
83
|
+
"rules": [
|
|
84
|
+
{"name": "test-review", "paths": ["**"], "review": "required"},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
82
87
|
"structure": {"enabled": False, "enforcement": "advisory"},
|
|
83
88
|
"verification": {
|
|
84
89
|
"target_env_required": False,
|
|
@@ -109,7 +114,9 @@ def base_config(isolation: str | object = "adaptive") -> dict:
|
|
|
109
114
|
class AutoCodingConcurrencyTests(unittest.TestCase):
|
|
110
115
|
def make_repo(
|
|
111
116
|
self,
|
|
112
|
-
isolation: str | object = "
|
|
117
|
+
isolation: str | object = "worktree",
|
|
118
|
+
*,
|
|
119
|
+
require_review: bool = True,
|
|
113
120
|
) -> tuple[Path, Path, Path]:
|
|
114
121
|
temp = tempfile.TemporaryDirectory(prefix="autocoding-concurrency-")
|
|
115
122
|
self.addCleanup(temp.cleanup)
|
|
@@ -125,6 +132,8 @@ class AutoCodingConcurrencyTests(unittest.TestCase):
|
|
|
125
132
|
git(repo, "config", "user.name", "Auto Coding Test")
|
|
126
133
|
|
|
127
134
|
config = base_config(isolation)
|
|
135
|
+
if not require_review:
|
|
136
|
+
config["risk"]["rules"] = []
|
|
128
137
|
if "concurrency" in config:
|
|
129
138
|
config["concurrency"]["worktree_root"] = str(worktrees)
|
|
130
139
|
engineering = repo / "docs" / "ENGINEERING.md"
|
|
@@ -202,6 +211,8 @@ class AutoCodingConcurrencyTests(unittest.TestCase):
|
|
|
202
211
|
"origin/dev",
|
|
203
212
|
"--owned-path",
|
|
204
213
|
".",
|
|
214
|
+
"--isolated",
|
|
215
|
+
"--review-required",
|
|
205
216
|
)
|
|
206
217
|
worktree = self.task_worktree(repo, task_id)
|
|
207
218
|
self.assertIn(task_id, result.stdout + result.stderr)
|
|
@@ -358,19 +369,42 @@ class AutoCodingConcurrencyTests(unittest.TestCase):
|
|
|
358
369
|
),
|
|
359
370
|
"task-start must persist a task manifest in the Git common directory",
|
|
360
371
|
)
|
|
361
|
-
|
|
362
|
-
|
|
372
|
+
self.assertFalse(
|
|
373
|
+
(worktree / "docs" / "tasks" / "active" / "START-1.md").exists(),
|
|
374
|
+
"4.0 machine state must not create tracked active-task documents",
|
|
363
375
|
)
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
"
|
|
371
|
-
"
|
|
372
|
-
|
|
373
|
-
|
|
376
|
+
|
|
377
|
+
def test_clean_serial_task_uses_direct_branch_and_no_diff_is_noop(self) -> None:
|
|
378
|
+
_, repo, remote = self.make_repo("adaptive", require_review=False)
|
|
379
|
+
worktrees_before = git_output(repo, "worktree", "list", "--porcelain")
|
|
380
|
+
start = self.ap(
|
|
381
|
+
repo,
|
|
382
|
+
"task-start",
|
|
383
|
+
"DIRECT-1",
|
|
384
|
+
"--base",
|
|
385
|
+
"origin/dev",
|
|
386
|
+
"--owned-path",
|
|
387
|
+
"shared.txt",
|
|
388
|
+
)
|
|
389
|
+
self.assertIn("execution_mode=direct", start.stdout)
|
|
390
|
+
self.assertEqual(worktrees_before, git_output(repo, "worktree", "list", "--porcelain"))
|
|
391
|
+
self.assert_local_branch(repo, "codex/DIRECT-1", False)
|
|
392
|
+
status = json.loads(self.ap(repo, "task-status", "DIRECT-1", "--json").stdout)["tasks"][0]
|
|
393
|
+
self.assertEqual("direct", status["execution_mode"])
|
|
394
|
+
self.assertFalse((repo / "docs" / "tasks" / "active" / "DIRECT-1.md").exists())
|
|
395
|
+
|
|
396
|
+
(repo / "shared.txt").write_text("direct\n", encoding="utf-8")
|
|
397
|
+
pushed = self.ap(repo, "commit-push", "DIRECT-1", "--msg", "DIRECT-1: update")
|
|
398
|
+
self.assertIn("execution_mode=direct", pushed.stdout)
|
|
399
|
+
self.assertEqual("direct", git_output(remote, "show", "refs/heads/dev:shared.txt"))
|
|
400
|
+
self.assertFalse(self.registry_manifest_path(repo, "DIRECT-1").exists())
|
|
401
|
+
|
|
402
|
+
before = git_output(repo, "rev-parse", "HEAD")
|
|
403
|
+
self.ap(repo, "task-start", "DIRECT-NOOP", "--owned-path", "shared.txt")
|
|
404
|
+
noop = self.ap(repo, "commit-push", "DIRECT-NOOP", "--msg", "DIRECT-NOOP: none")
|
|
405
|
+
self.assertIn("NOOP", noop.stdout)
|
|
406
|
+
self.assertEqual(before, git_output(repo, "rev-parse", "HEAD"))
|
|
407
|
+
self.assertFalse(self.registry_manifest_path(repo, "DIRECT-NOOP").exists())
|
|
374
408
|
|
|
375
409
|
def test_schema_one_task_status_fails_closed_with_migration_recovery(self) -> None:
|
|
376
410
|
_, repo, _ = self.make_repo()
|
|
@@ -780,7 +814,6 @@ class AutoCodingConcurrencyTests(unittest.TestCase):
|
|
|
780
814
|
self.assertIn("worktree", (primary.stdout + primary.stderr).lower())
|
|
781
815
|
|
|
782
816
|
second_status = git(second_worktree, "status", "--short").stdout
|
|
783
|
-
self.assertIn("?? docs/tasks/active/", second_status)
|
|
784
817
|
self.assertIn("?? second-task-only.txt", second_status)
|
|
785
818
|
self.approve_task(worktree, "ISOLATED-1")
|
|
786
819
|
self.approve_task(second_worktree, "ISOLATED-2")
|
|
@@ -50,9 +50,9 @@ def base_config() -> dict:
|
|
|
50
50
|
},
|
|
51
51
|
"gate": {
|
|
52
52
|
"default_scope": "auto",
|
|
53
|
-
"fallback_scope": "
|
|
54
|
-
"full_on_unknown":
|
|
55
|
-
"no_change_scope": "
|
|
53
|
+
"fallback_scope": "changed",
|
|
54
|
+
"full_on_unknown": False,
|
|
55
|
+
"no_change_scope": "changed",
|
|
56
56
|
"rules": [],
|
|
57
57
|
},
|
|
58
58
|
"structure": {"enabled": False, "enforcement": "advisory"},
|
|
@@ -243,32 +243,63 @@ class AutoCodingProfileTests(unittest.TestCase):
|
|
|
243
243
|
self.assertEqual("standard", plan["profile"])
|
|
244
244
|
self.assertEqual("changed", plan["selected_scope"])
|
|
245
245
|
self.assertEqual("dev", plan["effective_mode"])
|
|
246
|
-
self.assertEqual([
|
|
246
|
+
self.assertEqual([], plan["recommended_agents"])
|
|
247
247
|
agent_plan = plan["agent_plan"]
|
|
248
|
-
self.assertEqual("
|
|
249
|
-
self.assertEqual(
|
|
250
|
-
["decomposition", "discovery", "design", "delivery", "closure"],
|
|
251
|
-
[stage["id"] for stage in agent_plan["stages"]],
|
|
252
|
-
)
|
|
248
|
+
self.assertEqual("main-only", agent_plan["strategy"])
|
|
249
|
+
self.assertEqual(["delivery"], [stage["id"] for stage in agent_plan["stages"]])
|
|
253
250
|
self.assertTrue(agent_plan["policies"]["one_writer_per_worktree"])
|
|
254
|
-
self.assertEqual("explicit-
|
|
251
|
+
self.assertEqual("explicit-only-for-isolated-or-delegated-work", agent_plan["policies"]["path_ownership"])
|
|
255
252
|
self.assertEqual(
|
|
256
253
|
"integrate-before-dependent-start",
|
|
257
254
|
agent_plan["policies"]["dependency_policy"],
|
|
258
255
|
)
|
|
259
|
-
self.assertEqual("
|
|
260
|
-
self.assertEqual("diff-fingerprint", agent_plan["policies"]["review_binding"])
|
|
256
|
+
self.assertEqual("main", agent_plan["policies"]["review_feedback_owner"])
|
|
257
|
+
self.assertEqual("diff-fingerprint-when-required", agent_plan["policies"]["review_binding"])
|
|
261
258
|
self.assertEqual("main", agent_plan["policies"]["lifecycle_owner"])
|
|
262
259
|
self.assertIn("owned_paths", agent_plan["assignment_contract"]["writer"])
|
|
263
260
|
self.assertIn("diff_fingerprint", agent_plan["assignment_contract"]["reviewer"])
|
|
264
261
|
self.assertIn("diff_fingerprint", agent_plan["result_contract"])
|
|
265
262
|
delivery = next(stage for stage in agent_plan["stages"] if stage["id"] == "delivery")
|
|
266
|
-
self.assertEqual("
|
|
267
|
-
self.
|
|
268
|
-
|
|
269
|
-
|
|
263
|
+
self.assertEqual("serial", delivery["mode"])
|
|
264
|
+
self.assertFalse(plan["review_required"])
|
|
265
|
+
|
|
266
|
+
def test_execution_mode_is_none_direct_isolated_or_parallel(self) -> None:
|
|
267
|
+
repo, cfg = self.make_repo()
|
|
268
|
+
self.assertEqual("none", self.plan(repo, cfg)["execution_mode"])
|
|
269
|
+
direct = self.plan(repo, cfg, planned_paths=["src/widget.py"])
|
|
270
|
+
self.assertEqual("direct", direct["execution_mode"])
|
|
271
|
+
dirty = repo / "existing.txt"
|
|
272
|
+
dirty.write_text("user change\n", encoding="utf-8")
|
|
273
|
+
isolated = self.plan(repo, cfg, planned_paths=["src/widget.py"])
|
|
274
|
+
self.assertEqual("isolated", isolated["execution_mode"])
|
|
275
|
+
dirty.unlink()
|
|
276
|
+
parallel = self.plan(
|
|
277
|
+
repo,
|
|
278
|
+
cfg,
|
|
279
|
+
planned_paths=["src/widget.py"],
|
|
280
|
+
parallel_writers=2,
|
|
270
281
|
)
|
|
271
|
-
self.
|
|
282
|
+
self.assertEqual("isolated", parallel["execution_mode"])
|
|
283
|
+
self.assertTrue(parallel["review_required"])
|
|
284
|
+
self.assertIn("fixer", parallel["recommended_agents"])
|
|
285
|
+
|
|
286
|
+
def test_validation_routes_collect_all_commands_and_reject_unmapped_code(self) -> None:
|
|
287
|
+
repo, cfg = self.make_repo()
|
|
288
|
+
cfg["commands"] = {"one": "true", "two": "true"}
|
|
289
|
+
cfg["validation"] = {
|
|
290
|
+
"on_unmapped": "error",
|
|
291
|
+
"routes": [
|
|
292
|
+
{"name": "all-src", "paths": ["src/**"], "commands": ["one", "two"]},
|
|
293
|
+
{"name": "python", "paths": ["**/*.py"], "commands": ["two"]},
|
|
294
|
+
],
|
|
295
|
+
}
|
|
296
|
+
plan = ap._validation_plan(cfg, ["src/widget.py"])
|
|
297
|
+
self.assertEqual(["one", "two"], plan["commands"])
|
|
298
|
+
self.assertEqual(["all-src", "python"], plan["matched_routes"])
|
|
299
|
+
ap._validate_validation_plan(cfg, plan)
|
|
300
|
+
with self.assertRaises(APError) as context:
|
|
301
|
+
ap._validate_validation_plan(cfg, ap._validation_plan(cfg, ["contracts/api.yaml"]))
|
|
302
|
+
self.assertIn("no validation route", str(context.exception))
|
|
272
303
|
|
|
273
304
|
def test_test_only_change_resolves_micro(self) -> None:
|
|
274
305
|
repo, cfg = self.make_repo("tests/widget_test.py")
|
|
@@ -292,7 +323,8 @@ class AutoCodingProfileTests(unittest.TestCase):
|
|
|
292
323
|
self.assertEqual("high-risk", plan["profile"])
|
|
293
324
|
self.assertEqual("changed", plan["selected_scope"])
|
|
294
325
|
self.assertEqual("dev", plan["effective_mode"])
|
|
295
|
-
self.
|
|
326
|
+
self.assertFalse(plan["needs_dd"])
|
|
327
|
+
self.assertTrue(plan["review_required"])
|
|
296
328
|
self.assertIn("reviewer", plan["recommended_agents"])
|
|
297
329
|
self.assertFalse(plan["needs_jenkins"])
|
|
298
330
|
self.assertFalse(plan["needs_target"])
|
|
@@ -303,7 +335,7 @@ class AutoCodingProfileTests(unittest.TestCase):
|
|
|
303
335
|
discovery = next(stage for stage in plan["agent_plan"]["stages"] if stage["id"] == "discovery")
|
|
304
336
|
self.assertEqual("parallel", discovery["mode"])
|
|
305
337
|
self.assertEqual(
|
|
306
|
-
["
|
|
338
|
+
["docs_researcher", "browser_debugger"],
|
|
307
339
|
discovery["roles"],
|
|
308
340
|
)
|
|
309
341
|
flattened = [
|
|
@@ -511,8 +543,9 @@ class AutoCodingProfileTests(unittest.TestCase):
|
|
|
511
543
|
|
|
512
544
|
migrated, body = ap._read_frontmatter_markdown(engineering)
|
|
513
545
|
self.assertNotIn("full_on", migrated["gate"])
|
|
514
|
-
self.
|
|
515
|
-
self.
|
|
546
|
+
self.assertEqual([], migrated["gate"]["rules"])
|
|
547
|
+
self.assertEqual("high-risk", migrated["risk"]["rules"][0]["profile"])
|
|
548
|
+
self.assertEqual(["gate_full"], migrated["validation"]["routes"][-1]["commands"])
|
|
516
549
|
self.assertEqual("true", migrated["commands"]["gate_full"])
|
|
517
550
|
self.assertNotIn("must run the full gate", body)
|
|
518
551
|
|
|
@@ -568,7 +601,7 @@ class AutoCodingProfileTests(unittest.TestCase):
|
|
|
568
601
|
repo, _ = self.make_repo(config=cfg)
|
|
569
602
|
with self.assertRaises(APError) as context:
|
|
570
603
|
ap.cmd_doctor(argparse.Namespace(repo=str(repo)))
|
|
571
|
-
self.assertIn("
|
|
604
|
+
self.assertIn("validation.routes", str(context.exception))
|
|
572
605
|
|
|
573
606
|
def test_doctor_requires_direct_access_password_even_with_env_reference(self) -> None:
|
|
574
607
|
cfg = base_config()
|
package/cli/tests/index.test.js
CHANGED
|
@@ -136,8 +136,9 @@ 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
|
|
140
|
-
|
|
139
|
+
const withAccess = text.replace(/^access:\r?\n[\s\S]*?(?=^concurrency:)/m, `${block}\n\n`);
|
|
140
|
+
const updated = withAccess.replace(' project_fast: ""', ' project_fast: "true"');
|
|
141
|
+
assert(updated !== text || text.includes(password), "required project values should be replaceable");
|
|
141
142
|
fs.writeFileSync(engineering, updated);
|
|
142
143
|
}
|
|
143
144
|
|
|
@@ -197,10 +198,10 @@ function testMinimalSyncConvergesWithinBudget() {
|
|
|
197
198
|
assert(before.status !== 0, "status should fail before core scaffold exists");
|
|
198
199
|
run("node", [cli, "sync", "--projects", repo]);
|
|
199
200
|
|
|
200
|
-
for (const rel of ["docs/ENGINEERING.md", "docs/
|
|
201
|
+
for (const rel of ["docs/ENGINEERING.md", "docs/tools/autopipeline/ap.py"]) {
|
|
201
202
|
assert(exists(path.join(repo, rel)), `missing core scaffold file: ${rel}`);
|
|
202
203
|
}
|
|
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"]) {
|
|
204
|
+
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
205
|
assert(!exists(path.join(repo, rel)), `optional/duplicate file should not be installed: ${rel}`);
|
|
205
206
|
}
|
|
206
207
|
|
|
@@ -212,10 +213,10 @@ function testMinimalSyncConvergesWithinBudget() {
|
|
|
212
213
|
assert(engineering.includes("profile: \"auto\""), "engineering should enable adaptive profiles");
|
|
213
214
|
assert(engineering.includes("isolation: \"adaptive\""), "engineering should default to adaptive clean-branch/worktree isolation");
|
|
214
215
|
assert(engineering.includes('completion: "push"'), "engineering should complete normal development at push");
|
|
215
|
-
assert(engineering.includes('
|
|
216
|
+
assert(engineering.includes('project_fast: ""'), "generic projects should require an explicit project-fast command");
|
|
216
217
|
assert(engineering.includes(`name: "${path.basename(repo)}"`), "project name should be initialized automatically");
|
|
217
|
-
assert(engineering.includes("##
|
|
218
|
-
assert(engineering.includes("
|
|
218
|
+
assert(engineering.includes("## Design, review, and subagents"), "engineering should install adaptive orchestration guidance");
|
|
219
|
+
assert(engineering.includes("concurrent writers always use separate worktrees"), "engineering should enforce one writer per worktree");
|
|
219
220
|
const fixer = fs.readFileSync(path.join(repo, ".agents", "agents", "fixer.toml"), "utf8");
|
|
220
221
|
const reviewer = fs.readFileSync(path.join(repo, ".agents", "agents", "reviewer.toml"), "utf8");
|
|
221
222
|
const browserDebugger = fs.readFileSync(path.join(repo, ".agents", "agents", "browser-debugger.toml"), "utf8");
|
|
@@ -277,8 +278,8 @@ function testStatusRejectsLegacyGateEscalation() {
|
|
|
277
278
|
run("node", [cli, "sync", "--projects", repo]);
|
|
278
279
|
const engineeringPath = path.join(repo, "docs", "ENGINEERING.md");
|
|
279
280
|
const engineering = fs.readFileSync(engineeringPath, "utf8").replace(
|
|
280
|
-
|
|
281
|
-
' full_on_unknown: "true"\n full_on: ["prod_config"]\n
|
|
281
|
+
"validation:\n",
|
|
282
|
+
'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
283
|
);
|
|
283
284
|
fs.writeFileSync(engineeringPath, engineering);
|
|
284
285
|
const status = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
|
|
@@ -295,7 +296,7 @@ function testOrdinaryNodeTestIsNotPromotedToAutomaticGate() {
|
|
|
295
296
|
run("node", [cli, "init"], { cwd: repo });
|
|
296
297
|
run("node", [cli, "sync", "--projects", repo]);
|
|
297
298
|
const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
|
|
298
|
-
assert(engineering.includes('
|
|
299
|
+
assert(engineering.includes('project_fast: ""'), "ordinary test must not be promoted to the project-fast command");
|
|
299
300
|
assert(!engineering.includes("gate_standard:"), "ordinary test must not seed an automatic standard gate");
|
|
300
301
|
assert(!engineering.includes("gate_full:"), "ordinary test must not seed an automatic full gate");
|
|
301
302
|
|
|
@@ -310,7 +311,7 @@ function testOrdinaryNodeTestIsNotPromotedToAutomaticGate() {
|
|
|
310
311
|
const doctor = run("python3", [launcher, "--repo", repo, "doctor"], { check: false });
|
|
311
312
|
assert(doctor.status === 0, `high-risk paths must not expand the local gate: ${doctor.stdout}\n${doctor.stderr}`);
|
|
312
313
|
const gate = run("python3", [launcher, "--repo", repo, "light-gate", "--scope", "changed"]);
|
|
313
|
-
assert(
|
|
314
|
+
assert(gate.stdout.includes("[run] project_fast"), "the configured project-fast route should run");
|
|
314
315
|
assert((gate.stdout.match(/\[diff-check\] OK/g) || []).length === 1, "the built-in fast diff gate should run exactly once");
|
|
315
316
|
const expanded = run("python3", [launcher, "--repo", repo, "light-gate", "--scope", "full"], { check: false });
|
|
316
317
|
assert(expanded.status !== 0 && expanded.stderr.includes("invalid choice"), "light-gate must reject standard/full scopes instead of silently downgrading them");
|
|
@@ -470,8 +471,8 @@ function testBridgeIsGeneric() {
|
|
|
470
471
|
run("python3", [assetAp, "--repo", repo, "install", "--bridges"]);
|
|
471
472
|
assert(exists(path.join(repo, "AGENTS.md")), "generic bridge should be created");
|
|
472
473
|
const bridge = fs.readFileSync(path.join(repo, "AGENTS.md"), "utf8");
|
|
473
|
-
assert(bridge.includes("
|
|
474
|
-
assert(bridge.includes("
|
|
474
|
+
assert(bridge.includes("isolated worktree per writer"), "bridge should expose writer isolation");
|
|
475
|
+
assert(bridge.includes("ordered integration"), "bridge should expose dependency ordering");
|
|
475
476
|
for (const filename of [`CO${"DEX.md"}`, `CLA${"UDE.md"}`]) {
|
|
476
477
|
assert(!exists(path.join(repo, filename)), "client-named bridge should not be created");
|
|
477
478
|
}
|
|
@@ -595,7 +596,7 @@ function testUpgradeInitializesNewEngineeringDefaults() {
|
|
|
595
596
|
|
|
596
597
|
const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
|
|
597
598
|
assert(engineering.includes(`name: "${path.basename(repo)}"`), "upgrade should initialize a newly created project name");
|
|
598
|
-
assert(engineering.includes('
|
|
599
|
+
assert(engineering.includes('project_fast: "npm run test:changed"'), "upgrade should infer only a dedicated changed-scope test");
|
|
599
600
|
assert(!engineering.includes("gate_standard:"), "upgrade must not infer an automatic standard gate");
|
|
600
601
|
assert(!engineering.includes("gate_full:"), "upgrade must not infer an automatic full gate");
|
|
601
602
|
}
|
|
@@ -633,14 +634,12 @@ function testUpgradeMigratesLegacyAutomaticGateToFastDefault() {
|
|
|
633
634
|
|
|
634
635
|
run("python3", [assetAp, "--repo", repo, "upgrade", "--write"]);
|
|
635
636
|
const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
|
|
636
|
-
assert(
|
|
637
|
+
assert(/project_fast:\s*(?:''|"")/.test(engineering), "upgrade should not promote an ordinary npm test to the project-fast gate");
|
|
637
638
|
assert(engineering.includes("mode: dev"), "upgrade should migrate verify mode to fast development mode");
|
|
638
639
|
assert(engineering.includes("completion: push"), "upgrade should add push completion");
|
|
639
640
|
assert(engineering.includes("isolation: adaptive"), "upgrade should migrate legacy isolation to adaptive");
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
}
|
|
643
|
-
assert(engineering.includes("full_on_unknown: false"), "upgrade should disable automatic full escalation");
|
|
641
|
+
assert(engineering.includes("on_unmapped: error"), "upgrade should fail closed when changed code has no validation route");
|
|
642
|
+
assert(engineering.includes("rules: []"), "upgrade should remove legacy automatic gate escalation rules");
|
|
644
643
|
}
|
|
645
644
|
|
|
646
645
|
function testRemovedVerificationFlagsFailFast() {
|
|
@@ -719,7 +718,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
|
|
|
719
718
|
|
|
720
719
|
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
721
720
|
const initial = fs.readFileSync(engineering, "utf8");
|
|
722
|
-
const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=
|
|
721
|
+
const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.0\.0 -->/;
|
|
723
722
|
const endMarker = "<!-- auto-coding-skill:managed-workflow:end -->";
|
|
724
723
|
assert(startPattern.test(initial), "new projects should include a versioned managed workflow marker");
|
|
725
724
|
assert(initial.includes(endMarker), "new projects should include the managed workflow end marker");
|
|
@@ -728,7 +727,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
|
|
|
728
727
|
.replace("workflow:\n", "# project-frontmatter-comment\nworkflow:\n")
|
|
729
728
|
.replace(startPattern, "project note before managed workflow\n<!-- auto-coding-skill:managed-workflow:start version=3.0.0 -->")
|
|
730
729
|
.replace(endMarker, `${endMarker}\nproject note after managed workflow`)
|
|
731
|
-
.replace("##
|
|
730
|
+
.replace("## Delivery levels", "## Stale managed workflow");
|
|
732
731
|
writeFile(engineering, customized);
|
|
733
732
|
const staleStart = customized.indexOf("<!-- auto-coding-skill:managed-workflow:start");
|
|
734
733
|
const staleEnd = customized.indexOf(endMarker) + endMarker.length;
|
|
@@ -738,7 +737,7 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
|
|
|
738
737
|
const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
|
|
739
738
|
const dryResult = JSON.parse(dryRun.stdout).results[0];
|
|
740
739
|
assert(dryResult.managedWorkflow.state === "stale", `dry-run should expose stale workflow state: ${dryRun.stdout}`);
|
|
741
|
-
assert(dryResult.managedWorkflow.version === "
|
|
740
|
+
assert(dryResult.managedWorkflow.version === "4.0.0", "dry-run should expose the target workflow version");
|
|
742
741
|
assert(dryResult.actions.some(item => item.action === "would-update" && item.path === "docs/ENGINEERING.md"), "dry-run should plan the managed body update");
|
|
743
742
|
assert(fs.readFileSync(engineering, "utf8") === customized, "dry-run must not write ENGINEERING.md");
|
|
744
743
|
|
|
@@ -748,14 +747,14 @@ function testManagedEngineeringSyncIsControlledAndIdempotent() {
|
|
|
748
747
|
const updatedEnd = updated.indexOf(endMarker) + endMarker.length;
|
|
749
748
|
assert(updated.slice(0, updatedStart) === outsideBefore, "sync must preserve frontmatter and content before the managed block byte-for-byte");
|
|
750
749
|
assert(updated.slice(updatedEnd) === outsideAfter, "sync must preserve content after the managed block byte-for-byte");
|
|
751
|
-
assert(updated.includes("version=
|
|
752
|
-
assert(updated.includes("##
|
|
750
|
+
assert(updated.includes("version=4.0.0"), "sync should install the current managed workflow version");
|
|
751
|
+
assert(updated.includes("## Delivery levels"), "sync should refresh stale managed workflow content");
|
|
753
752
|
|
|
754
753
|
fillRequiredAccess(repo);
|
|
755
754
|
const status = run("node", [cli, "status", "--projects", repo, "--json"]);
|
|
756
755
|
const statusResult = JSON.parse(status.stdout).results[0];
|
|
757
756
|
assert(statusResult.managedWorkflow.state === "current", `status should expose current managed workflow state: ${status.stdout}`);
|
|
758
|
-
assert(statusResult.managedWorkflow.version === "
|
|
757
|
+
assert(statusResult.managedWorkflow.version === "4.0.0", "status should expose the installed managed workflow version");
|
|
759
758
|
|
|
760
759
|
const beforeSecondSync = fs.readFileSync(engineering, "utf8");
|
|
761
760
|
const second = run("node", [cli, "sync", "--projects", repo, "--json"]);
|
|
@@ -783,7 +782,7 @@ function testLegacyEngineeringMigrationPreservesExistingBody() {
|
|
|
783
782
|
assert(dryResult.actions.find(item => item.path === "docs/ENGINEERING.md")?.detail.includes("preserved-custom"), "custom legacy action should be labeled preserved-custom");
|
|
784
783
|
run("node", [cli, "sync", "--projects", repo]);
|
|
785
784
|
const migrated = fs.readFileSync(engineering, "utf8");
|
|
786
|
-
assert(migrated.includes("version=
|
|
785
|
+
assert(migrated.includes("version=4.0.0"), "legacy migration should insert the current managed workflow");
|
|
787
786
|
assert(migrated.includes(legacyNote), "legacy migration must preserve the complete existing body");
|
|
788
787
|
const migratedStart = migrated.indexOf("<!-- auto-coding-skill:managed-workflow:start");
|
|
789
788
|
const migratedEnd = migrated.indexOf(endMarker) + endMarker.length;
|
|
@@ -813,7 +812,7 @@ function testOfficialLegacyEngineeringBodyIsReplacedWithoutDuplication() {
|
|
|
813
812
|
const migrated = fs.readFileSync(engineering, "utf8");
|
|
814
813
|
assert(migrated.startsWith(customizedFrontmatter), "official legacy migration must preserve YAML frontmatter byte-for-byte");
|
|
815
814
|
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(/^##
|
|
815
|
+
assert((migrated.match(/^## Delivery levels$/gm) || []).length === 1, "official legacy migration must replace rather than duplicate the old workflow body");
|
|
817
816
|
|
|
818
817
|
const stable = fs.readFileSync(engineering, "utf8");
|
|
819
818
|
run("node", [cli, "sync", "--projects", repo]);
|
|
@@ -883,8 +882,8 @@ function testSkillOnlySyncTouchesOnlySkill() {
|
|
|
883
882
|
writeFile(skill, "legacy-task-sentinel\n");
|
|
884
883
|
writeFile(path.join(repo, ".git", "auto-coding-skill", "tasks", "T-LEGACY.json"), JSON.stringify({ schema: 1, task_id: "T-LEGACY" }));
|
|
885
884
|
const blocked = run("node", [cli, "sync", "--projects", repo, "--components", "skill"], { check: false });
|
|
886
|
-
assert(blocked.status !== 0 && blocked.stderr.includes("schema <
|
|
887
|
-
assert(blocked.stderr.includes("3.
|
|
885
|
+
assert(blocked.status !== 0 && blocked.stderr.includes("schema < 3"), "skill-only sync must block registered legacy tasks");
|
|
886
|
+
assert(blocked.stderr.includes("3.x runtime") && blocked.stderr.includes("lifecycle semantics"), "legacy task error should give safe completion guidance");
|
|
888
887
|
assert(fs.readFileSync(skill, "utf8") === "legacy-task-sentinel\n", "blocked skill-only sync must not write the skill");
|
|
889
888
|
}
|
|
890
889
|
|
|
@@ -915,7 +914,7 @@ function testManagedAgentsMigrationPreservesCustomRules() {
|
|
|
915
914
|
run("node", [cli, "sync", "--projects", repo]);
|
|
916
915
|
const agents = path.join(repo, "AGENTS.md");
|
|
917
916
|
const initial = fs.readFileSync(agents, "utf8");
|
|
918
|
-
assert(initial.includes("managed-agents:start version=
|
|
917
|
+
assert(initial.includes("managed-agents:start version=4.0.0"), "new projects should receive the versioned root AGENTS block");
|
|
919
918
|
|
|
920
919
|
const custom = [
|
|
921
920
|
"# Project rules",
|
|
@@ -932,7 +931,7 @@ function testManagedAgentsMigrationPreservesCustomRules() {
|
|
|
932
931
|
|
|
933
932
|
run("node", [cli, "sync", "--projects", repo]);
|
|
934
933
|
const migrated = fs.readFileSync(agents, "utf8");
|
|
935
|
-
assert(migrated.includes("managed-agents:start version=
|
|
934
|
+
assert(migrated.includes("managed-agents:start version=4.0.0"), "AGENTS migration should install the current managed block");
|
|
936
935
|
assert(migrated.includes("Preserve this repository-specific rule exactly."), "AGENTS migration must preserve unrelated custom rules");
|
|
937
936
|
assert(!migrated.includes("must execute `commands.gate_full`"), "known official conflicting rule should be removed");
|
|
938
937
|
const stable = fs.readFileSync(agents);
|
|
@@ -977,6 +976,27 @@ function testEngineeringMarkerBoundaryIsNormalized() {
|
|
|
977
976
|
assert(normalized.includes(`${marker}\n# Project-specific workflow\n`), "sync should normalize a heading glued to the managed end marker");
|
|
978
977
|
}
|
|
979
978
|
|
|
979
|
+
function testReleaseVersionMarkersStayInSync() {
|
|
980
|
+
const expected = "4.0.0";
|
|
981
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(repoRoot, "package.json"), "utf8"));
|
|
982
|
+
const lock = JSON.parse(fs.readFileSync(path.join(repoRoot, "package-lock.json"), "utf8"));
|
|
983
|
+
const policy = JSON.parse(fs.readFileSync(
|
|
984
|
+
path.join(repoRoot, "src", "auto-coding-skill", "data", "policies", "workflow-migrations-v1.json"),
|
|
985
|
+
"utf8",
|
|
986
|
+
));
|
|
987
|
+
assert(pkg.version === expected, "package version must match the 4.0.0 release");
|
|
988
|
+
assert(lock.version === expected && lock.packages[""].version === expected, "package-lock versions must match");
|
|
989
|
+
assert(policy.managed_versions.engineering === expected && policy.managed_versions.agents === expected, "managed workflow versions must match");
|
|
990
|
+
for (const rel of [
|
|
991
|
+
"src/auto-coding-skill/data/templates/ENGINEERING.md",
|
|
992
|
+
"src/auto-coding-skill/data/templates/bridges/AGENTS.md",
|
|
993
|
+
"cli/assets/skill/data/templates/ENGINEERING.md",
|
|
994
|
+
"cli/assets/skill/data/templates/bridges/AGENTS.md",
|
|
995
|
+
]) {
|
|
996
|
+
assert(fs.readFileSync(path.join(repoRoot, rel), "utf8").includes(`version=${expected}`), `${rel}: missing ${expected} marker`);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
980
1000
|
testPreflightAvoidsPartialInstall();
|
|
981
1001
|
testDestVariants();
|
|
982
1002
|
testLauncherFallsBackToGlobalRuntime();
|
|
@@ -1012,5 +1032,6 @@ testLegacyTaskPreflightRejectsWholeBatchAtomically();
|
|
|
1012
1032
|
testManagedAgentsMigrationPreservesCustomRules();
|
|
1013
1033
|
testUnknownWorkflowConflictFailsWholeBatchBeforeWrites();
|
|
1014
1034
|
testEngineeringMarkerBoundaryIsNormalized();
|
|
1035
|
+
testReleaseVersionMarkersStayInSync();
|
|
1015
1036
|
|
|
1016
1037
|
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": "
|
|
4
|
-
"description": "CLI installer for
|
|
3
|
+
"version": "4.0.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"
|