dotmd-cli 0.70.2 → 0.70.3
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/package.json +1 -1
- package/src/lifecycle.mjs +20 -11
- package/src/prompts.mjs +4 -1
package/package.json
CHANGED
package/src/lifecycle.mjs
CHANGED
|
@@ -80,10 +80,20 @@ function commitLifecycleMutation(filePath, targetPath, config, updates, historyF
|
|
|
80
80
|
const tracked = isTracked(filePath, config.repoRoot);
|
|
81
81
|
const gitIndex = tracked ? captureGitIndexGeneration(config.repoRoot) : null;
|
|
82
82
|
const companionPaths = new Set((options.additionalUpdates ?? []).map(item => path.resolve(item.path)));
|
|
83
|
-
const allFiles =
|
|
83
|
+
const allFiles = options.skipInboundRefs
|
|
84
|
+
? []
|
|
85
|
+
: collectDocFiles(config).filter(candidate => candidate !== filePath && candidate !== targetPath && !companionPaths.has(path.resolve(candidate)));
|
|
84
86
|
authorizeManagedSweep(allFiles, config, { kind: 'Reference rewrite source' });
|
|
85
87
|
const identities = createReferenceIdentitySet([filePath, ...allFiles]);
|
|
86
88
|
const referenceFields = configuredReferenceFields(config);
|
|
89
|
+
const additionalUpdates = options.skipInboundRefs
|
|
90
|
+
? (options.additionalUpdates ?? [])
|
|
91
|
+
: (options.additionalUpdates ?? []).map(item => ({
|
|
92
|
+
...item,
|
|
93
|
+
content: item.content === undefined ? undefined : rewriteDocumentReferences(item.content, {
|
|
94
|
+
sourcePath: item.path, repoRoot: config.repoRoot, identities, oldPath: filePath, newPath: targetPath, referenceFields,
|
|
95
|
+
}),
|
|
96
|
+
}));
|
|
87
97
|
const moveResult = moveFileAtomic(filePath, targetPath, sourceContent => {
|
|
88
98
|
result = render(sourceContent);
|
|
89
99
|
return result.content;
|
|
@@ -95,12 +105,7 @@ function commitLifecycleMutation(filePath, targetPath, config, updates, historyF
|
|
|
95
105
|
render: raw => rewriteDocumentReferences(raw, {
|
|
96
106
|
sourcePath: docFile, repoRoot: config.repoRoot, identities, oldPath: filePath, newPath: targetPath, referenceFields,
|
|
97
107
|
}),
|
|
98
|
-
})), ...
|
|
99
|
-
...item,
|
|
100
|
-
content: item.content === undefined ? undefined : rewriteDocumentReferences(item.content, {
|
|
101
|
-
sourcePath: item.path, repoRoot: config.repoRoot, identities, oldPath: filePath, newPath: targetPath, referenceFields,
|
|
102
|
-
}),
|
|
103
|
-
}))],
|
|
108
|
+
})), ...additionalUpdates],
|
|
104
109
|
creations: options.creations ?? [],
|
|
105
110
|
gitMove: tracked,
|
|
106
111
|
gitIndex,
|
|
@@ -806,10 +811,13 @@ export function runArchive(argv, config, opts = {}) {
|
|
|
806
811
|
if (config.indexPath && !noIndex && !opts.deferIndex) out.write(`${prefix} Would regenerate index\n`);
|
|
807
812
|
if (config.indexPath && noIndex) out.write(`${prefix} Would skip index regen (--no-index)\n`);
|
|
808
813
|
|
|
809
|
-
// Preview reference updates
|
|
810
|
-
|
|
811
|
-
if (
|
|
812
|
-
|
|
814
|
+
// Preview reference updates unless the caller owns a non-referenceable,
|
|
815
|
+
// session-local document such as a saved prompt.
|
|
816
|
+
if (!opts.skipInboundRefs) {
|
|
817
|
+
const refCount = countRefsToUpdate(filePath, targetPath, config);
|
|
818
|
+
if (refCount > 0) {
|
|
819
|
+
out.write(`${prefix} Would update references in ${refCount} file(s)\n`);
|
|
820
|
+
}
|
|
813
821
|
}
|
|
814
822
|
|
|
815
823
|
// Preview onArchive hook fire
|
|
@@ -825,6 +833,7 @@ export function runArchive(argv, config, opts = {}) {
|
|
|
825
833
|
testHooks: opts.testHooks,
|
|
826
834
|
additionalUpdates: [...(opts.additionalUpdates ?? []), ...(releaseUpdate ? [releaseUpdate] : [])],
|
|
827
835
|
creations: opts.creations,
|
|
836
|
+
skipInboundRefs: opts.skipInboundRefs,
|
|
828
837
|
bodyTransform: closeoutTemplate ? currentBody => {
|
|
829
838
|
committedCloseoutAction = planCloseoutInjection(currentBody);
|
|
830
839
|
return committedCloseoutAction.action === 'inject' ? committedCloseoutAction.newBody : currentBody;
|
package/src/prompts.mjs
CHANGED
|
@@ -270,7 +270,7 @@ export async function consumePrompt(filePath, config, opts) {
|
|
|
270
270
|
process.stderr.write(body);
|
|
271
271
|
if (!body.endsWith('\n')) process.stderr.write('\n');
|
|
272
272
|
process.stderr.write(`${dim('--->8---')}\n`);
|
|
273
|
-
runArchive([filePath], config, { dryRun: true, noIndex, out: process.stderr });
|
|
273
|
+
runArchive([filePath], config, { dryRun: true, noIndex, out: process.stderr, skipInboundRefs: true });
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
276
|
|
|
@@ -284,6 +284,9 @@ export async function consumePrompt(filePath, config, opts) {
|
|
|
284
284
|
out: process.stderr,
|
|
285
285
|
testHooks: opts.testHooks,
|
|
286
286
|
deferIndex: Boolean(linkedClaim),
|
|
287
|
+
// Saved prompts are gitignored session state, never durable reference
|
|
288
|
+
// targets. Avoid locking and replanning the entire corpus on consumption.
|
|
289
|
+
skipInboundRefs: true,
|
|
287
290
|
additionalUpdates: linkedClaim?.prepared?.updates,
|
|
288
291
|
creations: linkedClaim?.prepared?.creations,
|
|
289
292
|
});
|