@christang/keel 5.89.1 → 5.90.1

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
@@ -68,9 +68,9 @@ anything left for you; [docs/updating.md](docs/updating.md) has the details and
68
68
  with a running session. To opt out, set that entry's `autoUpdate` to
69
69
  `false`; Keel keeps a value the project states, and `keel --doctor` reports which one is declared.
70
70
 
71
- Each release's notes also carry the entry Anthropic's official plugin directory would list for it,
72
- pinned to the commit the release tag points at. The directory takes the same tagged tree this
73
- marketplace installs.
71
+ Anthropic's plugin directory lists Keel as `keel-openspec`. Each release commits the npm package's
72
+ files, with the manifest renamed and an icon, to the `claude-directory` branch, which the directory
73
+ tracks. The plugin installed from this marketplace keeps the name `keel`.
74
74
 
75
75
  **Codex, and your own terminal** — install the CLI as well (it also installs the bundled
76
76
  OpenSpec CLI):
package/README.zh-CN.md CHANGED
@@ -56,8 +56,8 @@ claude plugin install keel@keel-marketplace
56
56
  变了什么、何时生效、还剩什么要你做;细节和各宿主对运行中会话的行为见 [docs/updating.md](docs/updating.md)。
57
57
  不想自动更新,就把那一项的 `autoUpdate` 设为 `false`;项目写明的值 Keel 会保留,`keel --doctor` 会报告当前声明的是哪一个。
58
58
 
59
- 每个版本的 release notes 里还附有 Anthropic 官方插件目录对应的条目,锁定到该版本 tag 指向的 commit。
60
- 官方目录装到的就是这个 marketplace 装的同一棵带 tag 的树。
59
+ Anthropic 的插件目录里,Keel 以 `keel-openspec` 列出。每次发版都会把 npm 包的文件(清单改名、带图标)提交到
60
+ `claude-directory` 分支,目录跟踪这个分支。从本 marketplace 安装的插件仍叫 `keel`。
61
61
 
62
62
  **Codex,以及你自己的终端** —— 另外装一份 CLI(同时装上捆绑的 OpenSpec CLI):
63
63
 
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.89.1 -->
1
+ <!-- keel:start version=5.90.1 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the only durable authority — never native memory, goals, or transcripts.
Binary file
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.89.1",
3
+ "version": "5.90.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.89.1",
9
+ "version": "5.90.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@fission-ai/openspec": "^1.4.1"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@christang/keel",
3
3
  "displayName": "Keel",
4
4
  "description": "Keel OpenSpec execution discipline CLI for Claude Code, Codex, and OpenCode.",
