@christang/keel 5.99.1 → 5.99.3
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/assets/bootstrap/AGENTS.md +1 -1
- 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 +64 -2
- package/src/core/agents.js +12 -6
- package/src/core/shift.js +8 -1
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.99.
|
|
3
|
+
"version": "5.99.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.99.
|
|
9
|
+
"version": "5.99.3",
|
|
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.99.
|
|
3
|
+
"version": "5.99.3",
|
|
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.99.
|
|
3
|
+
"version": "5.99.3",
|
|
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",
|
|
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
|
|
|
47
47
|
"scripts/validate_plugin.py",
|
|
48
48
|
]
|
|
49
49
|
|
|
50
|
-
PACKAGE_VERSION = "5.99.
|
|
51
|
-
PROTOCOL_VERSION = "5.99.
|
|
50
|
+
PACKAGE_VERSION = "5.99.3"
|
|
51
|
+
PROTOCOL_VERSION = "5.99.3"
|
|
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
|
|
@@ -4715,6 +4715,37 @@ def validate_shift_without_role_scenario() -> int:
|
|
|
4715
4715
|
report(f"{label} keel context still points to a note already resumed.")
|
|
4716
4716
|
return 1
|
|
4717
4717
|
|
|
4718
|
+
# Issue #261: `--file -` is stdin, and an unreadable file is a named refusal.
|
|
4719
|
+
missing = base / "missing-note.md"
|
|
4720
|
+
refused = run_keel(repo, "shift", "ready", "--file", str(missing), env=env)
|
|
4721
|
+
if re.search(r"^\s+at ", refused.stderr, re.M):
|
|
4722
|
+
report(f"{label} an unreadable --file escaped as an uncaught exception: {refused.stderr.strip()}")
|
|
4723
|
+
return 1
|
|
4724
|
+
if refused.returncode != 1:
|
|
4725
|
+
report(f"{label} an unreadable --file exited {refused.returncode}, not 1: {refused.stderr.strip()}")
|
|
4726
|
+
return 1
|
|
4727
|
+
if not refused.stderr.startswith("keel shift:"):
|
|
4728
|
+
report(f"{label} an unreadable --file was not refused as a keel shift error: {refused.stderr.strip()}")
|
|
4729
|
+
return 1
|
|
4730
|
+
if str(missing) not in refused.stderr:
|
|
4731
|
+
report(f"{label} the refusal of an unreadable --file does not name the path: {refused.stderr.strip()}")
|
|
4732
|
+
return 1
|
|
4733
|
+
piped = subprocess.run(
|
|
4734
|
+
["node", str(ROOT / "bin" / "keel.js"), "shift", "ready", "--file", "-"],
|
|
4735
|
+
cwd=repo, env=env, input="next: from stdin via --file -\n",
|
|
4736
|
+
text=True, encoding="utf-8", errors="replace", capture_output=True, check=False,
|
|
4737
|
+
)
|
|
4738
|
+
if piped.returncode != 0:
|
|
4739
|
+
report(f"{label} keel shift ready --file - failed: {piped.stderr.strip()}")
|
|
4740
|
+
return 1
|
|
4741
|
+
notes = list((common / "shift" / "worktree").glob("*.md"))
|
|
4742
|
+
if len(notes) != 1:
|
|
4743
|
+
report(f"{label} keel shift ready --file - kept {len(notes)} worktree notes, not one.")
|
|
4744
|
+
return 1
|
|
4745
|
+
if "from stdin via --file -" not in notes[0].read_text(encoding="utf-8"):
|
|
4746
|
+
report(f"{label} the note stored by keel shift ready --file - lacks the text given on stdin.")
|
|
4747
|
+
return 1
|
|
4748
|
+
|
|
4718
4749
|
for relative, needle in (("docs/shift-change.md", "no chat role"), ("docs/shift-change.zh-CN.md", "不绑定聊天角色")):
|
|
4719
4750
|
if needle not in (ROOT / relative).read_text(encoding="utf-8"):
|
|
4720
4751
|
report(f"{label} {relative} does not say a chat role is optional ({needle!r}).")
|
|
@@ -36679,6 +36710,37 @@ def validate_external_agent_brief_scenario() -> int:
|
|
|
36679
36710
|
if needle not in command:
|
|
36680
36711
|
report(f"{label} the implementation command does not name {needle!r}: {command}")
|
|
36681
36712
|
return 1
|
|
36713
|
+
# Issue #262: a helper worktree beside the session's, under .claude/worktrees/.
|
|
36714
|
+
session_tree = repo / ".claude" / "worktrees" / "review"
|
|
36715
|
+
helper_tree = repo / ".claude" / "worktrees" / "dsh_review"
|
|
36716
|
+
# A real project commits its external_agents: declaration, so worktrees carry it.
|
|
36717
|
+
for command in (["add", "-A"], ["-c", "user.email=k@example.com", "-c", "user.name=k",
|
|
36718
|
+
"commit", "-q", "-m", "declare external agents"]):
|
|
36719
|
+
subprocess.run(["git", *command], cwd=repo, check=True, capture_output=True)
|
|
36720
|
+
for tree in (session_tree, helper_tree):
|
|
36721
|
+
subprocess.run(["git", "worktree", "add", "-q", "--detach", str(tree)],
|
|
36722
|
+
cwd=repo, check=True, capture_output=True)
|
|
36723
|
+
|
|
36724
|
+
def helper_brief(cwd: Path) -> tuple[dict, str]:
|
|
36725
|
+
if prompt.exists():
|
|
36726
|
+
prompt.unlink()
|
|
36727
|
+
result = run_keel(cwd, "agents", "brief", "dsh", "--mode", "helper",
|
|
36728
|
+
"--dir", str(helper_tree), "--out", str(prompt),
|
|
36729
|
+
"--change", "demo", "--task", "1.1", "--json", env=env)
|
|
36730
|
+
try:
|
|
36731
|
+
return json.loads(result.stdout), result.stdout + result.stderr
|
|
36732
|
+
except json.JSONDecodeError:
|
|
36733
|
+
return {}, result.stdout + result.stderr
|
|
36734
|
+
|
|
36735
|
+
payload, out = helper_brief(session_tree)
|
|
36736
|
+
if payload.get("status") != "ready":
|
|
36737
|
+
report(f"{label} a helper worktree under .claude/worktrees/ was refused from a sibling worktree: "
|
|
36738
|
+
f"{out.strip()[:600]}")
|
|
36739
|
+
return 1
|
|
36740
|
+
payload, out = helper_brief(helper_tree)
|
|
36741
|
+
if not refused(payload, out, str(helper_tree.resolve()), "current directory", "--repo",
|
|
36742
|
+
what="a helper brief run from inside its own --dir"):
|
|
36743
|
+
return 1
|
|
36682
36744
|
if calls.exists():
|
|
36683
36745
|
report(f"{label} an agent was launched: {calls.read_text(encoding='utf-8').strip()}")
|
|
36684
36746
|
return 1
|
package/src/core/agents.js
CHANGED
|
@@ -341,7 +341,7 @@ function realpath(file) {
|
|
|
341
341
|
// git common directory. The host's write guard is a hook on the host's own tool
|
|
342
342
|
// calls, so a process the session launches writes past it; the checkout it runs
|
|
343
343
|
// in is then the only write boundary there is.
|
|
344
|
-
function worktreeRefusal(repo, dir) {
|
|
344
|
+
function worktreeRefusal(repo, dir, repoGiven) {
|
|
345
345
|
const top = git(dir, "rev-parse", "--show-toplevel");
|
|
346
346
|
const common = git(dir, "rev-parse", "--path-format=absolute", "--git-common-dir");
|
|
347
347
|
const ownTop = git(repo, "rev-parse", "--show-toplevel");
|
|
@@ -353,10 +353,14 @@ function worktreeRefusal(repo, dir) {
|
|
|
353
353
|
if (realpath(common) !== realpath(ownCommon)) {
|
|
354
354
|
return `--dir ${dir} belongs to a different repository. ${how}`;
|
|
355
355
|
}
|
|
356
|
+
// Keel cannot see the session's checkout, only the one it was pointed at
|
|
357
|
+
// (#262): name that one and how it was chosen, rather than claim the session's.
|
|
356
358
|
if (realpath(top) === realpath(ownTop)) {
|
|
359
|
+
const from = repoGiven ? "named by --repo" : "the one containing the current directory";
|
|
357
360
|
return (
|
|
358
|
-
`--dir ${dir} is
|
|
359
|
-
+
|
|
361
|
+
`--dir ${dir} is the checkout this command runs in, ${realpath(ownTop)} (${from}). `
|
|
362
|
+
+ "The write guard does not reach an external process, so it needs a separate worktree "
|
|
363
|
+
+ `of this repository. Run this from the session's own checkout, or pass --repo <it>. ${how}`
|
|
360
364
|
);
|
|
361
365
|
}
|
|
362
366
|
return null;
|
|
@@ -485,7 +489,7 @@ function compileBrief(repo, options) {
|
|
|
485
489
|
const dir = path.resolve(options.dir);
|
|
486
490
|
const needsWorktree = options.mode === "implementation" || !entry.sandbox.helper;
|
|
487
491
|
if (needsWorktree) {
|
|
488
|
-
const refusal = worktreeRefusal(repo, dir);
|
|
492
|
+
const refusal = worktreeRefusal(repo, dir, options.repoGiven);
|
|
489
493
|
if (refusal) {
|
|
490
494
|
const why = options.mode === "implementation" ? ""
|
|
491
495
|
: `${entry.name} offers no read-only sandbox, so even a helper run needs a separate worktree. `;
|
|
@@ -538,8 +542,10 @@ function runBrief(argv) {
|
|
|
538
542
|
for (let index = 0; index < argv.length; index += 1) {
|
|
539
543
|
const arg = argv[index];
|
|
540
544
|
if (arg === "--json") json = true;
|
|
541
|
-
else if (arg === "--repo")
|
|
542
|
-
|
|
545
|
+
else if (arg === "--repo") {
|
|
546
|
+
repo = argv[++index] || "";
|
|
547
|
+
options.repoGiven = true;
|
|
548
|
+
} else if (flags[arg]) options[flags[arg]] = argv[++index] || "";
|
|
543
549
|
else if (options.name === null && !arg.startsWith("-")) options.name = arg;
|
|
544
550
|
else {
|
|
545
551
|
process.stderr.write(`keel agents brief: unexpected argument ${arg}\n${BRIEF_USAGE}\n`);
|
package/src/core/shift.js
CHANGED
|
@@ -268,7 +268,14 @@ function request(where, role, text) {
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
function readNoteText(options) {
|
|
271
|
-
if (options.file)
|
|
271
|
+
if (options.file) {
|
|
272
|
+
// `-` is stdin, as without --file (D1); any other failure is named (D2).
|
|
273
|
+
try {
|
|
274
|
+
return fs.readFileSync(options.file === "-" ? 0 : options.file, "utf8");
|
|
275
|
+
} catch (error) {
|
|
276
|
+
throw new ShiftError(`Cannot read the shift note from --file ${options.file}: ${error.code || error.message}.`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
272
279
|
if (options.text) return options.text;
|
|
273
280
|
if (!process.stdin.isTTY) {
|
|
274
281
|
try {
|