@sente-labs/cli 0.11.0 → 0.13.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/README.md +73 -46
- package/dist/client.js +12 -3
- package/dist/client.js.map +1 -1
- package/dist/commands/inbox.js +30 -4
- package/dist/commands/inbox.js.map +1 -1
- package/dist/config.js +0 -27
- package/dist/config.js.map +1 -1
- package/dist/index.js +3 -27
- package/dist/index.js.map +1 -1
- package/dist/{skill/autoupdate.js → update.js} +10 -47
- package/dist/update.js.map +1 -0
- package/package.json +3 -3
- package/dist/commands/appGraph.js +0 -110
- package/dist/commands/appGraph.js.map +0 -1
- package/dist/commands/auth.js +0 -54
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/deployWebhook.js +0 -94
- package/dist/commands/deployWebhook.js.map +0 -1
- package/dist/commands/init.js +0 -209
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/project.js +0 -283
- package/dist/commands/project.js.map +0 -1
- package/dist/commands/schedule.js +0 -188
- package/dist/commands/schedule.js.map +0 -1
- package/dist/commands/secret.js +0 -245
- package/dist/commands/secret.js.map +0 -1
- package/dist/commands/task.js +0 -425
- package/dist/commands/task.js.map +0 -1
- package/dist/commands/workflow.js +0 -69
- package/dist/commands/workflow.js.map +0 -1
- package/dist/skill/SKILL.md +0 -93
- package/dist/skill/autoupdate.js.map +0 -1
- package/dist/skill/template.js +0 -68
- package/dist/skill/template.js.map +0 -1
package/dist/commands/project.js
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
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.registerProjectCommands = registerProjectCommands;
|
|
37
|
-
exports.registerSyncCommand = registerSyncCommand;
|
|
38
|
-
const fs = __importStar(require("fs"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
|
-
const client_1 = require("../client");
|
|
41
|
-
const output_1 = require("../output");
|
|
42
|
-
const workflow_1 = require("./workflow");
|
|
43
|
-
/**
|
|
44
|
-
* Read the local .sente/config.json (written by `sente init` in M4).
|
|
45
|
-
* Walks up from the cwd looking for it -- same pattern as git/node_modules.
|
|
46
|
-
*/
|
|
47
|
-
function readLocalProjectId() {
|
|
48
|
-
let dir = process.cwd();
|
|
49
|
-
while (true) {
|
|
50
|
-
const candidate = path.join(dir, '.sente', 'config.json');
|
|
51
|
-
if (fs.existsSync(candidate)) {
|
|
52
|
-
try {
|
|
53
|
-
const parsed = JSON.parse(fs.readFileSync(candidate, 'utf8'));
|
|
54
|
-
if (typeof parsed.projectId === 'string')
|
|
55
|
-
return parsed.projectId;
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const parent = path.dirname(dir);
|
|
62
|
-
if (parent === dir)
|
|
63
|
-
return null;
|
|
64
|
-
dir = parent;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function registerProjectCommands(program, globalOpts) {
|
|
68
|
-
const project = program.command('project').description('Project commands');
|
|
69
|
-
project
|
|
70
|
-
.command('list')
|
|
71
|
-
.description('List all projects in the current organization')
|
|
72
|
-
.action(async () => {
|
|
73
|
-
const opts = globalOpts();
|
|
74
|
-
try {
|
|
75
|
-
const client = new client_1.GatewayClient();
|
|
76
|
-
const res = await client.request('/api/projects');
|
|
77
|
-
(0, output_1.printSuccess)(
|
|
78
|
-
// Match the sibling list commands' --json shape (strip the envelope).
|
|
79
|
-
{ projects: res.projects }, () => {
|
|
80
|
-
if (!res.projects.length) {
|
|
81
|
-
process.stdout.write('No projects.\n');
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
for (const p of res.projects) {
|
|
85
|
-
const def = p.isDefault ? ' [default]' : '';
|
|
86
|
-
const url = p.baseUrl ? ` ${p.baseUrl}` : '';
|
|
87
|
-
process.stdout.write(`${p.id} ${p.name}${def}${url}\n`);
|
|
88
|
-
}
|
|
89
|
-
}, opts);
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
process.exit((0, output_1.printError)(err, opts));
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
project
|
|
96
|
-
.command('set')
|
|
97
|
-
.description('Update the project server-side (e.g. its staging base URL); also syncs .sente/config.json')
|
|
98
|
-
.option('--id <projectId>', 'Project id (overrides .sente/config.json)')
|
|
99
|
-
.option('--url <baseUrl>', 'New staging base URL — where runs AND `sente auth login` seeding navigate')
|
|
100
|
-
.option('--name <name>', 'New project name')
|
|
101
|
-
.action(async (cmdOpts) => {
|
|
102
|
-
const opts = globalOpts();
|
|
103
|
-
try {
|
|
104
|
-
const projectId = cmdOpts.id ?? readLocalProjectId();
|
|
105
|
-
if (!projectId) {
|
|
106
|
-
throw new Error('No project id found. Pass --id <projectId> or run `sente init` to create a .sente/config.json.');
|
|
107
|
-
}
|
|
108
|
-
const body = {};
|
|
109
|
-
if (cmdOpts.url)
|
|
110
|
-
body.baseUrl = cmdOpts.url;
|
|
111
|
-
if (cmdOpts.name)
|
|
112
|
-
body.name = cmdOpts.name;
|
|
113
|
-
if (Object.keys(body).length === 0) {
|
|
114
|
-
throw new Error('Nothing to update. Pass --url <baseUrl> and/or --name <name>.');
|
|
115
|
-
}
|
|
116
|
-
const client = new client_1.GatewayClient();
|
|
117
|
-
const res = await client.request(`/api/projects/${projectId}`, {
|
|
118
|
-
method: 'PUT',
|
|
119
|
-
body,
|
|
120
|
-
});
|
|
121
|
-
// Keep the local authoring config in sync so `.sente/config.json` never
|
|
122
|
-
// diverges from the server (the server value is what runs/seeding use).
|
|
123
|
-
const localPath = cmdOpts.url ? updateLocalConfigBaseUrl(cmdOpts.url) : null;
|
|
124
|
-
(0, output_1.printSuccess)(res.project, () => {
|
|
125
|
-
const p = res.project;
|
|
126
|
-
process.stdout.write(`Updated project ${p.name} (${p.id}).\n`);
|
|
127
|
-
if (p.baseUrl)
|
|
128
|
-
process.stdout.write(`Base URL: ${p.baseUrl}\n`);
|
|
129
|
-
if (localPath)
|
|
130
|
-
process.stdout.write(`Synced ${localPath}\n`);
|
|
131
|
-
if (cmdOpts.url) {
|
|
132
|
-
process.stdout.write('\nThis URL is where runs AND `sente auth login` seeding navigate. If you changed the\n' +
|
|
133
|
-
'domain, re-run `sente auth login` to re-seed auth — cookies are domain-scoped.\n');
|
|
134
|
-
}
|
|
135
|
-
}, opts);
|
|
136
|
-
}
|
|
137
|
-
catch (err) {
|
|
138
|
-
process.exit((0, output_1.printError)(err, opts));
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
project
|
|
142
|
-
.command('show')
|
|
143
|
-
.description('Show the current project (from .sente/config.json or --id)')
|
|
144
|
-
.option('--id <projectId>', 'Project id (overrides .sente/config.json)')
|
|
145
|
-
.action(async (cmdOpts) => {
|
|
146
|
-
const opts = globalOpts();
|
|
147
|
-
try {
|
|
148
|
-
const projectId = cmdOpts.id ?? readLocalProjectId();
|
|
149
|
-
if (!projectId) {
|
|
150
|
-
throw new Error('No project id found. Pass --id <projectId> or run `sente init` to create a .sente/config.json.');
|
|
151
|
-
}
|
|
152
|
-
const client = new client_1.GatewayClient();
|
|
153
|
-
const res = await client.request(`/api/projects/${projectId}`);
|
|
154
|
-
(0, output_1.printSuccess)(res.project, () => {
|
|
155
|
-
const p = res.project;
|
|
156
|
-
process.stdout.write(`Project: ${p.name} (${p.id})\n`);
|
|
157
|
-
if (p.description)
|
|
158
|
-
process.stdout.write(`Description: ${p.description}\n`);
|
|
159
|
-
if (p.baseUrl)
|
|
160
|
-
process.stdout.write(`Base URL: ${p.baseUrl}\n`);
|
|
161
|
-
process.stdout.write(`Created: ${p.createdAt}\n`);
|
|
162
|
-
process.stdout.write(`Updated: ${p.updatedAt}\n`);
|
|
163
|
-
}, opts);
|
|
164
|
-
}
|
|
165
|
-
catch (err) {
|
|
166
|
-
process.exit((0, output_1.printError)(err, opts));
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
project
|
|
170
|
-
.command('run')
|
|
171
|
-
.description('Queue a run for every task across all workflows in a project (sequential, against staging)')
|
|
172
|
-
.option('--id <projectId>', 'Project id (overrides .sente/config.json)')
|
|
173
|
-
.action(async (cmdOpts) => {
|
|
174
|
-
const opts = globalOpts();
|
|
175
|
-
try {
|
|
176
|
-
const projectId = cmdOpts.id ?? readLocalProjectId();
|
|
177
|
-
if (!projectId) {
|
|
178
|
-
throw new Error('No project id found. Pass --id <projectId> or run `sente init` to create a .sente/config.json.');
|
|
179
|
-
}
|
|
180
|
-
const client = new client_1.GatewayClient();
|
|
181
|
-
const res = await client.request(`/api/projects/${projectId}/run`, { method: 'POST', body: {} });
|
|
182
|
-
(0, output_1.printSuccess)(res, () => (0, workflow_1.printBulkRun)(res), opts);
|
|
183
|
-
}
|
|
184
|
-
catch (err) {
|
|
185
|
-
process.exit((0, output_1.printError)(err, opts));
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
function registerSyncCommand(program, globalOpts) {
|
|
190
|
-
program
|
|
191
|
-
.command('sync')
|
|
192
|
-
.description('Regenerate .sente/tasks.json from the current Sente project')
|
|
193
|
-
.action(async () => {
|
|
194
|
-
const opts = globalOpts();
|
|
195
|
-
try {
|
|
196
|
-
const projectId = readLocalProjectId();
|
|
197
|
-
if (!projectId) {
|
|
198
|
-
throw new Error('No project id found. Run `sente init` first, or run this from inside a repo with .sente/config.json.');
|
|
199
|
-
}
|
|
200
|
-
const client = new client_1.GatewayClient();
|
|
201
|
-
const res = await client.request('/api/tasks/list', {
|
|
202
|
-
query: { projectId },
|
|
203
|
-
});
|
|
204
|
-
const tasksDir = findSenteDir();
|
|
205
|
-
if (!tasksDir) {
|
|
206
|
-
throw new Error('No .sente directory found upward from cwd.');
|
|
207
|
-
}
|
|
208
|
-
const tasksPath = path.join(tasksDir, 'tasks.json');
|
|
209
|
-
// Preserve existing tags + relatedPaths -- the file is the authoring hint
|
|
210
|
-
// layer, so we treat user-written annotations as canonical for those fields.
|
|
211
|
-
const existing = readExistingTasksFile(tasksPath);
|
|
212
|
-
const existingById = new Map(existing.tasks.map((t) => [t.id, t]));
|
|
213
|
-
const merged = {
|
|
214
|
-
projectId,
|
|
215
|
-
tasks: res.tasks.map((t) => {
|
|
216
|
-
const prev = existingById.get(t.id);
|
|
217
|
-
return {
|
|
218
|
-
id: t.id,
|
|
219
|
-
name: t.name,
|
|
220
|
-
tags: prev?.tags ?? [],
|
|
221
|
-
relatedPaths: prev?.relatedPaths ?? [],
|
|
222
|
-
};
|
|
223
|
-
}),
|
|
224
|
-
};
|
|
225
|
-
fs.writeFileSync(tasksPath, JSON.stringify(merged, null, 2) + '\n');
|
|
226
|
-
(0, output_1.printSuccess)({ path: tasksPath, taskCount: merged.tasks.length }, `Wrote ${merged.tasks.length} task(s) to ${tasksPath}`, opts);
|
|
227
|
-
}
|
|
228
|
-
catch (err) {
|
|
229
|
-
process.exit((0, output_1.printError)(err, opts));
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
function findSenteDir() {
|
|
234
|
-
let dir = process.cwd();
|
|
235
|
-
while (true) {
|
|
236
|
-
const candidate = path.join(dir, '.sente');
|
|
237
|
-
if (fs.existsSync(candidate) && fs.statSync(candidate).isDirectory()) {
|
|
238
|
-
return candidate;
|
|
239
|
-
}
|
|
240
|
-
const parent = path.dirname(dir);
|
|
241
|
-
if (parent === dir)
|
|
242
|
-
return null;
|
|
243
|
-
dir = parent;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Update the `baseUrl` in the local .sente/config.json (if present), preserving
|
|
248
|
-
* all other fields. Keeps the local authoring config in sync with the server-side
|
|
249
|
-
* project after `sente project set --url`. Returns the file path written, or null
|
|
250
|
-
* if there is no local config (e.g. running with an explicit --id outside a repo).
|
|
251
|
-
*/
|
|
252
|
-
function updateLocalConfigBaseUrl(baseUrl) {
|
|
253
|
-
const dir = findSenteDir();
|
|
254
|
-
if (!dir)
|
|
255
|
-
return null;
|
|
256
|
-
const configPath = path.join(dir, 'config.json');
|
|
257
|
-
if (!fs.existsSync(configPath))
|
|
258
|
-
return null;
|
|
259
|
-
try {
|
|
260
|
-
const cfg = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
261
|
-
cfg.baseUrl = baseUrl;
|
|
262
|
-
fs.writeFileSync(configPath, JSON.stringify(cfg, null, 2) + '\n');
|
|
263
|
-
return configPath;
|
|
264
|
-
}
|
|
265
|
-
catch {
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
function readExistingTasksFile(p) {
|
|
270
|
-
if (!fs.existsSync(p))
|
|
271
|
-
return { projectId: '', tasks: [] };
|
|
272
|
-
try {
|
|
273
|
-
const parsed = JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
274
|
-
return {
|
|
275
|
-
projectId: typeof parsed.projectId === 'string' ? parsed.projectId : '',
|
|
276
|
-
tasks: Array.isArray(parsed.tasks) ? parsed.tasks : [],
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
catch {
|
|
280
|
-
return { projectId: '', tasks: [] };
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
//# sourceMappingURL=project.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/commands/project.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,0DA0IC;AAED,kDAqDC;AAnQD,uCAAyB;AACzB,2CAA6B;AAE7B,sCAA0C;AAC1C,sCAAiE;AACjE,yCAA2D;AAuC3D;;;GAGG;AACH,SAAS,kBAAkB;IACzB,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACxB,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC1D,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;gBAC9D,IAAI,OA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CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;QAC5D,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACtB,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAClE,OAAO,UAAU,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,CAAS;IACtC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC3D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QACtD,OAAO;YACL,SAAS,EAAE,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;YACvE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;SACvD,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerScheduleCommands = registerScheduleCommands;
|
|
4
|
-
const client_1 = require("../client");
|
|
5
|
-
const output_1 = require("../output");
|
|
6
|
-
/**
|
|
7
|
-
* Parse a human-friendly interval string ("30m", "1h", "2d", "1w") into the
|
|
8
|
-
* gateway's `{intervalValue, intervalUnit}` shape. Accepts bare units too:
|
|
9
|
-
* "minute(s)", "hour(s)", "day(s)", "week(s)" -- always lower-case.
|
|
10
|
-
*/
|
|
11
|
-
function parseInterval(raw) {
|
|
12
|
-
const trimmed = raw.trim().toLowerCase();
|
|
13
|
-
// Shorthand first: "30m", "1h", "2d", "1w".
|
|
14
|
-
const shortMatch = trimmed.match(/^(\d+)\s*([smhdw])$/);
|
|
15
|
-
if (shortMatch) {
|
|
16
|
-
const value = parseInt(shortMatch[1], 10);
|
|
17
|
-
const u = shortMatch[2];
|
|
18
|
-
const unit = u === 'm' ? 'minutes' : u === 'h' ? 'hours' : u === 'd' ? 'days' : u === 'w' ? 'weeks' : null;
|
|
19
|
-
if (unit && value > 0)
|
|
20
|
-
return { intervalValue: value, intervalUnit: unit };
|
|
21
|
-
}
|
|
22
|
-
// Long form: "5 minutes", "1 hour", "3 days", "2 weeks".
|
|
23
|
-
const longMatch = trimmed.match(/^(\d+)\s*(minute|minutes|hour|hours|day|days|week|weeks)$/);
|
|
24
|
-
if (longMatch) {
|
|
25
|
-
const value = parseInt(longMatch[1], 10);
|
|
26
|
-
const u = longMatch[2];
|
|
27
|
-
const unit = u.startsWith('minute') ? 'minutes' : u.startsWith('hour') ? 'hours' : u.startsWith('day') ? 'days' : 'weeks';
|
|
28
|
-
if (value > 0)
|
|
29
|
-
return { intervalValue: value, intervalUnit: unit };
|
|
30
|
-
}
|
|
31
|
-
throw new Error(`Could not parse interval "${raw}". Use e.g. "30m", "1h", "2d", "1w" or "5 minutes", "1 hour".`);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Translate CLI flags into the gateway's schedule body. Exactly one of
|
|
35
|
-
* `--interval`, `--cron`, `--at` must be set.
|
|
36
|
-
*/
|
|
37
|
-
function buildScheduleBody(opts) {
|
|
38
|
-
const provided = [opts.interval, opts.cron, opts.at].filter(Boolean).length;
|
|
39
|
-
if (provided === 0) {
|
|
40
|
-
throw new Error('Pass exactly one of --interval, --cron, or --at.');
|
|
41
|
-
}
|
|
42
|
-
if (provided > 1) {
|
|
43
|
-
throw new Error('--interval, --cron, and --at are mutually exclusive.');
|
|
44
|
-
}
|
|
45
|
-
const enabled = !opts.disabled;
|
|
46
|
-
const timezone = opts.timezone ?? 'UTC';
|
|
47
|
-
if (opts.interval) {
|
|
48
|
-
const { intervalValue, intervalUnit } = parseInterval(opts.interval);
|
|
49
|
-
return { scheduleType: 'interval', intervalValue, intervalUnit, timezone, enabled };
|
|
50
|
-
}
|
|
51
|
-
if (opts.cron) {
|
|
52
|
-
return { scheduleType: 'cron', cronExpression: opts.cron, timezone, enabled };
|
|
53
|
-
}
|
|
54
|
-
// one_time
|
|
55
|
-
const date = new Date(opts.at);
|
|
56
|
-
if (Number.isNaN(date.getTime())) {
|
|
57
|
-
throw new Error(`Could not parse --at "${opts.at}". Use ISO 8601 (e.g. "2026-12-31T17:00:00Z").`);
|
|
58
|
-
}
|
|
59
|
-
return { scheduleType: 'one_time', scheduledAt: date.toISOString(), timezone, enabled };
|
|
60
|
-
}
|
|
61
|
-
function describeSchedule(s) {
|
|
62
|
-
switch (s.scheduleType) {
|
|
63
|
-
case 'interval':
|
|
64
|
-
return `every ${s.intervalValue} ${s.intervalUnit}`;
|
|
65
|
-
case 'cron':
|
|
66
|
-
return `cron "${s.cronExpression}" (${s.timezone})`;
|
|
67
|
-
case 'one_time':
|
|
68
|
-
return `once at ${s.scheduledAt}`;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function registerScheduleCommands(program, globalOpts) {
|
|
72
|
-
const schedule = program.command('schedule').description('Task schedule commands');
|
|
73
|
-
schedule
|
|
74
|
-
.command('set')
|
|
75
|
-
.description('Create or replace a task schedule')
|
|
76
|
-
.argument('<taskId>', 'task id (or shortId)')
|
|
77
|
-
.option('--interval <duration>', 'recurring interval (e.g. 30m, 1h, 2d, 1w)')
|
|
78
|
-
.option('--cron <expression>', 'cron expression (e.g. "0 */2 * * *")')
|
|
79
|
-
.option('--at <iso>', 'run once at this ISO 8601 datetime')
|
|
80
|
-
.option('--timezone <tz>', 'IANA timezone for cron schedules', 'UTC')
|
|
81
|
-
.option('--disabled', 'create the schedule but leave it disabled')
|
|
82
|
-
.action(async (taskId, cmdOpts) => {
|
|
83
|
-
const opts = globalOpts();
|
|
84
|
-
try {
|
|
85
|
-
const body = buildScheduleBody(cmdOpts);
|
|
86
|
-
const client = new client_1.GatewayClient();
|
|
87
|
-
// POST creates, PUT updates. Try create first; on 409 fall back to update.
|
|
88
|
-
let res;
|
|
89
|
-
try {
|
|
90
|
-
res = await client.request(`/api/tasks/${taskId}/schedule`, {
|
|
91
|
-
method: 'POST',
|
|
92
|
-
body,
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
catch (err) {
|
|
96
|
-
if (err instanceof client_1.ApiError && err.status === 409) {
|
|
97
|
-
res = await client.request(`/api/tasks/${taskId}/schedule`, {
|
|
98
|
-
method: 'PUT',
|
|
99
|
-
body,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
throw err;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
(0, output_1.printSuccess)({ schedule: res.schedule }, () => {
|
|
107
|
-
const s = res.schedule;
|
|
108
|
-
process.stdout.write(`Schedule ${s.id}: ${describeSchedule(s)}${s.enabled ? '' : ' (disabled)'}\n`);
|
|
109
|
-
if (s.nextRunAt) {
|
|
110
|
-
process.stdout.write(`Next run: ${s.nextRunAt}\n`);
|
|
111
|
-
}
|
|
112
|
-
}, opts);
|
|
113
|
-
}
|
|
114
|
-
catch (err) {
|
|
115
|
-
process.exit((0, output_1.printError)(err, opts));
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
schedule
|
|
119
|
-
.command('show')
|
|
120
|
-
.description('Show the schedule attached to a task (if any)')
|
|
121
|
-
.argument('<taskId>', 'task id')
|
|
122
|
-
.action(async (taskId) => {
|
|
123
|
-
const opts = globalOpts();
|
|
124
|
-
try {
|
|
125
|
-
const client = new client_1.GatewayClient();
|
|
126
|
-
const res = await client.request(`/api/tasks/${taskId}/schedule`);
|
|
127
|
-
(0, output_1.printSuccess)({ schedule: res.schedule }, () => {
|
|
128
|
-
if (!res.schedule) {
|
|
129
|
-
process.stdout.write('No schedule attached.\n');
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const s = res.schedule;
|
|
133
|
-
process.stdout.write(`${describeSchedule(s)}${s.enabled ? '' : ' (disabled)'}\n`);
|
|
134
|
-
if (s.nextRunAt)
|
|
135
|
-
process.stdout.write(`Next run: ${s.nextRunAt}\n`);
|
|
136
|
-
if (s.lastRunAt) {
|
|
137
|
-
process.stdout.write(`Last run: ${s.lastRunAt}${s.lastRunStatus ? ` (${s.lastRunStatus})` : ''}\n`);
|
|
138
|
-
}
|
|
139
|
-
}, opts);
|
|
140
|
-
}
|
|
141
|
-
catch (err) {
|
|
142
|
-
process.exit((0, output_1.printError)(err, opts));
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
schedule
|
|
146
|
-
.command('remove')
|
|
147
|
-
.description('Remove the schedule attached to a task')
|
|
148
|
-
.argument('<taskId>', 'task id')
|
|
149
|
-
.action(async (taskId) => {
|
|
150
|
-
const opts = globalOpts();
|
|
151
|
-
try {
|
|
152
|
-
const client = new client_1.GatewayClient();
|
|
153
|
-
await client.request(`/api/tasks/${taskId}/schedule`, { method: 'DELETE' });
|
|
154
|
-
(0, output_1.printSuccess)({ ok: true, taskId }, `Removed schedule from task ${taskId}`, opts);
|
|
155
|
-
}
|
|
156
|
-
catch (err) {
|
|
157
|
-
process.exit((0, output_1.printError)(err, opts));
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
schedule
|
|
161
|
-
.command('list')
|
|
162
|
-
.description('List scheduled tasks in the current organization')
|
|
163
|
-
.option('--limit <n>', 'max rows (default 10, max 50)', '10')
|
|
164
|
-
.action(async (cmdOpts) => {
|
|
165
|
-
const opts = globalOpts();
|
|
166
|
-
try {
|
|
167
|
-
const limit = Math.max(1, Math.min(50, parseInt(cmdOpts.limit, 10) || 10));
|
|
168
|
-
const client = new client_1.GatewayClient();
|
|
169
|
-
const res = await client.request('/api/tasks/scheduled', {
|
|
170
|
-
query: { limit },
|
|
171
|
-
});
|
|
172
|
-
(0, output_1.printSuccess)({ total: res.total, schedules: res.schedules }, () => {
|
|
173
|
-
if (res.schedules.length === 0) {
|
|
174
|
-
process.stdout.write('No scheduled tasks.\n');
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
for (const s of res.schedules) {
|
|
178
|
-
const line = `${s.taskId} ${describeSchedule(s.schedule).padEnd(28)} ${s.projectName} / ${s.workflowName} / ${s.taskName}`;
|
|
179
|
-
process.stdout.write(`${line}\n`);
|
|
180
|
-
}
|
|
181
|
-
}, opts);
|
|
182
|
-
}
|
|
183
|
-
catch (err) {
|
|
184
|
-
process.exit((0, output_1.printError)(err, opts));
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
//# sourceMappingURL=schedule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../src/commands/schedule.ts"],"names":[],"mappings":";;AAoHA,4DAmIC;AAtPD,sCAAoD;AACpD,sCAAiE;AAkCjE;;;;GAIG;AACH,SAAS,aAAa,CAAC,GAAW;IAChC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACzC,4CAA4C;IAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxD,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1C,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QACxB,MAAM,IAAI,GAC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