devlyn-cli 4.2.12 → 4.2.13
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/bin/skill-history.json
CHANGED
|
@@ -334,6 +334,7 @@
|
|
|
334
334
|
"a3b852c30898b572021b32721638f67d9f44cae98653da3362456a7b88208de7",
|
|
335
335
|
"a7d7d65fd5f672cb404e6069fdc42ad7077deaa80ed8500cfa8b382dab2e3e29",
|
|
336
336
|
"aba66b674683935e4c28c93333896dc116ffe67e7a35fe30b3599a8be507e94e",
|
|
337
|
+
"b2e4437fa981317362d03ee032e1cfd8b686316e966c6ba12ecd619a009c80a6",
|
|
337
338
|
"c1b8e3ebf38e2be8972aa003e9614a782cb4f195c69d20b95a475ebf9aaaab9e",
|
|
338
339
|
"ce282a55328c2d071cacc377670fbebea4da4b9a7fee81b25293fb26763f17c9",
|
|
339
340
|
"cf61a917a804503ef1e26fbb1cf498181e843a0758ec001f84edb7bcac837448",
|
|
@@ -267,18 +267,32 @@ def guard_results(packet, expected, source):
|
|
|
267
267
|
results.append({"rule": "forbidden_files", "subject": path, "passed": path not in changed, "blocking": True})
|
|
268
268
|
limit = expected.get("max_deps_added", 0)
|
|
269
269
|
try:
|
|
270
|
-
|
|
271
|
-
subject, passed = f"{added} added, limit {limit}", added <= limit
|
|
270
|
+
before = dependency_names(work, inputs)
|
|
272
271
|
except ValueError as exc:
|
|
273
|
-
subject, passed =
|
|
272
|
+
subject, passed = (f"inputs package.json at {inputs} unreadable; limit cannot apply. "
|
|
273
|
+
f"Fix base: regular npm-valid file; start a new loop. {exc}"), False
|
|
274
|
+
else:
|
|
275
|
+
try:
|
|
276
|
+
added = len(dependency_names(work, source) - before)
|
|
277
|
+
subject, passed = f"{added} added, limit {limit}", added <= limit
|
|
278
|
+
except ValueError as exc:
|
|
279
|
+
subject, passed = f"candidate package.json at {source} is invalid; fix it in the candidate. {exc}", False
|
|
274
280
|
results.append({"rule": "max_deps_added", "subject": subject, "passed": passed, "blocking": True})
|
|
275
281
|
return results
|
|
276
282
|
|
|
277
283
|
|
|
278
284
|
def dependency_names(work, commit):
|
|
279
285
|
"""Package names under dependencies and devDependencies of the root package.json at `commit`; a missing file has none."""
|
|
280
|
-
|
|
286
|
+
entry = git(work, "ls-tree", commit, "--", "package.json").stdout
|
|
287
|
+
if not entry:
|
|
281
288
|
return set()
|
|
289
|
+
mode, kind, _ = entry.split(maxsplit=2)
|
|
290
|
+
if mode not in (b"100644", b"100755") or kind != b"blob":
|
|
291
|
+
kind = "symlink" if mode == b"120000" else "gitlink" if mode == b"160000" else kind.decode("ascii")
|
|
292
|
+
if mode == b"120000":
|
|
293
|
+
target = git(work, "show", f"{commit}:package.json").stdout.decode("utf-8", "backslashreplace")
|
|
294
|
+
kind += f" to {target!r}"
|
|
295
|
+
raise ValueError(f"{kind} (mode {mode.decode('ascii')}); expected a regular file")
|
|
282
296
|
try:
|
|
283
297
|
# Read as npm reads it: a leading BOM is ignored, a duplicate key's last value wins, a null section is empty and
|
|
284
298
|
# NaN or Infinity is invalid.
|
|
@@ -718,7 +732,9 @@ class AcceptanceTests(unittest.TestCase):
|
|
|
718
732
|
moved from dependencies to devDependencies counts 0 and is accepted; an invalid package.json fails the guard,
|
|
719
733
|
naming it. A leading UTF-8 BOM, which npm and Node accept, is ignored: with one at both commits, one added
|
|
720
734
|
counts 1. A duplicate key (its last value wins) and a null dependencies section, which npm also reads, count 0
|
|
721
|
-
and are accepted; NaN, which npm rejects, fails the guard.
|
|
735
|
+
and are accepted; NaN, which npm rejects, fails the guard. Invalid inputs fail before an invalid candidate,
|
|
736
|
+
naming inputs and the base repair/new loop action; invalid candidates name the candidate and its repair.
|
|
737
|
+
The action survives the queue's 200-character first-reason collapse, with parser detail after it."""
|
|
722
738
|
passing = {"verification_commands": [{"argv": [sys.executable, "-c", "pass"], "contract_refs": ["R1"]}]}
|
|
723
739
|
|
|
724
740
|
def guard(inputs, source):
|
|
@@ -743,7 +759,7 @@ class AcceptanceTests(unittest.TestCase):
|
|
|
743
759
|
with self.subTest("invalid"):
|
|
744
760
|
commit, result, deps = guard({"dependencies": {"a": "1"}}, '{"dependencies": {"a": "1",}}\n')
|
|
745
761
|
self.assertEqual((deps["passed"], result["verdict"]), (False, "FAILED"))
|
|
746
|
-
self.
|
|
762
|
+
self.assertTrue(deps["subject"].startswith(f"candidate package.json at {commit} is invalid; fix it in the candidate."))
|
|
747
763
|
with self.subTest("BOM"):
|
|
748
764
|
self.write("package.json", "\ufeff" + json.dumps({"dependencies": {"a": "1"}}))
|
|
749
765
|
_, _, deps = guard(None, "\ufeff" + json.dumps({"dependencies": {"a": "1", "b": "1"}}))
|
|
@@ -755,7 +771,72 @@ class AcceptanceTests(unittest.TestCase):
|
|
|
755
771
|
with self.subTest("NaN"):
|
|
756
772
|
commit, result, deps = guard({"dependencies": {"a": "1"}}, '{"config": {"threshold": NaN}}')
|
|
757
773
|
self.assertEqual((deps["passed"], result["verdict"]), (False, "FAILED"))
|
|
758
|
-
self.
|
|
774
|
+
self.assertTrue(deps["subject"].startswith(f"candidate package.json at {commit} is invalid; fix it in the candidate."))
|
|
775
|
+
with self.subTest("invalid inputs precede invalid candidate"):
|
|
776
|
+
self.write("package.json", "{")
|
|
777
|
+
_, result, deps = guard(None, "[")
|
|
778
|
+
self.assertEqual((deps["passed"], result["verdict"]), (False, "FAILED"))
|
|
779
|
+
self.assertTrue(deps["subject"].startswith(f"inputs package.json at {self.packet['inputs_sha']} unreadable; limit cannot apply."))
|
|
780
|
+
one_line = runpy.run_path(str(Path(__file__).with_name("queue.py")))["one_line"]
|
|
781
|
+
for size in (40, 64):
|
|
782
|
+
reason = result["reasons"][0].replace(self.packet["inputs_sha"], "a" * size)
|
|
783
|
+
self.assertIn("Fix base: regular npm-valid file; start a new loop", one_line(reason))
|
|
784
|
+
|
|
785
|
+
@unittest.skipIf(os.name == "nt", "a symbolic link needs a privilege on Windows")
|
|
786
|
+
def test_max_deps_added_rejects_symlinks(self):
|
|
787
|
+
"""Prediction: a candidate package.json symlink to a file named '{}' containing a dependency fails the guard,
|
|
788
|
+
naming the candidate, symlink and target; before, the target text parsed as an empty object and passed limit 0.
|
|
789
|
+
An ordinary candidate symlink also names its target and candidate repair. An inputs symlink fails first even
|
|
790
|
+
when the candidate is invalid JSON, naming inputs and the base repair/new loop action."""
|
|
791
|
+
passing = {"verification_commands": [{"argv": [sys.executable, "-c", "pass"], "contract_refs": ["R1"]}]}
|
|
792
|
+
package = self.work / "package.json"
|
|
793
|
+
one_line = runpy.run_path(str(Path(__file__).with_name("queue.py")))["one_line"]
|
|
794
|
+
for side, target in (("candidate", "{}"), ("inputs", "deps.json"), ("candidate", "deps.json")):
|
|
795
|
+
with self.subTest(side=side, target=target):
|
|
796
|
+
package.unlink(missing_ok=True)
|
|
797
|
+
self.write(target, json.dumps({"dependencies": {"hidden": "1"}}))
|
|
798
|
+
if side == "inputs":
|
|
799
|
+
package.symlink_to(target)
|
|
800
|
+
else:
|
|
801
|
+
self.write("package.json", "{}")
|
|
802
|
+
self.inputs(passing)
|
|
803
|
+
package.unlink()
|
|
804
|
+
if side == "candidate":
|
|
805
|
+
package.symlink_to(target)
|
|
806
|
+
else:
|
|
807
|
+
self.write("package.json", "[")
|
|
808
|
+
source = self.commit("product")
|
|
809
|
+
result = self.submit(source)
|
|
810
|
+
deps = next(g for g in result["guards"] if g["rule"] == "max_deps_added")
|
|
811
|
+
self.assertEqual((deps["passed"], result["verdict"]), (False, "FAILED"))
|
|
812
|
+
commit = self.packet["inputs_sha"] if side == "inputs" else source
|
|
813
|
+
self.assertTrue(deps["subject"].startswith(f"{side} package.json at {commit}"))
|
|
814
|
+
self.assertIn(f"symlink to {target!r}", deps["subject"])
|
|
815
|
+
action = "Fix base: regular npm-valid file; start a new loop" if side == "inputs" else "fix it in the candidate."
|
|
816
|
+
self.assertIn(action, one_line(result["reasons"][0]))
|
|
817
|
+
|
|
818
|
+
def test_max_deps_added_requires_regular_blobs(self):
|
|
819
|
+
"""Prediction: both regular blob modes count names; a tree or gitlink at package.json fails the guard with
|
|
820
|
+
its kind and candidate repair, rather than escaping as an AcceptanceError without a guard subject."""
|
|
821
|
+
self.write("package.json", '{"dependencies": {"a": "1"}}')
|
|
822
|
+
self.inputs()
|
|
823
|
+
inputs = self.packet["inputs_sha"]
|
|
824
|
+
blob = self.g("rev-parse", f"{inputs}:package.json")
|
|
825
|
+
tree = self.g("rev-parse", f"{inputs}^{{tree}}")
|
|
826
|
+
for mode, kind, oid in (("100644", "blob", blob), ("100755", "blob", blob),
|
|
827
|
+
("040000", "tree", tree), ("160000", "commit", inputs)):
|
|
828
|
+
with self.subTest(mode=mode):
|
|
829
|
+
made = subprocess.run(["git", "-C", str(self.work), "mktree"],
|
|
830
|
+
input=f"{mode} {kind} {oid}\tpackage.json\n".encode(), capture_output=True, check=True)
|
|
831
|
+
source = self.g("commit-tree", made.stdout.decode().strip(), "-p", inputs, "-m", "package kind")
|
|
832
|
+
deps = next(g for g in guard_results(self.packet, {}, source) if g["rule"] == "max_deps_added")
|
|
833
|
+
if kind == "blob":
|
|
834
|
+
self.assertEqual(dependency_names(self.work, source), {"a"})
|
|
835
|
+
self.assertEqual((deps["passed"], deps["subject"]), (True, "0 added, limit 0"))
|
|
836
|
+
else:
|
|
837
|
+
self.assertFalse(deps["passed"])
|
|
838
|
+
self.assertTrue(deps["subject"].startswith(f"candidate package.json at {source} is invalid; fix it in the candidate."))
|
|
839
|
+
self.assertIn("gitlink" if kind == "commit" else kind, deps["subject"])
|
|
759
840
|
|
|
760
841
|
|
|
761
842
|
def main():
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devlyn-cli",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.13",
|
|
4
4
|
"description": "Loop & harness engineering for AI coding agents (Claude Code, Codex, and any AGENTS.md-driven agent) — core engineering principles for CLAUDE.md/AGENTS.md and a loop designer that splits one intent into tasks agents drain hands-free",
|
|
5
5
|
"homepage": "https://github.com/fysoul17/devlyn-cli#readme",
|
|
6
6
|
"bin": {
|