@gobing-ai/spur 0.4.8 → 0.4.9

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 (145) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/config/pipeline-budgets.json +2 -2
  3. package/config/rules/boundary/config-loading-ownership.yaml +1 -0
  4. package/config/rules/boundary/sp-plugin-standalone.yaml +1 -1
  5. package/config/rules/boundary/sp-script-placement.yaml +1 -1
  6. package/config/rules/docs/sourced-api-claims.yaml +45 -7
  7. package/config/rules/strict/runtime-boundaries.yaml +40 -1
  8. package/config/rules/structure/protected-files.yaml +1 -1
  9. package/config/rules/surface/check-cli-surface.yaml +33 -0
  10. package/config/rules/typescript/no-debugger.yaml +3 -0
  11. package/config/workflow-candidates.json +2 -2
  12. package/config/workflows/feature-verification.yaml +6 -11
  13. package/config/workflows/history-anatomy.yaml +14 -28
  14. package/config/workflows/idea-pipeline.yaml +6 -19
  15. package/config/workflows/pr-review.yaml +9 -16
  16. package/config/workflows/task-pipeline.yaml +16 -23
  17. package/config/workflows/wrapup-pipeline.yaml +21 -63
  18. package/package.json +3 -3
  19. package/plugins/sp/README.md +70 -37
  20. package/plugins/sp/agents/super-planner.md +5 -5
  21. package/plugins/sp/agents/super-reviewer.md +2 -2
  22. package/plugins/sp/commands/dev-changelog.md +1 -1
  23. package/plugins/sp/commands/dev-daily.md +1 -1
  24. package/plugins/sp/commands/dev-pr-review.md +1 -1
  25. package/plugins/sp/commands/dev-review-session.md +1 -1
  26. package/plugins/sp/commands/dev-runall.md +4 -4
  27. package/plugins/sp/commands/dev-verify.md +4 -6
  28. package/plugins/sp/commands/dev-verifyall.md +4 -5
  29. package/plugins/sp/hooks/hooks.json +11 -1
  30. package/plugins/sp/lib/context-post-tool.ts +1 -1
  31. package/plugins/sp/lib/context-session-start.ts +1 -1
  32. package/plugins/sp/lib/context-session-stop.ts +1 -1
  33. package/plugins/sp/lib/destructive-policy.ts +65 -1
  34. package/plugins/sp/plugin.json +2 -5
  35. package/plugins/sp/{hooks → scripts/hooks}/agent-lifecycle.ts +1 -1
  36. package/plugins/sp/scripts/hooks/careful-guard.ts +94 -0
  37. package/plugins/sp/{hooks → scripts/hooks}/context-post-tool.ts +2 -2
  38. package/plugins/sp/{hooks → scripts/hooks}/context-session-start.ts +1 -1
  39. package/plugins/sp/{hooks → scripts/hooks}/context-session-stop.ts +1 -1
  40. package/plugins/sp/{hooks → scripts/hooks}/fleet-guest-stop.ts +6 -4
  41. package/plugins/sp/{hooks → scripts/hooks}/task-write-guard.ts +38 -21
  42. package/plugins/sp/skills/code-implementation/SKILL.md +1 -1
  43. package/plugins/sp/skills/code-verification/SKILL.md +8 -8
  44. package/plugins/sp/skills/code-verification/references/secu-review.md +4 -3
  45. package/plugins/sp/skills/code-verification/references/verdict-schema.md +9 -1
  46. package/plugins/sp/skills/daily-summary/SKILL.md +4 -5
  47. package/plugins/sp/skills/dogfood-testing/SKILL.md +9 -9
  48. package/plugins/sp/skills/dogfood-testing/references/report-template.md +1 -1
  49. package/plugins/sp/skills/history-anatomy/references/modes.md +2 -2
  50. package/plugins/sp/skills/next-router/references/routing-table.md +1 -1
  51. package/plugins/sp/skills/parallel-execution/SKILL.md +1 -1
  52. package/plugins/sp/skills/pr-reviewing/SKILL.md +14 -15
  53. package/plugins/sp/skills/session-review/SKILL.md +3 -3
  54. package/plugins/sp/skills/source-driven-development/SKILL.md +7 -4
  55. package/plugins/sp/skills/spur-check/SKILL.md +14 -13
  56. package/plugins/sp/skills/spur-cli/SKILL.md +1 -1
  57. package/plugins/sp/skills/spur-cli/references/agent.md +12 -0
  58. package/plugins/sp/skills/spur-cli/references/builder.md +27 -6
  59. package/plugins/sp/skills/spur-cli/references/features.md +6 -1
  60. package/plugins/sp/skills/spur-cli/references/history.md +3 -0
  61. package/plugins/sp/skills/spur-cli/references/self.md +5 -3
  62. package/plugins/sp/skills/spur-cli/references/tasks/verbs.md +3 -0
  63. package/plugins/sp/skills/spur-cli/references/tasks.md +13 -3
  64. package/plugins/sp/skills/spur-cli/references/workflows.md +36 -1
  65. package/plugins/sp/skills/spur-dev/SKILL.md +1 -1
  66. package/plugins/sp/skills/spur-dev/references/cross-cutting.md +1 -1
  67. package/plugins/sp/skills/spur-dev/references/dev-operations.md +12 -12
  68. package/plugins/sp/skills/spur-dev/references/execution-batch-report.md +10 -11
  69. package/plugins/sp/skills/spur-dev/references/execution-batch.md +16 -17
  70. package/plugins/sp/skills/spur-dev/references/execution-parallel-isolation.md +1 -1
  71. package/plugins/sp/skills/spur-dev/references/execution-worktree-landing.md +8 -11
  72. package/plugins/sp/skills/spur-dev/references/execution-worktree-setup.md +6 -8
  73. package/plugins/sp/skills/spur-dev/references/gate-checklists.md +1 -1
  74. package/plugins/sp/skills/spur-dev/references/inline-pipeline-driver.md +33 -40
  75. package/plugins/sp/skills/spur-dev/references/structured-trace-emission.md +24 -24
  76. package/plugins/sp/skills/spur-doctor/SKILL.md +5 -4
  77. package/spur.js +41901 -30598
  78. package/config/plugin-scripts.json +0 -116
  79. package/config/script-placement-baseline.json +0 -33
  80. package/plugins/sp/hooks/careful-guard.ts +0 -74
  81. package/plugins/sp/hooks/pi/guard-extension.ts +0 -304
  82. package/plugins/sp/lib/dogfood-pipeline.ts +0 -265
  83. package/plugins/sp/lib/dogfood-report.ts +0 -278
  84. package/plugins/sp/lib/history-anatomy.generated.d.mts +0 -112
  85. package/plugins/sp/lib/history-anatomy.generated.mjs +0 -691
  86. package/plugins/sp/lib/idea-handoff.generated.d.mts +0 -17
  87. package/plugins/sp/lib/idea-handoff.generated.mjs +0 -1446
  88. package/plugins/sp/lib/inline-run-app.ts +0 -68
  89. package/plugins/sp/lib/inline-run.generated.d.mts +0 -37
  90. package/plugins/sp/lib/inline-run.generated.mjs +0 -3103
  91. package/plugins/sp/lib/plan-projection.generated.d.mts +0 -197
  92. package/plugins/sp/lib/plan-projection.generated.mjs +0 -982
  93. package/plugins/sp/lib/quality-gate.generated.d.mts +0 -139
  94. package/plugins/sp/lib/quality-gate.generated.mjs +0 -30510
  95. package/plugins/sp/lib/residual-scan.generated.d.mts +0 -93
  96. package/plugins/sp/lib/residual-scan.generated.mjs +0 -383
  97. package/plugins/sp/lib/run-summary-core.ts +0 -225
  98. package/plugins/sp/lib/spur-bin.ts +0 -36
  99. package/plugins/sp/lib/step-profile.generated.d.mts +0 -71
  100. package/plugins/sp/lib/step-profile.generated.mjs +0 -174
  101. package/plugins/sp/lib/transcript.ts +0 -112
  102. package/plugins/sp/scripts/batch-plan.mjs +0 -1096
  103. package/plugins/sp/scripts/batch-plan.ts +0 -145
  104. package/plugins/sp/scripts/batch-preflight.mjs +0 -423
  105. package/plugins/sp/scripts/batch-preflight.ts +0 -270
  106. package/plugins/sp/scripts/commit-guard.mjs +0 -226
  107. package/plugins/sp/scripts/commit-guard.ts +0 -248
  108. package/plugins/sp/scripts/daily-summary/daily-summary.mjs +0 -626
  109. package/plugins/sp/scripts/daily-summary/daily-summary.ts +0 -855
  110. package/plugins/sp/scripts/dogfood-testing/detect-pipeline-driving.mjs +0 -211
  111. package/plugins/sp/scripts/dogfood-testing/detect-pipeline-driving.ts +0 -110
  112. package/plugins/sp/scripts/dogfood-testing/validate-report.mjs +0 -282
  113. package/plugins/sp/scripts/dogfood-testing/validate-report.ts +0 -98
  114. package/plugins/sp/scripts/feature-verification-steps.mjs +0 -82
  115. package/plugins/sp/scripts/feature-verification-steps.ts +0 -164
  116. package/plugins/sp/scripts/history-anatomy-cache.mjs +0 -931
  117. package/plugins/sp/scripts/history-anatomy-cache.ts +0 -247
  118. package/plugins/sp/scripts/idea-handoff.mjs +0 -32
  119. package/plugins/sp/scripts/idea-handoff.ts +0 -47
  120. package/plugins/sp/scripts/inline-run-dispatch.mjs +0 -131
  121. package/plugins/sp/scripts/inline-run-dispatch.ts +0 -115
  122. package/plugins/sp/scripts/inline-run-setup.mjs +0 -746
  123. package/plugins/sp/scripts/inline-run-setup.ts +0 -198
  124. package/plugins/sp/scripts/persist-out-check.mjs +0 -217
  125. package/plugins/sp/scripts/persist-out-check.ts +0 -249
  126. package/plugins/sp/scripts/pr-reviewing.mjs +0 -712
  127. package/plugins/sp/scripts/pr-reviewing.ts +0 -952
  128. package/plugins/sp/scripts/quality-gate.mjs +0 -30491
  129. package/plugins/sp/scripts/quality-gate.ts +0 -80
  130. package/plugins/sp/scripts/residual-scan.mjs +0 -634
  131. package/plugins/sp/scripts/residual-scan.ts +0 -248
  132. package/plugins/sp/scripts/run-summary.mjs +0 -758
  133. package/plugins/sp/scripts/run-summary.ts +0 -107
  134. package/plugins/sp/scripts/script-root.mjs +0 -129
  135. package/plugins/sp/scripts/script-root.ts +0 -199
  136. package/plugins/sp/scripts/session-timeline.mjs +0 -359
  137. package/plugins/sp/scripts/session-timeline.ts +0 -190
  138. package/plugins/sp/scripts/task-diffstat.mjs +0 -181
  139. package/plugins/sp/scripts/task-diffstat.ts +0 -219
  140. package/plugins/sp/scripts/workflow-step-profile.mjs +0 -338
  141. package/plugins/sp/scripts/workflow-step-profile.ts +0 -165
  142. package/plugins/sp/scripts/wrapup-drift-probe.mjs +0 -190
  143. package/plugins/sp/scripts/wrapup-drift-probe.ts +0 -261
  144. package/plugins/sp/scripts/wrapup-steps.mjs +0 -627
  145. package/plugins/sp/scripts/wrapup-steps.ts +0 -891
