spawn-skill 1.2.6 → 1.3.0
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 +4 -82
- 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) {
|
|
660
660
|
const skillDir = path.join(process.cwd(), 'spawn');
|
|
661
661
|
|
|
662
662
|
// Create spawn directory
|
|
@@ -678,11 +678,7 @@ async function createSkillFiles(token, agentName, language, useMoltbot = false,
|
|
|
678
678
|
|
|
679
679
|
if (language === 'typescript') {
|
|
680
680
|
// TypeScript/Node setup
|
|
681
|
-
|
|
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
|
-
}
|
|
681
|
+
fs.writeFileSync(path.join(skillDir, 'connect.js'), getTypeScriptConnector(token, agentName));
|
|
686
682
|
|
|
687
683
|
const packageJson = {
|
|
688
684
|
name: "spawn-agent",
|
|
@@ -701,7 +697,7 @@ async function createSkillFiles(token, agentName, language, useMoltbot = false,
|
|
|
701
697
|
fs.writeFileSync(path.join(skillDir, 'requirements.txt'), 'websockets>=12.0\n');
|
|
702
698
|
}
|
|
703
699
|
|
|
704
|
-
return { skillDir, language
|
|
700
|
+
return { skillDir, language };
|
|
705
701
|
}
|
|
706
702
|
|
|
707
703
|
async function main() {
|
|
@@ -765,92 +761,18 @@ async function main() {
|
|
|
765
761
|
});
|
|
766
762
|
}
|
|
767
763
|
|
|
768
|
-
questions.push({
|
|
769
|
-
type: 'confirm',
|
|
770
|
-
name: 'useMoltbot',
|
|
771
|
-
message: 'Use Moltbot/Clawdbot as your AI backend?',
|
|
772
|
-
default: false
|
|
773
|
-
});
|
|
774
|
-
|
|
775
764
|
const answers = await inquirer.prompt(questions);
|
|
776
765
|
|
|
777
766
|
token = token || answers.token;
|
|
778
767
|
agentName = answers.agentName || agentName;
|
|
779
768
|
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
|
-
validate: (input) => {
|
|
791
|
-
if (!input.trim()) {
|
|
792
|
-
return 'Agent name is required. Check your moltbot/clawdbot config.';
|
|
793
|
-
}
|
|
794
|
-
return true;
|
|
795
|
-
}
|
|
796
|
-
}]);
|
|
797
|
-
moltbotAgent = moltbotAnswers.moltbotAgent;
|
|
798
|
-
}
|
|
799
769
|
|
|
800
770
|
console.log('');
|
|
801
771
|
|
|
802
|
-
// Check for Moltbot if needed (also check old name 'clawdbot')
|
|
803
|
-
if (useMoltbot) {
|
|
804
|
-
const moltbotCheck = ora('Checking for Moltbot...').start();
|
|
805
|
-
let moltbotFound = false;
|
|
806
|
-
let foundName = null;
|
|
807
|
-
const { execSync } = await import('child_process');
|
|
808
|
-
const os = await import('os');
|
|
809
|
-
|
|
810
|
-
// Try both names
|
|
811
|
-
const names = ['moltbot', 'clawdbot'];
|
|
812
|
-
|
|
813
|
-
for (const name of names) {
|
|
814
|
-
if (moltbotFound) break;
|
|
815
|
-
|
|
816
|
-
const candidates = [
|
|
817
|
-
`${name} --version`,
|
|
818
|
-
`npx ${name} --version`,
|
|
819
|
-
`"${path.join(os.homedir(), '.npm-global', 'bin', name)}" --version`,
|
|
820
|
-
`/usr/local/bin/${name} --version`,
|
|
821
|
-
`/opt/homebrew/bin/${name} --version`,
|
|
822
|
-
];
|
|
823
|
-
|
|
824
|
-
// Also try npm prefix
|
|
825
|
-
try {
|
|
826
|
-
const npmPrefix = execSync('npm config get prefix', { encoding: 'utf8', shell: true }).trim();
|
|
827
|
-
candidates.push(`"${path.join(npmPrefix, 'bin', name)}" --version`);
|
|
828
|
-
} catch {}
|
|
829
|
-
|
|
830
|
-
for (const cmd of candidates) {
|
|
831
|
-
try {
|
|
832
|
-
execSync(cmd, { stdio: 'pipe', shell: true });
|
|
833
|
-
moltbotFound = true;
|
|
834
|
-
foundName = name;
|
|
835
|
-
break;
|
|
836
|
-
} catch {}
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
if (moltbotFound) {
|
|
841
|
-
moltbotCheck.succeed(foundName === 'clawdbot' ? 'Found clawdbot (old name for Moltbot)' : 'Moltbot found');
|
|
842
|
-
} else {
|
|
843
|
-
moltbotCheck.warn('Moltbot not found');
|
|
844
|
-
console.log(dim(' Install with: npm install -g moltbot@latest'));
|
|
845
|
-
console.log(dim(' Then run: moltbot onboard'));
|
|
846
|
-
console.log('');
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
|
|
850
772
|
// Create files
|
|
851
773
|
const createSpinner = ora('Creating skill files...').start();
|
|
852
774
|
try {
|
|
853
|
-
const { skillDir } = await createSkillFiles(token, agentName, language
|
|
775
|
+
const { skillDir } = await createSkillFiles(token, agentName, language);
|
|
854
776
|
createSpinner.succeed('Created skill files');
|
|
855
777
|
} catch (err) {
|
|
856
778
|
createSpinner.fail('Failed to create skill files');
|