vigiles 2.0.0 → 2.2.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 (184) hide show
  1. package/README.md +182 -134
  2. package/dist/action-gate.d.ts +28 -0
  3. package/dist/action-gate.js +73 -0
  4. package/dist/cli.js +705 -230
  5. package/dist/community-skills.d.ts +22 -0
  6. package/dist/community-skills.js +86 -0
  7. package/dist/compile-generator.d.ts +48 -0
  8. package/dist/compile-generator.js +322 -0
  9. package/dist/compile.d.ts +4 -0
  10. package/dist/compile.js +239 -45
  11. package/dist/coverage.d.ts +56 -0
  12. package/dist/coverage.js +178 -0
  13. package/dist/doc-refs.d.ts +60 -0
  14. package/dist/doc-refs.js +246 -0
  15. package/dist/eval.d.ts +62 -0
  16. package/dist/eval.js +174 -0
  17. package/dist/evolve.js +60 -125
  18. package/dist/frontmatter.d.ts +75 -0
  19. package/dist/frontmatter.js +263 -0
  20. package/dist/generate-schema.d.ts +51 -0
  21. package/dist/generate-schema.js +125 -0
  22. package/dist/generate-types.js +39 -1
  23. package/dist/harness-test.d.ts +38 -0
  24. package/dist/harness-test.js +129 -0
  25. package/dist/hash.d.ts +8 -0
  26. package/dist/hash.js +16 -0
  27. package/dist/inline.d.ts +22 -4
  28. package/dist/inline.js +60 -13
  29. package/dist/integrity.d.ts +29 -0
  30. package/dist/integrity.js +44 -0
  31. package/dist/linters.d.ts +5 -3
  32. package/dist/linters.js +144 -4
  33. package/dist/mock-model.d.ts +31 -0
  34. package/dist/mock-model.js +189 -0
  35. package/dist/orphans.d.ts +52 -0
  36. package/dist/orphans.js +124 -0
  37. package/dist/proofs.js +22 -16
  38. package/dist/refs.d.ts +44 -0
  39. package/dist/refs.js +144 -0
  40. package/dist/session.d.ts +97 -0
  41. package/dist/session.js +306 -0
  42. package/dist/sidecar.d.ts +35 -0
  43. package/dist/sidecar.js +102 -0
  44. package/dist/skill-driver.d.ts +77 -0
  45. package/dist/skill-driver.js +76 -0
  46. package/dist/skill-runtime.d.ts +101 -0
  47. package/dist/skill-runtime.js +289 -0
  48. package/dist/skill-test.d.ts +47 -0
  49. package/dist/skill-test.js +77 -0
  50. package/dist/spec.d.ts +119 -13
  51. package/dist/spec.js +51 -4
  52. package/dist/symbols.d.ts +30 -0
  53. package/dist/symbols.js +142 -0
  54. package/dist/test-utils.d.ts +8 -0
  55. package/dist/test-utils.js +41 -0
  56. package/dist/types.d.ts +34 -8
  57. package/dist/types.js +19 -0
  58. package/dist/validate.js +5 -3
  59. package/package.json +26 -5
  60. package/.claude/settings.json +0 -46
  61. package/.claude/settings.local.json +0 -8
  62. package/.github/workflows/ci.yml +0 -81
  63. package/.prettierignore +0 -1
  64. package/.vigiles/generated.d.ts +0 -205
  65. package/CLAUDE.md +0 -95
  66. package/CLAUDE.md.spec.ts +0 -142
  67. package/CONTRIBUTING.md +0 -121
  68. package/dist/action.d.ts.map +0 -1
  69. package/dist/action.js.map +0 -1
  70. package/dist/cli.d.ts.map +0 -1
  71. package/dist/cli.js.map +0 -1
  72. package/dist/cli.test.d.ts +0 -2
  73. package/dist/cli.test.d.ts.map +0 -1
  74. package/dist/cli.test.js +0 -650
  75. package/dist/cli.test.js.map +0 -1
  76. package/dist/compile.d.ts.map +0 -1
  77. package/dist/compile.js.map +0 -1
  78. package/dist/evolve.d.ts.map +0 -1
  79. package/dist/evolve.js.map +0 -1
  80. package/dist/freshness.d.ts +0 -67
  81. package/dist/freshness.d.ts.map +0 -1
  82. package/dist/freshness.js +0 -244
  83. package/dist/freshness.js.map +0 -1
  84. package/dist/freshness.test.d.ts +0 -2
  85. package/dist/freshness.test.d.ts.map +0 -1
  86. package/dist/freshness.test.js +0 -356
  87. package/dist/freshness.test.js.map +0 -1
  88. package/dist/generate-types.d.ts.map +0 -1
  89. package/dist/generate-types.js.map +0 -1
  90. package/dist/inline.d.ts.map +0 -1
  91. package/dist/inline.js.map +0 -1
  92. package/dist/inline.test.d.ts +0 -5
  93. package/dist/inline.test.d.ts.map +0 -1
  94. package/dist/inline.test.js +0 -152
  95. package/dist/inline.test.js.map +0 -1
  96. package/dist/linters.d.ts.map +0 -1
  97. package/dist/linters.js.map +0 -1
  98. package/dist/proofs.d.ts.map +0 -1
  99. package/dist/proofs.js.map +0 -1
  100. package/dist/proofs.test.d.ts +0 -9
  101. package/dist/proofs.test.d.ts.map +0 -1
  102. package/dist/proofs.test.js +0 -952
  103. package/dist/proofs.test.js.map +0 -1
  104. package/dist/spec.d.ts.map +0 -1
  105. package/dist/spec.js.map +0 -1
  106. package/dist/spec.test.d.ts +0 -2
  107. package/dist/spec.test.d.ts.map +0 -1
  108. package/dist/spec.test.js +0 -1222
  109. package/dist/spec.test.js.map +0 -1
  110. package/dist/types.d.ts.map +0 -1
  111. package/dist/types.js.map +0 -1
  112. package/dist/validate.d.ts.map +0 -1
  113. package/dist/validate.js.map +0 -1
  114. package/dist/validate.test.d.ts +0 -2
  115. package/dist/validate.test.d.ts.map +0 -1
  116. package/dist/validate.test.js +0 -531
  117. package/dist/validate.test.js.map +0 -1
  118. package/docs/agent-setup.md +0 -85
  119. package/docs/agent-workflows.md +0 -103
  120. package/docs/comparison.md +0 -71
  121. package/docs/freshness.md +0 -124
  122. package/docs/inline-mode.md +0 -119
  123. package/docs/linter-support.md +0 -166
  124. package/docs/spec-format.md +0 -194
  125. package/eslint.config.mjs +0 -79
  126. package/examples/CLAUDE.md +0 -54
  127. package/examples/CLAUDE.md.spec.ts +0 -65
  128. package/examples/SKILL.md +0 -50
  129. package/examples/SKILL.md.spec.ts +0 -57
  130. package/fixtures/example-project/CLAUDE.md +0 -11
  131. package/fixtures/example-project/package.json +0 -9
  132. package/fixtures/example-project/src/index.ts +0 -3
  133. package/fixtures/example-project/src/utils.test.ts +0 -2
  134. package/fixtures/example-project/src/utils.ts +0 -3
  135. package/logo.png +0 -0
  136. package/research/adoption-strategy.md +0 -111
  137. package/research/agent-integration.md +0 -145
  138. package/research/ai-code-quality.md +0 -197
  139. package/research/code-search-for-agents.md +0 -313
  140. package/research/competitive-landscape.md +0 -163
  141. package/research/doc-freshness.md +0 -516
  142. package/research/executable-specs.md +0 -368
  143. package/research/feature-ideas.md +0 -464
  144. package/research/formal-proofs-for-agents.md +0 -338
  145. package/research/fp-for-agent-harness.md +0 -150
  146. package/research/fp-for-deterministic-ai.md +0 -131
  147. package/research/self-evolving-specs.md +0 -298
  148. package/schemas/claude-md-strict.yml +0 -18
  149. package/schemas/claude-md.yml +0 -6
  150. package/schemas/skill-strict.yml +0 -12
  151. package/schemas/skill.yml +0 -5
  152. package/skills/audit-feedback-loop/SKILL.md +0 -76
  153. package/skills/edit-spec/SKILL.md +0 -131
  154. package/skills/enforce-rules-format/SKILL.md +0 -71
  155. package/skills/generate-logo/SKILL.md +0 -102
  156. package/skills/generate-rule/SKILL.md +0 -90
  157. package/skills/linter-docs/clippy.md +0 -241
  158. package/skills/linter-docs/eslint.md +0 -384
  159. package/skills/linter-docs/pylint.md +0 -288
  160. package/skills/linter-docs/rubocop.md +0 -277
  161. package/skills/linter-docs/ruff.md +0 -187
  162. package/skills/linter-docs/stylelint.md +0 -247
  163. package/skills/migrate-to-spec/SKILL.md +0 -124
  164. package/skills/pr-to-lint-rule/SKILL.md +0 -97
  165. package/skills/strengthen/SKILL.md +0 -168
  166. package/src/action.ts +0 -214
  167. package/src/cli.test.ts +0 -914
  168. package/src/cli.ts +0 -1631
  169. package/src/compile.ts +0 -691
  170. package/src/evolve.ts +0 -781
  171. package/src/freshness.test.ts +0 -449
  172. package/src/freshness.ts +0 -299
  173. package/src/generate-types.ts +0 -448
  174. package/src/inline.test.ts +0 -206
  175. package/src/inline.ts +0 -164
  176. package/src/linters.ts +0 -739
  177. package/src/proofs.test.ts +0 -1314
  178. package/src/proofs.ts +0 -849
  179. package/src/spec.test.ts +0 -1471
  180. package/src/spec.ts +0 -427
  181. package/src/types.ts +0 -117
  182. package/src/validate.test.ts +0 -701
  183. package/src/validate.ts +0 -381
  184. package/tsconfig.json +0 -23
