@dboio/cli 0.9.8 → 0.11.1

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 (38) hide show
  1. package/README.md +172 -70
  2. package/bin/dbo.js +2 -0
  3. package/bin/postinstall.js +9 -1
  4. package/package.json +3 -3
  5. package/plugins/claude/dbo/commands/dbo.md +3 -3
  6. package/plugins/claude/dbo/skills/cli/SKILL.md +3 -3
  7. package/src/commands/add.js +50 -0
  8. package/src/commands/clone.js +720 -552
  9. package/src/commands/content.js +7 -3
  10. package/src/commands/deploy.js +22 -7
  11. package/src/commands/diff.js +41 -3
  12. package/src/commands/init.js +42 -79
  13. package/src/commands/input.js +5 -0
  14. package/src/commands/login.js +2 -2
  15. package/src/commands/mv.js +3 -0
  16. package/src/commands/output.js +8 -10
  17. package/src/commands/pull.js +268 -87
  18. package/src/commands/push.js +814 -94
  19. package/src/commands/rm.js +4 -1
  20. package/src/commands/status.js +12 -1
  21. package/src/commands/sync.js +71 -0
  22. package/src/lib/client.js +10 -0
  23. package/src/lib/config.js +80 -8
  24. package/src/lib/delta.js +178 -25
  25. package/src/lib/diff.js +150 -20
  26. package/src/lib/folder-icon.js +120 -0
  27. package/src/lib/ignore.js +2 -3
  28. package/src/lib/input-parser.js +37 -10
  29. package/src/lib/metadata-templates.js +21 -4
  30. package/src/lib/migrations.js +75 -0
  31. package/src/lib/save-to-disk.js +1 -1
  32. package/src/lib/scaffold.js +58 -3
  33. package/src/lib/structure.js +158 -21
  34. package/src/lib/toe-stepping.js +381 -0
  35. package/src/migrations/001-transaction-key-preset-scope.js +35 -0
  36. package/src/migrations/002-move-entity-dirs-to-lib.js +190 -0
  37. package/src/migrations/003-move-deploy-config.js +50 -0
  38. package/src/migrations/004-rename-output-files.js +101 -0
@@ -13,6 +13,8 @@ import { setFileTimestamps } from '../lib/timestamps.js';
13
13
  import { checkStoredTicket, clearGlobalTicket } from '../lib/ticketing.js';
14
14
  import { checkModifyKey, isModifyKeyError, handleModifyKeyError } from '../lib/modify-key.js';
15
15
  import { loadIgnore } from '../lib/ignore.js';
16
+ import { loadStructureFile, findBinByPath } from '../lib/structure.js';
17
+ import { runPendingMigrations } from '../lib/migrations.js';
16
18
 
17
19
  export const addCommand = new Command('add')
18
20
  .description('Add a new file to DBO.io (creates record on server)')
@@ -26,8 +28,10 @@ export const addCommand = new Command('add')
26
28
  .option('--jq <expr>', 'Filter JSON response')
27
29
  .option('-v, --verbose', 'Show HTTP request details')
28
30
  .option('--domain <host>', 'Override domain')
31
+ .option('--no-migrate', 'Skip pending migrations for this invocation')
29
32
  .action(async (targetPath, options) => {
30
33
  try {
34
+ await runPendingMigrations(options);
31
35
  const client = new DboClient({ domain: options.domain, verbose: options.verbose });
32
36
 
33
37
  // ModifyKey guard
@@ -75,6 +79,45 @@ async function detectDocumentationFile(filePath) {
75
79
  return { entity: 'extension', descriptor: 'documentation' };
76
80
  }
77
81
 
82
+ /**
83
+ * Detect whether a file is manifest.json at the project root.
84
+ * Returns { meta, metaPath } or null if not applicable.
85
+ *
86
+ * Creates companion metadata in bins/app/ with pre-filled fields.
87
+ */
88
+ async function detectManifestFile(filePath) {
89
+ const rel = relative(process.cwd(), filePath).replace(/\\/g, '/');
90
+ if (rel.toLowerCase() !== 'manifest.json') return null;
91
+
92
+ const appConfig = await loadAppConfig();
93
+ const structure = await loadStructureFile();
94
+ const appBin = findBinByPath('app', structure);
95
+
96
+ const companionDir = join(process.cwd(), 'bins', 'app');
97
+ await mkdir(companionDir, { recursive: true });
98
+
99
+ const meta = {
100
+ _entity: 'content',
101
+ _contentColumns: ['Content'],
102
+ Content: '@/manifest.json',
103
+ Path: 'manifest.json',
104
+ Name: 'manifest.json',
105
+ Extension: 'JSON',
106
+ Public: 1,
107
+ Active: 1,
108
+ Title: 'PWA Manifest',
109
+ };
110
+
111
+ if (appBin) meta.BinID = appBin.binId;
112
+ if (appConfig.AppID) meta.AppID = appConfig.AppID;
113
+
114
+ const metaPath = join(companionDir, 'manifest.metadata.json');
115
+ await writeFile(metaPath, JSON.stringify(meta, null, 2) + '\n');
116
+ log.success(`Created manifest metadata at ${metaPath}`);
117
+
118
+ return { meta, metaPath };
119
+ }
120
+
78
121
  async function addSingleFile(filePath, client, options, batchDefaults) {
79
122
  // Check .dboignore before doing any processing
80
123
  const ig = await loadIgnore();
@@ -186,6 +229,12 @@ async function addSingleFile(filePath, client, options, batchDefaults) {
186
229
  return await submitAdd(docMeta, docMetaFile, filePath, client, options);
187
230
  }
188
231
 
232
+ // Step 3d: Auto-detect manifest.json at project root
233
+ const manifestMeta = await detectManifestFile(filePath);
234
+ if (manifestMeta) {
235
+ return await submitAdd(manifestMeta.meta, manifestMeta.metaPath, filePath, client, options);
236
+ }
237
+
189
238
  // Step 4: No usable metadata — interactive wizard
190
239
  const inquirer = (await import('inquirer')).default;
191
240
 
@@ -386,6 +435,7 @@ async function submitAdd(meta, metaPath, filePath, client, options) {
386
435
  result = await client.postUrlEncoded('/api/input/submit', body);
387
436
  }
388
437
 
438
+ if (result.successful) await client.voidCache();
389
439
  formatResponse(result, { json: options.json, jq: options.jq, verbose: options.verbose });
390
440
 
391
441
  if (!result.successful) {