@elvis1513/auto-coding-skill 4.2.2 → 4.2.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.
- package/README.md +23 -4
- package/cli/assets/managed-install.json +1 -1
- package/cli/assets/skill/SKILL.md +4 -5
- package/cli/assets/skill/data/policies/workflow-migrations-v1.json +2 -2
- package/cli/assets/skill/data/templates/ENGINEERING.md +3 -2
- package/cli/assets/skill/data/templates/bridges/AGENTS.md +5 -5
- package/cli/assets/skill/scripts/ap.py +575 -21
- package/cli/tests/ap_profiles_test.py +408 -0
- package/cli/tests/index.test.js +63 -18
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import os
|
|
|
10
10
|
import subprocess
|
|
11
11
|
import sys
|
|
12
12
|
import tempfile
|
|
13
|
+
import time
|
|
13
14
|
import tomllib
|
|
14
15
|
import unittest
|
|
15
16
|
from pathlib import Path
|
|
@@ -1396,6 +1397,413 @@ class AutoCodingProfileTests(unittest.TestCase):
|
|
|
1396
1397
|
with self.assertRaises(APError):
|
|
1397
1398
|
ap.cmd_structure_check(args)
|
|
1398
1399
|
|
|
1400
|
+
def test_structure_block_warnings_matrix(self) -> None:
|
|
1401
|
+
cases = [
|
|
1402
|
+
("blocking", True, True),
|
|
1403
|
+
("blocking", False, False),
|
|
1404
|
+
("advisory", True, False),
|
|
1405
|
+
]
|
|
1406
|
+
for enforcement, configured_block_warnings, should_block in cases:
|
|
1407
|
+
with self.subTest(
|
|
1408
|
+
enforcement=enforcement,
|
|
1409
|
+
block_warnings=configured_block_warnings,
|
|
1410
|
+
):
|
|
1411
|
+
cfg = base_config()
|
|
1412
|
+
cfg["structure"] = {
|
|
1413
|
+
"enabled": True,
|
|
1414
|
+
"enforcement": enforcement,
|
|
1415
|
+
"block_warnings": configured_block_warnings,
|
|
1416
|
+
"max_file_lines_warn": 4,
|
|
1417
|
+
"max_file_lines_block": 50,
|
|
1418
|
+
"max_function_lines_warn": 4,
|
|
1419
|
+
"max_added_lines_to_large_file": 50,
|
|
1420
|
+
"layer_rules": {"enabled": False},
|
|
1421
|
+
}
|
|
1422
|
+
cfg["optimization"] = {"require_baseline_for_global_review": False}
|
|
1423
|
+
repo, _ = self.make_repo("src/large.py", cfg)
|
|
1424
|
+
(repo / "src" / "large.py").write_text(
|
|
1425
|
+
"def oversized():\n"
|
|
1426
|
+
" value = 1\n"
|
|
1427
|
+
" value += 1\n"
|
|
1428
|
+
" value += 1\n"
|
|
1429
|
+
" return value\n"
|
|
1430
|
+
"tail = 1\n",
|
|
1431
|
+
encoding="utf-8",
|
|
1432
|
+
)
|
|
1433
|
+
output = io.StringIO()
|
|
1434
|
+
args = argparse.Namespace(
|
|
1435
|
+
repo=str(repo), scope="changed", base="", json=True
|
|
1436
|
+
)
|
|
1437
|
+
with mock.patch.object(ap, "_record_evidence"), contextlib.redirect_stdout(output):
|
|
1438
|
+
if should_block:
|
|
1439
|
+
with self.assertRaisesRegex(APError, "2 blocking issue"):
|
|
1440
|
+
ap.cmd_structure_check(args)
|
|
1441
|
+
else:
|
|
1442
|
+
ap.cmd_structure_check(args)
|
|
1443
|
+
|
|
1444
|
+
result = json.loads(output.getvalue())
|
|
1445
|
+
self.assertIs(should_block, result["block_warnings"])
|
|
1446
|
+
if should_block:
|
|
1447
|
+
self.assertEqual(2, len(result["blocking"]))
|
|
1448
|
+
else:
|
|
1449
|
+
self.assertEqual([], result["blocking"])
|
|
1450
|
+
self.assertEqual(2, len(result["warnings"]))
|
|
1451
|
+
|
|
1452
|
+
def test_structure_block_warnings_keeps_accepted_debt_size_findings_advisory(self) -> None:
|
|
1453
|
+
cfg = base_config()
|
|
1454
|
+
cfg["structure"] = {
|
|
1455
|
+
"enabled": True,
|
|
1456
|
+
"enforcement": "blocking",
|
|
1457
|
+
"block_warnings": True,
|
|
1458
|
+
"max_file_lines_warn": 4,
|
|
1459
|
+
"max_file_lines_block": 50,
|
|
1460
|
+
"max_function_lines_warn": 4,
|
|
1461
|
+
"max_added_lines_to_large_file": 50,
|
|
1462
|
+
"accepted_debt_paths": ["src/accepted.py"],
|
|
1463
|
+
"layer_rules": {"enabled": False},
|
|
1464
|
+
}
|
|
1465
|
+
cfg["optimization"] = {"require_baseline_for_global_review": False}
|
|
1466
|
+
repo, _ = self.make_repo("src/accepted.py", cfg)
|
|
1467
|
+
(repo / "src" / "accepted.py").write_text(
|
|
1468
|
+
"def accepted_debt():\n"
|
|
1469
|
+
" value = 1\n"
|
|
1470
|
+
" value += 1\n"
|
|
1471
|
+
" value += 1\n"
|
|
1472
|
+
" return value\n"
|
|
1473
|
+
"tail = 1\n",
|
|
1474
|
+
encoding="utf-8",
|
|
1475
|
+
)
|
|
1476
|
+
output = io.StringIO()
|
|
1477
|
+
with mock.patch.object(ap, "_record_evidence"), contextlib.redirect_stdout(output):
|
|
1478
|
+
ap.cmd_structure_check(
|
|
1479
|
+
argparse.Namespace(
|
|
1480
|
+
repo=str(repo), scope="changed", base="", json=True
|
|
1481
|
+
)
|
|
1482
|
+
)
|
|
1483
|
+
|
|
1484
|
+
result = json.loads(output.getvalue())
|
|
1485
|
+
self.assertIs(True, result["block_warnings"])
|
|
1486
|
+
self.assertEqual([], result["blocking"])
|
|
1487
|
+
self.assertEqual(2, len(result["warnings"]))
|
|
1488
|
+
|
|
1489
|
+
def test_changed_scope_light_gate_blocks_promoted_structure_warnings(self) -> None:
|
|
1490
|
+
cfg = base_config()
|
|
1491
|
+
cfg["structure"] = {
|
|
1492
|
+
"enabled": True,
|
|
1493
|
+
"enforcement": "blocking",
|
|
1494
|
+
"block_warnings": True,
|
|
1495
|
+
"max_file_lines_warn": 3,
|
|
1496
|
+
"max_file_lines_block": 50,
|
|
1497
|
+
"max_function_lines_warn": 0,
|
|
1498
|
+
"max_added_lines_to_large_file": 50,
|
|
1499
|
+
"layer_rules": {"enabled": False},
|
|
1500
|
+
}
|
|
1501
|
+
cfg["optimization"] = {"require_baseline_for_global_review": False}
|
|
1502
|
+
repo, _ = self.make_repo("src/warn-only.py", cfg)
|
|
1503
|
+
(repo / "src" / "warn-only.py").write_text(
|
|
1504
|
+
"one\ntwo\nthree\nfour\n",
|
|
1505
|
+
encoding="utf-8",
|
|
1506
|
+
)
|
|
1507
|
+
|
|
1508
|
+
with mock.patch.object(ap, "_record_evidence"):
|
|
1509
|
+
with self.assertRaisesRegex(APError, "structure-check failed"):
|
|
1510
|
+
ap.cmd_light_gate(
|
|
1511
|
+
argparse.Namespace(
|
|
1512
|
+
repo=str(repo),
|
|
1513
|
+
scope="changed",
|
|
1514
|
+
profile="",
|
|
1515
|
+
mode="dev",
|
|
1516
|
+
base="",
|
|
1517
|
+
explain=False,
|
|
1518
|
+
)
|
|
1519
|
+
)
|
|
1520
|
+
|
|
1521
|
+
def test_doctor_validates_structure_block_warnings_type_and_advises_on_no_effect(self) -> None:
|
|
1522
|
+
cfg = base_config()
|
|
1523
|
+
cfg["structure"] = {
|
|
1524
|
+
"enabled": True,
|
|
1525
|
+
"enforcement": "blocking",
|
|
1526
|
+
"block_warnings": "true",
|
|
1527
|
+
}
|
|
1528
|
+
repo, _ = self.make_repo(config=cfg)
|
|
1529
|
+
with self.assertRaisesRegex(
|
|
1530
|
+
APError,
|
|
1531
|
+
"structure.block_warnings must be a boolean",
|
|
1532
|
+
):
|
|
1533
|
+
ap.cmd_doctor(argparse.Namespace(repo=str(repo)))
|
|
1534
|
+
|
|
1535
|
+
cfg = base_config()
|
|
1536
|
+
cfg["structure"] = {
|
|
1537
|
+
"enabled": True,
|
|
1538
|
+
"enforcement": "advisory",
|
|
1539
|
+
"block_warnings": True,
|
|
1540
|
+
}
|
|
1541
|
+
repo, _ = self.make_repo(config=cfg)
|
|
1542
|
+
output = io.StringIO()
|
|
1543
|
+
with mock.patch.object(ap, "_record_evidence"), contextlib.redirect_stdout(output):
|
|
1544
|
+
ap.cmd_doctor(argparse.Namespace(repo=str(repo)))
|
|
1545
|
+
self.assertIn(
|
|
1546
|
+
"structure.block_warnings has no effect unless structure.enforcement=blocking",
|
|
1547
|
+
output.getvalue(),
|
|
1548
|
+
)
|
|
1549
|
+
self.assertIn("[doctor] OK", output.getvalue())
|
|
1550
|
+
|
|
1551
|
+
def test_java_and_kotlin_semicolon_imports_trigger_layer_rules(self) -> None:
|
|
1552
|
+
structure_cfg = {
|
|
1553
|
+
"layer_rules": {
|
|
1554
|
+
"enabled": True,
|
|
1555
|
+
"block": True,
|
|
1556
|
+
"rules": [
|
|
1557
|
+
{
|
|
1558
|
+
"name": "domain",
|
|
1559
|
+
"paths": ["src/domain/**"],
|
|
1560
|
+
"forbidden_imports": ["**/infrastructure/**"],
|
|
1561
|
+
}
|
|
1562
|
+
],
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
for suffix in ["java", "kt"]:
|
|
1566
|
+
for import_line in [
|
|
1567
|
+
"import com.example.infrastructure.SecretStore;",
|
|
1568
|
+
"import com.example.infrastructure.SecretStore; // boundary",
|
|
1569
|
+
"import com.example.infrastructure.SecretStore; /* boundary */",
|
|
1570
|
+
"import com.example.infrastructure.SecretStore; /* boundary",
|
|
1571
|
+
"import com.example.infrastructure.SecretStore; /* boundary */ // trailing",
|
|
1572
|
+
]:
|
|
1573
|
+
with self.subTest(suffix=suffix, import_line=import_line):
|
|
1574
|
+
path = f"src/domain/Order.{suffix}"
|
|
1575
|
+
issues = ap._structure_boundary_issues(
|
|
1576
|
+
path,
|
|
1577
|
+
[
|
|
1578
|
+
"package com.example.domain;",
|
|
1579
|
+
import_line,
|
|
1580
|
+
"",
|
|
1581
|
+
"class Order {}",
|
|
1582
|
+
],
|
|
1583
|
+
structure_cfg,
|
|
1584
|
+
)
|
|
1585
|
+
self.assertEqual(1, len(issues))
|
|
1586
|
+
self.assertIn("layer 'domain'", issues[0])
|
|
1587
|
+
self.assertIn("com.example.infrastructure.SecretStore", issues[0])
|
|
1588
|
+
|
|
1589
|
+
def test_function_ranges_follow_language_syntax(self) -> None:
|
|
1590
|
+
fixtures = [
|
|
1591
|
+
(
|
|
1592
|
+
"repository.go",
|
|
1593
|
+
[
|
|
1594
|
+
"package sample",
|
|
1595
|
+
"",
|
|
1596
|
+
"func (r *Repository) Find() error {",
|
|
1597
|
+
" if r == nil {",
|
|
1598
|
+
" return nil",
|
|
1599
|
+
" }",
|
|
1600
|
+
" return nil",
|
|
1601
|
+
"}",
|
|
1602
|
+
"",
|
|
1603
|
+
"var after = 1",
|
|
1604
|
+
],
|
|
1605
|
+
3,
|
|
1606
|
+
6,
|
|
1607
|
+
),
|
|
1608
|
+
(
|
|
1609
|
+
"normalize.py",
|
|
1610
|
+
[
|
|
1611
|
+
"def normalize(value):",
|
|
1612
|
+
" if value:",
|
|
1613
|
+
" return value",
|
|
1614
|
+
" return None",
|
|
1615
|
+
"after = 1",
|
|
1616
|
+
],
|
|
1617
|
+
1,
|
|
1618
|
+
4,
|
|
1619
|
+
),
|
|
1620
|
+
(
|
|
1621
|
+
"block-arrow.ts",
|
|
1622
|
+
[
|
|
1623
|
+
"const block = () => {",
|
|
1624
|
+
' const literal = "}";',
|
|
1625
|
+
" // } inside a comment is not the function end",
|
|
1626
|
+
" if (literal) {",
|
|
1627
|
+
" return literal;",
|
|
1628
|
+
" }",
|
|
1629
|
+
' return "";',
|
|
1630
|
+
"};",
|
|
1631
|
+
"const after = 1;",
|
|
1632
|
+
],
|
|
1633
|
+
1,
|
|
1634
|
+
8,
|
|
1635
|
+
),
|
|
1636
|
+
(
|
|
1637
|
+
"expression-arrow.ts",
|
|
1638
|
+
[
|
|
1639
|
+
"const expression = value =>",
|
|
1640
|
+
" value",
|
|
1641
|
+
" .trim()",
|
|
1642
|
+
" .toLowerCase();",
|
|
1643
|
+
"const after = 1;",
|
|
1644
|
+
],
|
|
1645
|
+
1,
|
|
1646
|
+
4,
|
|
1647
|
+
),
|
|
1648
|
+
(
|
|
1649
|
+
"parenthesized-arrow.ts",
|
|
1650
|
+
[
|
|
1651
|
+
"const expression = value => (",
|
|
1652
|
+
" value",
|
|
1653
|
+
" .trim()",
|
|
1654
|
+
" .toLowerCase()",
|
|
1655
|
+
");",
|
|
1656
|
+
"const after = 1;",
|
|
1657
|
+
],
|
|
1658
|
+
1,
|
|
1659
|
+
5,
|
|
1660
|
+
),
|
|
1661
|
+
(
|
|
1662
|
+
"conditional-arrow.ts",
|
|
1663
|
+
[
|
|
1664
|
+
"const choose = value => value ?",
|
|
1665
|
+
" first :",
|
|
1666
|
+
" second;",
|
|
1667
|
+
"const after = 1;",
|
|
1668
|
+
],
|
|
1669
|
+
1,
|
|
1670
|
+
3,
|
|
1671
|
+
),
|
|
1672
|
+
(
|
|
1673
|
+
"view-arrow.tsx",
|
|
1674
|
+
[
|
|
1675
|
+
"const View = () => <section>",
|
|
1676
|
+
" <span>value</span>",
|
|
1677
|
+
"</section>;",
|
|
1678
|
+
"const after = 1;",
|
|
1679
|
+
],
|
|
1680
|
+
1,
|
|
1681
|
+
3,
|
|
1682
|
+
),
|
|
1683
|
+
(
|
|
1684
|
+
"multiline-params.ts",
|
|
1685
|
+
[
|
|
1686
|
+
"const multi = (",
|
|
1687
|
+
" value: string,",
|
|
1688
|
+
" count: number,",
|
|
1689
|
+
") => {",
|
|
1690
|
+
" return value.repeat(count);",
|
|
1691
|
+
"};",
|
|
1692
|
+
"const after = 1;",
|
|
1693
|
+
],
|
|
1694
|
+
1,
|
|
1695
|
+
6,
|
|
1696
|
+
),
|
|
1697
|
+
(
|
|
1698
|
+
"same-indent-plus.ts",
|
|
1699
|
+
[
|
|
1700
|
+
"const sum = value => value",
|
|
1701
|
+
"+ increment",
|
|
1702
|
+
"+ extra;",
|
|
1703
|
+
"const after = 1;",
|
|
1704
|
+
],
|
|
1705
|
+
1,
|
|
1706
|
+
3,
|
|
1707
|
+
),
|
|
1708
|
+
(
|
|
1709
|
+
"same-indent-chain.ts",
|
|
1710
|
+
[
|
|
1711
|
+
"const normalized = value => value",
|
|
1712
|
+
".trim()",
|
|
1713
|
+
".toLowerCase();",
|
|
1714
|
+
"const after = 1;",
|
|
1715
|
+
],
|
|
1716
|
+
1,
|
|
1717
|
+
3,
|
|
1718
|
+
),
|
|
1719
|
+
(
|
|
1720
|
+
"conditional-jsx.tsx",
|
|
1721
|
+
[
|
|
1722
|
+
"const Choice = value => (",
|
|
1723
|
+
" value ?",
|
|
1724
|
+
" <Accept /> :",
|
|
1725
|
+
" <Reject />",
|
|
1726
|
+
");",
|
|
1727
|
+
"const after = 1;",
|
|
1728
|
+
],
|
|
1729
|
+
1,
|
|
1730
|
+
5,
|
|
1731
|
+
),
|
|
1732
|
+
]
|
|
1733
|
+
trailing_top_level_lines = [f"top_level_{index} = {index}" for index in range(20)]
|
|
1734
|
+
for path, lines, start_line, expected_size in fixtures:
|
|
1735
|
+
with self.subTest(path=path):
|
|
1736
|
+
warnings = ap._function_size_warnings(
|
|
1737
|
+
path,
|
|
1738
|
+
lines + trailing_top_level_lines,
|
|
1739
|
+
expected_size - 1,
|
|
1740
|
+
)
|
|
1741
|
+
self.assertEqual(1, len(warnings))
|
|
1742
|
+
self.assertIn(f"{path}:{start_line}", warnings[0])
|
|
1743
|
+
self.assertIn(f"has {expected_size} lines", warnings[0])
|
|
1744
|
+
|
|
1745
|
+
def test_python_inline_suite_does_not_absorb_top_level_code(self) -> None:
|
|
1746
|
+
lines = ["def ready(): return True"] + [f"top_level_{index} = {index}" for index in range(200)]
|
|
1747
|
+
self.assertEqual([], ap._function_size_warnings("inline.py", lines, 120))
|
|
1748
|
+
|
|
1749
|
+
def test_function_ranges_ignore_type_braces_regex_literals_and_prior_assignments(self) -> None:
|
|
1750
|
+
long_body = [f" value_{index} := {index}" for index in range(130)]
|
|
1751
|
+
go_lines = [
|
|
1752
|
+
"package sample",
|
|
1753
|
+
"func build() struct {",
|
|
1754
|
+
" Value string",
|
|
1755
|
+
"} {",
|
|
1756
|
+
*long_body,
|
|
1757
|
+
" return struct { Value string }{}",
|
|
1758
|
+
"}",
|
|
1759
|
+
]
|
|
1760
|
+
self.assertEqual(1, len(ap._function_size_warnings("builder.go", go_lines, 120)))
|
|
1761
|
+
|
|
1762
|
+
js_lines = [
|
|
1763
|
+
"const block = () => {",
|
|
1764
|
+
" const matcher = /}/;",
|
|
1765
|
+
*[f" const value_{index} = {index};" for index in range(130)],
|
|
1766
|
+
"};",
|
|
1767
|
+
]
|
|
1768
|
+
self.assertEqual(1, len(ap._function_size_warnings("regex.js", js_lines, 120)))
|
|
1769
|
+
|
|
1770
|
+
separate_declarations = [
|
|
1771
|
+
'const label = "ready"',
|
|
1772
|
+
"const block = () => {",
|
|
1773
|
+
" return label;",
|
|
1774
|
+
"};",
|
|
1775
|
+
]
|
|
1776
|
+
self.assertEqual([], ap._function_size_warnings("separate.ts", separate_declarations, 3))
|
|
1777
|
+
|
|
1778
|
+
def test_function_range_scan_is_bounded_and_gate_deadline_is_enforced(self) -> None:
|
|
1779
|
+
depth = 4000
|
|
1780
|
+
lines = [f"function nested_{index}() {{" for index in range(depth)]
|
|
1781
|
+
lines.extend("}" for _ in range(depth))
|
|
1782
|
+
started = time.perf_counter()
|
|
1783
|
+
warnings = ap._function_size_warnings("nested.js", lines, 10)
|
|
1784
|
+
elapsed = time.perf_counter() - started
|
|
1785
|
+
self.assertEqual(depth - 5, len(warnings))
|
|
1786
|
+
self.assertLess(elapsed, 3.0, f"function scan must stay threshold-bounded, got {elapsed:.3f}s")
|
|
1787
|
+
|
|
1788
|
+
cfg = base_config()
|
|
1789
|
+
cfg["structure"] = {
|
|
1790
|
+
"enabled": True,
|
|
1791
|
+
"enforcement": "blocking",
|
|
1792
|
+
"max_function_lines_warn": 10,
|
|
1793
|
+
"layer_rules": {"enabled": False},
|
|
1794
|
+
}
|
|
1795
|
+
cfg["optimization"] = {"require_baseline_for_global_review": False}
|
|
1796
|
+
repo, _ = self.make_repo("src/app.js", cfg)
|
|
1797
|
+
with self.assertRaisesRegex(APError, "timed out during structure check"):
|
|
1798
|
+
ap._run_structure_check_for_gate(
|
|
1799
|
+
repo,
|
|
1800
|
+
cfg,
|
|
1801
|
+
"changed",
|
|
1802
|
+
"",
|
|
1803
|
+
deadline=time.monotonic() - 1,
|
|
1804
|
+
command_timeout_s=30,
|
|
1805
|
+
)
|
|
1806
|
+
|
|
1399
1807
|
def test_structure_scan_excludes_non_authoritative_agent_history_and_metadata(self) -> None:
|
|
1400
1808
|
repo, _ = self.make_repo()
|
|
1401
1809
|
files = {
|
package/cli/tests/index.test.js
CHANGED
|
@@ -314,7 +314,7 @@ function testInitFullyConvergesExistingProject() {
|
|
|
314
314
|
}
|
|
315
315
|
assert(exists(path.join(repo, ".agents", "agents", "custom.toml")), "project-owned custom agents must survive init");
|
|
316
316
|
assert(!exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "obsolete.txt")), "extra Skill files must be removed");
|
|
317
|
-
assert(exists(path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.
|
|
317
|
+
assert(exists(path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.3", "docs", "legacy", "old-taskbook.md")), "removed docs must be archived outside active docs");
|
|
318
318
|
assert(fs.readFileSync(structureStandard, "utf8") === customStructureStandard, "init must preserve a project-owned structure standard");
|
|
319
319
|
assert(fs.readFileSync(path.join(repo, "docs", "architecture", "adr", "0042-project-choice.md"), "utf8").includes("Keep me"), "numbered ADR artifacts must survive init");
|
|
320
320
|
assert(fs.readFileSync(path.join(repo, "docs", "architecture", "system-context.md"), "utf8").includes("Keep me"), "architecture artifacts must survive init");
|
|
@@ -329,6 +329,50 @@ function testInitFullyConvergesExistingProject() {
|
|
|
329
329
|
assert(JSON.stringify(secondDocs) === JSON.stringify(expectedInstalledDocs), "repeated init must stay idempotent");
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
function testStructureBlockWarningsDefaultsPreserveAndConverge() {
|
|
333
|
+
const repo = tmpdir("structure-block-warnings");
|
|
334
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
335
|
+
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
336
|
+
const initialized = fs.readFileSync(engineering, "utf8");
|
|
337
|
+
const initializedConfig = readEngineeringConfig(engineering);
|
|
338
|
+
assert(
|
|
339
|
+
initializedConfig.structure?.block_warnings === false,
|
|
340
|
+
"new projects must default structure.block_warnings to false",
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
const customized = initialized.replace(
|
|
344
|
+
/^ block_warnings: false$/m,
|
|
345
|
+
" block_warnings: true",
|
|
346
|
+
);
|
|
347
|
+
assert(customized !== initialized, "block_warnings must be present in canonical frontmatter");
|
|
348
|
+
writeFile(engineering, customized);
|
|
349
|
+
|
|
350
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
351
|
+
const converged = fs.readFileSync(engineering, "utf8");
|
|
352
|
+
assert(
|
|
353
|
+
readEngineeringConfig(engineering).structure?.block_warnings === true,
|
|
354
|
+
"init must preserve an explicit true structure.block_warnings value",
|
|
355
|
+
);
|
|
356
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
357
|
+
assert(
|
|
358
|
+
fs.readFileSync(engineering, "utf8") === converged,
|
|
359
|
+
"repeated init must be byte-idempotent with block_warnings=true",
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
363
|
+
const synced = fs.readFileSync(engineering, "utf8");
|
|
364
|
+
assert(
|
|
365
|
+
readEngineeringConfig(engineering).structure?.block_warnings === true,
|
|
366
|
+
"sync must preserve an explicit true structure.block_warnings value",
|
|
367
|
+
);
|
|
368
|
+
assert(synced === converged, "sync must not rewrite a converged block_warnings=true config");
|
|
369
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
370
|
+
assert(
|
|
371
|
+
fs.readFileSync(engineering, "utf8") === synced,
|
|
372
|
+
"repeated sync must be byte-idempotent with block_warnings=true",
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
|
|
332
376
|
function testInitRejectsMissingPythonRuntimeBeforeWrites() {
|
|
333
377
|
if (process.platform === "win32") return;
|
|
334
378
|
const repo = tmpdir("missing-python-runtime");
|
|
@@ -393,10 +437,10 @@ function testMinimalInitConvergesWithinBudget() {
|
|
|
393
437
|
const files = listProjectFiles(repo);
|
|
394
438
|
const lines = files.reduce((total, file) => total + fs.readFileSync(file, "utf8").split(/\r?\n/).length, 0);
|
|
395
439
|
assert(files.length <= 40, `minimal scaffold file budget exceeded: ${files.length}`);
|
|
396
|
-
// Integrity, staging, fail-closed classification,
|
|
397
|
-
// executable support code, not prompt
|
|
398
|
-
// leaving deterministic checks readable.
|
|
399
|
-
assert(lines <=
|
|
440
|
+
// Integrity, staging, fail-closed classification, contract helpers, and the
|
|
441
|
+
// language-aware structure scanner are executable support code, not prompt
|
|
442
|
+
// context. Keep a measured ceiling while leaving deterministic checks readable.
|
|
443
|
+
assert(lines <= 14860, `minimal scaffold line budget exceeded: ${lines}`);
|
|
400
444
|
const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
|
|
401
445
|
assert(engineering.includes("profile: auto"), "engineering should enable adaptive profiles");
|
|
402
446
|
assert(engineering.includes("isolation: adaptive"), "engineering should default to adaptive clean-branch/worktree isolation");
|
|
@@ -935,7 +979,7 @@ function testManagedEngineeringInitIsAuthoritativeAndIdempotent() {
|
|
|
935
979
|
|
|
936
980
|
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
937
981
|
const initial = fs.readFileSync(engineering, "utf8");
|
|
938
|
-
const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.2\.
|
|
982
|
+
const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.2\.3 -->/;
|
|
939
983
|
const endMarker = "<!-- auto-coding-skill:managed-workflow:end -->";
|
|
940
984
|
assert(startPattern.test(initial), "new projects should include a versioned managed workflow marker");
|
|
941
985
|
assert(initial.includes(endMarker), "new projects should include the managed workflow end marker");
|
|
@@ -949,21 +993,21 @@ function testManagedEngineeringInitIsAuthoritativeAndIdempotent() {
|
|
|
949
993
|
const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
|
|
950
994
|
const dryResult = JSON.parse(dryRun.stdout).results[0];
|
|
951
995
|
assert(dryResult.managedWorkflow.state === "stale", `dry-run should expose stale workflow state: ${dryRun.stdout}`);
|
|
952
|
-
assert(dryResult.managedWorkflow.version === "4.2.
|
|
996
|
+
assert(dryResult.managedWorkflow.version === "4.2.3", "dry-run should expose the target workflow version");
|
|
953
997
|
assert(dryResult.actions.some(item => item.action === "would-update" && item.path === "docs/ENGINEERING.md"), "dry-run should plan the managed body update");
|
|
954
998
|
assert(fs.readFileSync(engineering, "utf8") === customized, "dry-run must not write ENGINEERING.md");
|
|
955
999
|
|
|
956
1000
|
run("node", [cli, "init"], { cwd: repo });
|
|
957
1001
|
const updated = fs.readFileSync(engineering, "utf8");
|
|
958
1002
|
assert(!updated.includes("project note before") && !updated.includes("project note after"), "init must remove text outside the canonical ENGINEERING body");
|
|
959
|
-
assert(updated.includes("version=4.2.
|
|
1003
|
+
assert(updated.includes("version=4.2.3"), "init should install the current managed workflow version");
|
|
960
1004
|
assert(updated.includes("The frontmatter contract is:"), "init should refresh stale managed workflow content");
|
|
961
1005
|
|
|
962
1006
|
fillRequiredAccess(repo);
|
|
963
1007
|
const status = run("node", [cli, "status", "--projects", repo, "--json"]);
|
|
964
1008
|
const statusResult = JSON.parse(status.stdout).results[0];
|
|
965
1009
|
assert(statusResult.managedWorkflow.state === "current", `status should expose current managed workflow state: ${status.stdout}`);
|
|
966
|
-
assert(statusResult.managedWorkflow.version === "4.2.
|
|
1010
|
+
assert(statusResult.managedWorkflow.version === "4.2.3", "status should expose the installed managed workflow version");
|
|
967
1011
|
|
|
968
1012
|
const beforeSecondInit = fs.readFileSync(engineering, "utf8");
|
|
969
1013
|
run("node", [cli, "init"], { cwd: repo });
|
|
@@ -990,7 +1034,7 @@ function testLegacyEngineeringMigrationPreservesExistingBody() {
|
|
|
990
1034
|
assert(dryResult.actions.find(item => item.path === "docs/ENGINEERING.md")?.detail.includes("preserved-custom"), "custom legacy action should be labeled preserved-custom");
|
|
991
1035
|
run("node", [cli, "sync", "--projects", repo]);
|
|
992
1036
|
const migrated = fs.readFileSync(engineering, "utf8");
|
|
993
|
-
assert(migrated.includes("version=4.2.
|
|
1037
|
+
assert(migrated.includes("version=4.2.3"), "legacy migration should insert the current managed workflow");
|
|
994
1038
|
assert(migrated.includes(legacyNote), "legacy migration must preserve the complete existing body");
|
|
995
1039
|
const stable = fs.readFileSync(engineering, "utf8");
|
|
996
1040
|
run("node", [cli, "sync", "--projects", repo]);
|
|
@@ -1090,7 +1134,7 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
|
|
|
1090
1134
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1091
1135
|
const agents = path.join(repo, "AGENTS.md");
|
|
1092
1136
|
const initial = fs.readFileSync(agents, "utf8");
|
|
1093
|
-
assert(initial.includes("managed-agents:start version=4.2.
|
|
1137
|
+
assert(initial.includes("managed-agents:start version=4.2.3"), "new projects should receive the versioned root AGENTS block");
|
|
1094
1138
|
|
|
1095
1139
|
const custom = [
|
|
1096
1140
|
"# Project rules",
|
|
@@ -1109,12 +1153,12 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
|
|
|
1109
1153
|
|
|
1110
1154
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1111
1155
|
const migrated = fs.readFileSync(agents, "utf8");
|
|
1112
|
-
assert(migrated.includes("managed-agents:start version=4.2.
|
|
1156
|
+
assert(migrated.includes("managed-agents:start version=4.2.3"), "AGENTS migration should install the current managed block");
|
|
1113
1157
|
assert(!migrated.includes("Preserve this repository-specific rule exactly."), "root AGENTS must contain no project-specific tail");
|
|
1114
1158
|
assert(!migrated.includes("must execute `commands.gate_full`"), "known official conflicting rule should be removed");
|
|
1115
1159
|
const canonical = fs.readFileSync(path.join(repoRoot, "cli", "assets", "skill", "data", "templates", "bridges", "AGENTS.md"), "utf8");
|
|
1116
1160
|
assert(migrated === canonical, "root AGENTS must be byte-identical to the packaged canonical file");
|
|
1117
|
-
const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.2.
|
|
1161
|
+
const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.2.3.md");
|
|
1118
1162
|
assert(fs.readFileSync(archive, "utf8").includes("Preserve this repository-specific rule exactly."), "previous AGENTS content must be archived once");
|
|
1119
1163
|
const stable = fs.readFileSync(agents);
|
|
1120
1164
|
run("node", [cli, "sync", "--projects", repo]);
|
|
@@ -1171,7 +1215,7 @@ function testEngineeringFrameworkRejectsAnyNonCanonicalWorkflowText() {
|
|
|
1171
1215
|
|
|
1172
1216
|
run("node", [cli, "init"], { cwd: repo });
|
|
1173
1217
|
assert(!fs.readFileSync(engineering, "utf8").includes("backend owns APIs"), "init must restore the canonical ENGINEERING body");
|
|
1174
|
-
const archived = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.
|
|
1218
|
+
const archived = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.2.3", "docs", "ENGINEERING.md");
|
|
1175
1219
|
assert(fs.readFileSync(archived, "utf8").includes("backend owns APIs"), "removed project text should remain in non-authoritative history");
|
|
1176
1220
|
}
|
|
1177
1221
|
|
|
@@ -1183,12 +1227,12 @@ function testManagedInstallIntegrityIsBoundedAndRepairable() {
|
|
|
1183
1227
|
|
|
1184
1228
|
const manifestPath = path.join(repo, ".agents", "managed-install.json");
|
|
1185
1229
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
1186
|
-
assert(manifest.schema_version === 1 && manifest.skill_version === "4.2.
|
|
1230
|
+
assert(manifest.schema_version === 1 && manifest.skill_version === "4.2.3", "installed manifest must identify the release");
|
|
1187
1231
|
assert(manifest.entries.length > 0, "installed manifest must list managed files");
|
|
1188
1232
|
for (const entry of manifest.entries) {
|
|
1189
1233
|
assert(typeof entry.path === "string" && !path.isAbsolute(entry.path) && !entry.path.includes(".."), "manifest paths must be safe relative paths");
|
|
1190
1234
|
assert(/^[0-9a-f]{64}$/.test(entry.sha256), `${entry.path}: manifest hash must be sha256`);
|
|
1191
|
-
assert(entry.version === "4.2.
|
|
1235
|
+
assert(entry.version === "4.2.3" && typeof entry.executable === "boolean", `${entry.path}: version/executable metadata missing`);
|
|
1192
1236
|
}
|
|
1193
1237
|
assert(!manifest.managed_namespaces.some(item => item.path === ".agents" || item.path === "docs"), "manifest must not mirror entire project-owned trees");
|
|
1194
1238
|
|
|
@@ -1258,14 +1302,14 @@ function testManagedInstallIntegrityIsBoundedAndRepairable() {
|
|
|
1258
1302
|
}
|
|
1259
1303
|
|
|
1260
1304
|
function testReleaseVersionMarkersStayInSync() {
|
|
1261
|
-
const expected = "4.2.
|
|
1305
|
+
const expected = "4.2.3";
|
|
1262
1306
|
const pkg = JSON.parse(fs.readFileSync(path.join(repoRoot, "package.json"), "utf8"));
|
|
1263
1307
|
const lock = JSON.parse(fs.readFileSync(path.join(repoRoot, "package-lock.json"), "utf8"));
|
|
1264
1308
|
const policy = JSON.parse(fs.readFileSync(
|
|
1265
1309
|
path.join(repoRoot, "src", "auto-coding-skill", "data", "policies", "workflow-migrations-v1.json"),
|
|
1266
1310
|
"utf8",
|
|
1267
1311
|
));
|
|
1268
|
-
assert(pkg.version === expected, "package version must match the 4.2.
|
|
1312
|
+
assert(pkg.version === expected, "package version must match the 4.2.3 release");
|
|
1269
1313
|
assert(lock.version === expected && lock.packages[""].version === expected, "package-lock versions must match");
|
|
1270
1314
|
assert(policy.managed_versions.engineering === expected && policy.managed_versions.agents === expected, "managed workflow versions must match");
|
|
1271
1315
|
const manifest = JSON.parse(fs.readFileSync(path.join(repoRoot, "cli", "assets", "managed-install.json"), "utf8"));
|
|
@@ -1304,6 +1348,7 @@ function testProtocolResponsibilitiesStaySeparated() {
|
|
|
1304
1348
|
}
|
|
1305
1349
|
|
|
1306
1350
|
testInitFullyConvergesExistingProject();
|
|
1351
|
+
testStructureBlockWarningsDefaultsPreserveAndConverge();
|
|
1307
1352
|
testInitRejectsMissingPythonRuntimeBeforeWrites();
|
|
1308
1353
|
testDestVariants();
|
|
1309
1354
|
testLauncherFallsBackToGlobalRuntime();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elvis1513/auto-coding-skill",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.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": {
|