@slowcook-ai/cli 0.19.0-alpha.14 → 0.19.0-alpha.17

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.
@@ -0,0 +1,79 @@
1
+ /**
2
+ * 0.19.0-α.15 — `slowcook garnish` trailer helpers.
3
+ *
4
+ * When a human (or another agent) commits a tweak on top of an agent's
5
+ * work, we mark the commit with `Tweaks-output-of:` git trailer lines —
6
+ * one per file the tweak touched, naming the upstream agent + sha. A
7
+ * future `slowcook reflect` command mines these trailers to surface
8
+ * learning signal for the upstream agent (eval-set fixtures, prompt
9
+ * amendment candidates, drift catalogs).
10
+ *
11
+ * Trailer format (one line per file):
12
+ *
13
+ * Tweaks-output-of: agent=<name> sha=<commit-sha> file=<repo-relative-path>
14
+ *
15
+ * Examples:
16
+ * Tweaks-output-of: agent=vibe sha=a7df238 file=mock/src/components/Foo.tsx
17
+ * Tweaks-output-of: agent=plate sha=00905ae file=mock/src/components/Bar.tsx
18
+ *
19
+ * Pure module — no IO. Caller composes the trailer lines into the commit
20
+ * message and runs git separately.
21
+ */
22
+ export interface UpstreamRef {
23
+ /** Upstream agent name (vibe / plate / brew / chef / etc). */
24
+ agent: string;
25
+ /** Upstream commit SHA (short or full; renderer trims to 7). */
26
+ sha: string;
27
+ /** Repo-relative file path the tweak touched. */
28
+ file: string;
29
+ }
30
+ /**
31
+ * Format a list of upstream refs into trailer lines (one per ref).
32
+ * Pure: returns a single string with `\n` separators, no leading or
33
+ * trailing newline. Caller appends to the commit-message body.
34
+ */
35
+ export declare function formatTrailer(refs: UpstreamRef[]): string;
36
+ /**
37
+ * Parse a single trailer line, returning the parsed ref or null if the
38
+ * line doesn't match the expected shape. Tolerates leading/trailing
39
+ * whitespace + the optional " " indent some `git interpret-trailers`
40
+ * outputs add.
41
+ */
42
+ export declare function parseTrailerLine(line: string): UpstreamRef | null;
43
+ /**
44
+ * Parse all `Tweaks-output-of:` trailers from a full commit-message
45
+ * body (multi-line). Returns refs in the order they appeared.
46
+ */
47
+ export declare function parseTrailers(commitBody: string): UpstreamRef[];
48
+ /**
49
+ * Inspect a git author line + return the upstream agent name, if the
50
+ * author follows slowcook's agent convention. Otherwise null.
51
+ *
52
+ * Conventions detected:
53
+ * slowcook-vibe[bot] → "vibe"
54
+ * slowcook-plate[bot] → "plate"
55
+ * slowcook-brew[bot] → "brew"
56
+ * slowcook-chef[bot] → "chef"
57
+ * slowcook-refine[bot] → "refine"
58
+ * slowcook-testgen[bot] → "testgen"
59
+ * slowcook-recipe[bot] → "recipe"
60
+ * anything else → null (human or unrelated bot)
61
+ *
62
+ * Pure: no IO. Caller pipes git author through it.
63
+ */
64
+ export declare function agentFromAuthor(author: string): string | null;
65
+ /**
66
+ * Compose the full commit message body for a garnish commit: a one-line
67
+ * subject naming the touched files, a blank line, optional user-provided
68
+ * body, a blank line, then the trailer block.
69
+ *
70
+ * Pure: caller passes the staged-file list + the parsed upstream refs +
71
+ * the optional user message. Returns the body string ready for `git
72
+ * commit -F`.
73
+ */
74
+ export declare function composeCommitMessage(args: {
75
+ touchedFiles: string[];
76
+ upstreamRefs: UpstreamRef[];
77
+ userMessage?: string;
78
+ }): string;
79
+ //# sourceMappingURL=trailer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trailer.d.ts","sourceRoot":"","sources":["../../../src/commands/garnish/trailer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,WAAW;IAC1B,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,MAAM,CAIzD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAYjE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,EAAE,CAO/D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,MAAM,CAUT"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * 0.19.0-α.15 — `slowcook garnish` trailer helpers.
3
+ *
4
+ * When a human (or another agent) commits a tweak on top of an agent's
5
+ * work, we mark the commit with `Tweaks-output-of:` git trailer lines —
6
+ * one per file the tweak touched, naming the upstream agent + sha. A
7
+ * future `slowcook reflect` command mines these trailers to surface
8
+ * learning signal for the upstream agent (eval-set fixtures, prompt
9
+ * amendment candidates, drift catalogs).
10
+ *
11
+ * Trailer format (one line per file):
12
+ *
13
+ * Tweaks-output-of: agent=<name> sha=<commit-sha> file=<repo-relative-path>
14
+ *
15
+ * Examples:
16
+ * Tweaks-output-of: agent=vibe sha=a7df238 file=mock/src/components/Foo.tsx
17
+ * Tweaks-output-of: agent=plate sha=00905ae file=mock/src/components/Bar.tsx
18
+ *
19
+ * Pure module — no IO. Caller composes the trailer lines into the commit
20
+ * message and runs git separately.
21
+ */
22
+ /**
23
+ * Format a list of upstream refs into trailer lines (one per ref).
24
+ * Pure: returns a single string with `\n` separators, no leading or
25
+ * trailing newline. Caller appends to the commit-message body.
26
+ */
27
+ export function formatTrailer(refs) {
28
+ return refs
29
+ .map((r) => `Tweaks-output-of: agent=${r.agent} sha=${r.sha.slice(0, 7)} file=${r.file}`)
30
+ .join("\n");
31
+ }
32
+ /**
33
+ * Parse a single trailer line, returning the parsed ref or null if the
34
+ * line doesn't match the expected shape. Tolerates leading/trailing
35
+ * whitespace + the optional " " indent some `git interpret-trailers`
36
+ * outputs add.
37
+ */
38
+ export function parseTrailerLine(line) {
39
+ const trimmed = line.trim();
40
+ if (!trimmed.startsWith("Tweaks-output-of:"))
41
+ return null;
42
+ const body = trimmed.slice("Tweaks-output-of:".length).trim();
43
+ // body looks like: "agent=vibe sha=abc1234 file=mock/src/X.tsx"
44
+ // file= may contain spaces in the rare case of weird paths; capture
45
+ // greedily as the last field.
46
+ const m = body.match(/^agent=(\S+)\s+sha=(\S+)\s+file=(.+)$/);
47
+ if (!m)
48
+ return null;
49
+ const [, agent, sha, file] = m;
50
+ if (!agent || !sha || !file)
51
+ return null;
52
+ return { agent, sha, file };
53
+ }
54
+ /**
55
+ * Parse all `Tweaks-output-of:` trailers from a full commit-message
56
+ * body (multi-line). Returns refs in the order they appeared.
57
+ */
58
+ export function parseTrailers(commitBody) {
59
+ const out = [];
60
+ for (const line of commitBody.split("\n")) {
61
+ const ref = parseTrailerLine(line);
62
+ if (ref)
63
+ out.push(ref);
64
+ }
65
+ return out;
66
+ }
67
+ /**
68
+ * Inspect a git author line + return the upstream agent name, if the
69
+ * author follows slowcook's agent convention. Otherwise null.
70
+ *
71
+ * Conventions detected:
72
+ * slowcook-vibe[bot] → "vibe"
73
+ * slowcook-plate[bot] → "plate"
74
+ * slowcook-brew[bot] → "brew"
75
+ * slowcook-chef[bot] → "chef"
76
+ * slowcook-refine[bot] → "refine"
77
+ * slowcook-testgen[bot] → "testgen"
78
+ * slowcook-recipe[bot] → "recipe"
79
+ * anything else → null (human or unrelated bot)
80
+ *
81
+ * Pure: no IO. Caller pipes git author through it.
82
+ */
83
+ export function agentFromAuthor(author) {
84
+ const m = author.match(/^slowcook-([a-z][\w-]*)\[bot\]$/);
85
+ if (!m)
86
+ return null;
87
+ return m[1];
88
+ }
89
+ /**
90
+ * Compose the full commit message body for a garnish commit: a one-line
91
+ * subject naming the touched files, a blank line, optional user-provided
92
+ * body, a blank line, then the trailer block.
93
+ *
94
+ * Pure: caller passes the staged-file list + the parsed upstream refs +
95
+ * the optional user message. Returns the body string ready for `git
96
+ * commit -F`.
97
+ */
98
+ export function composeCommitMessage(args) {
99
+ const subject = `[garnish] ${formatTouchedFilesSummary(args.touchedFiles)}`;
100
+ const parts = [subject, ""];
101
+ if (args.userMessage && args.userMessage.trim().length > 0) {
102
+ parts.push(args.userMessage.trim(), "");
103
+ }
104
+ if (args.upstreamRefs.length > 0) {
105
+ parts.push(formatTrailer(args.upstreamRefs));
106
+ }
107
+ return parts.join("\n");
108
+ }
109
+ function formatTouchedFilesSummary(files) {
110
+ if (files.length === 0)
111
+ return "(no files)";
112
+ if (files.length === 1)
113
+ return files[0];
114
+ if (files.length === 2)
115
+ return `${files[0]} + ${files[1]}`;
116
+ return `${files[0]} + ${files.length - 1} more`;
117
+ }
118
+ //# sourceMappingURL=trailer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trailer.js","sourceRoot":"","sources":["../../../src/commands/garnish/trailer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAWH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,IAAmB;IAC/C,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,2BAA2B,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;SACxF,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,mBAAmB,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aAAa,IAAI,MAAM,CA0CtC;AAGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAehE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAQjE;AAED,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,IAAI,MAAM,CA2CtC;AAED;;;;;;GAMG;AACH;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAsDvC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAwBzC"}
@@ -320,10 +320,18 @@ export function gitignoreSection() {
320
320
  .brewing/code-map.json
321
321
  .brewing/code-map.md
322
322
  .brewing/code-map.target.md
323
- # 0.13.5+ — brownfield extracts (schema.mmd, tokens.md). Same
324
- # rationale: regenerated each refine/investigate workflow run via
325
- # \`slowcook extract\`. Live as derived state, not in source control.
326
- .brewing/diagrams/
323
+ # 0.13.5+ — brownfield extracts under .brewing/diagrams/. Ephemeral
324
+ # files (schema.mmd, tokens.md) are regenerated each refine/investigate
325
+ # workflow run via \`slowcook extract\` and SHOULD NOT be committed.
326
+ # Hand-curated artifacts (entities.md, architecture.md, etc.) are
327
+ # source-of-truth and SHOULD be tracked — \`!\` exceptions below
328
+ # whitelist them. The \`/*\` form (vs trailing slash) is required for
329
+ # the !-overrides to take effect.
330
+ .brewing/diagrams/*
331
+ !.brewing/diagrams/entities.md
332
+ !.brewing/diagrams/architecture.md
333
+ !.brewing/diagrams/sequence-*.md
334
+ !.brewing/diagrams/.gitkeep
327
335
  ${SLOWCOOK_GITIGNORE_MARKER_END}
328
336
  `;
329
337
  }
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/commands/init/templates.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sDAAsD;AAEtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAC;AAEjD;;;;GAIG;AACH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AK;kCACZ,MAAM,CAAC,KAAK;8CACA,MAAM,CAAC,KAAK;8CACZ,MAAM,CAAC,KAAK;8CACZ,MAAM,CAAC,KAAK;8CACZ,MAAM,CAAC,KAAK;EACxD,8BAA8B;CAC/B,CAAC;AACF,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACvD,qEAAqE;IACrE,OAAO;;;;;EAKP,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCR,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDR,CAAC;AACF,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,GAAG,+BAA+B;;;;;;;;;;;;;;;;;;;;;EAqBzC,6BAA6B;CAC9B,CAAC;AACF,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * 0.19.0+ (slowcook#36) — TypeORM entity-graph extractor. Walks all
3
+ * `**\/*.entity.ts` files containing `@Entity(...)` decorators and emits
4
+ * a Mermaid ERD + per-entity summary table to
5
+ * `.brewing/diagrams/entities.md`.
6
+ *
7
+ * Why: slowcook's existing `emitSchemaDiagram` only knows about
8
+ * `supabase/migrations/*.sql`. Consumers on TypeORM (delgoosh, plus
9
+ * any NestJS monorepo) get nothing from the brownfield-extract step,
10
+ * leaving their slowcook agents (vibe / recipe / brew / chef /
11
+ * investigate) without entity grounding. Hand-curated entities.md
12
+ * is the workaround — this module replaces it with auto-extraction.
13
+ *
14
+ * Detection signal: any `*.entity.ts` file with `@Entity(` decorator.
15
+ * (Skips `node_modules`, `dist`, `.next`, `coverage`.)
16
+ *
17
+ * Parser is regex-based — TypeORM decorators have a strict shape
18
+ * across the ecosystem. Same approach as `ddlToMermaidErd` in
19
+ * refine/mermaid.ts; no AST tooling needed.
20
+ */
21
+ export interface TypeOrmColumn {
22
+ /** TS property name (camelCase). */
23
+ property: string;
24
+ /** SQL column name (snake_case, from `@Column({ name: 'snake_case' })`). */
25
+ columnName?: string;
26
+ /** TypeORM column type ('uuid', 'text', 'enum', 'jsonb', etc.). */
27
+ columnType?: string;
28
+ /** Whether the column is nullable. */
29
+ nullable?: boolean;
30
+ /** TS type from the property declaration (for context). */
31
+ tsType?: string;
32
+ /** JSDoc COLUMN-DESCRIPTION text, if present. */
33
+ description?: string;
34
+ }
35
+ export interface TypeOrmRelation {
36
+ /** TS property name on the entity. */
37
+ property: string;
38
+ /** Relation kind. */
39
+ kind: "ManyToOne" | "OneToOne" | "OneToMany" | "ManyToMany";
40
+ /** Target entity class name (the `() => User` part). */
41
+ target: string;
42
+ /** Optional foreign-key column name from @JoinColumn. */
43
+ joinColumn?: string;
44
+ }
45
+ export interface TypeOrmEntity {
46
+ /** Class name (PascalCase). */
47
+ className: string;
48
+ /** SQL table name from `@Entity('table_name')`. Falls back to class name in snake_case if missing. */
49
+ tableName: string;
50
+ /** Whether the class `extends BaseEntity`. */
51
+ extendsBaseEntity: boolean;
52
+ /** Repo-relative path to the source file. */
53
+ sourcePath: string;
54
+ /** JSDoc TABLE-DESCRIPTION text, if present. */
55
+ description?: string;
56
+ columns: TypeOrmColumn[];
57
+ relations: TypeOrmRelation[];
58
+ }
59
+ /**
60
+ * Recursive walk under `root` collecting absolute file paths matching
61
+ * the predicate. Skips EXCLUDED_DIRS at any depth.
62
+ */
63
+ declare function walk(root: string, predicate: (path: string) => boolean): string[];
64
+ /**
65
+ * Find all `*.entity.ts` files under `repoRoot` whose content contains
66
+ * an `@Entity(` decorator. Returns paths sorted alphabetically for
67
+ * deterministic output.
68
+ */
69
+ export declare function findEntityFiles(repoRoot: string): string[];
70
+ /**
71
+ * Parse one TypeORM entity source file. Returns null if no `@Entity`
72
+ * decorator is found (defense-in-depth — findEntityFiles already
73
+ * filtered).
74
+ */
75
+ export declare function parseEntityFile(source: string, sourcePath: string): TypeOrmEntity | null;
76
+ /**
77
+ * Render one Mermaid `erDiagram` covering all entities + their
78
+ * relations. For very large graphs (>40 entities) the diagram is hard
79
+ * to read — but splitting by domain requires semantic knowledge we
80
+ * don't have. We render one big ERD; consumers can grep for entities
81
+ * they care about + use the per-entity table below for details.
82
+ */
83
+ export declare function entitiesToMermaidErd(entities: TypeOrmEntity[]): string;
84
+ /**
85
+ * Render the per-entity summary table for the entities.md artifact.
86
+ * Pairs with the Mermaid ERD above to give agents structured access
87
+ * to the entity vocabulary.
88
+ */
89
+ export declare function entitiesToSummaryTable(entities: TypeOrmEntity[]): string;
90
+ /**
91
+ * Full entities.md document body. Static header + conventions section
92
+ * (drawn from delgoosh dogfood — these are the same conventions every
93
+ * NestJS+TypeORM consumer follows) + the ERD + summary table.
94
+ */
95
+ export declare function renderEntitiesMarkdown(entities: TypeOrmEntity[]): string;
96
+ /**
97
+ * Public entry — walks the repo, parses entities, returns the rendered
98
+ * markdown body PLUS counts for the caller (which writes the file).
99
+ * Skipped silently if no .entity.ts files with @Entity are found —
100
+ * consumer probably uses Prisma / Drizzle / Supabase / raw SQL.
101
+ */
102
+ export declare function buildEntitiesArtifact(repoRoot: string): {
103
+ written: boolean;
104
+ body?: string;
105
+ entityCount?: number;
106
+ relationCount?: number;
107
+ fileCount?: number;
108
+ skippedReason?: string;
109
+ };
110
+ export declare const __testOnly__: {
111
+ parseEntityFile: typeof parseEntityFile;
112
+ walk: typeof walk;
113
+ entitiesToMermaidErd: typeof entitiesToMermaidErd;
114
+ entitiesToSummaryTable: typeof entitiesToSummaryTable;
115
+ };
116
+ export {};
117
+ //# sourceMappingURL=emit-typeorm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit-typeorm.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