@elvis1513/auto-coding-skill 4.2.0 → 4.2.2

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,84 @@
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+
4
+ import os
5
+ import signal
6
+ import subprocess
7
+ import sys
8
+ import tempfile
9
+ import unittest
10
+ from pathlib import Path
11
+ from unittest import mock
12
+
13
+
14
+ REPO_ROOT = Path(__file__).resolve().parents[2]
15
+ SCRIPT_DIR = REPO_ROOT / "src" / "auto-coding-skill" / "scripts"
16
+ sys.path.insert(0, str(SCRIPT_DIR))
17
+
18
+ import core # noqa: E402
19
+
20
+
21
+ class RunShellTests(unittest.TestCase):
22
+ def test_run_shell_uses_non_login_bash_and_inherits_environment(self) -> None:
23
+ process = mock.Mock()
24
+ process.wait.return_value = 0
25
+ cwd = Path("/tmp/run-shell-test")
26
+ with mock.patch.object(core.subprocess, "Popen", return_value=process) as popen:
27
+ core.run_shell("sentinel", cwd=cwd)
28
+
29
+ popen.assert_called_once_with(
30
+ ["bash", "-c", "sentinel"],
31
+ cwd=str(cwd),
32
+ text=True,
33
+ start_new_session=True,
34
+ )
35
+
36
+ def test_run_shell_preserves_caller_path(self) -> None:
37
+ with tempfile.TemporaryDirectory(prefix="autocoding-shell-") as temp_name:
38
+ root = Path(temp_name)
39
+ bin_dir = root / "bin"
40
+ bin_dir.mkdir()
41
+ sentinel = bin_dir / "path-sentinel"
42
+ sentinel.write_text("#!/bin/sh\nprintf inherited > \"$1\"\n", encoding="utf-8")
43
+ sentinel.chmod(0o755)
44
+ result = root / "result.txt"
45
+ profile_marker = root / "login-profile-ran"
46
+ (root / ".bash_profile").write_text(
47
+ f"export PATH=/usr/bin:/bin\n/usr/bin/touch '{profile_marker}'\n",
48
+ encoding="utf-8",
49
+ )
50
+ inherited_path = f"{bin_dir}{os.pathsep}{os.environ.get('PATH', '')}"
51
+ with mock.patch.dict(
52
+ os.environ,
53
+ {"HOME": str(root), "PATH": inherited_path},
54
+ clear=False,
55
+ ):
56
+ core.run_shell(f"path-sentinel '{result}'", cwd=root, timeout_s=5)
57
+
58
+ self.assertEqual("inherited", result.read_text(encoding="utf-8"))
59
+ self.assertFalse(profile_marker.exists())
60
+
61
+ def test_run_shell_timeout_terminates_then_kills_process_group(self) -> None:
62
+ process = mock.Mock(pid=4321)
63
+ process.wait.side_effect = [
64
+ subprocess.TimeoutExpired(cmd="slow", timeout=1),
65
+ subprocess.TimeoutExpired(cmd="slow", timeout=2),
66
+ 0,
67
+ ]
68
+ with (
69
+ mock.patch.object(core.subprocess, "Popen", return_value=process),
70
+ mock.patch.object(core.os, "killpg") as killpg,
71
+ ):
72
+ with self.assertRaises(core.APError) as context:
73
+ core.run_shell("slow", timeout_s=1)
74
+
75
+ self.assertIn("timed out after 1.0s", str(context.exception))
76
+ self.assertEqual(
77
+ [mock.call(4321, signal.SIGTERM), mock.call(4321, signal.SIGKILL)],
78
+ killpg.call_args_list,
79
+ )
80
+ self.assertEqual(3, process.wait.call_count)
81
+
82
+
83
+ if __name__ == "__main__":
84
+ unittest.main()
@@ -85,6 +85,25 @@ function writeFile(file, text) {
85
85
  fs.writeFileSync(file, text);
86
86
  }
87
87
 
