spawn-skill 1.3.1 → 1.3.2

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