@christang/keel 5.99.0 → 5.99.2
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/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.99.
|
|
3
|
+
"version": "5.99.2",
|
|
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.2",
|
|
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.2",
|
|
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.2",
|
|
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.2"
|
|
51
|
+
PROTOCOL_VERSION = "5.99.2"
|
|
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
|
|
@@ -4516,7 +4516,14 @@ def validate_shift_change_scenario() -> int:
|
|
|
4516
4516
|
subprocess.run(["git", "add", "pushed-not.txt"], cwd=verify, check=True)
|
|
4517
4517
|
subprocess.run(["git", "commit", "-q", "-m", "local only"], cwd=verify, check=True)
|
|
4518
4518
|
write_text(verify / "keel" / "guard.json", "{}\n")
|
|
4519
|
-
|
|
4519
|
+
# A Claude scratchpad of a session started in verify, and one of a
|
|
4520
|
+
# session started elsewhere (shift-temp-owner D1).
|
|
4521
|
+
scratch = Path(tempfile.gettempdir()) / f"claude-{os.getuid()}"
|
|
4522
|
+
slug = re.sub(r"[^A-Za-z0-9]", "-", str(verify.resolve()))
|
|
4523
|
+
temp_tree = scratch / slug / f"keel-test-{os.getpid()}" / "scratchpad" / "own-tmp-tree"
|
|
4524
|
+
other_tree = scratch / "-some-other-dir" / f"keel-test-{os.getpid()}" / "scratchpad" / "other-tmp-tree"
|
|
4525
|
+
for tree in (temp_tree, other_tree):
|
|
4526
|
+
tree.parent.mkdir(parents=True, exist_ok=True)
|
|
4520
4527
|
subprocess.run(["git", "worktree", "add", "-q", "--detach", str(temp_tree)], cwd=verify, check=True, capture_output=True)
|
|
4521
4528
|
run_keel(rtl, "chat", "todo", "soc", "--assignee", "verify", "Rerun the regression", env=env)
|
|
4522
4529
|
# Its own session, as a job a session leaves behind would be: the check
|
|
@@ -4558,6 +4565,19 @@ def validate_shift_change_scenario() -> int:
|
|
|
4558
4565
|
if clean.returncode != 0:
|
|
4559
4566
|
report(f"{label} keel shift check is not ready on a clean worktree: {clean.stdout.strip()} {clean.stderr.strip()}")
|
|
4560
4567
|
return 1
|
|
4568
|
+
subprocess.run(["git", "worktree", "add", "-q", "--detach", str(other_tree)], cwd=verify, check=True, capture_output=True)
|
|
4569
|
+
try:
|
|
4570
|
+
foreign = shift(verify, "check")
|
|
4571
|
+
if foreign.returncode != 0:
|
|
4572
|
+
report(f"{label} another session's temporary worktree blocked the check: {foreign.stdout.strip()}")
|
|
4573
|
+
return 1
|
|
4574
|
+
if "other-tmp-tree" not in foreign.stdout:
|
|
4575
|
+
report(f"{label} another session's temporary worktree is not listed as a note: {foreign.stdout.strip()}")
|
|
4576
|
+
return 1
|
|
4577
|
+
finally:
|
|
4578
|
+
subprocess.run(["git", "worktree", "remove", "--force", str(other_tree)], cwd=verify, check=False, capture_output=True)
|
|
4579
|
+
shutil.rmtree(scratch / slug / f"keel-test-{os.getpid()}", ignore_errors=True)
|
|
4580
|
+
shutil.rmtree(scratch / "-some-other-dir" / f"keel-test-{os.getpid()}", ignore_errors=True)
|
|
4561
4581
|
|
|
4562
4582
|
ready = shift(verify, "ready", "next: rerun R007 on 1b64e8c")
|
|
4563
4583
|
if ready.returncode != 0:
|
|
@@ -4695,6 +4715,37 @@ def validate_shift_without_role_scenario() -> int:
|
|
|
4695
4715
|
report(f"{label} keel context still points to a note already resumed.")
|
|
4696
4716
|
return 1
|
|
4697
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
|
+
|
|
4698
4749
|
for relative, needle in (("docs/shift-change.md", "no chat role"), ("docs/shift-change.zh-CN.md", "不绑定聊天角色")):
|
|
4699
4750
|
if needle not in (ROOT / relative).read_text(encoding="utf-8"):
|
|
4700
4751
|
report(f"{label} {relative} does not say a chat role is optional ({needle!r}).")
|
package/src/core/shift.js
CHANGED
|
@@ -149,13 +149,24 @@ function temporaryRoots() {
|
|
|
149
149
|
return [...new Set([os.tmpdir(), "/tmp", "/private/tmp", "/var/folders", "/private/var/folders"].map(realpath))];
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
// Linked worktrees under a temporary directory, split by owner
|
|
153
|
+
// (shift-temp-owner D1): one in a Claude scratchpad of a session started in
|
|
154
|
+
// this worktree is this worktree's; any other is someone else's, or unknown.
|
|
152
155
|
function temporaryWorktrees(where) {
|
|
153
156
|
const listed = git(where.worktree, ["worktree", "list", "--porcelain"]);
|
|
154
|
-
if (!listed.ok) return [];
|
|
157
|
+
if (!listed.ok) return { own: [], other: [] };
|
|
155
158
|
const trees = listed.out.split("\n").filter((line) => line.startsWith("worktree ")).map((line) => realpath(line.slice(9)));
|
|
156
159
|
const main = trees[0];
|
|
157
160
|
const roots = temporaryRoots();
|
|
158
|
-
|
|
161
|
+
const slug = where.worktree.replace(/[^A-Za-z0-9]/g, "-");
|
|
162
|
+
const own = [];
|
|
163
|
+
const other = [];
|
|
164
|
+
for (const tree of trees) {
|
|
165
|
+
if (tree === main || tree === where.worktree || !roots.some((root) => inside(tree, root))) continue;
|
|
166
|
+
const scratch = tree.match(/[\\/]claude-\d+[\\/]([^\\/]+)[\\/][^\\/]+[\\/]scratchpad(?:[\\/]|$)/);
|
|
167
|
+
(scratch && scratch[1] === slug ? own : other).push(tree);
|
|
168
|
+
}
|
|
169
|
+
return { own, other };
|
|
159
170
|
}
|
|
160
171
|
|
|
161
172
|
function check(where, role) {
|
|
@@ -180,7 +191,9 @@ function check(where, role) {
|
|
|
180
191
|
items.push({ kind: "process", detail: `PID ${row.pid}, running ${row.elapsed}: ${row.command}` });
|
|
181
192
|
}
|
|
182
193
|
|
|
183
|
-
|
|
194
|
+
const temporary = temporaryWorktrees(where);
|
|
195
|
+
for (const tree of temporary.own) items.push({ kind: "temporary-worktree", detail: tree });
|
|
196
|
+
for (const tree of temporary.other) notes.push(`temporary worktree of another session, or of unknown owner, not counted: ${tree}`);
|
|
184
197
|
|
|
185
198
|
if (role) {
|
|
186
199
|
for (const todo of store.openTodos(where, { assignee: role })) {
|
|
@@ -255,7 +268,14 @@ function request(where, role, text) {
|
|
|
255
268
|
}
|
|
256
269
|
|
|
257
270
|
function readNoteText(options) {
|
|
258
|
-
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
|
+
}
|
|
259
279
|
if (options.text) return options.text;
|
|
260
280
|
if (!process.stdin.isTTY) {
|
|
261
281
|
try {
|