@christang/keel 5.231.4 → 5.231.5

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.231.4",
3
+ "version": "5.231.5",
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.231.4 -->
1
+ <!-- keel:start version=5.231.5 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the durable authority, and memory or transcripts may only inform.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.231.4",
3
+ "version": "5.231.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.231.4",
9
+ "version": "5.231.5",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@fission-ai/openspec": "1.14.0"
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.231.4",
5
+ "version": "5.231.5",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.231.4",
3
+ "version": "5.231.5",
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.231.4",
3
+ "version": "5.231.5",
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",
@@ -1605,6 +1605,30 @@ def validate_chat_records_scenario() -> int:
1605
1605
  if not todo_id:
1606
1606
  report(f"{label} keel chat todo did not report an id: {todo.stdout.strip()} {todo.stderr.strip()}")
1607
1607
  return 1
1608
+ chat(verify, "read", "soc")
1609
+ store = mailbox_common_dir(rtl) / "keel-chat"
1610
+
1611
+ def snapshot():
1612
+ return {
1613
+ file.relative_to(store): file.read_bytes()
1614
+ for directory in (store / "groups", store / "cursors")
1615
+ for file in directory.rglob("*") if file.is_file()
1616
+ }
1617
+
1618
+ def show(record_id):
1619
+ result = chat(verify, "show", record_id, "--json")
1620
+ assert result.returncode == 0, result.stderr
1621
+ return chat_json(result)
1622
+
1623
+ before = snapshot()
1624
+ active = show(todo_id)
1625
+ assert active.get("task") == {
1626
+ "id": todo_id,
1627
+ "state": "open",
1628
+ "closureRecordId": None,
1629
+ }, "task view missing for open todo"
1630
+ assert active["record"]["id"] == todo_id and "readers" in active
1631
+ assert snapshot() == before, "open task query wrote to chat"
1608
1632
  mine = chat_json(chat(verify, "todos", "--mine", "--json")).get("todos", [])
1609
1633
  listed = [t for t in mine if t.get("id") == todo_id]
1610
1634
  if not listed:
@@ -1621,8 +1645,20 @@ def validate_chat_records_scenario() -> int:
1621
1645
  if todo_id in open_ids:
1622
1646
  report(f"{label} a todo answered with ✅ is still listed: {open_ids!r}")
1623
1647
  return 1
1648
+ before = snapshot()
1649
+ completed = show(todo_id)["task"]
1650
+ assert completed == {
1651
+ "id": todo_id,
1652
+ "state": "closed",
1653
+ "closureRecordId": completed["closureRecordId"],
1654
+ }
1655
+ receipt = show(completed["closureRecordId"])
1656
+ assert receipt["record"]["kind"] == "done" and receipt["record"]["target"] == todo_id
1657
+ assert "task" not in receipt
1658
+ assert show(todo_id)["task"] == completed
1659
+ assert snapshot() == before, "closed task query wrote to chat"
1624
1660
  second_id = chat_json(chat(rtl, "todo", "soc", "--assignee", "verify", "Update the spec", "--json")).get("id", "")
1625
- done = chat(verify, "done", second_id)
1661
+ done = chat(verify, "done", second_id, "--json")
1626
1662
  if done.returncode != 0:
1627
1663
  report(f"{label} keel chat done failed: {done.stderr.strip()}")
1628
1664
  return 1
@@ -1630,9 +1666,12 @@ def validate_chat_records_scenario() -> int:
1630
1666
  if second_id in open_ids:
1631
1667
  report(f"{label} a todo closed with keel chat done is still listed: {open_ids!r}")
1632
1668
  return 1
1669
+ explicit = {"id": second_id, "state": "closed", "closureRecordId": chat_json(done)["id"]}
1670
+ assert show(second_id)["task"] == explicit
1633
1671
 
1634
1672
  message_id = chat_json(chat(rtl, "post", "soc", "Clock is 100MHz", "--json")).get("id", "")
1635
1673
  message_file = chat_log(rtl, "soc") / f"{message_id}.md"
1674
+ assert "task" not in show(message_id)
1636
1675
  original = message_file.read_bytes()
1637
1676
  foreign = chat(verify, "edit", message_id, "Clock is 50MHz")
1638
1677
  if foreign.returncode == 0:
@@ -1683,6 +1722,12 @@ def validate_chat_records_scenario() -> int:
1683
1722
  if "06:00:00+00:00" in local.stdout:
1684
1723
  report(f"{label} the view prints the raw stored stamp.")