88
+ function readEngineeringConfig(file) {
89
+ const script = [
90
+ "import json, pathlib, sys, yaml",
91
+ "text = pathlib.Path(sys.argv[1]).read_text(encoding='utf-8')",
92
+ "parts = text.split('---', 2)",
93
+ "assert len(parts) == 3 and not parts[0].strip(), 'missing YAML frontmatter'",
94
+ "print(json.dumps(yaml.safe_load(parts[1]) or {}, sort_keys=True))",
95
+ ].join("; ");
96
+ return JSON.parse(run("python3", ["-c", script, file]).stdout);
97
+ }
98
+
99
+ function canonicalJson(value) {
100
+ if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
101
+ if (value && typeof value === "object") {
102
+ return `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(",")}}`;
103
+ }
104
+ return JSON.stringify(value);
105
+ }
106
+
88
107
  function readTomlString(text, key, file) {
89
108
  const match = text.match(new RegExp(`^${key}\\s*=\\s*"([^"]+)"\\s*$`, "m"));
90
109
  assert(match, `${file}: missing ${key}`);
@@ -182,14 +201,92 @@ function testInitFullyConvergesExistingProject() {
182
201
  run("node", [cli, "init"], { cwd: repo });
183
202
  fillRequiredAccess(repo, "preserved-project-secret");
184
203
  const engineering = path.join(repo, "docs", "ENGINEERING.md");
204
+ const structureStandard = path.join(repo, "docs", "architecture", "structure-standard.md");
205
+ assert(
206
+ fs.readFileSync(structureStandard, "utf8").startsWith("# Project Structure Standard"),
207
+ "first init must scaffold the project structure standard",
208
+ );
209
+ const customStructureStandard = "# XJMate Structure Standard\n\nProject-owned architecture policy.\n";
210
+ const expectedRiskRules = [
211
+ {
212
+ name: "frontend-manifest-and-extension-policy",
213
+ paths: ["package.json", "frontend/package.json", "frontend/extensions/**"],
214
+ profile: "high-risk",
215
+ review: "required",
216
+ design: "required",
217
+ },
218
+ ];
219
+ const expectedStructure = {
220
+ enabled: false,
221
+ enforcement: "blocking",
222
+ architecture_standard: "xjmate-clean-architecture",
223
+ exclude: ["docs/**"],
224
+ allow_large_files: ["generated/**"],
225
+ reusable_tool_dirs: ["tools/**"],
226
+ max_file_lines_warn: 701,
227
+ max_file_lines_block: 1401,
228
+ max_function_lines_warn: 101,
229
+ max_added_lines_to_large_file: 41,
230
+ require_reuse_search: false,
231
+ block_new_responsibility_in_large_file: false,
232
+ accepted_debt_paths: ["legacy/accepted/**"],
233
+ layer_rules: {
234
+ enabled: false,
235
+ block: true,
236
+ rules: [
237
+ {
238
+ name: "project-domain",
239
+ paths: ["src/domain/**"],
240
+ forbidden_imports: ["src/infrastructure/**"],
241
+ },
242
+ ],
243
+ },
244
+ };
245
+ const customRiskYaml = [
246
+ "risk:",
247
+ " rules:",
248
+ " - name: frontend-manifest-and-extension-policy",
249
+ " paths:",
250
+ " - package.json",
251
+ " - frontend/package.json",
252
+ " - frontend/extensions/**",
253
+ " profile: high-risk",
254
+ " review: required",
255
+ " design: required",
256
+ ].join("\n");
257
+ const customStructureYaml = [
258
+ "structure:",
259
+ " enabled: false",
260
+ " enforcement: blocking",
261
+ " architecture_standard: xjmate-clean-architecture",
262
+ " exclude: [docs/**]",
263
+ " allow_large_files: [generated/**]",
264
+ " reusable_tool_dirs: [tools/**]",
265
+ " max_file_lines_warn: 701",
266
+ " max_file_lines_block: 1401",
267
+ " max_function_lines_warn: 101",
268
+ " max_added_lines_to_large_file: 41",
269
+ " require_reuse_search: false",
270
+ " block_new_responsibility_in_large_file: false",
271
+ " accepted_debt_paths: [legacy/accepted/**]",
272
+ " layer_rules:",
273
+ " enabled: false",
274
+ " block: true",
275
+ " rules:",
276
+ " - name: project-domain",
277
+ " paths: [src/domain/**]",
278
+ " forbidden_imports: [src/infrastructure/**]",
279
+ ].join("\n");
185
280
  writeFile(engineering, fs.readFileSync(engineering, "utf8")
186
281
  .replace("concurrency:\n", "legacy_extra:\n forbidden: true\n\nconcurrency:\n")
282
+ .replace(/^risk:\r?\n[\s\S]*?(?=^structure:)/m, `${customRiskYaml}\n`)
283
+ .replace(/^structure:\r?\n[\s\S]*?(?=^optimization:)/m, `${customStructureYaml}\n`)
187
284
  .replace("# Project Facts", "# Obsolete workflow rules\n\nRun a full build every time.\n\n# Project Facts"));
188
285
  writeFile(path.join(repo, "docs", "legacy", "old-taskbook.md"), "historical\n");
189
286
  writeFile(path.join(repo, "docs", "architecture", "system-context.md"), "# System context\n\nKeep me.\n");
190
287
  writeFile(path.join(repo, "docs", "architecture", "adr", "0042-project-choice.md"), "# ADR-0042\n\nKeep me.\n");
191
288
  writeFile(path.join(repo, "docs", "interfaces", "event-contracts.md"), "# Events\n\nKeep me.\n");
192
- writeFile(path.join(repo, "docs", "architecture", "structure-standard.md"), "# stale managed template\n");
289
+ writeFile(structureStandard, customStructureStandard);
193
290
  writeFile(path.join(repo, ".agents", "agents", "custom.toml"), 'name = "custom"\n');
194
291
  writeFile(path.join(repo, ".agents", "skills", "auto-coding-skill", "obsolete.txt"), "obsolete\n");
195
292
 
@@ -205,17 +302,27 @@ function testInitFullyConvergesExistingProject() {
205
302
  ].sort();
206
303
  assert(JSON.stringify(installedDocs) === JSON.stringify(expectedInstalledDocs), `docs framework must converge while preserving valid artifacts: ${installedDocs.join(", ")}`);
207
304
  const converged = fs.readFileSync(engineering, "utf8");
305
+ const convergedConfig = readEngineeringConfig(engineering);
208
306
  assert(converged.includes("preserved-project-secret"), "supported access values must survive init");
209
307
  assert(!converged.includes("legacy_extra") && !converged.includes("Run a full build every time"), "unknown fields and legacy workflow text must be removed");
308
+ assert(canonicalJson(convergedConfig.risk?.rules) === canonicalJson(expectedRiskRules), "project risk.rules must survive init path-for-path");
309
+ for (const [key, expected] of Object.entries(expectedStructure)) {
310
+ assert(
311
+ canonicalJson(convergedConfig.structure?.[key]) === canonicalJson(expected),
312
+ `supported structure.${key} must survive init`,
313
+ );
314
+ }
210
315
  assert(exists(path.join(repo, ".agents", "agents", "custom.toml")), "project-owned custom agents must survive init");
211
316
  assert(!exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "obsolete.txt")), "extra Skill files must be removed");
