@christang/keel 5.112.0 → 5.112.1

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.112.0 -->
1
+ <!-- keel:start version=5.112.1 -->
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.112.0",
3
+ "version": "5.112.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.112.0",
9
+ "version": "5.112.1",
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.112.0",
5
+ "version": "5.112.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.112.0",
3
+ "version": "5.112.1",
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.112.0",
3
+ "version": "5.112.1",
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",
@@ -243,13 +243,19 @@ function shellSegments(command) {
243
243
  let words = [];
244
244
  let word = null;
245
245
  let expands = false;
246
+ // A redirection's target is not an argument (#286): the next word is dropped.
247
+ let dropNext = false;
246
248
  const finishWord = () => {
247
- if (word !== null) words.push({ text: word, expands });
249
+ if (word !== null) {
250
+ if (dropNext) dropNext = false;
251
+ else words.push({ text: word, expands });
252
+ }
248
253
  word = null;
249
254
  expands = false;
250
255
  };
251
256
  const finishSegment = () => {
252
257
  finishWord();
258
+ dropNext = false;
253
259
  if (words.length) segments.push(words);
254
260
  words = [];
255
261
  };
@@ -284,6 +290,29 @@ function shellSegments(command) {
284
290
  i = rest - 1;
285
291
  continue;
286
292
  }
293
+ // A redirection — `>`, `>>`, `<`, `2>`, `2>&1`, `>&2`, `&>` — and its target
294
+ // are dropped, never read as arguments (#286 D1). Heredocs are handled above.
295
+ if (c === ">" || c === "<" || (c === "&" && command[i + 1] === ">")) {
296
+ if (c === "&") i += 1;
297
+ if (word !== null && /^\d+$/.test(word) && !expands) {
298
+ word = null;
299
+ expands = false;
300
+ } else {
301
+ finishWord();
302
+ }
303
+ let j = i + 1;
304
+ if (command[j] === ">" || command[j] === "<") j += 1;
305
+ if (command[j] === "&") {
306
+ const fd = command.slice(j + 1).match(/^(\d+|-)/);
307
+ if (fd) {
308
+ i = j + fd[0].length;
309
+ continue;
310
+ }
311
+ }
312
+ dropNext = true;
313
+ i = j - 1;
314
+ continue;
315
+ }
287
316
  if (c === "'") {
288
317
  const end = command.indexOf("'", i + 1);
289
318
  word = (word || "") + command.slice(i + 1, end === -1 ? command.length : end);
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
47
47
  "scripts/validate_plugin.py",
48
48
  ]
49
49
 
50
- PACKAGE_VERSION = "5.112.0"
51
- PROTOCOL_VERSION = "5.112.0"
50
+ PACKAGE_VERSION = "5.112.1"
51
+ PROTOCOL_VERSION = "5.112.1"
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
@@ -30294,6 +30294,34 @@ def validate_push_protected_guard_scenario() -> int:
30294
30294
  return 0
30295
30295
 
30296
30296
 
30297
+ def validate_push_guard_redirects_scenario() -> int:
30298
+ """Issue #286: a shell redirection is never read as a push target."""
30299
+ label = "push-guard-redirects:"
30300
+ with tempfile.TemporaryDirectory(prefix="keel-push-redirects-") as raw:
30301
+ repo = mailbox_repository(Path(raw) / "repo")
30302
+ write_authorize_config(repo, "authorize:\n - push:flow-*\n")
30303
+
30304
+ def decide(command: str) -> dict:
30305
+ event = {"tool_name": "Bash", "tool_input": {"command": command}, "cwd": str(repo)}
30306
+ return pretooluse_decision(run_pretooluse_guard_hook(repo, event)) or {"permissionDecision": "pass"}
30307
+
30308
+ base = "git push --dry-run origin HEAD:refs/heads/flow-probe"
30309
+ for command in (f"{base} 2>&1 | tail -1", f"{base} 2>/dev/null", f"{base} &> out.log", f"{base} >&2"):
30310
+ decision = decide(command)
30311
+ if decision.get("permissionDecision") != "pass":
30312
+ report(f"{label} {command!r} was {decision!r}, not allowed.")
30313
+ return 1
30314
+ refused = decide("git push origin HEAD:main 2>&1 | tail -1")
30315
+ if refused.get("permissionDecision") != "deny":
30316
+ report(f"{label} an out-of-scope push with a redirection was {refused!r}, not denied.")
30317
+ return 1
30318
+ if "`main`" not in refused.get("permissionDecisionReason", ""):
30319
+ report(f"{label} the refusal does not name main: {refused!r}")
30320
+ return 1
30321
+ report("push-guard-redirects scenario passed.")
30322
+ return 0
30323
+
30324
+
30297
30325
  def validate_touch_write_guard_scenario() -> int:
30298
30326
  with tempfile.TemporaryDirectory(
30299
30327
  prefix="keel-touch-guard-", ignore_cleanup_errors=True
@@ -39050,6 +39078,7 @@ SCENARIOS: tuple = (
39050
39078
  ("native-single-task-matrix", validate_native_single_task_matrix_scenario),
39051
39079
  ("touch-write-guard", validate_touch_write_guard_scenario),
39052
39080
  ("push-branch-guard", validate_push_branch_guard_scenario),
39081
+ ("push-guard-redirects", validate_push_guard_redirects_scenario),
39053
39082
  ("push-protected-guard", validate_push_protected_guard_scenario),
39054
39083
  ("touch-guard-record-layer", validate_touch_guard_record_layer_scenario),
39055
39084
  ("repo-action-mode", validate_repo_action_mode_scenario),