@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,110 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.readFilesRecursive = readFilesRecursive;
|
|
37
|
+
exports.parseFrontmatter = parseFrontmatter;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
// Known binary/large file extensions to skip when reading local files
|
|
41
|
+
const SKIP_EXTENSIONS = new Set([
|
|
42
|
+
".png", ".jpg", ".jpeg", ".gif", ".webp", ".ico", ".svg",
|
|
43
|
+
".mp4", ".mp3", ".wav", ".ogg",
|
|
44
|
+
".zip", ".tar", ".gz", ".bz2", ".rar", ".7z",
|
|
45
|
+
".woff", ".woff2", ".ttf", ".eot",
|
|
46
|
+
".exe", ".dll", ".so", ".dylib",
|
|
47
|
+
".pdf", ".doc", ".docx", ".xls", ".xlsx",
|
|
48
|
+
".lock", ".bin",
|
|
49
|
+
]);
|
|
50
|
+
const SKIP_DIRS = new Set([
|
|
51
|
+
"node_modules", ".git", "__pycache__", ".venv", "venv",
|
|
52
|
+
"dist", "build", ".next", ".cache",
|
|
53
|
+
]);
|
|
54
|
+
function readFilesRecursive(dirPath, basePath = "") {
|
|
55
|
+
const files = [];
|
|
56
|
+
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
57
|
+
for (const entry of entries) {
|
|
58
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
59
|
+
const relativePath = basePath ? `${basePath}/${entry.name}` : entry.name;
|
|
60
|
+
if (entry.isDirectory()) {
|
|
61
|
+
if (SKIP_DIRS.has(entry.name) || entry.name.startsWith("."))
|
|
62
|
+
continue;
|
|
63
|
+
files.push(...readFilesRecursive(fullPath, relativePath));
|
|
64
|
+
}
|
|
65
|
+
else if (entry.isFile()) {
|
|
66
|
+
// Skip dotfiles and binary files
|
|
67
|
+
if (entry.name.startsWith("."))
|
|
68
|
+
continue;
|
|
69
|
+
const ext = entry.name.includes(".")
|
|
70
|
+
? "." + entry.name.split(".").pop().toLowerCase()
|
|
71
|
+
: "";
|
|
72
|
+
if (SKIP_EXTENSIONS.has(ext))
|
|
73
|
+
continue;
|
|
74
|
+
try {
|
|
75
|
+
const content = fs.readFileSync(fullPath, "utf-8");
|
|
76
|
+
files.push({
|
|
77
|
+
filePath: relativePath,
|
|
78
|
+
content,
|
|
79
|
+
isPrimary: entry.name === "SKILL.md" && basePath === "",
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Skip files that can't be read as UTF-8
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return files;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Simple YAML frontmatter parser for SKILL.md files.
|
|
91
|
+
* Supports single-line `name:` and `description:` values.
|
|
92
|
+
* Multi-line YAML values (block scalars, folded strings) are not supported —
|
|
93
|
+
* descriptions should be kept to a single line in frontmatter.
|
|
94
|
+
*/
|
|
95
|
+
function parseFrontmatter(content) {
|
|
96
|
+
const match = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
97
|
+
if (!match)
|
|
98
|
+
return {};
|
|
99
|
+
const fm = match[1] || "";
|
|
100
|
+
const result = {};
|
|
101
|
+
for (const line of fm.split("\n")) {
|
|
102
|
+
const nameMatch = line.match(/^name:\s*(.+)$/);
|
|
103
|
+
if (nameMatch?.[1])
|
|
104
|
+
result.name = nameMatch[1].trim();
|
|
105
|
+
const descMatch = line.match(/^description:\s*(.+)$/);
|
|
106
|
+
if (descMatch?.[1])
|
|
107
|
+
result.description = descMatch[1].trim();
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerSkillsCommands = registerSkillsCommands;
|
|
4
|
+
const analytics_js_1 = require("../../analytics.js");
|
|
5
|
+
const command_actions_js_1 = require("../../command-actions.js");
|
|
6
|
+
const browse_js_1 = require("./browse.js");
|
|
7
|
+
const create_js_1 = require("./create.js");
|
|
8
|
+
const init_js_1 = require("./init.js");
|
|
9
|
+
const install_js_1 = require("./install.js");
|
|
10
|
+
const shared_js_1 = require("./shared.js");
|
|
11
|
+
const upload_js_1 = require("./upload.js");
|
|
12
|
+
const verification_js_1 = require("./verification.js");
|
|
13
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
14
|
+
// orth skills <subcommand> — Skills commands group
|
|
15
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
16
|
+
function registerSkillsCommands(program) {
|
|
17
|
+
const skillsGroup = program
|
|
18
|
+
.command("skills")
|
|
19
|
+
.description("Agent skills library commands");
|
|
20
|
+
skillsGroup
|
|
21
|
+
.command("list")
|
|
22
|
+
.description("List discoverable skills")
|
|
23
|
+
.option("-l, --limit <number>", "Max results", "20")
|
|
24
|
+
.option("--json", "Print JSON")
|
|
25
|
+
.action((0, command_actions_js_1.asyncAction)(async (options) => {
|
|
26
|
+
(0, analytics_js_1.trackEvent)("skills.list");
|
|
27
|
+
await (0, browse_js_1.skillsListCommand)(options);
|
|
28
|
+
}));
|
|
29
|
+
skillsGroup
|
|
30
|
+
.command("mine")
|
|
31
|
+
.description("List your own skills")
|
|
32
|
+
.option("-l, --limit <number>", "Max results", "50")
|
|
33
|
+
.action((0, command_actions_js_1.asyncAction)(async (options) => {
|
|
34
|
+
(0, analytics_js_1.trackEvent)("skills.mine");
|
|
35
|
+
await (0, browse_js_1.skillsMineCommand)(options);
|
|
36
|
+
}));
|
|
37
|
+
skillsGroup
|
|
38
|
+
.command("search <query>")
|
|
39
|
+
.description("Search for agent skills")
|
|
40
|
+
.option("-l, --limit <number>", "Max results", "20")
|
|
41
|
+
.option("--json", "Print JSON")
|
|
42
|
+
.action((0, command_actions_js_1.asyncAction)(async (query, options) => {
|
|
43
|
+
await (0, command_actions_js_1.runTrackedSearch)("skills.search", query, () => (0, browse_js_1.skillsSearchCommand)(query, options));
|
|
44
|
+
}));
|
|
45
|
+
skillsGroup
|
|
46
|
+
.command("show <slug>")
|
|
47
|
+
.description("Show skill details and files")
|
|
48
|
+
.option("--json", "Print JSON")
|
|
49
|
+
.action((0, command_actions_js_1.asyncAction)(async (slug, options) => {
|
|
50
|
+
(0, analytics_js_1.trackEvent)("skills.show", { slug });
|
|
51
|
+
await (0, browse_js_1.skillsShowCommand)(slug, options);
|
|
52
|
+
}));
|
|
53
|
+
skillsGroup
|
|
54
|
+
.command("init [name]")
|
|
55
|
+
.description("Initialize a new skill directory with SKILL.md template")
|
|
56
|
+
.option("--bare", "Only create SKILL.md, skip subdirectories")
|
|
57
|
+
.option("--path <dir>", "Output directory")
|
|
58
|
+
.action((0, command_actions_js_1.asyncAction)(async (name, options) => {
|
|
59
|
+
(0, analytics_js_1.trackEvent)("skills.init", { name });
|
|
60
|
+
await (0, init_js_1.skillsInitCommand)(name, options);
|
|
61
|
+
}));
|
|
62
|
+
skillsGroup
|
|
63
|
+
.command("submit [path]")
|
|
64
|
+
.description("Submit a local skill to the Orthogonal platform")
|
|
65
|
+
.option("-n, --name <name>", "Override skill name from frontmatter")
|
|
66
|
+
.option("-t, --tags <tags>", "Comma-separated tags")
|
|
67
|
+
.option("--org <orgId>", "Submit to an organization instead of personal account")
|
|
68
|
+
.action((0, command_actions_js_1.asyncAction)(async (inputPath, options) => {
|
|
69
|
+
(0, analytics_js_1.trackEvent)("skills.submit", { path: inputPath });
|
|
70
|
+
await (0, upload_js_1.skillsSubmitCommand)(inputPath, options);
|
|
71
|
+
}));
|
|
72
|
+
skillsGroup
|
|
73
|
+
.command("update <slug> [path]")
|
|
74
|
+
.description("Pull latest skill version from Orthogonal to local directory")
|
|
75
|
+
.option("-f, --force", "Overwrite existing files")
|
|
76
|
+
.action((0, command_actions_js_1.asyncAction)(async (slug, inputPath, options) => {
|
|
77
|
+
(0, analytics_js_1.trackEvent)("skills.update", { slug, path: inputPath });
|
|
78
|
+
await (0, install_js_1.skillsUpdateCommand)(slug, inputPath, options);
|
|
79
|
+
}));
|
|
80
|
+
skillsGroup
|
|
81
|
+
.command("push <slug> [path]")
|
|
82
|
+
.description("Push local skill files to Orthogonal (update remote)")
|
|
83
|
+
.option("-n, --name <name>", "Override skill name from frontmatter")
|
|
84
|
+
.option("-t, --tags <tags>", "Comma-separated tags")
|
|
85
|
+
.action((0, command_actions_js_1.asyncAction)(async (slug, inputPath, options) => {
|
|
86
|
+
(0, analytics_js_1.trackEvent)("skills.push", { slug, path: inputPath });
|
|
87
|
+
await (0, upload_js_1.skillsPushCommand)(slug, inputPath, options);
|
|
88
|
+
}));
|
|
89
|
+
skillsGroup
|
|
90
|
+
.command("request-verification <slug>")
|
|
91
|
+
.description("Request verification for your skill (required before discoverability)")
|
|
92
|
+
.action((0, command_actions_js_1.asyncAction)(async (slug) => {
|
|
93
|
+
(0, analytics_js_1.trackEvent)("skills.request-verification", { slug });
|
|
94
|
+
await (0, verification_js_1.skillsRequestVerificationCommand)(slug);
|
|
95
|
+
}));
|
|
96
|
+
skillsGroup
|
|
97
|
+
.command("create <githubRepo>")
|
|
98
|
+
.description("Create a skill from a GitHub URL or owner/repo")
|
|
99
|
+
.option("-p, --path <path>", "Path to skill within repo")
|
|
100
|
+
.option("-r, --ref <ref>", "Git ref (branch/tag)", "main")
|
|
101
|
+
.option("-n, --name <name>", "Skill name (auto-detected from SKILL.md)")
|
|
102
|
+
.action((0, command_actions_js_1.asyncAction)(async (githubRepo, options) => {
|
|
103
|
+
(0, analytics_js_1.trackEvent)("skills.create", { githubRepo });
|
|
104
|
+
await (0, create_js_1.skillsCreateCommand)(githubRepo, options);
|
|
105
|
+
}));
|
|
106
|
+
skillsGroup
|
|
107
|
+
.command("add <slug>")
|
|
108
|
+
.alias("install")
|
|
109
|
+
.description("Add a skill to your local agent skills directories")
|
|
110
|
+
.option("--agent <agent>", `Install for one agent only (${shared_js_1.AGENT_NAMES.join(", ")})`)
|
|
111
|
+
.action((0, command_actions_js_1.asyncAction)(async (slug, options) => {
|
|
112
|
+
(0, analytics_js_1.trackEvent)("skills.add", { slug });
|
|
113
|
+
await (0, install_js_1.skillsInstallCommand)(slug, options);
|
|
114
|
+
}));
|
|
115
|
+
skillsGroup
|
|
116
|
+
.command("publish <slug>")
|
|
117
|
+
.description("Toggle skill discoverability")
|
|
118
|
+
.option("--unpublish", "Make skill private")
|
|
119
|
+
.action((0, command_actions_js_1.asyncAction)(async (slug, options) => {
|
|
120
|
+
(0, analytics_js_1.trackEvent)("skills.publish", { slug });
|
|
121
|
+
await (0, verification_js_1.skillsPublishCommand)(slug, options);
|
|
122
|
+
}));
|
|
123
|
+
skillsGroup
|
|
124
|
+
.command("request <input>")
|
|
125
|
+
.description("Request a skill to be added (GitHub URL or description)")
|
|
126
|
+
.action((0, command_actions_js_1.asyncAction)(async (input) => {
|
|
127
|
+
(0, analytics_js_1.trackEvent)("skills.request", { input });
|
|
128
|
+
await (0, verification_js_1.skillsRequestCommand)(input);
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface SkillResponse {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
sourceType: "github" | "upload";
|
|
7
|
+
githubOwner?: string;
|
|
8
|
+
githubRepo?: string;
|
|
9
|
+
githubPath?: string;
|
|
10
|
+
githubRef?: string;
|
|
11
|
+
discoverable: boolean;
|
|
12
|
+
verified: boolean;
|
|
13
|
+
installCount: number;
|
|
14
|
+
tags?: string[];
|
|
15
|
+
installCommand?: string;
|
|
16
|
+
githubUrl?: string;
|
|
17
|
+
files?: {
|
|
18
|
+
filePath: string;
|
|
19
|
+
content: string;
|
|
20
|
+
isPrimary: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
export interface SkillsListResponse {
|
|
24
|
+
skills: SkillResponse[];
|
|
25
|
+
total: number;
|
|
26
|
+
}
|
|
27
|
+
export interface SkillSearchResponse {
|
|
28
|
+
results: SkillResponse[];
|
|
29
|
+
count: number;
|
|
30
|
+
}
|
|
31
|
+
export interface SkillDetailResponse {
|
|
32
|
+
skill: SkillResponse;
|
|
33
|
+
}
|
|
34
|
+
export declare const AGENT_DIRS: Record<string, string>;
|
|
35
|
+
/** The names `skills add --agent` takes. */
|
|
36
|
+
export declare const AGENT_NAMES: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Where a skill's file may be written: inside baseDir, never baseDir itself.
|
|
39
|
+
* Normalizing first stops "....//" from collapsing into "../", and comparing
|
|
40
|
+
* with a trailing separator stops a sibling such as "<baseDir>-evil"
|
|
41
|
+
* (orthogonal-sh/cli PR #51). Null means skip the file.
|
|
42
|
+
*/
|
|
43
|
+
export declare function safeSkillFilePath(baseDir: string, filePath: string): string | null;
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AGENT_NAMES = exports.AGENT_DIRS = void 0;
|
|
37
|
+
exports.safeSkillFilePath = safeSkillFilePath;
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const os = __importStar(require("os"));
|
|
40
|
+
// Agent skill directories (user-level global skills)
|
|
41
|
+
exports.AGENT_DIRS = {
|
|
42
|
+
cursor: path.join(os.homedir(), ".cursor", "skills"),
|
|
43
|
+
"claude-code": path.join(os.homedir(), ".claude", "skills"),
|
|
44
|
+
copilot: path.join(os.homedir(), ".github", "skills"),
|
|
45
|
+
windsurf: path.join(os.homedir(), ".codeium", "windsurf", "skills"),
|
|
46
|
+
codex: path.join(os.homedir(), ".agents", "skills"), // Codex uses ~/.agents/skills/ for user-scoped skills
|
|
47
|
+
gemini: path.join(os.homedir(), ".gemini", "skills"),
|
|
48
|
+
openclaw: path.join(os.homedir(), ".openclaw", "skills"),
|
|
49
|
+
};
|
|
50
|
+
/** The names `skills add --agent` takes. */
|
|
51
|
+
exports.AGENT_NAMES = Object.keys(exports.AGENT_DIRS);
|
|
52
|
+
/**
|
|
53
|
+
* Where a skill's file may be written: inside baseDir, never baseDir itself.
|
|
54
|
+
* Normalizing first stops "....//" from collapsing into "../", and comparing
|
|
55
|
+
* with a trailing separator stops a sibling such as "<baseDir>-evil"
|
|
56
|
+
* (orthogonal-sh/cli PR #51). Null means skip the file.
|
|
57
|
+
*/
|
|
58
|
+
function safeSkillFilePath(baseDir, filePath) {
|
|
59
|
+
const relative = path.normalize(filePath);
|
|
60
|
+
if (path.isAbsolute(relative))
|
|
61
|
+
return null;
|
|
62
|
+
const base = path.resolve(baseDir);
|
|
63
|
+
const resolved = path.resolve(base, relative);
|
|
64
|
+
if (resolved === base)
|
|
65
|
+
return null;
|
|
66
|
+
if (!(resolved + path.sep).startsWith(base + path.sep))
|
|
67
|
+
return null;
|
|
68
|
+
return resolved;
|
|
69
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function skillsSubmitCommand(inputPath: string | undefined, options: {
|
|
2
|
+
name?: string;
|
|
3
|
+
tags?: string;
|
|
4
|
+
org?: string;
|
|
5
|
+
}): Promise<void>;
|
|
6
|
+
export declare function skillsPushCommand(slug: string, inputPath: string | undefined, options: {
|
|
7
|
+
name?: string;
|
|
8
|
+
tags?: string;
|
|
9
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,223 @@
|
|
|
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.skillsSubmitCommand = skillsSubmitCommand;
|
|
40
|
+
exports.skillsPushCommand = skillsPushCommand;
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const ora_1 = __importDefault(require("ora"));
|
|
43
|
+
const api_js_1 = require("../../api.js");
|
|
44
|
+
const urls_js_1 = require("../../urls.js");
|
|
45
|
+
const utils_js_1 = require("../../utils.js");
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const local_files_js_1 = require("./local-files.js");
|
|
49
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
50
|
+
// orth skills submit [path]
|
|
51
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
52
|
+
async function skillsSubmitCommand(inputPath, options) {
|
|
53
|
+
const dirPath = inputPath ? path.resolve(inputPath) : process.cwd();
|
|
54
|
+
const spinner = (0, ora_1.default)("Reading skill files...").start();
|
|
55
|
+
try {
|
|
56
|
+
// Validate directory exists
|
|
57
|
+
if (!fs.existsSync(dirPath) || !fs.statSync(dirPath).isDirectory()) {
|
|
58
|
+
spinner.stop();
|
|
59
|
+
console.error(chalk_1.default.red(`Error: ${dirPath} is not a directory`));
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
// Read all files
|
|
63
|
+
const files = (0, local_files_js_1.readFilesRecursive)(dirPath);
|
|
64
|
+
if (files.length === 0) {
|
|
65
|
+
spinner.stop();
|
|
66
|
+
console.error(chalk_1.default.red("Error: No files found in the directory"));
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
// Validate SKILL.md exists
|
|
70
|
+
const primaryFile = files.find((f) => f.isPrimary);
|
|
71
|
+
if (!primaryFile) {
|
|
72
|
+
spinner.stop();
|
|
73
|
+
console.error(chalk_1.default.red("Error: No SKILL.md found in the root of the directory"));
|
|
74
|
+
console.log(chalk_1.default.gray(`Run '${(0, utils_js_1.cliName)()} skills init' to create a skill template`));
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
// Parse frontmatter
|
|
78
|
+
const frontmatter = (0, local_files_js_1.parseFrontmatter)(primaryFile.content);
|
|
79
|
+
const skillName = options.name || frontmatter.name;
|
|
80
|
+
const skillDescription = frontmatter.description;
|
|
81
|
+
if (!skillName) {
|
|
82
|
+
spinner.stop();
|
|
83
|
+
console.error(chalk_1.default.red("Error: Skill name is required. Add 'name:' to SKILL.md frontmatter or use --name"));
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
if (!skillDescription) {
|
|
87
|
+
spinner.stop();
|
|
88
|
+
console.error(chalk_1.default.red("Error: Skill description is required. Add 'description:' to SKILL.md frontmatter"));
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
// Check size limits
|
|
92
|
+
const totalSize = files.reduce((acc, f) => acc + f.content.length, 0);
|
|
93
|
+
if (files.length > 50) {
|
|
94
|
+
spinner.stop();
|
|
95
|
+
console.error(chalk_1.default.red("Error: Too many files (max 50)"));
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
if (totalSize > 1024 * 1024) {
|
|
99
|
+
spinner.stop();
|
|
100
|
+
console.error(chalk_1.default.red("Error: Total content too large (max 1MB)"));
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
spinner.text = "Submitting skill to Orthogonal...";
|
|
104
|
+
const tags = options.tags
|
|
105
|
+
? options.tags.split(",").map((t) => t.trim())
|
|
106
|
+
: undefined;
|
|
107
|
+
const data = await (0, api_js_1.apiRequest)("/skills", {
|
|
108
|
+
method: "POST",
|
|
109
|
+
body: {
|
|
110
|
+
sourceType: "upload",
|
|
111
|
+
name: skillName,
|
|
112
|
+
description: skillDescription,
|
|
113
|
+
files: files.map((f) => ({
|
|
114
|
+
filePath: f.filePath,
|
|
115
|
+
content: f.content,
|
|
116
|
+
isPrimary: f.isPrimary,
|
|
117
|
+
})),
|
|
118
|
+
tags,
|
|
119
|
+
discoverable: false,
|
|
120
|
+
...(options.org ? { organizationId: options.org } : {}),
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
spinner.stop();
|
|
124
|
+
console.log(chalk_1.default.green(`\n✓ ${data.message}`));
|
|
125
|
+
console.log(chalk_1.default.bold(`\n${data.skill.name}`));
|
|
126
|
+
console.log(chalk_1.default.gray(` Slug: ${data.skill.slug}`));
|
|
127
|
+
console.log(chalk_1.default.gray(` Files: ${files.length}`));
|
|
128
|
+
if (data.skill.description) {
|
|
129
|
+
console.log(chalk_1.default.gray(` ${data.skill.description.slice(0, 100)}`));
|
|
130
|
+
}
|
|
131
|
+
console.log(chalk_1.default.bold("\nYour skill is on the platform but not yet verified."));
|
|
132
|
+
console.log(chalk_1.default.white(`To request verification: ${chalk_1.default.cyan(`${(0, utils_js_1.cliName)()} skills request-verification ${data.skill.slug}`)}`));
|
|
133
|
+
console.log(chalk_1.default.gray("Once verified, you can toggle discoverability anytime."));
|
|
134
|
+
console.log(chalk_1.default.gray(`Dashboard: ${(0, urls_js_1.webBaseUrl)()}/agents`));
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
spinner.stop();
|
|
138
|
+
console.error(chalk_1.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
139
|
+
process.exit(1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
143
|
+
// orth skills push <slug> [path]
|
|
144
|
+
// Push local skill files to remote (replaces remote with local)
|
|
145
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
146
|
+
async function skillsPushCommand(slug, inputPath, options) {
|
|
147
|
+
const dirPath = inputPath ? path.resolve(inputPath) : process.cwd();
|
|
148
|
+
const spinner = (0, ora_1.default)("Reading skill files...").start();
|
|
149
|
+
try {
|
|
150
|
+
// Validate directory exists
|
|
151
|
+
if (!fs.existsSync(dirPath) || !fs.statSync(dirPath).isDirectory()) {
|
|
152
|
+
spinner.stop();
|
|
153
|
+
console.error(chalk_1.default.red(`Error: ${dirPath} is not a directory`));
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
// Read all files
|
|
157
|
+
const files = (0, local_files_js_1.readFilesRecursive)(dirPath);
|
|
158
|
+
if (files.length === 0) {
|
|
159
|
+
spinner.stop();
|
|
160
|
+
console.error(chalk_1.default.red("Error: No files found in the directory"));
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
// Validate SKILL.md exists
|
|
164
|
+
const primaryFile = files.find((f) => f.isPrimary);
|
|
165
|
+
if (!primaryFile) {
|
|
166
|
+
spinner.stop();
|
|
167
|
+
console.error(chalk_1.default.red("Error: No SKILL.md found in the root of the directory"));
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
// Parse frontmatter
|
|
171
|
+
// Note: Unlike submit, name/description are optional for updates
|
|
172
|
+
// We only send them if provided (to allow partial updates)
|
|
173
|
+
const frontmatter = (0, local_files_js_1.parseFrontmatter)(primaryFile.content);
|
|
174
|
+
const skillName = options.name || frontmatter.name;
|
|
175
|
+
const skillDescription = frontmatter.description;
|
|
176
|
+
// Check size limits
|
|
177
|
+
const totalSize = files.reduce((acc, f) => acc + f.content.length, 0);
|
|
178
|
+
if (files.length > 50) {
|
|
179
|
+
spinner.stop();
|
|
180
|
+
console.error(chalk_1.default.red("Error: Too many files (max 50)"));
|
|
181
|
+
process.exit(1);
|
|
182
|
+
}
|
|
183
|
+
if (totalSize > 1024 * 1024) {
|
|
184
|
+
spinner.stop();
|
|
185
|
+
console.error(chalk_1.default.red("Error: Total content too large (max 1MB)"));
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
188
|
+
spinner.text = "Pushing skill to Orthogonal...";
|
|
189
|
+
const tags = options.tags
|
|
190
|
+
? options.tags.split(",").map((t) => t.trim())
|
|
191
|
+
: undefined;
|
|
192
|
+
const updatePayload = {
|
|
193
|
+
files: files.map((f) => ({
|
|
194
|
+
filePath: f.filePath,
|
|
195
|
+
content: f.content,
|
|
196
|
+
isPrimary: f.isPrimary,
|
|
197
|
+
})),
|
|
198
|
+
};
|
|
199
|
+
if (skillName)
|
|
200
|
+
updatePayload.name = skillName;
|
|
201
|
+
if (skillDescription)
|
|
202
|
+
updatePayload.description = skillDescription;
|
|
203
|
+
if (tags)
|
|
204
|
+
updatePayload.tags = tags;
|
|
205
|
+
const data = await (0, api_js_1.apiRequest)(`/skills/${slug}`, {
|
|
206
|
+
method: "PUT",
|
|
207
|
+
body: updatePayload,
|
|
208
|
+
});
|
|
209
|
+
spinner.stop();
|
|
210
|
+
console.log(chalk_1.default.green(`\n✓ Skill pushed successfully`));
|
|
211
|
+
console.log(chalk_1.default.bold(`\n${data.skill.name}`));
|
|
212
|
+
console.log(chalk_1.default.gray(` Slug: ${data.skill.slug}`));
|
|
213
|
+
console.log(chalk_1.default.gray(` Files: ${files.length}`));
|
|
214
|
+
if (data.skill.description) {
|
|
215
|
+
console.log(chalk_1.default.gray(` ${data.skill.description.slice(0, 100)}`));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
spinner.stop();
|
|
220
|
+
console.error(chalk_1.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
221
|
+
process.exit(1);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function skillsRequestVerificationCommand(slug: string): Promise<void>;
|
|
2
|
+
export declare function skillsPublishCommand(slug: string, options: {
|
|
3
|
+
unpublish?: boolean;
|
|
4
|
+
}): Promise<void>;
|
|
5
|
+
export declare function skillsRequestCommand(input: string): Promise<void>;
|