@dboio/cli 0.19.4 → 0.20.0
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/README.md +69 -16
- package/bin/dbo.js +5 -0
- package/package.json +1 -1
- package/plugins/claude/dbo/.claude-plugin/plugin.json +6 -1
- package/plugins/claude/dbo/commands/dbo.md +39 -12
- package/plugins/claude/dbo/docs/dbo-cli-readme.md +69 -16
- package/plugins/claude/dbo/skills/cookbook/SKILL.md +162 -0
- package/plugins/claude/dbo/skills/white-paper/SKILL.md +49 -8
- package/plugins/claude/dbo/skills/white-paper/references/api-reference.md +1 -1
- package/plugins/claude/track/.claude-plugin/plugin.json +1 -1
- package/src/commands/adopt.js +69 -14
- package/src/commands/clone.js +451 -87
- package/src/commands/init.js +2 -2
- package/src/commands/input.js +2 -2
- package/src/commands/login.js +3 -3
- package/src/commands/push.js +203 -54
- package/src/commands/status.js +15 -7
- package/src/lib/config.js +137 -10
- package/src/lib/filenames.js +54 -66
- package/src/lib/ignore.js +3 -0
- package/src/lib/insert.js +29 -45
- package/src/lib/structure.js +23 -8
- package/src/lib/ticketing.js +9 -8
- package/src/migrations/008-metadata-uid-in-suffix.js +4 -2
- package/src/migrations/009-fix-media-collision-metadata-names.js +9 -3
- package/src/migrations/013-remove-uid-from-meta-filenames.js +117 -0
- package/src/migrations/014-entity-dir-to-data-source.js +68 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { readdir, rename, mkdir, rmdir, access } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { log } from '../lib/logger.js';
|
|
4
|
+
|
|
5
|
+
export const description = 'Move lib/entity/ files into lib/data_source/';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Migration 014 — Relocate entity records from lib/entity/ into lib/data_source/.
|
|
9
|
+
*
|
|
10
|
+
* Entity (table-definition) records are now co-located with data source records
|
|
11
|
+
* under lib/data_source/. Files keep their _entity: "entity" metadata value —
|
|
12
|
+
* only their directory changes.
|
|
13
|
+
*
|
|
14
|
+
* If lib/data_source/ already contains a file with the same name, the source
|
|
15
|
+
* file is left in place and a warning is emitted; no data is overwritten.
|
|
16
|
+
*/
|
|
17
|
+
export default async function run() {
|
|
18
|
+
const cwd = process.cwd();
|
|
19
|
+
const srcDir = join(cwd, 'lib', 'entity');
|
|
20
|
+
|
|
21
|
+
// Nothing to do if lib/entity/ doesn't exist
|
|
22
|
+
try {
|
|
23
|
+
await access(srcDir);
|
|
24
|
+
} catch {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const entries = await readdir(srcDir, { withFileTypes: true });
|
|
29
|
+
if (entries.length === 0) {
|
|
30
|
+
// Empty directory — just remove it
|
|
31
|
+
try { await rmdir(srcDir); } catch { /* ignore */ }
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const destDir = join(cwd, 'lib', 'data_source');
|
|
36
|
+
await mkdir(destDir, { recursive: true });
|
|
37
|
+
|
|
38
|
+
let movedCount = 0;
|
|
39
|
+
let skippedCount = 0;
|
|
40
|
+
|
|
41
|
+
for (const entry of entries) {
|
|
42
|
+
const srcPath = join(srcDir, entry.name);
|
|
43
|
+
const destPath = join(destDir, entry.name);
|
|
44
|
+
|
|
45
|
+
// Check for collision
|
|
46
|
+
try {
|
|
47
|
+
await access(destPath);
|
|
48
|
+
log.warn(` Migration 014: skipped ${entry.name} — already exists in lib/data_source/`);
|
|
49
|
+
skippedCount++;
|
|
50
|
+
continue;
|
|
51
|
+
} catch { /* dest absent — safe to move */ }
|
|
52
|
+
|
|
53
|
+
await rename(srcPath, destPath);
|
|
54
|
+
movedCount++;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Remove lib/entity/ if now empty
|
|
58
|
+
try {
|
|
59
|
+
const remaining = await readdir(srcDir);
|
|
60
|
+
if (remaining.length === 0) {
|
|
61
|
+
await rmdir(srcDir);
|
|
62
|
+
}
|
|
63
|
+
} catch { /* ignore */ }
|
|
64
|
+
|
|
65
|
+
if (movedCount > 0) {
|
|
66
|
+
log.success(` Migration 014: moved ${movedCount} file(s) from lib/entity/ → lib/data_source/${skippedCount > 0 ? ` (${skippedCount} skipped — collision)` : ''}`);
|
|
67
|
+
}
|
|
68
|
+
}
|