@kevin0181/memoc 1.4.0 → 1.4.1
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/bin/cli.js +39 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -293,10 +293,36 @@ function migrateKnowledgeWiki(dir, mark) {
|
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
+
function migrateKnowledgeLayerLinks(filePath) {
|
|
297
|
+
if (!fs.existsSync(filePath)) return false;
|
|
298
|
+
const before = safeRead(filePath);
|
|
299
|
+
if (!before) return false;
|
|
300
|
+
|
|
301
|
+
let after = before;
|
|
302
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
303
|
+
|
|
304
|
+
if (/\/wiki\/knowledge\/(sources|glossary|questions|lint)\.md$/.test(normalized)) {
|
|
305
|
+
after = after
|
|
306
|
+
.replace(/\]\(index\.md\)/g, '](../index.md)')
|
|
307
|
+
.replace(/\]\(\.\.\/raw\/README\.md\)/g, '](../../raw/README.md)');
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (/\/wiki\/knowledge\/global\/README\.md$/.test(normalized)) {
|
|
311
|
+
after = after
|
|
312
|
+
.replace(/\]\(\.\.\/index\.md\)/g, '](../../index.md)')
|
|
313
|
+
.replace(/\]\(\.\.\/\.\.\/00-project-brief\.md\)/g, '](../../../00-project-brief.md)')
|
|
314
|
+
.replace(/\]\(\.\.\/\.\.\/06-project-rules\.md\)/g, '](../../../06-project-rules.md)');
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if (after === before) return false;
|
|
318
|
+
write(filePath, after);
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
|
|
296
322
|
function isDefaultKnowledgeScaffold(filePath) {
|
|
297
323
|
const src = safeRead(filePath);
|
|
298
324
|
const name = path.basename(filePath);
|
|
299
|
-
if (name === 'sources.md') return src.includes('# Sources') && src.includes('_No sources recorded yet.
|
|
325
|
+
if (name === 'sources.md') return src.includes('# Sources') && src.includes('_No sources recorded yet.');
|
|
300
326
|
if (name === 'glossary.md') return src.includes('# Glossary') && src.includes('_No terms defined yet.');
|
|
301
327
|
if (name === 'questions.md') return src.includes('# Open Questions') && src.includes('_No open questions yet._');
|
|
302
328
|
if (name === 'lint.md') return src.includes('# Wiki Lint') && src.includes('_No issues found._');
|
|
@@ -2539,6 +2565,17 @@ function run(dir, forceUpdate, action = 'update') {
|
|
|
2539
2565
|
}
|
|
2540
2566
|
ensureWikiScaffoldLinks(memDir, mark);
|
|
2541
2567
|
|
|
2568
|
+
const knowledgeLayerFiles = [
|
|
2569
|
+
path.join(memDir, 'wiki/knowledge/sources.md'),
|
|
2570
|
+
path.join(memDir, 'wiki/knowledge/glossary.md'),
|
|
2571
|
+
path.join(memDir, 'wiki/knowledge/questions.md'),
|
|
2572
|
+
path.join(memDir, 'wiki/knowledge/lint.md'),
|
|
2573
|
+
path.join(memDir, 'wiki/knowledge/global/README.md'),
|
|
2574
|
+
];
|
|
2575
|
+
for (const fp of knowledgeLayerFiles) {
|
|
2576
|
+
if (migrateKnowledgeLayerLinks(fp)) mark('update', `${path.relative(dir, fp)} (wiki links)`);
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2542
2579
|
const legacyReferenceFiles = [
|
|
2543
2580
|
path.join(memDir, '02-current-project-state.md'),
|
|
2544
2581
|
path.join(memDir, '04-handoff.md'),
|
|
@@ -2943,7 +2980,7 @@ ${warnings.length ? warnings.map(x => `- ${x}`).join('\n') : '_None._'}
|
|
|
2943
2980
|
|
|
2944
2981
|
## Related
|
|
2945
2982
|
|
|
2946
|
-
- [Wiki Index](index.md)
|
|
2983
|
+
- [Wiki Index](../index.md)
|
|
2947
2984
|
- [Sources](sources.md)
|
|
2948
2985
|
- [Topics](topics/README.md)
|
|
2949
2986
|
- [Open Questions](questions.md)
|