@christang/keel 5.225.0 → 5.226.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.226.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.226.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.226.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.226.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.226.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.226.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.226.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",
@@ -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.226.0"
39
39
 
40
40
 
41
- PROTOCOL_VERSION = "5.225.0"
41
+ PROTOCOL_VERSION = "5.226.0"
42
42
 
43
43
 
44
44
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
@@ -9,6 +9,7 @@ from validation import docs
9
9
  from validation import selfcheck
10
10
  from validation import export
11
11
  from validation import dsh
12
+ from validation import skipspecs
12
13
  from validation import feedback
13
14
 
14
15
 
@@ -552,6 +553,7 @@ SCENARIOS: tuple = (
552
553
  ("dsh-binary", dsh.validate_dsh_binary_scenario),
553
554
  ("dsh-uninstall-shared", dsh.validate_dsh_uninstall_shared_scenario),
554
555
  ("dsh-docs", dsh.validate_dsh_docs_scenario),
556
+ ("change-close-skip-specs", skipspecs.validate_change_close_skip_specs_scenario),
555
557
  ("push-protected-guard", guard.validate_push_protected_guard_scenario),
556
558
  ("authorize-role-scoped", guard.validate_authorize_role_scoped_scenario),
557
559
  ("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
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",