@dboio/cli 0.9.4 → 0.9.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dboio/cli",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "CLI for the DBO.io framework",
5
5
  "type": "module",
6
6
  "bin": {
@@ -2534,10 +2534,11 @@ async function processRecord(entityName, record, structure, options, usedNames,
2534
2534
  }
2535
2535
 
2536
2536
  // If the extension picker chose an extension (record.Extension was null),
2537
- // set it in metadata only — not in the record so the baseline preserves
2538
- // the server's null and push detects the change.
2537
+ // set it in both metadata and the record (baseline). This prevents delta
2538
+ // detection from flagging these as changed immediately after clone.
2539
2539
  if (ext && !record.Extension) {
2540
2540
  meta.Extension = ext;
2541
+ record.Extension = ext;
2541
2542
  }
2542
2543
 
2543
2544
  await writeFile(metaPath, JSON.stringify(meta, null, 2) + '\n');
@@ -591,7 +591,7 @@ async function mvFile(sourceFile, targetBinId, structure, options) {
591
591
  : null;
592
592
 
593
593
  // 1. Update metadata
594
- const metaUpdates = { BinID: targetBinId };
594
+ const metaUpdates = { BinID: targetBinId, _pathConfirmed: undefined };
595
595
  if (newRelativePath) metaUpdates.Path = newRelativePath;
596
596
 
597
597
  // Update content column references if file was renamed
@@ -765,6 +765,10 @@ async function checkPathMismatch(meta, metaPath, entity, options) {
765
765
 
766
766
  if (storedNormalized === currentNormalized) return;
767
767
 
768
+ // If user previously confirmed the metadata Path, skip the prompt.
769
+ // This flag is cleared by `dbo mv` when the file is moved.
770
+ if (meta._pathConfirmed) return;
771
+
768
772
  // Use normalized path for display
769
773
  const currentPath = normalizedCurrentPath;
770
774
 
@@ -787,9 +791,12 @@ async function checkPathMismatch(meta, metaPath, entity, options) {
787
791
 
788
792
  if (updatePath) {
789
793
  meta.Path = currentPath;
790
- // Write updated metadata back to disk
791
- await writeFile(join(dirname(metaPath), basename(metaPath)), JSON.stringify(meta, null, 2) + '\n');
794
+ await writeFile(metaPath, JSON.stringify(meta, null, 2) + '\n');
792
795
  log.success(` Path updated to "${currentPath}"`);
796
+ } else {
797
+ // Remember the decision — don't prompt again until `dbo mv` moves the file
798
+ meta._pathConfirmed = true;
799
+ await writeFile(metaPath, JSON.stringify(meta, null, 2) + '\n');
793
800
  }
794
801
  }
795
802
 
package/src/lib/delta.js CHANGED
@@ -183,13 +183,17 @@ function isReference(value) {
183
183
 
184
184
  /**
185
185
  * Resolve a @reference path to absolute file path.
186
+ * @/ prefix means relative to project root (cwd), plain @ is relative to baseDir.
186
187
  *
187
- * @param {string} reference - Reference string starting with @ (e.g., "@file.html")
188
+ * @param {string} reference - Reference string starting with @ (e.g., "@file.html" or "@/docs/file.md")
188
189
  * @param {string} baseDir - Base directory containing metadata
189
190
  * @returns {string} - Absolute file path
190
191
  */
191
192
  function resolveReferencePath(reference, baseDir) {
192
193
  const refPath = reference.substring(1); // Strip leading @
194
+ if (refPath.startsWith('/')) {
195
+ return join(process.cwd(), refPath);
196
+ }
193
197
  return join(baseDir, refPath);
194
198
  }
195
199