@dboio/cli 0.6.1 → 0.6.3
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/bin/dbo.js +36 -0
- package/bin/postinstall.js +29 -24
- package/package.json +1 -1
package/bin/dbo.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import { createRequire } from 'module';
|
|
5
|
+
import { existsSync, writeFileSync } from 'fs';
|
|
6
|
+
import { homedir } from 'os';
|
|
7
|
+
import { join } from 'path';
|
|
5
8
|
|
|
6
9
|
const require = createRequire(import.meta.url);
|
|
7
10
|
const packageJson = require('../package.json');
|
|
@@ -28,6 +31,36 @@ import { diffCommand } from '../src/commands/diff.js';
|
|
|
28
31
|
import { rmCommand } from '../src/commands/rm.js';
|
|
29
32
|
import { mvCommand } from '../src/commands/mv.js';
|
|
30
33
|
|
|
34
|
+
// First-run welcome message
|
|
35
|
+
function checkFirstRun() {
|
|
36
|
+
const markerFile = join(homedir(), '.dbo-cli-welcomed');
|
|
37
|
+
|
|
38
|
+
if (!existsSync(markerFile)) {
|
|
39
|
+
const RESET = '\x1b[0m';
|
|
40
|
+
const BOLD = '\x1b[1m';
|
|
41
|
+
const DIM = '\x1b[2m';
|
|
42
|
+
const CYAN = '\x1b[36m';
|
|
43
|
+
const YELLOW = '\x1b[33m';
|
|
44
|
+
|
|
45
|
+
console.log('');
|
|
46
|
+
console.log(`${BOLD}${CYAN} Welcome to DBO.io CLI!${RESET}`);
|
|
47
|
+
console.log('');
|
|
48
|
+
console.log(` ${DIM}Available plugins:${RESET}`);
|
|
49
|
+
console.log(` ${YELLOW}Claude Code — /dbo slash command${RESET}`);
|
|
50
|
+
console.log(` ${DIM}dbo install --claudecommand dbo${RESET}`);
|
|
51
|
+
console.log('');
|
|
52
|
+
console.log(` To install all plugins at once, run:`);
|
|
53
|
+
console.log(` ${BOLD}dbo install plugins${RESET}`);
|
|
54
|
+
console.log('');
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
writeFileSync(markerFile, new Date().toISOString());
|
|
58
|
+
} catch {
|
|
59
|
+
// Ignore write errors
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
31
64
|
const program = new Command();
|
|
32
65
|
|
|
33
66
|
program
|
|
@@ -57,4 +90,7 @@ program.addCommand(diffCommand);
|
|
|
57
90
|
program.addCommand(rmCommand);
|
|
58
91
|
program.addCommand(mvCommand);
|
|
59
92
|
|
|
93
|
+
// Show welcome message on first run
|
|
94
|
+
checkFirstRun();
|
|
95
|
+
|
|
60
96
|
program.parse();
|
package/bin/postinstall.js
CHANGED
|
@@ -9,6 +9,11 @@ const DIM = '\x1b[2m';
|
|
|
9
9
|
const CYAN = '\x1b[36m';
|
|
10
10
|
const YELLOW = '\x1b[33m';
|
|
11
11
|
|
|
12
|
+
// Simple log function - console.log works fine in postinstall
|
|
13
|
+
function write(message) {
|
|
14
|
+
console.log(message);
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
// Available plugins — add new entries here as plugins are created
|
|
13
18
|
const PLUGINS = [
|
|
14
19
|
{
|
|
@@ -19,24 +24,24 @@ const PLUGINS = [
|
|
|
19
24
|
];
|
|
20
25
|
|
|
21
26
|
function printStaticMessage() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
write('\n');
|
|
28
|
+
write(`${BOLD}${CYAN} DBO.io CLI installed successfully.${RESET}\n`);
|
|
29
|
+
write('\n');
|
|
30
|
+
write(` ${DIM}Plugins available:${RESET}\n`);
|
|
26
31
|
for (const plugin of PLUGINS) {
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
write(` ${YELLOW}${plugin.label}${RESET}\n`);
|
|
33
|
+
write(` ${DIM}${plugin.command}${RESET}\n`);
|
|
29
34
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
write('\n');
|
|
36
|
+
write(` To install all plugins at once, run:\n`);
|
|
37
|
+
write(` ${BOLD}dbo install plugins${RESET}\n`);
|
|
38
|
+
write('\n');
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
async function promptInteractive() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
write('\n');
|
|
43
|
+
write(`${BOLD}${CYAN} DBO.io CLI installed successfully.${RESET}\n`);
|
|
44
|
+
write('\n');
|
|
40
45
|
|
|
41
46
|
const { default: inquirer } = await import('inquirer');
|
|
42
47
|
|
|
@@ -54,29 +59,29 @@ async function promptInteractive() {
|
|
|
54
59
|
]);
|
|
55
60
|
|
|
56
61
|
if (selected.length === 0) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
write('\n');
|
|
63
|
+
write(` ${DIM}No plugins selected. You can install them later with:${RESET}\n`);
|
|
64
|
+
write(` ${BOLD}dbo install plugins${RESET}\n`);
|
|
65
|
+
write('\n');
|
|
61
66
|
return;
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
const { execSync } = await import('child_process');
|
|
65
70
|
const combined = selected.join(' && ');
|
|
66
71
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
write('\n');
|
|
73
|
+
write(` ${DIM}Running: ${combined}${RESET}\n`);
|
|
74
|
+
write('\n');
|
|
70
75
|
|
|
71
76
|
try {
|
|
72
77
|
execSync(combined, { stdio: 'inherit' });
|
|
73
78
|
} catch {
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
write('\n');
|
|
80
|
+
write(` ${YELLOW}Plugin installation had an issue. You can retry with:${RESET}\n`);
|
|
76
81
|
for (const cmd of selected) {
|
|
77
|
-
|
|
82
|
+
write(` ${BOLD}${cmd}${RESET}\n`);
|
|
78
83
|
}
|
|
79
|
-
|
|
84
|
+
write('\n');
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
87
|
|