moltguess-cli 1.0.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/index.js +57 -0
- package/package.json +14 -0
package/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { fetch } from 'node-fetch';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import ora from 'ora';
|
|
8
|
+
|
|
9
|
+
// PRODUCTION URL - CHANGE THIS WHEN DEPLOYING
|
|
10
|
+
const BASE_URL = 'http://localhost:3000';
|
|
11
|
+
|
|
12
|
+
async function downloadFile(filename, destDir) {
|
|
13
|
+
const url = `${BASE_URL}/${filename}`;
|
|
14
|
+
const response = await fetch(url);
|
|
15
|
+
if (!response.ok) throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
|
|
16
|
+
const text = await response.text();
|
|
17
|
+
fs.writeFileSync(path.join(destDir, filename), text);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function main() {
|
|
21
|
+
console.log(chalk.green.bold('\nMoltguess Agent Skill Installer\n'));
|
|
22
|
+
|
|
23
|
+
const spinner = ora('Initializing...').start();
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
27
|
+
const skillsDir = path.join(homeDir, '.moltbot', 'skills', 'moltguess');
|
|
28
|
+
|
|
29
|
+
if (!fs.existsSync(skillsDir)) {
|
|
30
|
+
fs.mkdirSync(skillsDir, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
spinner.text = 'Downloading Skill Files...';
|
|
34
|
+
|
|
35
|
+
await downloadFile('SKILL.md', skillsDir);
|
|
36
|
+
await downloadFile('HEARTBEAT.md', skillsDir);
|
|
37
|
+
await downloadFile('skill.json', skillsDir);
|
|
38
|
+
|
|
39
|
+
// Rename skill.json to package.json for standard compatibility if needed
|
|
40
|
+
// But keeping as skill.json is fine too.
|
|
41
|
+
|
|
42
|
+
spinner.succeed(chalk.green('Successfully installed Moltguess Skill!'));
|
|
43
|
+
|
|
44
|
+
console.log(chalk.gray(`\nInstalled to: ${skillsDir}`));
|
|
45
|
+
console.log(chalk.white('\nNext Steps:'));
|
|
46
|
+
console.log(`1. Read the instructions: ${chalk.cyan(path.join(skillsDir, 'SKILL.md'))}`);
|
|
47
|
+
console.log(`2. Register your agent via API.`);
|
|
48
|
+
console.log(`\nHappy Predicting!\n`);
|
|
49
|
+
|
|
50
|
+
} catch (error) {
|
|
51
|
+
spinner.fail(chalk.red('Installation failed.'));
|
|
52
|
+
console.error(error.message);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "moltguess-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI to install the Moltguess Agent Skill",
|
|
5
|
+
"bin": {
|
|
6
|
+
"moltguess": "./index.js"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"node-fetch": "^3.3.0",
|
|
11
|
+
"chalk": "^5.3.0",
|
|
12
|
+
"ora": "^7.0.1"
|
|
13
|
+
}
|
|
14
|
+
}
|