@christang/keel 5.225.0 → 5.227.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.225.0",
3
+ "version": "5.227.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.225.0 -->
1
+ <!-- keel:start version=5.227.0 -->
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.225.0",
3
+ "version": "5.227.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.225.0",
9
+ "version": "5.227.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.225.0",
5
+ "version": "5.227.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.225.0",
3
+ "version": "5.227.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.225.0",
3
+ "version": "5.227.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",
@@ -0,0 +1,189 @@
1
+ """Keel validation: chatwake (#516). A record wakes a session once, and the wake lists what is new."""
2
+ from __future__ import annotations
3
+
4
+ import json
5
+ import subprocess
6
+ import tempfile
7
+ from pathlib import Path
8
+
9
+ from validation.common import (
10
+ PLUGIN_ROOT,
11
+ ROOT,
12
+ chat_json,
13
+ chat_scratch_group,
14
+ report,
15
+ run_keel,
16
+ )
17
+
18
+ SCRIPT = ROOT / PLUGIN_ROOT / "scripts/mail-hook.js"
19
+ HOST_EVENTS = {
20
+ "session-start": "SessionStart",
21
+ "user-prompt-submit": "UserPromptSubmit",
22
+ "file-changed": "FileChanged",
23
+ "session-end": "SessionEnd",
24
+ }
25
+
26
+
27
+ def hook_payload(cwd: Path, event: str, session: str | None) -> str:
28
+ payload = {"hook_event_name": HOST_EVENTS[event], "cwd": str(cwd)}
29
+ if session is not None:
30
+ payload["session_id"] = session
31
+ return json.dumps(payload)
32
+
33
+
34
+ def run_hook(cwd: Path, env: dict, event: str, session: str | None) -> subprocess.CompletedProcess[str]:
35
+ return subprocess.run(
36
+ ["node", str(SCRIPT), event], cwd=cwd, env=env, text=True, capture_output=True, check=False,
37
+ input=hook_payload(cwd, event, session),
38
+ )
39
+
40
+
41
+ def start_hooks(cwd: Path, env: dict, event: str, session: str, count: int) -> list[subprocess.Popen]:
42
+ return [
43
+ subprocess.Popen(
44
+ ["node", str(SCRIPT), event], cwd=cwd, env=env, text=True, stdin=subprocess.PIPE,
45
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE,
46
+ )
47
+ for _ in range(count)
48
+ ]
49
+
50
+
51
+ def world(prefix: str):
52
+ raw = tempfile.TemporaryDirectory(prefix=prefix)
53
+ base = Path(raw.name).resolve()
54
+ rtl, verify, env = chat_scratch_group(base)
55
+ env["KEEL_CLI"] = f'node "{ROOT / "bin" / "keel.js"}"'
56
+ return raw, rtl, verify, env
57
+
58
+
59
+ def mention(rtl: Path, env: dict, text: str) -> str:
60
+ return chat_json(run_keel(rtl, "chat", "post", "soc", f"@verify {text}", "--json", env=env)).get("id", "")
61
+
62
+
63
+ def validate_chat_wake_once_scenario() -> int:
64
+ label = "chat-wake-once:"
65
+ raw, rtl, verify, env = world("keel-wake-once-")
66
+ with raw:
67
+ first = mention(rtl, env, "first")
68
+ woke = run_hook(verify, env, "file-changed", "s1")
69
+ if woke.returncode != 2:
70
+ report(f"{label} the first FileChanged exited {woke.returncode}, not 2: {woke.stderr.strip()}")
71
+ return 1
72
+ if first not in woke.stderr:
73
+ report(f"{label} the first wake does not name the record {first}: {woke.stderr.strip()}")
74
+ return 1
75
+ again = run_hook(verify, env, "file-changed", "s1")
76
+ if again.returncode != 0:
77
+ report(f"{label} the second FileChanged for the same record exited {again.returncode}, not 0: {again.stderr.strip()}")
78
+ return 1
79
+ if again.stderr.strip():
80
+ report(f"{label} the second FileChanged wrote {again.stderr.strip()!r} for a record already announced")
81
+ return 1
82
+
83
+ second = mention(rtl, env, "second")
84
+ later = run_hook(verify, env, "file-changed", "s1")
85
+ if later.returncode != 2:
86
+ report(f"{label} a later mention exited {later.returncode}, not 2: {later.stderr.strip()}")
87
+ return 1
88
+ if second not in later.stderr:
89
+ report(f"{label} the later wake does not name {second}: {later.stderr.strip()}")
90
+ return 1
91
+ if first in later.stderr:
92
+ report(f"{label} the later wake repeats the record already announced ({first}): {later.stderr.strip()}")
93
+ return 1
94
+ if "2 unread" not in later.stderr:
95
+ report(f"{label} the later wake does not state the total unread (2): {later.stderr.strip()}")
96
+ return 1
97
+
98
+ other = run_hook(verify, env, "file-changed", "s2")
99
+ if other.returncode != 2:
100
+ report(f"{label} another session's first FileChanged exited {other.returncode}, not 2")
101
+ return 1
102
+ for record in (first, second):
103
+ if record not in other.stderr:
104
+ report(f"{label} another session was not told {record}: {other.stderr.strip()}")
105
+ return 1
106
+
107
+ for _ in range(2):
108
+ anonymous = run_hook(verify, env, "file-changed", None)
109
+ if anonymous.returncode != 2:
110
+ report(f"{label} a payload without a session id exited {anonymous.returncode}, not 2")
111
+ return 1
112
+ report("chat-wake-once scenario passed.")
113
+ return 0
114
+
115
+
116
+ def validate_chat_wake_race_scenario() -> int:
117
+ label = "chat-wake-race:"
118
+ raw, rtl, verify, env = world("keel-wake-race-")
119
+ with raw:
120
+ mention(rtl, env, "once")
121
+ procs = start_hooks(verify, env, "file-changed", "s1", 8)
122
+ payload = hook_payload(verify, "file-changed", "s1")
123
+ codes = []
124
+ for proc in procs:
125
+ proc.communicate(payload)
126
+ codes.append(proc.returncode)
127
+ winners = [c for c in codes if c == 2]
128
+ if len(winners) != 1:
129
+ report(f"{label} {len(winners)} of 8 simultaneous hooks announced the record, not 1: {codes}")
130
+ return 1
131
+ quiet = [c for c in codes if c == 0]
132
+ if len(quiet) != 7:
133
+ report(f"{label} the other hooks did not all exit 0: {codes}")
134
+ return 1
135
+ report("chat-wake-race scenario passed.")
136
+ return 0
137
+
138
+
139
+ def validate_chat_wake_after_notice_scenario() -> int:
140
+ label = "chat-wake-after-notice:"
141
+ raw, rtl, verify, env = world("keel-wake-notice-")
142
+ with raw:
143
+ first = mention(rtl, env, "first")
144
+ start = run_hook(verify, env, "session-start", "s1")
145
+ if first not in chat_json(start).get("hookSpecificOutput", {}).get("additionalContext", ""):
146
+ report(f"{label} SessionStart did not list the mention it is meant to have shown: {start.stdout.strip()}")
147
+ return 1
148
+ after_start = run_hook(verify, env, "file-changed", "s1")
149
+ if after_start.returncode != 0:
150
+ report(f"{label} FileChanged exited {after_start.returncode} for a record SessionStart already listed: {after_start.stderr.strip()}")
151
+ return 1
152
+
153
+ second = mention(rtl, env, "second")
154
+ prompt = run_hook(verify, env, "user-prompt-submit", "s1")
155
+ if second not in chat_json(prompt).get("hookSpecificOutput", {}).get("additionalContext", ""):
156
+ report(f"{label} UserPromptSubmit did not list the later mention: {prompt.stdout.strip()}")
157
+ return 1
158
+ after_prompt = run_hook(verify, env, "file-changed", "s1")
159
+ if after_prompt.returncode != 0:
160
+ report(f"{label} FileChanged exited {after_prompt.returncode} for a record a prompt notice already listed: {after_prompt.stderr.strip()}")
161
+ return 1
162
+
163
+ run_keel(verify, "chat", "notice", env=env)
164
+ run_keel(verify, "chat", "check", env=env)
165
+ third = mention(rtl, env, "third")
166
+ run_keel(verify, "chat", "notice", env=env)
167
+ run_keel(verify, "chat", "check", env=env)
168
+ unannounced = run_hook(verify, env, "file-changed", "s1")
169
+ if unannounced.returncode != 2:
170
+ report(f"{label} `keel chat notice` and `check` marked a record announced; FileChanged exited {unannounced.returncode}, not 2")
171
+ return 1
172
+ if third not in unannounced.stderr:
173
+ report(f"{label} the wake after notice and check does not name {third}: {unannounced.stderr.strip()}")
174
+ return 1
175
+
176
+ run_hook(verify, env, "session-start", "s1")
177
+ resumed = run_hook(verify, env, "file-changed", "s1")
178
+ if resumed.returncode != 0:
179
+ report(f"{label} FileChanged exited {resumed.returncode} after a second SessionStart listed everything unread")
180
+ return 1
181
+
182
+ mention(rtl, env, "fourth")
183
+ run_hook(verify, env, "session-end", "s1")
184
+ restarted = run_hook(verify, env, "file-changed", "s1")
185
+ if restarted.returncode != 2:
186
+ report(f"{label} FileChanged exited {restarted.returncode} for a session id that ended, not 2")
187
+ return 1
188
+ report("chat-wake-after-notice scenario passed.")
189
+ return 0
@@ -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.225.0"
38
+ PACKAGE_VERSION = "5.227.0"
39
39
 
