dotmd-cli 0.14.8 → 0.14.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/rename.mjs +10 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotmd-cli",
3
- "version": "0.14.8",
3
+ "version": "0.14.9",
4
4
  "description": "CLI for managing markdown documents with YAML frontmatter — index, query, validate, graph, export, Notion sync, AI summaries.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/rename.mjs CHANGED
@@ -35,18 +35,17 @@ export async function runRename(argv, config, opts = {}) {
35
35
  die(`File not found: ${oldInput}\nSearched: ${toRepoPath(config.repoRoot, config.repoRoot) || '.'}, ${toRepoPath(config.docsRoot, config.repoRoot)}`);
36
36
  }
37
37
 
38
- // Compute new path in same directory as old
39
- const oldDir = path.dirname(oldPath);
40
- let newBasename = newInput;
41
- // If newInput contains a path separator, use just the basename
38
+ // Compute new path cross-directory if input has slashes, same directory otherwise
39
+ let newPath;
42
40
  if (newInput.includes('/') || newInput.includes(path.sep)) {
43
- newBasename = path.basename(newInput);
41
+ let resolved = newInput;
42
+ if (!resolved.endsWith('.md')) resolved += '.md';
43
+ newPath = path.resolve(config.repoRoot, resolved);
44
+ } else {
45
+ let newBasename = newInput;
46
+ if (!newBasename.endsWith('.md')) newBasename += '.md';
47
+ newPath = path.join(path.dirname(oldPath), newBasename);
44
48
  }
45
- // Add .md if not present
46
- if (!newBasename.endsWith('.md')) {
47
- newBasename += '.md';
48
- }
49
- const newPath = path.join(oldDir, newBasename);
50
49
 
51
50
  if (existsSync(newPath)) {
52
51
  die(`Target already exists: ${toRepoPath(newPath, config.repoRoot)}`);
@@ -56,6 +55,7 @@ export async function runRename(argv, config, opts = {}) {
56
55
  const oldRepoPath = toRepoPath(oldPath, config.repoRoot);
57
56
  const newRepoPath = toRepoPath(newPath, config.repoRoot);
58
57
  const oldBasename = path.basename(oldPath);
58
+ const newBasename = path.basename(newPath);
59
59
 
60
60
  // Scan for references in other docs
61
61
  const allFiles = collectDocFiles(config);