@christang/keel 5.148.0 → 5.149.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,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.148.0",
3
+ "version": "5.149.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,4 +1,4 @@
1
- <!-- keel:start version=5.148.0 -->
1
+ <!-- keel:start version=5.149.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.148.0",
3
+ "version": "5.149.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.148.0",
9
+ "version": "5.149.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.148.0",
5
+ "version": "5.149.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.148.0",
3
+ "version": "5.149.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.148.0",
3
+ "version": "5.149.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",
@@ -49,8 +49,8 @@ REQUIRED_SCRIPTS = [
49
49
  "scripts/validate_plugin.py",
50
50
  ]
51
51
 
52
- PACKAGE_VERSION = "5.148.0"
53
- PROTOCOL_VERSION = "5.148.0"
52
+ PACKAGE_VERSION = "5.149.0"
53
+ PROTOCOL_VERSION = "5.149.0"
54
54
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
55
55
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
56
56
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -2450,6 +2450,57 @@ def chat_scratch_group(base: Path) -> tuple[Path, Path, dict[str, str]]:
2450
2450
  return rtl, verify, env
2451
2451
 
2452
2452
 
2453
+ def validate_chat_mention_skips_code_scenario() -> int:
2454
+ """Issue #345: `keel chat post` refused a whole message over `@<commit-id>`
2455
+ or an `@word` inside backticks.
2456
+
2457
+ The refusal exists so a typo cannot post a message that reaches nobody;
2458
+ a commit id (`branch @ 638059e4`) and quoted text are not mentions.
2459
+ """
2460
+ label = "chat-mention-skips-code:"
2461
+ with tempfile.TemporaryDirectory(prefix="keel-chat-345-") as raw:
2462
+ base = Path(raw)
2463
+ rtl, _verify, env = chat_scratch_group(base)
2464
+
2465
+ def post(text: str) -> subprocess.CompletedProcess[str]:
2466
+ return run_keel(rtl, "chat", "post", "soc", text, "--json", env=env)
2467
+
2468
+ for name, text in (
2469
+ ("commit-id", "main moved: claude/x @638059e4 waiting for the push window"),
2470
+ ("long-commit-id", "landed @638059e4c0ffee1234567890abcdef12345678"),
2471
+ ("inline-code", "write it as `@verifyy` in the note"),
2472
+ ("fenced", "example:\n```\nkeel chat post soc @nobody hi\n```\nthat is all"),
2473
+ ):
2474
+ result = post(text)
2475
+ if result.returncode != 0:
2476
+ report(f"{label} a post with {name} was refused: {result.stdout!r} {result.stderr!r}")
2477
+ return 1
2478
+ mentions = chat_json(result).get("mentions", [])
2479
+ if mentions:
2480
+ report(f"{label} a post with {name} recorded mentions {mentions!r}.")
2481
+ return 1
2482
+
2483
+ typo = post("@verifyy please check")
2484
+ if typo.returncode == 0:
2485
+ report(f"{label} a bare typo is no longer refused: {typo.stdout!r}")
2486
+ return 1
2487
+ if "@verifyy is not a member" not in typo.stderr:
2488
+ report(f"{label} a bare typo's refusal does not name it: {typo.stderr!r}")
2489
+ return 1
2490
+ real = post("`@nobody` is quoted, @verify is asked")
2491
+ if real.returncode != 0:
2492
+ report(f"{label} a real mention beside quoted text was refused: {real.stderr!r}")
2493
+ return 1
2494
+ if chat_json(real).get("mentions") != ["verify"]:
2495
+ report(f"{label} a real mention beside quoted text was not recorded alone: {real.stdout!r}")
2496
+ return 1
2497
+ if "chat-mention-skips-code" not in {name for name, _ in SCENARIOS}:
2498
+ report(f"{label} scenario is not registered.")
2499
+ return 1
2500
+ report("chat-mention-skips-code scenario passed.")
2501
+ return 0
2502
+
2503
+
2453
2504
  def validate_chat_supersedes_scenario() -> int:
