@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
package/dist/utils.d.ts
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
1
|
export declare function sanitizeForTerminal(value: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* The command the person typed: `orth`, or a staff build's `mono-dev` and
|
|
4
|
+
* `mono-prod`, so hints name a command that exists. `npm run cli` runs
|
|
5
|
+
* dist/index.js, which is `orth`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function cliName(): string;
|
|
8
|
+
/** Whether a person is at the terminal to answer a question. */
|
|
9
|
+
export declare function isInteractive(): boolean;
|
|
10
|
+
/** A numbered list to pick from; answers the chosen index. */
|
|
11
|
+
export declare function choose(question: string, labels: string[]): Promise<number>;
|
|
12
|
+
/** A failure as people read it: a red ✗ and the message, never a stack. */
|
|
13
|
+
export declare function printError(error: unknown): void;
|
|
14
|
+
/** A yes-or-no question; anything but y/yes is no. */
|
|
15
|
+
export declare function confirmYes(question: string): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* A secret typed without echo (an API key), or stdin when piped, so it never
|
|
18
|
+
* shows on screen, in shell history or in `ps`. The prompt goes to stderr,
|
|
19
|
+
* so stdout keeps only the command's output (--json).
|
|
20
|
+
*/
|
|
21
|
+
export declare function readSecret(question: string): Promise<string>;
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.sanitizeForTerminal = sanitizeForTerminal;
|
|
7
|
+
exports.cliName = cliName;
|
|
8
|
+
exports.isInteractive = isInteractive;
|
|
9
|
+
exports.choose = choose;
|
|
10
|
+
exports.printError = printError;
|
|
11
|
+
exports.confirmYes = confirmYes;
|
|
12
|
+
exports.readSecret = readSecret;
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
14
|
+
const promises_1 = require("node:readline/promises");
|
|
15
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
4
16
|
// Strips ASCII control characters (including ESC, 0x1B) from a string before
|
|
5
17
|
// it's written to the terminal. Needed for any remotely-sourced value we
|
|
6
18
|
// render directly (e.g. apiSlug, which an API owner sets) — without this, a
|
|
@@ -10,3 +22,103 @@ function sanitizeForTerminal(value) {
|
|
|
10
22
|
// eslint-disable-next-line no-control-regex
|
|
11
23
|
return value.replace(/[\x00-\x1F\x7F]/g, "");
|
|
12
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The command the person typed: `orth`, or a staff build's `mono-dev` and
|
|
27
|
+
* `mono-prod`, so hints name a command that exists. `npm run cli` runs
|
|
28
|
+
* dist/index.js, which is `orth`.
|
|
29
|
+
*/
|
|
30
|
+
function cliName() {
|
|
31
|
+
const bin = (0, node_path_1.basename)(process.argv[1] ?? "").replace(/\.[cm]?[jt]s$/, "");
|
|
32
|
+
return !bin || bin === "index" ? "orth" : bin;
|
|
33
|
+
}
|
|
34
|
+
/** Whether a person is at the terminal to answer a question. */
|
|
35
|
+
function isInteractive() {
|
|
36
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
37
|
+
}
|
|
38
|
+
/** A numbered list to pick from; answers the chosen index. */
|
|
39
|
+
async function choose(question, labels) {
|
|
40
|
+
console.log(chalk_1.default.bold(`\n ${question}\n`));
|
|
41
|
+
labels.forEach((label, index) => console.log(` ${chalk_1.default.cyan(String(index + 1).padStart(2))} ${sanitizeForTerminal(label)}`));
|
|
42
|
+
const prompt = (0, promises_1.createInterface)({ input: process.stdin, output: process.stdout });
|
|
43
|
+
prompt.on("SIGINT", () => {
|
|
44
|
+
prompt.close();
|
|
45
|
+
process.exit(130);
|
|
46
|
+
});
|
|
47
|
+
// Ctrl+D ends the prompt like Ctrl+C: quietly.
|
|
48
|
+
let answered = false;
|
|
49
|
+
prompt.on("close", () => {
|
|
50
|
+
if (!answered)
|
|
51
|
+
process.exit(130);
|
|
52
|
+
});
|
|
53
|
+
try {
|
|
54
|
+
for (;;) {
|
|
55
|
+
const answer = Number((await prompt.question(chalk_1.default.gray(`\n Number (1-${labels.length}): `))).trim());
|
|
56
|
+
if (Number.isInteger(answer) && answer >= 1 && answer <= labels.length) {
|
|
57
|
+
answered = true;
|
|
58
|
+
return answer - 1;
|
|
59
|
+
}
|
|
60
|
+
console.log(chalk_1.default.yellow(` Type a number from 1 to ${labels.length}.`));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
prompt.close();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** A failure as people read it: a red ✗ and the message, never a stack. */
|
|
68
|
+
function printError(error) {
|
|
69
|
+
const message = error instanceof Error ? error.message : String(error ?? "Something went wrong");
|
|
70
|
+
console.error(chalk_1.default.red(`\n ✗ ${message.replace(/\n/g, "\n ")}\n`));
|
|
71
|
+
}
|
|
72
|
+
/** A yes-or-no question; anything but y/yes is no. */
|
|
73
|
+
async function confirmYes(question) {
|
|
74
|
+
const prompt = (0, promises_1.createInterface)({ input: process.stdin, output: process.stdout });
|
|
75
|
+
try {
|
|
76
|
+
const answer = await prompt.question(`\n ${question} ${chalk_1.default.gray("(y/N)")} `);
|
|
77
|
+
return /^y(es)?$/i.test(answer.trim());
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
prompt.close();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A secret typed without echo (an API key), or stdin when piped, so it never
|
|
85
|
+
* shows on screen, in shell history or in `ps`. The prompt goes to stderr,
|
|
86
|
+
* so stdout keeps only the command's output (--json).
|
|
87
|
+
*/
|
|
88
|
+
async function readSecret(question) {
|
|
89
|
+
const { stdin, stderr } = process;
|
|
90
|
+
if (!stdin.isTTY) {
|
|
91
|
+
const chunks = [];
|
|
92
|
+
for await (const chunk of stdin)
|
|
93
|
+
chunks.push(Buffer.from(chunk));
|
|
94
|
+
return Buffer.concat(chunks).toString("utf8").trim();
|
|
95
|
+
}
|
|
96
|
+
stderr.write(question);
|
|
97
|
+
return new Promise((resolve) => {
|
|
98
|
+
let value = "";
|
|
99
|
+
const stop = () => {
|
|
100
|
+
stdin.setRawMode(false);
|
|
101
|
+
stdin.pause();
|
|
102
|
+
stdin.off("data", onData);
|
|
103
|
+
stderr.write("\n");
|
|
104
|
+
};
|
|
105
|
+
const onData = (chunk) => {
|
|
106
|
+
for (const char of chunk) {
|
|
107
|
+
if (char === "\u0003") {
|
|
108
|
+
stop();
|
|
109
|
+
process.exit(130);
|
|
110
|
+
}
|
|
111
|
+
if (char === "\r" || char === "\n" || char === "\u0004") {
|
|
112
|
+
stop();
|
|
113
|
+
resolve(value.trim());
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
value = char === "\u007f" || char === "\b" ? value.slice(0, -1) : value + char;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
stdin.setRawMode(true);
|
|
120
|
+
stdin.setEncoding("utf8");
|
|
121
|
+
stdin.resume();
|
|
122
|
+
stdin.on("data", onData);
|
|
123
|
+
});
|
|
124
|
+
}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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.CLI_VERSION = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
/**
|
|
10
|
+
* The installed CLI's version, read from the package.json npm ships next to
|
|
11
|
+
* dist/ (and next to src/ in tests), so it never drifts from the release.
|
|
12
|
+
*/
|
|
13
|
+
exports.CLI_VERSION = (() => {
|
|
14
|
+
try {
|
|
15
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)(path_1.default.join(__dirname, "..", "package.json"), "utf8"));
|
|
16
|
+
return typeof pkg.version === "string" ? pkg.version : "unknown";
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return "unknown";
|
|
20
|
+
}
|
|
21
|
+
})();
|
package/dist/x402.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The x402 v2 challenge from a 402's PAYMENT-REQUIRED header: base64 (or
|
|
3
|
+
* base64url) JSON, or plain JSON. Mono's payment doors put it there and may
|
|
4
|
+
* answer with an empty body (orthogonal-sh/cli PR #61). Undefined when the
|
|
5
|
+
* header is absent or unreadable, so the caller falls back to the body.
|
|
6
|
+
*/
|
|
7
|
+
export declare function decodePaymentRequired(header: string | null): unknown;
|
package/dist/x402.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decodePaymentRequired = decodePaymentRequired;
|
|
4
|
+
/**
|
|
5
|
+
* The x402 v2 challenge from a 402's PAYMENT-REQUIRED header: base64 (or
|
|
6
|
+
* base64url) JSON, or plain JSON. Mono's payment doors put it there and may
|
|
7
|
+
* answer with an empty body (orthogonal-sh/cli PR #61). Undefined when the
|
|
8
|
+
* header is absent or unreadable, so the caller falls back to the body.
|
|
9
|
+
*/
|
|
10
|
+
function decodePaymentRequired(header) {
|
|
11
|
+
if (!header)
|
|
12
|
+
return undefined;
|
|
13
|
+
const plain = parseJson(header);
|
|
14
|
+
if (plain !== undefined)
|
|
15
|
+
return plain;
|
|
16
|
+
const base64 = header.replace(/-/g, "+").replace(/_/g, "/");
|
|
17
|
+
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
18
|
+
return parseJson(Buffer.from(padded, "base64").toString("utf8"));
|
|
19
|
+
}
|
|
20
|
+
function parseJson(text) {
|
|
21
|
+
try {
|
|
22
|
+
return JSON.parse(text);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orth/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "CLI to access all APIs and skills on the Orthogonal platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md",
|
|
12
|
+
"CHANGELOG.md",
|
|
12
13
|
"LICENSE"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
15
|
-
"build": "tsc",
|
|
16
|
-
"dev": "tsc -w",
|
|
16
|
+
"build": "node ../../scripts/local-run.mjs heavy tsc",
|
|
17
|
+
"dev": "node ../../scripts/local-run.mjs heavy tsc -w",
|
|
17
18
|
"start": "node dist/index.js",
|
|
18
|
-
"test": "vitest run",
|
|
19
|
-
"test:watch": "vitest"
|
|
20
|
-
"prepublishOnly": "npm run build"
|
|
19
|
+
"test": "node ../../scripts/local-run.mjs heavy vitest run",
|
|
20
|
+
"test:watch": "node ../../scripts/local-run.mjs heavy vitest"
|
|
21
21
|
},
|
|
22
22
|
"keywords": [
|
|
23
23
|
"orthogonal",
|
|
@@ -27,32 +27,33 @@
|
|
|
27
27
|
"skills",
|
|
28
28
|
"mcp"
|
|
29
29
|
],
|
|
30
|
-
"author": "Orthogonal <founders@orthogonal.sh> (https://orthogonal.
|
|
30
|
+
"author": "Orthogonal <founders@orthogonal.sh> (https://www.orthogonal.com)",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
|
-
"url": "git+https://github.com/orthogonal-sh/
|
|
34
|
+
"url": "git+https://github.com/orthogonal-sh/mono-repo.git",
|
|
35
|
+
"directory": "packages/cli"
|
|
35
36
|
},
|
|
36
|
-
"homepage": "https://orthogonal.
|
|
37
|
+
"homepage": "https://www.orthogonal.com",
|
|
37
38
|
"bugs": {
|
|
38
|
-
"url": "https://github.com/orthogonal-sh/
|
|
39
|
-
},
|
|
40
|
-
"publishConfig": {
|
|
41
|
-
"access": "public"
|
|
39
|
+
"url": "https://github.com/orthogonal-sh/mono-repo/issues"
|
|
42
40
|
},
|
|
43
41
|
"dependencies": {
|
|
44
|
-
"chalk": "^
|
|
45
|
-
"commander": "^
|
|
46
|
-
"conf": "^
|
|
47
|
-
"
|
|
48
|
-
"ora": "^5.4.1"
|
|
42
|
+
"chalk": "^6.0.1",
|
|
43
|
+
"commander": "^15.1.0",
|
|
44
|
+
"conf": "^16.0.0",
|
|
45
|
+
"ora": "^10.0.0"
|
|
49
46
|
},
|
|
50
47
|
"devDependencies": {
|
|
51
|
-
"@types/node": "^
|
|
52
|
-
"typescript": "^
|
|
53
|
-
"vitest": "^
|
|
48
|
+
"@types/node": "^26.6.6",
|
|
49
|
+
"typescript": "^7.0.2",
|
|
50
|
+
"vitest": "^5.1.0"
|
|
54
51
|
},
|
|
55
52
|
"engines": {
|
|
56
|
-
"node": ">=
|
|
53
|
+
"node": ">=22.12.0"
|
|
54
|
+
},
|
|
55
|
+
"private": false,
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
57
58
|
}
|
|
58
59
|
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
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
|
-
interface SkillSearchResponse {
|
|
24
|
-
results: SkillResponse[];
|
|
25
|
-
count: number;
|
|
26
|
-
}
|
|
27
|
-
export declare function skillsListCommand(options: {
|
|
28
|
-
limit: string;
|
|
29
|
-
}): Promise<void>;
|
|
30
|
-
export declare function skillsMineCommand(options: {
|
|
31
|
-
limit: string;
|
|
32
|
-
}): Promise<void>;
|
|
33
|
-
export declare function skillsSearchCommand(query: string, options: {
|
|
34
|
-
limit: string;
|
|
35
|
-
}): Promise<SkillSearchResponse>;
|
|
36
|
-
export declare function skillsShowCommand(slug: string): Promise<void>;
|
|
37
|
-
export declare function skillsCreateCommand(githubRepo: string, options: {
|
|
38
|
-
path?: string;
|
|
39
|
-
ref?: string;
|
|
40
|
-
name?: string;
|
|
41
|
-
}): Promise<void>;
|
|
42
|
-
export declare function skillsInstallCommand(slug: string, options: {
|
|
43
|
-
agent?: string;
|
|
44
|
-
}): Promise<void>;
|
|
45
|
-
export declare function skillsInitCommand(name: string | undefined, options: {
|
|
46
|
-
bare?: boolean;
|
|
47
|
-
path?: string;
|
|
48
|
-
}): Promise<void>;
|
|
49
|
-
export declare function skillsSubmitCommand(inputPath: string | undefined, options: {
|
|
50
|
-
name?: string;
|
|
51
|
-
tags?: string;
|
|
52
|
-
org?: string;
|
|
53
|
-
}): Promise<void>;
|
|
54
|
-
export declare function skillsPushCommand(slug: string, inputPath: string | undefined, options: {
|
|
55
|
-
name?: string;
|
|
56
|
-
tags?: string;
|
|
57
|
-
}): Promise<void>;
|
|
58
|
-
export declare function skillsUpdateCommand(slug: string, inputPath: string | undefined, options: {
|
|
59
|
-
force?: boolean;
|
|
60
|
-
}): Promise<void>;
|
|
61
|
-
export declare function skillsRequestVerificationCommand(slug: string): Promise<void>;
|
|
62
|
-
export declare function skillsPublishCommand(slug: string, options: {
|
|
63
|
-
unpublish?: boolean;
|
|
64
|
-
}): Promise<void>;
|
|
65
|
-
export declare function skillsRequestCommand(input: string): Promise<void>;
|
|
66
|
-
export {};
|