@kirill.konshin/lint 0.6.7 → 0.7.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.
Files changed (50) hide show
  1. package/README.md +253 -94
  2. package/dist/configs/imports.js +3 -30
  3. package/dist/configs/react.d.ts +0 -15
  4. package/dist/configs/react.js +2 -36
  5. package/dist/configs/tailwind.d.ts +10 -0
  6. package/dist/configs/tailwind.js +25 -9
  7. package/dist/configs/testing.js +2 -41
  8. package/dist/configs/unicorn.js +2 -10
  9. package/dist/conventions.d.ts +12 -0
  10. package/dist/conventions.js +53 -0
  11. package/dist/index.d.ts +4 -4
  12. package/dist/index.js +4 -4
  13. package/dist/lib.d.ts +18 -1
  14. package/dist/lib.js +36 -2
  15. package/dist/lintPrepare.d.ts +2 -1
  16. package/dist/lintPrepare.js +13 -1
  17. package/dist/oxlintPlugin.d.ts +10 -0
  18. package/dist/oxlintPlugin.js +13 -0
  19. package/dist/testColocation.d.ts +10 -0
  20. package/dist/testColocation.js +45 -0
  21. package/dist/vitePlus.d.ts +58 -0
  22. package/dist/vitePlus.js +434 -0
  23. package/package.json +32 -9
  24. package/rules/agent.md +3 -0
  25. package/rules/code-style.md +1 -1
  26. package/rules/github.md +4 -1
  27. package/rules/gitlab.md +3 -5
  28. package/rules/jest.md +1 -1
  29. package/rules/markdown.md +11 -0
  30. package/rules/monorepo-turbo-nx.md +9 -0
  31. package/rules/mui.md +0 -2
  32. package/rules/npm-yarn.md +10 -1
  33. package/rules/nx.md +3 -1
  34. package/rules/playwright.md +18 -0
  35. package/rules/react.md +1 -3
  36. package/rules/tailwind.md +1 -0
  37. package/rules/testing.md +5 -2
  38. package/rules/typescript.md +5 -4
  39. package/rules/vite.md +5 -1
  40. package/{rules/electron.md → skills/lint-electron/SKILL.md} +5 -3
  41. package/skills/lint-github/SKILL.md +244 -42
  42. package/skills/lint-gitlab/SKILL.md +46 -1
  43. package/skills/lint-migrate/SKILL.md +24 -0
  44. package/skills/lint-repo/SKILL.md +21 -5
  45. package/skills/lint-webstorm/SKILL.md +55 -3
  46. package/skills/spec-steward/SKILL.md +72 -15
  47. package/skills/spec-steward/references/contract.md +6 -6
  48. package/skills/spec-tools/SKILL.md +11 -11
  49. package/skills/spec-tools/references/rules/common.md +32 -7
  50. package/skills/spec-tools/scripts/cli.js +18 -12
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: lint-webstorm
3
- description: Templates and checks for JetBrains IDEA / WebStorm `.idea` project files - excluded folders, Prettier & ESLint scopes, VCS, code style, Tailwind, JSON schemas, index exclusions. Use when setting up, checking or fixing a project's `.idea` configuration.
3
+ description: Templates and checks for JetBrains IDEA / WebStorm `.idea` project files - Oxc plugin (Vite+ - Oxlint, Oxfmt) or Prettier & ESLint scopes, excluded folders, VCS, code style, Tailwind, JSON schemas, index exclusions. Use when setting up, checking or fixing a project's `.idea` configuration.
4
4
  ---
5
5
 
6
6
  # Check
@@ -42,7 +42,59 @@ Compare the project's `.idea` files with the templates below and the `webstorm`
42
42
  </project>
