@mjasnikovs/pi-task 0.18.23 → 0.18.25
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/dist/task/artifact-closure.d.ts +107 -0
- package/dist/task/artifact-closure.js +826 -0
- package/dist/task/auto-orchestrator.d.ts +1 -0
- package/dist/task/auto-orchestrator.js +72 -8
- package/dist/task/final-gate-fix.d.ts +11 -2
- package/dist/task/final-gate-fix.js +14 -8
- package/dist/task/final-gate.d.ts +24 -3
- package/dist/task/final-gate.js +70 -22
- package/dist/task/requirements.d.ts +6 -1
- package/dist/task/requirements.js +15 -2
- package/package.json +1 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export interface RuntimeRef {
|
|
2
|
+
/** Repo-relative normalized path (posix separators, no leading ./). */
|
|
3
|
+
path: string;
|
|
4
|
+
/** Where the reference lives: repo-relative file, `package.json scripts.X`, or 'spec'. */
|
|
5
|
+
referencer: string;
|
|
6
|
+
/** The construct that matched (Bun.file, readFile, script src, …). */
|
|
7
|
+
construct: string;
|
|
8
|
+
/** file = must exist as a file; dir = a static root that must exist as a directory. */
|
|
9
|
+
kind: 'file' | 'dir';
|
|
10
|
+
}
|
|
11
|
+
export interface DanglingRef extends RuntimeRef {
|
|
12
|
+
/** Why the producer resolution came up empty (human- and prompt-readable). */
|
|
13
|
+
reason: string;
|
|
14
|
+
}
|
|
15
|
+
/** Everything the tree/scripts/build POSITIVELY produce. */
|
|
16
|
+
export interface ProducedOutputs {
|
|
17
|
+
/** Exact output files (tailwind -o, --outfile, redirects, Bun.write, cp dest…). */
|
|
18
|
+
files: Set<string>;
|
|
19
|
+
/** Enumerable outdir → output STEMS (basename sans extension) it emits —
|
|
20
|
+
* from parsed Bun.build entrypoints, explicit output files, source args. */
|
|
21
|
+
enumerable: Map<string, Set<string>>;
|
|
22
|
+
/** Dirs produced by machinery we could not enumerate (vite/tsc/next/unknown
|
|
23
|
+
* commands naming them) — everything under them steps aside. */
|
|
24
|
+
opaque: Set<string>;
|
|
25
|
+
/** Dirs known to be created (mkdir, outdirs) — satisfies dir-kind refs. */
|
|
26
|
+
dirs: Set<string>;
|
|
27
|
+
}
|
|
28
|
+
export declare function emptyProducers(): ProducedOutputs;
|
|
29
|
+
/** Normalize a literal path: posix separators, strip ./ prefixes, query/hash
|
|
30
|
+
* tails (HTML), trailing slash. Returns null when the literal is not a
|
|
31
|
+
* checkable relative path (URL, absolute, template hole, glob — step aside). */
|
|
32
|
+
export declare function normalizeRefPath(raw: string): string | null;
|
|
33
|
+
/** Extract runtime refs from one JS/TS source. */
|
|
34
|
+
export declare function extractJsRefs(source: string, referencer: string): RuntimeRef[];
|
|
35
|
+
/** Extract local-asset refs from one HTML source. */
|
|
36
|
+
export declare function extractHtmlRefs(source: string, referencer: string): RuntimeRef[];
|
|
37
|
+
/** Script entrypoints: `bun x.ts`, `bun run x.ts`, `node x.js`, `tsx x.ts` —
|
|
38
|
+
* the first path-shaped source arg of a runner command. */
|
|
39
|
+
export declare function extractScriptEntrypoints(body: string, referencer: string): RuntimeRef[];
|
|
40
|
+
/**
|
|
41
|
+
* Producer facts from ONE shell command: output flags (`-o x`, `--outfile x`,
|
|
42
|
+
* `--outdir d`), redirects, `cp`/`mv`/`touch` destinations, `mkdir` dirs, known
|
|
43
|
+
* opaque bundlers. Leftover path tokens of an UNRECOGNIZED command escalate any
|
|
44
|
+
* directory they point into to opaque — that command may produce there, and
|
|
45
|
+
* inconclusive is never evidence. `escalate: false` disables that escalation
|
|
46
|
+
* for command text embedded in PROSE (a markdown bullet's surrounding words
|
|
47
|
+
* tokenize as junk "commands" and would opaque half the spec's paths).
|
|
48
|
+
*/
|
|
49
|
+
export declare function collectProducersFromCommand(cmd: string, prod: ProducedOutputs, opts?: {
|
|
50
|
+
escalate?: boolean;
|
|
51
|
+
}): void;
|
|
52
|
+
/**
|
|
53
|
+
* Producer facts from JS/TS source: write-side calls (`Bun.write`,
|
|
54
|
+
* `writeFile(Sync)`, `createWriteStream`, `copyFile` dest, `mkdir(Sync)`),
|
|
55
|
+
* `Bun.build({entrypoints, outdir})` (enumerable — unless a `naming` option
|
|
56
|
+
* makes the output names underivable, then opaque), `outfile:`, and `Bun.spawn`
|
|
57
|
+
* argv arrays re-fed through the shell-command collector (the mx5 build.ts
|
|
58
|
+
* shape: tailwind's `-o dist/app.css` lives in a spawn array).
|
|
59
|
+
*/
|
|
60
|
+
export declare function collectProducersFromSource(source: string, prod: ProducedOutputs): void;
|
|
61
|
+
/**
|
|
62
|
+
* Discover everything the project's own machinery produces: package.json script
|
|
63
|
+
* bodies, build files those scripts run (plus conventional root build files),
|
|
64
|
+
* tsconfig/vite outDirs.
|
|
65
|
+
*/
|
|
66
|
+
export declare function discoverProducers(cwd: string): ProducedOutputs;
|
|
67
|
+
/**
|
|
68
|
+
* Resolve refs against existence + producers. DANGLING requires POSITIVE
|
|
69
|
+
* evidence (see the module doc): the ref sits under an ENUMERATED output dir
|
|
70
|
+
* and is not among its outputs, or is a missing source-only-extension file
|
|
71
|
+
* (nothing ever builds a `.ts`/`.tsx`). Everything inconclusive steps aside.
|
|
72
|
+
*/
|
|
73
|
+
export declare function resolveDanglingRefs(refs: RuntimeRef[], prod: ProducedOutputs, exists: (rel: string) => boolean): DanglingRef[];
|
|
74
|
+
/**
|
|
75
|
+
* FINAL-GATE seam: scan the shipped tree for dangling runtime references.
|
|
76
|
+
* Deterministic, read-only, best-effort (throws nothing in normal operation;
|
|
77
|
+
* callers still guard). Producers are discovered first (scripts + build files +
|
|
78
|
+
* configs), then every authored source contributes refs AND runtime write-side
|
|
79
|
+
* producers (an app that writes its own cache file satisfies its own read).
|
|
80
|
+
*/
|
|
81
|
+
export declare function findDanglingArtifacts(cwd: string): DanglingRef[];
|
|
82
|
+
/** Ranked-failure text for the final gate (names referencer + missing path). */
|
|
83
|
+
export declare function danglingGateFailureText(d: DanglingRef): string;
|
|
84
|
+
/** Does the spec LIST the file as its own artifact — a file-tree entry or a
|
|
85
|
+
* bullet whose first token is (or ends with) the basename? Prose that merely
|
|
86
|
+
* mentions the name mid-sentence ("serves the built index.html") does NOT
|
|
87
|
+
* count: that is the CONSUMING side, exactly what must not self-satisfy. */
|
|
88
|
+
export declare function specListsFile(spec: string, refPath: string): boolean;
|
|
89
|
+
/** Backticked, asset-extension, path-shaped tokens on consuming-verb lines. */
|
|
90
|
+
export declare function extractSpecProseRefs(spec: string): RuntimeRef[];
|
|
91
|
+
/**
|
|
92
|
+
* PLAN-TIME seam: runtime refs in the spec's snippets AND consuming prose that
|
|
93
|
+
* neither the existing scaffold (`fileExists`), the spec's parsed build
|
|
94
|
+
* outputs, nor its own file tree produce. Each result becomes an UNOWNED
|
|
95
|
+
* coverage area until some task title claims the artifact.
|
|
96
|
+
*/
|
|
97
|
+
export declare function findSpecDanglingArtifacts(spec: string, fileExists: (rel: string) => boolean): DanglingRef[];
|
|
98
|
+
/** Does some task title claim the artifact (by basename or full path)? Titles
|
|
99
|
+
* are the one plan artifact the model cannot fake ownership INTO — mentioning
|
|
100
|
+
* the file is the grounded signal a producing task exists. */
|
|
101
|
+
export declare function titlesCoverArtifact(titles: string[], ref: {
|
|
102
|
+
path: string;
|
|
103
|
+
}): boolean;
|
|
104
|
+
/** Coverage-loop `missing` entry for an unowned dangling artifact. */
|
|
105
|
+
export declare function danglingMissingText(d: DanglingRef): string;
|
|
106
|
+
/** Carried-requirement line when still unowned at coverage exhaustion. */
|
|
107
|
+
export declare function danglingCarryText(d: DanglingRef): string;
|