@orth/cli 0.3.1 → 0.5.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/CHANGELOG.md +58 -0
- package/README.md +113 -109
- package/dist/analytics.d.ts +36 -8
- package/dist/analytics.js +247 -47
- package/dist/api.d.ts +34 -2
- package/dist/api.js +68 -13
- package/dist/command-actions.d.ts +10 -0
- package/dist/command-actions.js +42 -0
- package/dist/commands/account.d.ts +9 -1
- package/dist/commands/account.js +26 -10
- package/dist/commands/api.d.ts +3 -0
- package/dist/commands/api.js +114 -117
- package/dist/commands/auth.d.ts +3 -1
- package/dist/commands/auth.js +53 -9
- package/dist/commands/onboard/flow.d.ts +22 -0
- package/dist/commands/onboard/flow.js +155 -0
- package/dist/commands/onboard/guide.d.ts +8 -0
- package/dist/commands/onboard/guide.js +73 -0
- package/dist/commands/onboard/listing.d.ts +18 -0
- package/dist/commands/onboard/listing.js +166 -0
- package/dist/commands/onboard/progress.d.ts +44 -0
- package/dist/commands/onboard/progress.js +108 -0
- package/dist/commands/onboard/register.d.ts +2 -0
- package/dist/commands/onboard/register.js +261 -0
- package/dist/commands/onboard/requests.d.ts +24 -0
- package/dist/commands/onboard/requests.js +96 -0
- package/dist/commands/onboard/review.d.ts +31 -0
- package/dist/commands/onboard/review.js +228 -0
- package/dist/commands/onboard/setup.d.ts +68 -0
- package/dist/commands/onboard/setup.js +215 -0
- package/dist/commands/onboard/shared.d.ts +41 -0
- package/dist/commands/onboard/shared.js +97 -0
- package/dist/commands/onboard/tools.d.ts +19 -0
- package/dist/commands/onboard/tools.js +104 -0
- package/dist/commands/org.d.ts +21 -0
- package/dist/commands/org.js +126 -0
- package/dist/commands/payouts.d.ts +44 -0
- package/dist/commands/payouts.js +125 -0
- package/dist/commands/run.d.ts +2 -1
- package/dist/commands/run.js +23 -29
- package/dist/commands/search.d.ts +8 -1
- package/dist/commands/search.js +28 -4
- package/dist/commands/skills/browse.d.ts +15 -0
- package/dist/commands/skills/browse.js +194 -0
- package/dist/commands/skills/create.d.ts +5 -0
- package/dist/commands/skills/create.js +62 -0
- package/dist/commands/skills/init.d.ts +4 -0
- package/dist/commands/skills/init.js +123 -0
- package/dist/commands/skills/install.d.ts +6 -0
- package/dist/commands/skills/install.js +191 -0
- package/dist/commands/skills/local-files.d.ts +15 -0
- package/dist/commands/skills/local-files.js +110 -0
- package/dist/commands/skills/register.d.ts +2 -0
- package/dist/commands/skills/register.js +130 -0
- package/dist/commands/skills/shared.d.ts +43 -0
- package/dist/commands/skills/shared.js +69 -0
- package/dist/commands/skills/upload.d.ts +9 -0
- package/dist/commands/skills/upload.js +223 -0
- package/dist/commands/skills/verification.d.ts +5 -0
- package/dist/commands/skills/verification.js +74 -0
- package/dist/commands/telemetry.d.ts +3 -0
- package/dist/commands/telemetry.js +38 -0
- package/dist/config.d.ts +55 -1
- package/dist/config.js +102 -3
- package/dist/http.d.ts +15 -0
- package/dist/http.js +41 -0
- package/dist/index.js +133 -162
- package/dist/last-search.d.ts +19 -0
- package/dist/last-search.js +60 -0
- package/dist/organizations.d.ts +14 -0
- package/dist/organizations.js +77 -0
- package/dist/urls.d.ts +3 -0
- package/dist/urls.js +34 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +112 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.js +21 -0
- package/dist/x402.d.ts +7 -0
- package/dist/x402.js +27 -0
- package/package.json +23 -22
- package/dist/commands/skills.d.ts +0 -66
- package/dist/commands/skills.js +0 -821
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.skillsListCommand = skillsListCommand;
|
|
7
|
+
exports.skillsMineCommand = skillsMineCommand;
|
|
8
|
+
exports.skillsSearchCommand = skillsSearchCommand;
|
|
9
|
+
exports.skillsShowCommand = skillsShowCommand;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const ora_1 = __importDefault(require("ora"));
|
|
12
|
+
const api_js_1 = require("../../api.js");
|
|
13
|
+
const utils_js_1 = require("../../utils.js");
|
|
14
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
15
|
+
// orth skills list
|
|
16
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
17
|
+
async function skillsListCommand(options) {
|
|
18
|
+
const spinner = (0, ora_1.default)("Loading skills...").start();
|
|
19
|
+
try {
|
|
20
|
+
const limit = parseInt(options.limit, 10);
|
|
21
|
+
const data = await (0, api_js_1.apiRequest)(`/skills?limit=${limit}`);
|
|
22
|
+
spinner.stop();
|
|
23
|
+
if (options.json) {
|
|
24
|
+
console.log(JSON.stringify(data, null, 2));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!data.skills || data.skills.length === 0) {
|
|
28
|
+
console.log(chalk_1.default.yellow("No discoverable skills found."));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
console.log(chalk_1.default.bold(`\nDiscoverable Skills (${data.total} total):\n`));
|
|
32
|
+
for (const skill of data.skills) {
|
|
33
|
+
const verified = skill.verified ? chalk_1.default.blue(" ✓") : "";
|
|
34
|
+
const installs = chalk_1.default.gray(`(${skill.installCount} installs)`);
|
|
35
|
+
const source = skill.sourceType === "github" && skill.githubOwner
|
|
36
|
+
? chalk_1.default.gray(` [${skill.githubOwner}/${skill.githubRepo}]`)
|
|
37
|
+
: chalk_1.default.gray(" [uploaded]");
|
|
38
|
+
console.log(chalk_1.default.cyan.bold(skill.name) + verified + source + " " + installs);
|
|
39
|
+
if (skill.description) {
|
|
40
|
+
console.log(chalk_1.default.gray(` ${skill.description.slice(0, 100)}${skill.description.length > 100 ? "..." : ""}`));
|
|
41
|
+
}
|
|
42
|
+
if (skill.tags && skill.tags.length > 0) {
|
|
43
|
+
console.log(chalk_1.default.gray(" Tags: ") +
|
|
44
|
+
skill.tags.map((t) => chalk_1.default.magenta(t)).join(", "));
|
|
45
|
+
}
|
|
46
|
+
console.log(chalk_1.default.gray(` Slug: ${skill.slug}`));
|
|
47
|
+
console.log();
|
|
48
|
+
}
|
|
49
|
+
console.log(chalk_1.default.gray(`Run '${(0, utils_js_1.cliName)()} skills show <slug>' to see skill details`));
|
|
50
|
+
console.log(chalk_1.default.gray(`Run '${(0, utils_js_1.cliName)()} skills add <slug>' to add a skill locally`));
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
spinner.stop();
|
|
54
|
+
console.error(chalk_1.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
59
|
+
// orth skills mine
|
|
60
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
61
|
+
async function skillsMineCommand(options) {
|
|
62
|
+
const spinner = (0, ora_1.default)("Loading your skills...").start();
|
|
63
|
+
try {
|
|
64
|
+
const limit = parseInt(options.limit, 10) || 50;
|
|
65
|
+
const data = await (0, api_js_1.apiRequest)(`/skills/mine?limit=${limit}`);
|
|
66
|
+
spinner.stop();
|
|
67
|
+
if (!data.skills || data.skills.length === 0) {
|
|
68
|
+
console.log(chalk_1.default.gray(`\n No skills yet. Create one with: ${(0, utils_js_1.cliName)()} skills init\n`));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
console.log(chalk_1.default.bold(`\nYour Skills (${data.total} total):\n`));
|
|
72
|
+
for (const skill of data.skills) {
|
|
73
|
+
const verified = skill.verified ? chalk_1.default.blue(" ✓") : "";
|
|
74
|
+
const discoverable = skill.discoverable ? chalk_1.default.green(" [public]") : chalk_1.default.gray(" [private]");
|
|
75
|
+
const files = chalk_1.default.gray(`${skill.fileCount} files`);
|
|
76
|
+
console.log(` ${chalk_1.default.cyan.bold(skill.name)}${verified}${discoverable} ${files}`);
|
|
77
|
+
console.log(` Slug: ${chalk_1.default.white(skill.slug)}`);
|
|
78
|
+
if (skill.description) {
|
|
79
|
+
console.log(chalk_1.default.gray(` ${skill.description.slice(0, 100)}${skill.description.length > 100 ? "..." : ""}`));
|
|
80
|
+
}
|
|
81
|
+
console.log();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
spinner.stop();
|
|
86
|
+
console.error(chalk_1.default.red("Failed to load skills:"), error instanceof Error ? error.message : String(error));
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
91
|
+
// orth skills search <query>
|
|
92
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
93
|
+
async function skillsSearchCommand(query, options) {
|
|
94
|
+
const spinner = (0, ora_1.default)("Searching skills...").start();
|
|
95
|
+
try {
|
|
96
|
+
const data = await (0, api_js_1.apiRequest)("/skills/search", {
|
|
97
|
+
method: "POST",
|
|
98
|
+
body: { query, limit: parseInt(options.limit, 10) },
|
|
99
|
+
});
|
|
100
|
+
spinner.stop();
|
|
101
|
+
if (options.json) {
|
|
102
|
+
console.log(JSON.stringify(data, null, 2));
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
105
|
+
if (!data.results || data.results.length === 0) {
|
|
106
|
+
console.log(chalk_1.default.yellow("No skills found matching your query."));
|
|
107
|
+
return data;
|
|
108
|
+
}
|
|
109
|
+
console.log(chalk_1.default.bold(`\nFound ${data.count} skills:\n`));
|
|
110
|
+
for (const skill of data.results) {
|
|
111
|
+
const verified = skill.verified ? chalk_1.default.blue(" ✓") : "";
|
|
112
|
+
const installs = chalk_1.default.gray(`(${skill.installCount} installs)`);
|
|
113
|
+
console.log(chalk_1.default.cyan.bold(skill.name) + verified + " " + installs);
|
|
114
|
+
if (skill.description) {
|
|
115
|
+
console.log(chalk_1.default.gray(` ${skill.description.slice(0, 100)}${skill.description.length > 100 ? "..." : ""}`));
|
|
116
|
+
}
|
|
117
|
+
console.log(chalk_1.default.gray(` Slug: ${skill.slug}`));
|
|
118
|
+
console.log();
|
|
119
|
+
}
|
|
120
|
+
console.log(chalk_1.default.gray(`Run '${(0, utils_js_1.cliName)()} skills show <slug>' for full details`));
|
|
121
|
+
return data;
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
spinner.stop();
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
129
|
+
// orth skills show <slug>
|
|
130
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
131
|
+
async function skillsShowCommand(slug, options = {}) {
|
|
132
|
+
const spinner = (0, ora_1.default)("Loading skill...").start();
|
|
133
|
+
try {
|
|
134
|
+
const data = await (0, api_js_1.apiRequest)(`/skills/${slug}`);
|
|
135
|
+
spinner.stop();
|
|
136
|
+
if (options.json) {
|
|
137
|
+
console.log(JSON.stringify(data, null, 2));
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const skill = data.skill;
|
|
141
|
+
console.log(chalk_1.default.bold(`\n${chalk_1.default.cyan(skill.name)}\n`));
|
|
142
|
+
if (skill.description) {
|
|
143
|
+
console.log(chalk_1.default.white(skill.description));
|
|
144
|
+
console.log();
|
|
145
|
+
}
|
|
146
|
+
// Metadata
|
|
147
|
+
console.log(chalk_1.default.bold("Details:"));
|
|
148
|
+
console.log(chalk_1.default.gray(" Slug: ") + skill.slug);
|
|
149
|
+
console.log(chalk_1.default.gray(" Source: ") +
|
|
150
|
+
(skill.sourceType === "github"
|
|
151
|
+
? `GitHub (${skill.githubOwner}/${skill.githubRepo})`
|
|
152
|
+
: "Uploaded"));
|
|
153
|
+
console.log(chalk_1.default.gray(" Installs: ") + chalk_1.default.green(String(skill.installCount)));
|
|
154
|
+
if (skill.verified) {
|
|
155
|
+
console.log(chalk_1.default.gray(" Verified: ") + chalk_1.default.blue("Yes ✓"));
|
|
156
|
+
}
|
|
157
|
+
if (skill.tags && skill.tags.length > 0) {
|
|
158
|
+
console.log(chalk_1.default.gray(" Tags: ") +
|
|
159
|
+
skill.tags.map((t) => chalk_1.default.magenta(t)).join(", "));
|
|
160
|
+
}
|
|
161
|
+
console.log();
|
|
162
|
+
// Files
|
|
163
|
+
if (skill.files && skill.files.length > 0) {
|
|
164
|
+
console.log(chalk_1.default.bold("Files:"));
|
|
165
|
+
for (const file of skill.files) {
|
|
166
|
+
const primary = file.isPrimary ? chalk_1.default.green(" (primary)") : "";
|
|
167
|
+
console.log(chalk_1.default.gray(" ") + chalk_1.default.white(file.filePath) + primary);
|
|
168
|
+
}
|
|
169
|
+
console.log();
|
|
170
|
+
// Show primary file content preview
|
|
171
|
+
const primaryFile = skill.files.find((f) => f.isPrimary);
|
|
172
|
+
if (primaryFile) {
|
|
173
|
+
console.log(chalk_1.default.bold(`── ${primaryFile.filePath} ──\n`));
|
|
174
|
+
const lines = primaryFile.content.split("\n");
|
|
175
|
+
const preview = lines.slice(0, 30).join("\n");
|
|
176
|
+
console.log(preview);
|
|
177
|
+
if (lines.length > 30) {
|
|
178
|
+
console.log(chalk_1.default.gray(`\n... ${lines.length - 30} more lines`));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
console.log();
|
|
183
|
+
if (skill.installCommand) {
|
|
184
|
+
console.log(chalk_1.default.bold("Install:"));
|
|
185
|
+
console.log(chalk_1.default.white(` ${skill.installCommand}`));
|
|
186
|
+
}
|
|
187
|
+
console.log(chalk_1.default.gray(`\nRun '${(0, utils_js_1.cliName)()} skills add ${skill.slug}' to add locally`));
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
spinner.stop();
|
|
191
|
+
console.error(chalk_1.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
192
|
+
process.exit(1);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.skillsCreateCommand = skillsCreateCommand;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
9
|
+
const api_js_1 = require("../../api.js");
|
|
10
|
+
const utils_js_1 = require("../../utils.js");
|
|
11
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
12
|
+
// orth skills create <githubRepo>
|
|
13
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
14
|
+
async function skillsCreateCommand(githubRepo, options) {
|
|
15
|
+
const spinner = (0, ora_1.default)("Creating skill from GitHub...").start();
|
|
16
|
+
try {
|
|
17
|
+
// Parse GitHub URL or owner/repo format
|
|
18
|
+
let githubOwner;
|
|
19
|
+
let githubRepoName;
|
|
20
|
+
const urlMatch = githubRepo.match(/github\.com\/([^/]+)\/([^/\s#?]+)/);
|
|
21
|
+
if (urlMatch) {
|
|
22
|
+
githubOwner = urlMatch[1];
|
|
23
|
+
githubRepoName = urlMatch[2].replace(/\.git$/, "");
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const parts = githubRepo.split("/");
|
|
27
|
+
if (parts.length < 2) {
|
|
28
|
+
spinner.stop();
|
|
29
|
+
console.error(chalk_1.default.red("Error: Provide a GitHub URL or owner/repo format"));
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
githubOwner = parts[0];
|
|
33
|
+
githubRepoName = parts[1];
|
|
34
|
+
}
|
|
35
|
+
const data = await (0, api_js_1.apiRequest)("/skills", {
|
|
36
|
+
method: "POST",
|
|
37
|
+
body: {
|
|
38
|
+
githubOwner,
|
|
39
|
+
githubRepo: githubRepoName,
|
|
40
|
+
githubPath: options.path,
|
|
41
|
+
githubRef: options.ref || "main",
|
|
42
|
+
name: options.name,
|
|
43
|
+
sourceType: "github",
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
spinner.stop();
|
|
47
|
+
console.log(chalk_1.default.green(`\n✓ ${data.message}`));
|
|
48
|
+
console.log(chalk_1.default.bold(`\n${data.skill.name}`));
|
|
49
|
+
console.log(chalk_1.default.gray(` Slug: ${data.skill.slug}`));
|
|
50
|
+
if (data.skill.description) {
|
|
51
|
+
console.log(chalk_1.default.gray(` ${data.skill.description}`));
|
|
52
|
+
}
|
|
53
|
+
console.log(chalk_1.default.bold("\nYour skill is on the platform but not yet verified."));
|
|
54
|
+
console.log(chalk_1.default.white(`To request verification: ${chalk_1.default.cyan(`${(0, utils_js_1.cliName)()} skills request-verification ${data.skill.slug}`)}`));
|
|
55
|
+
console.log(chalk_1.default.gray("Once verified, you can toggle discoverability anytime."));
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
spinner.stop();
|
|
59
|
+
console.error(chalk_1.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.skillsInitCommand = skillsInitCommand;
|
|
40
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
41
|
+
const utils_js_1 = require("../../utils.js");
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
45
|
+
// orth skills init [name]
|
|
46
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
47
|
+
async function skillsInitCommand(name, options) {
|
|
48
|
+
try {
|
|
49
|
+
const skillName = name || "my-skill";
|
|
50
|
+
const dirPath = options.path || path.join(process.cwd(), skillName);
|
|
51
|
+
// Check if directory already exists and has content
|
|
52
|
+
if (fs.existsSync(dirPath)) {
|
|
53
|
+
const contents = fs.readdirSync(dirPath);
|
|
54
|
+
if (contents.length > 0) {
|
|
55
|
+
const skillMdExists = contents.includes("SKILL.md");
|
|
56
|
+
if (skillMdExists) {
|
|
57
|
+
console.error(chalk_1.default.red(`Error: ${dirPath} already contains a SKILL.md file`));
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Create directory
|
|
63
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
64
|
+
// Generate SKILL.md template
|
|
65
|
+
const slugName = skillName
|
|
66
|
+
.toLowerCase()
|
|
67
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
68
|
+
.replace(/-+/g, "-")
|
|
69
|
+
.replace(/^-+|-+$/g, "");
|
|
70
|
+
const skillMdContent = `---
|
|
71
|
+
name: ${slugName}
|
|
72
|
+
description: TODO - Describe what this skill does and when an agent should use it. Be specific about triggers.
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
# ${skillName.charAt(0).toUpperCase() + skillName.slice(1).replace(/-/g, " ")}
|
|
76
|
+
|
|
77
|
+
TODO - Add instructions for the AI agent here.
|
|
78
|
+
|
|
79
|
+
## When to Use This Skill
|
|
80
|
+
|
|
81
|
+
Use this skill when the user:
|
|
82
|
+
- TODO - Describe specific triggers
|
|
83
|
+
- TODO - Add more triggers
|
|
84
|
+
|
|
85
|
+
## Workflow
|
|
86
|
+
|
|
87
|
+
### Step 1: TODO
|
|
88
|
+
|
|
89
|
+
Describe the first step.
|
|
90
|
+
|
|
91
|
+
### Step 2: TODO
|
|
92
|
+
|
|
93
|
+
Describe the next step.
|
|
94
|
+
`;
|
|
95
|
+
fs.writeFileSync(path.join(dirPath, "SKILL.md"), skillMdContent, "utf-8");
|
|
96
|
+
// Create optional subdirectories unless --bare
|
|
97
|
+
if (!options.bare) {
|
|
98
|
+
const subDirs = ["scripts", "references", "assets"];
|
|
99
|
+
for (const sub of subDirs) {
|
|
100
|
+
const subPath = path.join(dirPath, sub);
|
|
101
|
+
fs.mkdirSync(subPath, { recursive: true });
|
|
102
|
+
// Add .gitkeep to keep empty dirs in git
|
|
103
|
+
fs.writeFileSync(path.join(subPath, ".gitkeep"), "", "utf-8");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
console.log(chalk_1.default.green(`\n✓ Skill initialized at ${dirPath}\n`));
|
|
107
|
+
console.log(chalk_1.default.bold("Files created:"));
|
|
108
|
+
console.log(chalk_1.default.white(" SKILL.md") + chalk_1.default.gray(" (primary - edit this!)"));
|
|
109
|
+
if (!options.bare) {
|
|
110
|
+
console.log(chalk_1.default.gray(" scripts/ - Executable scripts"));
|
|
111
|
+
console.log(chalk_1.default.gray(" references/ - Reference docs loaded on demand"));
|
|
112
|
+
console.log(chalk_1.default.gray(" assets/ - Files used in output"));
|
|
113
|
+
}
|
|
114
|
+
console.log(chalk_1.default.bold("\nNext steps:"));
|
|
115
|
+
console.log(chalk_1.default.white(" 1. Edit SKILL.md with your skill's instructions"));
|
|
116
|
+
console.log(chalk_1.default.white(" 2. Add any supporting files to scripts/, references/, or assets/"));
|
|
117
|
+
console.log(chalk_1.default.white(` 3. Submit to Orthogonal: ${chalk_1.default.cyan(`${(0, utils_js_1.cliName)()} skills submit ${dirPath}`)}`));
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
console.error(chalk_1.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.skillsInstallCommand = skillsInstallCommand;
|
|
40
|
+
exports.skillsUpdateCommand = skillsUpdateCommand;
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const ora_1 = __importDefault(require("ora"));
|
|
43
|
+
const api_js_1 = require("../../api.js");
|
|
44
|
+
const utils_js_1 = require("../../utils.js");
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const shared_js_1 = require("./shared.js");
|
|
48
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
49
|
+
// orth skills add <slug>
|
|
50
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
51
|
+
async function skillsInstallCommand(slug, options) {
|
|
52
|
+
const spinner = (0, ora_1.default)("Fetching skill...").start();
|
|
53
|
+
try {
|
|
54
|
+
const data = await (0, api_js_1.apiRequest)(`/skills/${slug}`);
|
|
55
|
+
const skill = data.skill;
|
|
56
|
+
spinner.stop();
|
|
57
|
+
if (!skill.files || skill.files.length === 0) {
|
|
58
|
+
console.log(chalk_1.default.yellow("This skill has no files to install."));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const primaryFile = skill.files.find((f) => f.isPrimary);
|
|
62
|
+
if (!primaryFile) {
|
|
63
|
+
console.log(chalk_1.default.yellow("No primary SKILL.md file found."));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
// Determine which agents to install for
|
|
67
|
+
if (options.agent && !shared_js_1.AGENT_DIRS[options.agent]) {
|
|
68
|
+
spinner.stop();
|
|
69
|
+
console.error(chalk_1.default.red(`Error: Unknown agent '${options.agent}'. Valid agents: ${Object.keys(shared_js_1.AGENT_DIRS).join(", ")}`));
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
const agents = options.agent
|
|
73
|
+
? { [options.agent]: shared_js_1.AGENT_DIRS[options.agent] }
|
|
74
|
+
: shared_js_1.AGENT_DIRS;
|
|
75
|
+
const skillDirName = skill.slug.replace(/\//g, "-");
|
|
76
|
+
let installed = 0;
|
|
77
|
+
for (const [agentName, baseDir] of Object.entries(agents)) {
|
|
78
|
+
if (!baseDir)
|
|
79
|
+
continue;
|
|
80
|
+
// Only install for agents whose base directory already exists
|
|
81
|
+
if (!fs.existsSync(path.dirname(baseDir)))
|
|
82
|
+
continue;
|
|
83
|
+
const skillDir = (0, shared_js_1.safeSkillFilePath)(baseDir, skillDirName);
|
|
84
|
+
if (!skillDir) {
|
|
85
|
+
console.log(chalk_1.default.yellow(` Skipped unsafe skill name: ${skill.slug}`));
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
// Create directories
|
|
90
|
+
fs.mkdirSync(skillDir, { recursive: true });
|
|
91
|
+
// Write all files (with path traversal protection)
|
|
92
|
+
for (const file of skill.files) {
|
|
93
|
+
const filePath = (0, shared_js_1.safeSkillFilePath)(skillDir, file.filePath);
|
|
94
|
+
if (!filePath) {
|
|
95
|
+
console.log(chalk_1.default.yellow(` Skipped unsafe file path: ${file.filePath}`));
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const fileDir = path.dirname(filePath);
|
|
99
|
+
fs.mkdirSync(fileDir, { recursive: true });
|
|
100
|
+
fs.writeFileSync(filePath, file.content, "utf-8");
|
|
101
|
+
}
|
|
102
|
+
console.log(chalk_1.default.green(` ✓ Installed for ${agentName}: ${skillDir}`));
|
|
103
|
+
installed++;
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// Skip agents whose directories don't exist / can't be created
|
|
107
|
+
console.log(chalk_1.default.gray(` - Skipped ${agentName} (directory not accessible)`));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Record the install
|
|
111
|
+
try {
|
|
112
|
+
await (0, api_js_1.apiRequest)(`/skills/${slug}/install`, { method: "POST" });
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// Non-critical - don't fail the install
|
|
116
|
+
}
|
|
117
|
+
if (installed > 0) {
|
|
118
|
+
console.log(chalk_1.default.green(`\n✓ Installed "${skill.name}" for ${installed} agent(s)`));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
console.log(chalk_1.default.yellow("\nNo agents were found. Install manually by copying SKILL.md to your agent's skills directory."));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
spinner.stop();
|
|
126
|
+
console.error(chalk_1.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
131
|
+
// orth skills update <slug> [path]
|
|
132
|
+
// Pull latest version from Orthogonal and update local files
|
|
133
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
134
|
+
async function skillsUpdateCommand(slug, inputPath, options) {
|
|
135
|
+
const spinner = (0, ora_1.default)(`Fetching skill '${slug}' from Orthogonal...`).start();
|
|
136
|
+
try {
|
|
137
|
+
// Fetch skill from API
|
|
138
|
+
const data = await (0, api_js_1.apiRequest)(`/skills/${slug}`);
|
|
139
|
+
const skill = data.skill;
|
|
140
|
+
if (!skill.files || skill.files.length === 0) {
|
|
141
|
+
spinner.stop();
|
|
142
|
+
console.error(chalk_1.default.red("Error: Skill has no files to download"));
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
// Determine target directory
|
|
146
|
+
const skillDirName = slug.replace(/\//g, "-");
|
|
147
|
+
const dirPath = inputPath
|
|
148
|
+
? path.resolve(inputPath)
|
|
149
|
+
: path.join(process.cwd(), skillDirName);
|
|
150
|
+
// Check if directory exists and has content
|
|
151
|
+
if (fs.existsSync(dirPath) && !options.force) {
|
|
152
|
+
const contents = fs.readdirSync(dirPath);
|
|
153
|
+
if (contents.length > 0) {
|
|
154
|
+
spinner.stop();
|
|
155
|
+
console.log(chalk_1.default.yellow(`Directory ${dirPath} already exists with content.`));
|
|
156
|
+
console.log(chalk_1.default.white(`Use ${chalk_1.default.cyan("--force")} to overwrite existing files.`));
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
spinner.text = "Writing files...";
|
|
161
|
+
// Create directory
|
|
162
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
163
|
+
// Write all files
|
|
164
|
+
for (const file of skill.files) {
|
|
165
|
+
const filePath = (0, shared_js_1.safeSkillFilePath)(dirPath, file.filePath);
|
|
166
|
+
if (!filePath) {
|
|
167
|
+
console.log(chalk_1.default.yellow(` Skipped unsafe file path: ${file.filePath}`));
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const fileDir = path.dirname(filePath);
|
|
171
|
+
fs.mkdirSync(fileDir, { recursive: true });
|
|
172
|
+
fs.writeFileSync(filePath, file.content, "utf-8");
|
|
173
|
+
}
|
|
174
|
+
spinner.stop();
|
|
175
|
+
console.log(chalk_1.default.green(`\n✓ Skill updated from Orthogonal`));
|
|
176
|
+
console.log(chalk_1.default.bold(`\n${skill.name}`));
|
|
177
|
+
console.log(chalk_1.default.gray(` Path: ${dirPath}`));
|
|
178
|
+
console.log(chalk_1.default.gray(` Files: ${skill.files.length}`));
|
|
179
|
+
console.log(chalk_1.default.bold("\nFiles written:"));
|
|
180
|
+
for (const file of skill.files) {
|
|
181
|
+
const primary = file.isPrimary ? chalk_1.default.green(" (primary)") : "";
|
|
182
|
+
console.log(chalk_1.default.gray(" ") + chalk_1.default.white(file.filePath) + primary);
|
|
183
|
+
}
|
|
184
|
+
console.log(chalk_1.default.gray(`\nTo push changes back: ${chalk_1.default.cyan(`${(0, utils_js_1.cliName)()} skills push ${slug} ${dirPath}`)}`));
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
spinner.stop();
|
|
188
|
+
console.error(chalk_1.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function readFilesRecursive(dirPath: string, basePath?: string): {
|
|
2
|
+
filePath: string;
|
|
3
|
+
content: string;
|
|
4
|
+
isPrimary: boolean;
|
|
5
|
+
}[];
|
|
6
|
+
/**
|
|
7
|
+
* Simple YAML frontmatter parser for SKILL.md files.
|
|
8
|
+
* Supports single-line `name:` and `description:` values.
|
|
9
|
+
* Multi-line YAML values (block scalars, folded strings) are not supported —
|
|
10
|
+
* descriptions should be kept to a single line in frontmatter.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseFrontmatter(content: string): {
|
|
13
|
+
name?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
};
|