1685
1724
  return 1
1725
+ archived = chat(rtl, "group", "archive", "soc")
1726
+ assert archived.returncode == 0, archived.stderr
1727
+ before = snapshot()
1728
+ assert show(second_id)["task"] == explicit
1729
+ assert show(todo_id)["task"] == completed
1730
+ assert snapshot() == before, "archived task query wrote to chat"
1686
1731
 
1687
1732
  if "chat-records" not in {name for name, _ in registry.SCENARIOS}:
1688
1733
  report(f"{label} scenario is not registered.")
@@ -35,10 +35,10 @@ os.environ["KEEL_UPDATE_CLAUDE"] = str(Path(tempfile.gettempdir()) / "keel-suite
35
35
  os.environ["KEEL_UPDATE_CODEX"] = str(Path(tempfile.gettempdir()) / "keel-suite-has-no-codex")
36
36
 
37
37
 
38
- PACKAGE_VERSION = "5.231.4"
38
+ PACKAGE_VERSION = "5.231.5"
39
39
 
40
40
 
41
- PROTOCOL_VERSION = "5.231.4"
41
+ PROTOCOL_VERSION = "5.231.5"
42
42
 
43
43
 
44
44
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
@@ -493,8 +493,14 @@ function dispatch(where, options) {
493
493
  if (!record) throw new ChatError(`No record ${id}.`);
494
494
  const readers = store.readersOf(where, record);
495
495
  const acks = record.ack === "requested" ? store.ackStatus(where, record) : null;
496
- if (options.json) out(JSON.stringify({ record: publicRecord(record), readers, ...(acks ? { acks } : {}) }));
497
- else out([`${record.group} ${formatLine(record)}`, `read by: ${readers.join(", ") || "nobody yet"}`, ...(acks ? ackLines(acks) : [])].join("\n"));
496
+ if (options.json) {
497
+ const result = { record: publicRecord(record), readers, ...(acks ? { acks } : {}) };
498
+ if (record.kind === "todo") {
499
+ const closure = store.todoClosure(where, record);
500
+ result.task = { id: record.id, state: closure ? "closed" : "open", closureRecordId: closure ? closure.id : null };
501
+ }
502
+ out(JSON.stringify(result));
503
+ } else out([`${record.group} ${formatLine(record)}`, `read by: ${readers.join(", ") || "nobody yet"}`, ...(acks ? ackLines(acks) : [])].join("\n"));
498
504
  return 0;
499
505
  }
500
506
  case "todo": {
@@ -689,7 +689,7 @@ function post(where, options) {
689
689
  text: text.replace(/\s+$/, ""),
690
690
  });
691
691
  // A reply that opens with `done` or ✅ closes the todo it answers (D6).
692
- if (parent && parent.kind === "todo" && DONE_REPLY.test(text) && !isDone(where, parent)) {
692
+ if (parent && parent.kind === "todo" && DONE_REPLY.test(text) && !todoClosure(where, parent)) {
693
693
  writeRecord(where, { group, kind: "done", from, target: parent.id });
694
694
  }
695
695
  // Answering a record marks it read for the one who answered (#201): a woken
@@ -795,8 +795,9 @@ function supersededIds(records) {
795
795
  return ids;
796
796
  }
797
797
 
798
- function isDone(where, todo) {
799
- return readLog(where, todo.group).some((record) => record.kind === "done" && record.target === todo.id);
798
+ function todoClosure(where, todo) {
799
+ checkGroup(todo.group);
800
+ return readLog(where, todo.group).find((record) => record.kind === "done" && record.target === todo.id);
800
801
  }
801
802
 
802
803
  function normalizeIssue(issue) {
@@ -831,7 +832,7 @@ function targetFor(where, id, actor, kinds) {
831
832
  function done(where, id) {
832
833
  const from = requireRole(where);
833
834
  const target = targetFor(where, id, from, ["todo"]);
834
- if (isDone(where, target)) throw new ChatError(`Todo ${id} is already done.`);
835
+ if (todoClosure(where, target)) throw new ChatError(`Todo ${id} is already done.`);
835
836
  const record = writeRecord(where, { group: target.group, kind: "done", from, target: id });
836
837
  advanceCursor(where, from, target.group, id);
837
838
  return record;
@@ -1137,6 +1138,7 @@ module.exports = {
1137
1138
  amend,
1138
1139
  done,
1139
1140
  openTodos,
1141
+ todoClosure,
1140
1142
  search,
1141
1143
  todo,
1142
1144
  archiveGroup,