@@ -1,261 +0,0 @@
1
- #!/usr/bin/env bun
2
- /**
3
- * wrapup-drift-probe — deterministic doc-ownership drift probe behind the wrapup-pipeline
4
- * task-resolve onEnter (task 0944, feature D64, ADR-115 composition budgets).
5
- *
6
- * Reads the validated wrapup capture `.spur/run/<runId>-wrapup-tasks.json` (never raw
7
- * vars.tasks — 0783 contract), runs `spur task show <wbs> --json` per member, collects the
8
- * changed paths from each task's `### Solution` file:line map, and writes:
9
- * - `<runId>-drift-probe.json` `{ clean: boolean, reasons: string[], paths: string[] }`
10
- * - `<runId>-mode.txt` projected wrapup mode: `fast` when clean, empty otherwise
11
- *
12
- * The probe runs ONLY when the caller left `mode` empty; a caller-set mode is projected
13
- * verbatim by the workflow wrapper and this script is never invoked (0944 R3).
14
- *
15
- * Dirty (clean=false, mode stays empty → the safety route) whenever ANY changed path
16
- * matches a doc-owned surface (AGENTS.md doc map + docs/99_PROJECT_CONSTITUTION.md
17
- * ownership table), or a task's Solution section is empty or unparseable (fail safe —
18
- * a wrapup without a readable change map must still reach doc-sync). Paths under the
19
- * task/feature corpus are never treated as drift.
20
- *
21
- * Node-builtin imports only; the spur lookup is a spawnable `SpurRunner` so tests can
22
- * fake it; `main(argv, env, options)` is the same injection point the workflow wrapper
23
- * and its node twin exercise. Always exits 0 after probing; only an empty `__runId`
24
- * (mis-invocation) exits 1.
25
- */
26
-
27
- import { spawnSync } from 'node:child_process';
28
- import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
29
- import { join } from 'node:path';
30
- import { getEnvVars } from '../lib/env';
31
- import { spurCommand } from '../lib/spur-bin';
32
-
33
- export interface DriftProbeEnv {
34
- __runId?: string;
35
- spurBin?: string;
36
- [key: string]: string | undefined;
37
- }
38
-
39
- export interface DriftProbeOptions {
40
- /** Base directory for `.spur/run`; defaults to the process cwd. */
41
- cwd?: string;
42
- }
43
-
44
- /** Minimal spawnable spur surface — tests fake this to return canned `task show` output. */
45
- export interface SpurShowResult {
46
- status: number;
47
- stdout: string;
48
- }
49
- export type SpurRunner = (args: string[]) => SpurShowResult;
50
-
51
- export interface DriftProbeResult {
52
- clean: boolean;
53
- reasons: string[];
54
- paths: string[];
55
- probeFile: string;
56
- modeFile: string;
57
- /** Exit code the workflow wrapper observes (only an empty __runId is a hard failure). */
58
- exitCode: number;
59
- }
60
-
61
- /**
62
- * Doc-owned surfaces (0944 R2): a changed path under any of these means doc-sync must
63
- * still run. Mirrors the AGENTS.md documentation map and the
64
- * docs/99_PROJECT_CONSTITUTION.md ownership table: contracts / cli commands / config /
65
- * migrations / workflow YAML / plugin commands, skills and hooks / root manifest / the
66
- * authoritative docs (00_ADR, 03_ARCHITECTURE, 04_DESIGN, docs/design). docs/tasks* and
67
- * docs/features/* (the corpus) are intentionally absent — they are never drift.
68
- *
69
- * WHY join('config', 'workflows'): rule sp-runtime-path forbids the literal
70
- * config/<dir> in runtime source; this constant is a drift TARGET (Solution
71
- * change-map paths against the build-time SSOT), not a runtime config read.
72
- */
73
- const WORKFLOWS_GLOB = `${join('config', 'workflows')}/**`;
74
- export const DOC_OWNED_SURFACES = [
75
- 'packages/contracts/**',
76
- 'apps/cli/src/commands/**',
77
- 'packages/config/src/**',
78
- 'drizzle/*.sql',
79
- WORKFLOWS_GLOB,
80
- 'plugins/sp/commands/**',
81
- 'plugins/sp/skills/**',
82
- 'plugins/sp/hooks/**',
83
- 'package.json',
84
- 'docs/00_ADR.md',
85
- 'docs/03_ARCHITECTURE.md',
86
- 'docs/04_DESIGN.md',
87
- 'docs/design/**',
88
- ] as const;
89
-
90
- /**
91
- * Top-level workspace entries from the AGENTS.md stack layout. A changed path whose first
92
- * segment is none of these is a new top-level workspace directory — doc-owned by default.
93
- * Single-segment paths (root files) are not directories and are exempt.
94
- */
95
- const KNOWN_TOP_LEVEL = new Set([
96
- 'apps',
97
- 'packages',
98
- 'plugins',
99
- 'config',
100
- 'docs',
101
- 'drizzle',
102
- 'scripts',
103
- 'vendors',
104
- 'package.json',
105
- 'bun.lock',
106
- 'bunfig.toml',
107
- ]);
108
-
109
- /** Corpus paths (task/feature records) are never drift — excluded before surface matching. */
110
- const CORPUS_PREFIXES = ['docs/tasks', 'docs/features/'];
111
-
112
- /** `### Solution` section of a task record (tolerates `##`–`####` heading depth). */
113
- export function solutionSectionOf(content: string): string | null {
114
- const heading = /^#{2,4}\s+Solution\s*$/m.exec(content);
115
- if (!heading) return null;
116
- const rest = content.slice(heading.index + heading[0].length);
117
- const next = /^#{2,4}\s+\S/m.exec(rest);
118
- return next ? rest.slice(0, next.index) : rest;
119
- }
120
-
121
- const CHANGE_ENTRY = /`([^`\r\n]+):(\d+)(?:-\d+)?`/g;
122
-
123
- /** Backticked `path:line` (or `path:line-range`) tokens from a Solution section. */
124
- export function changedPathsOf(section: string | null): string[] {
125
- if (section === null) return [];
126
- const paths: string[] = [];
127
- for (const match of section.matchAll(CHANGE_ENTRY)) {
128
- const path = match[1];
129
- if (path === undefined) continue;
130
- // Path-like: no whitespace and at least one separator or dotted suffix, so prose
131
- // backticks never masquerade as change-map entries.
132
- if (/\s/.test(path)) continue;
133
- if (!path.includes('/') && !path.includes('.')) continue;
134
- paths.push(path);
135
- }
136
- return paths;
137
- }
138
-
139
- function surfaceRegex(glob: string): RegExp {
140
- const escaped = glob
141
- .replace(/[.+^${}()|[\]\\]/g, '\\$&')
142
- .replaceAll('**', '\u0000')
143
- .replaceAll('*', '[^/]*')
144
- .replaceAll('\u0000', '.*');
145
- return new RegExp(`^${escaped}$`);
146
- }
147
-
148
- const SURFACE_MATCHERS = DOC_OWNED_SURFACES.map((glob) => ({ glob, regex: surfaceRegex(glob) }));
149
-
150
- /** 0944 R2 surface match: doc-owned glob, corpus exclusion, new top-level directory. */
151
- export function driftReasonForPath(path: string): string | null {
152
- if (CORPUS_PREFIXES.some((prefix) => path.startsWith(prefix))) return null;
153
- const top = path.split('/')[0];
154
- if (path.includes('/') && top !== undefined && !KNOWN_TOP_LEVEL.has(top)) {
155
- return 'new top-level workspace directory';
156
- }
157
- const match = SURFACE_MATCHERS.find((entry) => entry.regex.test(path));
158
- return match ? `matches doc-owned surface ${match.glob}` : null;
159
- }
160
-
161
- function defaultSpurRunner(env: DriftProbeEnv, cwd?: string): SpurRunner {
162
- const { cmd, prefix } = spurCommand(env.spurBin);
163
- return (args: string[]): SpurShowResult => {
164
- const run = spawnSync(cmd, [...prefix, ...args], {
165
- cwd,
166
- encoding: 'utf8',
167
- env: getEnvVars(),
168
- });
169
- return { status: run.status ?? 1, stdout: run.stdout ?? '' };
170
- };
171
- }
172
-
173
- /**
174
- * `probe` — classify the wrapup as clean (pure application-code change, no doc-owned
175
- * surface touched) or dirty, and project the wrapup mode. Fail safe: every lookup or
176
- * parse problem is a dirty probe, never a silent clean.
177
- */
178
- export function runDriftProbe(
179
- env: DriftProbeEnv,
180
- options: DriftProbeOptions = {},
181
- spur = defaultSpurRunner(env, options.cwd),
182
- ): DriftProbeResult {
183
- const cwd = options.cwd;
184
- const runId = env.__runId ?? '';
185
- if (runId.length === 0) {
186
- process.stderr.write('wrapup-drift-probe: __runId is empty — refusing the legacy fixed-path fallback\n');
187
- return { clean: false, reasons: [], paths: [], probeFile: '', modeFile: '', exitCode: 1 };
188
- }
189
- const relProbeFile = join('.spur', 'run', `${runId}-drift-probe.json`);
190
- const relModeFile = join('.spur', 'run', `${runId}-mode.txt`);
191
- const relTasksFile = join('.spur', 'run', `${runId}-wrapup-tasks.json`);
192
- const abs = (p: string): string => (cwd ? join(cwd, p) : p);
193
- mkdirSync(abs(join('.spur', 'run')), { recursive: true });
194
- // Write the dirty projection first so a crash mid-probe fails safe (mode stays empty).
195
- writeFileSync(abs(relModeFile), '\n');
196
-
197
- const finish = (clean: boolean, reasons: string[], paths: string[]): DriftProbeResult => {
198
- writeFileSync(abs(relProbeFile), `${JSON.stringify({ clean, reasons, paths })}\n`);
199
- writeFileSync(abs(relModeFile), clean ? 'fast\n' : '\n');
200
- return { clean, reasons, paths, probeFile: relProbeFile, modeFile: relModeFile, exitCode: 0 };
201
- };
202
-
203
- let tasks: unknown;
204
- try {
205
- tasks = JSON.parse(readFileSync(abs(relTasksFile), 'utf8'));
206
- } catch {
207
- tasks = undefined;
208
- }
209
- if (!Array.isArray(tasks) || !tasks.every((wbs) => typeof wbs === 'string')) {
210
- process.stderr.write(
211
- 'wrapup-drift-probe: normalized task capture is missing or corrupted — failing safe (dirty)\n',
212
- );
213
- return finish(false, ['normalized task capture missing or corrupted'], []);
214
- }
215
-
216
- const reasons: string[] = [];
217
- const allPaths = new Set<string>();
218
- for (const wbs of tasks as string[]) {
219
- const shown = spur(['task', 'show', wbs, '--json']);
220
- if (shown.status !== 0) {
221
- reasons.push(`${wbs}: task show failed (status=${shown.status})`);
222
- continue;
223
- }
224
- let content: unknown;
225
- try {
226
- content = JSON.parse(shown.stdout).content;
227
- } catch {
228
- content = undefined;
229
- }
230
- if (typeof content !== 'string') {
231
- reasons.push(`${wbs}: task show output unparseable`);
232
- continue;
233
- }
234
- const changedPaths = changedPathsOf(solutionSectionOf(content));
235
- if (changedPaths.length === 0) {
236
- reasons.push(`${wbs}: Solution empty or unparseable`);
237
- continue;
238
- }
239
- for (const path of changedPaths) {
240
- if (CORPUS_PREFIXES.some((prefix) => path.startsWith(prefix))) continue;
241
- allPaths.add(path);
242
- const drift = driftReasonForPath(path);
243
- if (drift) reasons.push(`${wbs}: ${path} ${drift}`);
244
- }
245
- }
246
- return finish(reasons.length === 0, reasons, [...allPaths].sort());
247
- }
248
-
249
- export const WRAPUP_DRIFT_PROBE_USAGE = 'usage: wrapup-drift-probe (env: __runId, spurBin)';
250
-
251
- export function main(argv: string[], env: DriftProbeEnv = getEnvVars(), options: DriftProbeOptions = {}): number {
252
- if (argv.length > 0) {
253
- process.stderr.write(`${WRAPUP_DRIFT_PROBE_USAGE}\n`);
254
- return 2;
255
- }
256
- return runDriftProbe(env, options).exitCode;
257
- }
258
-
259
- if (import.meta.main) {
260
- process.exit(main(process.argv.slice(2)));
261
- }