plumbbob 0.9.3 → 0.9.5
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.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +15 -13
- package/dist/cli-core.js +19 -2
- package/dist/lib/check.js +46 -13
- package/dist/lib/intent.js +1 -1
- package/dist/lib/latch.js +3 -3
- package/dist/lib/reentry.js +70 -0
- package/dist/verbs/agent.js +2 -2
- package/dist/verbs/doctor.js +4 -4
- package/dist/verbs/finish.js +1 -1
- package/dist/verbs/recover.js +297 -0
- package/dist/verbs/revert.js +2 -2
- package/dist/verbs/spike.js +8 -2
- package/hooks/post-edit.sh +4 -4
- package/hooks/pre-bash-commit.sh +3 -3
- package/node_modules/checkride/.claude-plugin/plugin.json +11 -0
- package/node_modules/checkride/CHANGELOG.md +1003 -0
- package/node_modules/checkride/LICENSE +201 -21
- package/node_modules/checkride/README.md +171 -30
- package/node_modules/checkride/dist/__tests__/fixtures/released-stanzas.d.ts +15 -0
- package/node_modules/checkride/dist/__tests__/fixtures/released-stanzas.d.ts.map +1 -0
- package/node_modules/checkride/dist/__tests__/fixtures/released-stanzas.js +17 -0
- package/node_modules/checkride/dist/__tests__/fixtures/released-stanzas.js.map +1 -0
- package/node_modules/checkride/dist/adapters.d.ts +18 -6
- package/node_modules/checkride/dist/adapters.d.ts.map +1 -1
- package/node_modules/checkride/dist/adapters.js +42 -23
- package/node_modules/checkride/dist/adapters.js.map +1 -1
- package/node_modules/checkride/dist/agent-setup/claude.d.ts +88 -0
- package/node_modules/checkride/dist/agent-setup/claude.d.ts.map +1 -0
- package/node_modules/checkride/dist/agent-setup/claude.js +305 -0
- package/node_modules/checkride/dist/agent-setup/claude.js.map +1 -0
- package/node_modules/checkride/dist/agent-setup/command.d.ts +43 -0
- package/node_modules/checkride/dist/agent-setup/command.d.ts.map +1 -0
- package/node_modules/checkride/dist/agent-setup/command.js +77 -0
- package/node_modules/checkride/dist/agent-setup/command.js.map +1 -0
- package/node_modules/checkride/dist/agent-setup/cursor.d.ts +61 -0
- package/node_modules/checkride/dist/agent-setup/cursor.d.ts.map +1 -0
- package/node_modules/checkride/dist/agent-setup/cursor.js +189 -0
- package/node_modules/checkride/dist/agent-setup/cursor.js.map +1 -0
- package/node_modules/checkride/dist/agent-setup/files.d.ts +50 -0
- package/node_modules/checkride/dist/agent-setup/files.d.ts.map +1 -0
- package/node_modules/checkride/dist/agent-setup/files.js +80 -0
- package/node_modules/checkride/dist/agent-setup/files.js.map +1 -0
- package/node_modules/checkride/dist/agent-setup/harness.d.ts +101 -0
- package/node_modules/checkride/dist/agent-setup/harness.d.ts.map +1 -0
- package/node_modules/checkride/dist/agent-setup/harness.js +84 -0
- package/node_modules/checkride/dist/agent-setup/harness.js.map +1 -0
- package/node_modules/checkride/dist/agent-setup/hook.d.ts +45 -52
- package/node_modules/checkride/dist/agent-setup/hook.d.ts.map +1 -1
- package/node_modules/checkride/dist/agent-setup/hook.js +64 -95
- package/node_modules/checkride/dist/agent-setup/hook.js.map +1 -1
- package/node_modules/checkride/dist/agent-setup/index.d.ts +10 -4
- package/node_modules/checkride/dist/agent-setup/index.d.ts.map +1 -1
- package/node_modules/checkride/dist/agent-setup/index.js +9 -4
- package/node_modules/checkride/dist/agent-setup/index.js.map +1 -1
- package/node_modules/checkride/dist/agent-setup/scripts.d.ts +58 -0
- package/node_modules/checkride/dist/agent-setup/scripts.d.ts.map +1 -0
- package/node_modules/checkride/dist/agent-setup/scripts.js +299 -0
- package/node_modules/checkride/dist/agent-setup/scripts.js.map +1 -0
- package/node_modules/checkride/dist/agent-setup/skills.d.ts +31 -0
- package/node_modules/checkride/dist/agent-setup/skills.d.ts.map +1 -0
- package/node_modules/checkride/dist/agent-setup/skills.js +56 -0
- package/node_modules/checkride/dist/agent-setup/skills.js.map +1 -0
- package/node_modules/checkride/dist/artifacts/configured.d.ts +30 -0
- package/node_modules/checkride/dist/artifacts/configured.d.ts.map +1 -0
- package/node_modules/checkride/dist/artifacts/configured.js +45 -0
- package/node_modules/checkride/dist/artifacts/configured.js.map +1 -0
- package/node_modules/checkride/dist/artifacts/format.d.ts +33 -0
- package/node_modules/checkride/dist/artifacts/format.d.ts.map +1 -0
- package/node_modules/checkride/dist/artifacts/format.js +56 -0
- package/node_modules/checkride/dist/artifacts/format.js.map +1 -0
- package/node_modules/checkride/dist/artifacts/freshness.d.ts +32 -0
- package/node_modules/checkride/dist/artifacts/freshness.d.ts.map +1 -0
- package/node_modules/checkride/dist/artifacts/freshness.js +37 -0
- package/node_modules/checkride/dist/artifacts/freshness.js.map +1 -0
- package/node_modules/checkride/dist/artifacts/index.d.ts +22 -0
- package/node_modules/checkride/dist/artifacts/index.d.ts.map +1 -0
- package/node_modules/checkride/dist/artifacts/index.js +19 -0
- package/node_modules/checkride/dist/artifacts/index.js.map +1 -0
- package/node_modules/checkride/dist/artifacts/json.d.ts +31 -0
- package/node_modules/checkride/dist/artifacts/json.d.ts.map +1 -0
- package/node_modules/checkride/dist/artifacts/json.js +47 -0
- package/node_modules/checkride/dist/artifacts/json.js.map +1 -0
- package/node_modules/checkride/dist/artifacts/raw.d.ts +60 -0
- package/node_modules/checkride/dist/artifacts/raw.d.ts.map +1 -0
- package/node_modules/checkride/dist/artifacts/raw.js +91 -0
- package/node_modules/checkride/dist/artifacts/raw.js.map +1 -0
- package/node_modules/checkride/dist/artifacts/summary.d.ts +69 -0
- package/node_modules/checkride/dist/artifacts/summary.d.ts.map +1 -0
- package/node_modules/checkride/dist/artifacts/summary.js +108 -0
- package/node_modules/checkride/dist/artifacts/summary.js.map +1 -0
- package/node_modules/checkride/dist/atomic.d.ts +16 -1
- package/node_modules/checkride/dist/atomic.d.ts.map +1 -1
- package/node_modules/checkride/dist/atomic.js +25 -3
- package/node_modules/checkride/dist/atomic.js.map +1 -1
- package/node_modules/checkride/dist/baseline/fallow.d.ts +9 -5
- package/node_modules/checkride/dist/baseline/fallow.d.ts.map +1 -1
- package/node_modules/checkride/dist/baseline/fallow.js +161 -58
- package/node_modules/checkride/dist/baseline/fallow.js.map +1 -1
- package/node_modules/checkride/dist/baseline/fingerprint.d.ts +7 -7
- package/node_modules/checkride/dist/baseline/fingerprint.d.ts.map +1 -1
- package/node_modules/checkride/dist/baseline/fingerprint.js +16 -19
- package/node_modules/checkride/dist/baseline/fingerprint.js.map +1 -1
- package/node_modules/checkride/dist/baseline/index.d.ts +4 -4
- package/node_modules/checkride/dist/baseline/index.d.ts.map +1 -1
- package/node_modules/checkride/dist/baseline/index.js +4 -4
- package/node_modules/checkride/dist/baseline/index.js.map +1 -1
- package/node_modules/checkride/dist/baseline/store.d.ts +12 -4
- package/node_modules/checkride/dist/baseline/store.d.ts.map +1 -1
- package/node_modules/checkride/dist/baseline/store.js +16 -9
- package/node_modules/checkride/dist/baseline/store.js.map +1 -1
- package/node_modules/checkride/dist/baseline-command.d.ts +5 -5
- package/node_modules/checkride/dist/baseline-command.js +7 -7
- package/node_modules/checkride/dist/baseline-command.js.map +1 -1
- package/node_modules/checkride/dist/cli.d.ts +17 -4
- package/node_modules/checkride/dist/cli.d.ts.map +1 -1
- package/node_modules/checkride/dist/cli.js +259 -18
- package/node_modules/checkride/dist/cli.js.map +1 -1
- package/node_modules/checkride/dist/config.d.ts +84 -8
- package/node_modules/checkride/dist/config.d.ts.map +1 -1
- package/node_modules/checkride/dist/config.js +122 -18
- package/node_modules/checkride/dist/config.js.map +1 -1
- package/node_modules/checkride/dist/digest/digest.d.ts +5 -5
- package/node_modules/checkride/dist/digest/digest.js +5 -5
- package/node_modules/checkride/dist/digest/index.d.ts +2 -2
- package/node_modules/checkride/dist/digest/index.js +2 -2
- package/node_modules/checkride/dist/doctor.d.ts +25 -6
- package/node_modules/checkride/dist/doctor.d.ts.map +1 -1
- package/node_modules/checkride/dist/doctor.js +193 -27
- package/node_modules/checkride/dist/doctor.js.map +1 -1
- package/node_modules/checkride/dist/gate.d.ts +135 -0
- package/node_modules/checkride/dist/gate.d.ts.map +1 -0
- package/node_modules/checkride/dist/gate.js +490 -0
- package/node_modules/checkride/dist/gate.js.map +1 -0
- package/node_modules/checkride/dist/init.d.ts +72 -12
- package/node_modules/checkride/dist/init.d.ts.map +1 -1
- package/node_modules/checkride/dist/init.js +324 -81
- package/node_modules/checkride/dist/init.js.map +1 -1
- package/node_modules/checkride/dist/json.d.ts +21 -0
- package/node_modules/checkride/dist/json.d.ts.map +1 -0
- package/node_modules/checkride/dist/json.js +21 -0
- package/node_modules/checkride/dist/json.js.map +1 -0
- package/node_modules/checkride/dist/links.d.ts +31 -5
- package/node_modules/checkride/dist/links.d.ts.map +1 -1
- package/node_modules/checkride/dist/links.js +141 -32
- package/node_modules/checkride/dist/links.js.map +1 -1
- package/node_modules/checkride/dist/node-pin.d.ts +129 -0
- package/node_modules/checkride/dist/node-pin.d.ts.map +1 -0
- package/node_modules/checkride/dist/node-pin.js +211 -0
- package/node_modules/checkride/dist/node-pin.js.map +1 -0
- package/node_modules/checkride/dist/orchestrator.d.ts +40 -10
- package/node_modules/checkride/dist/orchestrator.d.ts.map +1 -1
- package/node_modules/checkride/dist/orchestrator.js +196 -102
- package/node_modules/checkride/dist/orchestrator.js.map +1 -1
- package/node_modules/checkride/dist/pack.d.ts +8 -9
- package/node_modules/checkride/dist/pack.d.ts.map +1 -1
- package/node_modules/checkride/dist/pack.js +53 -17
- package/node_modules/checkride/dist/pack.js.map +1 -1
- package/node_modules/checkride/dist/pm/detect.d.ts +6 -1
- package/node_modules/checkride/dist/pm/detect.d.ts.map +1 -1
- package/node_modules/checkride/dist/pm/detect.js +6 -1
- package/node_modules/checkride/dist/pm/detect.js.map +1 -1
- package/node_modules/checkride/dist/pm/index.d.ts +6 -2
- package/node_modules/checkride/dist/pm/index.d.ts.map +1 -1
- package/node_modules/checkride/dist/pm/index.js +6 -2
- package/node_modules/checkride/dist/pm/index.js.map +1 -1
- package/node_modules/checkride/dist/pm/launch.d.ts +51 -0
- package/node_modules/checkride/dist/pm/launch.d.ts.map +1 -0
- package/node_modules/checkride/dist/pm/launch.js +92 -0
- package/node_modules/checkride/dist/pm/launch.js.map +1 -0
- package/node_modules/checkride/dist/pm/tools.d.ts +73 -0
- package/node_modules/checkride/dist/pm/tools.d.ts.map +1 -0
- package/node_modules/checkride/dist/pm/tools.js +124 -0
- package/node_modules/checkride/dist/pm/tools.js.map +1 -0
- package/node_modules/checkride/dist/pm/translate.d.ts +35 -9
- package/node_modules/checkride/dist/pm/translate.d.ts.map +1 -1
- package/node_modules/checkride/dist/pm/translate.js +78 -18
- package/node_modules/checkride/dist/pm/translate.js.map +1 -1
- package/node_modules/checkride/dist/proc.d.ts +30 -0
- package/node_modules/checkride/dist/proc.d.ts.map +1 -0
- package/node_modules/checkride/dist/proc.js +42 -0
- package/node_modules/checkride/dist/proc.js.map +1 -0
- package/node_modules/checkride/dist/qa/cli.d.ts +20 -0
- package/node_modules/checkride/dist/qa/cli.d.ts.map +1 -0
- package/node_modules/checkride/dist/qa/cli.js +24 -0
- package/node_modules/checkride/dist/qa/cli.js.map +1 -0
- package/node_modules/checkride/dist/qa/dead.d.ts +39 -0
- package/node_modules/checkride/dist/qa/dead.d.ts.map +1 -0
- package/node_modules/checkride/dist/qa/dead.js +88 -0
- package/node_modules/checkride/dist/qa/dead.js.map +1 -0
- package/node_modules/checkride/dist/qa/dupes.d.ts +45 -0
- package/node_modules/checkride/dist/qa/dupes.d.ts.map +1 -0
- package/node_modules/checkride/dist/qa/dupes.js +62 -0
- package/node_modules/checkride/dist/qa/dupes.js.map +1 -0
- package/node_modules/checkride/dist/qa/health.d.ts +85 -0
- package/node_modules/checkride/dist/qa/health.d.ts.map +1 -0
- package/node_modules/checkride/dist/qa/health.js +109 -0
- package/node_modules/checkride/dist/qa/health.js.map +1 -0
- package/node_modules/checkride/dist/qa/index.d.ts +23 -0
- package/node_modules/checkride/dist/qa/index.d.ts.map +1 -0
- package/node_modules/checkride/dist/qa/index.js +22 -0
- package/node_modules/checkride/dist/qa/index.js.map +1 -0
- package/node_modules/checkride/dist/qa/mutation.d.ts +80 -0
- package/node_modules/checkride/dist/qa/mutation.d.ts.map +1 -0
- package/node_modules/checkride/dist/qa/mutation.js +195 -0
- package/node_modules/checkride/dist/qa/mutation.js.map +1 -0
- package/node_modules/checkride/dist/qa/qa.d.ts +71 -0
- package/node_modules/checkride/dist/qa/qa.d.ts.map +1 -0
- package/node_modules/checkride/dist/qa/qa.js +158 -0
- package/node_modules/checkride/dist/qa/qa.js.map +1 -0
- package/node_modules/checkride/dist/qa/read.d.ts +40 -0
- package/node_modules/checkride/dist/qa/read.d.ts.map +1 -0
- package/node_modules/checkride/dist/qa/read.js +47 -0
- package/node_modules/checkride/dist/qa/read.js.map +1 -0
- package/node_modules/checkride/dist/qa/render.d.ts +26 -0
- package/node_modules/checkride/dist/qa/render.d.ts.map +1 -0
- package/node_modules/checkride/dist/qa/render.js +310 -0
- package/node_modules/checkride/dist/qa/render.js.map +1 -0
- package/node_modules/checkride/dist/security.d.ts +45 -0
- package/node_modules/checkride/dist/security.d.ts.map +1 -0
- package/node_modules/checkride/dist/security.js +86 -0
- package/node_modules/checkride/dist/security.js.map +1 -0
- package/node_modules/checkride/dist/smoke.d.ts +5 -5
- package/node_modules/checkride/dist/smoke.js +5 -5
- package/node_modules/checkride/dist/snippets.d.ts +26 -29
- package/node_modules/checkride/dist/snippets.d.ts.map +1 -1
- package/node_modules/checkride/dist/snippets.js +26 -30
- package/node_modules/checkride/dist/snippets.js.map +1 -1
- package/node_modules/checkride/dist/tool-json.d.ts +33 -0
- package/node_modules/checkride/dist/tool-json.d.ts.map +1 -0
- package/node_modules/checkride/dist/tool-json.js +58 -0
- package/node_modules/checkride/dist/tool-json.js.map +1 -0
- package/node_modules/checkride/dist/triage/cli.d.ts +21 -0
- package/node_modules/checkride/dist/triage/cli.d.ts.map +1 -0
- package/node_modules/checkride/dist/triage/cli.js +26 -0
- package/node_modules/checkride/dist/triage/cli.js.map +1 -0
- package/node_modules/checkride/dist/triage/doctor-fold.d.ts +51 -0
- package/node_modules/checkride/dist/triage/doctor-fold.d.ts.map +1 -0
- package/node_modules/checkride/dist/triage/doctor-fold.js +88 -0
- package/node_modules/checkride/dist/triage/doctor-fold.js.map +1 -0
- package/node_modules/checkride/dist/triage/env.d.ts +54 -0
- package/node_modules/checkride/dist/triage/env.d.ts.map +1 -0
- package/node_modules/checkride/dist/triage/env.js +81 -0
- package/node_modules/checkride/dist/triage/env.js.map +1 -0
- package/node_modules/checkride/dist/triage/gate.d.ts +61 -0
- package/node_modules/checkride/dist/triage/gate.d.ts.map +1 -0
- package/node_modules/checkride/dist/triage/gate.js +121 -0
- package/node_modules/checkride/dist/triage/gate.js.map +1 -0
- package/node_modules/checkride/dist/triage/index.d.ts +22 -0
- package/node_modules/checkride/dist/triage/index.d.ts.map +1 -0
- package/node_modules/checkride/dist/triage/index.js +20 -0
- package/node_modules/checkride/dist/triage/index.js.map +1 -0
- package/node_modules/checkride/dist/triage/render.d.ts +19 -0
- package/node_modules/checkride/dist/triage/render.d.ts.map +1 -0
- package/node_modules/checkride/dist/triage/render.js +419 -0
- package/node_modules/checkride/dist/triage/render.js.map +1 -0
- package/node_modules/checkride/dist/triage/triage.d.ts +83 -0
- package/node_modules/checkride/dist/triage/triage.d.ts.map +1 -0
- package/node_modules/checkride/dist/triage/triage.js +131 -0
- package/node_modules/checkride/dist/triage/triage.js.map +1 -0
- package/node_modules/checkride/package.json +17 -15
- package/node_modules/checkride/schema/checkride.config.schema.json +62 -5
- package/node_modules/checkride/schema/checkride.summary.schema.json +1 -1
- package/node_modules/checkride/skills/check/SKILL.md +257 -0
- package/node_modules/checkride/skills/qa/SKILL.md +231 -0
- package/node_modules/checkride/templates/shared/cspell.json +1 -0
- package/node_modules/checkride/templates/shared/oxlintrc.json +1 -1
- package/package.json +2 -2
- package/skills/build/SKILL.md +23 -19
- package/skills/finish/SKILL.md +3 -1
- package/skills/harvest/SKILL.md +2 -1
- package/skills/plan/SKILL.md +8 -7
- package/skills/recover/SKILL.md +28 -0
- package/skills/refine/SKILL.md +5 -4
- package/skills/spike/SKILL.md +1 -1
- package/skills/step/SKILL.md +4 -4
- package/skills/verify/SKILL.md +19 -14
- package/templates/intent.md +8 -7
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Built-in `snippets` check.
|
|
3
3
|
*
|
|
4
|
-
* A doc snippet typecheck
|
|
5
|
-
* byte-for-byte so the origin repo can adopt the slot verbatim (D11). It pulls
|
|
4
|
+
* A doc snippet typecheck. It pulls
|
|
6
5
|
* fenced ```ts / ```typescript blocks out of `README.md` and the non-recursive
|
|
7
6
|
* `docs/*.md`, and typechecks only the ones explicitly opted in with an HTML
|
|
8
7
|
* comment on the line immediately above the fence:
|
|
@@ -14,7 +13,7 @@
|
|
|
14
13
|
* A tagged snippet that fails to compile is documentation that lies — this
|
|
15
14
|
* turns that into a build failure. Opting the slot in but tagging *nothing* is
|
|
16
15
|
* a misconfiguration, not a vacuous pass, so zero tagged snippets is a hard
|
|
17
|
-
* error ({@link vacuousOptInError}
|
|
16
|
+
* error ({@link vacuousOptInError}).
|
|
18
17
|
*
|
|
19
18
|
* The pure machinery — no filesystem, no spawning:
|
|
20
19
|
*
|
|
@@ -30,7 +29,7 @@
|
|
|
30
29
|
* fields a `tsc --build` project carries, embeds the caller's mode-specific
|
|
31
30
|
* `paths`).
|
|
32
31
|
*
|
|
33
|
-
* Execution
|
|
32
|
+
* Execution, consuming the primitives above:
|
|
34
33
|
*
|
|
35
34
|
* - {@link deriveSrcPaths} resolves **src mode**'s `paths` mapping: the repo's
|
|
36
35
|
* own tsconfig `paths` when present, else the `src/index.ts` convention,
|
|
@@ -46,17 +45,16 @@ import type { CheckOutcome } from './links.js';
|
|
|
46
45
|
import type { PackageManager } from './pm/index.js';
|
|
47
46
|
/**
|
|
48
47
|
* The opt-in marker: an HTML comment `<!-- snippet: check -->` that must sit on
|
|
49
|
-
* the line immediately above a fence for its snippet to be typechecked.
|
|
50
|
-
* fascicle regex (D11).
|
|
48
|
+
* the line immediately above a fence for its snippet to be typechecked.
|
|
51
49
|
*/
|
|
52
50
|
export declare const CHECK_MARKER_RE: RegExp;
|
|
53
|
-
/** An opening fence — `ts` or `typescript` only, nothing else on the line
|
|
51
|
+
/** An opening fence — `ts` or `typescript` only, nothing else on the line. */
|
|
54
52
|
export declare const FENCE_OPEN_RE: RegExp;
|
|
55
53
|
/** A closing fence: three backticks alone on the line. */
|
|
56
54
|
export declare const FENCE_CLOSE_RE: RegExp;
|
|
57
55
|
/**
|
|
58
56
|
* One `ts`/`typescript` fenced block extracted from a doc. `code` is the fence
|
|
59
|
-
* body verbatim (no trailing newline —
|
|
57
|
+
* body verbatim (no trailing newline — {@link checkSnippets} appends one on write); `startLine`
|
|
60
58
|
* is the 1-based line of the opening fence; `checked` is true when a
|
|
61
59
|
* {@link CHECK_MARKER_RE} marker sits on the immediately-preceding line.
|
|
62
60
|
*/
|
|
@@ -73,7 +71,7 @@ export type DocInput = {
|
|
|
73
71
|
/**
|
|
74
72
|
* One checked snippet in the emission plan: the scratch file to write
|
|
75
73
|
* (`<slug>__<n>.ts`), and the source doc + line it maps back to (the
|
|
76
|
-
* `snippet -> source map:` legend
|
|
74
|
+
* `snippet -> source map:` legend rendered on failure).
|
|
77
75
|
*/
|
|
78
76
|
export type SnippetPlanEntry = {
|
|
79
77
|
name: string;
|
|
@@ -87,7 +85,7 @@ export type SnippetsPlan = {
|
|
|
87
85
|
checked: number;
|
|
88
86
|
skipped: number;
|
|
89
87
|
};
|
|
90
|
-
/** The two modes `snippets` runs in
|
|
88
|
+
/** The two modes `snippets` runs in: fast against `src`, or against built `dist/*.d.ts`. */
|
|
91
89
|
export type SnippetMode = 'src' | 'dist';
|
|
92
90
|
/** The generated tsconfig object (serialized to `.check/doc-snippets/tsconfig.json`). */
|
|
93
91
|
export type SnippetTsconfig = {
|
|
@@ -108,59 +106,58 @@ export type SnippetTsconfig = {
|
|
|
108
106
|
exclude: string[];
|
|
109
107
|
};
|
|
110
108
|
/**
|
|
111
|
-
* Select the doc files to check from a `docs/` directory listing
|
|
109
|
+
* Select the doc files to check from a `docs/` directory listing: always
|
|
112
110
|
* `README.md`, then every non-recursive `docs/*.md` entry, README first and the
|
|
113
111
|
* `docs/` entries in the order given. Pure — the caller does the (non-recursive)
|
|
114
112
|
* `readdir` and passes its entries; a plain entry list means a nested
|
|
115
|
-
* `docs/sub/x.md` never appears (its listing entry `sub` fails `.md`)
|
|
116
|
-
*
|
|
113
|
+
* `docs/sub/x.md` never appears (its listing entry `sub` fails `.md`) —
|
|
114
|
+
* discovery is deliberately non-recursive.
|
|
117
115
|
*/
|
|
118
116
|
export declare function selectDocFiles(docsEntries: readonly string[]): string[];
|
|
119
117
|
/**
|
|
120
|
-
* Parse a doc's markdown into its `ts`/`typescript` fenced blocks
|
|
118
|
+
* Parse a doc's markdown into its `ts`/`typescript` fenced blocks. A block
|
|
121
119
|
* is `checked` when a {@link CHECK_MARKER_RE} marker sits on the line immediately
|
|
122
120
|
* above its opening fence — a marker anywhere else does not count. Untagged
|
|
123
|
-
* blocks are still returned (the caller counts them as skipped).
|
|
124
|
-
* fascicle's `extract_blocks` exactly.
|
|
121
|
+
* blocks are still returned (the caller counts them as skipped).
|
|
125
122
|
*/
|
|
126
123
|
export declare function extractSnippets(text: string): Snippet[];
|
|
127
124
|
/**
|
|
128
125
|
* The scratch-file slug for a doc's repo-relative path: every non-alphanumeric
|
|
129
126
|
* run collapses to a single `_`, with leading/trailing `_` trimmed
|
|
130
|
-
* (`README.md` → `README_md`, `docs/guide.md` → `docs_guide_md`).
|
|
131
|
-
*
|
|
127
|
+
* (`README.md` → `README_md`, `docs/guide.md` → `docs_guide_md`).
|
|
128
|
+
* Distinct docs in the discovered namespace (`README.md` plus the
|
|
132
129
|
* flat `docs/*.md`) map to distinct slugs, so their emitted files never collide.
|
|
133
130
|
*/
|
|
134
131
|
export declare function slugForDoc(relPath: string): string;
|
|
135
132
|
/**
|
|
136
133
|
* The scratch-file name for a block: `<slug>__<n>.ts`, where `n` is the block's
|
|
137
134
|
* 1-based position among *all* ts/typescript fences in its doc (checked or not) —
|
|
138
|
-
* so a skipped fence still advances the number
|
|
135
|
+
* so a skipped fence still advances the number.
|
|
139
136
|
*/
|
|
140
137
|
export declare function snippetFileName(relPath: string, blockIndex: number): string;
|
|
141
138
|
/**
|
|
142
139
|
* Fold a set of docs into the emission plan: every checked block becomes a
|
|
143
140
|
* {@link SnippetPlanEntry} (named, mapped back to `<doc>:<line>`), untagged
|
|
144
141
|
* blocks bump `skipped`. The block index for naming counts all fences in a doc,
|
|
145
|
-
* so a checked block keeps its position even after skipped ones
|
|
146
|
-
*
|
|
142
|
+
* so a checked block keeps its position even after skipped ones. Pure — the
|
|
143
|
+
* caller reads the docs and writes the files.
|
|
147
144
|
*/
|
|
148
145
|
export declare function planSnippets(docs: readonly DocInput[]): SnippetsPlan;
|
|
149
146
|
/**
|
|
150
|
-
* The vacuous-opt-in guard
|
|
147
|
+
* The vacuous-opt-in guard: a plan with no checked snippets is a hard
|
|
151
148
|
* error, not a vacuous green — opting the slot in obligates at least one tagged
|
|
152
|
-
* fence. Returns the error message for
|
|
149
|
+
* fence. Returns the error message for {@link checkSnippets} to surface, or
|
|
153
150
|
* null when the plan has something to check.
|
|
154
151
|
*/
|
|
155
152
|
export declare function vacuousOptInError(plan: SnippetsPlan): string | null;
|
|
156
153
|
/**
|
|
157
|
-
* Build the generated tsconfig
|
|
154
|
+
* Build the generated tsconfig: extend the repo's own config so the
|
|
158
155
|
* snippets inherit its strictness, then relax exactly the three flags that
|
|
159
156
|
* false-positive on illustrative snippets (`verbatimModuleSyntax`,
|
|
160
157
|
* `isolatedModules`, `noPropertyAccessFromIndexSignature`) while keeping the
|
|
161
158
|
* type-correctness flags that catch real API drift. `include` clears the parent's
|
|
162
159
|
* `.check` exclusion so the emitted `./*.ts` are seen; `paths` is the caller's
|
|
163
|
-
* mode-specific module resolution (src vs dist
|
|
160
|
+
* mode-specific module resolution (src vs dist).
|
|
164
161
|
*
|
|
165
162
|
* A `tsc --build` project (composite, `rootDir`/`outDir` pinned to `src`/`dist`
|
|
166
163
|
* for project-reference emit) fails TS6059 on any *source* file outside its
|
|
@@ -181,7 +178,7 @@ export declare function generateSnippetTsconfig(opts: {
|
|
|
181
178
|
export type SnippetSpawn = (command: string, args: string[], cwd: string, timeoutSec?: number) => Promise<CheckOutcome>;
|
|
182
179
|
/**
|
|
183
180
|
* Derive the `paths` mapping **src mode** needs so `import { x } from
|
|
184
|
-
* '<pkg-name>'` resolves against source
|
|
181
|
+
* '<pkg-name>'` resolves against source: the repo's own tsconfig `paths`
|
|
185
182
|
* when present (remapped two directories deeper, to where the generated
|
|
186
183
|
* tsconfig lives), else the `src/index.ts` convention (`<pkg-name>` maps to its
|
|
187
184
|
* root `src/index.ts`) when the manifest names the package and that file
|
|
@@ -195,15 +192,15 @@ export declare function deriveSrcPaths(opts: {
|
|
|
195
192
|
hasSrcIndex: boolean;
|
|
196
193
|
}): Record<string, string[]> | null;
|
|
197
194
|
/**
|
|
198
|
-
* Run the `snippets` check against `cwd` in `mode` (
|
|
199
|
-
*
|
|
195
|
+
* Run the `snippets` check against `cwd` in `mode` (the `snippets` adapter
|
|
196
|
+
* passes `'src'`, `snippets-dist` passes `'dist'`). Discovers the doc
|
|
200
197
|
* set, plans the checked snippets ({@link vacuousOptInError} applies first —
|
|
201
198
|
* zero tagged snippets is a hard error before anything is written), derives
|
|
202
199
|
* the mode's `paths` mapping, emits the scratch files plus a generated
|
|
203
200
|
* tsconfig under `.check/doc-snippets/`, and typechecks them through the
|
|
204
201
|
* injected `spawn`. A compile failure's `stderr` carries tsc's raw output plus
|
|
205
202
|
* the `snippet -> source map:` legend mapping each generated file back to
|
|
206
|
-
* `<doc>:<line
|
|
203
|
+
* `<doc>:<line>`.
|
|
207
204
|
*/
|
|
208
205
|
export declare function checkSnippets(opts: {
|
|
209
206
|
cwd: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippets.d.ts","sourceRoot":"","sources":["../src/snippets.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"snippets.d.ts","sourceRoot":"","sources":["../src/snippets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAkC,CAAC;AAE/D,8EAA8E;AAC9E,eAAO,MAAM,aAAa,QAA4B,CAAC;AAEvD,0DAA0D;AAC1D,eAAO,MAAM,cAAc,QAAa,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,4FAA4F;AAC5F,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,CAAC;AAEzC,yFAAyF;AACzF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE;QACf,KAAK,EAAE,MA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AM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,MAAM,KAChB,OAAO,CAAC,YAAY,CAAC,CAAC;AAwE3B;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACxD,WAAW,EAAE,OAAO,CAAC;CACtB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAYlC;AAuBD;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC;IAClB,EAAE,EAAE,cAAc,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,YAAY,CAAC,CAqDxB"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Built-in `snippets` check.
|
|
3
3
|
*
|
|
4
|
-
* A doc snippet typecheck
|
|
5
|
-
* byte-for-byte so the origin repo can adopt the slot verbatim (D11). It pulls
|
|
4
|
+
* A doc snippet typecheck. It pulls
|
|
6
5
|
* fenced ```ts / ```typescript blocks out of `README.md` and the non-recursive
|
|
7
6
|
* `docs/*.md`, and typechecks only the ones explicitly opted in with an HTML
|
|
8
7
|
* comment on the line immediately above the fence:
|
|
@@ -14,7 +13,7 @@
|
|
|
14
13
|
* A tagged snippet that fails to compile is documentation that lies — this
|
|
15
14
|
* turns that into a build failure. Opting the slot in but tagging *nothing* is
|
|
16
15
|
* a misconfiguration, not a vacuous pass, so zero tagged snippets is a hard
|
|
17
|
-
* error ({@link vacuousOptInError}
|
|
16
|
+
* error ({@link vacuousOptInError}).
|
|
18
17
|
*
|
|
19
18
|
* The pure machinery — no filesystem, no spawning:
|
|
20
19
|
*
|
|
@@ -30,7 +29,7 @@
|
|
|
30
29
|
* fields a `tsc --build` project carries, embeds the caller's mode-specific
|
|
31
30
|
* `paths`).
|
|
32
31
|
*
|
|
33
|
-
* Execution
|
|
32
|
+
* Execution, consuming the primitives above:
|
|
34
33
|
*
|
|
35
34
|
* - {@link deriveSrcPaths} resolves **src mode**'s `paths` mapping: the repo's
|
|
36
35
|
* own tsconfig `paths` when present, else the `src/index.ts` convention,
|
|
@@ -48,21 +47,20 @@ import { join } from 'node:path';
|
|
|
48
47
|
import { translateExec } from './pm/index.js';
|
|
49
48
|
/**
|
|
50
49
|
* The opt-in marker: an HTML comment `<!-- snippet: check -->` that must sit on
|
|
51
|
-
* the line immediately above a fence for its snippet to be typechecked.
|
|
52
|
-
* fascicle regex (D11).
|
|
50
|
+
* the line immediately above a fence for its snippet to be typechecked.
|
|
53
51
|
*/
|
|
54
52
|
export const CHECK_MARKER_RE = /<!--\s*snippet:\s*check\s*-->/;
|
|
55
|
-
/** An opening fence — `ts` or `typescript` only, nothing else on the line
|
|
53
|
+
/** An opening fence — `ts` or `typescript` only, nothing else on the line. */
|
|
56
54
|
export const FENCE_OPEN_RE = /^```(ts|typescript)\s*$/;
|
|
57
55
|
/** A closing fence: three backticks alone on the line. */
|
|
58
56
|
export const FENCE_CLOSE_RE = /^```\s*$/;
|
|
59
57
|
/**
|
|
60
|
-
* Select the doc files to check from a `docs/` directory listing
|
|
58
|
+
* Select the doc files to check from a `docs/` directory listing: always
|
|
61
59
|
* `README.md`, then every non-recursive `docs/*.md` entry, README first and the
|
|
62
60
|
* `docs/` entries in the order given. Pure — the caller does the (non-recursive)
|
|
63
61
|
* `readdir` and passes its entries; a plain entry list means a nested
|
|
64
|
-
* `docs/sub/x.md` never appears (its listing entry `sub` fails `.md`)
|
|
65
|
-
*
|
|
62
|
+
* `docs/sub/x.md` never appears (its listing entry `sub` fails `.md`) —
|
|
63
|
+
* discovery is deliberately non-recursive.
|
|
66
64
|
*/
|
|
67
65
|
export function selectDocFiles(docsEntries) {
|
|
68
66
|
const files = ['README.md'];
|
|
@@ -73,11 +71,10 @@ export function selectDocFiles(docsEntries) {
|
|
|
73
71
|
return files;
|
|
74
72
|
}
|
|
75
73
|
/**
|
|
76
|
-
* Parse a doc's markdown into its `ts`/`typescript` fenced blocks
|
|
74
|
+
* Parse a doc's markdown into its `ts`/`typescript` fenced blocks. A block
|
|
77
75
|
* is `checked` when a {@link CHECK_MARKER_RE} marker sits on the line immediately
|
|
78
76
|
* above its opening fence — a marker anywhere else does not count. Untagged
|
|
79
|
-
* blocks are still returned (the caller counts them as skipped).
|
|
80
|
-
* fascicle's `extract_blocks` exactly.
|
|
77
|
+
* blocks are still returned (the caller counts them as skipped).
|
|
81
78
|
*/
|
|
82
79
|
export function extractSnippets(text) {
|
|
83
80
|
const lines = text.split('\n');
|
|
@@ -102,8 +99,8 @@ export function extractSnippets(text) {
|
|
|
102
99
|
/**
|
|
103
100
|
* The scratch-file slug for a doc's repo-relative path: every non-alphanumeric
|
|
104
101
|
* run collapses to a single `_`, with leading/trailing `_` trimmed
|
|
105
|
-
* (`README.md` → `README_md`, `docs/guide.md` → `docs_guide_md`).
|
|
106
|
-
*
|
|
102
|
+
* (`README.md` → `README_md`, `docs/guide.md` → `docs_guide_md`).
|
|
103
|
+
* Distinct docs in the discovered namespace (`README.md` plus the
|
|
107
104
|
* flat `docs/*.md`) map to distinct slugs, so their emitted files never collide.
|
|
108
105
|
*/
|
|
109
106
|
export function slugForDoc(relPath) {
|
|
@@ -112,7 +109,7 @@ export function slugForDoc(relPath) {
|
|
|
112
109
|
/**
|
|
113
110
|
* The scratch-file name for a block: `<slug>__<n>.ts`, where `n` is the block's
|
|
114
111
|
* 1-based position among *all* ts/typescript fences in its doc (checked or not) —
|
|
115
|
-
* so a skipped fence still advances the number
|
|
112
|
+
* so a skipped fence still advances the number.
|
|
116
113
|
*/
|
|
117
114
|
export function snippetFileName(relPath, blockIndex) {
|
|
118
115
|
return `${slugForDoc(relPath)}__${blockIndex}.ts`;
|
|
@@ -121,8 +118,8 @@ export function snippetFileName(relPath, blockIndex) {
|
|
|
121
118
|
* Fold a set of docs into the emission plan: every checked block becomes a
|
|
122
119
|
* {@link SnippetPlanEntry} (named, mapped back to `<doc>:<line>`), untagged
|
|
123
120
|
* blocks bump `skipped`. The block index for naming counts all fences in a doc,
|
|
124
|
-
* so a checked block keeps its position even after skipped ones
|
|
125
|
-
*
|
|
121
|
+
* so a checked block keeps its position even after skipped ones. Pure — the
|
|
122
|
+
* caller reads the docs and writes the files.
|
|
126
123
|
*/
|
|
127
124
|
export function planSnippets(docs) {
|
|
128
125
|
const entries = [];
|
|
@@ -146,9 +143,9 @@ export function planSnippets(docs) {
|
|
|
146
143
|
return { entries, checked, skipped };
|
|
147
144
|
}
|
|
148
145
|
/**
|
|
149
|
-
* The vacuous-opt-in guard
|
|
146
|
+
* The vacuous-opt-in guard: a plan with no checked snippets is a hard
|
|
150
147
|
* error, not a vacuous green — opting the slot in obligates at least one tagged
|
|
151
|
-
* fence. Returns the error message for
|
|
148
|
+
* fence. Returns the error message for {@link checkSnippets} to surface, or
|
|
152
149
|
* null when the plan has something to check.
|
|
153
150
|
*/
|
|
154
151
|
export function vacuousOptInError(plan) {
|
|
@@ -157,13 +154,13 @@ export function vacuousOptInError(plan) {
|
|
|
157
154
|
return 'no tagged snippets found — refusing to pass vacuously (add a `<!-- snippet: check -->` marker above a ts/typescript fence)';
|
|
158
155
|
}
|
|
159
156
|
/**
|
|
160
|
-
* Build the generated tsconfig
|
|
157
|
+
* Build the generated tsconfig: extend the repo's own config so the
|
|
161
158
|
* snippets inherit its strictness, then relax exactly the three flags that
|
|
162
159
|
* false-positive on illustrative snippets (`verbatimModuleSyntax`,
|
|
163
160
|
* `isolatedModules`, `noPropertyAccessFromIndexSignature`) while keeping the
|
|
164
161
|
* type-correctness flags that catch real API drift. `include` clears the parent's
|
|
165
162
|
* `.check` exclusion so the emitted `./*.ts` are seen; `paths` is the caller's
|
|
166
|
-
* mode-specific module resolution (src vs dist
|
|
163
|
+
* mode-specific module resolution (src vs dist).
|
|
167
164
|
*
|
|
168
165
|
* A `tsc --build` project (composite, `rootDir`/`outDir` pinned to `src`/`dist`
|
|
169
166
|
* for project-reference emit) fails TS6059 on any *source* file outside its
|
|
@@ -201,7 +198,7 @@ function isRecord(value) {
|
|
|
201
198
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
202
199
|
}
|
|
203
200
|
/**
|
|
204
|
-
* Read the doc set
|
|
201
|
+
* Read the doc set: `README.md` plus non-recursive `docs/*.md`, skipping
|
|
205
202
|
* any that don't exist — a repo with no `docs/` directory (or no `README.md`)
|
|
206
203
|
* still runs on what it has; an empty result is caught by
|
|
207
204
|
* {@link vacuousOptInError}.
|
|
@@ -237,9 +234,8 @@ async function readManifestName(cwd) {
|
|
|
237
234
|
}
|
|
238
235
|
/**
|
|
239
236
|
* The repo's own `tsconfig.json`'s **own** `compilerOptions.paths` (not resolved
|
|
240
|
-
* through its `extends` chain —
|
|
241
|
-
*
|
|
242
|
-
* absent, unreadable, or empty.
|
|
237
|
+
* through its `extends` chain — self-referencing paths are expected directly on
|
|
238
|
+
* the root file), or null when absent, unreadable, or empty.
|
|
243
239
|
*/
|
|
244
240
|
async function readOwnTsconfigPaths(cwd) {
|
|
245
241
|
try {
|
|
@@ -266,7 +262,7 @@ function remapRootRelative(target) {
|
|
|
266
262
|
}
|
|
267
263
|
/**
|
|
268
264
|
* Derive the `paths` mapping **src mode** needs so `import { x } from
|
|
269
|
-
* '<pkg-name>'` resolves against source
|
|
265
|
+
* '<pkg-name>'` resolves against source: the repo's own tsconfig `paths`
|
|
270
266
|
* when present (remapped two directories deeper, to where the generated
|
|
271
267
|
* tsconfig lives), else the `src/index.ts` convention (`<pkg-name>` maps to its
|
|
272
268
|
* root `src/index.ts`) when the manifest names the package and that file
|
|
@@ -301,15 +297,15 @@ function runTsc(cwd, tsconfigRelPath, pm, spawn, timeoutSec) {
|
|
|
301
297
|
return spawn(command, args, cwd, timeoutSec);
|
|
302
298
|
}
|
|
303
299
|
/**
|
|
304
|
-
* Run the `snippets` check against `cwd` in `mode` (
|
|
305
|
-
*
|
|
300
|
+
* Run the `snippets` check against `cwd` in `mode` (the `snippets` adapter
|
|
301
|
+
* passes `'src'`, `snippets-dist` passes `'dist'`). Discovers the doc
|
|
306
302
|
* set, plans the checked snippets ({@link vacuousOptInError} applies first —
|
|
307
303
|
* zero tagged snippets is a hard error before anything is written), derives
|
|
308
304
|
* the mode's `paths` mapping, emits the scratch files plus a generated
|
|
309
305
|
* tsconfig under `.check/doc-snippets/`, and typechecks them through the
|
|
310
306
|
* injected `spawn`. A compile failure's `stderr` carries tsc's raw output plus
|
|
311
307
|
* the `snippet -> source map:` legend mapping each generated file back to
|
|
312
|
-
* `<doc>:<line
|
|
308
|
+
* `<doc>:<line>`.
|
|
313
309
|
*/
|
|
314
310
|
export async function checkSnippets(opts) {
|
|
315
311
|
const { cwd, mode, pm, spawn, timeoutSec } = opts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippets.js","sourceRoot":"","sources":["../src/snippets.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"snippets.js","sourceRoot":"","sources":["../src/snippets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,+BAA+B,CAAC;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AAO,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;IAC9D,OAAO;QACL,EAAE,EAAE,KAAK;QACT,SAAS,EAAE,CAAC;QACZ,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI;QAChE,MAAM,EAAE,oDAAoD,SAAS,+BAA+B,MAAM,IAAI;KAC/G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tolerant parsing of a tool's stdout as JSON.
|
|
3
|
+
*
|
|
4
|
+
* A tool that emits JSON does not always get stdout to itself: any launcher,
|
|
5
|
+
* wrapper or shell profile can print before it does. checkride suppresses the
|
|
6
|
+
* one case it controls at the invocation (pnpm's dependency-check narration —
|
|
7
|
+
* see `translateExec` and `docs/tools.md` §Launcher quirks), but a consumer's
|
|
8
|
+
* launcher is not checkride's to pin, so the read tolerates a preamble too.
|
|
9
|
+
*
|
|
10
|
+
* **Skipping a preamble is not normalizing.** The tool's own bytes are returned
|
|
11
|
+
* verbatim from the first character of the JSON onward — nothing inside them is
|
|
12
|
+
* rewritten, reordered or reformatted, and what gets dropped was never the
|
|
13
|
+
* tool's output to begin with. That is what keeps this compatible with "the raw
|
|
14
|
+
* file is the truth" (`docs/contract.md`), which is a promise, not a detail.
|
|
15
|
+
*/
|
|
16
|
+
/** A tool's stdout parsed as JSON: the value, and the exact text it came from. */
|
|
17
|
+
export type ToolJson = {
|
|
18
|
+
/** The parsed value. */
|
|
19
|
+
value: unknown;
|
|
20
|
+
/**
|
|
21
|
+
* The JSON text with any preamble removed — what belongs in
|
|
22
|
+
* `.check/<slot>.json`, so the artifact a consumer opens actually parses.
|
|
23
|
+
*/
|
|
24
|
+
text: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Parse `raw` as JSON, tolerating up to {@link MAX_PREAMBLE_LINES} lines of
|
|
28
|
+
* non-JSON ahead of it. Clean output takes the fast path and is returned byte
|
|
29
|
+
* for byte. Returns `null` when nothing parses — every caller treats that as a
|
|
30
|
+
* loud failure, never as "clean".
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseToolJson(raw: string): ToolJson | null;
|
|
33
|
+
//# sourceMappingURL=tool-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-json.d.ts","sourceRoot":"","sources":["../src/tool-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH,kFAAkF;AAClF,MAAM,MAAM,QAAQ,GAAG;IACrB,wBAAwB;IACxB,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAYF;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAgB1D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tolerant parsing of a tool's stdout as JSON.
|
|
3
|
+
*
|
|
4
|
+
* A tool that emits JSON does not always get stdout to itself: any launcher,
|
|
5
|
+
* wrapper or shell profile can print before it does. checkride suppresses the
|
|
6
|
+
* one case it controls at the invocation (pnpm's dependency-check narration —
|
|
7
|
+
* see `translateExec` and `docs/tools.md` §Launcher quirks), but a consumer's
|
|
8
|
+
* launcher is not checkride's to pin, so the read tolerates a preamble too.
|
|
9
|
+
*
|
|
10
|
+
* **Skipping a preamble is not normalizing.** The tool's own bytes are returned
|
|
11
|
+
* verbatim from the first character of the JSON onward — nothing inside them is
|
|
12
|
+
* rewritten, reordered or reformatted, and what gets dropped was never the
|
|
13
|
+
* tool's output to begin with. That is what keeps this compatible with "the raw
|
|
14
|
+
* file is the truth" (`docs/contract.md`), which is a promise, not a detail.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* How many leading lines may precede the JSON before parsing gives up. Real
|
|
18
|
+
* preambles are one or two lines; the cap keeps a large non-JSON payload (a 650
|
|
19
|
+
* kB test log, say) from costing one parse attempt per line.
|
|
20
|
+
*/
|
|
21
|
+
const MAX_PREAMBLE_LINES = 10;
|
|
22
|
+
/** Parse `text` as JSON, or `undefined` when it is not JSON at all. */
|
|
23
|
+
function tryParse(text) {
|
|
24
|
+
if (text.trim() === '')
|
|
25
|
+
return undefined;
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(text);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Parse `raw` as JSON, tolerating up to {@link MAX_PREAMBLE_LINES} lines of
|
|
35
|
+
* non-JSON ahead of it. Clean output takes the fast path and is returned byte
|
|
36
|
+
* for byte. Returns `null` when nothing parses — every caller treats that as a
|
|
37
|
+
* loud failure, never as "clean".
|
|
38
|
+
*/
|
|
39
|
+
export function parseToolJson(raw) {
|
|
40
|
+
const whole = tryParse(raw);
|
|
41
|
+
if (whole !== undefined)
|
|
42
|
+
return { value: whole, text: raw };
|
|
43
|
+
// Retry from each subsequent line start. The tool's JSON begins at a line
|
|
44
|
+
// boundary because the preamble that precedes it ended with a newline.
|
|
45
|
+
let offset = 0;
|
|
46
|
+
for (let line = 0; line < MAX_PREAMBLE_LINES; line++) {
|
|
47
|
+
const newline = raw.indexOf('\n', offset);
|
|
48
|
+
if (newline === -1)
|
|
49
|
+
break;
|
|
50
|
+
offset = newline + 1;
|
|
51
|
+
const rest = raw.slice(offset);
|
|
52
|
+
const value = tryParse(rest);
|
|
53
|
+
if (value !== undefined)
|
|
54
|
+
return { value, text: rest };
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=tool-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-json.js","sourceRoot":"","sources":["../src/tool-json.ts"],"names":[],"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
+
* Executable form of the triage reader — what the bundled `/checkride:check`
|
|
4
|
+
* skill invokes:
|
|
5
|
+
*
|
|
6
|
+
* ```
|
|
7
|
+
* node <plugin-root>/dist/triage/cli.js [cwd]
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* It ships in the package's existing `dist/`, so both the published tarball and
|
|
11
|
+
* an installed plugin cache already carry it and no consumer build step exists.
|
|
12
|
+
* It adds no CLI command, flag or config to checkride itself: `dist/cli.js`
|
|
13
|
+
* knows nothing about this file.
|
|
14
|
+
*
|
|
15
|
+
* Exit code 0 means *a report was rendered*, however the gate came back — the
|
|
16
|
+
* gate's verdict is in the Markdown, not in this process's status, so a red repo
|
|
17
|
+
* does not look to the caller like a broken reader. Only a failure to produce a
|
|
18
|
+
* report at all exits non-zero.
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/triage/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Executable form of the triage reader — what the bundled `/checkride:check`
|
|
4
|
+
* skill invokes:
|
|
5
|
+
*
|
|
6
|
+
* ```
|
|
7
|
+
* node <plugin-root>/dist/triage/cli.js [cwd]
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* It ships in the package's existing `dist/`, so both the published tarball and
|
|
11
|
+
* an installed plugin cache already carry it and no consumer build step exists.
|
|
12
|
+
* It adds no CLI command, flag or config to checkride itself: `dist/cli.js`
|
|
13
|
+
* knows nothing about this file.
|
|
14
|
+
*
|
|
15
|
+
* Exit code 0 means *a report was rendered*, however the gate came back — the
|
|
16
|
+
* gate's verdict is in the Markdown, not in this process's status, so a red repo
|
|
17
|
+
* does not look to the caller like a broken reader. Only a failure to produce a
|
|
18
|
+
* report at all exits non-zero.
|
|
19
|
+
*/
|
|
20
|
+
import { realEnv } from './env.js';
|
|
21
|
+
import { renderTriage } from './render.js';
|
|
22
|
+
import { triage } from './triage.js';
|
|
23
|
+
const [, , cwdArg] = process.argv;
|
|
24
|
+
const report = await triage(cwdArg ?? process.cwd(), realEnv);
|
|
25
|
+
process.stdout.write(`${renderTriage(report)}\n`);
|
|
26
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/triage/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,EAAE,AAAD,EAAG,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;AAClC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Folding `checkride doctor` into the broken-harness branch.
|
|
3
|
+
*
|
|
4
|
+
* Exit 2 means the harness broke or was misused, and every check result from
|
|
5
|
+
* that run is untrustworthy. "Broken harness" on its own costs a round-trip:
|
|
6
|
+
* the agent has to go ask what broke. `doctor` already answers that — it is
|
|
7
|
+
* read-only, runs no checks, and splits 0/1 the same way — so triage runs it at
|
|
8
|
+
* the one moment it is the right answer and arrives with the diagnosis attached.
|
|
9
|
+
*
|
|
10
|
+
* It is spawned as `node <repo's checkride>/dist/cli.js doctor --json`, not
|
|
11
|
+
* through the package manager: `<pm> exec` can print its own noise onto stdout,
|
|
12
|
+
* and the JSON report is the thing being parsed. It is also deliberately the
|
|
13
|
+
* *repo's* installed checkride rather than the one this reader ships inside —
|
|
14
|
+
* diagnosing an environment with a different version's doctor is how a reader
|
|
15
|
+
* reports a problem the repo does not have.
|
|
16
|
+
*/
|
|
17
|
+
import type { TriageEnv } from './env.js';
|
|
18
|
+
/** One required doctor row that is not ok — an environment problem to fix. */
|
|
19
|
+
export type DoctorFinding = {
|
|
20
|
+
name: string;
|
|
21
|
+
status: string;
|
|
22
|
+
found: string | null;
|
|
23
|
+
expected: string | null;
|
|
24
|
+
hint: string | null;
|
|
25
|
+
};
|
|
26
|
+
/** What the fold-in produced. Every state is reportable; none is an error. */
|
|
27
|
+
export type DoctorFold = {
|
|
28
|
+
state: 'ran';
|
|
29
|
+
ok: boolean;
|
|
30
|
+
exitCode: number | null;
|
|
31
|
+
findings: DoctorFinding[];
|
|
32
|
+
} | {
|
|
33
|
+
state: 'unavailable';
|
|
34
|
+
reason: string;
|
|
35
|
+
} | {
|
|
36
|
+
state: 'unreadable';
|
|
37
|
+
reason: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The checkride CLI this repo would run: its installed copy, or its own build
|
|
41
|
+
* when `cwd` *is* the checkride package (the dogfooding case). Never some other
|
|
42
|
+
* repo's `dist/cli.js` — the package name has to say so.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveCheckrideCli(cwd: string): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Run the repo's `checkride doctor --json` and extract what is broken. Never
|
|
47
|
+
* throws; an absent or unparseable doctor is reported as such so the report can
|
|
48
|
+
* say "the harness broke and I could not ask why" instead of inventing a cause.
|
|
49
|
+
*/
|
|
50
|
+
export declare function foldDoctor(cwd: string, env: TriageEnv): Promise<DoctorFold>;
|
|
51
|
+
//# sourceMappingURL=doctor-fold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-fold.d.ts","sourceRoot":"","sources":["../../src/triage/doctor-fold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,8EAA8E;AAC9E,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAClB;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,aAAa,EAAE,CAAA;CAAE,GACjF;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAe5C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM9D;AAwBD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAUjF"}
|