@hasna/skills 0.1.37 → 0.1.39
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/index.js +315 -89
- package/bin/mcp.js +34 -9
- package/dist/index.js +20 -7
- package/package.json +1 -1
- package/skills/_common/auth.ts +8 -12
- package/skills/_common/http-client.ts +4 -4
- package/skills/audio/SKILL.md +1 -1
- package/skills/codefix/package.json +4 -4
- package/skills/codefix/src/index-local.ts +2 -1
- package/skills/codefix/src/index.ts +2 -108
- package/skills/convert/SKILL.md +2 -2
- package/skills/convert/package.json +4 -4
- package/skills/convert/src/index-local.ts +11 -12
- package/skills/convert/src/index.ts +2 -108
- package/skills/deploy/package.json +3 -3
- package/skills/deploy/src/http-client.ts +4 -4
- package/skills/deploy/src/index-local.ts +2 -1
- package/skills/deploy/src/index.ts +2 -109
- package/skills/extract/package.json +4 -4
- package/skills/extract/src/index-local.ts +2 -1
- package/skills/extract/src/index.ts +2 -108
- package/skills/image/SKILL.md +2 -2
- package/skills/music/SKILL.md +1 -1
- package/skills/transcript/SKILL.md +2 -2
- package/skills/video/SKILL.md +1 -1
- package/skills/write/SKILL.md +2 -2
- package/skills/write/package.json +4 -4
- package/skills/write/src/index-local.ts +2 -1
- package/skills/write/src/index.ts +2 -108
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"description": "Deployment CLI for managing EC2 deployments with automated health checks",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "src/index.ts",
|
|
6
|
+
"main": "src/index-local.ts",
|
|
7
7
|
"bin": {
|
|
8
8
|
"deploy": "src/index-local.ts"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"start": "bun run src/index.ts",
|
|
12
|
-
"dev": "bun run --watch src/index.ts"
|
|
11
|
+
"start": "bun run src/index-local.ts",
|
|
12
|
+
"dev": "bun run --watch src/index-local.ts"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {},
|
|
15
15
|
"devDependencies": {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Usage: import and call executeSkill() from your skill CLI
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
const SKILL_API_URL = process.env.SKILL_API_URL || "
|
|
8
|
+
const SKILL_API_URL = process.env.SKILLS_API_URL || process.env.SKILL_API_URL || "https://skills.md/api/v1";
|
|
9
9
|
|
|
10
10
|
export interface SkillRequest {
|
|
11
11
|
skill: string;
|
|
@@ -33,12 +33,12 @@ export async function executeSkill(request: SkillRequest): Promise<SkillResponse
|
|
|
33
33
|
const url = `${SKILL_API_URL}/${skill}/`;
|
|
34
34
|
|
|
35
35
|
// Get API key from environment
|
|
36
|
-
const apiKey = process.env.SKILL_API_KEY;
|
|
36
|
+
const apiKey = process.env.SKILLS_API_KEY || process.env.SKILL_API_KEY;
|
|
37
37
|
if (!apiKey) {
|
|
38
38
|
return {
|
|
39
39
|
success: false,
|
|
40
|
-
error: "Missing
|
|
41
|
-
details: "Set
|
|
40
|
+
error: "Missing SKILLS_API_KEY",
|
|
41
|
+
details: "Set SKILLS_API_KEY environment variable or run `skills auth login`"
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -13,7 +13,7 @@ const SKILL_META = {
|
|
|
13
13
|
description: 'Deployment CLI for managing EC2 deployments with automated health checks',
|
|
14
14
|
version: '1.0.0',
|
|
15
15
|
commands: `Use: deploy --help`,
|
|
16
|
-
requiredEnvVars: [
|
|
16
|
+
requiredEnvVars: [],
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
if (await handleInstallCommand(SKILL_META, process.argv.slice(2))) {
|
|
@@ -38,6 +38,7 @@ function parseArgs(): {
|
|
|
38
38
|
parallel?: boolean;
|
|
39
39
|
} {
|
|
40
40
|
const args = process.argv.slice(2);
|
|
41
|
+
if (args[0] === '--help' || args[0] === '-h') args[0] = 'help';
|
|
41
42
|
const parsed: Record<string, any> = {
|
|
42
43
|
command: args[0] || 'help',
|
|
43
44
|
hosts: [],
|
|
@@ -1,111 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Calls the remote skill API server
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { executeAndSave, executeSkill } from './http-client';
|
|
9
|
-
import { handleInstallCommand } from '../../_common';
|
|
10
|
-
|
|
11
|
-
// Skill metadata for install command
|
|
12
|
-
const SKILL_META = {
|
|
13
|
-
name: 'deploy',
|
|
14
|
-
description: 'Deploy skill - calls remote API',
|
|
15
|
-
version: '1.0.0',
|
|
16
|
-
commands: `deploy <command> [options]`,
|
|
17
|
-
requiredEnvVars: ['SKILL_API_KEY'],
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// Handle install/uninstall commands
|
|
21
|
-
if (await handleInstallCommand(SKILL_META, process.argv.slice(2))) {
|
|
22
|
-
process.exit(0);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Parse command line arguments
|
|
26
|
-
function parseArgs(): Record<string, string | boolean> {
|
|
27
|
-
const args = process.argv.slice(2);
|
|
28
|
-
const parsed: Record<string, string | boolean> = {};
|
|
29
|
-
|
|
30
|
-
for (let i = 0; i < args.length; i++) {
|
|
31
|
-
if (args[i].startsWith('--')) {
|
|
32
|
-
const key = args[i].slice(2);
|
|
33
|
-
const value = args[i + 1];
|
|
34
|
-
if (value && !value.startsWith('--')) {
|
|
35
|
-
parsed[key] = value;
|
|
36
|
-
i++;
|
|
37
|
-
} else {
|
|
38
|
-
parsed[key] = true;
|
|
39
|
-
}
|
|
40
|
-
} else if (!parsed.command) {
|
|
41
|
-
parsed.command = args[i];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return parsed;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Main logic
|
|
49
|
-
async function main() {
|
|
50
|
-
const args = parseArgs();
|
|
51
|
-
const command = (args.command as string) || 'help';
|
|
52
|
-
|
|
53
|
-
if (command === 'help' || args.help) {
|
|
54
|
-
console.log(`Skill Deploy CLI
|
|
55
|
-
|
|
56
|
-
USAGE:
|
|
57
|
-
deploy <command> [options]
|
|
58
|
-
|
|
59
|
-
COMMANDS:
|
|
60
|
-
Call with any command and it will be forwarded to the remote API server
|
|
61
|
-
|
|
62
|
-
EXAMPLES:
|
|
63
|
-
deploy generate --provider <provider> [options]`);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Extract all parameters
|
|
68
|
-
const { command: cmd, ...params } = args;
|
|
69
|
-
|
|
70
|
-
// Check if output file is expected (for file-generating skills)
|
|
71
|
-
const fileSkills = ['audio', 'image', 'video', 'emoji'];
|
|
72
|
-
const isFileSkill = fileSkills.includes('deploy');
|
|
73
|
-
|
|
74
|
-
if (isFileSkill && params.output) {
|
|
75
|
-
// Skill that generates files
|
|
76
|
-
const success = await executeAndSave({
|
|
77
|
-
skill: 'deploy',
|
|
78
|
-
command: cmd,
|
|
79
|
-
...params,
|
|
80
|
-
});
|
|
81
|
-
process.exit(success ? 0 : 1);
|
|
82
|
-
} else {
|
|
83
|
-
// Skill that returns JSON/text
|
|
84
|
-
const result = await executeSkill({
|
|
85
|
-
skill: 'deploy',
|
|
86
|
-
command: cmd,
|
|
87
|
-
...params,
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
if (result instanceof Blob) {
|
|
91
|
-
console.error('❌ Unexpected binary response');
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (result.success && result.output) {
|
|
96
|
-
console.log(result.output);
|
|
97
|
-
} else {
|
|
98
|
-
console.error(`❌ Error: ${result.error}`);
|
|
99
|
-
if (result.details) {
|
|
100
|
-
console.error(` ${result.details}`);
|
|
101
|
-
}
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Run main
|
|
108
|
-
main().catch((error) => {
|
|
109
|
-
console.error('❌ Fatal error:', error.message);
|
|
110
|
-
process.exit(1);
|
|
111
|
-
});
|
|
3
|
+
// Keep the package root on the local implementation; hosted execution goes through the root Skills CLI.
|
|
4
|
+
import "./index-local";
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"name": "extract",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"description": "Extract text and structured data from images and PDFs using OpenAI Vision",
|
|
5
|
-
"main": "src/index.ts",
|
|
5
|
+
"main": "src/index-local.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"extract": "src/index.ts"
|
|
8
|
+
"extract": "src/index-local.ts"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"start": "bun run src/index.ts",
|
|
12
|
-
"extract": "bun run src/index.ts extract"
|
|
11
|
+
"start": "bun run src/index-local.ts",
|
|
12
|
+
"extract": "bun run src/index-local.ts extract"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"extraction",
|
|
@@ -13,7 +13,7 @@ const SKILL_META = {
|
|
|
13
13
|
description: 'Extract text and structured data from images and PDFs using OpenAI Vision',
|
|
14
14
|
version: '1.0.0',
|
|
15
15
|
commands: `Use: extract --help`,
|
|
16
|
-
requiredEnvVars: [
|
|
16
|
+
requiredEnvVars: [],
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
if (await handleInstallCommand(SKILL_META, process.argv.slice(2))) {
|
|
@@ -36,6 +36,7 @@ function parseArgs(): {
|
|
|
36
36
|
detail?: 'low' | 'high' | 'auto';
|
|
37
37
|
} {
|
|
38
38
|
const args = process.argv.slice(2);
|
|
39
|
+
if (args[0] === '--help' || args[0] === '-h') args[0] = 'help';
|
|
39
40
|
const parsed: any = { command: args[0] || 'help' };
|
|
40
41
|
|
|
41
42
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -1,110 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Calls the remote skill API server
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { executeAndSave, executeSkill, handleInstallCommand } from '../../_common';
|
|
9
|
-
|
|
10
|
-
// Skill metadata for install command
|
|
11
|
-
const SKILL_META = {
|
|
12
|
-
name: 'extract',
|
|
13
|
-
description: 'Extract skill - calls remote API',
|
|
14
|
-
version: '1.0.0',
|
|
15
|
-
commands: `extract <command> [options]`,
|
|
16
|
-
requiredEnvVars: ['SKILL_API_KEY'],
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// Handle install/uninstall commands
|
|
20
|
-
if (await handleInstallCommand(SKILL_META, process.argv.slice(2))) {
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Parse command line arguments
|
|
25
|
-
function parseArgs(): Record<string, string | boolean> {
|
|
26
|
-
const args = process.argv.slice(2);
|
|
27
|
-
const parsed: Record<string, string | boolean> = {};
|
|
28
|
-
|
|
29
|
-
for (let i = 0; i < args.length; i++) {
|
|
30
|
-
if (args[i].startsWith('--')) {
|
|
31
|
-
const key = args[i].slice(2);
|
|
32
|
-
const value = args[i + 1];
|
|
33
|
-
if (value && !value.startsWith('--')) {
|
|
34
|
-
parsed[key] = value;
|
|
35
|
-
i++;
|
|
36
|
-
} else {
|
|
37
|
-
parsed[key] = true;
|
|
38
|
-
}
|
|
39
|
-
} else if (!parsed.command) {
|
|
40
|
-
parsed.command = args[i];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return parsed;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Main logic
|
|
48
|
-
async function main() {
|
|
49
|
-
const args = parseArgs();
|
|
50
|
-
const command = (args.command as string) || 'help';
|
|
51
|
-
|
|
52
|
-
if (command === 'help' || args.help) {
|
|
53
|
-
console.log(`Skill Extract CLI
|
|
54
|
-
|
|
55
|
-
USAGE:
|
|
56
|
-
extract <command> [options]
|
|
57
|
-
|
|
58
|
-
COMMANDS:
|
|
59
|
-
Call with any command and it will be forwarded to the remote API server
|
|
60
|
-
|
|
61
|
-
EXAMPLES:
|
|
62
|
-
extract generate --provider <provider> [options]`);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Extract all parameters
|
|
67
|
-
const { command: cmd, ...params } = args;
|
|
68
|
-
|
|
69
|
-
// Check if output file is expected (for file-generating skills)
|
|
70
|
-
const fileSkills = ['audio', 'image', 'video', 'emoji'];
|
|
71
|
-
const isFileSkill = fileSkills.includes('extract');
|
|
72
|
-
|
|
73
|
-
if (isFileSkill && params.output) {
|
|
74
|
-
// Skill that generates files
|
|
75
|
-
const success = await executeAndSave({
|
|
76
|
-
skill: 'extract',
|
|
77
|
-
command: cmd,
|
|
78
|
-
...params,
|
|
79
|
-
});
|
|
80
|
-
process.exit(success ? 0 : 1);
|
|
81
|
-
} else {
|
|
82
|
-
// Skill that returns JSON/text
|
|
83
|
-
const result = await executeSkill({
|
|
84
|
-
skill: 'extract',
|
|
85
|
-
command: cmd,
|
|
86
|
-
...params,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
if (result instanceof Blob) {
|
|
90
|
-
console.error('❌ Unexpected binary response');
|
|
91
|
-
process.exit(1);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (result.success && result.output) {
|
|
95
|
-
console.log(result.output);
|
|
96
|
-
} else {
|
|
97
|
-
console.error(`❌ Error: ${result.error}`);
|
|
98
|
-
if (result.details) {
|
|
99
|
-
console.error(` ${result.details}`);
|
|
100
|
-
}
|
|
101
|
-
process.exit(1);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Run main
|
|
107
|
-
main().catch((error) => {
|
|
108
|
-
console.error('❌ Fatal error:', error.message);
|
|
109
|
-
process.exit(1);
|
|
110
|
-
});
|
|
3
|
+
// Keep the package root on the local implementation; hosted execution goes through the root Skills CLI.
|
|
4
|
+
import "./index-local";
|
package/skills/image/SKILL.md
CHANGED
|
@@ -7,7 +7,7 @@ description: Generate images using OpenAI, Minimax, or Gemini through the hosted
|
|
|
7
7
|
|
|
8
8
|
Generate high-quality images from text prompts using provider-backed image models.
|
|
9
9
|
|
|
10
|
-
This CLI is API-backed. Set `
|
|
10
|
+
This CLI is API-backed. Set `SKILLS_API_KEY` when routing through the hosted Skills runtime; provider-specific keys are managed by that runtime and billed at the selected provider/model cost.
|
|
11
11
|
|
|
12
12
|
## Supported Providers
|
|
13
13
|
|
|
@@ -46,4 +46,4 @@ image generate --provider gemini --model imagen-4.0-fast-generate-001 --prompt "
|
|
|
46
46
|
|
|
47
47
|
## Environment Variables
|
|
48
48
|
|
|
49
|
-
Set `
|
|
49
|
+
Set `SKILLS_API_KEY` for hosted runtime execution.
|
package/skills/music/SKILL.md
CHANGED
|
@@ -7,7 +7,7 @@ description: Transcribe audio and video files using ElevenLabs Scribe, OpenAI Wh
|
|
|
7
7
|
|
|
8
8
|
This skill provides high-quality speech-to-text transcription using multiple AI providers. It automatically handles large files through compression and chunking.
|
|
9
9
|
|
|
10
|
-
This CLI is API-backed. Set `
|
|
10
|
+
This CLI is API-backed. Set `SKILLS_API_KEY` when routing through the hosted skills/connectors runtime; provider-specific keys are managed by that runtime.
|
|
11
11
|
|
|
12
12
|
## Supported Providers
|
|
13
13
|
|
|
@@ -85,7 +85,7 @@ The skill automatically handles files larger than provider limits:
|
|
|
85
85
|
## Configuration
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
export
|
|
88
|
+
export SKILLS_API_KEY=your_skill_api_key
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
## Dependencies
|
package/skills/video/SKILL.md
CHANGED
package/skills/write/SKILL.md
CHANGED
|
@@ -7,7 +7,7 @@ description: Generate high-quality articles using parallel AI agents. Supports r
|
|
|
7
7
|
|
|
8
8
|
This skill spawns parallel AI agents to research and write articles on any topic. Each article goes through a multi-phase pipeline:
|
|
9
9
|
|
|
10
|
-
This CLI is API-backed. Set `
|
|
10
|
+
This CLI is API-backed. Set `SKILLS_API_KEY` when routing through the hosted skills/connectors runtime; provider-specific keys are managed by that runtime.
|
|
11
11
|
|
|
12
12
|
1. **Research Agent** - Gathers information and key points about the topic
|
|
13
13
|
2. **Writer Agent** - Creates a well-structured article based on the research
|
|
@@ -50,7 +50,7 @@ bun run src/index.ts batch \
|
|
|
50
50
|
Set the hosted runtime API key:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
export
|
|
53
|
+
export SKILLS_API_KEY=your_skill_api_key
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
## Output Format
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"description": "Article writing skill that spawns parallel AI agents to research and write articles with image generation",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "src/index.ts",
|
|
6
|
+
"main": "src/index-local.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"write": "src/index.ts"
|
|
8
|
+
"write": "src/index-local.ts"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"start": "bun run src/index.ts",
|
|
12
|
-
"dev": "bun run --watch src/index.ts"
|
|
11
|
+
"start": "bun run src/index-local.ts",
|
|
12
|
+
"dev": "bun run --watch src/index-local.ts"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"article",
|
|
@@ -13,7 +13,7 @@ const SKILL_META = {
|
|
|
13
13
|
description: 'Article writing skill that spawns parallel AI agents to research and write articles with image generation',
|
|
14
14
|
version: '1.0.0',
|
|
15
15
|
commands: `Use: write --help`,
|
|
16
|
-
requiredEnvVars: [
|
|
16
|
+
requiredEnvVars: [],
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
if (await handleInstallCommand(SKILL_META, process.argv.slice(2))) {
|
|
@@ -36,6 +36,7 @@ function parseArgs(): {
|
|
|
36
36
|
filename?: string;
|
|
37
37
|
} {
|
|
38
38
|
const args = process.argv.slice(2);
|
|
39
|
+
if (args[0] === '--help' || args[0] === '-h') args[0] = 'help';
|
|
39
40
|
const parsed: any = { command: args[0] || 'help' };
|
|
40
41
|
|
|
41
42
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -1,110 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Calls the remote skill API server
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { executeAndSave, executeSkill, handleInstallCommand } from '../../_common';
|
|
9
|
-
|
|
10
|
-
// Skill metadata for install command
|
|
11
|
-
const SKILL_META = {
|
|
12
|
-
name: 'write',
|
|
13
|
-
description: 'Write skill - calls remote API',
|
|
14
|
-
version: '1.0.0',
|
|
15
|
-
commands: `write <command> [options]`,
|
|
16
|
-
requiredEnvVars: ['SKILL_API_KEY'],
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// Handle install/uninstall commands
|
|
20
|
-
if (await handleInstallCommand(SKILL_META, process.argv.slice(2))) {
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Parse command line arguments
|
|
25
|
-
function parseArgs(): Record<string, string | boolean> {
|
|
26
|
-
const args = process.argv.slice(2);
|
|
27
|
-
const parsed: Record<string, string | boolean> = {};
|
|
28
|
-
|
|
29
|
-
for (let i = 0; i < args.length; i++) {
|
|
30
|
-
if (args[i].startsWith('--')) {
|
|
31
|
-
const key = args[i].slice(2);
|
|
32
|
-
const value = args[i + 1];
|
|
33
|
-
if (value && !value.startsWith('--')) {
|
|
34
|
-
parsed[key] = value;
|
|
35
|
-
i++;
|
|
36
|
-
} else {
|
|
37
|
-
parsed[key] = true;
|
|
38
|
-
}
|
|
39
|
-
} else if (!parsed.command) {
|
|
40
|
-
parsed.command = args[i];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return parsed;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Main logic
|
|
48
|
-
async function main() {
|
|
49
|
-
const args = parseArgs();
|
|
50
|
-
const command = (args.command as string) || 'help';
|
|
51
|
-
|
|
52
|
-
if (command === 'help' || args.help) {
|
|
53
|
-
console.log(`Skill Write CLI
|
|
54
|
-
|
|
55
|
-
USAGE:
|
|
56
|
-
write <command> [options]
|
|
57
|
-
|
|
58
|
-
COMMANDS:
|
|
59
|
-
Call with any command and it will be forwarded to the remote API server
|
|
60
|
-
|
|
61
|
-
EXAMPLES:
|
|
62
|
-
write generate --provider <provider> [options]`);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Extract all parameters
|
|
67
|
-
const { command: cmd, ...params } = args;
|
|
68
|
-
|
|
69
|
-
// Check if output file is expected (for file-generating skills)
|
|
70
|
-
const fileSkills = ['audio', 'image', 'video', 'emoji'];
|
|
71
|
-
const isFileSkill = fileSkills.includes('write');
|
|
72
|
-
|
|
73
|
-
if (isFileSkill && params.output) {
|
|
74
|
-
// Skill that generates files
|
|
75
|
-
const success = await executeAndSave({
|
|
76
|
-
skill: 'write',
|
|
77
|
-
command: cmd,
|
|
78
|
-
...params,
|
|
79
|
-
});
|
|
80
|
-
process.exit(success ? 0 : 1);
|
|
81
|
-
} else {
|
|
82
|
-
// Skill that returns JSON/text
|
|
83
|
-
const result = await executeSkill({
|
|
84
|
-
skill: 'write',
|
|
85
|
-
command: cmd,
|
|
86
|
-
...params,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
if (result instanceof Blob) {
|
|
90
|
-
console.error('❌ Unexpected binary response');
|
|
91
|
-
process.exit(1);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (result.success && result.output) {
|
|
95
|
-
console.log(result.output);
|
|
96
|
-
} else {
|
|
97
|
-
console.error(`❌ Error: ${result.error}`);
|
|
98
|
-
if (result.details) {
|
|
99
|
-
console.error(` ${result.details}`);
|
|
100
|
-
}
|
|
101
|
-
process.exit(1);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Run main
|
|
107
|
-
main().catch((error) => {
|
|
108
|
-
console.error('❌ Fatal error:', error.message);
|
|
109
|
-
process.exit(1);
|
|
110
|
-
});
|
|
3
|
+
// Keep the package root on the local implementation; hosted execution goes through the root Skills CLI.
|
|
4
|
+
import "./index-local";
|