@indigoai-us/hq-cloud 6.14.50 → 6.15.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/dist/cli/reindex-knowledge.d.ts +7 -0
- package/dist/cli/reindex-knowledge.d.ts.map +1 -0
- package/dist/cli/reindex-knowledge.js +389 -0
- package/dist/cli/reindex-knowledge.js.map +1 -0
- package/dist/cli/reindex-knowledge.test.d.ts +12 -0
- package/dist/cli/reindex-knowledge.test.d.ts.map +1 -0
- package/dist/cli/reindex-knowledge.test.js +260 -0
- package/dist/cli/reindex-knowledge.test.js.map +1 -0
- package/dist/cli/reindex.d.ts.map +1 -1
- package/dist/cli/reindex.js +8 -0
- package/dist/cli/reindex.js.map +1 -1
- package/dist/cli/rescue-settings-reconcile.test.js +47 -0
- package/dist/cli/rescue-settings-reconcile.test.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/reindex-knowledge.test.ts +307 -0
- package/src/cli/reindex-knowledge.ts +450 -0
- package/src/cli/reindex.ts +9 -0
- package/src/cli/rescue-settings-reconcile.test.ts +54 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scour the HQ tree for legacy knowledge-repo layouts and migrate each to a
|
|
3
|
+
* real canonical directory, removing fully-migrated legacy repos under
|
|
4
|
+
* `repos/`. Best-effort throughout; never throws.
|
|
5
|
+
*/
|
|
6
|
+
export declare function materializeLegacyKnowledgeRepos(root: string): void;
|
|
7
|
+
//# sourceMappingURL=reindex-knowledge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reindex-knowledge.d.ts","sourceRoot":"","sources":["../../src/cli/reindex-knowledge.ts"],"names":[],"mappings":"AAmWA;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAyFlE"}
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy knowledge-repo materialization — the migration arm of policy
|
|
3
|
+
* `knowledge-repositories-never-symlink` (hq-core).
|
|
4
|
+
*
|
|
5
|
+
* Every knowledge repository must be a REAL directory at its canonical HQ
|
|
6
|
+
* path (`core/knowledge/`, `personal/knowledge/`, `companies/{co}/knowledge/`),
|
|
7
|
+
* with git initialized inside that directory when independent history is
|
|
8
|
+
* needed. The legacy layout — a repo under `repos/` (or any separate git
|
|
9
|
+
* repo) with the knowledge path symlinked to it — breaks cloud sync: sync
|
|
10
|
+
* records a directory symlink as a ~50-byte vault marker, so teammates
|
|
11
|
+
* receive nothing.
|
|
12
|
+
*
|
|
13
|
+
* On every reindex this module scours the canonical knowledge locations for
|
|
14
|
+
* that legacy shape and migrates each occurrence in place:
|
|
15
|
+
*
|
|
16
|
+
* 1. `git pull --ff-only` the legacy repo (best-effort — offline or dirty
|
|
17
|
+
* repos still migrate with their local content),
|
|
18
|
+
* 2. copy the link target to a temp sibling — INCLUDING `.git/` when the
|
|
19
|
+
* target is the repo root, so history is preserved as a supported
|
|
20
|
+
* embedded repo at the canonical path,
|
|
21
|
+
* 3. swap the symlink for the copied real directory, and
|
|
22
|
+
* 4. remove the legacy repo under `repos/` once every symlink that
|
|
23
|
+
* referenced it has been materialized and nothing else lives in it
|
|
24
|
+
* (a repo whose knowledge was only a subdirectory is left in place).
|
|
25
|
+
*
|
|
26
|
+
* Deliberately NOT migrated:
|
|
27
|
+
* - package-manager links from `core/knowledge/` into the pack knowledge
|
|
28
|
+
* dirs under `core/packages/` — immutable pack mounts, a supported
|
|
29
|
+
* non-repo link;
|
|
30
|
+
* - symlinks that resolve inside the HQ tree itself (aliases tracked by HQ
|
|
31
|
+
* git are not separate repositories);
|
|
32
|
+
* - real directories with an embedded `.git/` — already the supported form;
|
|
33
|
+
* - broken symlinks — warned about and left for a human, since there is no
|
|
34
|
+
* content to materialize.
|
|
35
|
+
*
|
|
36
|
+
* Steady-state cost is a handful of lstats: git subprocesses are spawned only
|
|
37
|
+
* when a symlink candidate is actually present. Everything is best-effort —
|
|
38
|
+
* a failed migration warns to stderr and never fails the reindex. Escape
|
|
39
|
+
* hatch: HQ_REINDEX_SKIP_KNOWLEDGE_MIGRATION=1 disables the whole pass.
|
|
40
|
+
*/
|
|
41
|
+
import { spawnSync } from "child_process";
|
|
42
|
+
import * as fs from "fs";
|
|
43
|
+
import * as path from "path";
|
|
44
|
+
function warn(msg) {
|
|
45
|
+
process.stderr.write(`${msg}\n`);
|
|
46
|
+
}
|
|
47
|
+
function lstatOrNull(p) {
|
|
48
|
+
try {
|
|
49
|
+
return fs.lstatSync(p);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function isDir(p) {
|
|
56
|
+
try {
|
|
57
|
+
return fs.statSync(p).isDirectory();
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Non-hidden entries of `dir`, sorted; [] when missing/unreadable. */
|
|
64
|
+
function entries(dir) {
|
|
65
|
+
try {
|
|
66
|
+
return fs
|
|
67
|
+
.readdirSync(dir)
|
|
68
|
+
.filter((n) => !n.startsWith("."))
|
|
69
|
+
.sort();
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function realpathOrNull(p) {
|
|
76
|
+
try {
|
|
77
|
+
return fs.realpathSync(p);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** True when `child` is `parent` or lexically inside it. */
|
|
84
|
+
function isUnder(child, parent) {
|
|
85
|
+
const rel = path.relative(parent, child);
|
|
86
|
+
return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));
|
|
87
|
+
}
|
|
88
|
+
/** `git rev-parse --show-toplevel` for `dir`, realpath'd; null when not in a repo. */
|
|
89
|
+
function gitToplevel(dir) {
|
|
90
|
+
try {
|
|
91
|
+
const res = spawnSync("git", ["-C", dir, "rev-parse", "--show-toplevel"], {
|
|
92
|
+
encoding: "utf8",
|
|
93
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
94
|
+
timeout: 15_000,
|
|
95
|
+
});
|
|
96
|
+
if (res.status !== 0)
|
|
97
|
+
return null;
|
|
98
|
+
const top = res.stdout.trim();
|
|
99
|
+
return top ? realpathOrNull(top) ?? top : null;
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Candidate knowledge locations, per the HQ layout contract. Only these are
|
|
107
|
+
* scanned — knowledge repositories are defined to live at canonical paths, so
|
|
108
|
+
* a full-tree walk would add cost without adding coverage.
|
|
109
|
+
*/
|
|
110
|
+
function knowledgeCandidates(root) {
|
|
111
|
+
const out = [];
|
|
112
|
+
const push = (p) => {
|
|
113
|
+
if (lstatOrNull(p))
|
|
114
|
+
out.push(p);
|
|
115
|
+
};
|
|
116
|
+
for (const slug of entries(path.join(root, "companies"))) {
|
|
117
|
+
const knowledge = path.join(root, "companies", slug, "knowledge");
|
|
118
|
+
push(knowledge);
|
|
119
|
+
// One level deep: /newcompany-era docs showed per-base links such as
|
|
120
|
+
// companies/acme/knowledge/acme → repos/private/knowledge-acme.
|
|
121
|
+
const st = lstatOrNull(knowledge);
|
|
122
|
+
if (st?.isDirectory()) {
|
|
123
|
+
for (const base of entries(knowledge))
|
|
124
|
+
push(path.join(knowledge, base));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const personal = path.join(root, "personal", "knowledge");
|
|
128
|
+
push(personal);
|
|
129
|
+
if (lstatOrNull(personal)?.isDirectory()) {
|
|
130
|
+
for (const base of entries(personal))
|
|
131
|
+
push(path.join(personal, base));
|
|
132
|
+
}
|
|
133
|
+
const coreKnowledge = path.join(root, "core", "knowledge");
|
|
134
|
+
for (const entry of entries(coreKnowledge)) {
|
|
135
|
+
const p = path.join(coreKnowledge, entry);
|
|
136
|
+
if (entry === "public" || entry === "private") {
|
|
137
|
+
for (const base of entries(p))
|
|
138
|
+
push(path.join(p, base));
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
push(p); // flat starter-kit layout
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return out;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Classify a symlink candidate. Returns the legacy occurrence to migrate, or
|
|
148
|
+
* null when the link is supported (pack mount, in-tree alias) or unusable
|
|
149
|
+
* (broken — warned here).
|
|
150
|
+
*/
|
|
151
|
+
function classifyLink(root, linkPath, rootTop) {
|
|
152
|
+
const linkRel = path.relative(root, linkPath);
|
|
153
|
+
const target = realpathOrNull(linkPath);
|
|
154
|
+
if (target === null) {
|
|
155
|
+
warn(`reindex: knowledge symlink '${linkRel}' is broken (target missing) — nothing to materialize; remove or repair it by hand`);
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
if (!isDir(target))
|
|
159
|
+
return null; // file links are not knowledge repositories
|
|
160
|
+
// Supported pack mount: core/knowledge/* → core/packages/*/knowledge/*.
|
|
161
|
+
if (isUnder(target, path.join(root, "core", "packages")))
|
|
162
|
+
return null;
|
|
163
|
+
const repoTop = gitToplevel(target);
|
|
164
|
+
const underRepos = isUnder(target, path.join(root, "repos"));
|
|
165
|
+
const separateRepo = repoTop !== null && repoTop !== rootTop;
|
|
166
|
+
// Legacy iff the target lives under repos/ (code-only tree) or is a separate
|
|
167
|
+
// git repo OUTSIDE the HQ tree. Anything else is left alone: an in-HQ alias
|
|
168
|
+
// is not a knowledge repository, and an in-HQ symlink to an embedded repo at
|
|
169
|
+
// another canonical path (e.g. a retired-release mirror core/knowledge/<x> →
|
|
170
|
+
// personal/knowledge/<x> whose personal side has its own .git) is the
|
|
171
|
+
// mirror-cleanup pass's to prune — materializing it here would double-surface
|
|
172
|
+
// the same knowledge as a real duplicate before that cleanup runs.
|
|
173
|
+
const insideHq = isUnder(target, root);
|
|
174
|
+
if (!underRepos && (insideHq || !separateRepo))
|
|
175
|
+
return null;
|
|
176
|
+
return { linkPath, linkRel, target, repoTop: separateRepo ? repoTop : null };
|
|
177
|
+
}
|
|
178
|
+
/** Best-effort `git pull --ff-only`; failures warn and never block migration. */
|
|
179
|
+
function pullLegacyRepo(root, repoTop) {
|
|
180
|
+
try {
|
|
181
|
+
// A repo with no remote has nothing to pull; migrate its local content
|
|
182
|
+
// without the noise of a doomed pull attempt.
|
|
183
|
+
const remotes = spawnSync("git", ["-C", repoTop, "remote"], {
|
|
184
|
+
encoding: "utf8",
|
|
185
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
186
|
+
timeout: 15_000,
|
|
187
|
+
});
|
|
188
|
+
if (remotes.status !== 0 || !remotes.stdout.trim())
|
|
189
|
+
return;
|
|
190
|
+
const res = spawnSync("git", ["-C", repoTop, "pull", "--ff-only", "--quiet"], {
|
|
191
|
+
encoding: "utf8",
|
|
192
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
193
|
+
timeout: 60_000,
|
|
194
|
+
});
|
|
195
|
+
if (res.status !== 0) {
|
|
196
|
+
const detail = `${res.stderr ?? ""}`.trim().split("\n")[0] || `exit ${res.status}`;
|
|
197
|
+
warn(`reindex: could not pull legacy knowledge repo '${path.relative(root, repoTop)}' (${detail}); migrating its local content as-is`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
warn(`reindex: could not pull legacy knowledge repo '${path.relative(root, repoTop)}' (${err.message}); migrating its local content as-is`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Work out what the copy must skip.
|
|
206
|
+
*
|
|
207
|
+
* - A `.git` FILE (not directory) marks a linked git worktree / gitdir
|
|
208
|
+
* pointer: copying it verbatim would leave the materialized directory
|
|
209
|
+
* pointing at metadata inside the main repository, and deleting the legacy
|
|
210
|
+
* path would strand that registration. Skip the pointer file and keep the
|
|
211
|
+
* legacy worktree for `git worktree remove` by hand.
|
|
212
|
+
* - Files the legacy repo git-ignores (e.g. a local `credentials.json`) stay
|
|
213
|
+
* out of the copy: cloud sync's ignore layer reads only the HQ ROOT
|
|
214
|
+
* `.gitignore`, so materializing them under a synced knowledge path would
|
|
215
|
+
* upload files their own repo deliberately kept local. The legacy repo is
|
|
216
|
+
* kept so those local-only files are never destroyed.
|
|
217
|
+
*/
|
|
218
|
+
function copyExclusions(root, link) {
|
|
219
|
+
const paths = new Set();
|
|
220
|
+
const keepLegacyReasons = [];
|
|
221
|
+
const gitEntry = path.join(link.target, ".git");
|
|
222
|
+
if (lstatOrNull(gitEntry)?.isFile()) {
|
|
223
|
+
paths.add(gitEntry);
|
|
224
|
+
keepLegacyReasons.push("it is a linked git worktree (its history lives in the main repository; remove it with `git worktree remove` after verifying the migrated content)");
|
|
225
|
+
}
|
|
226
|
+
if (link.repoTop) {
|
|
227
|
+
try {
|
|
228
|
+
const res = spawnSync("git", ["-C", link.repoTop, "ls-files", "--others", "--ignored", "--exclude-standard", "-z"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 30_000 });
|
|
229
|
+
if (res.status === 0) {
|
|
230
|
+
const ignored = res.stdout
|
|
231
|
+
.split("\0")
|
|
232
|
+
.filter(Boolean)
|
|
233
|
+
.map((rel) => path.join(link.repoTop, rel))
|
|
234
|
+
.filter((abs) => isUnder(abs, link.target));
|
|
235
|
+
if (ignored.length > 0) {
|
|
236
|
+
for (const abs of ignored)
|
|
237
|
+
paths.add(abs);
|
|
238
|
+
keepLegacyReasons.push(`it holds ${ignored.length} git-ignored local file(s) that must not enter a cloud-synced knowledge path`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
keepLegacyReasons.push("its git-ignored local files could not be enumerated, so the copy may be incomplete");
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
catch (err) {
|
|
246
|
+
keepLegacyReasons.push(`its git-ignored local files could not be enumerated (${err.message})`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return { paths, keepLegacyReasons };
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Replace the symlink at `link.linkPath` with a real directory holding a full
|
|
253
|
+
* copy of its target (`.git/` included when the target is the repo root).
|
|
254
|
+
* Relative symlinks inside the content are copied verbatim so they still
|
|
255
|
+
* resolve after the legacy repo is removed. Returns true when the canonical
|
|
256
|
+
* path ends as a real, non-symlink directory.
|
|
257
|
+
*/
|
|
258
|
+
function materializeLink(link, exclude) {
|
|
259
|
+
// PID-suffixed so a standalone `hq reindex` overlapping the post-sync/rescue
|
|
260
|
+
// inline reindex (skipLock — an overlap that pass tolerates by design) can
|
|
261
|
+
// never rename/delete a temp directory out from under the other process.
|
|
262
|
+
const tmp = path.join(path.dirname(link.linkPath), `.${path.basename(link.linkPath)}.hq-knowledge-migrate.${process.pid}.tmp`);
|
|
263
|
+
try {
|
|
264
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
265
|
+
fs.cpSync(link.target, tmp, {
|
|
266
|
+
recursive: true,
|
|
267
|
+
verbatimSymlinks: true,
|
|
268
|
+
filter: (src) => !exclude.has(src),
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
catch (err) {
|
|
272
|
+
warn(`reindex: could not copy knowledge content for '${link.linkRel}' from '${link.target}' (${err.message}); leaving the legacy symlink in place`);
|
|
273
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
const previousTarget = (() => {
|
|
277
|
+
try {
|
|
278
|
+
return fs.readlinkSync(link.linkPath);
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
})();
|
|
284
|
+
try {
|
|
285
|
+
fs.rmSync(link.linkPath);
|
|
286
|
+
fs.renameSync(tmp, link.linkPath);
|
|
287
|
+
}
|
|
288
|
+
catch (err) {
|
|
289
|
+
// Restore the link if the swap died between rm and rename, so the
|
|
290
|
+
// knowledge path never ends up missing entirely.
|
|
291
|
+
if (previousTarget !== null && lstatOrNull(link.linkPath) === null) {
|
|
292
|
+
try {
|
|
293
|
+
fs.symlinkSync(previousTarget, link.linkPath);
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
/* best-effort restore */
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
300
|
+
warn(`reindex: could not swap knowledge symlink '${link.linkRel}' for its materialized copy (${err.message}); leaving the legacy layout in place`);
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
const st = lstatOrNull(link.linkPath);
|
|
304
|
+
return st !== null && st.isDirectory() && !st.isSymbolicLink();
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Scour the HQ tree for legacy knowledge-repo layouts and migrate each to a
|
|
308
|
+
* real canonical directory, removing fully-migrated legacy repos under
|
|
309
|
+
* `repos/`. Best-effort throughout; never throws.
|
|
310
|
+
*/
|
|
311
|
+
export function materializeLegacyKnowledgeRepos(root) {
|
|
312
|
+
if (process.env.HQ_REINDEX_SKIP_KNOWLEDGE_MIGRATION === "1")
|
|
313
|
+
return;
|
|
314
|
+
try {
|
|
315
|
+
const symlinkCandidates = knowledgeCandidates(root).filter((p) => lstatOrNull(p)?.isSymbolicLink());
|
|
316
|
+
if (symlinkCandidates.length === 0)
|
|
317
|
+
return;
|
|
318
|
+
const rootTop = gitToplevel(root);
|
|
319
|
+
const links = symlinkCandidates
|
|
320
|
+
.map((p) => classifyLink(root, p, rootTop))
|
|
321
|
+
.filter((l) => l !== null);
|
|
322
|
+
if (links.length === 0)
|
|
323
|
+
return;
|
|
324
|
+
// Pull each distinct legacy repo once, before any copies are taken.
|
|
325
|
+
const pulled = new Set();
|
|
326
|
+
for (const link of links) {
|
|
327
|
+
if (link.repoTop && !pulled.has(link.repoTop)) {
|
|
328
|
+
pulled.add(link.repoTop);
|
|
329
|
+
pullLegacyRepo(root, link.repoTop);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
// Materialize every link first; legacy repos are only removed once no
|
|
333
|
+
// remaining symlink references them (aliases to one repo each get a copy).
|
|
334
|
+
const byRepo = new Map();
|
|
335
|
+
for (const link of links) {
|
|
336
|
+
const exclusions = copyExclusions(root, link);
|
|
337
|
+
const ok = materializeLink(link, exclusions.paths);
|
|
338
|
+
if (ok) {
|
|
339
|
+
warn(`reindex: materialized knowledge repo at '${link.linkRel}' (was a symlink to '${path.relative(root, link.target)}')`);
|
|
340
|
+
}
|
|
341
|
+
if (link.repoTop) {
|
|
342
|
+
const rec = byRepo.get(link.repoTop) ?? {
|
|
343
|
+
targets: new Set(),
|
|
344
|
+
allMigrated: true,
|
|
345
|
+
keepReasons: new Set(),
|
|
346
|
+
};
|
|
347
|
+
rec.targets.add(link.target);
|
|
348
|
+
rec.allMigrated = rec.allMigrated && ok;
|
|
349
|
+
for (const reason of exclusions.keepLegacyReasons)
|
|
350
|
+
rec.keepReasons.add(reason);
|
|
351
|
+
byRepo.set(link.repoTop, rec);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
// Remove a legacy repo only when it (a) lives under repos/ inside this HQ,
|
|
355
|
+
// (b) had every referencing symlink migrated, and (c) held nothing beyond
|
|
356
|
+
// the knowledge itself — i.e. every link targeted the repo root. A repo
|
|
357
|
+
// whose knowledge was a subdirectory (e.g. <repo>/docs) is left in place.
|
|
358
|
+
for (const [repoTop, rec] of byRepo) {
|
|
359
|
+
const repoRel = path.relative(root, repoTop);
|
|
360
|
+
if (!isUnder(repoTop, path.join(root, "repos"))) {
|
|
361
|
+
warn(`reindex: legacy knowledge repo '${repoTop}' lives outside this HQ's repos/ — content was materialized; remove the old repo yourself once verified`);
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
if (!rec.allMigrated)
|
|
365
|
+
continue;
|
|
366
|
+
if (rec.keepReasons.size > 0) {
|
|
367
|
+
for (const reason of rec.keepReasons) {
|
|
368
|
+
warn(`reindex: keeping legacy knowledge repo '${repoRel}' — ${reason}`);
|
|
369
|
+
}
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
if (![...rec.targets].every((t) => t === repoTop)) {
|
|
373
|
+
warn(`reindex: legacy repo '${repoRel}' also holds content beyond the migrated knowledge subdirectory; leaving it in place`);
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
try {
|
|
377
|
+
fs.rmSync(repoTop, { recursive: true, force: true });
|
|
378
|
+
warn(`reindex: removed legacy knowledge repo '${repoRel}' (fully materialized inline)`);
|
|
379
|
+
}
|
|
380
|
+
catch (err) {
|
|
381
|
+
warn(`reindex: could not remove legacy knowledge repo '${repoRel}' (${err.message}); its content was already materialized`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
catch (err) {
|
|
386
|
+
warn(`reindex: legacy knowledge-repo migration pass failed (${err.message}); skipping`);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
//# sourceMappingURL=reindex-knowledge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reindex-knowledge.js","sourceRoot":"","sources":["../../src/cli/reindex-knowledge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,SAAS,IAAI,CAAC,GAAW;IACvB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,WAAW,CAAC,CAAS;IAC5B,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;I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AK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC;gBAClD,IAAI,CACF,yBAAyB,OAAO,sFAAsF,CACvH,CAAC;gBACF,SAAS;YACX,CAAC;YACD,IAAI,CAAC;gBACH,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBACrD,IAAI,CAAC,2CAA2C,OAAO,+BAA+B,CAAC,CAAC;YAC1F,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CACF,oDAAoD,OAAO,MAAO,GAAa,CAAC,OAAO,yCAAyC,CACjI,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CACF,yDAA0D,GAAa,CAAC,OAAO,aAAa,CAC7F,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the legacy knowledge-repo materialization pass (`hq reindex`).
|
|
3
|
+
*
|
|
4
|
+
* Each test builds a temp HQ tree with the layout under test, runs
|
|
5
|
+
* materializeLegacyKnowledgeRepos() (or full reindex() for the integration
|
|
6
|
+
* case), and asserts observable filesystem outcomes: canonical knowledge
|
|
7
|
+
* paths become real directories with their content (and history) inline, and
|
|
8
|
+
* fully-migrated legacy repos under repos/ are removed — while supported
|
|
9
|
+
* layouts (pack mounts, embedded repos, in-tree aliases) are untouched.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=reindex-knowledge.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reindex-knowledge.test.d.ts","sourceRoot":"","sources":["../../src/cli/reindex-knowledge.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|