212
- assert(exists(path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.0", "docs", "legacy", "old-taskbook.md")), "removed docs must be archived outside active docs");
213
- assert(fs.readFileSync(path.join(repo, "docs", "architecture", "structure-standard.md"), "utf8").startsWith("# Project Structure Standard"), "managed templates must be replaced");
317
+ assert(exists(path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.2", "docs", "legacy", "old-taskbook.md")), "removed docs must be archived outside active docs");
318
+ assert(fs.readFileSync(structureStandard, "utf8") === customStructureStandard, "init must preserve a project-owned structure standard");
214
319
  assert(fs.readFileSync(path.join(repo, "docs", "architecture", "adr", "0042-project-choice.md"), "utf8").includes("Keep me"), "numbered ADR artifacts must survive init");
215
320
  assert(fs.readFileSync(path.join(repo, "docs", "architecture", "system-context.md"), "utf8").includes("Keep me"), "architecture artifacts must survive init");
216
321
  assert(fs.readFileSync(path.join(repo, "docs", "interfaces", "event-contracts.md"), "utf8").includes("Keep me"), "interface artifacts must survive init");
217
322
 
218
323
  run("node", [cli, "init"], { cwd: repo });
324
+ assert(fs.readFileSync(engineering, "utf8") === converged, "repeated init must be byte-idempotent for ENGINEERING.md");
325
+ assert(fs.readFileSync(structureStandard, "utf8") === customStructureStandard, "repeated init must preserve the project structure standard byte-for-byte");
219
326
  const secondDocs = listProjectFiles(path.join(repo, "docs"))
220
327
  .map(file => path.relative(repo, file).split(path.sep).join("/"))
221
328
  .sort();
@@ -286,9 +393,10 @@ function testMinimalInitConvergesWithinBudget() {
286
393
  const files = listProjectFiles(repo);
287
394
  const lines = files.reduce((total, file) => total + fs.readFileSync(file, "utf8").split(/\r?\n/).length, 0);
288
395
  assert(files.length <= 40, `minimal scaffold file budget exceeded: ${files.length}`);
289
- // Integrity, staging, and gate-receipt logic are executable support code, not
290
- // prompt context. Keep a measured ceiling while leaving deterministic checks readable.
291
- assert(lines <= 12700, `minimal scaffold line budget exceeded: ${lines}`);
396
+ // Integrity, staging, fail-closed classification, and contract helpers are
397
+ // executable support code, not prompt context. Keep a measured ceiling while
398
+ // leaving deterministic checks readable.
399
+ assert(lines <= 14300, `minimal scaffold line budget exceeded: ${lines}`);
292
400
  const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
293
401
  assert(engineering.includes("profile: auto"), "engineering should enable adaptive profiles");
294
402
  assert(engineering.includes("isolation: adaptive"), "engineering should default to adaptive clean-branch/worktree isolation");
@@ -307,6 +415,11 @@ function testMinimalInitConvergesWithinBudget() {
307
415
  assert(fixer.includes("owned_paths"), "fixer should receive explicit path ownership");
308
416
  assert(fixer.includes("不提交、不推送、不集成"), "fixer should leave Git lifecycle to the main agent");
309
417
  assert(reviewer.includes("diff_fingerprint"), "reviewer verdict should bind to a stable diff");
418
+ assert(reviewer.includes("agent-result-template"), "reviewer should use the complete result skeleton");
419
+ assert(reviewer.includes("AUTOCODING_REVIEW_ASSIGNMENT"), "reviewer should receive the supervised assignment path");
420
+ assert(reviewer.includes("90 秒"), "reviewer should enforce the focused review budget");
421
+ assert(agentsProtocol.includes("ap.py review-run"), "AGENTS should use the supervised Reviewer runtime");
422
+ assert(agentsProtocol.includes("cannot stop an in-app subagent"), "AGENTS should state the supervision boundary honestly");
310
423
  assert(browserDebugger.includes('sandbox_mode = "read-only"'), "browser discovery should be read-only");
311
424
 
312
425
  const incomplete = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
@@ -822,7 +935,7 @@ function testManagedEngineeringInitIsAuthoritativeAndIdempotent() {
822
935
 
823
936
  const engineering = path.join(repo, "docs", "ENGINEERING.md");
824
937
  const initial = fs.readFileSync(engineering, "utf8");
825
- const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.2\.0 -->/;
938
+ const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.2\.2 -->/;
826
939
  const endMarker = "<!-- auto-coding-skill:managed-workflow:end -->";
827
940
  assert(startPattern.test(initial), "new projects should include a versioned managed workflow marker");
828
941
  assert(initial.includes(endMarker), "new projects should include the managed workflow end marker");
@@ -836,21 +949,21 @@ function testManagedEngineeringInitIsAuthoritativeAndIdempotent() {
836
949
  const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
837
950
  const dryResult = JSON.parse(dryRun.stdout).results[0];
838
951
  assert(dryResult.managedWorkflow.state === "stale", `dry-run should expose stale workflow state: ${dryRun.stdout}`);
839
- assert(dryResult.managedWorkflow.version === "4.2.0", "dry-run should expose the target workflow version");
952
+ assert(dryResult.managedWorkflow.version === "4.2.2", "dry-run should expose the target workflow version");
840
953
  assert(dryResult.actions.some(item => item.action === "would-update" && item.path === "docs/ENGINEERING.md"), "dry-run should plan the managed body update");
841
954
  assert(fs.readFileSync(engineering, "utf8") === customized, "dry-run must not write ENGINEERING.md");
842
955
 
843
956
  run("node", [cli, "init"], { cwd: repo });
844
957
  const updated = fs.readFileSync(engineering, "utf8");
845
958
  assert(!updated.includes("project note before") && !updated.includes("project note after"), "init must remove text outside the canonical ENGINEERING body");
846
- assert(updated.includes("version=4.2.0"), "init should install the current managed workflow version");
959
+ assert(updated.includes("version=4.2.2"), "init should install the current managed workflow version");
847
960
  assert(updated.includes("The frontmatter contract is:"), "init should refresh stale managed workflow content");
848
961
 
849
962
  fillRequiredAccess(repo);
850
963
  const status = run("node", [cli, "status", "--projects", repo, "--json"]);
851
964
  const statusResult = JSON.parse(status.stdout).results[0];
852
965
  assert(statusResult.managedWorkflow.state === "current", `status should expose current managed workflow state: ${status.stdout}`);
853
- assert(statusResult.managedWorkflow.version === "4.2.0", "status should expose the installed managed workflow version");
966
+ assert(statusResult.managedWorkflow.version === "4.2.2", "status should expose the installed managed workflow version");
854
967
 
855
968
  const beforeSecondInit = fs.readFileSync(engineering, "utf8");
856
969
  run("node", [cli, "init"], { cwd: repo });
@@ -877,7 +990,7 @@ function testLegacyEngineeringMigrationPreservesExistingBody() {
877
990
  assert(dryResult.actions.find(item => item.path === "docs/ENGINEERING.md")?.detail.includes("preserved-custom"), "custom legacy action should be labeled preserved-custom");
878
991
  run("node", [cli, "sync", "--projects", repo]);
879
992
  const migrated = fs.readFileSync(engineering, "utf8");
880
- assert(migrated.includes("version=4.2.0"), "legacy migration should insert the current managed workflow");
993
+ assert(migrated.includes("version=4.2.2"), "legacy migration should insert the current managed workflow");
881
994
  assert(migrated.includes(legacyNote), "legacy migration must preserve the complete existing body");
882
995
  const stable = fs.readFileSync(engineering, "utf8");
883
996
  run("node", [cli, "sync", "--projects", repo]);
@@ -977,7 +1090,7 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
977
1090
  run("node", [cli, "sync", "--projects", repo]);
978
1091
  const agents = path.join(repo, "AGENTS.md");
979
1092
  const initial = fs.readFileSync(agents, "utf8");
980
- assert(initial.includes("managed-agents:start version=4.2.0"), "new projects should receive the versioned root AGENTS block");
1093
+ assert(initial.includes("managed-agents:start version=4.2.2"), "new projects should receive the versioned root AGENTS block");
981
1094
 
982
1095
  const custom = [
983
1096
  "# Project rules",
@@ -996,12 +1109,12 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
996
1109
 
997
1110
  run("node", [cli, "sync", "--projects", repo]);
998
1111
  const migrated = fs.readFileSync(agents, "utf8");
999
- assert(migrated.includes("managed-agents:start version=4.2.0"), "AGENTS migration should install the current managed block");
1112
+ assert(migrated.includes("managed-agents:start version=4.2.2"), "AGENTS migration should install the current managed block");
1000
1113
  assert(!migrated.includes("Preserve this repository-specific rule exactly."), "root AGENTS must contain no project-specific tail");
1001
1114
  assert(!migrated.includes("must execute `commands.gate_full`"), "known official conflicting rule should be removed");
1002
1115
  const canonical = fs.readFileSync(path.join(repoRoot, "cli", "assets", "skill", "data", "templates", "bridges", "AGENTS.md"), "utf8");
1003
1116
  assert(migrated === canonical, "root AGENTS must be byte-identical to the packaged canonical file");
1004
- const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.2.0.md");
1117
+ const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.2.2.md");
1005
1118
  assert(fs.readFileSync(archive, "utf8").includes("Preserve this repository-specific rule exactly."), "previous AGENTS content must be archived once");
1006
1119
  const stable = fs.readFileSync(agents);
1007
1120
  run("node", [cli, "sync", "--projects", repo]);
@@ -1058,7 +1171,7 @@ function testEngineeringFrameworkRejectsAnyNonCanonicalWorkflowText() {
1058
1171
 
1059
1172
  run("node", [cli, "init"], { cwd: repo });
1060
1173
  assert(!fs.readFileSync(engineering, "utf8").includes("backend owns APIs"), "init must restore the canonical ENGINEERING body");
1061
- const archived = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.0", "docs", "ENGINEERING.md");
1174
+ const archived = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.2", "docs", "ENGINEERING.md");
1062
1175
  assert(fs.readFileSync(archived, "utf8").includes("backend owns APIs"), "removed project text should remain in non-authoritative history");
1063
1176
  }
1064
1177
 
@@ -1070,12 +1183,12 @@ function testManagedInstallIntegrityIsBoundedAndRepairable() {
1070
1183
 
1071
1184
  const manifestPath = path.join(repo, ".agents", "managed-install.json");
1072
1185
  const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
1073
- assert(manifest.schema_version === 1 && manifest.skill_version === "4.2.0", "installed manifest must identify the release");
1186
+ assert(manifest.schema_version === 1 && manifest.skill_version === "4.2.2", "installed manifest must identify the release");
1074
1187
  assert(manifest.entries.length > 0, "installed manifest must list managed files");
1075
1188
  for (const entry of manifest.entries) {
1076
1189
  assert(typeof entry.path === "string" && !path.isAbsolute(entry.path) && !entry.path.includes(".."), "manifest paths must be safe relative paths");
1077
1190
  assert(/^[0-9a-f]{64}$/.test(entry.sha256), `${entry.path}: manifest hash must be sha256`);
1078
- assert(entry.version === "4.2.0" && typeof entry.executable === "boolean", `${entry.path}: version/executable metadata missing`);
1191
+ assert(entry.version === "4.2.2" && typeof entry.executable === "boolean", `${entry.path}: version/executable metadata missing`);
1079
1192
  }
1080
1193
  assert(!manifest.managed_namespaces.some(item => item.path === ".agents" || item.path === "docs"), "manifest must not mirror entire project-owned trees");
1081
1194
 
@@ -1145,19 +1258,21 @@ function testManagedInstallIntegrityIsBoundedAndRepairable() {
1145
1258
  }
1146
1259
 
1147
1260
  function testReleaseVersionMarkersStayInSync() {
1148
- const expected = "4.2.0";
1261
+ const expected = "4.2.2";
1149
1262
  const pkg = JSON.parse(fs.readFileSync(path.join(repoRoot, "package.json"), "utf8"));
1150
1263
  const lock = JSON.parse(fs.readFileSync(path.join(repoRoot, "package-lock.json"), "utf8"));
1151
1264
  const policy = JSON.parse(fs.readFileSync(
1152
1265
  path.join(repoRoot, "src", "auto-coding-skill", "data", "policies", "workflow-migrations-v1.json"),
1153
1266
  "utf8",
1154
1267
  ));
1155
- assert(pkg.version === expected, "package version must match the 4.2.0 release");
1268
+ assert(pkg.version === expected, "package version must match the 4.2.2 release");
1156
1269
  assert(lock.version === expected && lock.packages[""].version === expected, "package-lock versions must match");
1157
1270
  assert(policy.managed_versions.engineering === expected && policy.managed_versions.agents === expected, "managed workflow versions must match");
1158
1271
  const manifest = JSON.parse(fs.readFileSync(path.join(repoRoot, "cli", "assets", "managed-install.json"), "utf8"));
1159
1272
  assert(manifest.skill_version === expected && manifest.schema_version === 1, "managed install manifest version/schema must match");
1160
1273
  assert(manifest.entries.every(entry => entry.version === expected && /^[0-9a-f]{64}$/.test(entry.sha256)), "managed install entries must carry release hashes and versions");
1274
+ assert(!manifest.entries.some(entry => entry.path === "docs/architecture/structure-standard.md"), "project structure standard must not be exact-managed");
1275
+ assert(manifest.preserved.includes("docs/architecture/structure-standard.md"), "manifest must declare the project structure standard preserved");
1161
1276
  const publishWorkflow = fs.readFileSync(path.join(repoRoot, ".github", "workflows", "npm-publish.yml"), "utf8");
1162
1277
  const runtimeRequirements = fs.readFileSync(path.join(repoRoot, "src", "auto-coding-skill", "requirements.txt"), "utf8");
1163
1278
  assert(publishWorkflow.includes("tags:\n - \"v*\""), "npm publish must run from version tag pushes");
@@ -1182,7 +1297,7 @@ function testProtocolResponsibilitiesStaySeparated() {
1182
1297
  const agents = fs.readFileSync(path.join(repoRoot, "src", "auto-coding-skill", "data", "templates", "bridges", "AGENTS.md"), "utf8");
1183
1298
  const engineering = fs.readFileSync(path.join(repoRoot, "src", "auto-coding-skill", "data", "templates", "ENGINEERING.md"), "utf8");
1184
1299
  const totalLines = [skill, agents, engineering].reduce((sum, text) => sum + text.split(/\r?\n/).length, 0);
1185
- assert(totalLines <= 350, `shared protocol context budget exceeded: ${totalLines} lines`);
1300
+ assert(totalLines <= 360, `shared protocol context budget exceeded: ${totalLines} lines`);
1186
1301
  assert(agents.includes("## Minimum mechanism budget") && agents.includes("## Bounded real validation"), "AGENTS must remain the behavioral protocol");
1187
1302
  assert(skill.includes("## Select the minimum mechanism set") && !skill.includes("## Authority"), "SKILL must remain invocation guidance");
1188
1303
  assert(engineering.includes("The frontmatter contract is:") && !engineering.includes("## Git and parallel work"), "ENGINEERING must remain project configuration/facts");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elvis1513/auto-coding-skill",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
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": {
@@ -19,7 +19,7 @@
19
19
  "clean:cache": "find cli src -type d -name '__pycache__' -prune -exec rm -rf {} +",
20
20
  "prepack": "npm run clean:cache",
21
21
  "check:package": "npm run clean:cache && node cli/src/check-package.js",
22
- "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/install_integrity.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/install_integrity.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 {} +",
22
+ "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/install_integrity.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/install_integrity.py cli/assets/skill/scripts/scaffold_templates.py && python3 cli/tests/core_shell_test.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 {} +",
23
23
  "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/install_integrity.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/install_integrity.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 {} +",
24
24
  "check:assets": "node cli/src/sync-assets.js --check",
25
25
  "sync-assets": "node cli/src/sync-assets.js",