@christang/keel 5.80.0 → 5.82.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.
- package/assets/bootstrap/AGENTS.md +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/plugins/keel/skills/keel-align-expectations/SKILL.md +2 -2
- package/scripts/validate_plugin.py +312 -3
- package/src/core/task-contract.js +82 -14
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.82.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.
|
|
9
|
+
"version": "5.82.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.82.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.
|
|
3
|
+
"version": "5.82.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",
|
|
@@ -7,7 +7,7 @@ description: Align explicit requirements, implicit expectations, non-goals, obse
|
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
9
9
|
|
|
10
|
-
Turn user intent and repository facts into durable OpenSpec authority before specs and executable tasks harden. Alignment is risk-scaled: clear, complete, low-risk requests pass through a compact quick path; material ambiguity switches to a focused deep path. This skill owns materiality routing, acceptance authority, and write-back ownership;
|
|
10
|
+
Turn user intent and repository facts into durable OpenSpec authority before specs and executable tasks harden. Alignment is risk-scaled: clear, complete, low-risk requests pass through a compact quick path; material ambiguity switches to a focused deep path. This skill owns materiality routing, acceptance authority, and write-back ownership; which surface a host offers for asking is the host's, and it does not replace `/opsx:apply`, review, or OpenSpec artifact mechanics.
|
|
11
11
|
|
|
12
12
|
## Routing
|
|
13
13
|
|
|
@@ -21,7 +21,7 @@ State the extracted goals, non-goals, observable Acceptance, constraints, and ev
|
|
|
21
21
|
|
|
22
22
|
## Deep path
|
|
23
23
|
|
|
24
|
-
Pause spec/task finalization and ask one material decision at a time. Each question explains in plain terms why the decision matters and provides a recommended answer. Continue only until executable authority is clear; do not run a broad brainstorming session. A material choice that stays unresolved becomes a Q<n> with an owner or resolution gate, and no affected task becomes executable until it is accepted, verified, durably owned, or explicitly discarded.
|
|
24
|
+
Pause spec/task finalization and ask one material decision at a time. Each question explains in plain terms why the decision matters and provides a recommended answer. When the host offers a structured-choice surface, ask a decision whose answers can be enumerated through it, with the recommended option first and marked; keep prose for open questions and for hosts with no such surface. Continue only until executable authority is clear; do not run a broad brainstorming session. A material choice that stays unresolved becomes a Q<n> with an owner or resolution gate, and no affected task becomes executable until it is accepted, verified, durably owned, or explicitly discarded.
|
|
25
25
|
|
|
26
26
|
## Implicit expectations are proposals
|
|
27
27
|
|
|
@@ -38,8 +38,8 @@ REQUIRED_SCRIPTS = [
|
|
|
38
38
|
"scripts/validate_plugin.py",
|
|
39
39
|
]
|
|
40
40
|
|
|
41
|
-
PACKAGE_VERSION = "5.
|
|
42
|
-
PROTOCOL_VERSION = "5.
|
|
41
|
+
PACKAGE_VERSION = "5.82.0"
|
|
42
|
+
PROTOCOL_VERSION = "5.82.0"
|
|
43
43
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
44
44
|
OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
|
|
45
45
|
# Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
|
|
@@ -1702,7 +1702,7 @@ def validate_unparsed_covers_critical_statement_scenario() -> int:
|
|
|
1702
1702
|
f"must report Unparsed, got: {message!r}"
|
|
1703
1703
|
)
|
|
1704
1704
|
return 1
|
|
1705
|
-
if "D2 —
|
|
1705
|
+
if "D2 — statement" not in message:
|
|
1706
1706
|
report(
|
|
1707
1707
|
"unparsed-covers-critical-statement: the Unparsed message must "
|
|
1708
1708
|
f"name the required shape, got: {message!r}"
|
|
@@ -1873,6 +1873,303 @@ def validate_widened_critical_statement_shapes_scenario() -> int:
|
|
|
1873
1873
|
return 0
|
|
1874
1874
|
|
|
1875
1875
|
|
|
1876
|
+
def validate_whole_critical_statement_authority_scenario() -> int:
|
|
1877
|
+
"""Issue #177: every owned line, but no sibling, binds cited authority."""
|
|
1878
|
+
task = task_capsule_compact_fixture().replace(
|
|
1879
|
+
" - E1: Public behavior passes.\n", " - D1\n"
|
|
1880
|
+
)
|
|
1881
|
+
base = (
|
|
1882
|
+
"## Decisions\n\n"
|
|
1883
|
+
"- D1 — Preserve semantics.\n"
|
|
1884
|
+
" continuation alpha\n"
|
|
1885
|
+
" - nested detail alpha\n\n"
|
|
1886
|
+
"- D2 — Peer decision.\n\n"
|
|
1887
|
+
"Independent paragraph.\n\n"
|
|
1888
|
+
"## Following heading\n"
|
|
1889
|
+
)
|
|
1890
|
+
|
|
1891
|
+
with tempfile.TemporaryDirectory(prefix="keel-whole-critical-") as raw:
|
|
1892
|
+
repo = Path(raw)
|
|
1893
|
+
design_path = repo / "openspec/changes/demo/design.md"
|
|
1894
|
+
write_text(repo / "openspec/changes/demo/tasks.md", task)
|
|
1895
|
+
|
|
1896
|
+
def start(design: str, *extra: str) -> tuple[int, dict]:
|
|
1897
|
+
write_text(design_path, design)
|
|
1898
|
+
result = run_keel(
|
|
1899
|
+
repo, "gate", "task-start", "--change", "demo", "--task", "1.1",
|
|
1900
|
+
*extra, "--json",
|
|
1901
|
+
)
|
|
1902
|
+
return result.returncode, json.loads(result.stdout)
|
|
1903
|
+
|
|
1904
|
+
code, initial = start(base)
|
|
1905
|
+
if code != 0:
|
|
1906
|
+
report("whole-critical-statement-authority: accepted D1 did not compile.")
|
|
1907
|
+
report(str(initial))
|
|
1908
|
+
return 1
|
|
1909
|
+
authority = initial["contract"]["capsule"]["authority"]
|
|
1910
|
+
if authority[0]["text"] != (
|
|
1911
|
+
"Preserve semantics. continuation alpha - nested detail alpha"
|
|
1912
|
+
):
|
|
1913
|
+
report(
|
|
1914
|
+
"whole-critical-statement-authority: the D1 authority omitted "
|
|
1915
|
+
f"an owned line: {authority[0]['text']!r}"
|
|
1916
|
+
)
|
|
1917
|
+
return 1
|
|
1918
|
+
fingerprint = initial["contract"]["fingerprint"]["value"]
|
|
1919
|
+
|
|
1920
|
+
for old, new, label in (
|
|
1921
|
+
("continuation alpha", "continuation beta", "continuation"),
|
|
1922
|
+
("nested detail alpha", "nested detail beta", "nested bullet"),
|
|
1923
|
+
):
|
|
1924
|
+
code, changed = start(base.replace(old, new))
|
|
1925
|
+
if code != 0:
|
|
1926
|
+
report(f"whole-critical-statement-authority: {label} edit failed to compile.")
|
|
1927
|
+
return 1
|
|
1928
|
+
if changed["contract"]["fingerprint"]["value"] == fingerprint:
|
|
1929
|
+
report(
|
|
1930
|
+
f"whole-critical-statement-authority: {label} edit left "
|
|
1931
|
+
"the cited contract fingerprint unchanged."
|
|
1932
|
+
)
|
|
1933
|
+
return 1
|
|
1934
|
+
|
|
1935
|
+
for old, new, label in (
|
|
1936
|
+
("Peer decision", "Changed peer", "peer bullet"),
|
|
1937
|
+
("Independent paragraph", "Changed paragraph", "peer paragraph"),
|
|
1938
|
+
("Following heading", "Changed heading", "heading"),
|
|
1939
|
+
):
|
|
1940
|
+
code, changed = start(base.replace(old, new))
|
|
1941
|
+
if code != 0:
|
|
1942
|
+
report(f"whole-critical-statement-authority: {label} edit failed to compile.")
|
|
1943
|
+
return 1
|
|
1944
|
+
if changed["contract"]["fingerprint"]["value"] != fingerprint:
|
|
1945
|
+
report(
|
|
1946
|
+
f"whole-critical-statement-authority: {label} edit "
|
|
1947
|
+
"incorrectly changed D1 authority."
|
|
1948
|
+
)
|
|
1949
|
+
return 1
|
|
1950
|
+
|
|
1951
|
+
# A `#` line nested inside the item is owned content (a code sample's
|
|
1952
|
+
# comment, a heading inside the list item), and an unindented line
|
|
1953
|
+
# with no blank before it continues the paragraph lazily. Neither may
|
|
1954
|
+
# cut the statement short; a blank-separated paragraph still ends it.
|
|
1955
|
+
for design, old, new, label in (
|
|
1956
|
+
(
|
|
1957
|
+
"## Decisions\n\n- D1 — Opener.\n - detail one\n"
|
|
1958
|
+
" # sample comment\n - detail after hash\n",
|
|
1959
|
+
"detail after hash", "detail changed", "detail after a nested #",
|
|
1960
|
+
),
|
|
1961
|
+
(
|
|
1962
|
+
"## Decisions\n\n- D1 — Opener wraps\nlazily onto this line.\n\n"
|
|
1963
|
+
"Separate paragraph.\n",
|
|
1964
|
+
"lazily onto", "lazily into", "lazy continuation",
|
|
1965
|
+
),
|
|
1966
|
+
):
|
|
1967
|
+
before_code, before = start(design)
|
|
1968
|
+
after_code, after = start(design.replace(old, new))
|
|
1969
|
+
if before_code != 0 or after_code != 0:
|
|
1970
|
+
report(f"whole-critical-statement-authority: {label} case failed to compile.")
|
|
1971
|
+
return 1
|
|
1972
|
+
if before["contract"]["fingerprint"]["value"] == after["contract"]["fingerprint"]["value"]:
|
|
1973
|
+
report(
|
|
1974
|
+
f"whole-critical-statement-authority: {label} edit left "
|
|
1975
|
+
"the cited contract fingerprint unchanged."
|
|
1976
|
+
)
|
|
1977
|
+
return 1
|
|
1978
|
+
if "Separate paragraph" not in design:
|
|
1979
|
+
continue
|
|
1980
|
+
_, peer = start(design.replace("Separate paragraph", "Changed paragraph"))
|
|
1981
|
+
if peer["contract"]["fingerprint"]["value"] != before["contract"]["fingerprint"]["value"]:
|
|
1982
|
+
report(
|
|
1983
|
+
f"whole-critical-statement-authority: {label} case let a "
|
|
1984
|
+
"blank-separated paragraph change D1 authority."
|
|
1985
|
+
)
|
|
1986
|
+
return 1
|
|
1987
|
+
|
|
1988
|
+
# Consecutive unbulleted openers are one CommonMark paragraph, but
|
|
1989
|
+
# each is its own decision: a peer opener is never a lazy line.
|
|
1990
|
+
adjacent = "## Decisions\n\nD1 — First.\n**D2** — Second.\n"
|
|
1991
|
+
before_code, before = start(adjacent)
|
|
1992
|
+
after_code, after = start(adjacent.replace("Second", "Changed"))
|
|
1993
|
+
if before_code != 0 or after_code != 0:
|
|
1994
|
+
report("whole-critical-statement-authority: adjacent-opener case failed to compile.")
|
|
1995
|
+
return 1
|
|
1996
|
+
if before["contract"]["fingerprint"]["value"] != after["contract"]["fingerprint"]["value"]:
|
|
1997
|
+
report(
|
|
1998
|
+
"whole-critical-statement-authority: an adjacent unbulleted "
|
|
1999
|
+
"peer opener was absorbed into D1 authority."
|
|
2000
|
+
)
|
|
2001
|
+
return 1
|
|
2002
|
+
|
|
2003
|
+
code, recorded = start(base, "--record", "--no-guard")
|
|
2004
|
+
if code != 0 or recorded.get("record", {}).get("status") != "recorded":
|
|
2005
|
+
report("whole-critical-statement-authority: could not record D1 anchor.")
|
|
2006
|
+
return 1
|
|
2007
|
+
write_text(design_path, base.replace("nested detail alpha", "nested detail beta"))
|
|
2008
|
+
completion = run_keel(
|
|
2009
|
+
repo, "gate", "task-complete", "--change", "demo", "--task", "1.1", "--json"
|
|
2010
|
+
)
|
|
2011
|
+
problems = json.loads(completion.stdout).get("problems", [])
|
|
2012
|
+
if not any(item.get("code") == "contract-drift" for item in problems):
|
|
2013
|
+
report(
|
|
2014
|
+
"whole-critical-statement-authority: task-complete missed "
|
|
2015
|
+
"drift after a nested detail changed."
|
|
2016
|
+
)
|
|
2017
|
+
report(completion.stdout.strip())
|
|
2018
|
+
return 1
|
|
2019
|
+
|
|
2020
|
+
code, colon = start("## Decisions\n\n- D1: colon shape.\n")
|
|
2021
|
+
messages = [item.get("message", "") for item in colon.get("problems", [])]
|
|
2022
|
+
if code == 0 or not any(
|
|
2023
|
+
"Unparsed Covers critical statement: D1." in message
|
|
2024
|
+
and "D1 —" in message
|
|
2025
|
+
for message in messages
|
|
2026
|
+
):
|
|
2027
|
+
report("whole-critical-statement-authority: colon shape lost its actionable refusal.")
|
|
2028
|
+
return 1
|
|
2029
|
+
|
|
2030
|
+
if "whole-critical-statement-authority" not in {name for name, _ in SCENARIOS}:
|
|
2031
|
+
report("whole-critical-statement-authority: scenario is not registered.")
|
|
2032
|
+
return 1
|
|
2033
|
+
report("whole-critical-statement-authority scenario passed.")
|
|
2034
|
+
return 0
|
|
2035
|
+
|
|
2036
|
+
|
|
2037
|
+
def validate_unlinked_critical_covers_scenario() -> int:
|
|
2038
|
+
"""Issue #177: critical citations must not silently become legacy prose."""
|
|
2039
|
+
design = (
|
|
2040
|
+
"## Decisions\n\n"
|
|
2041
|
+
"- D1 — First decision.\n"
|
|
2042
|
+
"- D2 — Second decision.\n"
|
|
2043
|
+
)
|
|
2044
|
+
with tempfile.TemporaryDirectory(prefix="keel-unlinked-critical-") as raw:
|
|
2045
|
+
repo = Path(raw)
|
|
2046
|
+
write_text(repo / "openspec/changes/demo/design.md", design)
|
|
2047
|
+
|
|
2048
|
+
def start(covers: str) -> tuple[int, dict]:
|
|
2049
|
+
write_text(
|
|
2050
|
+
repo / "openspec/changes/demo/tasks.md",
|
|
2051
|
+
task_capsule_compact_fixture().replace(
|
|
2052
|
+
" - E1: Public behavior passes.\n", f" - {covers}\n"
|
|
2053
|
+
),
|
|
2054
|
+
)
|
|
2055
|
+
result = run_keel(
|
|
2056
|
+
repo, "gate", "task-start", "--change", "demo", "--task", "1.1", "--json"
|
|
2057
|
+
)
|
|
2058
|
+
return result.returncode, json.loads(result.stdout)
|
|
2059
|
+
|
|
2060
|
+
for covers in (
|
|
2061
|
+
"D1、D2",
|
|
2062
|
+
"D1,D2",
|
|
2063
|
+
"D1 D2",
|
|
2064
|
+
"Implement both decisions(D1、D2)",
|
|
2065
|
+
):
|
|
2066
|
+
code, payload = start(covers)
|
|
2067
|
+
messages = [item.get("message", "") for item in payload.get("problems", [])]
|
|
2068
|
+
if code == 0:
|
|
2069
|
+
report(f"unlinked-critical-covers: {covers!r} passed as unlinked prose.")
|
|
2070
|
+
return 1
|
|
2071
|
+
if not any(covers in message and "D1, D2" in message for message in messages):
|
|
2072
|
+
report(
|
|
2073
|
+
f"unlinked-critical-covers: {covers!r} lacks a diagnostic "
|
|
2074
|
+
"naming the entry and the supported list form."
|
|
2075
|
+
)
|
|
2076
|
+
report(str(messages))
|
|
2077
|
+
return 1
|
|
2078
|
+
|
|
2079
|
+
for covers, expected in (
|
|
2080
|
+
("D1", ["D1"]),
|
|
2081
|
+
("D1, D2", ["D1", "D2"]),
|
|
2082
|
+
("D1 — annotation", ["D1"]),
|
|
2083
|
+
):
|
|
2084
|
+
code, payload = start(covers)
|
|
2085
|
+
if code != 0:
|
|
2086
|
+
report(f"unlinked-critical-covers: supported {covers!r} failed.")
|
|
2087
|
+
report(str(payload.get("problems", [])))
|
|
2088
|
+
return 1
|
|
2089
|
+
authority = payload["contract"]["capsule"]["authority"]
|
|
2090
|
+
actual = [item["reference"] for item in authority]
|
|
2091
|
+
if actual != expected or any(
|
|
2092
|
+
item["kind"] != "critical-statement" for item in authority
|
|
2093
|
+
):
|
|
2094
|
+
report(
|
|
2095
|
+
f"unlinked-critical-covers: supported {covers!r} lost "
|
|
2096
|
+
f"linked authority: {authority!r}"
|
|
2097
|
+
)
|
|
2098
|
+
return 1
|
|
2099
|
+
|
|
2100
|
+
for covers in (
|
|
2101
|
+
"F13 (Q1 resolved: the answer is recorded)",
|
|
2102
|
+
"D2: colon-form legacy description",
|
|
2103
|
+
"D2-compatible fixture text",
|
|
2104
|
+
):
|
|
2105
|
+
code, payload = start(covers)
|
|
2106
|
+
if code != 0:
|
|
2107
|
+
report(f"unlinked-critical-covers: existing free text {covers!r} was rejected.")
|
|
2108
|
+
report(str(payload.get("problems", [])))
|
|
2109
|
+
return 1
|
|
2110
|
+
|
|
2111
|
+
if "unlinked-critical-covers" not in {name for name, _ in SCENARIOS}:
|
|
2112
|
+
report("unlinked-critical-covers: scenario is not registered.")
|
|
2113
|
+
return 1
|
|
2114
|
+
report("unlinked-critical-covers scenario passed.")
|
|
2115
|
+
return 0
|
|
2116
|
+
|
|
2117
|
+
|
|
2118
|
+
def validate_decisions_are_selectable_scenario() -> int:
|
|
2119
|
+
"""Issue #174: an enumerable decision is offered as selectable options.
|
|
2120
|
+
|
|
2121
|
+
The owner asked (2026-09-28) that a decision be something the user can
|
|
2122
|
+
pick, not type, wherever the host offers a structured choice. No gate can
|
|
2123
|
+
observe presentation, so this checks only that both carriers say so — the
|
|
2124
|
+
resident protocol and the alignment skill's deep path, in source and in
|
|
2125
|
+
the shipped copy — and that the portable skill names no host tool.
|
|
2126
|
+
"""
|
|
2127
|
+
label = "decisions-are-selectable:"
|
|
2128
|
+
|
|
2129
|
+
def section(text: str, heading: str) -> str:
|
|
2130
|
+
start = text.find(heading)
|
|
2131
|
+
if start < 0:
|
|
2132
|
+
return ""
|
|
2133
|
+
rest = text[start + len(heading):]
|
|
2134
|
+
end = rest.find("\n## ")
|
|
2135
|
+
return rest if end < 0 else rest[:end]
|
|
2136
|
+
|
|
2137
|
+
def offers_choices(text: str) -> bool:
|
|
2138
|
+
lowered = " ".join(text.lower().split())
|
|
2139
|
+
return (
|
|
2140
|
+
"structured-choice surface" in lowered
|
|
2141
|
+
and "recommend" in lowered
|
|
2142
|
+
and "first" in lowered
|
|
2143
|
+
and "open question" in lowered
|
|
2144
|
+
and "prose" in lowered
|
|
2145
|
+
)
|
|
2146
|
+
|
|
2147
|
+
block = extract_managed_block((ROOT / "AGENTS.md").read_text(encoding="utf-8")) or ""
|
|
2148
|
+
if not offers_choices(section(block, "## User-facing communication")):
|
|
2149
|
+
report(
|
|
2150
|
+
f"{label} AGENTS.md User-facing communication does not offer "
|
|
2151
|
+
"decisions as selectable options."
|
|
2152
|
+
)
|
|
2153
|
+
return 1
|
|
2154
|
+
for root in ("src/skills", f"{PLUGIN_ROOT}/skills"):
|
|
2155
|
+
path = ROOT / root / "keel-align-expectations" / "SKILL.md"
|
|
2156
|
+
text = path.read_text(encoding="utf-8")
|
|
2157
|
+
if not offers_choices(section(text, "## Deep path")):
|
|
2158
|
+
report(
|
|
2159
|
+
f"{label} {root} keel-align-expectations Deep path does not "
|
|
2160
|
+
"offer decisions as selectable options."
|
|
2161
|
+
)
|
|
2162
|
+
return 1
|
|
2163
|
+
if "AskUserQuestion" in text:
|
|
2164
|
+
report(f"{label} {root} keel-align-expectations names a host tool.")
|
|
2165
|
+
return 1
|
|
2166
|
+
if "decisions-are-selectable" not in {name for name, _ in SCENARIOS}:
|
|
2167
|
+
report(f"{label} scenario is not registered.")
|
|
2168
|
+
return 1
|
|
2169
|
+
report("decisions-are-selectable scenario passed.")
|
|
2170
|
+
return 0
|
|
2171
|
+
|
|
2172
|
+
|
|
1876
2173
|
def validate_covers_annotation_entry_scenario() -> int:
|
|
1877
2174
|
"""Issue #49 Section 1's fail-open half, owner-decided 2026-08-17: a Covers
|
|
1878
2175
|
entry that opens with a critical-statement identifier and a dash
|
|
@@ -31595,6 +31892,18 @@ SCENARIOS: tuple = (
|
|
|
31595
31892
|
"widened-critical-statement-shapes",
|
|
31596
31893
|
validate_widened_critical_statement_shapes_scenario,
|
|
31597
31894
|
),
|
|
31895
|
+
(
|
|
31896
|
+
"whole-critical-statement-authority",
|
|
31897
|
+
validate_whole_critical_statement_authority_scenario,
|
|
31898
|
+
),
|
|
31899
|
+
(
|
|
31900
|
+
"unlinked-critical-covers",
|
|
31901
|
+
validate_unlinked_critical_covers_scenario,
|
|
31902
|
+
),
|
|
31903
|
+
(
|
|
31904
|
+
"decisions-are-selectable",
|
|
31905
|
+
validate_decisions_are_selectable_scenario,
|
|
31906
|
+
),
|
|
31598
31907
|
(
|
|
31599
31908
|
"covers-annotation-entry",
|
|
31600
31909
|
validate_covers_annotation_entry_scenario,
|
|
@@ -1033,18 +1033,22 @@ function criticalAuthority(repo, change, reference) {
|
|
|
1033
1033
|
};
|
|
1034
1034
|
}
|
|
1035
1035
|
const content = fs.readFileSync(designPath, "utf8");
|
|
1036
|
-
//
|
|
1037
|
-
//
|
|
1038
|
-
//
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1036
|
+
// Resolve the opener by line, then collect its owned indented lines. A
|
|
1037
|
+
// multiline regex matched only the opener (issue #177), so changing a nested
|
|
1038
|
+
// decision detail left the contract fingerprint unchanged. Keep the accepted
|
|
1039
|
+
// bullet/bold/dash opener shapes from issue #49; colon remains unparsed.
|
|
1040
|
+
const lines = content.split(/\r?\n/);
|
|
1041
|
+
const opener = new RegExp(
|
|
1042
|
+
`^([ \\t]*)((?:[-*+][ \\t]+)?)(?:\\*\\*${reference}\\*\\*|${reference})`
|
|
1043
|
+
+ `[ \\t]*[—-][ \\t]*(.+?)[ \\t]*$`,
|
|
1044
|
+
"i"
|
|
1045
|
+
);
|
|
1046
|
+
const matches = lines.flatMap((line, index) => {
|
|
1047
|
+
const match = line.match(opener);
|
|
1048
|
+
return match
|
|
1049
|
+
? [{ index, indent: match[1], bullet: match[2], text: match[3] }]
|
|
1050
|
+
: [];
|
|
1051
|
+
});
|
|
1048
1052
|
if (matches.length !== 1) {
|
|
1049
1053
|
// Zero matches is ambiguous: the identifier may never appear in design.md,
|
|
1050
1054
|
// or it may appear in some other shape (bulleted, bold) that the strict
|
|
@@ -1062,7 +1066,7 @@ function criticalAuthority(repo, change, reference) {
|
|
|
1062
1066
|
`Unparsed Covers critical statement: ${reference}. It appears in `
|
|
1063
1067
|
+ "design.md but not in an accepted line shape — write it as a "
|
|
1064
1068
|
+ "line opening with the identifier and a dash, "
|
|
1065
|
-
+ `\`${reference} —
|
|
1069
|
+
+ `\`${reference} — statement\`, optionally as a list `
|
|
1066
1070
|
+ `bullet (\`- ${reference} — …\`) and/or with the identifier `
|
|
1067
1071
|
+ `bold (\`**${reference}** — …\`).`,
|
|
1068
1072
|
},
|
|
@@ -1077,13 +1081,53 @@ function criticalAuthority(repo, change, reference) {
|
|
|
1077
1081
|
},
|
|
1078
1082
|
};
|
|
1079
1083
|
}
|
|
1084
|
+
const indentColumns = (prefix) => {
|
|
1085
|
+
let columns = 0;
|
|
1086
|
+
for (const character of prefix) {
|
|
1087
|
+
columns += character === "\t" ? 4 - (columns % 4) : 1;
|
|
1088
|
+
}
|
|
1089
|
+
return columns;
|
|
1090
|
+
};
|
|
1091
|
+
const match = matches[0];
|
|
1092
|
+
const openerIndent = indentColumns(match.indent);
|
|
1093
|
+
// A heading shallower than the item's content column closes the item; one
|
|
1094
|
+
// at or past it is nested inside the item and stays owned, as does a deeper
|
|
1095
|
+
// `#` line such as a code sample's comment. An unbulleted opener has no
|
|
1096
|
+
// content column beyond itself, so CommonMark's three-space heading indent
|
|
1097
|
+
// applies there.
|
|
1098
|
+
const headingLimit = match.bullet
|
|
1099
|
+
? openerIndent + indentColumns(match.bullet)
|
|
1100
|
+
: openerIndent + 4;
|
|
1101
|
+
// A line opening with another critical identifier and a dash is a peer
|
|
1102
|
+
// statement even without a bullet, never a lazy continuation of this one.
|
|
1103
|
+
const blockStart = new RegExp(
|
|
1104
|
+
"^[ \\t]*(?:[-*+][ \\t]|\\d+[.)][ \\t]|>|```|~~~|#{1,6}(?:[ \\t]|$)"
|
|
1105
|
+
+ "|(?:\\*\\*)?[DFAQ]\\d+(?:\\*\\*)?[ \\t]*[—-])",
|
|
1106
|
+
"i"
|
|
1107
|
+
);
|
|
1108
|
+
const statementLines = [match.text];
|
|
1109
|
+
let previousBlank = false;
|
|
1110
|
+
for (const line of lines.slice(match.index + 1)) {
|
|
1111
|
+
if (!line.trim()) {
|
|
1112
|
+
previousBlank = true;
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
const columns = indentColumns(line.match(/^[ \t]*/)[0]);
|
|
1116
|
+
if (/^[ \t]*#{1,6}(?:[ \t]|$)/.test(line) && columns < headingLimit) break;
|
|
1117
|
+
// A shallower line directly after owned text, starting no block of its
|
|
1118
|
+
// own, is a lazy paragraph continuation; after a blank line it is a peer.
|
|
1119
|
+
const lazy = !previousBlank && !blockStart.test(line);
|
|
1120
|
+
if (columns <= openerIndent && !lazy) break;
|
|
1121
|
+
previousBlank = false;
|
|
1122
|
+
statementLines.push(line.trim());
|
|
1123
|
+
}
|
|
1080
1124
|
return {
|
|
1081
1125
|
authority: {
|
|
1082
1126
|
kind: "critical-statement",
|
|
1083
1127
|
reference,
|
|
1084
1128
|
source:
|
|
1085
1129
|
`${path.relative(repo, designPath).replace(/\\/g, "/")}#${reference}`,
|
|
1086
|
-
text: normalizeText(
|
|
1130
|
+
text: normalizeText(statementLines.join("\n")),
|
|
1087
1131
|
acceptance: [],
|
|
1088
1132
|
},
|
|
1089
1133
|
};
|
|
@@ -1135,6 +1179,30 @@ function resolveAuthority(repo, change, task) {
|
|
|
1135
1179
|
if (spec.authority) authority.push(spec.authority);
|
|
1136
1180
|
continue;
|
|
1137
1181
|
}
|
|
1182
|
+
// A combined citation that missed the supported ASCII-comma expansion
|
|
1183
|
+
// must not become unlinked legacy prose (issue #177). This scan excludes
|
|
1184
|
+
// hyphenated words such as `D2-compatible`, and preserves the existing
|
|
1185
|
+
// colon-form legacy entry and closed-question note beside a fact. Valid
|
|
1186
|
+
// opening references and their annotations already continued above.
|
|
1187
|
+
const criticalMentions = [
|
|
1188
|
+
...entry.matchAll(/(?:^|[^A-Za-z0-9_-])([DFAQ]\d+)(?![A-Za-z0-9_-])/g),
|
|
1189
|
+
].map((match) => match[1]);
|
|
1190
|
+
const colonLegacy =
|
|
1191
|
+
criticalMentions.length === 1
|
|
1192
|
+
&& /^[DFAQ]\d+\s*:\s*.+$/.test(entry);
|
|
1193
|
+
const closedQuestionNote =
|
|
1194
|
+
criticalMentions.length === 2
|
|
1195
|
+
&& /^F\d+\s*\(\s*Q\d+\s+resolved\s*:/i.test(entry);
|
|
1196
|
+
if (criticalMentions.length > 0 && !colonLegacy && !closedQuestionNote) {
|
|
1197
|
+
diagnostics.push({
|
|
1198
|
+
code: "unresolved-covers",
|
|
1199
|
+
message:
|
|
1200
|
+
`Covers critical references are not linked: ${entry}. `
|
|
1201
|
+
+ "Write each identifier as its own Covers entry, or use an "
|
|
1202
|
+
+ "ASCII-comma list such as `D1, D2`.",
|
|
1203
|
+
});
|
|
1204
|
+
continue;
|
|
1205
|
+
}
|
|
1138
1206
|
const match = entry.match(/^([A-Za-z]\d+)\s*:\s*(.+)$/);
|
|
1139
1207
|
authority.push({
|
|
1140
1208
|
kind: "legacy-task-reference",
|