@orth/cli 0.2.29 → 0.2.31
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/README.md +0 -17
- package/dist/index.js +0 -68
- package/package.json +1 -1
- package/dist/commands/tasks.d.ts +0 -15
- package/dist/commands/tasks.js +0 -227
package/README.md
CHANGED
|
@@ -23,7 +23,6 @@ Discover APIs in natural language, call them with a single command, and pay per
|
|
|
23
23
|
- [Authentication](#authentication)
|
|
24
24
|
- [Calling APIs](#calling-apis)
|
|
25
25
|
- [Agent Skills](#agent-skills)
|
|
26
|
-
- [Scheduled Tasks](#scheduled-tasks)
|
|
27
26
|
- [Account & Usage](#account--usage)
|
|
28
27
|
- [Command Reference](#command-reference)
|
|
29
28
|
- [Configuration](#configuration)
|
|
@@ -174,21 +173,6 @@ orth skills request <input> # request a skill by URL or description
|
|
|
174
173
|
|
|
175
174
|
**Verification workflow:** to make a skill discoverable to others, go `init`/`create` → `submit` → `request-verification`. Once approved, it becomes discoverable in the library.
|
|
176
175
|
|
|
177
|
-
## Scheduled Tasks
|
|
178
|
-
|
|
179
|
-
Run API calls and skills on a schedule.
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
orth tasks list # your scheduled tasks
|
|
183
|
-
orth tasks create # create a task
|
|
184
|
-
orth tasks show <id> # task details
|
|
185
|
-
orth tasks trigger <id> # run it now
|
|
186
|
-
orth tasks logs <id> # run history
|
|
187
|
-
orth tasks pause <id> # pause
|
|
188
|
-
orth tasks resume <id> # resume
|
|
189
|
-
orth tasks delete <id> # delete
|
|
190
|
-
```
|
|
191
|
-
|
|
192
176
|
## Account & Usage
|
|
193
177
|
|
|
194
178
|
```bash
|
|
@@ -209,7 +193,6 @@ orth usage # recent API usage
|
|
|
209
193
|
| `orth api code <slug> <path>` | Generate integration code |
|
|
210
194
|
| `orth api request <docsUrl>` | Request an API to be added |
|
|
211
195
|
| `orth skills …` | Browse, install, author, and publish skills |
|
|
212
|
-
| `orth tasks …` | Create and manage scheduled tasks |
|
|
213
196
|
|
|
214
197
|
**Shorthand aliases** for the most common commands:
|
|
215
198
|
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,6 @@ const account_js_1 = require("./commands/account.js");
|
|
|
10
10
|
const code_js_1 = require("./commands/code.js");
|
|
11
11
|
const skills_js_1 = require("./commands/skills.js");
|
|
12
12
|
const apiRequest_js_1 = require("./commands/apiRequest.js");
|
|
13
|
-
const tasks_js_1 = require("./commands/tasks.js");
|
|
14
13
|
const analytics_js_1 = require("./analytics.js");
|
|
15
14
|
/**
|
|
16
15
|
* Wraps an async action callback so that rejected promises are caught,
|
|
@@ -248,73 +247,6 @@ skillsGroup
|
|
|
248
247
|
await (0, skills_js_1.skillsRequestCommand)(input);
|
|
249
248
|
}));
|
|
250
249
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
251
|
-
// orth tasks <subcommand> — Scheduled task commands
|
|
252
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
253
|
-
const tasksGroup = program
|
|
254
|
-
.command("tasks")
|
|
255
|
-
.description("Scheduled task commands");
|
|
256
|
-
tasksGroup
|
|
257
|
-
.command("list")
|
|
258
|
-
.description("List your scheduled tasks")
|
|
259
|
-
.action(asyncAction(async () => {
|
|
260
|
-
(0, analytics_js_1.trackEvent)("tasks.list");
|
|
261
|
-
await (0, tasks_js_1.tasksListCommand)();
|
|
262
|
-
}));
|
|
263
|
-
tasksGroup
|
|
264
|
-
.command("create")
|
|
265
|
-
.description("Create a new scheduled task")
|
|
266
|
-
.requiredOption("-s, --skill <slug>", "Skill to run")
|
|
267
|
-
.option("-n, --name <name>", "Task name")
|
|
268
|
-
.option("--schedule <cron>", "Cron expression or preset (every-5-min, every-hour, every-day-9am, every-weekday-9am, every-monday, every-month)")
|
|
269
|
-
.option("-i, --input <pairs...>", "Skill input as key=value pairs")
|
|
270
|
-
.action(asyncAction(async (options) => {
|
|
271
|
-
(0, analytics_js_1.trackEvent)("tasks.create", { skill: options.skill });
|
|
272
|
-
await (0, tasks_js_1.tasksCreateCommand)(options);
|
|
273
|
-
}));
|
|
274
|
-
tasksGroup
|
|
275
|
-
.command("show <id>")
|
|
276
|
-
.description("Show task details")
|
|
277
|
-
.action(asyncAction(async (id) => {
|
|
278
|
-
(0, analytics_js_1.trackEvent)("tasks.show", { id });
|
|
279
|
-
await (0, tasks_js_1.tasksShowCommand)(id);
|
|
280
|
-
}));
|
|
281
|
-
tasksGroup
|
|
282
|
-
.command("delete <id>")
|
|
283
|
-
.description("Delete a scheduled task")
|
|
284
|
-
.action(asyncAction(async (id) => {
|
|
285
|
-
(0, analytics_js_1.trackEvent)("tasks.delete", { id });
|
|
286
|
-
await (0, tasks_js_1.tasksDeleteCommand)(id);
|
|
287
|
-
}));
|
|
288
|
-
tasksGroup
|
|
289
|
-
.command("pause <id>")
|
|
290
|
-
.description("Pause a scheduled task")
|
|
291
|
-
.action(asyncAction(async (id) => {
|
|
292
|
-
(0, analytics_js_1.trackEvent)("tasks.pause", { id });
|
|
293
|
-
await (0, tasks_js_1.tasksPauseCommand)(id);
|
|
294
|
-
}));
|
|
295
|
-
tasksGroup
|
|
296
|
-
.command("resume <id>")
|
|
297
|
-
.description("Resume a paused task")
|
|
298
|
-
.action(asyncAction(async (id) => {
|
|
299
|
-
(0, analytics_js_1.trackEvent)("tasks.resume", { id });
|
|
300
|
-
await (0, tasks_js_1.tasksResumeCommand)(id);
|
|
301
|
-
}));
|
|
302
|
-
tasksGroup
|
|
303
|
-
.command("trigger <id>")
|
|
304
|
-
.description("Manually trigger a task run")
|
|
305
|
-
.action(asyncAction(async (id) => {
|
|
306
|
-
(0, analytics_js_1.trackEvent)("tasks.trigger", { id });
|
|
307
|
-
await (0, tasks_js_1.tasksTriggerCommand)(id);
|
|
308
|
-
}));
|
|
309
|
-
tasksGroup
|
|
310
|
-
.command("logs <id>")
|
|
311
|
-
.description("View run history for a task")
|
|
312
|
-
.option("-l, --limit <number>", "Max results", "10")
|
|
313
|
-
.action(asyncAction(async (id, options) => {
|
|
314
|
-
(0, analytics_js_1.trackEvent)("tasks.logs", { id });
|
|
315
|
-
await (0, tasks_js_1.tasksLogsCommand)(id, options);
|
|
316
|
-
}));
|
|
317
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
318
250
|
// Backward-compatible aliases (flat commands)
|
|
319
251
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
320
252
|
program
|
package/package.json
CHANGED
package/dist/commands/tasks.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare function tasksListCommand(): Promise<void>;
|
|
2
|
-
export declare function tasksCreateCommand(options: {
|
|
3
|
-
skill: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
schedule?: string;
|
|
6
|
-
input?: string[];
|
|
7
|
-
}): Promise<void>;
|
|
8
|
-
export declare function tasksShowCommand(taskId: string): Promise<void>;
|
|
9
|
-
export declare function tasksDeleteCommand(taskId: string): Promise<void>;
|
|
10
|
-
export declare function tasksPauseCommand(taskId: string): Promise<void>;
|
|
11
|
-
export declare function tasksResumeCommand(taskId: string): Promise<void>;
|
|
12
|
-
export declare function tasksTriggerCommand(taskId: string): Promise<void>;
|
|
13
|
-
export declare function tasksLogsCommand(taskId: string, options: {
|
|
14
|
-
limit?: string;
|
|
15
|
-
}): Promise<void>;
|
package/dist/commands/tasks.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
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.tasksListCommand = tasksListCommand;
|
|
7
|
-
exports.tasksCreateCommand = tasksCreateCommand;
|
|
8
|
-
exports.tasksShowCommand = tasksShowCommand;
|
|
9
|
-
exports.tasksDeleteCommand = tasksDeleteCommand;
|
|
10
|
-
exports.tasksPauseCommand = tasksPauseCommand;
|
|
11
|
-
exports.tasksResumeCommand = tasksResumeCommand;
|
|
12
|
-
exports.tasksTriggerCommand = tasksTriggerCommand;
|
|
13
|
-
exports.tasksLogsCommand = tasksLogsCommand;
|
|
14
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
15
|
-
const ora_1 = __importDefault(require("ora"));
|
|
16
|
-
const api_js_1 = require("../api.js");
|
|
17
|
-
// Common cron presets
|
|
18
|
-
const CRON_PRESETS = {
|
|
19
|
-
"every-5-min": "*/5 * * * *",
|
|
20
|
-
"every-hour": "0 * * * *",
|
|
21
|
-
"every-day-9am": "0 9 * * *",
|
|
22
|
-
"every-weekday-9am": "0 9 * * 1-5",
|
|
23
|
-
"every-monday": "0 9 * * 1",
|
|
24
|
-
"every-month": "0 9 1 * *",
|
|
25
|
-
};
|
|
26
|
-
function cronToHuman(expr) {
|
|
27
|
-
const presetName = Object.entries(CRON_PRESETS).find(([, v]) => v === expr)?.[0];
|
|
28
|
-
if (presetName) {
|
|
29
|
-
return presetName.replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
30
|
-
}
|
|
31
|
-
return expr;
|
|
32
|
-
}
|
|
33
|
-
function formatTimeAgo(dateStr) {
|
|
34
|
-
const diff = Date.now() - new Date(dateStr).getTime();
|
|
35
|
-
const mins = Math.floor(diff / 60000);
|
|
36
|
-
if (mins < 1)
|
|
37
|
-
return "just now";
|
|
38
|
-
if (mins < 60)
|
|
39
|
-
return `${mins}m ago`;
|
|
40
|
-
const hours = Math.floor(mins / 60);
|
|
41
|
-
if (hours < 24)
|
|
42
|
-
return `${hours}h ago`;
|
|
43
|
-
const days = Math.floor(hours / 24);
|
|
44
|
-
return `${days}d ago`;
|
|
45
|
-
}
|
|
46
|
-
function statusBadge(status) {
|
|
47
|
-
switch (status) {
|
|
48
|
-
case "active": return chalk_1.default.green("● active");
|
|
49
|
-
case "paused": return chalk_1.default.yellow("● paused");
|
|
50
|
-
case "succeeded": return chalk_1.default.green("✓ succeeded");
|
|
51
|
-
case "failed": return chalk_1.default.red("✗ failed");
|
|
52
|
-
case "running": return chalk_1.default.blue("◌ running");
|
|
53
|
-
case "pending": return chalk_1.default.gray("○ pending");
|
|
54
|
-
default: return chalk_1.default.gray(status);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async function tasksListCommand() {
|
|
58
|
-
const spinner = (0, ora_1.default)("Fetching tasks...").start();
|
|
59
|
-
try {
|
|
60
|
-
const data = await (0, api_js_1.apiRequest)("/tasks");
|
|
61
|
-
spinner.stop();
|
|
62
|
-
if (!data.tasks || data.tasks.length === 0) {
|
|
63
|
-
console.log(chalk_1.default.gray("\n No tasks yet. Create one with: orth tasks create\n"));
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
console.log(chalk_1.default.bold("\nTasks\n"));
|
|
67
|
-
for (const task of data.tasks) {
|
|
68
|
-
console.log(` ${chalk_1.default.white.bold(task.name)} ${statusBadge(task.status)} ${chalk_1.default.gray(cronToHuman(task.cron_expression))}`);
|
|
69
|
-
console.log(` Skill: ${chalk_1.default.cyan(task.skill_slug)} Runs: ${task.run_count}${task.last_run_at ? ` Last: ${formatTimeAgo(task.last_run_at)}` : ""}`);
|
|
70
|
-
console.log(` ID: ${chalk_1.default.gray(task.id)}`);
|
|
71
|
-
console.log();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
catch (err) {
|
|
75
|
-
spinner.fail("Failed to fetch tasks");
|
|
76
|
-
console.error(chalk_1.default.red(err.message));
|
|
77
|
-
process.exit(1);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
async function tasksCreateCommand(options) {
|
|
81
|
-
const { skill, name, schedule } = options;
|
|
82
|
-
if (!skill) {
|
|
83
|
-
console.error(chalk_1.default.red("Skill slug is required. Usage: orth tasks create --skill <slug>"));
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
// Parse schedule
|
|
87
|
-
let cronExpression = schedule || "0 9 * * *"; // default: daily at 9am
|
|
88
|
-
if (CRON_PRESETS[cronExpression]) {
|
|
89
|
-
cronExpression = CRON_PRESETS[cronExpression];
|
|
90
|
-
}
|
|
91
|
-
// Parse input key=value pairs
|
|
92
|
-
const skillInput = {};
|
|
93
|
-
if (options.input) {
|
|
94
|
-
for (const pair of options.input) {
|
|
95
|
-
const [key, ...rest] = pair.split("=");
|
|
96
|
-
if (key && rest.length > 0) {
|
|
97
|
-
skillInput[key] = rest.join("=");
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
const taskName = name || `${skill} (${cronToHuman(cronExpression)})`;
|
|
102
|
-
const spinner = (0, ora_1.default)("Creating task...").start();
|
|
103
|
-
try {
|
|
104
|
-
const data = await (0, api_js_1.apiRequest)("/tasks", {
|
|
105
|
-
method: "POST",
|
|
106
|
-
body: {
|
|
107
|
-
name: taskName,
|
|
108
|
-
skillSlug: skill,
|
|
109
|
-
skillInput,
|
|
110
|
-
cronExpression,
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
spinner.succeed("Task created!");
|
|
114
|
-
console.log(`\n ${chalk_1.default.white.bold(data.task.name)}`);
|
|
115
|
-
console.log(` Skill: ${chalk_1.default.cyan(data.task.skill_slug)}`);
|
|
116
|
-
console.log(` Schedule: ${chalk_1.default.gray(cronToHuman(data.task.cron_expression))}`);
|
|
117
|
-
console.log(` Status: ${statusBadge(data.task.status)}`);
|
|
118
|
-
console.log(` ID: ${chalk_1.default.gray(data.task.id)}\n`);
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
spinner.fail("Failed to create task");
|
|
122
|
-
console.error(chalk_1.default.red(err.message));
|
|
123
|
-
process.exit(1);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
async function tasksShowCommand(taskId) {
|
|
127
|
-
const spinner = (0, ora_1.default)("Fetching task...").start();
|
|
128
|
-
try {
|
|
129
|
-
const data = await (0, api_js_1.apiRequest)(`/tasks/${taskId}`);
|
|
130
|
-
spinner.stop();
|
|
131
|
-
const t = data.task;
|
|
132
|
-
console.log(`\n ${chalk_1.default.white.bold(t.name)}`);
|
|
133
|
-
console.log(` Status: ${statusBadge(t.status)}`);
|
|
134
|
-
console.log(` Skill: ${chalk_1.default.cyan(t.skill_slug)}`);
|
|
135
|
-
console.log(` Schedule: ${chalk_1.default.gray(cronToHuman(t.cron_expression))} (${t.timezone})`);
|
|
136
|
-
console.log(` Runs: ${t.run_count}${t.last_run_at ? ` Last: ${formatTimeAgo(t.last_run_at)}` : ""}`);
|
|
137
|
-
if (Object.keys(t.skill_input || {}).length > 0) {
|
|
138
|
-
console.log(` Input: ${chalk_1.default.gray(JSON.stringify(t.skill_input))}`);
|
|
139
|
-
}
|
|
140
|
-
console.log(` ID: ${chalk_1.default.gray(t.id)}`);
|
|
141
|
-
console.log(` Created: ${new Date(t.created_at).toLocaleString()}\n`);
|
|
142
|
-
}
|
|
143
|
-
catch (err) {
|
|
144
|
-
spinner.fail("Failed to fetch task");
|
|
145
|
-
console.error(chalk_1.default.red(err.message));
|
|
146
|
-
process.exit(1);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
async function tasksDeleteCommand(taskId) {
|
|
150
|
-
const spinner = (0, ora_1.default)("Deleting task...").start();
|
|
151
|
-
try {
|
|
152
|
-
await (0, api_js_1.apiRequest)(`/tasks/${taskId}`, { method: "DELETE" });
|
|
153
|
-
spinner.succeed("Task deleted");
|
|
154
|
-
}
|
|
155
|
-
catch (err) {
|
|
156
|
-
spinner.fail("Failed to delete task");
|
|
157
|
-
console.error(chalk_1.default.red(err.message));
|
|
158
|
-
process.exit(1);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
async function tasksPauseCommand(taskId) {
|
|
162
|
-
const spinner = (0, ora_1.default)("Pausing task...").start();
|
|
163
|
-
try {
|
|
164
|
-
const data = await (0, api_js_1.apiRequest)(`/tasks/${taskId}/pause`, { method: "POST" });
|
|
165
|
-
spinner.succeed(`Task paused: ${data.task.name}`);
|
|
166
|
-
}
|
|
167
|
-
catch (err) {
|
|
168
|
-
spinner.fail("Failed to pause task");
|
|
169
|
-
console.error(chalk_1.default.red(err.message));
|
|
170
|
-
process.exit(1);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
async function tasksResumeCommand(taskId) {
|
|
174
|
-
const spinner = (0, ora_1.default)("Resuming task...").start();
|
|
175
|
-
try {
|
|
176
|
-
const data = await (0, api_js_1.apiRequest)(`/tasks/${taskId}/resume`, { method: "POST" });
|
|
177
|
-
spinner.succeed(`Task resumed: ${data.task.name}`);
|
|
178
|
-
}
|
|
179
|
-
catch (err) {
|
|
180
|
-
spinner.fail("Failed to resume task");
|
|
181
|
-
console.error(chalk_1.default.red(err.message));
|
|
182
|
-
process.exit(1);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
async function tasksTriggerCommand(taskId) {
|
|
186
|
-
const spinner = (0, ora_1.default)("Triggering task...").start();
|
|
187
|
-
try {
|
|
188
|
-
await (0, api_js_1.apiRequest)(`/tasks/${taskId}/trigger`, { method: "POST" });
|
|
189
|
-
spinner.succeed("Task triggered — check logs for progress");
|
|
190
|
-
}
|
|
191
|
-
catch (err) {
|
|
192
|
-
spinner.fail("Failed to trigger task");
|
|
193
|
-
console.error(chalk_1.default.red(err.message));
|
|
194
|
-
process.exit(1);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
async function tasksLogsCommand(taskId, options) {
|
|
198
|
-
const limit = parseInt(options.limit || "10") || 10;
|
|
199
|
-
const spinner = (0, ora_1.default)("Fetching run history...").start();
|
|
200
|
-
try {
|
|
201
|
-
const data = await (0, api_js_1.apiRequest)(`/tasks/${taskId}/runs?limit=${limit}`);
|
|
202
|
-
spinner.stop();
|
|
203
|
-
if (!data.runs || data.runs.length === 0) {
|
|
204
|
-
console.log(chalk_1.default.gray("\n No runs yet.\n"));
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
console.log(chalk_1.default.bold(`\nRun History (${data.total} total)\n`));
|
|
208
|
-
for (const run of data.runs) {
|
|
209
|
-
const duration = run.duration_ms != null ? `${(run.duration_ms / 1000).toFixed(0)}s` : "—";
|
|
210
|
-
const time = run.started_at ? new Date(run.started_at).toLocaleString() : "—";
|
|
211
|
-
console.log(` ${statusBadge(run.status)} ${chalk_1.default.gray(time)} ${chalk_1.default.gray(duration)}`);
|
|
212
|
-
if (run.error) {
|
|
213
|
-
console.log(` ${chalk_1.default.red(run.error)}`);
|
|
214
|
-
}
|
|
215
|
-
if (run.output) {
|
|
216
|
-
const preview = run.output.slice(0, 200);
|
|
217
|
-
console.log(` ${chalk_1.default.gray(preview)}${run.output.length > 200 ? "..." : ""}`);
|
|
218
|
-
}
|
|
219
|
-
console.log();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
catch (err) {
|
|
223
|
-
spinner.fail("Failed to fetch run history");
|
|
224
|
-
console.error(chalk_1.default.red(err.message));
|
|
225
|
-
process.exit(1);
|
|
226
|
-
}
|
|
227
|
-
}
|