@christang/keel 5.129.0 → 5.130.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 CHANGED
@@ -182,7 +182,7 @@ because a permission granted in conversation does not survive a context reset. D
182
182
  `keel/config.yaml` instead:
183
183
 
184
184
  ```yaml
185
- authorize: # accepted names: commit, push, push:<branch glob>, release, archive, continuation, issue:<owner>/<repo>, protocol-refresh, chat-reply:<group>, issue-close:<owner>/<repo>, cleanup:scratch, push-protected:<branch glob>[@<role>], shift-restore
185
+ authorize: # accepted names: commit, push, push:<branch glob>, release, archive, continuation, issue:<owner>/<repo>, protocol-refresh, chat-reply:<group>, issue-close:<owner>/<repo>, cleanup:scratch, push-protected:<branch glob>[@<role>], shift-restore, self-shift
186
186
  - commit
187
187
  - push
188
188
  ```
@@ -238,6 +238,11 @@ session reads that restore as another session's request and stops to ask you. It
238
238
  session, so it takes no scope, and it covers no other session, no clear or archive, and no repository
239
239
  action.
240
240
 
241
+ `self-shift` (#319) is its outgoing counterpart: the four steps `keel shift ready --wake` prints on
242
+ the desktop app once the note is stored — turn the session's own Remote Control off and wait, create
243
+ the one-shot wake task, rename the session, clear it. It does not decide that a shift happens; that
244
+ stays with the task-boundary rule and the coordinator. It takes no scope.
245
+
241
246
  `cleanup:scratch` covers removing temporary worktrees and run output under the session's own
242
247
  scratchpad, after checking that they are merged and that no process is using them. It never covers
243
248
  a branch or another session's files, and like the tracker scopes it is carried, not enforced.
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.129.0 -->
1
+ <!-- keel:start version=5.130.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.129.0",
3
+ "version": "5.130.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.129.0",
9
+ "version": "5.130.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.129.0",
5
+ "version": "5.130.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.129.0",
3
+ "version": "5.130.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.129.0",
3
+ "version": "5.130.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.129.0"
51
- PROTOCOL_VERSION = "5.129.0"
50
+ PACKAGE_VERSION = "5.130.0"
51
+ PROTOCOL_VERSION = "5.130.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
@@ -6788,6 +6788,64 @@ def validate_shift_change_scenario() -> int:
6788
6788
  return 0
6789
6789
 
6790
6790
 
6791
+ def validate_self_shift_authorization_scenario() -> int:
6792
+ """Issue #319: `self-shift` lets a desktop session take its own four steps.
6793
+
6794
+ The name is read and listed by `--doctor`, a scoped form is refused, and a
6795
+ desktop `keel shift ready --wake` says the steps are standing-authorized
6796
+ only when the repository declares it.
6797
+ """
6798
+ label = "self-shift-authorization:"
6799
+ with tempfile.TemporaryDirectory(prefix="keel-self-shift-") as raw:
6800
+ base = Path(raw)
6801
+ _rtl, verify, env, _ = shift_scratch(base)
6802
+ env = {**env, "KEEL_SHIFT_WAKE_TIMEOUT_MS": "2000"}
6803
+ desktop = {**env, "CLAUDE_CODE_ENTRYPOINT": "claude-desktop", "CLAUDE_CODE_HOST_SESSION_ID": "local_test-319"}
6804
+ config = verify / "keel" / "config.yaml"
6805
+ reason = ("--force-reason", "the fixture config is uncommitted")
6806
+
6807
+ def declare(*entries: str) -> None:
6808
+ write_text(config, "authorize:\n" + "".join(f" - {entry}\n" for entry in entries))
6809
+
6810
+ declare("commit", "self-shift")
6811
+ doctor = run_keel(verify, "--doctor", env=env)
6812
+ if "self-shift" not in doctor.stdout or "unrecognized" in (doctor.stdout + doctor.stderr).lower():
6813
+ report(f"{label} self-shift was not read and listed as a standing authorization: {doctor.stdout.strip()} {doctor.stderr.strip()}")
6814
+ return 1
6815
+ granted = run_keel(verify, "shift", "ready", "--wake", *reason, "verify note: R015", env=desktop)
6816
+ if "Standing-authorized by `self-shift`" not in granted.stdout:
6817
+ report(f"{label} a desktop ready --wake with self-shift declared does not say the steps are standing-authorized: {granted.stdout.strip()} {granted.stderr.strip()}")
6818
+ return 1
6819
+ run_keel(verify, "shift", "resume", env=desktop)
6820
+
6821
+ declare("commit")
6822
+ asked = run_keel(verify, "shift", "ready", "--wake", *reason, "verify note: R016", env=desktop)
6823
+ if "Standing-authorized by `self-shift`" in asked.stdout:
6824
+ report(f"{label} a desktop ready --wake without self-shift says the steps are standing-authorized: {asked.stdout.strip()}")
6825
+ return 1
6826
+ if "self-shift" not in asked.stdout:
6827
+ report(f"{label} a desktop ready --wake without self-shift does not name the declaration that would allow it: {asked.stdout.strip()}")
6828
+ return 1
6829
+ run_keel(verify, "shift", "resume", env=desktop)
6830
+
6831
+ declare("commit", "self-shift:anything")
6832
+ scoped = run_keel(verify, "--doctor", env=env)
6833
+ combined = scoped.stdout + scoped.stderr
6834
+ if "self-shift:anything" not in combined or "commit: authorized" in combined:
6835
+ report(f"{label} a scoped self-shift was not refused by name: {combined.strip()}")
6836
+ return 1
6837
+
6838
+ for relative in ("README.md", "docs/shift-change.md", "docs/shift-change.zh-CN.md"):
6839
+ if "self-shift" not in (ROOT / relative).read_text(encoding="utf-8"):
6840
+ report(f"{label} {relative} does not name self-shift.")
6841
+ return 1
6842
+ if "self-shift-authorization" not in {name for name, _ in SCENARIOS}:
6843
+ report(f"{label} scenario is not registered.")
6844
+ return 1
6845
+ report("self-shift-authorization scenario passed.")
6846
+ return 0
6847
+
6848
+
6791
6849
  def validate_shift_restore_authorization_scenario() -> int:
6792
6850
  """Issue #319: `shift-restore` lets a woken desktop shift restore itself.
6793
6851
 
@@ -28981,7 +29039,7 @@ def validate_continuation_authorization_scenario() -> int:
28981
29039
  ACCEPTED_AUTHORIZE_NAMES = (
28982
29040
  "commit, push, push:<branch glob>, release, archive, continuation, "
28983
29041
  "issue:<owner>/<repo>, protocol-refresh, chat-reply:<group>, "
28984
- "issue-close:<owner>/<repo>, cleanup:scratch, push-protected:<branch glob>[@<role>], shift-restore"
29042
+ "issue-close:<owner>/<repo>, cleanup:scratch, push-protected:<branch glob>[@<role>], shift-restore, self-shift"
28985
29043
  )
28986
29044
 
28987
29045
 
@@ -29043,7 +29101,7 @@ def validate_continuation_docs_scenario() -> int:
29043
29101
  return 1
29044
29102
 
29045
29103
  config_text = (ROOT / "keel/config.yaml").read_text(encoding="utf-8")
29046
- if "commit, push, push:<branch glob>,\n# release, archive, continuation, issue:<owner>/<repo>, protocol-refresh,\n# chat-reply:<group>, issue-close:<owner>/<repo>, cleanup:scratch,\n# push-protected:<branch glob>[@<role>], shift-restore" not in config_text:
29104
+ if "commit, push, push:<branch glob>,\n# release, archive, continuation, issue:<owner>/<repo>, protocol-refresh,\n# chat-reply:<group>, issue-close:<owner>/<repo>, cleanup:scratch,\n# push-protected:<branch glob>[@<role>], shift-restore, self-shift" not in config_text:
29047
29105
  report(
29048
29106
  f"{label}: keel/config.yaml's comment lacks: protocol-refresh in the "
29049
29107
  "seven-name vocabulary."
@@ -40358,6 +40416,7 @@ SCENARIOS: tuple = (
40358
40416
  ("shift-without-role", validate_shift_without_role_scenario),
40359
40417
  ("shift-desktop-wake", validate_shift_desktop_wake_scenario),
40360
40418
  ("shift-restore-authorization", validate_shift_restore_authorization_scenario),
40419
+ ("self-shift-authorization", validate_self_shift_authorization_scenario),
40361
40420
  ("resource-lock", validate_resource_lock_scenario),
40362
40421
  ("chat-supersedes", validate_chat_supersedes_scenario),
40363
40422
  ("chat-ack", validate_chat_ack_scenario),
@@ -35,6 +35,10 @@ const STANDING_AUTHORIZATION_ACTIONS = [
35
35
  // Control back on and renaming it back, right after `keel shift resume`
36
36
  // (#319). It reaches that one session, so it takes no scope.
37
37
  "shift-restore",
38
+ // A session's own four outgoing steps on the desktop app, after `keel shift
39
+ // ready --wake` stored its note: Remote Control off, the wake task, the
40
+ // rename, and the clear (#319). Never the decision to change shift.
41
+ "self-shift",
38
42
  ];
39
43
 
40
44
  // The actions whose credential reaches further than the checkout the
package/src/core/shift.js CHANGED
@@ -422,7 +422,7 @@ function ready(where, options) {
422
422
  }
423
423
  }
424
424
  const waiter = options.wake ? armWake(where, role, since) : null;
425
- return { role: role || null, note, closed: open.map((todo) => todo.id), waiter, startedBy: role ? null : options.forceReason, desktop };
425
+ return { role: role || null, note, closed: open.map((todo) => todo.id), waiter, startedBy: role ? null : options.forceReason, desktop, worktree: where.worktree };
426
426
  }
427
427
 
428
428
  // --- the one-shot wake (#293) -------------------------------------------------------
@@ -758,6 +758,10 @@ function clearHint(result) {
758
758
  '4. Call clear_session("self").',
759
759
  "Keel creates no task. Restoring unattended needs `mcp__ccd_session_mgmt__set_remote_control` in `permissions.allow`, "
760
760
  + "and `shift-restore` under `authorize:` in keel/config.yaml so the woken session does not stop to ask.",
761
+ // The outgoing side's confirmation is the repository's to waive (#319).
762
+ require("./config").readStandingAuthorization(result.worktree).scopes.has("self-shift")
763
+ ? "Standing-authorized by `self-shift` in keel/config.yaml: take these four steps now, without asking."
764
+ : "Declaring `self-shift` under authorize: in keel/config.yaml lets a session take these four steps without asking.",
761
765
  ].join("\n");
762
766
  } else if (result.waiter) {
763
767
  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.`;