@stan-chen/simple-cli 0.2.4 → 0.2.5
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/dist/llm.js +8 -1
- package/dist/tui.js +6 -1
- package/package.json +1 -1
package/dist/llm.js
CHANGED
|
@@ -20,7 +20,14 @@ export class LLM {
|
|
|
20
20
|
let py = join(__dirname, 'anyllm.py');
|
|
21
21
|
if (!fs.existsSync(py))
|
|
22
22
|
py = join(process.cwd(), 'src/lib/anyllm.py'); // Fallback
|
|
23
|
-
|
|
23
|
+
// Try to find a working python command
|
|
24
|
+
const getPyCmd = () => {
|
|
25
|
+
const isWin = process.platform === 'win32';
|
|
26
|
+
// On Windows, preferred is 'python' or 'py' if they aren't store aliases
|
|
27
|
+
// On Linux/Mac, preferred is 'python3'
|
|
28
|
+
return isWin ? 'python' : 'python3';
|
|
29
|
+
};
|
|
30
|
+
const child = spawn(getPyCmd(), [py]);
|
|
24
31
|
let out = '';
|
|
25
32
|
let err = '';
|
|
26
33
|
child.stdout.on('data', d => out += d);
|
package/dist/tui.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import pc from 'picocolors';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { join, dirname } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const pkg = JSON.parse(fs.readFileSync(join(__dirname, '../package.json'), 'utf8'));
|
|
2
7
|
export function showBanner() {
|
|
3
8
|
const cat = `
|
|
4
9
|
/\\_/\\
|
|
@@ -6,5 +11,5 @@ export function showBanner() {
|
|
|
6
11
|
> ^ <
|
|
7
12
|
`;
|
|
8
13
|
console.log(pc.magenta(cat));
|
|
9
|
-
console.log(` ${pc.bgMagenta(pc.black(' SIMPLE-CLI '))} ${pc.dim(
|
|
14
|
+
console.log(` ${pc.bgMagenta(pc.black(' SIMPLE-CLI '))} ${pc.dim(`v${pkg.version}`)}\n`);
|
|
10
15
|
}
|