@christang/keel 5.99.2 → 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.
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.99.2 -->
1
+ <!-- keel:start version=5.99.3 -->
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.99.2",
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.2",
9
+ "version": "5.99.3",
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.99.2",
5
+ "version": "5.99.3",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.99.2",
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.2",
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.2"
51
- PROTOCOL_VERSION = "5.99.2"
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
@@ -36710,6 +36710,37 @@ def validate_external_agent_brief_scenario() -> int:
36710
36710
  if needle not in command:
36711
36711
  report(f"{label} the implementation command does not name {needle!r}: {command}")
36712
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
36713
36744
  if calls.exists():
36714
36745
  report(f"{label} an agent was launched: {calls.read_text(encoding='utf-8').strip()}")
36715
36746
  return 1
@@ -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 this session's own checkout. The write guard does not reach an external `
359
- + `process, so it needs a separate worktree of this repository. ${how}`
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") repo = argv[++index] || "";
542
- else if (flags[arg]) options[flags[arg]] = argv[++index] || "";
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`);