@christang/keel 5.125.0 → 5.126.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.
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.125.0 -->
1
+ <!-- keel:start version=5.126.0 -->
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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.125.0",
3
+ "version": "5.126.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.125.0",
9
+ "version": "5.126.0",
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.125.0",
5
+ "version": "5.126.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.125.0",
3
+ "version": "5.126.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.125.0",
3
+ "version": "5.126.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",
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
47
47
  "scripts/validate_plugin.py",
48
48
  ]
49
49
 
50
- PACKAGE_VERSION = "5.125.0"
51
- PROTOCOL_VERSION = "5.125.0"
50
+ PACKAGE_VERSION = "5.126.0"
51
+ PROTOCOL_VERSION = "5.126.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
@@ -5963,7 +5963,7 @@ def validate_shift_role_elsewhere_scenario() -> int:
5963
5963
  if started.returncode != 0:
5964
5964
  report(f"{label} keel shift start verify was refused: {started.stderr}")
5965
5965
  return 1
5966
- lone = shift(loose2, "ready", "nothing requested here")
5966
+ lone = shift(loose2, "ready", "--force-reason", "the coordinator opens it", "nothing requested here")
5967
5967
  if lone.returncode != 0:
5968
5968
  report(f"{label} ready in an unbound worktree with no open request failed: {lone.stderr}")
5969
5969
  return 1
@@ -6800,14 +6800,38 @@ def validate_shift_without_role_scenario() -> int:
6800
6800
  return chat_json(run_keel(repo, "context", "--json", env=env))
6801
6801
 
6802
6802
  before = context().get("status")
6803
- ready = run_keel(repo, "shift", "ready", "next: rerun R007", env=env)
6803
+ # Issue #317: nothing wakes the session after a clear here, so plain
6804
+ # `ready` is refused and points to a role and --wake.
6805
+ plain = run_keel(repo, "shift", "ready", "next: rerun R007", env=env)
6806
+ if plain.returncode != 1:
6807
+ report(f"{label} plain ready in a worktree without a chat role exited {plain.returncode}, not 1: {plain.stdout.strip()}")
6808
+ return 1
6809
+ if "keel chat role --set" not in plain.stderr:
6810
+ report(f"{label} the refusal does not name `keel chat role --set`: {plain.stderr.strip()}")
6811
+ return 1
6812
+ if "--wake" not in plain.stderr:
6813
+ report(f"{label} the refusal does not name --wake: {plain.stderr.strip()}")
6814
+ return 1
6815
+ if list((common / "shift" / "worktree").glob("*.md")):
6816
+ report(f"{label} the refused ready stored a worktree note.")
6817
+ return 1
6818
+ ready = run_keel(repo, "shift", "ready", "--force-reason", "the owner opens it", "next: rerun R007", env=env)
6804
6819
  if ready.returncode != 0:
6805
- report(f"{label} keel shift ready refused in a worktree without a chat role: {ready.stderr.strip()}")
6820
+ report(f"{label} keel shift ready --force-reason refused in a worktree without a chat role: {ready.stderr.strip()}")
6821
+ return 1
6822
+ if "the owner opens it" not in ready.stdout:
6823
+ report(f"{label} the clear hint does not name who starts the new session: {ready.stdout.strip()}")
6806
6824
  return 1
6807
6825
  notes = list((common / "shift" / "worktree").glob("*.md"))
6808
6826
  if len(notes) != 1:
6809
6827
  report(f"{label} ready kept {len(notes)} worktree notes under keel-chat/shift/worktree/, not one.")
6810
6828
  return 1
6829
+ if "Started by hand: the owner opens it" not in notes[0].read_text(encoding="utf-8"):
6830
+ report(f"{label} the note does not record who starts the new session.")
6831
+ return 1
6832
+ if "Left as is" in notes[0].read_text(encoding="utf-8"):
6833
+ report(f"{label} the note lists loose ends left as is when the check found none.")
6834
+ return 1
6811
6835
  text = run_keel(repo, "context", env=env).stdout
6812
6836
  if "keel shift resume" not in text:
6813
6837
  report(f"{label} keel context does not point to the waiting note: {text.strip()}")
@@ -6838,7 +6862,7 @@ def validate_shift_without_role_scenario() -> int:
6838
6862
 
6839
6863
  # Issue #261: `--file -` is stdin, and an unreadable file is a named refusal.
6840
6864
  missing = base / "missing-note.md"
6841
- refused = run_keel(repo, "shift", "ready", "--file", str(missing), env=env)
6865
+ refused = run_keel(repo, "shift", "ready", "--force-reason", "the owner opens it", "--file", str(missing), env=env)
6842
6866
  if re.search(r"^\s+at ", refused.stderr, re.M):
6843
6867
  report(f"{label} an unreadable --file escaped as an uncaught exception: {refused.stderr.strip()}")
6844
6868
  return 1
