@agent-compose/cli 0.2.1 → 0.3.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 +4 -1
- package/dist/index.js +124 -23
- package/package.json +11 -11
- package/skills/ac:generate-workflow.md +353 -122
- package/skills/ac:invoke.md +31 -9
- package/skills/ac:register-invoke.md +44 -7
- package/skills/ac:register.md +4 -1
- package/skills/ac:schedule.md +132 -0
- package/skills/ac:setup.md +4 -1
- package/skills/ac:snapshots.md +10 -2
- package/skills/ac:tutorial.md +375 -0
- package/skills/ac:demo.md +0 -134
package/README.md
CHANGED
|
@@ -102,11 +102,14 @@ Claude Code session running inside this repo:
|
|
|
102
102
|
| Skill | What it does |
|
|
103
103
|
|---|---|
|
|
104
104
|
| `/ac:setup` | Walks first-time setup against an existing server |
|
|
105
|
-
| `/ac:
|
|
105
|
+
| `/ac:tutorial` | Hands-on tutorial — register, invoke, schedule, emit events, capture snapshots (~10 min) |
|
|
106
106
|
| `/ac:register` | Bundle + register the current workflow |
|
|
107
107
|
| `/ac:invoke` | Dispatch a registered workflow with input |
|
|
108
108
|
| `/ac:register-invoke` | Register-then-invoke combo for fast iteration |
|
|
109
|
+
| `/ac:schedule` | Create / list / delete cron schedules on a registered workflow |
|
|
109
110
|
| `/ac:logs` | Tail logs for a running run |
|
|
111
|
+
| `/ac:events` | Send / list run events |
|
|
112
|
+
| `/ac:snapshots` | List / inspect / delete captured sandbox snapshots |
|
|
110
113
|
| `/ac:secrets` | Manage per-workflow secrets |
|
|
111
114
|
| `/ac:generate-workflow` | Scaffold a new workflow from a plain-English description |
|
|
112
115
|
| `/ac:generate-agent` | Scaffold an agent prompt + iteration logic |
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
|
-
import { readFileSync as
|
|
7
|
-
import { fileURLToPath as
|
|
6
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
7
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
8
8
|
import { program } from "commander";
|
|
9
9
|
|
|
10
10
|
// src/commands/register.ts
|
|
@@ -1159,14 +1159,95 @@ var listCommand2 = new Command13("list").description("List events for a run, or
|
|
|
1159
1159
|
});
|
|
1160
1160
|
var eventsCommand = new Command13("events").description("Send or list run events (Events API)").addCommand(sendCommand).addCommand(listCommand2);
|
|
1161
1161
|
|
|
1162
|
-
// src/
|
|
1162
|
+
// src/commands/schedule.ts
|
|
1163
|
+
import { Command as Command14 } from "commander";
|
|
1164
|
+
var sharedOpts2 = (cmd) => cmd.option("--factory <slug>", `Factory the schedule lives in (default: ${defaultFactory})`, defaultFactory).option("--url <url>", "Server URL", parseUrlFlag, defaultUrl).option("--api-key <key>", "API key", defaultApiKey);
|
|
1165
|
+
var scheduleCommand = new Command14("schedule").description("Manage cron schedules attached to registered workflows");
|
|
1166
|
+
sharedOpts2(scheduleCommand.command("create <name>").description("Create a new schedule for a workflow").requiredOption("--workflow <name>", "The registered workflow this schedule should fire").requiredOption("--cron <expr>", "Cron expression (UTC) — e.g. '0 9 * * *'")).action(async (name, opts) => {
|
|
1167
|
+
const client = makeClient(opts);
|
|
1168
|
+
const created = await client.createSchedule({
|
|
1169
|
+
name,
|
|
1170
|
+
workflow: opts.workflow,
|
|
1171
|
+
cron: opts.cron,
|
|
1172
|
+
factorySlug: opts.factory
|
|
1173
|
+
});
|
|
1174
|
+
console.log(`✓ Schedule "${created.name}" → workflow "${created.workflow}" @ "${created.cron}" (${created.id})`);
|
|
1175
|
+
});
|
|
1176
|
+
sharedOpts2(scheduleCommand.command("list").description("List schedules in a factory")).action(async (opts) => {
|
|
1177
|
+
const client = makeClient(opts);
|
|
1178
|
+
const rows = await client.listSchedules(opts.factory);
|
|
1179
|
+
if (rows.length === 0) {
|
|
1180
|
+
console.log(`No schedules in factory "${opts.factory}"`);
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
console.log(`Schedules in factory "${opts.factory}":`);
|
|
1184
|
+
for (const s of rows) {
|
|
1185
|
+
const next = s.nextFireAt ? new Date(s.nextFireAt).toLocaleString() : "—";
|
|
1186
|
+
console.log(` ${s.name.padEnd(24)} ${s.workflowName.padEnd(20)} ${s.cron.padEnd(16)} next: ${next} ${s.id}`);
|
|
1187
|
+
}
|
|
1188
|
+
});
|
|
1189
|
+
sharedOpts2(scheduleCommand.command("delete <id>").description("Delete a schedule by id")).action(async (id, opts) => {
|
|
1190
|
+
const client = makeClient(opts);
|
|
1191
|
+
await client.deleteSchedule(id, opts.factory);
|
|
1192
|
+
console.log(`✓ Schedule ${id} deleted from factory "${opts.factory}"`);
|
|
1193
|
+
});
|
|
1194
|
+
|
|
1195
|
+
// src/commands/upgrade.ts
|
|
1196
|
+
import { Command as Command15 } from "commander";
|
|
1163
1197
|
import { spawnSync } from "node:child_process";
|
|
1164
|
-
import {
|
|
1198
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
1199
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
1200
|
+
import pc4 from "picocolors";
|
|
1201
|
+
var PACKAGE_NAME = "@agent-compose/cli";
|
|
1202
|
+
var upgradeCommand = new Command15("upgrade").description("Update the agentc CLI to the latest published version").option("--check", "Check for updates without installing", false).action(async (opts) => {
|
|
1203
|
+
const pkg = JSON.parse(readFileSync4(fileURLToPath2(new URL("../../package.json", import.meta.url)), "utf8"));
|
|
1204
|
+
const current = pkg.version;
|
|
1205
|
+
const controller = new AbortController;
|
|
1206
|
+
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
1207
|
+
let latest = null;
|
|
1208
|
+
try {
|
|
1209
|
+
const res = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`, {
|
|
1210
|
+
signal: controller.signal,
|
|
1211
|
+
headers: { Accept: "application/json" }
|
|
1212
|
+
});
|
|
1213
|
+
if (res.ok) {
|
|
1214
|
+
const body = await res.json();
|
|
1215
|
+
if (typeof body.version === "string")
|
|
1216
|
+
latest = body.version;
|
|
1217
|
+
}
|
|
1218
|
+
} catch {} finally {
|
|
1219
|
+
clearTimeout(timeout);
|
|
1220
|
+
}
|
|
1221
|
+
if (!latest) {
|
|
1222
|
+
console.error(`${pc4.red("✗")} Couldn't reach the npm registry. Check your connection and try again.`);
|
|
1223
|
+
process.exit(1);
|
|
1224
|
+
}
|
|
1225
|
+
if (latest === current) {
|
|
1226
|
+
console.log(`${pc4.green("✓")} You're on the latest version (${pc4.bold(current)}).`);
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
console.log(`${pc4.yellow("●")} agentc ${pc4.bold(latest)} is available (you have ${current}).`);
|
|
1230
|
+
if (opts.check) {
|
|
1231
|
+
console.log(` Run ${pc4.cyan("agentc upgrade")} to install, or ${pc4.cyan("npm install -g " + PACKAGE_NAME + "@latest")} manually.`);
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
console.log(` Running ${pc4.cyan("npm install -g " + PACKAGE_NAME + "@latest")} …`);
|
|
1235
|
+
const result = spawnSync("npm", ["install", "-g", `${PACKAGE_NAME}@latest`], { stdio: "inherit" });
|
|
1236
|
+
if (result.status !== 0) {
|
|
1237
|
+
console.error(`${pc4.red("✗")} Install failed. Run the command above manually, or check for permission issues (npm prefix / sudo).`);
|
|
1238
|
+
process.exit(1);
|
|
1239
|
+
}
|
|
1240
|
+
console.log(`${pc4.green("✓")} Installed ${pc4.bold(`agentc ${latest}`)}.`);
|
|
1241
|
+
});
|
|
1242
|
+
|
|
1243
|
+
// src/update-check.ts
|
|
1244
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
1245
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync } from "node:fs";
|
|
1165
1246
|
import { homedir as homedir3 } from "node:os";
|
|
1166
1247
|
import { join as join3 } from "node:path";
|
|
1167
1248
|
import { createInterface } from "node:readline/promises";
|
|
1168
|
-
import
|
|
1169
|
-
var
|
|
1249
|
+
import pc5 from "picocolors";
|
|
1250
|
+
var PACKAGE_NAME2 = "@agent-compose/cli";
|
|
1170
1251
|
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
1171
1252
|
var FETCH_TIMEOUT_MS = 2000;
|
|
1172
1253
|
function cachePath() {
|
|
@@ -1201,7 +1282,7 @@ function isNewer(latest, current) {
|
|
|
1201
1282
|
}
|
|
1202
1283
|
function readCache() {
|
|
1203
1284
|
try {
|
|
1204
|
-
const raw =
|
|
1285
|
+
const raw = readFileSync5(cachePath(), "utf8");
|
|
1205
1286
|
const parsed = JSON.parse(raw);
|
|
1206
1287
|
if (typeof parsed.checkedAt !== "number")
|
|
1207
1288
|
return null;
|
|
@@ -1225,7 +1306,7 @@ async function fetchLatest() {
|
|
|
1225
1306
|
const controller = new AbortController;
|
|
1226
1307
|
const timeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
1227
1308
|
try {
|
|
1228
|
-
const res = await fetch(`https://registry.npmjs.org/${
|
|
1309
|
+
const res = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME2}/latest`, {
|
|
1229
1310
|
signal: controller.signal,
|
|
1230
1311
|
headers: { Accept: "application/json" }
|
|
1231
1312
|
});
|
|
@@ -1263,35 +1344,35 @@ async function checkForUpdate(currentVersion) {
|
|
|
1263
1344
|
const latest = await resolveLatest();
|
|
1264
1345
|
if (!latest || !isNewer(latest, currentVersion))
|
|
1265
1346
|
return;
|
|
1266
|
-
const headline = `${
|
|
1347
|
+
const headline = `${pc5.yellow("●")} agentc ${pc5.bold(latest)} is available (you have ${currentVersion}).`;
|
|
1267
1348
|
process.stderr.write(`${headline}
|
|
1268
1349
|
`);
|
|
1269
1350
|
if (!process.stdin.isTTY) {
|
|
1270
|
-
process.stderr.write(` Run ${
|
|
1351
|
+
process.stderr.write(` Run ${pc5.cyan("npm install -g " + PACKAGE_NAME2 + "@latest")} to update.
|
|
1271
1352
|
`);
|
|
1272
1353
|
return;
|
|
1273
1354
|
}
|
|
1274
|
-
const confirm = await promptYesNo(` Install now? [y/${
|
|
1355
|
+
const confirm = await promptYesNo(` Install now? [y/${pc5.bold("N")}] `);
|
|
1275
1356
|
if (!confirm)
|
|
1276
1357
|
return;
|
|
1277
|
-
process.stderr.write(` Running ${
|
|
1358
|
+
process.stderr.write(` Running ${pc5.cyan("npm install -g " + PACKAGE_NAME2 + "@latest")} …
|
|
1278
1359
|
`);
|
|
1279
|
-
const result =
|
|
1360
|
+
const result = spawnSync2("npm", ["install", "-g", `${PACKAGE_NAME2}@latest`], {
|
|
1280
1361
|
stdio: "inherit"
|
|
1281
1362
|
});
|
|
1282
1363
|
if (result.status !== 0) {
|
|
1283
|
-
process.stderr.write(`${
|
|
1364
|
+
process.stderr.write(`${pc5.red("✗")} Install failed. Run the command above manually.
|
|
1284
1365
|
`);
|
|
1285
1366
|
return;
|
|
1286
1367
|
}
|
|
1287
|
-
process.stderr.write(`${
|
|
1368
|
+
process.stderr.write(`${pc5.green("✓")} Installed ${pc5.bold(`agentc ${latest}`)}. ` + `Re-run your command to use the new version.
|
|
1288
1369
|
`);
|
|
1289
1370
|
process.exit(0);
|
|
1290
1371
|
}
|
|
1291
1372
|
|
|
1292
1373
|
// src/index.ts
|
|
1293
|
-
var pkg = JSON.parse(
|
|
1294
|
-
program.name("agentc").description("
|
|
1374
|
+
var pkg = JSON.parse(readFileSync6(fileURLToPath3(new URL("../package.json", import.meta.url)), "utf8"));
|
|
1375
|
+
program.name("agentc").description("Coordinate agent production lines.").version(pkg.version);
|
|
1295
1376
|
program.hook("preAction", async () => {
|
|
1296
1377
|
try {
|
|
1297
1378
|
await checkForUpdate(pkg.version);
|
|
@@ -1300,14 +1381,34 @@ program.hook("preAction", async () => {
|
|
|
1300
1381
|
program.addCommand(registerCommand);
|
|
1301
1382
|
program.addCommand(invokeCommand);
|
|
1302
1383
|
program.addCommand(listCommand);
|
|
1384
|
+
program.addCommand(cancelCommand);
|
|
1385
|
+
program.addCommand(scheduleCommand);
|
|
1303
1386
|
program.addCommand(logsCommand);
|
|
1304
|
-
program.addCommand(
|
|
1387
|
+
program.addCommand(eventsCommand);
|
|
1388
|
+
program.addCommand(factoryCommand);
|
|
1389
|
+
program.addCommand(snapshotCommand);
|
|
1390
|
+
program.addCommand(secretsCommand);
|
|
1305
1391
|
program.addCommand(keysCommand);
|
|
1306
1392
|
program.addCommand(authCommand);
|
|
1307
|
-
program.addCommand(secretsCommand);
|
|
1308
1393
|
program.addCommand(usageCommand);
|
|
1309
|
-
program.addCommand(
|
|
1310
|
-
program.addCommand(
|
|
1311
|
-
program.
|
|
1312
|
-
|
|
1394
|
+
program.addCommand(initCommand);
|
|
1395
|
+
program.addCommand(upgradeCommand);
|
|
1396
|
+
program.addHelpText("after", `
|
|
1397
|
+
Topics:
|
|
1398
|
+
Workflows register, invoke, list, cancel
|
|
1399
|
+
Scheduling schedule
|
|
1400
|
+
Run inspection logs, events
|
|
1401
|
+
Resources factory, snapshot, secrets
|
|
1402
|
+
Account keys, auth, usage
|
|
1403
|
+
Setup init, upgrade
|
|
1404
|
+
|
|
1405
|
+
Examples:
|
|
1406
|
+
$ agentc register ./workflows/pipeline.ts
|
|
1407
|
+
$ agentc invoke pipeline --follow
|
|
1408
|
+
$ agentc schedule create nightly --workflow pipeline --cron '0 9 * * *'
|
|
1409
|
+
$ agentc logs <run-id>
|
|
1410
|
+
|
|
1411
|
+
Docs:
|
|
1412
|
+
https://github.com/Layr-Labs/agent-compose
|
|
1413
|
+
`);
|
|
1313
1414
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-compose/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Command-line interface for agent-compose — register, invoke, and monitor workflows from your terminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
"node": ">=20"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
|
-
"typecheck":
|
|
39
|
-
"test":
|
|
40
|
-
"build":
|
|
41
|
-
"build:js":
|
|
42
|
-
"build:chmod":
|
|
43
|
-
"clean":
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"test": "bun test src/__tests__",
|
|
40
|
+
"build": "bun run clean && bun run build:js && bun run build:chmod",
|
|
41
|
+
"build:js": "bun build src/index.ts --outdir dist --target node --format esm --packages external --banner='#!/usr/bin/env bun'",
|
|
42
|
+
"build:chmod": "chmod +x dist/index.js",
|
|
43
|
+
"clean": "rm -rf dist",
|
|
44
44
|
"prepublishOnly": "bun run build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@agent-compose/sdk": "^0.
|
|
48
|
-
"commander":
|
|
49
|
-
"picocolors":
|
|
47
|
+
"@agent-compose/sdk": "^0.4.0",
|
|
48
|
+
"commander": "^12.0.0",
|
|
49
|
+
"picocolors": "^1.1.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"bun-types":
|
|
52
|
+
"bun-types": "latest",
|
|
53
53
|
"typescript": "^5.8.0"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|