@christang/keel 5.95.3 → 5.96.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.95.3 -->
1
+ <!-- keel:start version=5.96.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.95.3",
3
+ "version": "5.96.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.95.3",
9
+ "version": "5.96.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.95.3",
5
+ "version": "5.96.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.95.3",
3
+ "version": "5.96.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.95.3",
3
+ "version": "5.96.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.95.3"
51
- PROTOCOL_VERSION = "5.95.3"
50
+ PACKAGE_VERSION = "5.96.0"
51
+ PROTOCOL_VERSION = "5.96.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
@@ -3862,6 +3862,82 @@ def validate_chat_slack_format_scenario() -> int:
3862
3862
  return 0
3863
3863
 
3864
3864
 
3865
+ def validate_chat_issue_links_scenario() -> int:
3866
+ """Owner's request of 2026-10-05: an issue mentioned in Slack links to GitHub.
3867
+
3868
+ `owner/repo#N` links to that repository, and a bare `#N` to the project's
3869
+ own repository read from a GitHub `origin`; `C#`, `abc#9`, and code stay
3870
+ text; a project without a GitHub origin keeps a bare `#N` as text; and an
3871
+ issue link a person sends comes back as the text it showed.
3872
+ """
3873
+ label = "chat-issue-links:"
3874
+ if chat_bridge_node_missing("chat-issue-links"):
3875
+ return 3
3876
+ FakeSlack = fake_slack_class()
3877
+ with tempfile.TemporaryDirectory(prefix="keel-chat-issues-") as raw, FakeSlack() as slack:
3878
+ base = Path(raw)
3879
+ rtl, _verify, env = chat_scratch_group(base)
3880
+ chat_slack_config(rtl, {"soc": "CSOC"})
3881
+ benv = chat_bridge_environment(env, base / "home", slack)
3882
+ run_keel(rtl, "chat", "bridge", "add", env=benv)
3883
+ subprocess.run(["git", "remote", "remove", "origin"], cwd=rtl, capture_output=True, check=False)
3884
+ subprocess.run(["git", "remote", "add", "origin", "git@github.com:acme/rtl.git"], cwd=rtl, capture_output=True, check=True)
3885
+
3886
+ def posted(body: str) -> str:
3887
+ record_id = chat_json(run_keel(rtl, "chat", "post", "soc", body, "--json", env=benv)).get("id", "")
3888
+ once = run_keel(rtl, "chat", "bridge", "run", "--once", env=benv)
3889
+ sent = next((c["params"].get("text", "") for c in slack.calls_to("chat.postMessage") if slack_payload(c).get("id") == record_id), None)
3890
+ if sent is None:
3891
+ raise AssertionError(f"the record was never posted: {once.stderr.strip()}")
3892
+ if body not in (chat_log(rtl, "soc") / f"{record_id}.md").read_text(encoding="utf-8"):
3893
+ raise AssertionError("linking changed the local record")
3894
+ return sent
3895
+
3896
+ try:
3897
+ sent = posted("see #42, acme/other#7, C# and abc#9 and `#5`")
3898
+ for needle in ("<https://github.com/acme/rtl/issues/42|#42>", "<https://github.com/acme/other/issues/7|acme/other#7>", "C# and abc#9", "`#5`"):
3899
+ if needle not in sent:
3900
+ report(f"{label} the posted text lacks {needle!r}: {sent!r}")
3901
+ return 1
3902
+ subprocess.run(["git", "remote", "remove", "origin"], cwd=rtl, capture_output=True, check=True)
3903
+ sent = posted("see #43 and acme/other#8")
3904
+ if "github.com/acme/rtl" in sent or "see #43 and" not in sent:
3905
+ report(f"{label} a bare #43 was linked although origin is not on GitHub: {sent!r}")
3906
+ return 1
3907
+ if "<https://github.com/acme/other/issues/8|acme/other#8>" not in sent:
3908
+ report(f"{label} acme/other#8 was not linked without an origin: {sent!r}")
3909
+ return 1
3910
+ except AssertionError as error:
3911
+ report(f"{label} {error}")
3912
+ return 1
3913
+
3914
+ bridge = start_chat_bridge(rtl, benv)
3915
+ try:
3916
+ if not slack.wait_for(lambda: slack.sockets, 10):
3917
+ report(f"{label} the bridge never connected: {stop_chat_bridge(bridge).strip()}")
3918
+ return 1
3919
+ slack.push(slack_event("CSOC", user="UOWNER", text="<https://github.com/acme/rtl/issues/42|#42> done", ts="1800000001.000100"))
3920
+ if not slack.wait_for(lambda: chat_records_with(rtl, "soc", "done")):
3921
+ report(f"{label} the owner's message was not imported.")
3922
+ return 1
3923
+ stored = chat_records_with(rtl, "soc", "done")[0]
3924
+ if "#42 done" not in stored or "](" in stored:
3925
+ report(f"{label} the issue link did not come back as its text:\n{stored}")
3926
+ return 1
3927
+ finally:
3928
+ stop_chat_bridge(bridge)
3929
+
3930
+ for relative, needle in (("docs/chat-slack-setup.md", "link to GitHub"), ("docs/chat-slack-setup.zh-CN.md", "跳转到 GitHub")):
3931
+ if needle not in (ROOT / relative).read_text(encoding="utf-8"):
3932
+ report(f"{label} {relative} does not say {needle!r}.")
3933
+ return 1
3934
+ if "chat-issue-links" not in {name for name, _ in SCENARIOS}:
3935
+ report(f"{label} scenario is not registered.")
3936
+ return 1
3937
+ report("chat-issue-links scenario passed.")
3938
+ return 0
3939
+
3940
+
3865
3941
  def validate_chat_role_apps_are_documented_scenario() -> int:
