@christang/keel 5.90.2 → 5.91.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.90.2 -->
1
+ <!-- keel:start version=5.91.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.90.2",
3
+ "version": "5.91.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.90.2",
9
+ "version": "5.91.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.90.2",
5
+ "version": "5.91.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.90.2",
3
+ "version": "5.91.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.90.2",
3
+ "version": "5.91.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",
@@ -102,13 +102,16 @@ TASKS_LEGACY_HEADING_PATTERNS = (
102
102
  "remove legacy ## Current Completion; derive progress from checklist [x]/[ ] state",
103
103
  ),
104
104
  )
105
+ TASKS_DIRTY_STATE_PATTERN = re.compile(
106
+ r"(?i)\b(?:dirty|uncommitted|not\s+committed|pending\s+commit)\b"
107
+ )
105
108
  TASKS_COMMIT_STATUS_PATTERNS = (
106
109
  (
107
110
  re.compile(r"(?i)\bcommit[-\s]?hash\b"),
108
111
  "remove commit hash wording from tasks.md; git log is the source of truth",
109
112
  ),
110
113
  (
111
- re.compile(r"(?i)\b(?:dirty|uncommitted|not\s+committed|pending\s+commit)\b"),
114
+ TASKS_DIRTY_STATE_PATTERN,
112
115
  "remove dirty/uncommitted state from tasks.md; keep durable work state in OpenSpec and use HANDOFF only as an explicit pointer override",
113
116
  ),
114
117
  (
@@ -171,6 +174,29 @@ TASKS_CONTEXTUAL_HASH_RE = re.compile(
171
174
  rf"(?i){_HASH_CONTEXT_WORD}.*{_HASH_SHAPED_TOKEN}|"
172
175
  rf"{_HASH_SHAPED_TOKEN}.*{_HASH_CONTEXT_WORD}"
173
176
  )
177
+ # Inside a task field the two rules above read a claim, not a line (#213). A
178
+ # field cites its provenance — the base a Scope check compared against, which
179
+ # keel-review-checklist asks it to name, the commit a result ran on, the inputs
180
+ # a hash identifies — and a context word elsewhere on that line does not make
181
+ # the token a record. So a field refuses a token only where a state claim binds
182
+ # it: a context word naming it directly, or the token followed by the act.
183
+ TASKS_FIELD_BOUND_HASH_RE = re.compile(
184
+ r"(?i)\b(?:commits?|committed|committing|master|main|HEAD|hash(?:es)?)\b"
185
+ r"[\s:=@(\uff08-]*(?:(?:is|was|now)\s+)?(?:(?:at|as|to|into|onto|in|on)\s+)?"
186
+ rf"{_HASH_SHAPED_TOKEN}"
187
+ rf"|{_HASH_SHAPED_TOKEN}\s*(?:(?:is|was)\s+)?\b(?:committed|merged|pushed)\b"
188
+ rf"|(?:提交|合入|哈希)\S{{0,4}}?\s*{_HASH_SHAPED_TOKEN}"
189
+ )
190
+ # Likewise `dirty` names the design under test as often as this worktree — a
191
+ # cache buffer's dirty groups — and a negation says the opposite of what the
192
+ # bare word matched. Inside a field the word is refused only as a claim about
193
+ # the work: predicative after a copula, or the value of a Status/State label.
194
+ TASKS_FIELD_DIRTY_STATE_RE = re.compile(
195
+ r"(?i)\b(?:is|are|was|were|remains?|remained|stays?|stayed|left)\s+"
196
+ r"(?:(?:still|now|yet)\s+)?(?:dirty|uncommitted)\b"
197
+ r"|\b(?:status|state)\s*[:\uff1a=]\s*(?:dirty|uncommitted)\b"
198
+ r"|\bnot\s+(?:yet\s+)?committed\b|\bpending\s+commit\b"
199
+ )
174
200
 
175
201
 
176
202
  @dataclass(frozen=True)
@@ -735,6 +761,25 @@ def covers_field_lines(content: str) -> set[int]:
735
761
  return lines
736
762
 
737
763
 
764
+ def task_field_lines(content: str) -> set[int]:
765
+ """1-based line numbers inside any task field.
766
+
767
+ A field starts at a two-space `- Name:` label, the compiler's bound, and
768
+ runs until a non-blank line indented less than two spaces — the next task
769
+ title, a heading, or a notes section, which keep the line-wide rules.
770
+ """
771
+ inside = False
772
+ lines: set[int] = set()
773
+ for number, line in enumerate(content.splitlines(), start=1):
774
+ if TASKS_FIELD_LABEL_RE.match(line):
775
+ inside = True
776
+ elif line.strip() and not line.startswith(" "):
777
+ inside = False
778
+ if inside:
779
+ lines.add(number)
780
+ return lines
781
+
782
+
738
783
  # What an author quotes is content they cite, not a claim they make. Evidence
739
784
  # prose quotes the command that ran, the output it printed, the branch base it
740
785
  # ran against, and the name of the requirement under change — and every one of
@@ -787,6 +832,7 @@ def check_tasks_semantics(repo: Path) -> list[str]:
787
832
  errors.append(f"{relative}:{line}: {message}")
788
833
 
789
834
  cited = covers_field_lines(content)
835
+ fields = task_field_lines(content)
790
836
  fenced = False
791
837
  for line_number, line in enumerate(content.splitlines(), start=1):
792
838
  # A fenced block is one long quoted span, and its own delimiter
@@ -799,7 +845,10 @@ def check_tasks_semantics(repo: Path) -> list[str]:
799
845
  if fenced or is_tasks_rule_line(line) or line_number in cited:
800
846
  continue
801
847
  line = without_quoted_spans(line)
848
+ in_field = line_number in fields
802
849
  for pattern, message in TASKS_COMMIT_STATUS_PATTERNS:
850
+ if in_field and pattern is TASKS_DIRTY_STATE_PATTERN:
851
+ pattern = TASKS_FIELD_DIRTY_STATE_RE
803
852
  if pattern.search(line):
804
853
  errors.append(f"{relative}:{line_number}: {message}")
805
854
  if TASKS_SUBMISSION_STATE_RE.search(line) and TASKS_GIT_CONTEXT_RE.search(
@@ -808,7 +857,8 @@ def check_tasks_semantics(repo: Path) -> list[str]:
808
857
  errors.append(
809
858
  f"{relative}:{line_number}: {TASKS_SUBMISSION_MESSAGE}"
810
859
  )
811
- if TASKS_CONTEXTUAL_HASH_RE.search(line):
860
+ hash_rule = TASKS_FIELD_BOUND_HASH_RE if in_field else TASKS_CONTEXTUAL_HASH_RE
861
+ if hash_rule.search(line):
812
862
  errors.append(
813
863
  f"{relative}:{line_number}: remove contextual commit hash from tasks.md; git log is the source of truth"
814
864
  )
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
47
47
  "scripts/validate_plugin.py",
48
48
  ]
49
49
 
50
- PACKAGE_VERSION = "5.90.2"
51
- PROTOCOL_VERSION = "5.90.2"
50
+ PACKAGE_VERSION = "5.91.0"
51
+ PROTOCOL_VERSION = "5.91.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
@@ -29733,6 +29733,90 @@ def validate_a_quoted_span_is_not_a_claim_scenario() -> int:
29733
29733
  return 0
29734
29734
 
29735
29735
 
29736
+ def validate_a_task_field_cites_its_provenance_scenario() -> int:
29737
+ """Issue #213: a Review field naming its base failed `keel state`.
29738
+
29739
+ The contextual-hash rule matched a context word and a hash-shaped token
29740
+ anywhere on one line, and the dirty rule matched the bare word. Inside a
29741
+ task field that reads cited provenance as recorded state: the base a Scope
29742
+ check compared against (which keel-review-checklist asks it to name), the
29743
+ commit a result ran on, a cache buffer's `dirty groups`, and a negation
29744
+ about another checkout. Each accepted line below is one rtl_ppa_prj wrote,
29745
+ shortened; line 262's shape is an Acceptance criterion of a checked task,
29746
+ so rewording it would move a recorded fingerprint.
29747
+ """
29748
+ label = "a-task-field-cites-its-provenance"
29749
+ task = "- [x] A1 implementation\n"
29750
+ accepted = (
29751
+ ("a Scope check naming its base",
29752
+ " - Evidence:\n - Review:\n - Scope check: git diff against task-start "
29753
+ "base 1f3a6b0 changes only the declared TB. Frozen input hashes identify "
29754
+ "actual 211dfb5 RTL.\n"),
29755
+ ("an Acceptance check naming the commit it ran on",
29756
+ " - Evidence:\n - Review:\n - Acceptance check: P2 55/55 on dec4d6e. "
29757
+ "All 15 manifests match current source hashes.\n"),
29758
+ ("an Acceptance criterion bounding scope by a base",
29759
+ " - Acceptance:\n - Only declared files change after synchronized base "
29760
+ "dec4d6e. Capture shared HEAD and reject unexpected staged scope before commit.\n"),
29761
+ ("a domain term",
29762
+ " - Evidence:\n - M2: pass. All 24 resource traces end with no dirty groups.\n"),
29763
+ ("a negation about another checkout",
29764
+ " - Evidence:\n - Review:\n - Scope check: no design edits were authored "
29765
+ "or copied from uncommitted Claude changes.\n"),
29766
+ )
29767
+ refused = (
29768
+ ("a commit recorded in a field",
29769
+ " - Evidence:\n - M1: pass, committed to main as a1b2c3d.\n"),
29770
+ ("HEAD recorded in a field", " - Evidence:\n - M1: HEAD is at a1b2c3d.\n"),
29771
+ ("a merge recorded in Chinese", " - Evidence:\n - M1: 已合入 a1b2c3d。\n"),
29772
+ ("work state stated in a field",
29773
+ " - Evidence:\n - M1: pass, but the work is still uncommitted.\n"),
29774
+ ("a Status value", " - Evidence:\n - Status: dirty\n"),
29775
+ )
29776
+
29777
+ with tempfile.TemporaryDirectory(prefix="keel-task-field-") as raw:
29778
+ check, failure = _tasks_semantics_probe(raw)
29779
+ if failure is not None:
29780
+ report(f"{label}: keel --install failed while building the fixture.")
29781
+ report(failure)
29782
+ return 1
29783
+ for description, body in accepted:
29784
+ state, errors = check(task + body)
29785
+ if state == "unreported":
29786
+ report(f"{label}: keel --check reported no state at all on {description}.")
29787
+ return 1
29788
+ if state != "ok":
29789
+ report(f"{label}: {description} was refused as recorded state. A task "
29790
+ "field cites its provenance, and the only repair open to the "
29791
+ "author is to leave the evidence out.")
29792
+ for error in errors:
29793
+ report(f" {error}")
29794
+ return 1
29795
+ # The boundary: a bound claim inside a field, and any claim outside one.
29796
+ for description, body in (*refused, (
29797
+ "a title line carrying a context word and a hash apart",
29798
+ "- [x] A1 done on main, see a1b2c3d\n - Touch:\n - src/a.js\n",
29799
+ )):
29800
+ text = body if body.startswith("- [") else task + body
29801
+ state, errors = check(text)
29802
+ if state == "unreported":
29803
+ report(f"{label}: keel --check reported no state at all on {description}.")
29804
+ return 1
29805
+ if state != "failed":
29806
+ report(f"{label}: {description} was accepted. Binding the rule to a "
29807
+ "claim must not stop it refusing the claim.")
29808
+ return 1
29809
+ if not [error for error in errors if "tasks.md:" in error]:
29810
+ report(f"{label}: the refusal of {description} named no line.")
29811
+ return 1
29812
+
29813
+ if label not in {name for name, _ in SCENARIOS}:
29814
+ report(f"{label}: the scenario registry does not include it.")
29815
+ return 1
29816
+ report(f"{label} scenario passed.")
29817
+ return 0
29818
+
29819
+
29736
29820
  def validate_a_covers_citation_is_not_a_record_scenario() -> int:
29737
29821
  """Issue #65 §4: the rule refused a tasks.md that cited it.
29738
29822
 
@@ -35606,6 +35690,10 @@ SCENARIOS: tuple = (
35606
35690
  "a-covers-citation-is-not-a-record",
35607
35691
  validate_a_covers_citation_is_not_a_record_scenario,
35608
35692
  ),
35693
+ (
35694
+ "a-task-field-cites-its-provenance",
35695
+ validate_a_task_field_cites_its_provenance_scenario,
35696
+ ),
35609
35697
  ("validation-runner", validate_validation_runner_scenario),
35610
35698
  ("section-boundary", validate_section_boundary_scenario),
35611
35699
  ("review-entry-extent", validate_review_entry_extent_scenario),