@slowcook-ai/cli 0.19.0-alpha.8 → 0.19.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.
- package/AGENTS.md +240 -0
- package/REPORTING.md +193 -0
- package/dist/cli.js +78 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/brand/index.d.ts +26 -0
- package/dist/commands/brand/index.d.ts.map +1 -0
- package/dist/commands/brand/index.js +257 -0
- package/dist/commands/brand/index.js.map +1 -0
- package/dist/commands/brew/agent.d.ts +7 -2
- package/dist/commands/brew/agent.d.ts.map +1 -1
- package/dist/commands/brew/agent.js +9 -0
- package/dist/commands/brew/agent.js.map +1 -1
- package/dist/commands/brew/halt.d.ts +26 -0
- package/dist/commands/brew/halt.d.ts.map +1 -1
- package/dist/commands/brew/halt.js.map +1 -1
- package/dist/commands/brew/index.d.ts.map +1 -1
- package/dist/commands/brew/index.js +142 -18
- package/dist/commands/brew/index.js.map +1 -1
- package/dist/commands/brew/pair-navigator.d.ts +119 -0
- package/dist/commands/brew/pair-navigator.d.ts.map +1 -0
- package/dist/commands/brew/pair-navigator.js +187 -0
- package/dist/commands/brew/pair-navigator.js.map +1 -0
- package/dist/commands/budget/index.d.ts +2 -0
- package/dist/commands/budget/index.d.ts.map +1 -0
- package/dist/commands/budget/index.js +252 -0
- package/dist/commands/budget/index.js.map +1 -0
- package/dist/commands/chef/drift-fix.d.ts +33 -4
- package/dist/commands/chef/drift-fix.d.ts.map +1 -1
- package/dist/commands/chef/drift-fix.js +417 -29
- package/dist/commands/chef/drift-fix.js.map +1 -1
- package/dist/commands/chef/index.js +13 -3
- package/dist/commands/chef/index.js.map +1 -1
- package/dist/commands/chef/orchestrate.d.ts +1 -1
- package/dist/commands/chef/orchestrate.d.ts.map +1 -1
- package/dist/commands/chef/orchestrate.js +32 -9
- package/dist/commands/chef/orchestrate.js.map +1 -1
- package/dist/commands/dev-env/config.d.ts +57 -0
- package/dist/commands/dev-env/config.d.ts.map +1 -0
- package/dist/commands/dev-env/config.js +96 -0
- package/dist/commands/dev-env/config.js.map +1 -0
- package/dist/commands/dev-env/index.d.ts +27 -0
- package/dist/commands/dev-env/index.d.ts.map +1 -0
- package/dist/commands/dev-env/index.js +226 -0
- package/dist/commands/dev-env/index.js.map +1 -0
- package/dist/commands/dev-env/init.d.ts +28 -0
- package/dist/commands/dev-env/init.d.ts.map +1 -0
- package/dist/commands/dev-env/init.js +135 -0
- package/dist/commands/dev-env/init.js.map +1 -0
- package/dist/commands/docs/index.d.ts +16 -0
- package/dist/commands/docs/index.d.ts.map +1 -0
- package/dist/commands/docs/index.js +127 -0
- package/dist/commands/docs/index.js.map +1 -0
- package/dist/commands/eval/index.d.ts +54 -0
- package/dist/commands/eval/index.d.ts.map +1 -0
- package/dist/commands/eval/index.js +294 -0
- package/dist/commands/eval/index.js.map +1 -0
- package/dist/commands/extract/index.d.ts.map +1 -1
- package/dist/commands/extract/index.js +23 -1
- package/dist/commands/extract/index.js.map +1 -1
- package/dist/commands/garnish/index.d.ts +56 -0
- package/dist/commands/garnish/index.d.ts.map +1 -0
- package/dist/commands/garnish/index.js +281 -0
- package/dist/commands/garnish/index.js.map +1 -0
- package/dist/commands/garnish/trailer.d.ts +79 -0
- package/dist/commands/garnish/trailer.d.ts.map +1 -0
- package/dist/commands/garnish/trailer.js +118 -0
- package/dist/commands/garnish/trailer.js.map +1 -0
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +33 -0
- package/dist/commands/init/index.js.map +1 -1
- package/dist/commands/init/mock-vite.d.ts +54 -0
- package/dist/commands/init/mock-vite.d.ts.map +1 -0
- package/dist/commands/init/mock-vite.js +613 -0
- package/dist/commands/init/mock-vite.js.map +1 -0
- package/dist/commands/init/mock.d.ts +6 -0
- package/dist/commands/init/mock.d.ts.map +1 -1
- package/dist/commands/init/mock.js +20 -4
- package/dist/commands/init/mock.js.map +1 -1
- package/dist/commands/init/plan.d.ts +26 -1
- package/dist/commands/init/plan.d.ts.map +1 -1
- package/dist/commands/init/plan.js +41 -3
- package/dist/commands/init/plan.js.map +1 -1
- package/dist/commands/init/templates.d.ts.map +1 -1
- package/dist/commands/init/templates.js +12 -4
- package/dist/commands/init/templates.js.map +1 -1
- package/dist/commands/knowledge-add.d.ts +52 -0
- package/dist/commands/knowledge-add.d.ts.map +1 -0
- package/dist/commands/knowledge-add.js +232 -0
- package/dist/commands/knowledge-add.js.map +1 -0
- package/dist/commands/map/emit-typeorm.d.ts +117 -0
- package/dist/commands/map/emit-typeorm.d.ts.map +1 -0
- package/dist/commands/map/emit-typeorm.js +341 -0
- package/dist/commands/map/emit-typeorm.js.map +1 -0
- package/dist/commands/map/index.d.ts +18 -0
- package/dist/commands/map/index.d.ts.map +1 -1
- package/dist/commands/map/index.js +28 -0
- package/dist/commands/map/index.js.map +1 -1
- package/dist/commands/plate/agent.d.ts +7 -0
- package/dist/commands/plate/agent.d.ts.map +1 -1
- package/dist/commands/plate/agent.js +1 -1
- package/dist/commands/plate/agent.js.map +1 -1
- package/dist/commands/plate/index.d.ts.map +1 -1
- package/dist/commands/plate/index.js +6 -0
- package/dist/commands/plate/index.js.map +1 -1
- package/dist/commands/recon/index.d.ts +16 -3
- package/dist/commands/recon/index.d.ts.map +1 -1
- package/dist/commands/recon/index.js +267 -16
- package/dist/commands/recon/index.js.map +1 -1
- package/dist/commands/recon/migration-gate.d.ts +59 -0
- package/dist/commands/recon/migration-gate.d.ts.map +1 -0
- package/dist/commands/recon/migration-gate.js +131 -0
- package/dist/commands/recon/migration-gate.js.map +1 -0
- package/dist/commands/recon/reuse.d.ts +32 -0
- package/dist/commands/recon/reuse.d.ts.map +1 -1
- package/dist/commands/recon/reuse.js +66 -0
- package/dist/commands/recon/reuse.js.map +1 -1
- package/dist/commands/recon/stale-stubs.d.ts +65 -0
- package/dist/commands/recon/stale-stubs.d.ts.map +1 -0
- package/dist/commands/recon/stale-stubs.js +84 -0
- package/dist/commands/recon/stale-stubs.js.map +1 -0
- package/dist/commands/refine/agent.d.ts +23 -0
- package/dist/commands/refine/agent.d.ts.map +1 -1
- package/dist/commands/refine/agent.js +245 -15
- package/dist/commands/refine/agent.js.map +1 -1
- package/dist/commands/refine/brownfield-answer.d.ts +81 -0
- package/dist/commands/refine/brownfield-answer.d.ts.map +1 -0
- package/dist/commands/refine/brownfield-answer.js +231 -0
- package/dist/commands/refine/brownfield-answer.js.map +1 -0
- package/dist/commands/refine/context.d.ts +27 -1
- package/dist/commands/refine/context.d.ts.map +1 -1
- package/dist/commands/refine/context.js +438 -6
- package/dist/commands/refine/context.js.map +1 -1
- package/dist/commands/refine/git-attention.d.ts +123 -0
- package/dist/commands/refine/git-attention.d.ts.map +1 -0
- package/dist/commands/refine/git-attention.js +378 -0
- package/dist/commands/refine/git-attention.js.map +1 -0
- package/dist/commands/refine/history-index.d.ts +66 -0
- package/dist/commands/refine/history-index.d.ts.map +1 -1
- package/dist/commands/refine/history-index.js +195 -8
- package/dist/commands/refine/history-index.js.map +1 -1
- package/dist/commands/refine/index.d.ts.map +1 -1
- package/dist/commands/refine/index.js +105 -18
- package/dist/commands/refine/index.js.map +1 -1
- package/dist/commands/refine/multifurcate.d.ts +129 -0
- package/dist/commands/refine/multifurcate.d.ts.map +1 -0
- package/dist/commands/refine/multifurcate.js +247 -0
- package/dist/commands/refine/multifurcate.js.map +1 -0
- package/dist/commands/refine/proposals-synth.d.ts +50 -1
- package/dist/commands/refine/proposals-synth.d.ts.map +1 -1
- package/dist/commands/refine/proposals-synth.js +199 -35
- package/dist/commands/refine/proposals-synth.js.map +1 -1
- package/dist/commands/refine/spec-yaml.d.ts +214 -1210
- package/dist/commands/refine/spec-yaml.d.ts.map +1 -1
- package/dist/commands/refine/spec-yaml.js +10 -0
- package/dist/commands/refine/spec-yaml.js.map +1 -1
- package/dist/commands/refresh-knowledge.d.ts +126 -0
- package/dist/commands/refresh-knowledge.d.ts.map +1 -0
- package/dist/commands/refresh-knowledge.js +1010 -0
- package/dist/commands/refresh-knowledge.js.map +1 -0
- package/dist/commands/run-mock/index.d.ts.map +1 -1
- package/dist/commands/run-mock/index.js +135 -22
- package/dist/commands/run-mock/index.js.map +1 -1
- package/dist/commands/testgen/agent.d.ts +13 -0
- package/dist/commands/testgen/agent.d.ts.map +1 -1
- package/dist/commands/testgen/agent.js +137 -11
- package/dist/commands/testgen/agent.js.map +1 -1
- package/dist/commands/upsert-agent-docs.d.ts +48 -0
- package/dist/commands/upsert-agent-docs.d.ts.map +1 -0
- package/dist/commands/upsert-agent-docs.js +298 -0
- package/dist/commands/upsert-agent-docs.js.map +1 -0
- package/dist/commands/vibe/agent.d.ts +7 -0
- package/dist/commands/vibe/agent.d.ts.map +1 -1
- package/dist/commands/vibe/agent.js +2 -2
- package/dist/commands/vibe/agent.js.map +1 -1
- package/dist/commands/vibe/index.d.ts.map +1 -1
- package/dist/commands/vibe/index.js +7 -1
- package/dist/commands/vibe/index.js.map +1 -1
- package/dist/cost-store.d.ts +52 -0
- package/dist/cost-store.d.ts.map +1 -0
- package/dist/cost-store.js +108 -0
- package/dist/cost-store.js.map +1 -0
- package/dist/lib/budget.d.ts +73 -0
- package/dist/lib/budget.d.ts.map +1 -0
- package/dist/lib/budget.js +225 -0
- package/dist/lib/budget.js.map +1 -0
- package/dist/lib/mock-shape.d.ts +29 -0
- package/dist/lib/mock-shape.d.ts.map +1 -0
- package/dist/lib/mock-shape.js +77 -0
- package/dist/lib/mock-shape.js.map +1 -0
- package/dist/lib/read-only.d.ts +22 -0
- package/dist/lib/read-only.d.ts.map +1 -0
- package/dist/lib/read-only.js +34 -0
- package/dist/lib/read-only.js.map +1 -0
- package/package.json +17 -12
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @slowcook 0.19.0-alpha.43 — git-history attention layer for the refine
|
|
3
|
+
* history-index.
|
|
4
|
+
*
|
|
5
|
+
* Motivated by the "Attention Is All You Need" thread (memory:
|
|
6
|
+
* project_bounded_attention_validation_2026_04_25): a brownfield repo IS
|
|
7
|
+
* the product of a sequential process (git commits). Versioning history
|
|
8
|
+
* — diffs, commit messages, PR descriptions, specs — is a strong signal
|
|
9
|
+
* for which existing components/props/tests/routes/migrations are most
|
|
10
|
+
* relevant to a new story, BUT raw commit history is noisy. We extract
|
|
11
|
+
* four narrower signals:
|
|
12
|
+
*
|
|
13
|
+
* 1. Rename chains — `git log --follow` so look-ups don't miss
|
|
14
|
+
* historical names (e.g. ReactionsPage →
|
|
15
|
+
* MemberReactionsPage).
|
|
16
|
+
* 2. Change-coupling — file pairs that co-change in the same
|
|
17
|
+
* commits; surfaces architectural couplings
|
|
18
|
+
* file-system layout misses.
|
|
19
|
+
* 3. Recent PRs per file — PR descriptions are higher-quality "Keys"
|
|
20
|
+
* than raw commit messages because they're
|
|
21
|
+
* intent-shaped, not change-shaped.
|
|
22
|
+
* 4. PR+spec corpus — flat searchable index of PR descriptions
|
|
23
|
+
* and spec yaml summaries so downstream agents
|
|
24
|
+
* can keyword-retrieve prior intent before
|
|
25
|
+
* writing new code.
|
|
26
|
+
*
|
|
27
|
+
* Deliberately deterministic (no embeddings). Embedding upgrade is a
|
|
28
|
+
* future Phase 3 step; this lower-cost version ships the contract first.
|
|
29
|
+
*
|
|
30
|
+
* All four are graceful-degradation: missing git history, missing gh,
|
|
31
|
+
* unauthenticated gh, no PRs, no specs — each path returns an empty
|
|
32
|
+
* structure plus a warning string. The orchestrator NEVER throws.
|
|
33
|
+
*/
|
|
34
|
+
export interface CoChangeEntry {
|
|
35
|
+
/** repo-relative path of the co-changing file */
|
|
36
|
+
file: string;
|
|
37
|
+
/** fraction of this file's co-change events that landed on `file` (0..1, 2dp) */
|
|
38
|
+
strength: number;
|
|
39
|
+
}
|
|
40
|
+
export interface PRRecord {
|
|
41
|
+
number: number;
|
|
42
|
+
title: string;
|
|
43
|
+
body: string;
|
|
44
|
+
merged_at: string | null;
|
|
45
|
+
files: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface PRSpecCorpusEntry {
|
|
48
|
+
source: "pr" | "spec";
|
|
49
|
+
/** Stable id: "pr#123" or "spec:story-007". */
|
|
50
|
+
id: string;
|
|
51
|
+
title: string;
|
|
52
|
+
/** First ~500 chars of the body / spec summary. */
|
|
53
|
+
excerpt: string;
|
|
54
|
+
/** Files touched (empty for specs). */
|
|
55
|
+
files_touched: string[];
|
|
56
|
+
/** ISO date or "" if not applicable. */
|
|
57
|
+
date: string;
|
|
58
|
+
/** Lower-cased, stopword-stripped tokens for cheap keyword retrieval. */
|
|
59
|
+
tokens: string[];
|
|
60
|
+
}
|
|
61
|
+
export interface GitAttentionData {
|
|
62
|
+
enriched_at: string;
|
|
63
|
+
/** current_file -> historical paths it was renamed from, newest-first. */
|
|
64
|
+
rename_chains: Record<string, string[]>;
|
|
65
|
+
/** file -> top-K co-changing files (by frequency in same commits). */
|
|
66
|
+
co_changes: Record<string, CoChangeEntry[]>;
|
|
67
|
+
/** file -> last 5 PRs that touched it (newest-first; merged before open). */
|
|
68
|
+
recent_prs_by_file: Record<string, PRRecord[]>;
|
|
69
|
+
/** Flat searchable corpus of PR descriptions + spec yaml summaries. */
|
|
70
|
+
pr_spec_corpus: PRSpecCorpusEntry[];
|
|
71
|
+
/** Non-fatal degradation notices ("gh not installed", "git history shallow", etc.). */
|
|
72
|
+
warnings: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface GitAttentionOptions {
|
|
75
|
+
repoRoot: string;
|
|
76
|
+
/** Files we want enrichment for (typically the union of components/api/tests/migrations from the history index). */
|
|
77
|
+
trackedFiles: string[];
|
|
78
|
+
/** Months of git log to consider for co-change. Default 6. */
|
|
79
|
+
coChangeWindowMonths?: number;
|
|
80
|
+
/** Skip commits with more files than this (mass refactor filter). Default 50. */
|
|
81
|
+
coChangeMaxFilesPerCommit?: number;
|
|
82
|
+
/** How many co-changes to keep per file. Default 5. */
|
|
83
|
+
coChangesPerFile?: number;
|
|
84
|
+
/** How many recent PRs to fetch from gh. Default 50. */
|
|
85
|
+
prsToFetch?: number;
|
|
86
|
+
/** Injectable for tests: override `git -C <root> ...` */
|
|
87
|
+
gitExec?: (cmd: string) => string;
|
|
88
|
+
/** Injectable for tests: override `gh ...` */
|
|
89
|
+
ghExec?: (cmd: string) => string;
|
|
90
|
+
}
|
|
91
|
+
export declare function computeGitAttention(opts: GitAttentionOptions): GitAttentionData;
|
|
92
|
+
export declare function computeRenameChains(files: string[], git: (cmd: string) => string): Record<string, string[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Parse `git log --follow --name-status -M` output for a single file.
|
|
95
|
+
* Each rename is a line `R<score>\told\tnew`. Returns OLD paths in the
|
|
96
|
+
* order git reports them (newest commit first, so most-recent rename
|
|
97
|
+
* is index 0).
|
|
98
|
+
*/
|
|
99
|
+
export declare function parseRenameChain(stdout: string, currentFile: string): string[];
|
|
100
|
+
export interface CoChangeBuildOptions {
|
|
101
|
+
windowMonths: number;
|
|
102
|
+
maxFilesPerCommit: number;
|
|
103
|
+
topPerFile: number;
|
|
104
|
+
}
|
|
105
|
+
export declare function computeCoChanges(trackedFiles: string[], git: (cmd: string) => string, opts: CoChangeBuildOptions): Record<string, CoChangeEntry[]>;
|
|
106
|
+
export declare function parseLogIntoCommits(stdout: string): Array<{
|
|
107
|
+
sha: string;
|
|
108
|
+
files: string[];
|
|
109
|
+
}>;
|
|
110
|
+
export declare function fetchRecentPRs(gh: (cmd: string) => string, limit: number): PRRecord[];
|
|
111
|
+
export declare function parseGhPRList(stdout: string): PRRecord[];
|
|
112
|
+
export declare function indexPRsByFile(prs: PRRecord[], files: string[]): Record<string, PRRecord[]>;
|
|
113
|
+
/**
|
|
114
|
+
* Lowercase, stopword-stripped, deduped token list capped at 60. Cheap
|
|
115
|
+
* substitute for embeddings — agents can intersect query tokens with
|
|
116
|
+
* each corpus entry's `tokens` to rank relevance without an LLM call.
|
|
117
|
+
*
|
|
118
|
+
* Embedding upgrade is Phase 3 (slowcook 0.14.0+, evidence-gated). Until
|
|
119
|
+
* then this is what we ship.
|
|
120
|
+
*/
|
|
121
|
+
export declare function tokeniseForCorpus(text: string): string[];
|
|
122
|
+
export declare function buildPRSpecCorpus(prs: PRRecord[], repoRoot: string): PRSpecCorpusEntry[];
|
|
123
|
+
//# sourceMappingURL=git-attention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-attention.d.ts","sourceRoot":"","sources":["../../../src/commands/refine/git-attention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAOH,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IAC5C,6EAA6E;IAC7E,kBAAkB,EAAE,MAAM,CAA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AAE,oBAAoB,GACzB,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,CAiCjC;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GACb,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAczC;AAaD,wBAAgB,cAAc,CAC5B,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAC3B,KAAK,EAAE,MAAM,GACZ,QAAQ,EAAE,CAGZ;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CA+BxD;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,QAAQ,EAAE,EACf,KAAK,EAAE,MAAM,EAAE,GACd,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAmB5B;AAeD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAYxD;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,QAAQ,EAAE,EACf,QAAQ,EAAE,MAAM,GACf,iBAAiB,EAAE,CAsDrB"}
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @slowcook 0.19.0-alpha.43 — git-history attention layer for the refine
|
|
3
|
+
* history-index.
|
|
4
|
+
*
|
|
5
|
+
* Motivated by the "Attention Is All You Need" thread (memory:
|
|
6
|
+
* project_bounded_attention_validation_2026_04_25): a brownfield repo IS
|
|
7
|
+
* the product of a sequential process (git commits). Versioning history
|
|
8
|
+
* — diffs, commit messages, PR descriptions, specs — is a strong signal
|
|
9
|
+
* for which existing components/props/tests/routes/migrations are most
|
|
10
|
+
* relevant to a new story, BUT raw commit history is noisy. We extract
|
|
11
|
+
* four narrower signals:
|
|
12
|
+
*
|
|
13
|
+
* 1. Rename chains — `git log --follow` so look-ups don't miss
|
|
14
|
+
* historical names (e.g. ReactionsPage →
|
|
15
|
+
* MemberReactionsPage).
|
|
16
|
+
* 2. Change-coupling — file pairs that co-change in the same
|
|
17
|
+
* commits; surfaces architectural couplings
|
|
18
|
+
* file-system layout misses.
|
|
19
|
+
* 3. Recent PRs per file — PR descriptions are higher-quality "Keys"
|
|
20
|
+
* than raw commit messages because they're
|
|
21
|
+
* intent-shaped, not change-shaped.
|
|
22
|
+
* 4. PR+spec corpus — flat searchable index of PR descriptions
|
|
23
|
+
* and spec yaml summaries so downstream agents
|
|
24
|
+
* can keyword-retrieve prior intent before
|
|
25
|
+
* writing new code.
|
|
26
|
+
*
|
|
27
|
+
* Deliberately deterministic (no embeddings). Embedding upgrade is a
|
|
28
|
+
* future Phase 3 step; this lower-cost version ships the contract first.
|
|
29
|
+
*
|
|
30
|
+
* All four are graceful-degradation: missing git history, missing gh,
|
|
31
|
+
* unauthenticated gh, no PRs, no specs — each path returns an empty
|
|
32
|
+
* structure plus a warning string. The orchestrator NEVER throws.
|
|
33
|
+
*/
|
|
34
|
+
import { execSync } from "node:child_process";
|
|
35
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
36
|
+
import { join } from "node:path";
|
|
37
|
+
import YAML from "yaml";
|
|
38
|
+
export function computeGitAttention(opts) {
|
|
39
|
+
const warnings = [];
|
|
40
|
+
const git = opts.gitExec ?? defaultGit(opts.repoRoot);
|
|
41
|
+
const gh = opts.ghExec ?? defaultGh();
|
|
42
|
+
let isRepo = true;
|
|
43
|
+
try {
|
|
44
|
+
git("rev-parse --git-dir");
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
isRepo = false;
|
|
48
|
+
warnings.push(`Not a git repo (${e.message.slice(0, 80)}); git-history signals skipped.`);
|
|
49
|
+
}
|
|
50
|
+
let rename_chains = {};
|
|
51
|
+
let co_changes = {};
|
|
52
|
+
if (isRepo) {
|
|
53
|
+
try {
|
|
54
|
+
rename_chains = computeRenameChains(opts.trackedFiles, git);
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
warnings.push(`Rename detection failed: ${e.message.slice(0, 120)}`);
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
co_changes = computeCoChanges(opts.trackedFiles, git, {
|
|
61
|
+
windowMonths: opts.coChangeWindowMonths ?? 6,
|
|
62
|
+
maxFilesPerCommit: opts.coChangeMaxFilesPerCommit ?? 50,
|
|
63
|
+
topPerFile: opts.coChangesPerFile ?? 5,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
warnings.push(`Co-change matrix failed: ${e.message.slice(0, 120)}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
let prs = [];
|
|
71
|
+
let recent_prs_by_file = {};
|
|
72
|
+
try {
|
|
73
|
+
prs = fetchRecentPRs(gh, opts.prsToFetch ?? 50);
|
|
74
|
+
recent_prs_by_file = indexPRsByFile(prs, opts.trackedFiles);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
warnings.push(`gh pr list failed (PR-as-Key signal skipped): ${e.message.slice(0, 120)}`);
|
|
78
|
+
}
|
|
79
|
+
let pr_spec_corpus = [];
|
|
80
|
+
try {
|
|
81
|
+
pr_spec_corpus = buildPRSpecCorpus(prs, opts.repoRoot);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
warnings.push(`PR+spec corpus build failed: ${e.message.slice(0, 120)}`);
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
enriched_at: new Date().toISOString(),
|
|
88
|
+
rename_chains,
|
|
89
|
+
co_changes,
|
|
90
|
+
recent_prs_by_file,
|
|
91
|
+
pr_spec_corpus,
|
|
92
|
+
warnings,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// ─── git/gh execution shims ─────────────────────────────────────────────
|
|
96
|
+
function defaultGit(repoRoot) {
|
|
97
|
+
return (cmd) => execSync(`git -C "${repoRoot}" ${cmd}`, {
|
|
98
|
+
encoding: "utf8",
|
|
99
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
100
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function defaultGh() {
|
|
104
|
+
return (cmd) => execSync(`gh ${cmd}`, {
|
|
105
|
+
encoding: "utf8",
|
|
106
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
107
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// ─── rename chains ──────────────────────────────────────────────────────
|
|
111
|
+
export function computeRenameChains(files, git) {
|
|
112
|
+
const out = {};
|
|
113
|
+
for (const file of files) {
|
|
114
|
+
if (file.includes('"') || file.includes("`"))
|
|
115
|
+
continue; // refuse shell-injection candidates
|
|
116
|
+
let stdout = "";
|
|
117
|
+
try {
|
|
118
|
+
stdout = git(`log --follow --name-status -M --pretty=format:"" -- "${file}"`);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
continue; // per-file failures are fine (file may not be tracked)
|
|
122
|
+
}
|
|
123
|
+
const chain = parseRenameChain(stdout, file);
|
|
124
|
+
if (chain.length > 0)
|
|
125
|
+
out[file] = chain;
|
|
126
|
+
}
|
|
127
|
+
return out;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Parse `git log --follow --name-status -M` output for a single file.
|
|
131
|
+
* Each rename is a line `R<score>\told\tnew`. Returns OLD paths in the
|
|
132
|
+
* order git reports them (newest commit first, so most-recent rename
|
|
133
|
+
* is index 0).
|
|
134
|
+
*/
|
|
135
|
+
export function parseRenameChain(stdout, currentFile) {
|
|
136
|
+
const renames = [];
|
|
137
|
+
for (const rawLine of stdout.split("\n")) {
|
|
138
|
+
const line = rawLine.trim();
|
|
139
|
+
if (!line)
|
|
140
|
+
continue;
|
|
141
|
+
if (!line.startsWith("R"))
|
|
142
|
+
continue;
|
|
143
|
+
const parts = line.split("\t");
|
|
144
|
+
if (parts.length < 3)
|
|
145
|
+
continue;
|
|
146
|
+
const oldPath = parts[1];
|
|
147
|
+
if (oldPath === currentFile)
|
|
148
|
+
continue;
|
|
149
|
+
if (renames.includes(oldPath))
|
|
150
|
+
continue;
|
|
151
|
+
renames.push(oldPath);
|
|
152
|
+
}
|
|
153
|
+
return renames;
|
|
154
|
+
}
|
|
155
|
+
export function computeCoChanges(trackedFiles, git, opts) {
|
|
156
|
+
const since = isoDaysAgo(opts.windowMonths * 30);
|
|
157
|
+
const stdout = git(`log --name-only --pretty=format:"COMMIT %H" --since="${since}"`);
|
|
158
|
+
const commits = parseLogIntoCommits(stdout);
|
|
159
|
+
const tracked = new Set(trackedFiles);
|
|
160
|
+
const counts = new Map();
|
|
161
|
+
for (const file of trackedFiles)
|
|
162
|
+
counts.set(file, new Map());
|
|
163
|
+
for (const commit of commits) {
|
|
164
|
+
if (commit.files.length === 0 || commit.files.length > opts.maxFilesPerCommit)
|
|
165
|
+
continue;
|
|
166
|
+
if (!commit.files.some((f) => tracked.has(f)))
|
|
167
|
+
continue;
|
|
168
|
+
for (const a of commit.files) {
|
|
169
|
+
if (!tracked.has(a))
|
|
170
|
+
continue;
|
|
171
|
+
const aMap = counts.get(a);
|
|
172
|
+
for (const b of commit.files) {
|
|
173
|
+
if (b === a)
|
|
174
|
+
continue;
|
|
175
|
+
aMap.set(b, (aMap.get(b) ?? 0) + 1);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const out = {};
|
|
180
|
+
for (const [file, others] of counts) {
|
|
181
|
+
if (others.size === 0)
|
|
182
|
+
continue;
|
|
183
|
+
const total = Array.from(others.values()).reduce((s, n) => s + n, 0);
|
|
184
|
+
const sorted = Array.from(others.entries())
|
|
185
|
+
.sort((a, b) => b[1] - a[1])
|
|
186
|
+
.slice(0, opts.topPerFile)
|
|
187
|
+
.map(([f, c]) => ({ file: f, strength: round2(c / Math.max(total, 1)) }));
|
|
188
|
+
out[file] = sorted;
|
|
189
|
+
}
|
|
190
|
+
return out;
|
|
191
|
+
}
|
|
192
|
+
export function parseLogIntoCommits(stdout) {
|
|
193
|
+
const commits = [];
|
|
194
|
+
let current = null;
|
|
195
|
+
for (const rawLine of stdout.split("\n")) {
|
|
196
|
+
const line = rawLine.trim();
|
|
197
|
+
if (line.startsWith("COMMIT ")) {
|
|
198
|
+
if (current)
|
|
199
|
+
commits.push(current);
|
|
200
|
+
current = { sha: line.slice("COMMIT ".length), files: [] };
|
|
201
|
+
}
|
|
202
|
+
else if (line.length > 0 && current) {
|
|
203
|
+
current.files.push(line);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (current)
|
|
207
|
+
commits.push(current);
|
|
208
|
+
return commits;
|
|
209
|
+
}
|
|
210
|
+
function isoDaysAgo(days) {
|
|
211
|
+
const d = new Date(Date.now() - days * 24 * 60 * 60 * 1000);
|
|
212
|
+
return d.toISOString().slice(0, 10);
|
|
213
|
+
}
|
|
214
|
+
function round2(x) {
|
|
215
|
+
return Math.round(x * 100) / 100;
|
|
216
|
+
}
|
|
217
|
+
// ─── recent PRs via gh ──────────────────────────────────────────────────
|
|
218
|
+
export function fetchRecentPRs(gh, limit) {
|
|
219
|
+
const stdout = gh(`pr list --state all --limit ${limit} --json number,title,body,mergedAt,files`);
|
|
220
|
+
return parseGhPRList(stdout);
|
|
221
|
+
}
|
|
222
|
+
export function parseGhPRList(stdout) {
|
|
223
|
+
let raw;
|
|
224
|
+
try {
|
|
225
|
+
raw = JSON.parse(stdout);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
return [];
|
|
229
|
+
}
|
|
230
|
+
if (!Array.isArray(raw))
|
|
231
|
+
return [];
|
|
232
|
+
const out = [];
|
|
233
|
+
for (const item of raw) {
|
|
234
|
+
if (!item || typeof item !== "object")
|
|
235
|
+
continue;
|
|
236
|
+
const o = item;
|
|
237
|
+
const filesField = o.files;
|
|
238
|
+
const files = Array.isArray(filesField)
|
|
239
|
+
? filesField
|
|
240
|
+
.map((f) => f && typeof f === "object"
|
|
241
|
+
? f.path
|
|
242
|
+
: null)
|
|
243
|
+
.filter((p) => typeof p === "string")
|
|
244
|
+
: [];
|
|
245
|
+
out.push({
|
|
246
|
+
number: typeof o.number === "number" ? o.number : 0,
|
|
247
|
+
title: typeof o.title === "string" ? o.title : "",
|
|
248
|
+
body: typeof o.body === "string" ? o.body : "",
|
|
249
|
+
merged_at: typeof o.mergedAt === "string" ? o.mergedAt : null,
|
|
250
|
+
files,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
return out;
|
|
254
|
+
}
|
|
255
|
+
export function indexPRsByFile(prs, files) {
|
|
256
|
+
const out = {};
|
|
257
|
+
const tracked = new Set(files);
|
|
258
|
+
for (const pr of prs) {
|
|
259
|
+
for (const f of pr.files) {
|
|
260
|
+
if (!tracked.has(f))
|
|
261
|
+
continue;
|
|
262
|
+
(out[f] ??= []).push(pr);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
for (const key of Object.keys(out)) {
|
|
266
|
+
out[key].sort((a, b) => {
|
|
267
|
+
if (a.merged_at === b.merged_at)
|
|
268
|
+
return b.number - a.number;
|
|
269
|
+
if (!a.merged_at)
|
|
270
|
+
return -1; // open PRs first
|
|
271
|
+
if (!b.merged_at)
|
|
272
|
+
return 1;
|
|
273
|
+
return a.merged_at < b.merged_at ? 1 : -1;
|
|
274
|
+
});
|
|
275
|
+
out[key] = out[key].slice(0, 5);
|
|
276
|
+
}
|
|
277
|
+
return out;
|
|
278
|
+
}
|
|
279
|
+
// ─── PR + spec corpus ───────────────────────────────────────────────────
|
|
280
|
+
const STOPWORDS = new Set([
|
|
281
|
+
"the", "and", "for", "with", "that", "this", "from", "into", "over", "under",
|
|
282
|
+
"when", "where", "what", "how", "why", "not", "but", "you", "your", "our", "its",
|
|
283
|
+
"are", "was", "were", "has", "have", "had", "can", "may", "might", "will", "would",
|
|
284
|
+
"should", "could", "does", "did", "done", "than", "then", "also", "just", "like",
|
|
285
|
+
"use", "using", "used", "make", "made", "get", "got", "set", "new", "old", "add",
|
|
286
|
+
"added", "fix", "fixed", "update", "updated", "remove", "removed", "pull",
|
|
287
|
+
"request", "merge", "branch", "commit", "file", "files", "code", "main", "alpha",
|
|
288
|
+
"beta", "wip", "tbd", "docs", "doc", "feat", "chore", "refactor", "src", "test", "tests",
|
|
289
|
+
]);
|
|
290
|
+
/**
|
|
291
|
+
* Lowercase, stopword-stripped, deduped token list capped at 60. Cheap
|
|
292
|
+
* substitute for embeddings — agents can intersect query tokens with
|
|
293
|
+
* each corpus entry's `tokens` to rank relevance without an LLM call.
|
|
294
|
+
*
|
|
295
|
+
* Embedding upgrade is Phase 3 (slowcook 0.14.0+, evidence-gated). Until
|
|
296
|
+
* then this is what we ship.
|
|
297
|
+
*/
|
|
298
|
+
export function tokeniseForCorpus(text) {
|
|
299
|
+
const raw = text.toLowerCase().match(/[a-z][a-z0-9_-]{2,}/g) ?? [];
|
|
300
|
+
const seen = new Set();
|
|
301
|
+
const out = [];
|
|
302
|
+
for (const tok of raw) {
|
|
303
|
+
if (STOPWORDS.has(tok))
|
|
304
|
+
continue;
|
|
305
|
+
if (seen.has(tok))
|
|
306
|
+
continue;
|
|
307
|
+
seen.add(tok);
|
|
308
|
+
out.push(tok);
|
|
309
|
+
if (out.length >= 60)
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
return out;
|
|
313
|
+
}
|
|
314
|
+
export function buildPRSpecCorpus(prs, repoRoot) {
|
|
315
|
+
const out = [];
|
|
316
|
+
for (const pr of prs) {
|
|
317
|
+
out.push({
|
|
318
|
+
source: "pr",
|
|
319
|
+
id: `pr#${pr.number}`,
|
|
320
|
+
title: pr.title,
|
|
321
|
+
excerpt: trimExcerpt(pr.body, 500),
|
|
322
|
+
files_touched: pr.files,
|
|
323
|
+
date: pr.merged_at ?? "",
|
|
324
|
+
tokens: tokeniseForCorpus(`${pr.title}\n${pr.body}\n${pr.files.join(" ")}`),
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
const specsDir = join(repoRoot, "specs");
|
|
328
|
+
if (existsSync(specsDir)) {
|
|
329
|
+
let entries = [];
|
|
330
|
+
try {
|
|
331
|
+
entries = readdirSync(specsDir)
|
|
332
|
+
.filter((f) => f.endsWith(".yaml") || f.endsWith(".yml"))
|
|
333
|
+
.sort();
|
|
334
|
+
}
|
|
335
|
+
catch {
|
|
336
|
+
return out;
|
|
337
|
+
}
|
|
338
|
+
for (const name of entries) {
|
|
339
|
+
const full = join(specsDir, name);
|
|
340
|
+
let raw = "";
|
|
341
|
+
try {
|
|
342
|
+
raw = readFileSync(full, "utf8");
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
let title = "";
|
|
348
|
+
let summary = "";
|
|
349
|
+
try {
|
|
350
|
+
const parsed = YAML.parse(raw);
|
|
351
|
+
if (parsed && typeof parsed === "object") {
|
|
352
|
+
title = typeof parsed.title === "string" ? parsed.title : "";
|
|
353
|
+
summary = typeof parsed.summary === "string" ? parsed.summary : "";
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
catch {
|
|
357
|
+
// malformed yaml — index raw text anyway
|
|
358
|
+
}
|
|
359
|
+
out.push({
|
|
360
|
+
source: "spec",
|
|
361
|
+
id: `spec:${name.replace(/\.(yaml|yml)$/, "")}`,
|
|
362
|
+
title,
|
|
363
|
+
excerpt: summary || trimExcerpt(raw, 500),
|
|
364
|
+
files_touched: [],
|
|
365
|
+
date: "",
|
|
366
|
+
tokens: tokeniseForCorpus(`${title}\n${summary}\n${raw}`),
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return out;
|
|
371
|
+
}
|
|
372
|
+
function trimExcerpt(text, limit) {
|
|
373
|
+
const trimmed = (text || "").trim();
|
|
374
|
+
if (trimmed.length <= limit)
|
|
375
|
+
return trimmed;
|
|
376
|
+
return trimmed.slice(0, limit) + " …";
|
|
377
|
+
}
|
|
378
|
+
//# sourceMappingURL=git-attention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-attention.js","sourceRoot":"","sources":["../../../src/commands/refine/git-attention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,IAAI,MAAM,MAAM,CAAC;AAgExB,MAAM,UAAU,mBAAmB,CAAC,IAAyB;IAC3D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;IAEtC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC;QACH,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,KAAK,CAAC;QACf,QAAQ,CAAC,IAAI,CAAC,mBAAoB,CAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,iCAAiC,CAAC,CAAC;IACvG,CAAC;IAED,IAAI,aAAa,GAA6B,EAAE,CAAC;IACjD,IAAI,UAAU,GAAoC,EAAE,CAAC;IAErD,IAAI,MAAM,EAAE,CAAC;QACX,IAAI,CAAC;YACH,aAAa,GAAG,mBAAmB,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAC9D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,QAAQ,CAAC,IAAI,CAAC,4BAA6B,CAAW,CAAC,OAAO,CAAC,KAAK,CAA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IAC5C,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;AACxC,CAAC"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* Pure functions over the filesystem. No LLM. Generated on every refine
|
|
18
18
|
* invocation so it's always current.
|
|
19
19
|
*/
|
|
20
|
+
import type { GitAttentionData } from "./git-attention.js";
|
|
20
21
|
export interface ComponentEntry {
|
|
21
22
|
/** PascalCase component name (the default-export or first named export). */
|
|
22
23
|
name: string;
|
|
@@ -59,6 +60,30 @@ export interface TestFileEntry {
|
|
|
59
60
|
/** describe / it titles found in the file (best-effort regex). */
|
|
60
61
|
test_names: string[];
|
|
61
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* A mock page or component, captured so refine can answer
|
|
65
|
+
* "match the mock" without making the PM cite paths.
|
|
66
|
+
*
|
|
67
|
+
* 0.19.0-α.23 — added because real PM issues describe user pain
|
|
68
|
+
* ("registration should look like the mock"), and the indexer
|
|
69
|
+
* previously only saw production `src/`. Refine then either
|
|
70
|
+
* hallucinated a design or had to ask. Surfacing mock files in
|
|
71
|
+
* context closes the loop: PM says "as mock" → refine reads the
|
|
72
|
+
* actual mock excerpt → spec mirrors it.
|
|
73
|
+
*
|
|
74
|
+
* The excerpt is bounded to the first ~1.5KB so refine's prompt
|
|
75
|
+
* doesn't blow up on a 5KB mock file.
|
|
76
|
+
*/
|
|
77
|
+
export interface MockEntry {
|
|
78
|
+
/** repo-relative path. */
|
|
79
|
+
file: string;
|
|
80
|
+
/** Route inferred from app/router-shape file location, or null for components. */
|
|
81
|
+
route: string | null;
|
|
82
|
+
/** Component or page name (best-effort extraction, falls back to file basename). */
|
|
83
|
+
name: string;
|
|
84
|
+
/** First ~1500 chars of the file (after trimming whitespace) so refine sees the actual JSX/markup. */
|
|
85
|
+
excerpt: string;
|
|
86
|
+
}
|
|
62
87
|
export interface HistoryIndex {
|
|
63
88
|
generated_at: string;
|
|
64
89
|
generator: "slowcook-refine-history-index@0.17.0";
|
|
@@ -67,6 +92,14 @@ export interface HistoryIndex {
|
|
|
67
92
|
migrations: MigrationEntry[];
|
|
68
93
|
test_helpers: TestHelperEntry[];
|
|
69
94
|
test_files: TestFileEntry[];
|
|
95
|
+
/** 0.19.0-α.23 — mock surface (design source-of-truth). */
|
|
96
|
+
mock_surface: MockEntry[];
|
|
97
|
+
/**
|
|
98
|
+
* 0.19.0-α.43 — git-history attention layer. Set when enrichment ran
|
|
99
|
+
* (refine emits with it on by default; pure-filesystem callers / tests
|
|
100
|
+
* may leave it undefined). See git-attention.ts for the four sub-signals.
|
|
101
|
+
*/
|
|
102
|
+
git_attention?: GitAttentionData;
|
|
70
103
|
}
|
|
71
104
|
interface BuildOptions {
|
|
72
105
|
repoRoot: string;
|
|
@@ -77,8 +110,41 @@ interface BuildOptions {
|
|
|
77
110
|
migrations?: string;
|
|
78
111
|
tests?: string;
|
|
79
112
|
helpers?: string;
|
|
113
|
+
/** Default: `mock/src` (matches slowcook init scaffold). */
|
|
114
|
+
mockRoot?: string;
|
|
80
115
|
};
|
|
81
116
|
}
|
|
82
117
|
export declare function buildHistoryIndex(opts: BuildOptions): HistoryIndex;
|
|
118
|
+
export declare const TYPEORM_MIGRATION_FALLBACK_DIRS: string[];
|
|
119
|
+
/**
|
|
120
|
+
* The columns `DatabaseCreateTable` (delgoosh's helper) adds implicitly on
|
|
121
|
+
* EVERY table. Knowing these prevents the migration gate from raising a
|
|
122
|
+
* false-positive "missing column" verdict when the spec references e.g.
|
|
123
|
+
* `created_at` and the migration uses the helper.
|
|
124
|
+
*
|
|
125
|
+
* Kept conservative: only columns added by the helper at delgoosh-monorepo's
|
|
126
|
+
* version (id, created_at, updated_at, deleted_at). Future TypeORM helpers
|
|
127
|
+
* with different defaults need their own entry — or, longer-term, slowcook
|
|
128
|
+
* should infer this from the helper's source.
|
|
129
|
+
*/
|
|
130
|
+
export declare const TYPEORM_HELPER_IMPLICIT_COLUMNS: string[];
|
|
131
|
+
export declare function scanMigrations(repoRoot: string, dir: string): MigrationEntry[];
|
|
132
|
+
/**
|
|
133
|
+
* Parse a single TypeORM migration TS file into the same MigrationEntry shape
|
|
134
|
+
* the SQL parser produces. Sees two patterns:
|
|
135
|
+
*
|
|
136
|
+
* 1. `await queryRunner.query(\`CREATE TABLE x ...\`)` — extract the SQL
|
|
137
|
+
* template body and run it through the existing SQL parsers.
|
|
138
|
+
* 2. `await DatabaseCreateTable(queryRunner, 'tbl', [{name:'a'},{name:'b'}])`
|
|
139
|
+
* — extract `tbl` + each column's name + the implicit-columns helpers
|
|
140
|
+
* add (id, created_at, updated_at, deleted_at).
|
|
141
|
+
*
|
|
142
|
+
* Pattern 2 is delgoosh-monorepo-specific; pattern 1 covers raw SQL writers.
|
|
143
|
+
* EXPORTED for unit testing.
|
|
144
|
+
*/
|
|
145
|
+
export declare function parseTypeOrmMigration(name: string, body: string): MigrationEntry;
|
|
146
|
+
export declare function extractCreateTables(sql: string): string[];
|
|
147
|
+
export declare function extractColumnsAdded(sql: string): Record<string, string[]>;
|
|
148
|
+
export declare function scanMockSurface(repoRoot: string, mockRoot: string): MockEntry[];
|
|
83
149
|
export {};
|
|
84
150
|
//# sourceMappingURL=history-index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history-index.d.ts","sourceRoot":"","sources":["../../../src/commands/refine/history-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"history-index.d.ts","sourceRoot":"","sources":["../../../src/commands/refine/history-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,WAAW,cAAc;IAC7B,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,KAAK,EAAE,MAA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