spawn-skill 1.2.4 → 1.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/bin/cli.js +63 -48
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -492,41 +492,46 @@ const RELAY = 'wss://spawn-relay.ngvsqdjj5r.workers.dev/v1/agent';
|
|
|
492
492
|
let ws;
|
|
493
493
|
let moltbotPath = null;
|
|
494
494
|
|
|
495
|
-
// Find moltbot executable
|
|
495
|
+
// Find moltbot executable (also check for old name 'clawdbot')
|
|
496
496
|
function findMoltbot() {
|
|
497
497
|
if (moltbotPath) return moltbotPath;
|
|
498
498
|
|
|
499
|
-
// Try
|
|
500
|
-
const
|
|
501
|
-
'moltbot', // In PATH
|
|
502
|
-
path.join(os.homedir(), '.npm-global', 'bin', 'moltbot'),
|
|
503
|
-
path.join(os.homedir(), '.nvm', 'versions', 'node', process.version, 'bin', 'moltbot'),
|
|
504
|
-
'/usr/local/bin/moltbot',
|
|
505
|
-
'/opt/homebrew/bin/moltbot',
|
|
506
|
-
];
|
|
499
|
+
// Try both names - moltbot and clawdbot (old name)
|
|
500
|
+
const names = ['moltbot', 'clawdbot'];
|
|
507
501
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
|
|
502
|
+
for (const name of names) {
|
|
503
|
+
// Try common locations
|
|
504
|
+
const candidates = [
|
|
505
|
+
name, // In PATH
|
|
506
|
+
path.join(os.homedir(), '.npm-global', 'bin', name),
|
|
507
|
+
path.join(os.homedir(), '.nvm', 'versions', 'node', process.version, 'bin', name),
|
|
508
|
+
'/usr/local/bin/' + name,
|
|
509
|
+
'/opt/homebrew/bin/' + name,
|
|
510
|
+
];
|
|
513
511
|
|
|
514
|
-
|
|
512
|
+
// Also try to get npm prefix
|
|
515
513
|
try {
|
|
516
|
-
execSync(
|
|
517
|
-
|
|
518
|
-
moltbotPath = cmd;
|
|
519
|
-
return cmd;
|
|
514
|
+
const npmPrefix = execSync('npm config get prefix', { encoding: 'utf8', shell: true }).trim();
|
|
515
|
+
candidates.push(path.join(npmPrefix, 'bin', name));
|
|
520
516
|
} catch {}
|
|
521
|
-
}
|
|
522
517
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
518
|
+
for (const cmd of candidates) {
|
|
519
|
+
try {
|
|
520
|
+
execSync(\`"\${cmd}" --version\`, { stdio: 'pipe', shell: true });
|
|
521
|
+
console.log(\`✓ Found \${name} at:\`, cmd);
|
|
522
|
+
moltbotPath = cmd;
|
|
523
|
+
return cmd;
|
|
524
|
+
} catch {}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// Try npx
|
|
528
|
+
try {
|
|
529
|
+
execSync(\`npx \${name} --version\`, { stdio: 'pipe', shell: true });
|
|
530
|
+
console.log(\`✓ Found \${name} via npx\`);
|
|
531
|
+
moltbotPath = \`npx \${name}\`;
|
|
532
|
+
return \`npx \${name}\`;
|
|
533
|
+
} catch {}
|
|
534
|
+
}
|
|
530
535
|
|
|
531
536
|
return null;
|
|
532
537
|
}
|
|
@@ -564,8 +569,10 @@ async function askMoltbot(message) {
|
|
|
564
569
|
|
|
565
570
|
// Build command based on whether we're using npx or direct path
|
|
566
571
|
let proc;
|
|
567
|
-
if (cmd
|
|
568
|
-
|
|
572
|
+
if (cmd.startsWith('npx ')) {
|
|
573
|
+
// npx moltbot or npx clawdbot
|
|
574
|
+
const pkgName = cmd.split(' ')[1];
|
|
575
|
+
proc = spawn('npx', [pkgName, 'agent', '--message', message, '--thinking', 'high'], {
|
|
569
576
|
shell: true,
|
|
570
577
|
env: { ...process.env }
|
|
571
578
|
});
|
|
@@ -771,38 +778,46 @@ async function main() {
|
|
|
771
778
|
|
|
772
779
|
console.log('');
|
|
773
780
|
|
|
774
|
-
// Check for Moltbot if needed
|
|
781
|
+
// Check for Moltbot if needed (also check old name 'clawdbot')
|
|
775
782
|
if (useMoltbot) {
|
|
776
783
|
const moltbotCheck = ora('Checking for Moltbot...').start();
|
|
777
784
|
let moltbotFound = false;
|
|
785
|
+
let foundName = null;
|
|
778
786
|
const { execSync } = await import('child_process');
|
|
779
787
|
const os = await import('os');
|
|
780
788
|
|
|
781
|
-
// Try
|
|
782
|
-
const
|
|
783
|
-
'moltbot --version',
|
|
784
|
-
'npx moltbot --version',
|
|
785
|
-
`"${path.join(os.homedir(), '.npm-global', 'bin', 'moltbot')}" --version`,
|
|
786
|
-
'/usr/local/bin/moltbot --version',
|
|
787
|
-
'/opt/homebrew/bin/moltbot --version',
|
|
788
|
-
];
|
|
789
|
+
// Try both names
|
|
790
|
+
const names = ['moltbot', 'clawdbot'];
|
|
789
791
|
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
const npmPrefix = execSync('npm config get prefix', { encoding: 'utf8', shell: true }).trim();
|
|
793
|
-
candidates.push(`"${path.join(npmPrefix, 'bin', 'moltbot')}" --version`);
|
|
794
|
-
} catch {}
|
|
792
|
+
for (const name of names) {
|
|
793
|
+
if (moltbotFound) break;
|
|
795
794
|
|
|
796
|
-
|
|
795
|
+
const candidates = [
|
|
796
|
+
`${name} --version`,
|
|
797
|
+
`npx ${name} --version`,
|
|
798
|
+
`"${path.join(os.homedir(), '.npm-global', 'bin', name)}" --version`,
|
|
799
|
+
`/usr/local/bin/${name} --version`,
|
|
800
|
+
`/opt/homebrew/bin/${name} --version`,
|
|
801
|
+
];
|
|
802
|
+
|
|
803
|
+
// Also try npm prefix
|
|
797
804
|
try {
|
|
798
|
-
execSync(
|
|
799
|
-
|
|
800
|
-
break;
|
|
805
|
+
const npmPrefix = execSync('npm config get prefix', { encoding: 'utf8', shell: true }).trim();
|
|
806
|
+
candidates.push(`"${path.join(npmPrefix, 'bin', name)}" --version`);
|
|
801
807
|
} catch {}
|
|
808
|
+
|
|
809
|
+
for (const cmd of candidates) {
|
|
810
|
+
try {
|
|
811
|
+
execSync(cmd, { stdio: 'pipe', shell: true });
|
|
812
|
+
moltbotFound = true;
|
|
813
|
+
foundName = name;
|
|
814
|
+
break;
|
|
815
|
+
} catch {}
|
|
816
|
+
}
|
|
802
817
|
}
|
|
803
818
|
|
|
804
819
|
if (moltbotFound) {
|
|
805
|
-
moltbotCheck.succeed('Moltbot found');
|
|
820
|
+
moltbotCheck.succeed(foundName === 'clawdbot' ? 'Found clawdbot (old name for Moltbot)' : 'Moltbot found');
|
|
806
821
|
} else {
|
|
807
822
|
moltbotCheck.warn('Moltbot not found');
|
|
808
823
|
console.log(dim(' Install with: npm install -g moltbot@latest'));
|