ricord 1.0.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/LICENSE +21 -0
- package/README.md +213 -0
- package/commands/ricord-flush.md +29 -0
- package/commands/ricord-init.md +129 -0
- package/commands/ricord-lint.md +64 -0
- package/commands/ricord-query.md +71 -0
- package/dist/cli/auth.d.ts +16 -0
- package/dist/cli/auth.js +42 -0
- package/dist/cli/auth.js.map +1 -0
- package/dist/cli/bundle.d.ts +25 -0
- package/dist/cli/bundle.js +179 -0
- package/dist/cli/bundle.js.map +1 -0
- package/dist/cli/cache.d.ts +18 -0
- package/dist/cli/cache.js +39 -0
- package/dist/cli/cache.js.map +1 -0
- package/dist/cli/cli.d.ts +21 -0
- package/dist/cli/cli.js +355 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/client.d.ts +12 -0
- package/dist/cli/client.js +35 -0
- package/dist/cli/client.js.map +1 -0
- package/dist/cli/commands/build.d.ts +44 -0
- package/dist/cli/commands/build.js +437 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/curate.d.ts +32 -0
- package/dist/cli/commands/curate.js +154 -0
- package/dist/cli/commands/curate.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +16 -0
- package/dist/cli/commands/doctor.js +92 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/ingest.d.ts +25 -0
- package/dist/cli/commands/ingest.js +121 -0
- package/dist/cli/commands/ingest.js.map +1 -0
- package/dist/cli/commands/install.d.ts +16 -0
- package/dist/cli/commands/install.js +82 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/pull.d.ts +24 -0
- package/dist/cli/commands/pull.js +104 -0
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/commands/push.d.ts +28 -0
- package/dist/cli/commands/push.js +164 -0
- package/dist/cli/commands/push.js.map +1 -0
- package/dist/cli/commands/rollup.d.ts +21 -0
- package/dist/cli/commands/rollup.js +118 -0
- package/dist/cli/commands/rollup.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +7 -0
- package/dist/cli/commands/setup.js +43 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +15 -0
- package/dist/cli/commands/sync.js +63 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +17 -0
- package/dist/cli/commands/watch.js +87 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/config.d.ts +29 -0
- package/dist/cli/config.js +52 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/extract.d.ts +101 -0
- package/dist/cli/extract.js +216 -0
- package/dist/cli/extract.js.map +1 -0
- package/dist/cli/ingest.d.ts +48 -0
- package/dist/cli/ingest.js +74 -0
- package/dist/cli/ingest.js.map +1 -0
- package/dist/cli/ledger.d.ts +44 -0
- package/dist/cli/ledger.js +67 -0
- package/dist/cli/ledger.js.map +1 -0
- package/dist/cli/llm.d.ts +21 -0
- package/dist/cli/llm.js +138 -0
- package/dist/cli/llm.js.map +1 -0
- package/dist/cli/parse.d.ts +13 -0
- package/dist/cli/parse.js +188 -0
- package/dist/cli/parse.js.map +1 -0
- package/dist/cli/run-explore.d.ts +56 -0
- package/dist/cli/run-explore.js +229 -0
- package/dist/cli/run-explore.js.map +1 -0
- package/dist/cli/summarize.d.ts +15 -0
- package/dist/cli/summarize.js +49 -0
- package/dist/cli/summarize.js.map +1 -0
- package/dist/cli/uninstall.d.ts +6 -0
- package/dist/cli/uninstall.js +277 -0
- package/dist/cli/uninstall.js.map +1 -0
- package/dist/cli/walk.d.ts +13 -0
- package/dist/cli/walk.js +62 -0
- package/dist/cli/walk.js.map +1 -0
- package/dist/cli/walker.d.ts +14 -0
- package/dist/cli/walker.js +120 -0
- package/dist/cli/walker.js.map +1 -0
- package/dist/hooks/pre-compact.d.ts +15 -0
- package/dist/hooks/pre-compact.js +127 -0
- package/dist/hooks/pre-compact.js.map +1 -0
- package/dist/hooks/pre-tool-use.d.ts +15 -0
- package/dist/hooks/pre-tool-use.js +25 -0
- package/dist/hooks/pre-tool-use.js.map +1 -0
- package/dist/hooks/session-end.d.ts +21 -0
- package/dist/hooks/session-end.js +186 -0
- package/dist/hooks/session-end.js.map +1 -0
- package/dist/hooks/session-start.d.ts +15 -0
- package/dist/hooks/session-start.js +233 -0
- package/dist/hooks/session-start.js.map +1 -0
- package/dist/hooks/turn-end-post.d.ts +17 -0
- package/dist/hooks/turn-end-post.js +66 -0
- package/dist/hooks/turn-end-post.js.map +1 -0
- package/dist/hooks/turn-end.d.ts +29 -0
- package/dist/hooks/turn-end.js +295 -0
- package/dist/hooks/turn-end.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +1547 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +45 -0
- package/dist/init.js +839 -0
- package/dist/init.js.map +1 -0
- package/dist/lib/active-project.d.ts +14 -0
- package/dist/lib/active-project.js +65 -0
- package/dist/lib/active-project.js.map +1 -0
- package/dist/lib/buffer.d.ts +34 -0
- package/dist/lib/buffer.js +79 -0
- package/dist/lib/buffer.js.map +1 -0
- package/dist/scripts/compile.d.ts +25 -0
- package/dist/scripts/compile.js +185 -0
- package/dist/scripts/compile.js.map +1 -0
- package/dist/scripts/config.d.ts +30 -0
- package/dist/scripts/config.js +68 -0
- package/dist/scripts/config.js.map +1 -0
- package/dist/scripts/flush.d.ts +23 -0
- package/dist/scripts/flush.js +230 -0
- package/dist/scripts/flush.js.map +1 -0
- package/dist/scripts/lint.d.ts +21 -0
- package/dist/scripts/lint.js +242 -0
- package/dist/scripts/lint.js.map +1 -0
- package/dist/scripts/utils.d.ts +43 -0
- package/dist/scripts/utils.js +165 -0
- package/dist/scripts/utils.js.map +1 -0
- package/package.json +74 -0
- package/scripts/postinstall.mjs +56 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { walkRepo } from "./walker.js";
|
|
4
|
+
import { buildBundle, invertUsedBy, renderBundleForPrompt } from "./bundle.js";
|
|
5
|
+
import { bundleAsSummary } from "./summarize.js";
|
|
6
|
+
import { SummaryCache } from "./cache.js";
|
|
7
|
+
import { fetchExtractionPrompt, fetchUsage, makeLlmFn, postExtracted, resolveLlmConfig, runExtraction, } from "./extract.js";
|
|
8
|
+
/**
|
|
9
|
+
* Walk a repo, summarize each meaningful directory mechanically, run client-
|
|
10
|
+
* side LLM extraction, and POST structured anchors/connections/tasks to
|
|
11
|
+
* /v1/ingest/extracted. Powers `ricord init`.
|
|
12
|
+
*
|
|
13
|
+
* Post-2026-05-12 the server runs zero generative LLM calls — extraction
|
|
14
|
+
* happens here. The caller must provide an LLM key (OPENAI_API_KEY or
|
|
15
|
+
* ANTHROPIC_API_KEY by default, or --llm-key/--llm-model overrides).
|
|
16
|
+
*
|
|
17
|
+
* Progress is streamed via the `log` callback so the CLI can write to stdout.
|
|
18
|
+
*/
|
|
19
|
+
export async function runExplore(opts, log) {
|
|
20
|
+
const root = path.resolve(opts.root);
|
|
21
|
+
const summariesDir = opts.summariesDir ?? path.join(root, ".ricord-cache", "summaries");
|
|
22
|
+
const result = {
|
|
23
|
+
ok: true,
|
|
24
|
+
root,
|
|
25
|
+
bundlesFound: 0,
|
|
26
|
+
meaningful: 0,
|
|
27
|
+
processed: 0,
|
|
28
|
+
cached: 0,
|
|
29
|
+
failed: 0,
|
|
30
|
+
ingested: 0,
|
|
31
|
+
totalChars: 0,
|
|
32
|
+
totalExports: 0,
|
|
33
|
+
totalImports: 0,
|
|
34
|
+
totalAnchors: 0,
|
|
35
|
+
totalConnections: 0,
|
|
36
|
+
totalTasks: 0,
|
|
37
|
+
topDirsByUsedBy: [],
|
|
38
|
+
summariesDir,
|
|
39
|
+
};
|
|
40
|
+
// Resolve LLM up front so we fail fast if the user has no key.
|
|
41
|
+
// --emit-bundles mode skips the LLM entirely: the host agent (Claude Code,
|
|
42
|
+
// Codex, etc.) reads the manifest and drives extraction itself.
|
|
43
|
+
const willIngest = !opts.dryRun && !opts.noIngest && !opts.emitBundles && !!opts.ricordToken;
|
|
44
|
+
let llmCfg = null;
|
|
45
|
+
if (willIngest) {
|
|
46
|
+
try {
|
|
47
|
+
llmCfg = resolveLlmConfig({ modelFlag: opts.llmModel, keyFlag: opts.llmKey });
|
|
48
|
+
result.llm = { provider: llmCfg.provider, model: llmCfg.model };
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
52
|
+
result.ok = false;
|
|
53
|
+
result.errorReason = msg;
|
|
54
|
+
log(`ERROR: ${msg}`);
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
log("▸ Walking repo…");
|
|
59
|
+
const groups = await walkRepo(root);
|
|
60
|
+
result.bundlesFound = groups.length;
|
|
61
|
+
log(` found ${groups.length} dirs with ingestable files`);
|
|
62
|
+
log("▸ Parsing files + building bundles…");
|
|
63
|
+
const bundles = [];
|
|
64
|
+
for (const g of groups)
|
|
65
|
+
bundles.push(await buildBundle(g, root));
|
|
66
|
+
invertUsedBy(bundles);
|
|
67
|
+
const meaningful = bundles.filter(b => b.parsedFiles.length > 0 || b.readme || b.fileTree.split("\n").length > 1);
|
|
68
|
+
result.meaningful = meaningful.length;
|
|
69
|
+
log(` ${meaningful.length} meaningful dirs (after filtering empty)`);
|
|
70
|
+
const target = opts.limit ? meaningful.slice(0, opts.limit) : meaningful;
|
|
71
|
+
for (const b of target) {
|
|
72
|
+
result.totalChars += renderBundleForPrompt(b).length;
|
|
73
|
+
result.totalExports += b.parsedFiles.reduce((n, p) => n + p.exports.length, 0);
|
|
74
|
+
result.totalImports += b.parsedFiles.reduce((n, p) => n + p.imports.length, 0);
|
|
75
|
+
}
|
|
76
|
+
log(` bundles: ${target.length} | total prompt chars: ${result.totalChars} | exports: ${result.totalExports} | import edges: ${result.totalImports}`);
|
|
77
|
+
result.topDirsByUsedBy = [...target]
|
|
78
|
+
.sort((a, b) => b.usedBy.length - a.usedBy.length)
|
|
79
|
+
.slice(0, 5)
|
|
80
|
+
.map(b => ({ rel: b.rel, usedByCount: b.usedBy.length }));
|
|
81
|
+
if (opts.dryRun) {
|
|
82
|
+
log("\n▸ Top 5 dirs by used-by count:");
|
|
83
|
+
for (const t of result.topDirsByUsedBy)
|
|
84
|
+
log(` ${t.rel} ← ${t.usedByCount} dirs`);
|
|
85
|
+
log("\nDry run complete.");
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
const cache = new SummaryCache(root);
|
|
89
|
+
await cache.load();
|
|
90
|
+
await fs.mkdir(summariesDir, { recursive: true });
|
|
91
|
+
// --emit-bundles: walk + write bundles + manifest, then exit. The host agent
|
|
92
|
+
// (a slash command in Claude Code, a Codex script, etc.) reads the manifest
|
|
93
|
+
// and drives extraction. Karpathy pattern: the LLM agent IS the worker.
|
|
94
|
+
if (opts.emitBundles) {
|
|
95
|
+
log(`\n▸ Emitting bundles + manifest for ${target.length} dirs…`);
|
|
96
|
+
const bundlesDir = path.join(root, ".ricord-cache", "bundles");
|
|
97
|
+
await fs.mkdir(bundlesDir, { recursive: true });
|
|
98
|
+
const manifest = [];
|
|
99
|
+
for (const b of target) {
|
|
100
|
+
result.processed++;
|
|
101
|
+
const summary = bundleAsSummary(b);
|
|
102
|
+
const hash = cache.hashBundle(renderBundleForPrompt(b));
|
|
103
|
+
cache.set(b.rel, { bundleHash: hash, summary });
|
|
104
|
+
const slug = b.rel === "." ? "_root" : b.rel.replace(/\//g, "__");
|
|
105
|
+
const bundlePath = path.join(bundlesDir, `${slug}.md`);
|
|
106
|
+
await fs.writeFile(bundlePath, summary, "utf8");
|
|
107
|
+
manifest.push({ rel: b.rel, slug, bundlePath, chars: summary.length, hash });
|
|
108
|
+
}
|
|
109
|
+
await cache.save();
|
|
110
|
+
const manifestPath = path.join(root, ".ricord-cache", "manifest.json");
|
|
111
|
+
await fs.writeFile(manifestPath, JSON.stringify({
|
|
112
|
+
generated_at: new Date().toISOString(),
|
|
113
|
+
root,
|
|
114
|
+
repo: path.basename(root),
|
|
115
|
+
api_base: opts.apiBase,
|
|
116
|
+
bundle_count: manifest.length,
|
|
117
|
+
bundles: manifest,
|
|
118
|
+
}, null, 2), "utf8");
|
|
119
|
+
log(`\n▸ Done. ${manifest.length} bundles written to ${bundlesDir}`);
|
|
120
|
+
log(` manifest: ${manifestPath}`);
|
|
121
|
+
log(`\n▸ Next: have your host agent (e.g. /ricord-init in Claude Code) walk`);
|
|
122
|
+
log(` the manifest and POST extraction results to /v1/ingest/extracted.`);
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
const ingestCfg = willIngest
|
|
126
|
+
? { apiBase: opts.apiBase, token: opts.ricordToken }
|
|
127
|
+
: null;
|
|
128
|
+
if (!ingestCfg && !opts.noIngest) {
|
|
129
|
+
log(" (no token — running as if --no-ingest)");
|
|
130
|
+
}
|
|
131
|
+
// Fetch the canonical extraction prompt once. The server-authored prompt
|
|
132
|
+
// drives all clients so we stay in lockstep with schema/cap changes.
|
|
133
|
+
let promptTemplate = "";
|
|
134
|
+
let schemaVersion = 1;
|
|
135
|
+
if (ingestCfg && llmCfg) {
|
|
136
|
+
log(`\n▸ Client-side extraction: ${llmCfg.provider}/${llmCfg.model}`);
|
|
137
|
+
try {
|
|
138
|
+
const p = await fetchExtractionPrompt(ingestCfg);
|
|
139
|
+
promptTemplate = p.prompt;
|
|
140
|
+
schemaVersion = p.schema_version;
|
|
141
|
+
log(` prompt schema v${schemaVersion} fetched`);
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
145
|
+
result.ok = false;
|
|
146
|
+
result.errorReason = msg;
|
|
147
|
+
log(`ERROR: ${msg}`);
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const llmFn = ingestCfg && llmCfg ? makeLlmFn(llmCfg) : null;
|
|
152
|
+
log(`\n▸ Building summaries + extracting for ${target.length} dirs…`);
|
|
153
|
+
for (const b of target) {
|
|
154
|
+
result.processed++;
|
|
155
|
+
const bundleText = renderBundleForPrompt(b);
|
|
156
|
+
const hash = cache.hashBundle(bundleText);
|
|
157
|
+
let summary;
|
|
158
|
+
if (cache.hasFresh(b.rel, hash)) {
|
|
159
|
+
summary = cache.get(b.rel).summary;
|
|
160
|
+
result.cached++;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
summary = bundleAsSummary(b);
|
|
164
|
+
cache.set(b.rel, { bundleHash: hash, summary });
|
|
165
|
+
}
|
|
166
|
+
const slug = b.rel === "." ? "_root" : b.rel.replace(/\//g, "__");
|
|
167
|
+
await fs.writeFile(path.join(summariesDir, `${slug}.md`), summary, "utf8");
|
|
168
|
+
let note = "";
|
|
169
|
+
if (ingestCfg && llmFn && llmCfg) {
|
|
170
|
+
try {
|
|
171
|
+
const extracted = await runExtraction(llmFn, promptTemplate, summary);
|
|
172
|
+
const r = await postExtracted(ingestCfg, {
|
|
173
|
+
dirRel: b.rel,
|
|
174
|
+
bundleText: summary,
|
|
175
|
+
extracted,
|
|
176
|
+
repo: path.basename(root),
|
|
177
|
+
model: llmCfg.model,
|
|
178
|
+
schemaVersion,
|
|
179
|
+
});
|
|
180
|
+
if (r.ok) {
|
|
181
|
+
result.ingested++;
|
|
182
|
+
result.totalAnchors += extracted.anchors.length;
|
|
183
|
+
result.totalConnections += extracted.connections.length;
|
|
184
|
+
result.totalTasks += extracted.tasks.length;
|
|
185
|
+
const e = cache.get(b.rel);
|
|
186
|
+
e.ingestedAt = new Date().toISOString();
|
|
187
|
+
note = ` → a:${extracted.anchors.length} c:${extracted.connections.length} t:${extracted.tasks.length}`;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
const errMsg = typeof r.body === "string"
|
|
191
|
+
? r.body
|
|
192
|
+
: (() => {
|
|
193
|
+
const b = r.body;
|
|
194
|
+
return b?.error?.message ?? JSON.stringify(r.body);
|
|
195
|
+
})();
|
|
196
|
+
note = ` → ingest FAILED ${r.status}: ${errMsg.slice(0, 200)}`;
|
|
197
|
+
result.failed++;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
202
|
+
note = ` → extract FAILED (${msg.slice(0, 80)})`;
|
|
203
|
+
result.failed++;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
log(` ✓ [${result.processed}/${target.length}] ${b.rel} (${summary.length} chars)${note}`);
|
|
207
|
+
if (result.processed % 10 === 0)
|
|
208
|
+
await cache.save();
|
|
209
|
+
}
|
|
210
|
+
await cache.save();
|
|
211
|
+
log(`\n▸ Done. ok=${result.processed - result.failed} cached=${result.cached} failed=${result.failed} ingested=${result.ingested}`);
|
|
212
|
+
log(` summaries written to: ${summariesDir}`);
|
|
213
|
+
if (ingestCfg && result.ingested > 0) {
|
|
214
|
+
log(` totals: ${result.totalAnchors} anchors · ${result.totalConnections} connections · ${result.totalTasks} tasks`);
|
|
215
|
+
const usage = await fetchUsage(ingestCfg);
|
|
216
|
+
if (usage) {
|
|
217
|
+
result.usage = {
|
|
218
|
+
tier: usage.tier ?? "unknown",
|
|
219
|
+
memoriesUsed: usage.memories_used ?? 0,
|
|
220
|
+
memoriesCap: usage.memories_cap ?? 0,
|
|
221
|
+
};
|
|
222
|
+
log(`\n▸ Quota: ${result.usage.memoriesUsed}/${result.usage.memoriesCap} memories used (tier: ${result.usage.tier})`);
|
|
223
|
+
}
|
|
224
|
+
log(`\n▸ Extraction ran client-side. KG, KB pages, and tasks are written.`);
|
|
225
|
+
log(` View your graph at https://ricord.ai/dashboard.`);
|
|
226
|
+
}
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=run-explore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-explore.js","sourceRoot":"","sources":["../../src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C;QACtH,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,KAAK,GAAG;gBACb,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,SAAS;gBAC7B,YAAY,EAAE,KAAK,CAAC,aAAa,IAAI,CAAC;gBACtC,WAAW,EAAE,KAAK,CAAC,YAAY,IAAI,CAAC;aACrC,CAAC;YACF,GAAG,CAAC,cAAc,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,MAAM,CAAC,KAAK,CAAC,WAAW,yBAAyB,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;QACxH,CAAC;QACD,GAAG,CAAC,sEAAsE,CAAC,CAAC;QAC5E,GAAG,CAAC,mDAAmD,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DirBundle } from "./bundle.js";
|
|
2
|
+
/**
|
|
3
|
+
* Guidance prompt returned by the `ricord_walk` MCP tool so the calling agent
|
|
4
|
+
* (Claude) knows what shape of summary to write per directory before posting
|
|
5
|
+
* via `ricord_ingest`. Also documents the output that `bundleAsSummary` aims
|
|
6
|
+
* to approximate mechanically when no agent is in the loop (e.g. `ricord init`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const SUMMARY_PROMPT = "You summarize one directory of a code repository for ingestion into a knowledge graph.\n\nYour output becomes graph nodes and edges, so be precise about relationships between modules, packages, tables, endpoints, and external dependencies.\n\nOutput STRICT MARKDOWN with these exact headings, in this order:\n\n# {dir_path}\n\n**Module:** {short name}\n**Package:** {parent package, e.g. ricord-api}\n**Path:** {dir_path}\n\n## Purpose\nONE paragraph (3-6 sentences). What this directory is responsible for. Use proper nouns liberally \u2014 class names, table names, endpoint paths, function names.\n\n## Key exports\nBulleted list. One line each. Format: `Name \u2014 what it does`. Limit to 5-15 most important.\n\n## Tables, endpoints, named artifacts\nBulleted list of specific named things this directory creates or owns.\n\n## Depends on\nPull DIRECTLY from the \"Imports from sibling dirs\" and \"External dependencies\" sections you were given. Do NOT invent.\n\n## Used by\nPull DIRECTLY from the \"This directory is imported by\" section. Do NOT invent.\n\n## Facts\nNon-obvious truths a reader would want. Each fact one line. Reference proper nouns.\n\nHard rules: no source code blocks, no speculation, ~600-1000 words total.\n";
|
|
9
|
+
/**
|
|
10
|
+
* Ship the rendered bundle directly. The bundle is already structured
|
|
11
|
+
* (headings, exports, imports, used-by) and the backend entity extractor
|
|
12
|
+
* (Gemini 2.5 Flash) latches onto that structure — no client-side LLM
|
|
13
|
+
* rewrite needed.
|
|
14
|
+
*/
|
|
15
|
+
export declare function bundleAsSummary(bundle: DirBundle): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { renderBundleForPrompt } from "./bundle.js";
|
|
2
|
+
/**
|
|
3
|
+
* Guidance prompt returned by the `ricord_walk` MCP tool so the calling agent
|
|
4
|
+
* (Claude) knows what shape of summary to write per directory before posting
|
|
5
|
+
* via `ricord_ingest`. Also documents the output that `bundleAsSummary` aims
|
|
6
|
+
* to approximate mechanically when no agent is in the loop (e.g. `ricord init`).
|
|
7
|
+
*/
|
|
8
|
+
export const SUMMARY_PROMPT = `You summarize one directory of a code repository for ingestion into a knowledge graph.
|
|
9
|
+
|
|
10
|
+
Your output becomes graph nodes and edges, so be precise about relationships between modules, packages, tables, endpoints, and external dependencies.
|
|
11
|
+
|
|
12
|
+
Output STRICT MARKDOWN with these exact headings, in this order:
|
|
13
|
+
|
|
14
|
+
# {dir_path}
|
|
15
|
+
|
|
16
|
+
**Module:** {short name}
|
|
17
|
+
**Package:** {parent package, e.g. ricord-api}
|
|
18
|
+
**Path:** {dir_path}
|
|
19
|
+
|
|
20
|
+
## Purpose
|
|
21
|
+
ONE paragraph (3-6 sentences). What this directory is responsible for. Use proper nouns liberally — class names, table names, endpoint paths, function names.
|
|
22
|
+
|
|
23
|
+
## Key exports
|
|
24
|
+
Bulleted list. One line each. Format: \`Name — what it does\`. Limit to 5-15 most important.
|
|
25
|
+
|
|
26
|
+
## Tables, endpoints, named artifacts
|
|
27
|
+
Bulleted list of specific named things this directory creates or owns.
|
|
28
|
+
|
|
29
|
+
## Depends on
|
|
30
|
+
Pull DIRECTLY from the "Imports from sibling dirs" and "External dependencies" sections you were given. Do NOT invent.
|
|
31
|
+
|
|
32
|
+
## Used by
|
|
33
|
+
Pull DIRECTLY from the "This directory is imported by" section. Do NOT invent.
|
|
34
|
+
|
|
35
|
+
## Facts
|
|
36
|
+
Non-obvious truths a reader would want. Each fact one line. Reference proper nouns.
|
|
37
|
+
|
|
38
|
+
Hard rules: no source code blocks, no speculation, ~600-1000 words total.
|
|
39
|
+
`;
|
|
40
|
+
/**
|
|
41
|
+
* Ship the rendered bundle directly. The bundle is already structured
|
|
42
|
+
* (headings, exports, imports, used-by) and the backend entity extractor
|
|
43
|
+
* (Gemini 2.5 Flash) latches onto that structure — no client-side LLM
|
|
44
|
+
* rewrite needed.
|
|
45
|
+
*/
|
|
46
|
+
export function bundleAsSummary(bundle) {
|
|
47
|
+
return renderBundleForPrompt(bundle, { maxChars: 32_000 });
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=summarize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summarize.js","sourceRoot":"","sources":["../../src/cli/summarize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B7B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,OAAO,qBAAqB,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
function tryJson(file) {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function writeJson(file, data, dryRun) {
|
|
14
|
+
const text = JSON.stringify(data, null, 2);
|
|
15
|
+
if (dryRun) {
|
|
16
|
+
console.log(` [dry-run] would write ${file}`);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
fs.writeFileSync(file, text + "\n", "utf8");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** Walk from startDir upward, collecting all .mcp.json and .claude/settings.json paths that exist. */
|
|
23
|
+
function collectConfigFiles(startDir) {
|
|
24
|
+
const mcpJsons = [];
|
|
25
|
+
const settingsJsons = [];
|
|
26
|
+
let dir = startDir;
|
|
27
|
+
while (true) {
|
|
28
|
+
const mcp = path.join(dir, ".mcp.json");
|
|
29
|
+
if (fs.existsSync(mcp))
|
|
30
|
+
mcpJsons.push(mcp);
|
|
31
|
+
// Both settings.json (committed) and settings.local.json (per-machine,
|
|
32
|
+
// where `claude mcp add` writes permission grants) need cleaning.
|
|
33
|
+
for (const name of ["settings.json", "settings.local.json"]) {
|
|
34
|
+
const f = path.join(dir, ".claude", name);
|
|
35
|
+
if (fs.existsSync(f))
|
|
36
|
+
settingsJsons.push(f);
|
|
37
|
+
}
|
|
38
|
+
const parent = path.dirname(dir);
|
|
39
|
+
if (parent === dir)
|
|
40
|
+
break;
|
|
41
|
+
dir = parent;
|
|
42
|
+
}
|
|
43
|
+
// Also check home dir (both variants)
|
|
44
|
+
for (const name of ["settings.json", "settings.local.json"]) {
|
|
45
|
+
const f = path.join(os.homedir(), ".claude", name);
|
|
46
|
+
if (fs.existsSync(f) && !settingsJsons.includes(f))
|
|
47
|
+
settingsJsons.push(f);
|
|
48
|
+
}
|
|
49
|
+
return { mcpJsons, settingsJsons };
|
|
50
|
+
}
|
|
51
|
+
function removeMcpEntry(file, dryRun) {
|
|
52
|
+
const data = tryJson(file);
|
|
53
|
+
if (!data)
|
|
54
|
+
return false;
|
|
55
|
+
const servers = data.mcpServers;
|
|
56
|
+
if (!servers || !("ricord" in servers))
|
|
57
|
+
return false;
|
|
58
|
+
delete servers.ricord;
|
|
59
|
+
if (Object.keys(servers).length === 0)
|
|
60
|
+
delete data.mcpServers;
|
|
61
|
+
writeJson(file, data, dryRun);
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
function isRicordHook(cmd) {
|
|
65
|
+
return typeof cmd === "string" && cmd.includes("ricord-mcp");
|
|
66
|
+
}
|
|
67
|
+
function removeHooksAndPerms(file, dryRun) {
|
|
68
|
+
const data = tryJson(file);
|
|
69
|
+
if (!data)
|
|
70
|
+
return false;
|
|
71
|
+
let changed = false;
|
|
72
|
+
// Remove ricord hooks
|
|
73
|
+
const hooks = data.hooks;
|
|
74
|
+
if (hooks) {
|
|
75
|
+
for (const event of Object.keys(hooks)) {
|
|
76
|
+
const entries = hooks[event];
|
|
77
|
+
const filtered = entries.filter(entry => {
|
|
78
|
+
const cmds = entry.hooks ?? [];
|
|
79
|
+
return !cmds.some(h => isRicordHook(h.command));
|
|
80
|
+
});
|
|
81
|
+
if (filtered.length !== entries.length)
|
|
82
|
+
changed = true;
|
|
83
|
+
if (filtered.length === 0) {
|
|
84
|
+
delete hooks[event];
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
hooks[event] = filtered;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (Object.keys(hooks).length === 0)
|
|
91
|
+
delete data.hooks;
|
|
92
|
+
}
|
|
93
|
+
// Remove ricord permissions from allow list
|
|
94
|
+
const perms = data.permissions;
|
|
95
|
+
if (perms?.allow) {
|
|
96
|
+
const before = perms.allow.length;
|
|
97
|
+
perms.allow = perms.allow.filter(p => !p.startsWith("mcp__ricord__"));
|
|
98
|
+
if (perms.allow.length === 0)
|
|
99
|
+
delete perms.allow;
|
|
100
|
+
if (Object.keys(perms).length === 0)
|
|
101
|
+
delete data.permissions;
|
|
102
|
+
if (perms.allow?.length !== before)
|
|
103
|
+
changed = true;
|
|
104
|
+
}
|
|
105
|
+
if (!changed)
|
|
106
|
+
return false;
|
|
107
|
+
writeJson(file, data, dryRun);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Clean ricord entries from ~/.claude.json, which is where Claude Code's
|
|
112
|
+
* `claude mcp add` writes registrations. Handles three locations:
|
|
113
|
+
* 1. Top-level `mcpServers.ricord` (user scope: `claude mcp add -s user`)
|
|
114
|
+
* 2. `projects.<cwd>.mcpServers.ricord` (default/local scope)
|
|
115
|
+
* 3. `claudeAiMcpEverConnected[]` registry entries containing "ricord"
|
|
116
|
+
*/
|
|
117
|
+
function removeClaudeAiMcpEntries(dryRun) {
|
|
118
|
+
const claudeJson = path.join(os.homedir(), ".claude.json");
|
|
119
|
+
const data = tryJson(claudeJson);
|
|
120
|
+
if (!data)
|
|
121
|
+
return false;
|
|
122
|
+
let changed = false;
|
|
123
|
+
// 1. Top-level user-scope mcpServers
|
|
124
|
+
const topServers = data.mcpServers;
|
|
125
|
+
if (topServers && "ricord" in topServers) {
|
|
126
|
+
delete topServers.ricord;
|
|
127
|
+
if (Object.keys(topServers).length === 0)
|
|
128
|
+
delete data.mcpServers;
|
|
129
|
+
changed = true;
|
|
130
|
+
}
|
|
131
|
+
// 2. Per-project mcpServers (project/local scope)
|
|
132
|
+
const projects = data.projects;
|
|
133
|
+
if (projects) {
|
|
134
|
+
for (const projPath of Object.keys(projects)) {
|
|
135
|
+
const proj = projects[projPath];
|
|
136
|
+
if (proj?.mcpServers && "ricord" in proj.mcpServers) {
|
|
137
|
+
delete proj.mcpServers.ricord;
|
|
138
|
+
if (Object.keys(proj.mcpServers).length === 0)
|
|
139
|
+
delete proj.mcpServers;
|
|
140
|
+
changed = true;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// 3. claudeAiMcpEverConnected registry
|
|
145
|
+
const connected = data.claudeAiMcpEverConnected;
|
|
146
|
+
if (connected) {
|
|
147
|
+
const filtered = connected.filter((e) => !e.toLowerCase().includes("ricord"));
|
|
148
|
+
if (filtered.length !== connected.length) {
|
|
149
|
+
data.claudeAiMcpEverConnected = filtered;
|
|
150
|
+
changed = true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (!changed)
|
|
154
|
+
return false;
|
|
155
|
+
writeJson(claudeJson, data, dryRun);
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
function removeSlashCommands(dryRun) {
|
|
159
|
+
const commandsDir = path.join(os.homedir(), ".claude", "commands");
|
|
160
|
+
if (!fs.existsSync(commandsDir))
|
|
161
|
+
return 0;
|
|
162
|
+
const ricordFiles = fs.readdirSync(commandsDir).filter(f => f.startsWith("ricord-") && f.endsWith(".md"));
|
|
163
|
+
let removed = 0;
|
|
164
|
+
for (const f of ricordFiles) {
|
|
165
|
+
const full = path.join(commandsDir, f);
|
|
166
|
+
if (dryRun) {
|
|
167
|
+
console.log(` [dry-run] would remove ${full}`);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
fs.rmSync(full);
|
|
171
|
+
}
|
|
172
|
+
removed++;
|
|
173
|
+
}
|
|
174
|
+
return removed;
|
|
175
|
+
}
|
|
176
|
+
function runCommand(cmd, args) {
|
|
177
|
+
const r = spawnSync(cmd, args, { encoding: "utf8" });
|
|
178
|
+
return {
|
|
179
|
+
ok: r.status === 0 && !r.error,
|
|
180
|
+
stderr: r.stderr ?? "",
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/** Remove cached ricord-mcp installs from ~/.npm/_npx/<hash>/node_modules/. */
|
|
184
|
+
function cleanNpxCache(dryRun) {
|
|
185
|
+
const npxDir = path.join(os.homedir(), ".npm", "_npx");
|
|
186
|
+
if (!fs.existsSync(npxDir))
|
|
187
|
+
return 0;
|
|
188
|
+
let removed = 0;
|
|
189
|
+
for (const entry of fs.readdirSync(npxDir)) {
|
|
190
|
+
const pkgDir = path.join(npxDir, entry, "node_modules", "ricord-mcp");
|
|
191
|
+
if (fs.existsSync(pkgDir)) {
|
|
192
|
+
if (dryRun) {
|
|
193
|
+
console.log(` [dry-run] would remove ${pkgDir}`);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
fs.rmSync(pkgDir, { recursive: true, force: true });
|
|
197
|
+
}
|
|
198
|
+
removed++;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return removed;
|
|
202
|
+
}
|
|
203
|
+
function uninstallGlobal(dryRun) {
|
|
204
|
+
console.log("\n▸ Removing global installs");
|
|
205
|
+
const managers = [
|
|
206
|
+
{ bin: "npm", args: ["uninstall", "-g", "ricord-mcp", "@ricord/mcp-server"] },
|
|
207
|
+
{ bin: "bun", args: ["remove", "-g", "ricord-mcp"] },
|
|
208
|
+
];
|
|
209
|
+
for (const { bin, args } of managers) {
|
|
210
|
+
// Check if the bin exists
|
|
211
|
+
const which = spawnSync("which", [bin], { encoding: "utf8" });
|
|
212
|
+
if (which.status !== 0)
|
|
213
|
+
continue;
|
|
214
|
+
if (dryRun) {
|
|
215
|
+
console.log(` [dry-run] would run: ${bin} ${args.join(" ")}`);
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
const result = runCommand(bin, args);
|
|
219
|
+
if (result.ok) {
|
|
220
|
+
console.log(` ✓ ${bin}: removed`);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
// Not installed is fine
|
|
224
|
+
console.log(` - ${bin}: not found or already removed`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
export async function runUninstall(opts) {
|
|
229
|
+
const { root, dryRun } = opts;
|
|
230
|
+
console.log(`▸ ricord uninstall${dryRun ? " (dry-run)" : ""}`);
|
|
231
|
+
console.log(` scanning from: ${root}`);
|
|
232
|
+
// 1. Global package managers
|
|
233
|
+
uninstallGlobal(dryRun);
|
|
234
|
+
// 2. Config files
|
|
235
|
+
const { mcpJsons, settingsJsons } = collectConfigFiles(root);
|
|
236
|
+
console.log("\n▸ Removing MCP server entries");
|
|
237
|
+
if (mcpJsons.length === 0) {
|
|
238
|
+
console.log(" - no .mcp.json files found");
|
|
239
|
+
}
|
|
240
|
+
for (const f of mcpJsons) {
|
|
241
|
+
const changed = removeMcpEntry(f, dryRun);
|
|
242
|
+
console.log(` ${changed ? "✓" : "-"} ${f}`);
|
|
243
|
+
}
|
|
244
|
+
console.log("\n▸ Removing hooks and permissions");
|
|
245
|
+
if (settingsJsons.length === 0) {
|
|
246
|
+
console.log(" - no .claude/settings.json files found");
|
|
247
|
+
}
|
|
248
|
+
for (const f of settingsJsons) {
|
|
249
|
+
const changed = removeHooksAndPerms(f, dryRun);
|
|
250
|
+
console.log(` ${changed ? "✓" : "-"} ${f}`);
|
|
251
|
+
}
|
|
252
|
+
// 3. ~/.claude.json (Claude Code registrations + ever-connected registry)
|
|
253
|
+
console.log("\n▸ Cleaning ~/.claude.json (Claude Code MCP registrations)");
|
|
254
|
+
const registryChanged = removeClaudeAiMcpEntries(dryRun);
|
|
255
|
+
console.log(` ${registryChanged ? "✓" : "-"} ~/.claude.json (mcpServers + projects.*.mcpServers + claudeAiMcpEverConnected)`);
|
|
256
|
+
// 4. Slash commands
|
|
257
|
+
console.log("\n▸ Removing slash commands");
|
|
258
|
+
const removed = removeSlashCommands(dryRun);
|
|
259
|
+
if (removed === 0) {
|
|
260
|
+
console.log(" - no ricord slash commands found");
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
console.log(` ✓ removed ${removed} command(s) from ~/.claude/commands/`);
|
|
264
|
+
}
|
|
265
|
+
// 5. npx cache (so future `npx ricord-mcp` re-fetches a fresh version)
|
|
266
|
+
console.log("\n▸ Cleaning npx cache");
|
|
267
|
+
const npxRemoved = cleanNpxCache(dryRun);
|
|
268
|
+
if (npxRemoved === 0) {
|
|
269
|
+
console.log(" - no ricord-mcp in npx cache");
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
console.log(` ✓ removed ${npxRemoved} cached copy/copies from ~/.npm/_npx/`);
|
|
273
|
+
}
|
|
274
|
+
console.log("\nDone. Restart Claude Code to complete the removal.");
|
|
275
|
+
return 0;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=uninstall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/cli/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAO/C,SAAS,OAAO,CAAC,IAAY;IAC3B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,IAAa,EAAE,MAAe;IAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,sGAAsG;AACtG,SAAS,kB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AC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,iFAAiF,CAAC,CAAC;IAE/H,oBAAoB;IACpB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IACpD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,eAAe,OAAO,sCAAsC,CAAC,CAAC;IAC5E,CAAC;IAED,uEAAuE;IACvE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAChD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,eAAe,UAAU,uCAAuC,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;IACpE,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repo walker — finds source files for `ricord ingest`. Honors a hard-coded
|
|
3
|
+
* skip list (node_modules, .git, dist, build, .next, .cache, .ricord) and
|
|
4
|
+
* an extension allow-list. Optional `paths` restricts to those subtrees.
|
|
5
|
+
*
|
|
6
|
+
* Designed to be deterministic so the same repo produces the same file
|
|
7
|
+
* order in every run — the ingest batch is order-stable for sha checks.
|
|
8
|
+
*/
|
|
9
|
+
export interface WalkedFile {
|
|
10
|
+
absPath: string;
|
|
11
|
+
size: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function walkRepo(repoRoot: string, paths?: string[]): Promise<WalkedFile[]>;
|