@christang/keel 5.173.0 → 5.174.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/.claude-plugin/plugin.json +1 -1
- package/assets/bootstrap/AGENTS.md +1 -1
- package/bin/keel.js +97 -12
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/scripts/validate_plugin.py +102 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.174.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",
|
package/bin/keel.js
CHANGED
|
@@ -1090,10 +1090,83 @@ function updateClaudePlugin(options) {
|
|
|
1090
1090
|
return true;
|
|
1091
1091
|
}
|
|
1092
1092
|
|
|
1093
|
+
function compareVersions(a, b) {
|
|
1094
|
+
const parts = (value) => value.split(/[.-]/).map((part) => (/^\d+$/.test(part) ? Number(part) : part));
|
|
1095
|
+
const left = parts(a);
|
|
1096
|
+
const right = parts(b);
|
|
1097
|
+
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
1098
|
+
const x = left[index] === undefined ? 0 : left[index];
|
|
1099
|
+
const y = right[index] === undefined ? 0 : right[index];
|
|
1100
|
+
if (x === y) continue;
|
|
1101
|
+
if (typeof x === "number" && typeof y === "number") return x - y;
|
|
1102
|
+
return String(x) < String(y) ? -1 : 1;
|
|
1103
|
+
}
|
|
1104
|
+
return 0;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
function codexCacheVersion(cacheDir) {
|
|
1108
|
+
let entries = [];
|
|
1109
|
+
try {
|
|
1110
|
+
entries = fs.readdirSync(cacheDir, { withFileTypes: true })
|
|
1111
|
+
.filter((entry) => entry.isDirectory() && /^\d/.test(entry.name))
|
|
1112
|
+
.map((entry) => entry.name);
|
|
1113
|
+
} catch {
|
|
1114
|
+
return null;
|
|
1115
|
+
}
|
|
1116
|
+
return entries.sort(compareVersions).pop() || null;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
// What Codex's own files say when `plugin list --json` cannot (#412): the
|
|
1120
|
+
// marketplace's source type in config.toml and the installed version in the
|
|
1121
|
+
// plugin cache. Both, or nothing — a query failure is never read as an absent
|
|
1122
|
+
// host (#354), so with no install on disk the failure stands.
|
|
1123
|
+
function codexKeelFromDisk(codexHome, market) {
|
|
1124
|
+
let config = "";
|
|
1125
|
+
try {
|
|
1126
|
+
config = fs.readFileSync(path.join(codexHome, "config.toml"), "utf8");
|
|
1127
|
+
} catch {
|
|
1128
|
+
return null;
|
|
1129
|
+
}
|
|
1130
|
+
const header = `[marketplaces.${market}]`;
|
|
1131
|
+
const lines = config.split(/\r?\n/);
|
|
1132
|
+
const start = lines.findIndex((line) => line.trim() === header);
|
|
1133
|
+
if (start < 0) return null;
|
|
1134
|
+
const section = {};
|
|
1135
|
+
for (const line of lines.slice(start + 1)) {
|
|
1136
|
+
if (/^\s*\[/.test(line)) break;
|
|
1137
|
+
const entry = line.match(/^\s*([A-Za-z_]+)\s*=\s*"([^"]*)"/);
|
|
1138
|
+
if (entry) section[entry[1]] = entry[2];
|
|
1139
|
+
}
|
|
1140
|
+
const cacheDir = path.join(codexHome, "plugins", "cache", market, "keel");
|
|
1141
|
+
const version = codexCacheVersion(cacheDir);
|
|
1142
|
+
if (!section.source_type || !version) return null;
|
|
1143
|
+
return {
|
|
1144
|
+
id: `keel@${market}`,
|
|
1145
|
+
market,
|
|
1146
|
+
version,
|
|
1147
|
+
sourceType: section.source_type,
|
|
1148
|
+
source: section.source || "",
|
|
1149
|
+
path: null,
|
|
1150
|
+
cacheDir,
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1093
1154
|
function updateCodexPlugin(options) {
|
|
1094
1155
|
const component = "codex plugin";
|
|
1095
1156
|
const executable = process.env.KEEL_UPDATE_CODEX || "codex";
|
|
1096
|
-
const
|
|
1157
|
+
const codexHome = process.env.CODEX_HOME || path.join(os.homedir(), ".codex");
|
|
1158
|
+
let queried = codexKeel(executable);
|
|
1159
|
+
// A query that failed and Codex's own state that can carry the update: the
|
|
1160
|
+
// update runs from that state, and every later read comes from the cache,
|
|
1161
|
+
// because a query that just hung would most likely hang again.
|
|
1162
|
+
let listFailure = null;
|
|
1163
|
+
if (queried && queried.failed && !options.dryRun) {
|
|
1164
|
+
const fromDisk = codexKeelFromDisk(codexHome, "keel-marketplace");
|
|
1165
|
+
if (fromDisk) {
|
|
1166
|
+
listFailure = queried.failed;
|
|
1167
|
+
queried = fromDisk;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1097
1170
|
const installed = queried && !queried.failed ? queried : null;
|
|
1098
1171
|
const id = installed ? installed.id : "keel@keel-marketplace";
|
|
1099
1172
|
const market = installed ? installed.market : "keel-marketplace";
|
|
@@ -1138,28 +1211,40 @@ function updateCodexPlugin(options) {
|
|
|
1138
1211
|
// Codex re-reads hook definitions at every call and trusts them by hash, so
|
|
1139
1212
|
// a changed definition stops running until the owner reviews it. Compared
|
|
1140
1213
|
// before `plugin add`, which deletes the old install's directory.
|
|
1141
|
-
const codexHome = process.env.CODEX_HOME || path.join(os.homedir(), ".codex");
|
|
1142
1214
|
const oldHooks = installed.version
|
|
1143
1215
|
? readOrNull(path.join(codexHome, "plugins", "cache", market, "keel", installed.version, "hooks", "codex.json"))
|
|
1144
1216
|
: null;
|
|
1145
|
-
|
|
1146
|
-
if (
|
|
1147
|
-
|
|
1148
|
-
|
|
1217
|
+
let newHooks = null;
|
|
1218
|
+
if (!listFailure) {
|
|
1219
|
+
const upgraded = codexKeel(executable);
|
|
1220
|
+
if (upgraded && upgraded.failed) {
|
|
1221
|
+
updateLine(component, "failed", `${upgraded.failed} after the marketplace refresh`);
|
|
1222
|
+
return false;
|
|
1223
|
+
}
|
|
1224
|
+
newHooks = upgraded && upgraded.path ? readOrNull(path.join(upgraded.path, "hooks", "codex.json")) : null;
|
|
1149
1225
|
}
|
|
1150
|
-
const newHooks = upgraded && upgraded.path ? readOrNull(path.join(upgraded.path, "hooks", "codex.json")) : null;
|
|
1151
|
-
const hooksChanged = oldHooks && newHooks && !oldHooks.equals(newHooks);
|
|
1152
1226
|
if (!runHostSteps(component, "codex", executable, [steps[1]])) return false;
|
|
1153
|
-
|
|
1154
|
-
if (
|
|
1155
|
-
|
|
1156
|
-
|
|
1227
|
+
let after;
|
|
1228
|
+
if (listFailure) {
|
|
1229
|
+
const version = codexCacheVersion(installed.cacheDir);
|
|
1230
|
+
after = version ? { version } : null;
|
|
1231
|
+
if (version) newHooks = readOrNull(path.join(installed.cacheDir, version, "hooks", "codex.json"));
|
|
1232
|
+
} else {
|
|
1233
|
+
after = codexKeel(executable);
|
|
1234
|
+
if (after && after.failed) {
|
|
1235
|
+
updateLine(component, "failed", `${after.failed} after the update, so its result is unverified`);
|
|
1236
|
+
return false;
|
|
1237
|
+
}
|
|
1157
1238
|
}
|
|
1239
|
+
const hooksChanged = oldHooks && newHooks && !oldHooks.equals(newHooks);
|
|
1158
1240
|
updateLine(
|
|
1159
1241
|
component,
|
|
1160
1242
|
versionChange(installed.version, after && after.version),
|
|
1161
1243
|
"running sessions use it at their next hook call"
|
|
1162
1244
|
+ (hooksChanged ? "; its hook definitions changed, so Codex will ask you to review them in /hooks before they run" : "")
|
|
1245
|
+
+ (listFailure
|
|
1246
|
+
? `; \`codex plugin list --json\` did not answer (${listFailure.replace(/^`codex plugin list --json` /, "")}), so versions were read from ${installed.cacheDir}`
|
|
1247
|
+
: "")
|
|
1163
1248
|
);
|
|
1164
1249
|
return true;
|
|
1165
1250
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.174.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.
|
|
9
|
+
"version": "5.174.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.174.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.174.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",
|
|
@@ -51,8 +51,8 @@ REQUIRED_SCRIPTS = [
|
|
|
51
51
|
"scripts/validate_plugin.py",
|
|
52
52
|
]
|
|
53
53
|
|
|
54
|
-
PACKAGE_VERSION = "5.
|
|
55
|
-
PROTOCOL_VERSION = "5.
|
|
54
|
+
PACKAGE_VERSION = "5.174.0"
|
|
55
|
+
PROTOCOL_VERSION = "5.174.0"
|
|
56
56
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
57
57
|
OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
|
|
58
58
|
# Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
|
|
@@ -25283,6 +25283,16 @@ if (joined === "plugin list --json") {
|
|
|
25283
25283
|
if (joined === "plugin update keel@keel-marketplace" || joined === "plugin add keel@keel-marketplace") {
|
|
25284
25284
|
state[host] = "5.1.0";
|
|
25285
25285
|
save();
|
|
25286
|
+
// FAKE_CODEX_CACHE: `plugin add` installs into the plugin cache and deletes
|
|
25287
|
+
// the previous version's directory, as Codex does (#412).
|
|
25288
|
+
const cache = process.env.FAKE_CODEX_CACHE;
|
|
25289
|
+
if (host === "codex" && cache) {
|
|
25290
|
+
for (const entry of fs.existsSync(cache) ? fs.readdirSync(cache) : []) {
|
|
25291
|
+
fs.rmSync(path.join(cache, entry), { recursive: true, force: true });
|
|
25292
|
+
}
|
|
25293
|
+
fs.mkdirSync(path.join(cache, "5.1.0", "hooks"), { recursive: true });
|
|
25294
|
+
fs.writeFileSync(path.join(cache, "5.1.0", "hooks", "codex.json"), "{}\n");
|
|
25295
|
+
}
|
|
25286
25296
|
}
|
|
25287
25297
|
process.exit(0);
|
|
25288
25298
|
"""
|
|
@@ -25532,6 +25542,95 @@ def validate_update_host_query_timeout_scenario() -> int:
|
|
|
25532
25542
|
return 0
|
|
25533
25543
|
|
|
25534
25544
|
|
|
25545
|
+
def validate_update_codex_from_disk_scenario() -> int:
|
|
25546
|
+
"""Issue #412: a hung `codex plugin list --json` stopped an update that worked.
|
|
25547
|
+
|
|
25548
|
+
On 2026-10-20 the query hung past 90 s while `codex plugin marketplace
|
|
25549
|
+
upgrade` succeeded by hand in 35 s. Codex's own config and plugin cache say
|
|
25550
|
+
what the query would have, so the update runs from them; with neither, the
|
|
25551
|
+
failure stays a failure (#354), and a local source stays manual.
|
|
25552
|
+
"""
|
|
25553
|
+
label = "update-codex-from-disk:"
|
|
25554
|
+
upgrade = ["codex", "plugin", "marketplace", "upgrade", "keel-marketplace"]
|
|
25555
|
+
add = ["codex", "plugin", "add", "keel@keel-marketplace"]
|
|
25556
|
+
with tempfile.TemporaryDirectory(prefix="keel-update-412-", ignore_cleanup_errors=True) as raw:
|
|
25557
|
+
tmp = Path(raw)
|
|
25558
|
+
fake = tmp / "fake.js"
|
|
25559
|
+
write_text(fake, UPDATE_FAKE)
|
|
25560
|
+
launchers = {}
|
|
25561
|
+
for host in ("npm", "claude", "codex"):
|
|
25562
|
+
launcher = tmp / f"fake-{host}"
|
|
25563
|
+
write_text(launcher, f'#!/bin/sh\nFAKE_HOST={host} exec node "{fake}" "$@"\n')
|
|
25564
|
+
launcher.chmod(0o755)
|
|
25565
|
+
launchers[host] = launcher
|
|
25566
|
+
|
|
25567
|
+
def update(source_type: str | None):
|
|
25568
|
+
codex_home = tmp / f"codex-home-{source_type}"
|
|
25569
|
+
if codex_home.exists():
|
|
25570
|
+
shutil.rmtree(codex_home)
|
|
25571
|
+
cache = codex_home / "plugins/cache/keel-marketplace/keel"
|
|
25572
|
+
write_text(cache / "5.0.0/hooks/codex.json", "{}\n")
|
|
25573
|
+
if source_type:
|
|
25574
|
+
write_text(codex_home / "config.toml",
|
|
25575
|
+
"[features]\nx = true\n\n[marketplaces.keel-marketplace]\n"
|
|
25576
|
+
f'source_type = "{source_type}"\n'
|
|
25577
|
+
'source = "https://github.com/TanglmChris/keel.git"\n\n[other]\ny = 1\n')
|
|
25578
|
+
log, state = tmp / "log.jsonl", tmp / "state.json"
|
|
25579
|
+
for stale in (log, state):
|
|
25580
|
+
if stale.exists():
|
|
25581
|
+
stale.unlink()
|
|
25582
|
+
log.write_text("")
|
|
25583
|
+
env = dict(os.environ)
|
|
25584
|
+
env.update({
|
|
25585
|
+
"KEEL_UPDATE_NPM": str(launchers["npm"]), "KEEL_UPDATE_CLAUDE": str(launchers["claude"]),
|
|
25586
|
+
"KEEL_UPDATE_CODEX": str(launchers["codex"]), "CODEX_HOME": str(codex_home),
|
|
25587
|
+
"KEEL_UPDATE_QUERY_TIMEOUT_MS": "2000", "FAKE_LIST_SLEEP_CODEX": "15",
|
|
25588
|
+
"FAKE_LOG": str(log), "FAKE_STATE": str(state), "FAKE_CODEX_SOURCE": str(tmp / "codex-source"),
|
|
25589
|
+
"FAKE_CODEX_CACHE": str(cache),
|
|
25590
|
+
})
|
|
25591
|
+
env.pop("KEEL_UPDATE_SOURCE", None)
|
|
25592
|
+
result = subprocess.run(["node", str(ROOT / "bin/keel.js"), "--update"], cwd=tmp, env=env,
|
|
25593
|
+
text=True, capture_output=True, check=False, timeout=120)
|
|
25594
|
+
calls = [json.loads(line) for line in log.read_text().splitlines() if line.strip()]
|
|
25595
|
+
line = next((l for l in result.stdout.splitlines() if l.startswith("keel update: codex plugin:")), "")
|
|
25596
|
+
return result, calls, line, cache
|
|
25597
|
+
|
|
25598
|
+
result, calls, line, cache = update("git")
|
|
25599
|
+
for args in (upgrade, add):
|
|
25600
|
+
runs = sum(1 for c in calls if c[:len(args)] == args)
|
|
25601
|
+
if runs != 1:
|
|
25602
|
+
report(f"{label} with a git marketplace on disk, {' '.join(args)} ran {runs} time(s), not 1: {line!r}")
|
|
25603
|
+
return 1
|
|
25604
|
+
for needle in ("5.0.0 -> 5.1.0", "did not answer", str(cache)):
|
|
25605
|
+
if needle not in line:
|
|
25606
|
+
report(f"{label} the Codex line does not name {needle!r}: {line!r}")
|
|
25607
|
+
return 1
|
|
25608
|
+
if result.returncode != 0:
|
|
25609
|
+
report(f"{label} an update carried from disk exited {result.returncode}: {result.stdout!r}")
|
|
25610
|
+
return 1
|
|
25611
|
+
|
|
25612
|
+
_, calls, line, _ = update("local")
|
|
25613
|
+
if "manual" not in line:
|
|
25614
|
+
report(f"{label} a local marketplace on disk does not read manual: {line!r}")
|
|
25615
|
+
return 1
|
|
25616
|
+
if any(c[:len(upgrade)] == upgrade for c in calls):
|
|
25617
|
+
report(f"{label} a local marketplace on disk was upgraded: {calls!r}")
|
|
25618
|
+
return 1
|
|
25619
|
+
|
|
25620
|
+
result, calls, line, _ = update(None)
|
|
25621
|
+
if "failed" not in line or "absent" in line:
|
|
25622
|
+
report(f"{label} with no config on disk the Codex line does not read failed: {line!r}")
|
|
25623
|
+
return 1
|
|
25624
|
+
if any(c[:2] == ["codex", "plugin"] and c[2:3] != ["list"] for c in calls):
|
|
25625
|
+
report(f"{label} with no config on disk a Codex update command ran: {calls!r}")
|
|
25626
|
+
return 1
|
|
25627
|
+
if label.rstrip(":") not in {name for name, _ in SCENARIOS}:
|
|
25628
|
+
report(f"{label} the scenario registry does not include it.")
|
|
25629
|
+
return 1
|
|
25630
|
+
report("update-codex-from-disk scenario passed.")
|
|
25631
|
+
return 0
|
|
25632
|
+
|
|
25633
|
+
|
|
25535
25634
|
def validate_update_claude_refresh_retry_scenario() -> int:
|
|
25536
25635
|
"""Issue #359: the Claude marketplace refresh failed once and passed on a direct retry.
|
|
25537
25636
|
|
|
@@ -41101,6 +41200,7 @@ SCENARIOS: tuple = (
|
|
|
41101
41200
|
("update-host-query-retry", validate_update_host_query_retry_scenario),
|
|
41102
41201
|
("update-claude-refresh-retry", validate_update_claude_refresh_retry_scenario),
|
|
41103
41202
|
("update-host-query-timeout", validate_update_host_query_timeout_scenario),
|
|
41203
|
+
("update-codex-from-disk", validate_update_codex_from_disk_scenario),
|
|
41104
41204
|
("refresh-covers-every-target", validate_refresh_covers_every_target_scenario),
|
|
41105
41205
|
("directory-branch-advances", validate_directory_branch_advances_scenario),
|
|
41106
41206
|
("release-notes-name-the-directory-branch", validate_release_notes_name_the_directory_branch_scenario),
|