beth-copilot 1.0.3 → 1.0.4
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/cli.js +73 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -4,6 +4,7 @@ import { fileURLToPath } from 'url';
|
|
|
4
4
|
import { dirname, join, relative } from 'path';
|
|
5
5
|
import { existsSync, mkdirSync, readdirSync, statSync, copyFileSync, readFileSync, writeFileSync } from 'fs';
|
|
6
6
|
import { createRequire } from 'module';
|
|
7
|
+
import { execSync, spawn } from 'child_process';
|
|
7
8
|
|
|
8
9
|
const require = createRequire(import.meta.url);
|
|
9
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -74,6 +75,60 @@ async function checkForUpdates() {
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
function isBacklogCliInstalled() {
|
|
79
|
+
try {
|
|
80
|
+
execSync('backlog --version', { stdio: 'ignore' });
|
|
81
|
+
return true;
|
|
82
|
+
} catch {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function promptYesNo(question) {
|
|
88
|
+
const readline = await import('readline');
|
|
89
|
+
const rl = readline.createInterface({
|
|
90
|
+
input: process.stdin,
|
|
91
|
+
output: process.stdout
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return new Promise((resolve) => {
|
|
95
|
+
rl.question(`${question} (y/N) `, (answer) => {
|
|
96
|
+
rl.close();
|
|
97
|
+
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async function installBacklogCli() {
|
|
103
|
+
log('\nInstalling backlog.md CLI...', COLORS.cyan);
|
|
104
|
+
|
|
105
|
+
return new Promise((resolve) => {
|
|
106
|
+
const child = spawn('npm', ['install', '-g', 'backlog.md'], {
|
|
107
|
+
stdio: 'inherit',
|
|
108
|
+
shell: true
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
child.on('close', (code) => {
|
|
112
|
+
if (code === 0) {
|
|
113
|
+
logSuccess('backlog.md CLI installed successfully!');
|
|
114
|
+
resolve(true);
|
|
115
|
+
} else {
|
|
116
|
+
logWarning('Failed to install backlog.md CLI. You can install it manually:');
|
|
117
|
+
logInfo('npm i -g backlog.md');
|
|
118
|
+
logInfo(' or');
|
|
119
|
+
logInfo('bun i -g backlog.md');
|
|
120
|
+
resolve(false);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
child.on('error', () => {
|
|
125
|
+
logWarning('Failed to install backlog.md CLI. You can install it manually:');
|
|
126
|
+
logInfo('npm i -g backlog.md');
|
|
127
|
+
resolve(false);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
77
132
|
function showHelp() {
|
|
78
133
|
console.log(`
|
|
79
134
|
${COLORS.bright}Beth${COLORS.reset} - AI Orchestrator for GitHub Copilot
|
|
@@ -227,6 +282,24 @@ ${COLORS.cyan}"I don't do excuses. I do results."${COLORS.reset}
|
|
|
227
282
|
logWarning('No files were copied. Use --force to overwrite existing files.');
|
|
228
283
|
}
|
|
229
284
|
|
|
285
|
+
// Check for backlog.md CLI
|
|
286
|
+
if (!skipBacklog && !isBacklogCliInstalled()) {
|
|
287
|
+
console.log('');
|
|
288
|
+
logWarning('backlog.md CLI is not installed.');
|
|
289
|
+
logInfo('The CLI provides TUI boards, web UI, and task management commands.');
|
|
290
|
+
logInfo('Learn more: https://github.com/MrLesk/Backlog.md');
|
|
291
|
+
console.log('');
|
|
292
|
+
|
|
293
|
+
const shouldInstall = await promptYesNo('Would you like to install the backlog.md CLI globally?');
|
|
294
|
+
if (shouldInstall) {
|
|
295
|
+
await installBacklogCli();
|
|
296
|
+
} else {
|
|
297
|
+
logInfo('Skipped. You can install it later with: npm i -g backlog.md');
|
|
298
|
+
}
|
|
299
|
+
} else if (!skipBacklog) {
|
|
300
|
+
logSuccess('backlog.md CLI is already installed');
|
|
301
|
+
}
|
|
302
|
+
|
|
230
303
|
// Next steps
|
|
231
304
|
console.log(`
|
|
232
305
|
${COLORS.bright}Next steps:${COLORS.reset}
|