2454
2505
  """Issue #252: a record supersedes its author's earlier one.
2455
2506
 
@@ -41790,6 +41841,7 @@ SCENARIOS: tuple = (
41790
41841
  ("self-shift-authorization", validate_self_shift_authorization_scenario),
41791
41842
  ("resource-lock", validate_resource_lock_scenario),
41792
41843
  ("chat-supersedes", validate_chat_supersedes_scenario),
41844
+ ("chat-mention-skips-code", validate_chat_mention_skips_code_scenario),
41793
41845
  ("chat-ack", validate_chat_ack_scenario),
41794
41846
  ("coordinator-patrol", validate_coordinator_patrol_scenario),
41795
41847
  ("patrol-since-last", validate_patrol_since_last_scenario),
@@ -476,7 +476,8 @@ function lenientMentions(project, group, text) {
476
476
  const state = store.groupState(store.readLog(project.where, group));
477
477
  const aliases = store.aliasMap(project.where.root);
478
478
  const mentions = [];
479
- for (const match of String(text).matchAll(MENTION)) {
479
+ // Quoted text is not a mention here either (#345).
480
+ for (const match of store.mentionText(text).matchAll(MENTION)) {
480
481
  const token = match[2].replace(/[-/]+$/, "").toLowerCase();
481
482
  let role = null;
482
483
  if (token === store.ALL || token === store.OWNER || token.includes("/") || state.members.has(token)) role = token;
@@ -527,10 +527,23 @@ const MENTION = /(^|[^\w@/])@([A-Za-z0-9][A-Za-z0-9/-]*)/g;
527
527
  // `@role`, `@alias` (case-insensitive), `@all`, `@owner`, and the cross-project
528
528
  // `@project/role`. Anything else is refused by name, so a typo cannot post a
529
529
  // message that silently reaches nobody (design D3, D4).
530
+ // Quoted text is not a mention: a fenced block or an inline code span is
531
+ // blanked with spaces of its own length before the scan, so `@verify` written
532
+ // as an example neither refuses the post nor wakes anyone (#345).
533
+ function mentionText(text) {
534
+ return String(text)
535
+ .replace(/```[\s\S]*?(?:```|$)/g, (block) => block.replace(/[^\n]/g, " "))
536
+ .replace(/`[^`\n]*`/g, (span) => " ".repeat(span.length));
537
+ }
538
+
539
+ // `<branch> @ <sha>` is the commonest `@` in some projects; a hex token that
540
+ // names nobody is that commit id, not a typo of a role (#345).
541
+ const COMMIT_ID = /^[0-9a-f]{7,40}$/;
542
+
530
543
  function resolveMentions(where, group, state, text) {
531
544
  const aliases = aliasMap(where.root);
532
545
  const mentions = [];
533
- for (const match of String(text).matchAll(MENTION)) {
546
+ for (const match of mentionText(text).matchAll(MENTION)) {
534
547
  const token = match[2].replace(/[-/]+$/, "").toLowerCase();
535
548
  let role = null;
536
549
  if (token === ALL || token === OWNER) role = token;
@@ -540,6 +553,7 @@ function resolveMentions(where, group, state, text) {
540
553
  if (role && role !== ALL && role !== OWNER && !role.includes("/") && !state.members.has(role)) {
541
554
  throw new ChatError(`@${match[2]} names role ${role}, which is not a member of group ${group}.`);
542
555
  }
556
+ if (!role && COMMIT_ID.test(token)) continue;
543
557
  if (!role) {
544
558
  throw new ChatError(`@${match[2]} is not a member or alias in group ${group}.`);
545
559
  }
@@ -984,6 +998,7 @@ function readGroups(where, role, group) {
984
998
 
985
999
  module.exports = {
986
1000
  wait,
1001
+ mentionText,
987
1002
  openWaits,
988
1003
  markMet,
989
1004
  canAct,