43
43
  ```
44
44
 
45
- # Configure `.idea/prettier.xml`
45
+ # Vite+: Oxc plugin
46
+
47
+ When the project uses `vite-plus`: the [Oxc plugin](https://plugins.jetbrains.com/plugin/27061-oxc) runs `vp lint --lsp` / `vp fmt --lsp` (AUTOMATIC mode finds `vite-plus`), so the `vite.config.ts` blocks apply. Prettier is disabled and `.idea/jsLinters/eslint.xml` deleted. The plugin stores booleans as attributes while the Vite+ docs write `<option>` - keep both; the IDE rewrites the file in its own form on save. Ask the user to confirm Settings → Tools → Oxc after reopening.
48
+
49
+ `.idea/externalDependencies.xml` (required plugin; un-ignore it if `.idea` is gitignored: `!.idea/externalDependencies.xml`):
50
+
51
+ ```xml
52
+ <?xml version="1.0" encoding="UTF-8"?>
53
+ <project version="4">
54
+ <component name="ExternalDependencies">
55
+ <plugin id="com.github.oxc.project.oxcintellijplugin" />
56
+ </component>
57
+ </project>
58
+ ```
59
+
60
+ `.idea/OxcSettings.xml` (Oxlint, fix all on save):
61
+
62
+ ```xml
63
+ <?xml version="1.0" encoding="UTF-8"?>
64
+ <project version="4">
65
+ <component name="OxcSettings" configurationMode="AUTOMATIC" fixAllOnSave="true">
66
+ <option name="configurationMode" value="AUTOMATIC" />
67
+ <option name="fixAllOnSave" value="true" />
68
+ </component>
69
+ </project>
70
+ ```
71
+
72
+ `.idea/OxfmtSettings.xml` (Oxfmt, format on save, IDE code style from Oxfmt):
73
+
74
+ ```xml
75
+ <?xml version="1.0" encoding="UTF-8"?>
76
+ <project version="4">
77
+ <component name="OxfmtSettings" configurationMode="AUTOMATIC" fixAllOnSave="true" preferOxfmtCodeStyleSettings="true">
78
+ <option name="configurationMode" value="AUTOMATIC" />
79
+ <option name="fixAllOnSave" value="true" />
80
+ <option name="preferOxfmtCodeStyleSettings" value="true" />
81
+ </component>
82
+ </project>
83
+ ```
84
+
85
+ `.idea/prettier.xml`:
86
+
87
+ ```xml
88
+ <?xml version="1.0" encoding="UTF-8"?>
89
+ <project version="4">
90
+ <component name="PrettierConfiguration">
91
+ <option name="myConfigurationMode" value="DISABLED" />
92
+ <option name="myRunOnSave" value="false" />
93
+ </component>
94
+ </project>
95
+ ```
96
+
97
+ # Configure `.idea/prettier.xml` (without Vite+)
46
98
 
47
99
  ```xml
48
100
  <?xml version="1.0" encoding="UTF-8"?>
@@ -56,7 +108,7 @@ Compare the project's `.idea` files with the templates below and the `webstorm`
56
108
  </project>
57
109
  ```
58
110
 
59
- # Configure `.idea/jsLinters/eslint.xml`
111
+ # Configure `.idea/jsLinters/eslint.xml` (without Vite+)
60
112
 
61
113
  ```xml
62
114
  <?xml version="1.0" encoding="UTF-8"?>
@@ -30,21 +30,78 @@ Procedures for an OpenSpec corpus. Five things live elsewhere and are not repeat
30
30
 
31
31
  Where the repository's `AGENTS.md` names a spec gate in its Checks list, such as `spec-tools gates`, run that gate: it runs `steward check --base auto` with the repository's binds. Elsewhere run `steward check --base auto` yourself. It compares the working tree with the branch point and checks the corpus and the files citing it. Add `--file <path>` to scope it, `--json` for machines, `--strict` to fail on warnings, and `--fix` for the safe mechanical repairs. A kind marked _base only_ runs only when a base is set, and under a base the prompts cover only what the diff added or edited.
32
32
 
