shadowdocs 2.5.3 → 2.5.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 +25 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -5,14 +5,20 @@ import { loadConfig, saveConfig } from '../dist/core/config.js';
|
|
|
5
5
|
import { validateApiKey } from '../dist/services/ai.js';
|
|
6
6
|
import { ExitCodes } from '../dist/core/types.js';
|
|
7
7
|
import readline from 'readline';
|
|
8
|
+
import chalk from 'chalk';
|
|
8
9
|
|
|
9
10
|
async function main() {
|
|
10
11
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
11
12
|
|
|
12
13
|
const args = process.argv.slice(2);
|
|
14
|
+
const isInteractive = process.stdin.isTTY && process.stdout.isTTY;
|
|
13
15
|
|
|
14
16
|
if (args.length === 0) {
|
|
15
|
-
|
|
17
|
+
if (isInteractive) {
|
|
18
|
+
startApp();
|
|
19
|
+
} else {
|
|
20
|
+
await runNonInteractive();
|
|
21
|
+
}
|
|
16
22
|
return;
|
|
17
23
|
}
|
|
18
24
|
|
|
@@ -106,4 +112,21 @@ async function main() {
|
|
|
106
112
|
main().catch((err) => {
|
|
107
113
|
console.error(' Error:', err.message);
|
|
108
114
|
process.exit(ExitCodes.FATAL_INPUT_ERROR);
|
|
109
|
-
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
async function runNonInteractive() {
|
|
118
|
+
console.log('');
|
|
119
|
+
console.log(chalk.cyan.bold('╔══════════════════════════════════════════╗'));
|
|
120
|
+
console.log(chalk.cyan.bold('║ SHADOWDOCS CLI ║'));
|
|
121
|
+
console.log(chalk.cyan.bold('╚══════════════════════════════════════════╝'));
|
|
122
|
+
console.log('');
|
|
123
|
+
console.log(chalk.yellow(' Commands:'));
|
|
124
|
+
console.log(chalk.white(' g - Generate Docs'));
|
|
125
|
+
console.log(chalk.white(' i - Improve Docs'));
|
|
126
|
+
console.log(chalk.white(' e - Explain Project'));
|
|
127
|
+
console.log(chalk.white(' s - Settings'));
|
|
128
|
+
console.log(chalk.white(' h - Help'));
|
|
129
|
+
console.log(chalk.white(' q - Quit'));
|
|
130
|
+
console.log('');
|
|
131
|
+
console.log(chalk.dim(' Run in a real terminal for full interactive UI.'));
|
|
132
|
+
}
|