spawn-skill 1.3.1 → 1.3.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.
Files changed (2) hide show
  1. package/bin/cli.js +61 -4
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -474,7 +474,8 @@ class SpawnAgent:
474
474
  }
475
475
 
476
476
  function getMoltbotBridge(token, agentName, moltbotAgent = '') {
477
- const agentFlag = moltbotAgent ? `, '--agent', '${moltbotAgent}'` : '';
477
+ // moltbot agent command doesn't need --agent flag, just --message and --thinking
478
+ const agentFlag = '';
478
479
  return `/**
479
480
  * Spawn.wtf → Moltbot Bridge
480
481
  * Routes messages from Spawn iOS app to your Moltbot backend
@@ -656,7 +657,7 @@ process.on('SIGINT', () => { ws?.close(); process.exit(0); });
656
657
  `;
657
658
  }
658
659
 
659
- async function createSkillFiles(token, agentName, language) {
660
+ async function createSkillFiles(token, agentName, language, useMoltbot = false, moltbotAgent = '') {
660
661
  const skillDir = path.join(process.cwd(), 'spawn');
661
662
 
662
663
  // Create spawn directory
@@ -678,7 +679,11 @@ async function createSkillFiles(token, agentName, language) {
678
679
 
679
680
  if (language === 'typescript') {
680
681
  // TypeScript/Node setup
681
- fs.writeFileSync(path.join(skillDir, 'connect.js'), getTypeScriptConnector(token, agentName));
682
+ if (useMoltbot) {
683
+ fs.writeFileSync(path.join(skillDir, 'connect.js'), getMoltbotBridge(token, agentName, moltbotAgent));
684
+ } else {
685
+ fs.writeFileSync(path.join(skillDir, 'connect.js'), getTypeScriptConnector(token, agentName));
686
+ }
682
687
 
683
688
  const packageJson = {
684
689
  name: "spawn-agent",
@@ -761,18 +766,70 @@ async function main() {
761
766
  });
762
767
  }
763
768
 
769
+ questions.push({
770
+ type: 'confirm',
771
+ name: 'useMoltbot',
772
+ message: 'Use Moltbot/Clawdbot as your AI backend?',
773
+ default: false
774
+ });
775
+
764
776
  const answers = await inquirer.prompt(questions);
765
777
 
766
778
  token = token || answers.token;
767
779
  agentName = answers.agentName || agentName;
768
780
  language = language || answers.language;
781
+ const useMoltbot = answers.useMoltbot || false;
782
+
783
+ // Moltbot doesn't need an agent name - it uses --message and --thinking flags
784
+ let moltbotAgent = '';
769
785
 
770
786
  console.log('');
771
787
 
788
+ // Check for Moltbot if needed
789
+ if (useMoltbot) {
790
+ const moltbotCheck = ora('Checking for Moltbot/Clawdbot...').start();
791
+ let moltbotFound = false;
792
+ let foundName = null;
793
+ const { execSync } = await import('child_process');
794
+ const os = await import('os');
795
+
796
+ const names = ['moltbot', 'clawdbot'];
797
+ for (const name of names) {
798
+ if (moltbotFound) break;
799
+ const candidates = [
800
+ `${name} --version`,
801
+ `npx ${name} --version`,
802
+ `/usr/local/bin/${name} --version`,
803
+ `/opt/homebrew/bin/${name} --version`,
804
+ ];
805
+ try {
806
+ const npmPrefix = execSync('npm config get prefix', { encoding: 'utf8', shell: true }).trim();
807
+ candidates.push(`"${path.join(npmPrefix, 'bin', name)}" --version`);
808
+ } catch {}
809
+
810
+ for (const cmd of candidates) {
811
+ try {
812
+ execSync(cmd, { stdio: 'pipe', shell: true });
813
+ moltbotFound = true;
814
+ foundName = name;
815
+ break;
816
+ } catch {}
817
+ }
818
+ }
819
+
820
+ if (moltbotFound) {
821
+ moltbotCheck.succeed(`Found ${foundName}`);
822
+ } else {
823
+ moltbotCheck.warn('Moltbot/Clawdbot not found');
824
+ console.log(dim(' Install with: npm install -g moltbot'));
825
+ console.log('');
826
+ }
827
+ }
828
+
772
829
  // Create files
773
830
  const createSpinner = ora('Creating skill files...').start();
774
831
  try {
775
- const { skillDir } = await createSkillFiles(token, agentName, language);
832
+ const { skillDir } = await createSkillFiles(token, agentName, language, useMoltbot, moltbotAgent);
776
833
  createSpinner.succeed('Created skill files');
777
834
  } catch (err) {
778
835
  createSpinner.fail('Failed to create skill files');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spawn-skill",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Connect your AI agent to Spawn.wtf",
5
5
  "bin": {
6
6
  "spawn-skill": "./bin/cli.js"