5
- "version": "5.89.1",
5
+ "version": "5.90.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.89.1",
3
+ "version": "5.90.1",
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.89.1",
3
+ "version": "5.90.1",
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",
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // Advances the branch Anthropic's plugin directory tracks (#175).
5
+ //
6
+ // The directory follows a branch of the repository, picking up and scanning
7
+ // each new commit, so a release publishes to it by committing the directory
8
+ // tree (scripts/directory_tree.js) as the next commit of `claude-directory`
9
+ // on `origin` and pushing. The branch is started as an orphan the first time.
10
+ // A tree identical to the branch head commits nothing, so re-running a
11
+ // release adds no commit. Prints the branch head it leaves.
12
+ //
13
+ // Run from the repository whose `origin` receives the branch; the tree is
14
+ // built from the package this script belongs to unless `--tree` names one.
15
+ //
16
+ // Usage:
17
+ // node scripts/directory_branch.js <X.Y.Z> <40-hex sha> [--tree <dir>] [--no-push]
18
+
19
+ const fs = require("fs");
20
+ const os = require("os");
21
+ const path = require("path");
22
+ const { spawnSync } = require("child_process");
23
+ const { build } = require("./directory_tree");
24
+
25
+ const BRANCH = "claude-directory";
26
+ const IDENTITY = [
27
+ "-c", "user.name=github-actions[bot]",
28
+ "-c", "user.email=41898282+github-actions[bot]@users.noreply.github.com",
29
+ ];
30
+
31
+ function fail(message) {
32
+ process.stderr.write(`directory-branch: ${message}\n`);
33
+ process.exit(1);
34
+ }
35
+
36
+ function git(cwd, args, { allowFailure = false } = {}) {
37
+ const result = spawnSync("git", args, { cwd, encoding: "utf8" });
38
+ if (!allowFailure && (result.error || result.status !== 0)) {
39
+ fail(`git ${args.join(" ")} failed: ${result.error ? result.error.message : result.stderr.trim()}`);
40
+ }
41
+ return result;
42
+ }
43
+
44
+ function main() {
45
+ const args = process.argv.slice(2);
46
+ const [version, sha] = args;
47
+ if (!/^\d+\.\d+\.\d+$/.test(version || "") || !/^[0-9a-f]{40}$/.test(sha || "")) {
48
+ fail("usage: node scripts/directory_branch.js <X.Y.Z> <40-hex sha> [--tree <dir>] [--no-push]");
49
+ }
50
+ const treeIndex = args.indexOf("--tree");
51
+ const push = !args.includes("--no-push");
52
+ const repo = process.cwd();
53
+ const temp = fs.mkdtempSync(path.join(os.tmpdir(), "keel-directory-branch-"));
54
+ const worktree = path.join(temp, "branch");
55
+ try {
56
+ const tree = treeIndex >= 0 ? path.resolve(args[treeIndex + 1] || "") : build(path.join(temp, "tree"));
57
+ if (!fs.existsSync(path.join(tree, ".claude-plugin", "plugin.json"))) {
58
+ fail(`${tree} is not a directory tree`);
59
+ }
60
+ const remote = git(repo, ["ls-remote", "--heads", "origin", BRANCH]).stdout.trim();
61
+ if (remote) {
62
+ git(repo, ["fetch", "-q", "origin", `refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH}`]);
63
+ git(repo, ["worktree", "add", "-q", "--detach", worktree, `origin/${BRANCH}`]);
64
+ } else {
65
+ git(repo, ["worktree", "add", "-q", "--detach", worktree]);
66
+ git(worktree, ["checkout", "-q", "--orphan", BRANCH]);
67
+ }
68
+ // Replace the worktree's contents with the tree, keeping only `.git`.
69
+ for (const entry of fs.readdirSync(worktree)) {
70
+ if (entry !== ".git") fs.rmSync(path.join(worktree, entry), { recursive: true, force: true });
71
+ }
72
+ fs.cpSync(tree, worktree, { recursive: true });
73
+ git(worktree, ["add", "-A"]);
74
+ const unchanged = remote
75
+ && git(worktree, ["diff", "--cached", "--quiet"], { allowFailure: true }).status === 0;
76
+ if (!unchanged) {
77
+ git(worktree, [...IDENTITY, "commit", "-q", "-m", `keel-openspec ${version} from ${sha}`]);
78
+ if (push) git(worktree, ["push", "-q", "origin", `HEAD:refs/heads/${BRANCH}`]);
79
+ }
80
+ process.stdout.write(`${git(worktree, ["rev-parse", "HEAD"]).stdout.trim()}\n`);
81
+ } finally {
82
+ git(repo, ["worktree", "remove", "--force", worktree], { allowFailure: true });
83
+ fs.rmSync(temp, { recursive: true, force: true });
84
+ }
85
+ }
86
+
87
+ main();
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // The plugin tree Anthropic's plugin directory lists (#175).
5
+ //
6
+ // It is the npm package less the scripts only development uses, with the
7
+ // manifest renamed and given a homepage, plus an icon.
8
+ //
9
+ // The directory reads `.claude-plugin/plugin.json` from a branch of a GitHub
10
+ // repository and scans every file it finds there. The name `keel` belongs to
11
+ // another directory listing, and the whole repository is more than the
12
+ // directory scans, so the tree is the files the npm package publishes, which
13
+ // already form a complete plugin carrying its own CLI, plus the root manifest
14
+ // renamed `keel-openspec` and an icon. The repository's own manifest keeps
15
+ // `keel`, which is what marketplace installs use.
16
+ //
17
+ // Builds locally and submits nothing.
18
+ //
19
+ // Usage:
20
+ // node scripts/directory_tree.js <empty or absent output directory>
21
+
22
+ const fs = require("fs");
23
+ const os = require("os");
24
+ const path = require("path");
25
+ const { spawnSync } = require("child_process");
26
+
27
+ const ROOT = path.resolve(__dirname, "..");
28
+ const DIRECTORY_NAME = "keel-openspec";
29
+ const HOMEPAGE = "https://github.com/TanglmChris/keel";
30
+ // The scripts the shipped code runs. The rest of `scripts/` is for developing
31
+ // Keel — the test suite, the release helpers, this builder — and only adds
32
+ // files a reviewer must read for a plugin that never runs them.
33
+ const RUNTIME_SCRIPTS = new Set(["run_python.js", "install_to_repo.py"]);
34
+ const ICON = path.join(ROOT, "assets", "directory", "icon.png");
35
+
36
+ function fail(message) {
37
+ process.stderr.write(`directory-tree: ${message}\n`);
38
+ process.exit(1);
39
+ }
40
+
41
+ function run(command, args, options = {}) {
42
+ const result = spawnSync(command, args, {
43
+ encoding: "utf8",
44
+ shell: process.platform === "win32",
45
+ ...options,
46
+ });
47
+ if (result.error || result.status !== 0) {
48
+ fail(`${command} ${args.join(" ")} failed: ${result.error ? result.error.message : result.stderr}`);
49
+ }
50
+ return result.stdout;
51
+ }
52
+
53
+ function build(out) {
54
+ const target = path.resolve(out);
55
+ if (fs.existsSync(target) && fs.readdirSync(target).length > 0) {
56
+ fail(`${target} is not empty; build into an empty or absent directory.`);
57
+ }
58
+ const temp = fs.mkdtempSync(path.join(os.tmpdir(), "keel-directory-tree-"));
59
+ try {
60
+ const npm = process.platform === "win32" ? "npm.cmd" : "npm";
61
+ const packed = JSON.parse(run(npm, ["pack", "--json", "--pack-destination", temp], { cwd: ROOT }));
62
+ const tarball = path.join(temp, packed[0].filename);
63
+ run("tar", ["-xzf", tarball, "-C", temp]);
64
+ fs.mkdirSync(path.dirname(target), { recursive: true });
65
+ fs.cpSync(path.join(temp, "package"), target, { recursive: true });
66
+ } finally {
67
+ fs.rmSync(temp, { recursive: true, force: true });
68
+ }
69
+ for (const entry of fs.readdirSync(path.join(target, "scripts"))) {
70
+ if (!RUNTIME_SCRIPTS.has(entry)) {
71
+ fs.rmSync(path.join(target, "scripts", entry), { recursive: true, force: true });
72
+ }
73
+ }
74
+ const manifest = JSON.parse(
75
+ fs.readFileSync(path.join(ROOT, ".claude-plugin", "plugin.json"), "utf8")
76
+ );
77
+ manifest.name = DIRECTORY_NAME;
78
+ manifest.homepage = HOMEPAGE;
79
+ fs.mkdirSync(path.join(target, ".claude-plugin"), { recursive: true });
80
+ fs.writeFileSync(
81
+ path.join(target, ".claude-plugin", "plugin.json"),
82
+ `${JSON.stringify(manifest, null, 2)}\n`
83
+ );
84
+ fs.copyFileSync(ICON, path.join(target, ".claude-plugin", "icon.png"));
85
+ return target;
86
+ }
87
+
88
+ if (require.main === module) {
89
+ const [out] = process.argv.slice(2);
90
+ if (!out) fail("usage: node scripts/directory_tree.js <output directory>");
91
+ process.stdout.write(`${build(out)}\n`);
92
+ }
93
+
94
+ module.exports = { build, DIRECTORY_NAME };
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
47
47
  "scripts/validate_plugin.py",
