@christang/keel 5.89.1 → 5.90.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 +3 -3
- package/README.zh-CN.md +2 -2
- package/assets/bootstrap/AGENTS.md +1 -1
- package/assets/directory/icon.png +0 -0
- 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/directory_branch.js +87 -0
- package/scripts/directory_tree.js +80 -0
- package/scripts/validate_plugin.py +195 -82
- package/scripts/official_entry.js +0 -40
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
|
-
|
|
72
|
-
|
|
73
|
-
marketplace
|
|
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
|
-
|
|
60
|
-
|
|
59
|
+
Anthropic 的插件目录里,Keel 以 `keel-openspec` 列出。每次发版都会把 npm 包的文件(清单改名、带图标)提交到
|
|
60
|
+
`claude-directory` 分支,目录跟踪这个分支。从本 marketplace 安装的插件仍叫 `keel`。
|
|
61
61
|
|
|
62
62
|
**Codex,以及你自己的终端** —— 另外装一份 CLI(同时装上捆绑的 OpenSpec CLI):
|
|
63
63
|
|
|
Binary file
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.90.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.90.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.90.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.90.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",
|
|
@@ -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,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// The plugin tree Anthropic's plugin directory lists (#175).
|
|
5
|
+
//
|
|
6
|
+
// The directory reads `.claude-plugin/plugin.json` from a branch of a GitHub
|
|
7
|
+
// repository and scans every file it finds there. The name `keel` belongs to
|
|
8
|
+
// another directory listing, and the whole repository is more than the
|
|
9
|
+
// directory scans, so the tree is the files the npm package publishes, which
|
|
10
|
+
// already form a complete plugin carrying its own CLI, plus the root manifest
|
|
11
|
+
// renamed `keel-openspec` and an icon. The repository's own manifest keeps
|
|
12
|
+
// `keel`, which is what marketplace installs use.
|
|
13
|
+
//
|
|
14
|
+
// Builds locally and submits nothing.
|
|
15
|
+
//
|
|
16
|
+
// Usage:
|
|
17
|
+
// node scripts/directory_tree.js <empty or absent output directory>
|
|
18
|
+
|
|
19
|
+
const fs = require("fs");
|
|
20
|
+
const os = require("os");
|
|
21
|
+
const path = require("path");
|
|
22
|
+
const { spawnSync } = require("child_process");
|
|
23
|
+
|
|
24
|
+
const ROOT = path.resolve(__dirname, "..");
|
|
25
|
+
const DIRECTORY_NAME = "keel-openspec";
|
|
26
|
+
const ICON = path.join(ROOT, "assets", "directory", "icon.png");
|
|
27
|
+
|
|
28
|
+
function fail(message) {
|
|
29
|
+
process.stderr.write(`directory-tree: ${message}\n`);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function run(command, args, options = {}) {
|
|
34
|
+
const result = spawnSync(command, args, {
|
|
35
|
+
encoding: "utf8",
|
|
36
|
+
shell: process.platform === "win32",
|
|
37
|
+
...options,
|
|
38
|
+
});
|
|
39
|
+
if (result.error || result.status !== 0) {
|
|
40
|
+
fail(`${command} ${args.join(" ")} failed: ${result.error ? result.error.message : result.stderr}`);
|
|
41
|
+
}
|
|
42
|
+
return result.stdout;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function build(out) {
|
|
46
|
+
const target = path.resolve(out);
|
|
47
|
+
if (fs.existsSync(target) && fs.readdirSync(target).length > 0) {
|
|
48
|
+
fail(`${target} is not empty; build into an empty or absent directory.`);
|
|
49
|
+
}
|
|
50
|
+
const temp = fs.mkdtempSync(path.join(os.tmpdir(), "keel-directory-tree-"));
|
|
51
|
+
try {
|
|
52
|
+
const npm = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
53
|
+
const packed = JSON.parse(run(npm, ["pack", "--json", "--pack-destination", temp], { cwd: ROOT }));
|
|
54
|
+
const tarball = path.join(temp, packed[0].filename);
|
|
55
|
+
run("tar", ["-xzf", tarball, "-C", temp]);
|
|
56
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
57
|
+
fs.cpSync(path.join(temp, "package"), target, { recursive: true });
|
|
58
|
+
} finally {
|
|
59
|
+
fs.rmSync(temp, { recursive: true, force: true });
|
|
60
|
+
}
|
|
61
|
+
const manifest = JSON.parse(
|
|
62
|
+
fs.readFileSync(path.join(ROOT, ".claude-plugin", "plugin.json"), "utf8")
|
|
63
|
+
);
|
|
64
|
+
manifest.name = DIRECTORY_NAME;
|
|
65
|
+
fs.mkdirSync(path.join(target, ".claude-plugin"), { recursive: true });
|
|
66
|
+
fs.writeFileSync(
|
|
67
|
+
path.join(target, ".claude-plugin", "plugin.json"),
|
|
68
|
+
`${JSON.stringify(manifest, null, 2)}\n`
|
|
69
|
+
);
|
|
70
|
+
fs.copyFileSync(ICON, path.join(target, ".claude-plugin", "icon.png"));
|
|
71
|
+
return target;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (require.main === module) {
|
|
75
|
+
const [out] = process.argv.slice(2);
|
|
76
|
+
if (!out) fail("usage: node scripts/directory_tree.js <output directory>");
|
|
77
|
+
process.stdout.write(`${build(out)}\n`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
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.
|
|
51
|
-
PROTOCOL_VERSION = "5.
|
|
50
|
+
PACKAGE_VERSION = "5.90.0"
|
|
51
|
+
PROTOCOL_VERSION = "5.90.0"
|
|
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,209 @@ def validate_refresh_covers_every_target_scenario() -> int:
|
|
|
19476
19476
|
return 0
|
|
19477
19477
|
|
|
19478
19478
|
|
|
19479
|
-
def
|
|
19480
|
-
""
|
|
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
|
-
|
|
19483
|
-
|
|
19484
|
-
|
|
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 = "
|
|
19487
|
-
script = ROOT / "scripts/
|
|
19488
|
-
|
|
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
|
+
expected = npm_pack_paths() | {".claude-plugin/plugin.json", ".claude-plugin/icon.png"}
|
|
19515
|
+
if files != expected:
|
|
19516
|
+
report(f"{label} the tree is not the npm package plus the manifest and icon: "
|
|
19517
|
+
f"extra={sorted(files - expected)!r} missing={sorted(expected - files)!r}")
|
|
19518
|
+
return 1
|
|
19519
|
+
root_manifest = json.loads((ROOT / ".claude-plugin/plugin.json").read_text(encoding="utf-8"))
|
|
19520
|
+
manifest = json.loads((tree / ".claude-plugin/plugin.json").read_text(encoding="utf-8"))
|
|
19521
|
+
if manifest.get("name") != "keel-openspec":
|
|
19522
|
+
report(f"{label} the tree manifest is named {manifest.get('name')!r}, not keel-openspec.")
|
|
19523
|
+
return 1
|
|
19524
|
+
if {k: v for k, v in manifest.items() if k != "name"} != {k: v for k, v in root_manifest.items() if k != "name"}:
|
|
19525
|
+
report(f"{label} the tree manifest differs from the root manifest beyond its name.")
|
|
19526
|
+
return 1
|
|
19527
|
+
if root_manifest.get("name") != "keel":
|
|
19528
|
+
report(f"{label} the repository's root manifest no longer names keel: {root_manifest.get('name')!r}")
|
|
19529
|
+
return 1
|
|
19530
|
+
declared = list(manifest.get("skills", [])) + list(manifest.get("agents", []))
|
|
19531
|
+
for event in manifest.get("hooks", {}).values():
|
|
19532
|
+
for group in event:
|
|
19533
|
+
for hook in group.get("hooks", []):
|
|
19534
|
+
declared += [a.replace("${CLAUDE_PLUGIN_ROOT}/", "./") for a in hook.get("args", [])
|
|
19535
|
+
if "${CLAUDE_PLUGIN_ROOT}" in a]
|
|
19536
|
+
unresolved = [d for d in declared if not (tree / d).exists()]
|
|
19537
|
+
if unresolved:
|
|
19538
|
+
report(f"{label} manifest paths do not resolve inside the tree: {unresolved!r}")
|
|
19539
|
+
return 1
|
|
19540
|
+
icon = tree / ".claude-plugin/icon.png"
|
|
19541
|
+
side = png_side(icon)
|
|
19542
|
+
if side is None or side[0] != side[1] or not 512 <= side[0] <= 2048:
|
|
19543
|
+
report(f"{label} the icon is not a square PNG between 512 and 2048 px: {side!r}")
|
|
19544
|
+
return 1
|
|
19545
|
+
if icon.stat().st_size >= 2 * 1024 * 1024:
|
|
19546
|
+
report(f"{label} the icon is {icon.stat().st_size} bytes, not under 2 MB.")
|
|
19547
|
+
return 1
|
|
19548
|
+
again = subprocess.run(["node", str(script), str(tree)], cwd=ROOT, text=True,
|
|
19549
|
+
capture_output=True, check=False)
|
|
19550
|
+
if again.returncode == 0:
|
|
19551
|
+
report(f"{label} a build into a non-empty directory succeeded.")
|
|
19552
|
+
return 1
|
|
19553
|
+
|
|
19554
|
+
if "directory-tree-is-the-package-renamed" not in {name for name, _ in SCENARIOS}:
|
|
19555
|
+
report(f"{label} scenario is not registered.")
|
|
19556
|
+
return 1
|
|
19557
|
+
report("directory-tree-is-the-package-renamed scenario passed.")
|
|
19558
|
+
return 0
|
|
19489
19559
|
|
|
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
|
-
)
|
|
19500
19560
|
|
|
19501
|
-
|
|
19502
|
-
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
)
|
|
19561
|
+
def validate_directory_branch_advances_scenario() -> int:
|
|
19562
|
+
"""Issue #175: each release advances the branch the directory tracks.
|
|
19563
|
+
|
|
19564
|
+
The directory follows a branch rather than a pinned commit, so the release
|
|
19565
|
+
job commits the directory tree to `claude-directory` and pushes it. A run
|
|
19566
|
+
with nothing new commits nothing, so a re-run of a release adds no noise.
|
|
19567
|
+
"""
|
|
19568
|
+
label = "directory-branch-advances:"
|
|
19569
|
+
script = ROOT / "scripts/directory_branch.js"
|
|
19570
|
+
if not script.is_file():
|
|
19571
|
+
report(f"{label} scripts/directory_branch.js does not exist.")
|
|
19512
19572
|
return 1
|
|
19513
|
-
|
|
19514
|
-
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
"
|
|
19519
|
-
"
|
|
19520
|
-
|
|
19521
|
-
"
|
|
19522
|
-
|
|
19523
|
-
|
|
19524
|
-
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
)
|
|
19573
|
+
sha = "a" * 40
|
|
19574
|
+
with tempfile.TemporaryDirectory(prefix="keel-directory-branch-", ignore_cleanup_errors=True) as raw:
|
|
19575
|
+
base = Path(raw)
|
|
19576
|
+
origin = base / "origin.git"
|
|
19577
|
+
work = base / "work"
|
|
19578
|
+
subprocess.run(["git", "init", "-q", "--bare", str(origin)], check=True)
|
|
19579
|
+
subprocess.run(["git", "init", "-q", "-b", "main", str(work)], check=True)
|
|
19580
|
+
write_text(work / "README.md", "scratch\n")
|
|
19581
|
+
git = lambda *a: subprocess.run(["git", "-C", str(work), *a], text=True, capture_output=True, check=False)
|
|
19582
|
+
git("add", "-A")
|
|
19583
|
+
git("-c", "user.name=t", "-c", "user.email=t@example.invalid", "commit", "-qm", "init")
|
|
19584
|
+
git("remote", "add", "origin", str(origin))
|
|
19585
|
+
git("push", "-q", "origin", "main")
|
|
19586
|
+
|
|
19587
|
+
def run(*extra: str) -> subprocess.CompletedProcess[str]:
|
|
19588
|
+
return subprocess.run(["node", str(script), "9.9.9", sha, *extra], cwd=work, text=True,
|
|
19589
|
+
capture_output=True, check=False, timeout=180)
|
|
19590
|
+
|
|
19591
|
+
def branch_head() -> str:
|
|
19592
|
+
out = subprocess.run(["git", "-C", str(origin), "rev-parse", "--verify", "-q",
|
|
19593
|
+
"refs/heads/claude-directory"], text=True, capture_output=True)
|
|
19594
|
+
return out.stdout.strip()
|
|
19595
|
+
|
|
19596
|
+
first = run()
|
|
19597
|
+
head = branch_head()
|
|
19598
|
+
if first.returncode != 0 or not head:
|
|
19599
|
+
report(f"{label} the first run did not create origin's claude-directory: "
|
|
19600
|
+
f"exit={first.returncode} {first.stdout}{first.stderr}")
|
|
19601
|
+
return 1
|
|
19602
|
+
if head not in first.stdout:
|
|
19603
|
+
report(f"{label} the run did not print the commit it pushed ({head}): {first.stdout!r}")
|
|
19604
|
+
return 1
|
|
19605
|
+
show = lambda ref, path: subprocess.run(["git", "-C", str(origin), "show", f"{ref}:{path}"],
|
|
19606
|
+
text=True, capture_output=True).stdout
|
|
19607
|
+
message = subprocess.run(["git", "-C", str(origin), "log", "-1", "--format=%s", head],
|
|
19608
|
+
text=True, capture_output=True).stdout
|
|
19609
|
+
if "9.9.9" not in message or sha not in message:
|
|
19610
|
+
report(f"{label} the commit message does not name the version and sha: {message!r}")
|
|
19611
|
+
return 1
|
|
19612
|
+
if json.loads(show(head, ".claude-plugin/plugin.json") or "{}").get("name") != "keel-openspec":
|
|
19613
|
+
report(f"{label} the branch manifest does not name keel-openspec.")
|
|
19614
|
+
return 1
|
|
19615
|
+
listed = set(subprocess.run(["git", "-C", str(origin), "ls-tree", "-r", "--name-only", head],
|
|
19616
|
+
text=True, capture_output=True).stdout.split())
|
|
19617
|
+
reference = base / "reference"
|
|
19618
|
+
subprocess.run(["node", str(ROOT / "scripts/directory_tree.js"), str(reference)], check=True,
|
|
19619
|
+
capture_output=True)
|
|
19620
|
+
built = {p.relative_to(reference).as_posix() for p in reference.rglob("*") if p.is_file()}
|
|
19621
|
+
if listed != built:
|
|
19622
|
+
report(f"{label} the branch files differ from a directory_tree.js build: "
|
|
19623
|
+
f"extra={sorted(listed - built)!r} missing={sorted(built - listed)!r}")
|
|
19624
|
+
return 1
|
|
19625
|
+
|
|
19626
|
+
second = run()
|
|
19627
|
+
if second.returncode != 0 or branch_head() != head:
|
|
19628
|
+
report(f"{label} a run with an unchanged tree moved the branch: "
|
|
19629
|
+
f"exit={second.returncode} head={branch_head()} was {head}")
|
|
19630
|
+
return 1
|
|
19631
|
+
|
|
19632
|
+
changed = base / "changed"
|
|
19633
|
+
shutil.copytree(reference, changed)
|
|
19634
|
+
write_text(changed / "README.md", (changed / "README.md").read_text(encoding="utf-8") + "\nplanted\n")
|
|
19635
|
+
third = run("--tree", str(changed))
|
|
19636
|
+
new_head = branch_head()
|
|
19637
|
+
parent = subprocess.run(["git", "-C", str(origin), "rev-parse", f"{new_head}^"],
|
|
19638
|
+
text=True, capture_output=True).stdout.strip()
|
|
19639
|
+
if third.returncode != 0 or new_head == head or parent != head:
|
|
19640
|
+
report(f"{label} a changed package did not add exactly one commit on top: "
|
|
19641
|
+
f"exit={third.returncode} new={new_head} parent={parent} was {head}")
|
|
19642
|
+
return 1
|
|
19643
|
+
|
|
19644
|
+
if "directory-branch-advances" not in {name for name, _ in SCENARIOS}:
|
|
19645
|
+
report(f"{label} scenario is not registered.")
|
|
19528
19646
|
return 1
|
|
19647
|
+
report("directory-branch-advances scenario passed.")
|
|
19648
|
+
return 0
|
|
19529
19649
|
|
|
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
19650
|
|
|
19541
|
-
|
|
19542
|
-
#
|
|
19651
|
+
def validate_release_notes_name_the_directory_branch_scenario() -> int:
|
|
19652
|
+
"""Issue #175: the release step advances the branch and names its commit.
|
|
19653
|
+
|
|
19654
|
+
The step replaces the pinned "Official directory entry", which described a
|
|
19655
|
+
commit the directory no longer reads.
|
|
19656
|
+
"""
|
|
19657
|
+
label = "release-notes-name-the-directory-branch:"
|
|
19543
19658
|
workflow = (ROOT / ".github/workflows/publish.yml").read_text(encoding="utf-8")
|
|
19544
|
-
|
|
19545
|
-
|
|
19546
|
-
|
|
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
|
-
)
|
|
19659
|
+
start = workflow.find("- name: Tag and release the landed version")
|
|
19660
|
+
if start < 0:
|
|
19661
|
+
report(f"{label} the release step is missing from publish.yml.")
|
|
19553
19662
|
return 1
|
|
19554
|
-
|
|
19555
|
-
|
|
19663
|
+
following = workflow.find("\n - name:", start + 1)
|
|
19664
|
+
step = workflow[start:] if following < 0 else workflow[start:following]
|
|
19665
|
+
if 'node scripts/directory_branch.js "$VERSION" "$SHA"' not in step:
|
|
19666
|
+
report(f"{label} the release step does not run scripts/directory_branch.js for the version and sha.")
|
|
19556
19667
|
return 1
|
|
19557
|
-
|
|
19558
|
-
|
|
19559
|
-
f"{label}
|
|
19560
|
-
|
|
19561
|
-
|
|
19668
|
+
for needle in ("keel-openspec", "claude-directory"):
|
|
19669
|
+
if needle not in step:
|
|
19670
|
+
report(f"{label} the release notes written by the step do not name {needle}.")
|
|
19671
|
+
return 1
|
|
19672
|
+
if "official_entry.js" in workflow:
|
|
19673
|
+
report(f"{label} publish.yml still references official_entry.js.")
|
|
19562
19674
|
return 1
|
|
19563
|
-
if "
|
|
19564
|
-
report(
|
|
19565
|
-
f"{label} M3 the release step runs official_entry.js but does not "
|
|
19566
|
-
"append its output to notes.md."
|
|
19567
|
-
)
|
|
19675
|
+
if (ROOT / "scripts/official_entry.js").exists():
|
|
19676
|
+
report(f"{label} scripts/official_entry.js still exists.")
|
|
19568
19677
|
return 1
|
|
19569
|
-
|
|
19570
|
-
|
|
19678
|
+
if "release-notes-name-the-directory-branch" not in {name for name, _ in SCENARIOS}:
|
|
19679
|
+
report(f"{label} scenario is not registered.")
|
|
19680
|
+
return 1
|
|
19681
|
+
report("release-notes-name-the-directory-branch scenario passed.")
|
|
19571
19682
|
return 0
|
|
19572
19683
|
|
|
19573
19684
|
|
|
@@ -35358,7 +35469,9 @@ SCENARIOS: tuple = (
|
|
|
35358
35469
|
("adopted-update-is-silent-unless-reload", validate_adopted_update_is_silent_unless_reload_scenario),
|
|
35359
35470
|
("update-covers-installed-hosts", validate_update_covers_installed_hosts_scenario),
|
|
35360
35471
|
("refresh-covers-every-target", validate_refresh_covers_every_target_scenario),
|
|
35361
|
-
("
|
|
35472
|
+
("directory-branch-advances", validate_directory_branch_advances_scenario),
|
|
35473
|
+
("release-notes-name-the-directory-branch", validate_release_notes_name_the_directory_branch_scenario),
|
|
35474
|
+
("directory-tree-is-the-package-renamed", validate_directory_tree_is_the_package_renamed_scenario),
|
|
35362
35475
|
("init-declares-plugin-auto-update", validate_init_declares_plugin_auto_update_scenario),
|
|
35363
35476
|
("context-names-the-protocol-refresh", validate_context_names_the_protocol_refresh_scenario),
|
|
35364
35477
|
("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`);
|