@dboio/cli 0.9.3 → 0.9.5

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.3",
3
+ "version": "0.9.5",
4
4
  "description": "CLI for the DBO.io framework",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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
@@ -15,7 +15,7 @@ import { stripUidFromFilename, renameToUidConvention, hasUidInFilename } from '.
15
15
  import { findMetadataFiles } from '../lib/diff.js';
16
16
  import { loadIgnore } from '../lib/ignore.js';
17
17
  import { detectChangedColumns, findBaselineEntry } from '../lib/delta.js';
18
- import { BINS_DIR } from '../lib/structure.js';
18
+ import { BINS_DIR, ENTITY_DIR_NAMES } from '../lib/structure.js';
19
19
 
20
20
  /**
21
21
  * Resolve an @reference file path to an absolute filesystem path.
@@ -450,9 +450,10 @@ async function pushFromMetadata(meta, metaPath, client, options, changedColumns
450
450
  throw new Error(`No _entity found in ${metaPath}`);
451
451
  }
452
452
 
453
- // Detect path mismatch
453
+ // Detect path mismatch (only for content, media, output, bin entities —
454
+ // entity-dir types use structural directories unrelated to server Path)
454
455
  if (meta.Path) {
455
- await checkPathMismatch(meta, metaPath, options);
456
+ await checkPathMismatch(meta, metaPath, entity, options);
456
457
  }
457
458
 
458
459
  const dataExprs = [];
@@ -721,7 +722,12 @@ function normalizePathForComparison(localPath) {
721
722
  /**
722
723
  * Detect if a file has been moved to a different directory than its metadata Path suggests
723
724
  */
724
- async function checkPathMismatch(meta, metaPath, options) {
725
+ async function checkPathMismatch(meta, metaPath, entity, options) {
726
+ // Skip entity-dir types (extension, site, group, etc.) — their local
727
+ // directory placement is structural and unrelated to the server Path column.
728
+ // Only compare paths for content, media, output, and bin-placed entities.
729
+ if (ENTITY_DIR_NAMES.has(entity)) return;
730
+
725
731
  const metaDir = dirname(metaPath);
726
732
  const metaBase = basename(metaPath, '.metadata.json');
727
733
 
@@ -759,6 +765,10 @@ async function checkPathMismatch(meta, metaPath, options) {
759
765
 
760
766
  if (storedNormalized === currentNormalized) return;
761
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
+
762
772
  // Use normalized path for display
763
773
  const currentPath = normalizedCurrentPath;
764
774
 
@@ -781,9 +791,12 @@ async function checkPathMismatch(meta, metaPath, options) {
781
791
 
782
792
  if (updatePath) {
783
793
  meta.Path = currentPath;
784
- // Write updated metadata back to disk
785
- await writeFile(join(dirname(metaPath), basename(metaPath)), JSON.stringify(meta, null, 2) + '\n');
794
+ await writeFile(metaPath, JSON.stringify(meta, null, 2) + '\n');
786
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');
787
800
  }
788
801
  }
789
802