48
48
  ]
49
49
 
50
- PACKAGE_VERSION = "5.89.1"
51
- PROTOCOL_VERSION = "5.89.1"
50
+ PACKAGE_VERSION = "5.90.1"
51
+ PROTOCOL_VERSION = "5.90.1"
52
52
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
53
53
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
54
54
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -19476,98 +19476,233 @@ def validate_refresh_covers_every_target_scenario() -> int:
19476
19476
  return 0
19477
19477
 
19478
19478
 
19479
- def validate_official_directory_entry_scenario() -> int:
19480
- """Each release states the entry Anthropic's official directory would list.
19479
+ def npm_pack_paths() -> set[str]:
19480
+ npm = "npm.cmd" if os.name == "nt" else "npm"
19481
+ packed = subprocess.run([npm, "pack", "--dry-run", "--json"], cwd=ROOT, text=True,
19482
+ capture_output=True, check=True)
19483
+ return {entry["path"] for entry in json.loads(packed.stdout)[0]["files"]}
19481
19484
 
19482
- The directory pins third-party plugins to a commit of a git repository, so
19483
- the entry is only useful pinned to the commit the release tag points at.
19484
- Keel prints it and submits nothing.
19485
+
19486
+ def png_side(path: Path) -> tuple[int, int] | None:
19487
+ data = path.read_bytes()[:24]
19488
+ if data[:8] != b"\x89PNG\r\n\x1a\n" or data[12:16] != b"IHDR":
19489
+ return None
19490
+ return int.from_bytes(data[16:20], "big"), int.from_bytes(data[20:24], "big")
19491
+
19492
+
19493
+ def validate_directory_tree_is_the_package_renamed_scenario() -> int:
19494
+ """Issue #175: the directory sees the npm package, named keel-openspec.
19495
+
19496
+ The name `keel` belongs to another directory listing, and the whole
19497
+ repository was too large to be scanned. The directory tree is therefore the
19498
+ files the npm package publishes plus a manifest renamed for the directory
19499
+ and an icon, while the repository's own manifest keeps `keel`.
19485
19500
  """
19486
- label = "official-directory-entry"
19487
- script = ROOT / "scripts/official_entry.js"
19488
- sha = "0123456789abcdef0123456789abcdef01234567"
19501
+ label = "directory-tree-is-the-package-renamed:"
19502
+ script = ROOT / "scripts/directory_tree.js"
19503
+ if not script.is_file():
19504
+ report(f"{label} scripts/directory_tree.js does not exist.")
19505
+ return 1
19506
+ with tempfile.TemporaryDirectory(prefix="keel-directory-tree-", ignore_cleanup_errors=True) as raw:
19507
+ tree = Path(raw) / "tree"
19508
+ built = subprocess.run(["node", str(script), str(tree)], cwd=ROOT, text=True,
19509
+ capture_output=True, check=False)
19510
+ if built.returncode != 0:
19511
+ report(f"{label} the build failed: {built.stdout}{built.stderr}")
19512
+ return 1
19513
+ files = {p.relative_to(tree).as_posix() for p in tree.rglob("*") if p.is_file()}
19514
+ runtime_scripts = {"scripts/run_python.js", "scripts/install_to_repo.py"}
19515
+ expected = {p for p in npm_pack_paths() if not p.startswith("scripts/") or p in runtime_scripts}
19516
+ expected |= {".claude-plugin/plugin.json", ".claude-plugin/icon.png"}
19517
+ if files != expected:
19518
+ report(f"{label} the tree is not the npm package less development scripts, plus the "
19519
+ f"manifest and icon: extra={sorted(files - expected)!r} missing={sorted(expected - files)!r}")
19520
+ return 1
19521
+ root_manifest = json.loads((ROOT / ".claude-plugin/plugin.json").read_text(encoding="utf-8"))
19522
+ manifest = json.loads((tree / ".claude-plugin/plugin.json").read_text(encoding="utf-8"))
19523
+ if manifest.get("name") != "keel-openspec":
19524
+ report(f"{label} the tree manifest is named {manifest.get('name')!r}, not keel-openspec.")
19525
+ return 1
19526
+ if manifest.get("homepage") != "https://github.com/TanglmChris/keel":
19527
+ report(f"{label} the tree manifest's homepage is {manifest.get('homepage')!r}.")
19528
+ return 1
19529
+ renamed = {k: v for k, v in manifest.items() if k not in ("name", "homepage")}
19530
+ if renamed != {k: v for k, v in root_manifest.items() if k not in ("name", "homepage")}:
19531
+ report(f"{label} the tree manifest differs from the root manifest beyond name and homepage.")
19532
+ return 1
19533
+ version = json.loads((ROOT / "package.json").read_text(encoding="utf-8"))["version"]
19534
+ cli = subprocess.run(["node", str(tree / "bin/keel.js"), "--version"], text=True,
19535
+ capture_output=True, check=False)
19536
+ if cli.returncode != 0:
19537
+ report(f"{label} the tree's CLI does not run: exit={cli.returncode} {cli.stderr}")
19538
+ return 1
19539
+ if version not in cli.stdout:
19540
+ report(f"{label} the tree's CLI reports {cli.stdout.strip()!r}, not {version}.")
19541
+ return 1
19542
+ consumer = Path(raw) / "consumer"
19543
+ consumer.mkdir()
19544
+ subprocess.run(["git", "init", "-q", str(consumer)], check=True)
19545
+ install = subprocess.run(["node", str(tree / "bin/keel.js"), "--install", "--target", "claude",
19546
+ "--dry-run"], cwd=consumer, text=True, capture_output=True, check=False)
19547
+ if install.returncode != 0:
19548
+ report(f"{label} the tree's CLI cannot plan an install: exit={install.returncode} "
19549
+ f"{install.stdout[-400:]}{install.stderr[-400:]}")
19550
+ return 1
19551
+ if root_manifest.get("name") != "keel":
19552
+ report(f"{label} the repository's root manifest no longer names keel: {root_manifest.get('name')!r}")
19553
+ return 1
19554
+ declared = list(manifest.get("skills", [])) + list(manifest.get("agents", []))
19555
+ for event in manifest.get("hooks", {}).values():
19556
+ for group in event:
19557
+ for hook in group.get("hooks", []):
19558
+ declared += [a.replace("${CLAUDE_PLUGIN_ROOT}/", "./") for a in hook.get("args", [])
19559
+ if "${CLAUDE_PLUGIN_ROOT}" in a]
19560
+ unresolved = [d for d in declared if not (tree / d).exists()]
19561
+ if unresolved:
19562
+ report(f"{label} manifest paths do not resolve inside the tree: {unresolved!r}")
19563
+ return 1
19564
+ icon = tree / ".claude-plugin/icon.png"
19565
+ side = png_side(icon)
19566
+ if side is None or side[0] != side[1] or not 512 <= side[0] <= 2048:
19567
+ report(f"{label} the icon is not a square PNG between 512 and 2048 px: {side!r}")
19568
+ return 1
19569
+ if icon.stat().st_size >= 2 * 1024 * 1024:
19570
+ report(f"{label} the icon is {icon.stat().st_size} bytes, not under 2 MB.")
19571
+ return 1
19572
+ again = subprocess.run(["node", str(script), str(tree)], cwd=ROOT, text=True,
19573
+ capture_output=True, check=False)
19574
+ if again.returncode == 0:
19575
+ report(f"{label} a build into a non-empty directory succeeded.")
19576
+ return 1
19489
19577
 
19490
- def run(*args: str) -> subprocess.CompletedProcess[str]:
19491
- return subprocess.run(
19492
- ["node", str(script), *args],
19493
- cwd=ROOT,
19494
- text=True,
19495
- encoding="utf-8",
19496
- errors="replace",
19497
- capture_output=True,
19498
- check=False,
19499
- )
19578
+ if "directory-tree-is-the-package-renamed" not in {name for name, _ in SCENARIOS}:
19579
+ report(f"{label} scenario is not registered.")
19580
+ return 1
19581
+ report("directory-tree-is-the-package-renamed scenario passed.")
19582
+ return 0
19500
19583
 
19501
- # M1 — the entry, pinned to the given commit.
19502
- printed = run("5.80.0", sha)
19503
- try:
19504
- entry = json.loads(printed.stdout) if printed.returncode == 0 else None
19505
- except ValueError:
19506
- entry = None
19507
- if not isinstance(entry, dict):
19508
- report(
19509
- f"{label} M1 printed no official directory entry: exit "
19510
- f"{printed.returncode}, {(printed.stderr or printed.stdout).strip()!r}"
19511
- )
19584
+
19585
+ def validate_directory_branch_advances_scenario() -> int:
19586
+ """Issue #175: each release advances the branch the directory tracks.
19587
+
19588
+ The directory follows a branch rather than a pinned commit, so the release
19589
+ job commits the directory tree to `claude-directory` and pushes it. A run
19590
+ with nothing new commits nothing, so a re-run of a release adds no noise.
19591
+ """
19592
+ label = "directory-branch-advances:"
19593
+ script = ROOT / "scripts/directory_branch.js"
19594
+ if not script.is_file():
19595
+ report(f"{label} scripts/directory_branch.js does not exist.")
19512
19596
  return 1
19513
- manifest = json.loads(
19514
- (ROOT / ".claude-plugin/plugin.json").read_text(encoding="utf-8")
19515
- )
19516
- want = {
19517
- "name": "keel",
19518
- "description": manifest.get("description"),
19519
- "category": "development",
19520
- "source": {"source": "url", "url": KEEL_REPOSITORY_GIT_URL, "sha": sha},
19521
- "homepage": "https://github.com/TanglmChris/keel",
19522
- }
19523
- if entry != want:
19524
- report(
19525
- f"{label} M1 printed an entry that is not the release's: "
19526
- f"{entry!r}, expected {want!r}"
19527
- )
19597
+ sha = "a" * 40
19598
+ with tempfile.TemporaryDirectory(prefix="keel-directory-branch-", ignore_cleanup_errors=True) as raw:
19599
+ base = Path(raw)
19600
+ origin = base / "origin.git"
19601
+ work = base / "work"
19602
+ subprocess.run(["git", "init", "-q", "--bare", str(origin)], check=True)
19603
+ subprocess.run(["git", "init", "-q", "-b", "main", str(work)], check=True)
19604
+ write_text(work / "README.md", "scratch\n")
19605
+ git = lambda *a: subprocess.run(["git", "-C", str(work), *a], text=True, capture_output=True, check=False)
19606
+ git("add", "-A")
19607
+ git("-c", "user.name=t", "-c", "user.email=t@example.invalid", "commit", "-qm", "init")
19608
+ git("remote", "add", "origin", str(origin))
19609
+ git("push", "-q", "origin", "main")
19610
+
19611
+ def run(*extra: str) -> subprocess.CompletedProcess[str]:
19612
+ return subprocess.run(["node", str(script), "9.9.9", sha, *extra], cwd=work, text=True,
19613
+ capture_output=True, check=False, timeout=180)
19614
+
19615
+ def branch_head() -> str:
19616
+ out = subprocess.run(["git", "-C", str(origin), "rev-parse", "--verify", "-q",
19617
+ "refs/heads/claude-directory"], text=True, capture_output=True)
19618
+ return out.stdout.strip()
19619
+
19620
+ first = run()
19621
+ head = branch_head()
19622
+ if first.returncode != 0 or not head:
19623
+ report(f"{label} the first run did not create origin's claude-directory: "
19624
+ f"exit={first.returncode} {first.stdout}{first.stderr}")
19625
+ return 1
19626
+ if head not in first.stdout:
19627
+ report(f"{label} the run did not print the commit it pushed ({head}): {first.stdout!r}")
19628
+ return 1
19629
+ show = lambda ref, path: subprocess.run(["git", "-C", str(origin), "show", f"{ref}:{path}"],
19630
+ text=True, capture_output=True).stdout
19631
+ message = subprocess.run(["git", "-C", str(origin), "log", "-1", "--format=%s", head],
19632
+ text=True, capture_output=True).stdout
19633
+ if "9.9.9" not in message or sha not in message:
19634
+ report(f"{label} the commit message does not name the version and sha: {message!r}")
19635
+ return 1
19636
+ if json.loads(show(head, ".claude-plugin/plugin.json") or "{}").get("name") != "keel-openspec":
19637
+ report(f"{label} the branch manifest does not name keel-openspec.")
19638
+ return 1
19639
+ listed = set(subprocess.run(["git", "-C", str(origin), "ls-tree", "-r", "--name-only", head],
19640
+ text=True, capture_output=True).stdout.split())
19641
+ reference = base / "reference"
19642
+ subprocess.run(["node", str(ROOT / "scripts/directory_tree.js"), str(reference)], check=True,
19643
+ capture_output=True)
19644
+ built = {p.relative_to(reference).as_posix() for p in reference.rglob("*") if p.is_file()}
19645
+ if listed != built:
19646
+ report(f"{label} the branch files differ from a directory_tree.js build: "
19647
+ f"extra={sorted(listed - built)!r} missing={sorted(built - listed)!r}")
19648
+ return 1
19649
+
19650
+ second = run()
19651
+ if second.returncode != 0 or branch_head() != head:
19652
+ report(f"{label} a run with an unchanged tree moved the branch: "
19653
+ f"exit={second.returncode} head={branch_head()} was {head}")
19654
+ return 1
19655
+
19656
+ changed = base / "changed"
19657
+ shutil.copytree(reference, changed)
19658
+ write_text(changed / "README.md", (changed / "README.md").read_text(encoding="utf-8") + "\nplanted\n")
19659
+ third = run("--tree", str(changed))
19660
+ new_head = branch_head()
19661
+ parent = subprocess.run(["git", "-C", str(origin), "rev-parse", f"{new_head}^"],
19662
+ text=True, capture_output=True).stdout.strip()
19663
+ if third.returncode != 0 or new_head == head or parent != head:
19664
+ report(f"{label} a changed package did not add exactly one commit on top: "
19665
+ f"exit={third.returncode} new={new_head} parent={parent} was {head}")
19666
+ return 1
19667
+
19668
+ if "directory-branch-advances" not in {name for name, _ in SCENARIOS}:
19669
+ report(f"{label} scenario is not registered.")
19528
19670
  return 1
19671
+ report("directory-branch-advances scenario passed.")
19672
+ return 0
19529
19673
 
19530
- # M2 — a pin the directory could not use is refused, and prints nothing a
19531
- # careless pipe could paste.
19532
- for args in (("5.80", sha), ("5.80.0", sha[:-1])):
19533
- refused = run(*args)
19534
- if refused.returncode == 0 or refused.stdout.strip():
19535
- report(
19536
- f"{label} M2 accepted a malformed pin {args!r}: exit "
19537
- f"{refused.returncode}, stdout {refused.stdout!r}"
19538
- )
19539
- return 1
19540
19674
 
19541
- # M3 — the release job appends the entry for the tag's commit to the notes
19542
- # before it creates the release.
19675
+ def validate_release_notes_name_the_directory_branch_scenario() -> int:
19676
+ """Issue #175: the release step advances the branch and names its commit.
19677
+
19678
+ The step replaces the pinned "Official directory entry", which described a
19679
+ commit the directory no longer reads.
19680
+ """
19681
+ label = "release-notes-name-the-directory-branch:"
19543
19682
  workflow = (ROOT / ".github/workflows/publish.yml").read_text(encoding="utf-8")
19544
- step = workflow[workflow.find("name: Tag and release the landed version"):]
19545
- create = step.find("gh release create")
19546
- append = step.find('node scripts/official_entry.js "$VERSION" "$SHA"')
19547
- if append < 0:
19548
- report(
19549
- f"{label} M3 release notes do not carry the official directory "
19550
- "entry: the release step never runs `node scripts/official_entry.js "
19551
- '"$VERSION" "$SHA"`.'
19552
- )
19683
+ start = workflow.find("- name: Tag and release the landed version")
19684
+ if start < 0:
19685
+ report(f"{label} the release step is missing from publish.yml.")
19553
19686
  return 1
19554
- if create < 0:
19555
- report(f"{label} M3 the release step no longer runs `gh release create`.")
19687
+ following = workflow.find("\n - name:", start + 1)
19688
+ step = workflow[start:] if following < 0 else workflow[start:following]
19689
+ if 'node scripts/directory_branch.js "$VERSION" "$SHA"' not in step:
19690
+ report(f"{label} the release step does not run scripts/directory_branch.js for the version and sha.")
19556
19691
  return 1
19557
- if create < append:
19558
- report(
19559
- f"{label} M3 the release step creates the release before it "
19560
- "writes the official directory entry, so the notes miss it."
19561
- )
19692
+ for needle in ("keel-openspec", "claude-directory"):
19693
+ if needle not in step:
19694
+ report(f"{label} the release notes written by the step do not name {needle}.")
19695
+ return 1
19696
+ if "official_entry.js" in workflow:
19697
+ report(f"{label} publish.yml still references official_entry.js.")
19562
19698
  return 1
19563
- if ">> notes.md" not in step[append:create]:
19564
- report(
19565
- f"{label} M3 the release step runs official_entry.js but does not "
19566
- "append its output to notes.md."
19567
- )
19699
+ if (ROOT / "scripts/official_entry.js").exists():
19700
+ report(f"{label} scripts/official_entry.js still exists.")
19568
19701
  return 1
19569
-
19570
- report(f"{label} scenario passed.")
19702
+ if "release-notes-name-the-directory-branch" not in {name for name, _ in SCENARIOS}:
19703
+ report(f"{label} scenario is not registered.")
19704
+ return 1
19705
+ report("release-notes-name-the-directory-branch scenario passed.")
19571
19706
  return 0
19572
19707
 
19573
19708
 
@@ -35358,7 +35493,9 @@ SCENARIOS: tuple = (
35358
35493
  ("adopted-update-is-silent-unless-reload", validate_adopted_update_is_silent_unless_reload_scenario),
35359
35494
  ("update-covers-installed-hosts", validate_update_covers_installed_hosts_scenario),
35360
35495
  ("refresh-covers-every-target", validate_refresh_covers_every_target_scenario),
35361
- ("official-directory-entry", validate_official_directory_entry_scenario),
35496
+ ("directory-branch-advances", validate_directory_branch_advances_scenario),
35497
+ ("release-notes-name-the-directory-branch", validate_release_notes_name_the_directory_branch_scenario),
35498
+ ("directory-tree-is-the-package-renamed", validate_directory_tree_is_the_package_renamed_scenario),
35362
35499
  ("init-declares-plugin-auto-update", validate_init_declares_plugin_auto_update_scenario),
35363
35500
  ("context-names-the-protocol-refresh", validate_context_names_the_protocol_refresh_scenario),
35364
35501
  ("init-never-downgrades-openspec", validate_init_never_downgrades_openspec_scenario),
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
-
4
- // The entry Anthropic's official plugin directory would list for a release.
5
- //
6
- // The directory pins every third-party plugin to a commit of its git
7
- // repository, so the entry is only useful pinned to the commit the release
8
- // tag points at. The release job appends this output to the release notes;
9
- // submitting it, or asking the directory to move its pin, is the owner's act.
10
- // This script reads the root manifest and nothing else, and runs nothing.
11
- //
12
- // Usage:
13
- // node scripts/official_entry.js <X.Y.Z> <40-character commit sha>
14
-
15
- const fs = require("fs");
16
- const path = require("path");
17
-
18
- const ROOT = path.resolve(__dirname, "..");
19
- const REPOSITORY = "https://github.com/TanglmChris/keel";
20
-
21
- const [version, sha] = process.argv.slice(2);
22
- // A pin the directory could not use prints nothing, so a pipe into the notes
23
- // cannot carry a half-formed entry.
24
- if (!/^\d+\.\d+\.\d+$/.test(version || "") || !/^[0-9a-f]{40}$/.test(sha || "")) {
25
- process.stderr.write(
26
- "official-entry: usage: node scripts/official_entry.js <X.Y.Z> <40-hex commit sha>\n"
27
- );
28
- process.exit(1);
29
- }
30
- const manifest = JSON.parse(
31
- fs.readFileSync(path.join(ROOT, ".claude-plugin", "plugin.json"), "utf8")
32
- );
33
- const entry = {
34
- name: manifest.name,
35
- description: manifest.description,
36
- category: "development",
37
- source: { source: "url", url: `${REPOSITORY}.git`, sha },
38
- homepage: REPOSITORY,
39
- };
40
- process.stdout.write(`${JSON.stringify(entry, null, 2)}\n`);