3866
3942
  """Issue #187: the setup guides and READMEs describe shared bots.
3867
3943
 
@@ -36459,6 +36535,10 @@ SCENARIOS: tuple = (
36459
36535
  "chat-slack-format",
36460
36536
  validate_chat_slack_format_scenario,
36461
36537
  ),
36538
+ (
36539
+ "chat-issue-links",
36540
+ validate_chat_issue_links_scenario,
36541
+ ),
36462
36542
  (
36463
36543
  "chat-archive",
36464
36544
  validate_chat_archive_scenario,
@@ -71,14 +71,14 @@ const BUNDLED = {
71
71
  sendsTo: "DeepSeek, through the provider the profile configures (by default deepseek-official, model deepseek-flash)",
72
72
  pitfalls: [
73
73
  {
74
- date: "2026-10-04",
75
- source: "dsh --version, 0.2.0-rc.2",
76
- text: "The CLI lives inside the app bundle and is not on PATH.",
74
+ date: "2026-10-05",
75
+ source: "ls -l ~/.local/bin/dsh and dsh --version, 0.2.0-rc.2 (rtl_ppa_prj #191)",
76
+ text: "The CLI lives inside the app bundle. A `~/.local/bin/dsh` on PATH, where one exists, is a symlink to that same file, so the catalog keeps the bundle path, which works with or without it.",
77
77
  },
78
78
  {
79
79
  date: "2026-10-05",
80
- source: "dsh --profile headless, 0.2.0-rc.2",
81
- text: "The headless profile fails with MISSING_CREDENTIAL until a DeepSeek API key is stored through the app's Models page or DEEPSEEK_API_KEY is exported where it is launched.",
80
+ source: "dsh --profile headless, 0.2.0-rc.2 (rtl_ppa_prj #191)",
81
+ text: "First use needs a DeepSeek API key, stored once through the app's Models page or exported as DEEPSEEK_API_KEY where it is launched; until then the headless profile fails with MISSING_CREDENTIAL. With the key stored it runs from any directory.",
82
82
  },
83
83
  {
84
84
  date: "2026-10-04",
@@ -172,7 +172,7 @@ function bodyText(record) {
172
172
  // `[redacted]`, and neither the cut pointer nor the owner mention is Markdown
173
173
  // to translate (chat-slack-format D1).
174
174
  function slackText(project, record, text) {
175
- let result = mrkdwn.toSlack(redact(text));
175
+ let result = mrkdwn.toSlack(redact(text), { repo: project.github });
176
176
  if (result.length > TEXT_LIMIT) {
177
177
  result = `${result.slice(0, TEXT_LIMIT)}… (cut; full text: \`keel chat show ${record.id}\`)`;
178
178
  }
@@ -850,10 +850,19 @@ function prepareProjects() {
850
850
  if (!project.channelGroups.has(channel)) project.channelGroups.set(channel, group);
851
851
  }
852
852
  buildTsIndex(project);
853
+ project.github = githubRepo(project.where.worktree);
853
854
  }
854
855
  return projects;
855
856
  }
856
857
 
858
+ // `owner/repo` of the project's `origin` when it is on GitHub, which a bare
859
+ // `#N` in a record links to (chat-issue-links D1); null otherwise.
860
+ function githubRepo(worktree) {
861
+ const result = require("child_process").spawnSync("git", ["remote", "get-url", "origin"], { cwd: worktree, encoding: "utf8", timeout: 5000 });
862
+ const match = String(result.stdout || "").trim().match(/github\.com[:/]([\w.-]+\/[\w.-]+?)(?:\.git)?\/?$/);
863
+ return result.status === 0 && match ? match[1] : null;
864
+ }
865
+
857
866
  async function createContext(log, { needApp }) {
858
867
  requireWebSocket();
859
868
  const { bot, app } = lifecycle.tokens();
@@ -16,6 +16,11 @@ const BOLD = "\u0001";
16
16
  // on each side of every marker pair supplies the boundary, checked against
17
17
  // real Slack on 2026-10-05 (#187). Inbound text drops them again.
18
18
  const ZWSP = "\u200b";
19
+ // An issue reference at a word boundary, `owner/repo#N` or a bare `#N`, and
20
+ // any Slack link already made, which is matched first so that a reference
21
+ // inside one is left alone (chat-issue-links D3).
22
+ const ISSUE = /(<[^>\n]*>)|(?<![\w#/;&.-])((?:([\w.-]+\/[\w.-]+))?#(\d{1,7}))(?![\w#])/g;
23
+ const ISSUE_LINK = /<https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/(?:issues|pull)\/\d+\|((?:[\w.-]+\/[\w.-]+)?#\d+)>/g;
19
24
 
20
25
  // Calls `prose` on the text outside code and `code` on the code itself.
21
26
  function byCode(text, prose, code) {
@@ -45,9 +50,20 @@ function unescape(text) {
45
50
  return text.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
46
51
  }
47
52
 
48
- function proseToSlack(text) {
49
- return escape(text)
50
- .replace(/\[([^\]\n]+)\]\((https?:\/\/[^)\s]+|mailto:[^)\s]+)\)/g, (match, label, url) => `<${url}|${label}>`)
53
+ // `owner/repo#N` links to that repository; a bare `#N` to `repo`, the
54
+ // project's own GitHub repository, and stays text without one (D1, D2).
55
+ function linkIssues(text, repo) {
56
+ return text.replace(ISSUE, (match, link, ref, named, number) => {
57
+ if (link) return link;
58
+ const target = named || repo;
59
+ if (!target) return match;
60
+ return `<https://github.com/${target}/issues/${number}|${ref}>`;
61
+ });
62
+ }
63
+
64
+ function proseToSlack(text, repo) {
65
+ return linkIssues(escape(text)
66
+ .replace(/\[([^\]\n]+)\]\((https?:\/\/[^)\s]+|mailto:[^)\s]+)\)/g, (match, label, url) => `<${url}|${label}>`), repo)
51
67
  .replace(/^(\s*)[-*+][ \t]+/gm, "$1• ")
52
68
  .replace(/^#{1,6}[ \t]+(.+?)[ \t]*#*[ \t]*$/gm, `${BOLD}$1${BOLD}`)
53
69
  .replace(/\*\*(?!\s)([^\n]+?)\*\*/g, `${BOLD}$1${BOLD}`)
@@ -59,6 +75,7 @@ function proseToSlack(text) {
59
75
 
60
76
  function proseFromSlack(text) {
61
77
  return unescape(text.split(ZWSP).join("")
78
+ .replace(ISSUE_LINK, "$1")
62
79
  .replace(/<((?:https?:\/\/|mailto:)[^|>\s]+)\|([^>]+)>/g, "[$2]($1)")
63
80
  .replace(/<((?:https?:\/\/|mailto:)[^|>\s]+)>/g, "$1")
64
81
  .replace(/(^|[^\w*])\*(?![\s*])([^*\n]+?)\*(?![\w*])/g, `$1${BOLD}${BOLD}$2${BOLD}${BOLD}`)
@@ -67,8 +84,8 @@ function proseFromSlack(text) {
67
84
  .split(BOLD).join("*"));
68
85
  }
69
86
 
70
- function toSlack(text) {
71
- return byCode(String(text || ""), proseToSlack, escape);
87
+ function toSlack(text, { repo = null } = {}) {
88
+ return byCode(String(text || ""), (prose) => proseToSlack(prose, repo), escape);
72
89
  }
73
90
 
74
91
  function fromSlack(text) {