@@ -6852,7 +6876,7 @@ def validate_shift_without_role_scenario() -> int:
6852
6876
  report(f"{label} the refusal of an unreadable --file does not name the path: {refused.stderr.strip()}")
6853
6877
  return 1
6854
6878
  piped = subprocess.run(
6855
- ["node", str(ROOT / "bin" / "keel.js"), "shift", "ready", "--file", "-"],
6879
+ ["node", str(ROOT / "bin" / "keel.js"), "shift", "ready", "--force-reason", "the owner opens it", "--file", "-"],
6856
6880
  cwd=repo, env=env, input="next: from stdin via --file -\n",
6857
6881
  text=True, encoding="utf-8", errors="replace", capture_output=True, check=False,
6858
6882
  )
@@ -6868,9 +6892,17 @@ def validate_shift_without_role_scenario() -> int:
6868
6892
  return 1
6869
6893
 
6870
6894
  for relative, needle in (("docs/shift-change.md", "no chat role"), ("docs/shift-change.zh-CN.md", "不绑定聊天角色")):
6871
- if needle not in (ROOT / relative).read_text(encoding="utf-8"):
6895
+ text = (ROOT / relative).read_text(encoding="utf-8")
6896
+ if needle not in text:
6872
6897
  report(f"{label} {relative} does not say a chat role is optional ({needle!r}).")
6873
6898
  return 1
6899
+ intro = text.split("## ", 1)[0]
6900
+ if "--wake" not in intro:
6901
+ report(f"{label} {relative} does not say an unbound self-shift needs --wake.")
6902
+ return 1
6903
+ if "--force-reason" not in intro:
6904
+ report(f"{label} {relative} does not say --force-reason files an unbound self-shift by hand.")
6905
+ return 1
6874
6906
  if "shift-without-role" not in {name for name, _ in SCENARIOS}:
6875
6907
  report(f"{label} scenario is not registered.")
6876
6908
  return 1
package/src/core/shift.js CHANGED
@@ -371,6 +371,14 @@ function ready(where, options) {
371
371
  if (options.wake && !role) {
372
372
  throw new ShiftError("--wake wakes a chat role, and this worktree has none: bind one with `keel chat role --set <name>`, or name it with --role.");
373
373
  }
374
+ // No request can name an unbound worktree, so its `ready` is a self-shift
375
+ // that nothing wakes after the clear (#317 D1).
376
+ if (!role && !options.forceReason) {
377
+ throw new ShiftError(
378
+ "This worktree has no chat role, so nothing will start the session that follows a clear: no request can name it, and --wake needs a role. "
379
+ + "Bind one with `keel chat role --set <name>` and run `keel shift ready --wake`, or give --force-reason \"<who starts the new session>\"."
380
+ );
381
+ }
374
382
  const since = Date.now();
375
383
  const result = check(where, role);
376
384
  if (!result.ready && !options.forceReason) {
@@ -385,7 +393,8 @@ function ready(where, options) {
385
393
  `Written ${stamp} in ${result.worktree}.`,
386
394
  // A shift the role started itself; the patrol may nudge it to resume (#307 D4).
387
395
  options.wake ? "Self-initiated: this shift armed `keel shift ready --wake`." : "",
388
- options.forceReason ? `\nLeft as is (${options.forceReason}):\n${result.items.map((item) => `- ${item.kind}: ${item.detail}`).join("\n")}` : "",
396
+ !role ? `Started by hand: ${options.forceReason}.` : "",
397
+ options.forceReason && result.items.length ? `\nLeft as is (${options.forceReason}):\n${result.items.map((item) => `- ${item.kind}: ${item.detail}`).join("\n")}` : "",
389
398
  "",
390
399
  ].join("\n");
391
400
  const note = ownNotePath(where, role);
@@ -404,7 +413,7 @@ function ready(where, options) {
404
413
  }
405
414
  }
406
415
  const waiter = options.wake ? armWake(where, role, since) : null;
407
- return { role: role || null, note, closed: open.map((todo) => todo.id), waiter };
416
+ return { role: role || null, note, closed: open.map((todo) => todo.id), waiter, startedBy: role ? null : options.forceReason };
408
417
  }
409
418
 
410
419
  // --- the one-shot wake (#293) -------------------------------------------------------
@@ -723,7 +732,7 @@ const CLEAR_HINT = [
723
732
  // or — without a chat role — the person who opens it.
724
733
  function clearHint(result) {
725
734
  let last;
726
- if (!result.role) last = "Without a chat role, tell the new session to run `keel shift resume`.";
735
+ if (!result.role) last = `Without a chat role nothing wakes the new session; ${result.startedBy} — tell it to run \`keel shift resume\`.`;
727
736
  else if (result.waiter) {
728
737
  last = `The wake is armed: once ${result.role}'s next session starts (after a clear or a fresh start), it gets one message to run \`keel shift resume\`. The waiter gives up after two hours.`;
729
738
  } else if (result.closed.length) last = "The coordinator's `keel shift start` then wakes the new shift.";