33
- | Kind | Severity | What to do |
34
- | --- | --- | --- |
35
- | `dangling-citation` | error | Fix the path or anchor, or remove the citation. A citation is an optional pointer; the one rule is that it resolves. |
36
- | `renamed-anchor` | error, base only | `--fix` rewrites every citation of an anchor the diff renamed. |
37
- | `duplicate-anchor` | error | Two headings in one spec render the same slug. Rename one. |
38
- | `duplicate-requirement` | error | One requirement name in two capabilities, or one body twice. Keep it in the capability that owns the behaviour and reference it from the other. |
39
- | `size` | error past 500 words or 8 obligations, info past 300 or 5 | Split the requirement into coherent areas, never into one requirement per sentence ([model](references/model.md#tests-and-scenarios)). |
40
- | `scenario-unproven` | error, base only | A scenario you added or edited in a REQUIRED requirement has no binding. Cite it where its test, type assertion, lint entry or check proves it ([binding](references/contract.md#binding)); a test you add must catch a regression of that case. If no evidence can, the requirement takes a Known gap naming the scenario, or becomes ⚠️ ADVISORY — the owner's call. |
41
- | `weakened` | warn, base only | A rule was removed, lowered (MUST → SHOULD), lost an absolute, gained an exception or became advisory. **Stop and ask the owner** — unless they asked for exactly this. In a hand-back, map each finding to the decision that authorised it (a review item, a ticket, the owner's word) and list only the unmatched ones for a decision; a verbatim move is already reported as a rename. |
42
- | `textual-test` | warn | The test asserts on source, spec or doc text. Prefer a behavioural test, or a deterministic tool for structure. |
43
- | `marker-hygiene` | warn | `--fix` normalises a misspelt marker. A retired `**⚠️ Unenforced:**`, or a Known gap without a tracker, exempts nothing: replace it with Advisory, a tracked Known gap, or nothing, as the [model](references/model.md#advisory-known-gap-or-neither) says, and ask the owner, because each is a reclassification. |
44
- | `new-requirement` | info, base only | Say, in your reply, which observable failure it prevents and what cheapest evidence catches it. If there is none, it is advisory or belongs elsewhere. |
45
- | `absolute-unproven` | info | Name the absolute's exceptions, or confirm it has none. Advisory requirements are not reported. |
46
- | `impl-detail`, `vague-obligation`, `restating-scenario`, `duplicate-scenario`, `unbound-test` | info | Prompts for judgement, not orders. Answer them in the spec or in your reply. Never write a test just to silence one. |
47
- | `non-ears`, `non-bdd` | info, base only | Added or edited text only: write the statement in EARS and the scenario in Given/When/Then ([model](references/model.md#tests-and-scenarios)). Never fails. |
33
+ <table>
34
+ <thead>
35
+ <tr><th>Kind</th><th>Severity</th><th>What to do</th></tr>
36
+ </thead>
37
+ <tbody>
38
+ <tr>
39
+ <td><code>dangling-citation</code></td>
40
+ <td>error</td>
41
+ <td>Fix the path or anchor, or remove the citation. A citation is an optional pointer; the one rule is that it resolves.</td>
42
+ </tr>
43
+ <tr>
44
+ <td><code>renamed-anchor</code></td>
45
+ <td>error, base only</td>
46
+ <td><code>--fix</code> rewrites every citation of an anchor the diff renamed.</td>
47
+ </tr>
48
+ <tr>
49
+ <td><code>duplicate-anchor</code></td>
50
+ <td>error</td>
51
+ <td>Two headings in one spec render the same slug. Rename one.</td>
52
+ </tr>
53
+ <tr>
54
+ <td><code>duplicate-requirement</code></td>
55
+ <td>error</td>
56
+ <td>One requirement name in two capabilities, or one body twice. Keep it in the capability that owns the behaviour and reference it from the other.</td>
57
+ </tr>
58
+ <tr>
59
+ <td><code>size</code></td>
60
+ <td>error past 500 words or 8 obligations, info past 300 or 5</td>
61
+ <td>Split the requirement into coherent areas, never into one requirement per sentence (<a href="references/model.md#tests-and-scenarios">model</a>).</td>
62
+ </tr>
63
+ <tr>
64
+ <td><code>scenario-unproven</code></td>
65
+ <td>error, base only</td>
66
+ <td>A scenario you added or edited in a REQUIRED requirement has no binding. Cite it where its test, type assertion, lint entry or check proves it (<a href="references/contract.md#binding">binding</a>); a test you add must catch a regression of that case. If no evidence can, the requirement takes a Known gap naming the scenario, or becomes ⚠️ ADVISORY — the owner's call.</td>
67
+ </tr>
68
+ <tr>
69
+ <td><code>weakened</code></td>
70
+ <td>warn, base only</td>
71
+ <td>A rule was removed, lowered (MUST → SHOULD), lost an absolute, gained an exception or became advisory. <strong>Stop and ask the owner</strong> — unless they asked for exactly this. In a hand-back, map each finding to the decision that authorised it (a review item, a ticket, the owner's word) and list only the unmatched ones for a decision; a verbatim move is already reported as a rename.</td>
72
+ </tr>
73
+ <tr>
74
+ <td><code>textual-test</code></td>
75
+ <td>warn</td>
76
+ <td>The test asserts on source, spec or doc text. Prefer a behavioural test, or a deterministic tool for structure.</td>
77
+ </tr>
78
+ <tr>
79
+ <td><code>marker-hygiene</code></td>
80
+ <td>warn</td>
81
+ <td><code>--fix</code> normalises a misspelt marker. A retired <code>**⚠️ Unenforced:**</code>, or a Known gap without a tracker, exempts nothing: replace it with Advisory, a tracked Known gap, or nothing, as the <a href="references/model.md#advisory-known-gap-or-neither">model</a> says, and ask the owner, because each is a reclassification.</td>
82
+ </tr>
83
+ <tr>
84
+ <td><code>new-requirement</code></td>
85
+ <td>info, base only</td>
86
+ <td>Say, in your reply, which observable failure it prevents and what cheapest evidence catches it. If there is none, it is advisory or belongs elsewhere.</td>
87
+ </tr>
88
+ <tr>
89
+ <td><code>absolute-unproven</code></td>
90
+ <td>info</td>
91
+ <td>Name the absolute's exceptions, or confirm it has none. Advisory requirements are not reported.</td>
92
+ </tr>
93
+ <tr>
94
+ <td><code>impl-detail</code>, <code>vague-obligation</code>, <code>restating-scenario</code>, <code>duplicate-scenario</code>, <code>unbound-test</code></td>
95
+ <td>info</td>
96
+ <td>Prompts for judgement, not orders. Answer them in the spec or in your reply. Never write a test just to silence one.</td>
97
+ </tr>
98
+ <tr>
99
+ <td><code>non-ears</code>, <code>non-bdd</code></td>
100
+ <td>info, base only</td>
101
+ <td>Added or edited text only: write the statement in EARS and the scenario in Given/When/Then (<a href="references/model.md#tests-and-scenarios">model</a>). Never fails.</td>
102
+ </tr>
103
+ </tbody>
104
+ </table>
48
105
 
49
106
  The exact rule behind each kind is in [contract.md](references/contract.md#kinds-and-severities). The edit hook runs the per-file checks on each file you touch, with no ratchet, and feeds them back at once. Treat its message as you would this table.
50
107
 
@@ -35,7 +35,7 @@ A citation of a scenario's anchor binds the scenario only where it sits in one o
35
35
  | In a test file (a JavaScript or TypeScript `*.test.*`, `*.spec.*` or `*.test-d.*` file, a file under `__tests__/` or `e2e/`, or a Python or Go test file), inside a `describe`, `it`, `test`, `suite` or `bench` call, with any `.only`, `.skip`, `.concurrent`, `.sequential`, `.todo`, `.each(…)`, `.for(…)`, `.runIf(…)`, `.skipIf(…)` or `.fails` chain, and Playwright's `test.describe`, `test.step`, `.serial`, `.parallel`, `.fixme` and `.fail`; in a Python test file, inside a `test_…` function or a `Test…` class; in a Go test file, inside a `Test…` function | yes |
36
36
  | In a test file, in the comment run directly above such a call or function (in Python, its decorators too), with no blank line between | yes |
37
37
  | In a test file, on a type assertion — an `Expect<…>` type alias, or an `expectTypeOf(…)` or `assertType(…)` call — at the top level or inside a block | yes |
38
- | In a lint configuration — `eslint.config.{js,mjs,cjs,ts,mts,cts}` or `yarn.config.cjs` — anywhere | yes |
38
+ | In a lint configuration — `eslint.config.{js,mjs,cjs,ts,mts,cts}`, `vite.config.{js,mjs,cjs,ts,mts,cts}` (Vite+) or `yarn.config.cjs` — anywhere | yes |
39
39
  | In a file matching a `binds` glob the repository declares — `"spec-steward": { "binds": [...] }` in its root `package.json`, or `--binds <glob>` — (a check script, a Dockerfile, a CI configuration), anywhere | yes |
40
40
  | Anywhere else in a test file: its header, a fixture, a helper | no — it binds nothing and fails nothing |
41
41
  | Code, configuration, YAML, a Dockerfile or a document that no `--binds` glob matches | no — it is a pointer |
@@ -145,11 +145,11 @@ An explicit `--base <ref>` compares with the merge base of `<ref>` and `HEAD`. W
145
145
 
146
146
  ### Exit codes
147
147
 
148
- | Code | When |
149
- | --- | --- |
150
- | 0 | No error finding |
151
- | 1 | An error finding, or a warning under `--strict` |
152
- | 2 | A usage or environment error: an unknown flag, a base ref that does not exist, a git file listing that failed or came back empty, a missing specs directory |
148
+ | Code | When |
149
+ | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
150
+ | 0 | No error finding |
151
+ | 1 | An error finding, or a warning under `--strict` |
152
+ | 2 | A usage or environment error: an unknown flag, a base ref that does not exist, a git file listing that failed or came back empty, a missing specs directory |
153
153
 
154
154
  Exit 2 on an empty listing keeps a broken checkout from passing a scan that read nothing.
155
155
 
@@ -14,18 +14,18 @@ One CLI, `spec-tools`, installed with `@kirill.konshin/lint` beside `spec-stewar
14
14
 
15
15
  ## Commands
16
16
 
17
- | Need | Command |
18
- | --- | --- |
19
- | The gate a merge request runs | `spec-tools gates` (spec-steward's check, then the change gates) |
20
- | Is this branch's change finished? | `spec-tools evidence` |
21
- | What changed in the specifications, by requirement | `spec-tools diff [<base>]` |
22
- | Check a spec edit before handing it back | `spec-tools changed`, then `/spec-verify changed` |
23
- | The full code-conformance audit, locally | `spec-tools audit` (`--here` for uncommitted edits, `--dry` to stop after the scope) |
17
+ | Need | Command |
18
+ | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
19
+ | The gate a merge request runs | `spec-tools gates` (spec-steward's check, then the change gates) |
20
+ | Is this branch's change finished? | `spec-tools evidence` |
21
+ | What changed in the specifications, by requirement | `spec-tools diff [<base>]` |
22
+ | Check a spec edit before handing it back | `spec-tools changed`, then `/spec-verify changed` |
23
+ | The full code-conformance audit, locally | `spec-tools audit` (`--here` for uncommitted edits, `--dry` to stop after the scope) |
24
24
  | spec-steward's corpus-quality audit, on the same engine | `spec-tools audit --audit spec-steward`, then consolidate `.spec-audit/spec-review.yaml` as the `spec-steward` skill says |
25
- | One pass of a CI audit | `spec-tools tier`, `scope`, `workers [--complete\|--verify]`, `report [--gate]` |
26
- | A headless skill review in CI | `spec-tools run <skill> --verdict .spec-audit/<report>.yaml` |
27
- | Gate a review's report | `spec-tools verdict .spec-audit/spec-verify.yaml` or `.spec-audit/<report>.yaml` |
28
- | The merge-request comment and HTML reports | `spec-tools comment <name>=<report.md>...`, `spec-tools html <file.md>...` |
25
+ | One pass of a CI audit | `spec-tools tier`, `scope`, `workers [--complete\|--verify]`, `report [--gate]` |
26
+ | A headless skill review in CI | `spec-tools run <skill> --verdict .spec-audit/<report>.yaml` |
27
+ | Gate a review's report | `spec-tools verdict .spec-audit/spec-verify.yaml` or `.spec-audit/<report>.yaml` |
28
+ | The merge-request comment and HTML reports | `spec-tools comment <name>=<report.md>...`, `spec-tools html <file.md>...` |
29
29
 
30
30
  In CI: `gates`, `evidence`, `diff`, `tier`, `scope`, `workers`, `report`, `verdict`, `comment`, `html`, for spec-verify. Locally: any of them, plus `audit --audit spec-steward`, which never runs in CI.
31
31
 
@@ -25,13 +25,38 @@ These rules tell what a finding is, how severe it is, and how sure you are of it
25
25
 
26
26
  - Give each finding a severity, an integer from 0 to 100, on this scale:
27
27
 
28
- | Band | Severity | The finding is |
29
- | --- | --- | --- |
30
- | ERROR | 90–100 | data loss, a leak of sensitive data, a security hole, or a main flow that fails in production |
31
- | ERROR | 70–89 | a demonstrated defect with a production effect: a flow fails, a contract or an invariant is broken, or users or operators see a performance problem |
32
- | WARN | 40–69 | a suspected defect; a demonstrated defect with no production effect; a conflict between rules |
33
- | INFO | 1–39 | a state or a risk for a reviewer: a duplicate rule, a test that asserts less than its scenario, a wording problem. It is never a failure. |
34
- | — | 0 | not true |
28
+ <table>
29
+ <thead>
30
+ <tr><th>Band</th><th>Severity</th><th>The finding is</th></tr>
31
+ </thead>
32
+ <tbody>
33
+ <tr>
34
+ <td>ERROR</td>
35
+ <td>90–100</td>
36
+ <td>data loss, a leak of sensitive data, a security hole, or a main flow that fails in production</td>
37
+ </tr>
38
+ <tr>
39
+ <td>ERROR</td>
40
+ <td>70–89</td>
41
+ <td>a demonstrated defect with a production effect: a flow fails, a contract or an invariant is broken, or users or operators see a performance problem</td>
42
+ </tr>
43
+ <tr>
44
+ <td>WARN</td>
45
+ <td>40–69</td>
46
+ <td>a suspected defect; a demonstrated defect with no production effect; a conflict between rules</td>
47
+ </tr>
48
+ <tr>
49
+ <td>INFO</td>
50
+ <td>1–39</td>
51
+ <td>a state or a risk for a reviewer: a duplicate rule, a test that asserts less than its scenario, a wording problem. It is never a failure.</td>
52
+ </tr>
53
+ <tr>
54
+ <td>—</td>
55
+ <td>0</td>
56
+ <td>not true</td>
57
+ </tr>
58
+ </tbody>
59
+ </table>
35
60
 
36
61
  - For a severity in the ERROR band, write the production scenario in one sentence: what occurs, to whom, and what breaks, leaks or becomes slow.
37
62
  - The tool turns severity and confidence into ERROR, WARN or INFO with its thresholds. The bands above are its defaults; a run can move them. Give the severity that the finding has. Do not aim at a band.
@@ -15,7 +15,7 @@ var __esmMin = (fn, res, err) => () => {
15
15
  throw err = [e], e;
16
16
  }
17
17
  };
18
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
18
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
19
19
  var __exportAll = (all, no_symbols) => {
20
20
  let target = {};
21
21
  for (var name in all) __defProp(target, name, {
@@ -1564,13 +1564,13 @@ var require_stringifyPair = /* @__PURE__ */ __commonJSMin(((exports) => {
1564
1564
  //#endregion
1565
1565
  //#region ../../node_modules/yaml/dist/log.js
1566
1566
  var require_log = /* @__PURE__ */ __commonJSMin(((exports) => {
1567
- var node_process$2 = __require("process");
1567
+ var node_process = __require("process");
1568
1568
  function debug(logLevel, ...messages) {
1569
1569
  if (logLevel === "debug") console.log(...messages);
1570
1570
  }
1571
1571
  function warn(logLevel, warning) {
1572
1572
  if (logLevel === "debug" || logLevel === "warn") {
1573
- if (typeof node_process$2.emitWarning === "function") node_process$2.emitWarning(warning);
1573
+ if (typeof node_process.emitWarning === "function") node_process.emitWarning(warning);
1574
1574
  else console.warn(warning);
1575
1575
  }
1576
1576
  }
@@ -4488,7 +4488,7 @@ var require_compose_doc = /* @__PURE__ */ __commonJSMin(((exports) => {
4488
4488
  //#endregion
4489
4489
  //#region ../../node_modules/yaml/dist/compose/composer.js
4490
4490
  var require_composer = /* @__PURE__ */ __commonJSMin(((exports) => {
4491
- var node_process$1 = __require("process");
4491
+ var node_process = __require("process");
4492
4492
  var directives = require_directives();
4493
4493
  var Document = require_Document();
4494
4494
  var errors = require_errors();
@@ -4605,7 +4605,7 @@ var require_composer = /* @__PURE__ */ __commonJSMin(((exports) => {
4605
4605
  }
4606
4606
  /** Advance the composer by one CST token. */
4607
4607
  *next(token) {
4608
- if (node_process$1.env.LOG_STREAM) console.dir(token, { depth: null });
4608
+ if (node_process.env.LOG_STREAM) console.dir(token, { depth: null });
4609
4609
  switch (token.type) {
4610
4610
  case "directive":
4611
4611
  this.directives.add(token.source, (offset, message, warning) => {
@@ -7476,7 +7476,7 @@ var isCLike, isDoc, REGEX_AFTER, REGEX_KEYWORD, OPEN, indentOf, TEST_NAME, TEST_
7476
7476
  var init_scan = __esmMin((() => {
7477
7477
  isCLike = (file) => /\.(?:[cm]?[jt]sx?|go)$/i.test(file);
7478
7478
  isDoc = (file) => /\.mdx?$/i.test(file);
7479
- REGEX_AFTER = /* @__PURE__ */ new Set([..."(,=:[!&|?{};+-*%<>~^", ""]);
7479
+ REGEX_AFTER = /* @__PURE__ */ new Set([..."(,=:[!&|?{};+-*%<>~^".split(""), ""]);
7480
7480
  REGEX_KEYWORD = /^(?:return|typeof|instanceof|in|of|new|delete|void|throw|case|do|else|yield|await)$/;
7481
7481
  OPEN = {
7482
7482
  "(": ")",
@@ -7689,7 +7689,7 @@ var init_citations = __esmMin((() => {
7689
7689
  CITE = /((?:\.{1,2}\/)*(?:[\w@.-]+\/)*?openspec\/specs\/[\w./-]*?spec\.md)(?:#([\w-]+))?/g;
7690
7690
  SKIP = /(?:^|\/)(?:node_modules|dist|build|coverage|\.git|\.nx|\.yarn|\.yalc|\.turbo|\.next|\.docusaurus|\.eve)(?:\/|$)|^openspec\/changes\/|(?:^|\/)spec\.md$/;
7691
7691
  TEST_FILE = /(?:^|\/)(?:__tests__|e2e)\/|\.(?:test|spec|test-d)\.[cm]?[jt]sx?$|(?:^|\/)test_[^/]+\.py$|_test\.(?:py|go)$/;
7692
- LINT_CONFIG = /(?:^|\/)(?:eslint\.config\.[cm]?[jt]s|yarn\.config\.cjs)$/;
7692
+ LINT_CONFIG = /(?:^|\/)(?:(?:eslint|vite)\.config\.[cm]?[jt]s|yarn\.config\.cjs)$/;
7693
7693
  isTestFile = (file) => TEST_FILE.test(file) && !isDoc(file);
7694
7694
  isLintConfig = (file) => LINT_CONFIG.test(file);
7695
7695
  anchorCache = /* @__PURE__ */ new Map();
@@ -9389,6 +9389,7 @@ function rootsOf(opts, cwd = process.cwd()) {
9389
9389
  /** A `P,F` pair of size lines, or the default. */
9390
9390
  function pair(value, fallback) {
9391
9391
  if (value === void 0) return fallback;
9392
+ if (typeof value !== "string" && typeof value !== "number") throw new UsageError(`bad size line: ${JSON.stringify(value)}`);
9392
9393
  const [p, f] = String(value).split(",").map(Number);
9393
9394
  if (!Number.isFinite(p) || f !== void 0 && !Number.isFinite(f)) throw new UsageError(`bad size line: ${value}`);
9394
9395
  return [p, f ?? fallback[1]];
@@ -11648,7 +11649,7 @@ async function runClaude(run, wrote, budget, env, cwd) {
11648
11649
  session
11649
11650
  };
11650
11651
  if (code !== 0) {
11651
- const why = String(r?.result ?? "").slice(0, 200);
11652
+ const why = typeof r?.result === "string" ? r.result.slice(0, 200) : "";
11652
11653
  return {
11653
11654
  status: `exit ${code}${why ? ` (${why})` : ""}`,
11654
11655
  session
@@ -12364,7 +12365,7 @@ function scopeHeader(scope) {
12364
12365
  }
12365
12366
  function main$1(read = commitReader, env = process.env) {
12366
12367
  const t = thresholds(env);
12367
- const units = tryReadData(path$1.join(root(), UNITS_FILE)) ?? {};
12368
+ const units = tryReadData(path$1.join(root(), ".spec-audit/parts/units.yaml")) ?? {};
12368
12369
  const advisory = new Set(Object.entries(units).flatMap(([id, u]) => u.advisory ? [id] : []));
12369
12370
  const scopePath = path$1.join(root(), SCOPE_FILE);
12370
12371
  const scope = fs$1.existsSync(scopePath) ? readData(scopePath) : void 0;
@@ -12650,8 +12651,13 @@ function progress(event, now = /* @__PURE__ */ new Date()) {
12650
12651
  const clock = now.toTimeString().slice(0, 8);
12651
12652
  return (event.message?.content ?? []).filter((c) => c.type === "tool_use").map((c) => {
12652
12653
  const i = c.input ?? {};
12653
- const what = String(i.description ?? i.file_path ?? i.pattern ?? i.command ?? "").slice(0, 120);
12654
- return `[${clock}]${event.parent_tool_use_id ? " ↳" : ""} ${c.name} ${what}\n`;
12654
+ const what = [
12655
+ i.description,
12656
+ i.file_path,
12657
+ i.pattern,
12658
+ i.command
12659
+ ].find((v) => typeof v === "string") ?? "";
12660
+ return `[${clock}]${event.parent_tool_use_id ? " ↳" : ""} ${c.name} ${what.slice(0, 120)}\n`;
12655
12661
  }).join("");
12656
12662
  }
12657
12663
  /** One headless session, streamed to the job log; its exit code, its result text and its session id. */
@@ -12879,7 +12885,7 @@ function comment(reviews, env = process.env) {
12879
12885
  out.push(`| ${name} | ${MARKS[v.state] ?? `⚠️ ${v.state}`} | ${v.errors} | ${v.warnings} | ${reports(file.replace(/\.md$/, ""))} |`);
12880
12886
  }
12881
12887
  out.push("");
12882
- if (fs$1.existsSync(COVERAGE_REPORT)) out.push(`Coverage: ${reports(COVERAGE_REPORT.replace(/\.md$/, ""))}`, "");
12888
+ if (fs$1.existsSync(".spec-audit/coverage.md")) out.push(`Coverage: ${reports(COVERAGE_REPORT.replace(/\.md$/, ""))}`, "");
12883
12889
  const diff = read(DIFF_FILE);
12884
12890
  if (diff !== void 0) out.push(`Specification diff — ${diff.split("\n")[0]}: ${reports(DIFF_FILE.replace(/\.md$/, ""))}`, "");
12885
12891
  const gating = env.AUDIT_GATING || "gating";