/** * `slowcook refresh-knowledge` — α.62 * * Rebuilds `.brewing/repo-knowledge/auto/*.md` digests so refine (and any * other agent) reads the consumer repo's actual shape instead of * re-deriving it via LLM every run. * * Caching policy (three classes): * 1. Cheap deterministic extractions (all of α.62: pure regex/AST, * <2s per file). Just rebuild every time. No hash machinery. * * 2. Expensive deterministic extractions (e.g., git-history mining * in α.63 — walking 500 commits to extract conventions). Stamp * output with `` * and resume from the stamped SHA on the next run (delta mining). * * 3. Expensive INSIGHTS (LLM-derived chef known-fixes, lesson * extractions, PR summaries). These do NOT auto-invalidate on * commit change — the insight is about a CLASS of problem, not * a snapshot of code. An insight like "vitest/config not found * means deps missing" stays true even if vitest.config.ts moves. * Staleness is a SOFT signal: * - Each insight carries `evidence-pr: N` + `last-verified: ISO` * - `slowcook knowledge verify` may flag [PRECARIOUS] when the * evidence file is substantially rewritten, but does NOT * delete. Agents reading insights see staleness as weight, * not as a gate. * α.62 has no insight extractions yet; this comment locks the * design for α.63+ to follow. * * Output layout (gitignored by convention): * .brewing/repo-knowledge/auto/ * ├── backend-entities.md (TypeORM @Entity classes + columns) * ├── backend-routes.md (HTTP controllers + handler names) * ├── backend-enums.md (packages/enums/src/*.enum.ts values) * ├── frontend-types.md (mock/src/types/*.ts interfaces) * ├── frontend-components.md (mock/src/{app,components}/**.tsx) * ├── frontend-contexts.md (mock/src/contexts/*-context.tsx hooks) * ├── tokens.md (Tailwind brand-token vocabulary) * ├── config.md (tsconfig paths + workspace + scripts) * ├── aliases.md (every tsconfig + vite/vitest path alias) * ├── migrations.md (migration file timestamps + table names) * └── routes-inventory.md (filesystem-derived route URLs) * * Refine (`refine/context.ts`) reads these from disk and concatenates * them. If the dir doesn't exist (first run), refine falls back to the * legacy in-memory scan (α.61 readNestJsBackendDigest). */ /** * Build one digest. Cheap extractions class — always rebuilds. */ export declare function buildDigest(args: { repoRoot: string; name: string; inputFiles: string[]; build: (inputs: string[]) => string; }): { body: string; built: boolean; }; export declare function buildBackendEntitiesDigest(repoRoot: string): { body: string; built: boolean; }; export declare function buildBackendRoutesDigest(repoRoot: string): { body: string; built: boolean; }; /** * Parse the values out of an `export enum { … }` body. * * Strips JSDoc block comments + line comments first, then splits on * commas. Without the strip, enums whose every value is preceded by * a JSDoc block (a common convention in the consumer's * `packages/enums/src/*.enum.ts`) would yield zero parsed values — * the JSDoc text leaks into the identifier slot, fails the * uppercase-only filter, and the whole enum drops from the digest. * * Exported for testing. */ export declare function parseEnumValues(enumBody: string): string[]; export declare function buildBackendEnumsDigest(repoRoot: string): { body: string; built: boolean; }; export declare function buildFrontendTypesDigest(repoRoot: string): { body: string; built: boolean; }; export declare function buildFrontendComponentsDigest(repoRoot: string): { body: string; built: boolean; }; export declare function buildFrontendContextsDigest(repoRoot: string): { body: string; built: boolean; }; export declare function buildTailwindTokensDigest(repoRoot: string): { body: string; built: boolean; }; export declare function buildConfigDigest(repoRoot: string): { body: string; built: boolean; }; /** * Parse a tsconfig.json body's `compilerOptions.paths` map. * Strips JSON-with-comments before parsing (tsconfig allows * `//` and `/* … *​/` per spec). Returns `{}` on parse failure. * * Exported for testing. */ export declare function parseTsconfigPaths(body: string): Record; /** * Regex-extract `resolve.alias` keys + (best-effort) target hints from * a vite / vitest config body. The config is TS code and not safely * parseable here; we capture the common literal-object form: * * resolve: { alias: { "@": path.join(root, "src"), … } } * * Returns `Array<{ alias: string; targetHint: string }>` where * `targetHint` is the raw RHS text (e.g., `path.join(root, "src")`). * Agents reading the digest can interpret the hint contextually. * * Exported for testing. */ export declare function parseViteAliases(body: string): Array<{ alias: string; targetHint: string; }>; /** * Walks the workspace for tsconfig + vite/vitest configs and emits a * single `aliases.md` listing every `@whatever`-style alias and what * it resolves to in EACH context. * * Motivation: in a monorepo the same alias (e.g. `@/`) often means * different things in different directories — root vitest config may * map `@/` to root `src/`, mock workspace's tsconfig may map `@/` to * `mock/src/`, and each Next.js app's tsconfig maps `@/` to its own * `apps//src/`. Without a digest, agents see `@/foo/bar` in a * file and can't tell which root it resolves against — they read the * config file by hand on every cold start. (Surfaced in * delgoosh/monorepo as a brew-vs-testgen path divergence.) */ export declare function buildAliasesDigest(repoRoot: string): { body: string; built: boolean; }; export declare function buildMigrationsDigest(repoRoot: string): { body: string; built: boolean; }; export declare function buildRoutesInventoryDigest(repoRoot: string): { body: string; built: boolean; }; export interface RefreshKnowledgeResult { built: string[]; skippedEmpty: string[]; outDir: string; } export declare function refreshKnowledgeAuto(repoRoot: string, opts?: { only?: string; }): RefreshKnowledgeResult; /** * CLI entry point. Called from cli.ts. * * Default behavior (no mode flag) = run both --auto and --mine-history, * since they target different output dirs and have no overlap. Either * mode can be requested individually with the explicit flag. */ export declare function refreshKnowledge(argv: string[]): Promise; export interface MineHistoryResult { outDir: string; built: string[]; commitsProcessed: number; deltaFromSha: string | null; } export declare function refreshKnowledgeMineHistory(repoRoot: string, opts?: { maxCommits?: number; full?: boolean; }): MineHistoryResult; //# sourceMappingURL=refresh-knowledge.d.ts.map