@christang/keel 5.47.0 → 5.48.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
CHANGED
|
@@ -280,8 +280,10 @@ command at the right moment. Three things make that happen.
|
|
|
280
280
|
- **The hooks.** A SessionStart hook runs the continuity projection the moment a session
|
|
281
281
|
opens; a PreToolUse hook enforces the write guard on every edit. Neither needs prompting.
|
|
282
282
|
|
|
283
|
-
So in day-to-day use you run two commands: `keel --
|
|
284
|
-
|
|
283
|
+
So in day-to-day use you run two commands: `keel --doctor` when you want to check the
|
|
284
|
+
wiring, and `keel --init` whenever it tells you the repository is behind its install — the
|
|
285
|
+
protocol version lives in your `AGENTS.md`, and updating the package does not move it.
|
|
286
|
+
Everything below is the vocabulary the agent uses on your behalf.
|
|
285
287
|
|
|
286
288
|
## Verification layering
|
|
287
289
|
|
package/bin/keel.js
CHANGED
|
@@ -983,6 +983,78 @@ function printDoctorLine(name, status, detail = "") {
|
|
|
983
983
|
process.stdout.write(`${name}: ${status}${detail ? ` - ${detail}` : ""}\n`);
|
|
984
984
|
}
|
|
985
985
|
|
|
986
|
+
// The `version=` attribute of the managed marker is written by every install
|
|
987
|
+
// and, until this line existed, read back by nothing that runs locally: both
|
|
988
|
+
// marker parsers match `keel:start(?:\s+[^>]*)?` and throw the attributes away.
|
|
989
|
+
// The one reader was the plugin's SessionStart hook, and doctor reports that
|
|
990
|
+
// plugin's activation as manual on every target — so the check might simply not
|
|
991
|
+
// be running, with nothing to distinguish that from agreement. Doctor is the
|
|
992
|
+
// model-free fallback: the declaration comes from the working tree and the
|
|
993
|
+
// running version from this process, so the comparison holds with no plugin at
|
|
994
|
+
// all.
|
|
995
|
+
function declaredProtocolVersion(repo) {
|
|
996
|
+
const agentsPath = path.join(repo, "AGENTS.md");
|
|
997
|
+
if (!fs.existsSync(agentsPath)) return null;
|
|
998
|
+
const match = fs
|
|
999
|
+
.readFileSync(agentsPath, "utf8")
|
|
1000
|
+
.match(/<!--\s*keel:start\s+version=(\d+\.\d+\.\d+)\s*-->/);
|
|
1001
|
+
return match ? match[1] : null;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
// Numeric, not lexical: "5.9.0" precedes "5.10.0" and string order says
|
|
1005
|
+
// otherwise. Returns a negative number when `a` is behind `b`.
|
|
1006
|
+
function compareVersions(a, b) {
|
|
1007
|
+
const left = a.split(".").map(Number);
|
|
1008
|
+
const right = b.split(".").map(Number);
|
|
1009
|
+
for (let i = 0; i < 3; i += 1) {
|
|
1010
|
+
if (left[i] !== right[i]) return left[i] - right[i];
|
|
1011
|
+
}
|
|
1012
|
+
return 0;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
// Printed on every run, agreeing or not. A check that is silent when it passes
|
|
1016
|
+
// cannot be told apart from a check that did not run, which is the failure this
|
|
1017
|
+
// line exists to remove — so silence is never the report.
|
|
1018
|
+
function printProtocolVersionDrift(repo, target) {
|
|
1019
|
+
const running = PACKAGE_JSON.version;
|
|
1020
|
+
const declared = declaredProtocolVersion(repo);
|
|
1021
|
+
if (!declared) {
|
|
1022
|
+
printDoctorLine(
|
|
1023
|
+
"protocol",
|
|
1024
|
+
"not comparable",
|
|
1025
|
+
`this CLI is ${running}; the repository declares no protocol version in `
|
|
1026
|
+
+ "an AGENTS.md `keel:start` marker — run "
|
|
1027
|
+
+ `keel --init --target ${target} to write one`
|
|
1028
|
+
);
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
const order = compareVersions(declared, running);
|
|
1032
|
+
if (order === 0) {
|
|
1033
|
+
printDoctorLine(
|
|
1034
|
+
"protocol",
|
|
1035
|
+
"ok",
|
|
1036
|
+
`repo declares ${declared}, this CLI is ${running}`
|
|
1037
|
+
);
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
// The two directions have different repairs, and the wrong repair is a no-op
|
|
1041
|
+
// that reads as a failure, so the line names the direction rather than the
|
|
1042
|
+
// difference. Drift never reaches the exit code: an out-of-date install is
|
|
1043
|
+
// not a broken one, and a doctor that goes red on release day is a doctor
|
|
1044
|
+
// people switch off.
|
|
1045
|
+
printDoctorLine(
|
|
1046
|
+
"protocol",
|
|
1047
|
+
"warning",
|
|
1048
|
+
order < 0
|
|
1049
|
+
? `repo declares ${declared}, this CLI is ${running} — the repository is `
|
|
1050
|
+
+ `behind its install; run keel --init --target ${target} to bring the `
|
|
1051
|
+
+ "protocol forward"
|
|
1052
|
+
: `repo declares ${declared}, this CLI is ${running} — the install is `
|
|
1053
|
+
+ "behind the repository, which carries a protocol this CLI cannot "
|
|
1054
|
+
+ "enforce; update the Keel package"
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
986
1058
|
function codexHome() {
|
|
987
1059
|
const configured = (process.env.CODEX_HOME || "").trim();
|
|
988
1060
|
return path.resolve(configured || path.join(os.homedir(), ".codex"));
|
|
@@ -1553,6 +1625,8 @@ function runDoctor(options) {
|
|
|
1553
1625
|
);
|
|
1554
1626
|
}
|
|
1555
1627
|
|
|
1628
|
+
printProtocolVersionDrift(repo, options.target);
|
|
1629
|
+
|
|
1556
1630
|
process.stdout.write("\nProject status:\n");
|
|
1557
1631
|
const checkStatus = runPython(
|
|
1558
1632
|
INSTALL_SCRIPT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.48.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.48.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -37,8 +37,8 @@ REQUIRED_SCRIPTS = [
|
|
|
37
37
|
"scripts/validate_plugin.py",
|
|
38
38
|
]
|
|
39
39
|
|
|
40
|
-
PACKAGE_VERSION = "5.
|
|
41
|
-
PROTOCOL_VERSION = "5.
|
|
40
|
+
PACKAGE_VERSION = "5.48.0"
|
|
41
|
+
PROTOCOL_VERSION = "5.48.0"
|
|
42
42
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
43
43
|
OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
|
|
44
44
|
# Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
|
|
@@ -24597,6 +24597,129 @@ def validate_doctor_openspec_honesty_scenario() -> int:
|
|
|
24597
24597
|
return 0
|
|
24598
24598
|
|
|
24599
24599
|
|
|
24600
|
+
# The marker's `version=` attribute is written by the installer and, before this
|
|
24601
|
+
# scenario, read back by nothing that runs locally: both marker parsers match
|
|
24602
|
+
# `keel:start(?:\s+[^>]*)?` and discard the attributes. The only reader was the
|
|
24603
|
+
# plugin's SessionStart hook, whose activation doctor itself reports as manual.
|
|
24604
|
+
def validate_marker_version_is_read_scenario() -> int:
|
|
24605
|
+
def doctor_protocol_line(repo: Path) -> tuple[str, int]:
|
|
24606
|
+
result = run_keel(repo, "--doctor")
|
|
24607
|
+
line = next(
|
|
24608
|
+
(
|
|
24609
|
+
entry
|
|
24610
|
+
for entry in result.stdout.splitlines()
|
|
24611
|
+
if entry.startswith("protocol:")
|
|
24612
|
+
),
|
|
24613
|
+
"",
|
|
24614
|
+
)
|
|
24615
|
+
return line, result.returncode
|
|
24616
|
+
|
|
24617
|
+
def write_repo(root: Path, name: str, marker: str | None) -> Path:
|
|
24618
|
+
repo = root / name
|
|
24619
|
+
repo.mkdir()
|
|
24620
|
+
body = "# Agents\n\nSession Start.\n"
|
|
24621
|
+
(repo / "AGENTS.md").write_text(
|
|
24622
|
+
f"{marker}\n{body}" if marker is not None else body,
|
|
24623
|
+
encoding="utf-8",
|
|
24624
|
+
)
|
|
24625
|
+
return repo
|
|
24626
|
+
|
|
24627
|
+
with tempfile.TemporaryDirectory(prefix="keel-marker-version-") as raw:
|
|
24628
|
+
root = Path(raw)
|
|
24629
|
+
|
|
24630
|
+
behind = write_repo(root, "behind", "<!-- keel:start version=5.14.0 -->")
|
|
24631
|
+
line, behind_code = doctor_protocol_line(behind)
|
|
24632
|
+
if not line.startswith("protocol: warning"):
|
|
24633
|
+
report(
|
|
24634
|
+
"the-marker-version-is-read scenario: a repository declaring an "
|
|
24635
|
+
f"older protocol did not warn; got {line!r}."
|
|
24636
|
+
)
|
|
24637
|
+
return 1
|
|
24638
|
+
for needed in ("5.14.0", PACKAGE_VERSION, "keel --init"):
|
|
24639
|
+
if needed not in line:
|
|
24640
|
+
report(
|
|
24641
|
+
"the-marker-version-is-read scenario: the behind-repository "
|
|
24642
|
+
f"warning omits {needed!r}; got {line!r}."
|
|
24643
|
+
)
|
|
24644
|
+
return 1
|
|
24645
|
+
if "repository" not in line:
|
|
24646
|
+
report(
|
|
24647
|
+
"the-marker-version-is-read scenario: the warning does not name "
|
|
24648
|
+
f"the repository as the term that is behind; got {line!r}."
|
|
24649
|
+
)
|
|
24650
|
+
return 1
|
|
24651
|
+
|
|
24652
|
+
ahead = write_repo(root, "ahead", "<!-- keel:start version=9.99.0 -->")
|
|
24653
|
+
line, _ = doctor_protocol_line(ahead)
|
|
24654
|
+
if not line.startswith("protocol: warning"):
|
|
24655
|
+
report(
|
|
24656
|
+
"the-marker-version-is-read scenario: a repository declaring a "
|
|
24657
|
+
f"newer protocol did not warn; got {line!r}."
|
|
24658
|
+
)
|
|
24659
|
+
return 1
|
|
24660
|
+
for needed in ("9.99.0", PACKAGE_VERSION, "install"):
|
|
24661
|
+
if needed not in line:
|
|
24662
|
+
report(
|
|
24663
|
+
"the-marker-version-is-read scenario: the ahead-repository "
|
|
24664
|
+
f"warning omits {needed!r}; got {line!r}."
|
|
24665
|
+
)
|
|
24666
|
+
return 1
|
|
24667
|
+
if "keel --init" in line:
|
|
24668
|
+
report(
|
|
24669
|
+
"the-marker-version-is-read scenario: a repository ahead of its "
|
|
24670
|
+
f"install was told to re-run keel --init; got {line!r}."
|
|
24671
|
+
)
|
|
24672
|
+
return 1
|
|
24673
|
+
|
|
24674
|
+
agreed = write_repo(
|
|
24675
|
+
root, "agreed", f"<!-- keel:start version={PACKAGE_VERSION} -->"
|
|
24676
|
+
)
|
|
24677
|
+
line, agreed_code = doctor_protocol_line(agreed)
|
|
24678
|
+
if not line.startswith("protocol: ok"):
|
|
24679
|
+
report(
|
|
24680
|
+
"the-marker-version-is-read scenario: agreeing versions did not "
|
|
24681
|
+
f"report ok; got {line!r}."
|
|
24682
|
+
)
|
|
24683
|
+
return 1
|
|
24684
|
+
if line.count(PACKAGE_VERSION) < 2:
|
|
24685
|
+
report(
|
|
24686
|
+
"the-marker-version-is-read scenario: the agreeing line does not "
|
|
24687
|
+
f"print both versions; got {line!r}."
|
|
24688
|
+
)
|
|
24689
|
+
return 1
|
|
24690
|
+
|
|
24691
|
+
# D2: drift is a warning and nothing else. A line that could turn a
|
|
24692
|
+
# pipeline red on release day is a line users switch off.
|
|
24693
|
+
if behind_code != agreed_code:
|
|
24694
|
+
report(
|
|
24695
|
+
"the-marker-version-is-read scenario: drift changed doctor's "
|
|
24696
|
+
f"exit code ({behind_code} vs {agreed_code})."
|
|
24697
|
+
)
|
|
24698
|
+
return 1
|
|
24699
|
+
|
|
24700
|
+
for name, marker in (
|
|
24701
|
+
("undeclared", None),
|
|
24702
|
+
("attributeless", "<!-- keel:start -->"),
|
|
24703
|
+
):
|
|
24704
|
+
repo = write_repo(root, name, marker)
|
|
24705
|
+
line, _ = doctor_protocol_line(repo)
|
|
24706
|
+
if not line.startswith("protocol: not comparable"):
|
|
24707
|
+
report(
|
|
24708
|
+
f"the-marker-version-is-read scenario: the {name} repository "
|
|
24709
|
+
f"did not report `not comparable`; got {line!r}."
|
|
24710
|
+
)
|
|
24711
|
+
return 1
|
|
24712
|
+
if "declares" not in line:
|
|
24713
|
+
report(
|
|
24714
|
+
f"the-marker-version-is-read scenario: the {name} repository "
|
|
24715
|
+
f"was not told which term is missing; got {line!r}."
|
|
24716
|
+
)
|
|
24717
|
+
return 1
|
|
24718
|
+
|
|
24719
|
+
report("the-marker-version-is-read scenario passed.")
|
|
24720
|
+
return 0
|
|
24721
|
+
|
|
24722
|
+
|
|
24600
24723
|
# A scenario name, as the registry spells one. Two registered names carry no
|
|
24601
24724
|
# hyphen — `cli` and `uninstall` — so requiring one would leave exactly those
|
|
24602
24725
|
# two unchecked, and allowing single words was measured to add no false
|
|
@@ -24826,6 +24949,7 @@ SCENARIOS: tuple = (
|
|
|
24826
24949
|
),
|
|
24827
24950
|
("cli", validate_cli_scenario),
|
|
24828
24951
|
("doctor-openspec-honesty", validate_doctor_openspec_honesty_scenario),
|
|
24952
|
+
("the-marker-version-is-read", validate_marker_version_is_read_scenario),
|
|
24829
24953
|
(
|
|
24830
24954
|
"authored-scenario-names-are-registered",
|
|
24831
24955
|
validate_authored_scenario_names_scenario,
|