40
40
 
41
- PROTOCOL_VERSION = "5.225.0"
41
+ PROTOCOL_VERSION = "5.227.0"
42
42
 
43
43
 
44
44
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
@@ -8,7 +8,9 @@ from validation import shift
8
8
  from validation import docs
9
9
  from validation import selfcheck
10
10
  from validation import export
11
+ from validation import chatwake
11
12
  from validation import dsh
13
+ from validation import skipspecs
12
14
  from validation import feedback
13
15
 
14
16
 
@@ -552,6 +554,10 @@ SCENARIOS: tuple = (
552
554
  ("dsh-binary", dsh.validate_dsh_binary_scenario),
553
555
  ("dsh-uninstall-shared", dsh.validate_dsh_uninstall_shared_scenario),
554
556
  ("dsh-docs", dsh.validate_dsh_docs_scenario),
557
+ ("change-close-skip-specs", skipspecs.validate_change_close_skip_specs_scenario),
558
+ ("chat-wake-once", chatwake.validate_chat_wake_once_scenario),
559
+ ("chat-wake-race", chatwake.validate_chat_wake_race_scenario),
560
+ ("chat-wake-after-notice", chatwake.validate_chat_wake_after_notice_scenario),
555
561
  ("push-protected-guard", guard.validate_push_protected_guard_scenario),
556
562
  ("authorize-role-scoped", guard.validate_authorize_role_scoped_scenario),
557
563
  ("touch-guard-record-layer", guard.validate_touch_guard_record_layer_scenario),
@@ -0,0 +1,85 @@
1
+ """Keel validation: change-close and a declared skip of specs (#517)."""
2
+ from __future__ import annotations
3
+
4
+ import json
5
+ import os
6
+ import shutil
7
+ import subprocess
8
+ import tempfile
9
+ from pathlib import Path
10
+
11
+ from validation.common import report, run_keel, write_text
12
+
13
+
14
+ def closing_codes(repo: Path, env: dict[str, str], action: str) -> list[str] | None:
15
+ result = run_keel(repo, "gate", "change-close", "--change", "demo", "--action", action, "--json", env=env)
16
+ try:
17
+ return [p.get("code") for p in json.loads(result.stdout).get("problems", [])]
18
+ except json.JSONDecodeError:
19
+ report(f"change-close-skip-specs: change-close printed no JSON: {result.stdout!r} {result.stderr!r}")
20
+ return None
21
+
22
+
23
+ def validate_change_close_skip_specs_scenario() -> int:
24
+ label = "change-close-skip-specs:"
25
+ with tempfile.TemporaryDirectory(prefix="keel-skip-specs-") as raw:
26
+ tmp = Path(raw).resolve()
27
+ repo = tmp / "repo"
28
+ repo.mkdir()
29
+ subprocess.run(["git", "init", "-q"], cwd=repo, check=True, capture_output=True)
30
+ env = {k: v for k, v in os.environ.items() if not k.startswith(("CLAUDE", "KEEL_"))}
31
+ env["CODEX_HOME"] = str(tmp / "codex-home")
32
+ init = run_keel(repo, "--init", "--target", "claude", env=env)
33
+ if init.returncode != 0:
34
+ report(f"{label} init failed: {init.stderr or init.stdout}")
35
+ return 1
36
+ change = repo / "openspec/changes/demo"
37
+ write_text(change / "proposal.md", "## Why\n\nfixture\n\n## What Changes\n\n- fixture\n")
38
+ write_text(change / "tasks.md", "# Tasks\n\n- [x] 1.1 done\n")
39
+ marker = change / ".openspec.yaml"
40
+
41
+ def codes(action: str = "archive") -> list[str]:
42
+ found = closing_codes(repo, env, action)
43
+ return [] if found is None else found
44
+
45
+ write_text(marker, "schema: keel-spec-driven\nskip_specs: true\n")
46
+ for action in ("archive", "sync"):
47
+ marked = codes(action)
48
+ if "missing-delta-spec" in marked:
49
+ report(f"{label} a marked change without specs still gets missing-delta-spec for {action}: {marked}")
50
+ return 1
51
+ if "skip-specs-with-specs" in marked:
52
+ report(f"{label} a marked change without specs gets skip-specs-with-specs for {action}: {marked}")
53
+ return 1
54
+
55
+ write_text(change / "specs/demo/spec.md", "## ADDED Requirements\n")
56
+ both = closing_codes(repo, env, "archive") or []
57
+ if "skip-specs-with-specs" not in both:
58
+ report(f"{label} a marker beside a spec file is not reported: {both}")
59
+ return 1
60
+ if "missing-delta-spec" in both:
61
+ report(f"{label} a marker beside a spec file also reports missing-delta-spec: {both}")
62
+ return 1
63
+ gate = run_keel(repo, "gate", "change-close", "--change", "demo", "--action", "archive", "--json", env=env)
64
+ if "specs/demo/spec.md" not in gate.stdout.replace("\\\\", "/"):
65
+ report(f"{label} the contradiction does not name the file: {gate.stdout[:400]!r}")
66
+ return 1
67
+ shutil.rmtree(change / "specs")
68
+
69
+ for text, why in (
70
+ ("schema: keel-spec-driven\n", "no marker"),
71
+ ("schema: keel-spec-driven\nskip_specs: false\n", "skip_specs: false"),
72
+ ):
73
+ write_text(marker, text)
74
+ unmarked = codes()
75
+ if "missing-delta-spec" not in unmarked:
76
+ report(f"{label} with {why} the delta spec is no longer required: {unmarked}")
77
+ return 1
78
+ marker.unlink()
79
+ marker.mkdir()
80
+ unreadable = codes()
81
+ if "missing-delta-spec" not in unreadable:
82
+ report(f"{label} with an unreadable .openspec.yaml the delta spec is no longer required: {unreadable}")
83
+ return 1
84
+ report("change-close-skip-specs scenario passed.")
85
+ return 0
@@ -26,18 +26,22 @@ function firstLine(text) {
26
26
  return line.length > 120 ? `${line.slice(0, 117)}...` : line;
27
27
  }
28
28
 
29
- function noticeText(where, role, now = Date.now()) {
29
+ // `only`, when given, is the waking records a FileChanged wake announces for
30
+ // the first time (#516 D2): they are the ones listed, and the header says so;
31
+ // the other unread are still counted.
32
+ function noticeText(where, role, now = Date.now(), only = null) {
30
33
  // Newest first (#252 D3).
31
34
  const records = store.unread(where, role).reverse();
32
35
  if (!records.length) return "";
33
- const waking = records.filter((record) => store.wakes(record, role));
36
+ const allWaking = records.filter((record) => store.wakes(record, role));
37
+ const waking = only ? allWaking.filter((record) => only.some((item) => item.id === record.id)) : allWaking;
34
38
  const others = new Map();
35
39
  for (const record of records) {
36
- if (waking.includes(record)) continue;
40
+ if (allWaking.includes(record)) continue;
37
41
  others.set(record.group, (others.get(record.group) || 0) + 1);
38
42
  }
39
43
  const lines = [
40
- `keel chat: ${records.length} unread for role \`${role}\`, ${waking.length} addressed to you.`,
44
+ `keel chat: ${records.length} unread for role \`${role}\`, ${waking.length} ${only ? "new " : ""}addressed to you.`,
41
45
  ];
42
46
  for (const record of waking.slice(0, NOTICE_LIMIT)) {
43
47
  const asks = record.ack === "requested" ? " (ack requested)" : "";
@@ -341,6 +345,40 @@ function signalPath(where, role) {
341
345
  return path.join(where.root, "signal", role);
342
346
  }
343
347
 
348
+ // What a session has been told (#516 D1): one empty file per waking record id,
349
+ // named under the session's own directory. A record is announced to a session
350
+ // only by the process that creates its file, so two hooks started together
351
+ // cannot both announce it. Without a valid session id nothing is remembered.
352
+ function wokenDir(where, payload) {
353
+ const id = typeof payload.session_id === "string" ? payload.session_id : "";
354
+ return /^[A-Za-z0-9._-]{1,128}$/.test(id) ? path.join(where.root, "woken", id) : null;
355
+ }
356
+
357
+ function claimWoken(where, payload, records) {
358
+ const dir = wokenDir(where, payload);
359
+ if (!dir) return records;
360
+ try {
361
+ fs.mkdirSync(dir, { recursive: true });
362
+ } catch {
363
+ return records;
364
+ }
365
+ const won = [];
366
+ for (const record of records) {
367
+ try {
368
+ fs.writeFileSync(path.join(dir, record.id), "", { flag: "wx" });
369
+ won.push(record);
370
+ } catch (error) {
371
+ if (!error || error.code !== "EEXIST") won.push(record);
372
+ }
373
+ }
374
+ return won;
375
+ }
376
+
377
+ function forgetWoken(where, payload) {
378
+ const dir = wokenDir(where, payload);
379
+ if (dir) fs.rmSync(dir, { recursive: true, force: true });
380
+ }
381
+
344
382
  function ensureSignal(where, role) {
345
383
  const signal = signalPath(where, role);
346
384
  fs.mkdirSync(path.dirname(signal), { recursive: true });
@@ -746,13 +784,20 @@ function hook(event, input, { mail = false } = {}) {
746
784
  }
747
785
  if (event === "session-end") {
748
786
  touchPresence(where, role, "offline");
787
+ forgetWoken(where, payload);
749
788
  return { code: 0 };
750
789
  }
751
790
  if (event === "session-start") rememberSession(where, role, file);
752
791
  const started = event === "session-start" ? { source: typeof payload.source === "string" ? payload.source : null } : null;
753
792
  touchPresence(where, role, "online", mail ? null : "claude-code", started);
754
793
  if (event === "session-start" || event === "user-prompt-submit") recordSegment(where, role, existingTranscript(payload));
794
+ // What SessionStart and a prompt show counts as announced (#516 D3); a
795
+ // SessionStart first forgets what an earlier run of the same session id was told.
796
+ if (event === "session-start") forgetWoken(where, payload);
755
797
  const chatText = noticeText(where, role);
798
+ if (event === "session-start" || event === "user-prompt-submit") {
799
+ claimWoken(where, payload, store.unread(where, role).filter((record) => store.wakes(record, role)));
800
+ }
756
801
  const text = chatText && mail ? `${chatText}\n${MAIL_POINTER}` : chatText;
757
802
  if (event === "session-start") {
758
803
  const output = {
@@ -766,9 +811,11 @@ function hook(event, input, { mail = false } = {}) {
766
811
  const context = [replacedLine, languageLine, text].filter(Boolean).join("\n");
767
812
  return context ? promptOutput(context) : { code: 0 };
768
813
  }
769
- // file-changed
770
- const waking = store.unread(where, role).some((record) => store.wakes(record, role));
771
- return waking ? { code: 2, stderr: `${text}\n` } : { code: 0 };
814
+ // file-changed: one wake per record and session, listing what is new (#516)
815
+ const fresh = claimWoken(where, payload, store.unread(where, role).filter((record) => store.wakes(record, role)));
816
+ if (!fresh.length) return { code: 0 };
817
+ const news = noticeText(where, role, Date.now(), fresh);
818
+ return { code: 2, stderr: `${mail ? `${news}\n${MAIL_POINTER}` : news}\n` };
772
819
  }
773
820
 
774
821
  // The model-free question a scheduler asks before starting a turn (#194):
package/src/core/gates.js CHANGED
@@ -2206,6 +2206,40 @@ function expectationProblems(repo, content, tasks, change) {
2206
2206
  return { problems, report };
2207
2207
  }
2208
2208
 
2209
+ // `skip_specs: true` in a change's `.openspec.yaml` is OpenSpec's marker that
2210
+ // the change adds or modifies no capability (#517). Only that exact line
2211
+ // declares it; an absent file, an unreadable one, `false` or anything else is
2212
+ // undeclared, so the gate keeps requiring a delta spec, as OpenSpec itself
2213
+ // counts a marker it cannot honor as undeclared.
2214
+ function declaresSkipSpecs(changePath) {
2215
+ try {
2216
+ const text = fs.readFileSync(path.join(changePath, ".openspec.yaml"), "utf8");
2217
+ return /^skip_specs:[ \t]*true[ \t]*(#.*)?$/m.test(text);
2218
+ } catch {
2219
+ return false;
2220
+ }
2221
+ }
2222
+
2223
+ // The first file anywhere under `specs/`, as a path relative to the change.
2224
+ function firstFileUnderSpecs(changePath) {
2225
+ const queue = [path.join(changePath, "specs")];
2226
+ while (queue.length > 0) {
2227
+ const current = queue.pop();
2228
+ let entries;
2229
+ try {
2230
+ entries = fs.readdirSync(current, { withFileTypes: true });
2231
+ } catch {
2232
+ continue;
2233
+ }
2234
+ for (const entry of entries) {
2235
+ const candidate = path.join(current, entry.name);
2236
+ if (entry.isDirectory()) queue.push(candidate);
2237
+ else return path.relative(changePath, candidate).split(path.sep).join("/");
2238
+ }
2239
+ }
2240
+ return null;
2241
+ }
2242
+
2209
2243
  function hasDeltaSpec(changePath) {
2210
2244
  const specsPath = path.join(changePath, "specs");
2211
2245
  if (!fs.existsSync(specsPath)) return false;
@@ -2327,7 +2361,18 @@ function changeClose(repo, options) {
2327
2361
  problems.push(...changeVerifyProblems(selection.content, selection.tasks));
2328
2362
 
2329
2363
  const changePath = path.dirname(selection.tasksPath);
2330
- if (!hasDeltaSpec(changePath)) {
2364
+ if (declaresSkipSpecs(changePath)) {
2365
+ const carried = firstFileUnderSpecs(changePath);
2366
+ if (carried !== null) {
2367
+ problems.push(
2368
+ problem(
2369
+ "skip-specs-with-specs",
2370
+ `The change declares \`skip_specs: true\` in .openspec.yaml and still carries \`${carried}\`; `
2371
+ + "remove the marker or the specs."
2372
+ )
2373
+ );
2374
+ }
2375
+ } else if (!hasDeltaSpec(changePath)) {
2331
2376
  problems.push(
2332
2377
  problem(
2333
2378
  "missing-delta-spec",