dotmd-cli 0.70.1 → 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/bin/dotmd.mjs CHANGED
@@ -1382,6 +1382,12 @@ async function main() {
1382
1382
  let { command, explicitConfig, rootArg, typeArg, dryRun, verbose } = parsed;
1383
1383
  let restArgs = parsed.rest;
1384
1384
 
1385
+ // Tolerate accidentally pasting the command prefix twice, while leaving all
1386
+ // remaining arguments to the normal `use` grammar and path validation.
1387
+ if (command === 'use') {
1388
+ while (restArgs[0] === 'dotmd' && restArgs[1] === 'use') restArgs = restArgs.slice(2);
1389
+ }
1390
+
1385
1391
  // Reconstruct the active global flags for proxy commands (e.g. `watch`) that
1386
1392
  // re-invoke the CLI in a child process and must propagate them through.
1387
1393
  const globalFlagArgs = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotmd-cli",
3
- "version": "0.70.1",
3
+ "version": "0.70.3",
4
4
  "description": "CLI for managing markdown documents with YAML frontmatter — index, query, validate, graph, export, lifecycle, and AI summaries.",
5
5
  "type": "module",
6
6
  "license": "MIT",
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 = collectDocFiles(config).filter(candidate => candidate !== filePath && candidate !== targetPath && !companionPaths.has(path.resolve(candidate)));
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
- })), ...(options.additionalUpdates ?? []).map(item => ({
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
- const refCount = countRefsToUpdate(filePath, targetPath, config);
811
- if (refCount > 0) {
812
- out.write(`${prefix} Would update references in ${refCount} file(s)\n`);
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
  });