package/src/inline.ts DELETED
@@ -1,164 +0,0 @@
1
- /**
2
- * vigiles — Inline rule mode for gradual adoption.
3
- *
4
- * Parses `<!-- vigiles:enforce <linter>/<rule> "<why>" -->` HTML comments
5
- * out of any markdown file, so a project can adopt vigiles one rule at a
6
- * time without committing to a .spec.ts compile step. Every inline rule
7
- * goes through the same `checkLinterRule` verification as rules declared
8
- * in a .spec.ts — typos get closest-match suggestions, disabled rules are
9
- * flagged, etc.
10
- *
11
- * Only `enforce` is supported inline. `guidance` would be a tautology: if
12
- * you're editing the markdown, the prose around the comment already is
13
- * the guidance — there's nothing extra for a tool to render.
14
- *
15
- * A file is in "inline mode" iff it contains at least one vigiles:enforce
16
- * comment. Spec mode (`.md.spec.ts` sibling) takes precedence if both
17
- * exist; the spec compiler emits a fresh file that may overwrite the
18
- * inline markup, so users should pick one per file.
19
- */
20
-
21
- export interface InlineRule {
22
- /** Linter rule reference, e.g. "eslint/no-console". */
23
- linterRule: string;
24
- /** Why this rule is enforced (human-readable, shown in agent context). */
25
- why: string;
26
- /** 1-based line number of the comment in the source file. */
27
- line: number;
28
- }
29
-
30
- export interface InlineParseResult {
31
- rules: InlineRule[];
32
- /** Lines that look like vigiles: markers but failed to parse. */
33
- errors: { line: number; message: string; raw: string }[];
34
- }
35
-
36
- /**
37
- * Match `<!-- vigiles:enforce <linter>/<rule> "<why>" -->`. The linter
38
- * reference allows the same characters as the TS-side `SAFE_RULE_NAME_RE`
39
- * plus `@` for scoped plugin names (e.g. `@typescript-eslint/...`).
40
- * The `why` is a simple quoted string — if someone wants newlines or
41
- * embedded quotes, they can move to spec mode.
42
- */
43
- const ENFORCE_RE =
44
- /<!--\s*vigiles:enforce\s+([@A-Za-z0-9_/:.-]+)\s+"([^"\n]*)"\s*-->/;
45
-
46
- /**
47
- * Detects any `<!-- vigiles:<kind> -->` comment (valid or not) so we can
48
- * surface errors for typos and reserved-but-unrecognized kinds. Uses a
49
- * non-greedy match for the tail so a `-` inside the kind doesn't short-
50
- * circuit the pattern.
51
- */
52
- const MARKER_RE = /<!--\s*vigiles:([A-Za-z_-]+)[^]*?-->/;
53
-
54
- /**
55
- * Parse inline vigiles rules out of a markdown file's contents.
56
- * Does not touch the filesystem and does not verify the rules against
57
- * any linter — callers can feed the returned rules into
58
- * `checkLinterRule` themselves.
59
- *
60
- * Lines inside fenced code blocks (``` ... ``` or ~~~ ... ~~~) are
61
- * skipped so illustrative examples in docs don't get treated as live
62
- * rules.
63
- */
64
- export function parseInlineRules(content: string): InlineParseResult {
65
- const rules: InlineRule[] = [];
66
- const errors: InlineParseResult["errors"] = [];
67
-
68
- const lines = content.split("\n");
69
- let fenceChar: "`" | "~" | null = null;
70
- let fenceLen = 0;
71
-
72
- for (let i = 0; i < lines.length; i++) {
73
- const line = lines[i];
74
-
75
- // Track fenced code blocks. CommonMark allows ``` or ~~~ fences
76
- // with 3+ characters; the closing fence must use the same char and
77
- // have length >= the opening fence's length. Info-string tokens
78
- // after the opener are allowed.
79
- const fenceMatch = /^(\s{0,3})(`{3,}|~{3,})(.*)$/.exec(line);
80
- if (fenceMatch) {
81
- const marker = fenceMatch[2];
82
- const ch = marker[0] as "`" | "~";
83
- const len = marker.length;
84
- if (fenceChar === null) {
85
- fenceChar = ch;
86
- fenceLen = len;
87
- continue;
88
- } else if (ch === fenceChar && len >= fenceLen) {
89
- // Closing fence — trailing info-string is not allowed per
90
- // CommonMark; only treat it as a close if the rest of the
91
- // line is whitespace.
92
- if (fenceMatch[3].trim() === "") {
93
- fenceChar = null;
94
- fenceLen = 0;
95
- continue;
96
- }
97
- }
98
- }
99
- if (fenceChar !== null) {
100
- // Inside a code block — ignore any vigiles markers on this line.
101
- continue;
102
- }
103
-
104
- // Strip inline code spans (backtick-wrapped text) so illustrative
105
- // markers in prose like `<!-- vigiles:enforce ... -->` don't get
106
- // parsed. CommonMark opens with N backticks and closes with exactly
107
- // N, so the backreference handles matching-length spans.
108
- const scannable = line.replace(/(`+)[\s\S]*?\1/g, (m) =>
109
- " ".repeat(m.length),
110
- );
111
-
112
- const enforceMatch = ENFORCE_RE.exec(scannable);
113
- if (enforceMatch) {
114
- rules.push({
115
- linterRule: enforceMatch[1],
116
- why: enforceMatch[2],
117
- line: i + 1,
118
- });
119
- continue;
120
- }
121
- // Skip the compiled-file hash header (`<!-- vigiles:sha256:... -->`)
122
- // entirely — it's not a rule marker and should not be reported.
123
- if (/<!--\s*vigiles:sha\d+:/.test(scannable)) continue;
124
-
125
- const markerMatch = MARKER_RE.exec(scannable);
126
- if (markerMatch) {
127
- // Looks like a vigiles marker but didn't parse as enforce —
128
- // surface it so users catch typos like "vigile:enforce" or
129
- // unquoted why.
130
- const kind = markerMatch[1];
131
- if (kind === "enforce") {
132
- errors.push({
133
- line: i + 1,
134
- message:
135
- 'Malformed vigiles:enforce — expected `<!-- vigiles:enforce <linter>/<rule> "<why>" -->`',
136
- raw: line.trim(),
137
- });
138
- } else if (kind !== "disable" && kind !== "ignore") {
139
- // `vigiles:disable ...` / `vigiles:ignore ...` are reserved for
140
- // future disable-comment support; don't complain about them.
141
- errors.push({
142
- line: i + 1,
143
- message: `Unknown vigiles marker "${kind}". Only \`vigiles:enforce\` is supported.`,
144
- raw: line.trim(),
145
- });
146
- }
147
- }
148
- }
149
-
150
- return { rules, errors };
151
- }
152
-
153
- /**
154
- * True if the content contains at least one parseable vigiles:enforce
155
- * rule (ignoring fenced code blocks and malformed markers). Used by
156
- * `require-spec` validation to treat inline mode as spec-equivalent.
157
- *
158
- * Deliberately delegates to `parseInlineRules` so a loose prefix regex
159
- * can't satisfy require-spec with a malformed marker that produces no
160
- * real enforceable rule.
161
- */
162
- export function hasInlineRules(content: string): boolean {
163
- return parseInlineRules(content).rules.length > 0;
164
- }