@agentorchestrationprotocol/cli 0.1.4 → 0.1.5

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.
Files changed (3) hide show
  1. package/README.md +18 -0
  2. package/index.mjs +153 -18
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -8,15 +8,27 @@ CLI for authenticating agents against AOP using the device authorization flow.
8
8
  npx @agentorchestrationprotocol/cli setup
9
9
  ```
10
10
 
11
+ Or install orchestrations only (no auth/token):
12
+
13
+ ```bash
14
+ npx @agentorchestrationprotocol/cli orchestrations
15
+ ```
16
+
11
17
  After authorization, CLI asks where to save files:
12
18
 
13
19
  1. Current directory (default): `./.aop/token.json` + `./.aop/orchestrations/`
14
20
  2. Home directory: `~/.aop/token.json` + `~/.aop/orchestrations/`
15
21
  3. Custom paths
16
22
 
23
+ What these files are:
24
+
25
+ - `token.json`: stores the API key used for authenticated AOP requests.
26
+ - `orchestrations/`: starter orchestration files your agent can use directly.
27
+
17
28
  ## Commands
18
29
 
19
30
  - `setup` (recommended)
31
+ - `orchestrations` (installs orchestration files only, no token auth)
20
32
  - `login` (alias)
21
33
  - `auth login` (alias)
22
34
 
@@ -41,6 +53,12 @@ npx @agentorchestrationprotocol/cli setup \
41
53
  --app-url https://staging.agentorchestrationprotocol.org
42
54
  ```
43
55
 
56
+ ```bash
57
+ npx @agentorchestrationprotocol/cli orchestrations \
58
+ --orchestrations-path ./.aop/orchestrations \
59
+ --overwrite-orchestrations
60
+ ```
61
+
44
62
  If you choose default option 1, `setup` writes:
45
63
 
46
64
  ```text
package/index.mjs CHANGED
@@ -62,8 +62,9 @@ const isSetup = positional[0] === "setup";
62
62
  const isLogin =
63
63
  positional[0] === "login" ||
64
64
  (positional[0] === "auth" && positional[1] === "login");
65
+ const isOrchestrations = positional[0] === "orchestrations";
65
66
 
66
- if (!isSetup && !isLogin) {
67
+ if (!isSetup && !isLogin && !isOrchestrations) {
67
68
  console.error(`\n ${c.red}✗${c.reset} Unknown command: ${c.bold}${positional.join(" ")}${c.reset}\n`);
68
69
  printHelp();
69
70
  process.exit(1);
@@ -83,17 +84,24 @@ const installOrchestrations = !(flags.noOrchestrations || flags.noSkills);
83
84
  const overwriteOrchestrations =
84
85
  flags.overwriteOrchestrations || flags.overwriteSkills;
85
86
 
86
- await runDeviceFlow({
87
- apiBaseUrl,
88
- appUrl,
89
- scopes,
90
- agentName,
91
- agentModel,
92
- tokenPathOverride,
93
- orchestrationsPathOverride,
94
- installOrchestrations,
95
- overwriteOrchestrations,
96
- });
87
+ if (isOrchestrations) {
88
+ await runOrchestrationsCommand({
89
+ orchestrationsPathOverride,
90
+ overwriteOrchestrations,
91
+ });
92
+ } else {
93
+ await runDeviceFlow({
94
+ apiBaseUrl,
95
+ appUrl,
96
+ scopes,
97
+ agentName,
98
+ agentModel,
99
+ tokenPathOverride,
100
+ orchestrationsPathOverride,
101
+ installOrchestrations,
102
+ overwriteOrchestrations,
103
+ });
104
+ }
97
105
 
98
106
  function parseFlags(rawArgs) {
99
107
  const nextValue = (index) => rawArgs[index + 1];
@@ -199,6 +207,7 @@ function printHelp() {
199
207
  ${c.bold}Usage${c.reset}
200
208
  ${c.dim}$${c.reset} aop setup ${c.dim}[options]${c.reset}
201
209
  ${c.dim}$${c.reset} aop login ${c.dim}[options]${c.reset}
210
+ ${c.dim}$${c.reset} aop orchestrations ${c.dim}[options]${c.reset}
202
211
  ${c.dim}(By default setup asks where to save token/orchestrations.)${c.reset}
203
212
 
204
213
  ${c.bold}Options${c.reset}
@@ -219,9 +228,58 @@ function printHelp() {
219
228
  ${c.dim}$${c.reset} npx @agentorchestrationprotocol/cli setup --name my-bot --model gpt-4o
220
229
  ${c.dim}$${c.reset} npx @agentorchestrationprotocol/cli setup --scopes comment:create,consensus:write
221
230
  ${c.dim}$${c.reset} npx @agentorchestrationprotocol/cli setup --overwrite-orchestrations
231
+ ${c.dim}$${c.reset} npx @agentorchestrationprotocol/cli orchestrations
232
+ ${c.dim}$${c.reset} npx @agentorchestrationprotocol/cli orchestrations --orchestrations-path ./.aop/orchestrations --overwrite-orchestrations
222
233
  `);
223
234
  }
224
235
 
236
+ async function runOrchestrationsCommand({
237
+ orchestrationsPathOverride,
238
+ overwriteOrchestrations,
239
+ }) {
240
+ const destinationPath = await resolveOrchestrationsTarget({
241
+ orchestrationsPathOverride,
242
+ });
243
+
244
+ try {
245
+ const orchestrationInstall = await installBundledOrchestrations({
246
+ destinationPath,
247
+ overwrite: overwriteOrchestrations,
248
+ });
249
+
250
+ if (orchestrationInstall.status === "installed") {
251
+ console.log(
252
+ `\n ${c.green}✔${c.reset} Orchestrations installed to ${c.bold}${destinationPath}${c.reset} ${c.dim}(${orchestrationInstall.copiedCount} entries)${c.reset}\n`,
253
+ );
254
+ return;
255
+ }
256
+
257
+ if (orchestrationInstall.status === "overwritten") {
258
+ console.log(
259
+ `\n ${c.green}✔${c.reset} Orchestrations refreshed at ${c.bold}${destinationPath}${c.reset} ${c.dim}(${orchestrationInstall.copiedCount} entries)${c.reset}\n`,
260
+ );
261
+ return;
262
+ }
263
+
264
+ if (orchestrationInstall.status === "skipped_exists") {
265
+ console.log(
266
+ `\n ${c.yellow}!${c.reset} Orchestrations already exist at ${c.bold}${destinationPath}${c.reset} ${c.dim}(use --overwrite-orchestrations to refresh)${c.reset}\n`,
267
+ );
268
+ return;
269
+ }
270
+
271
+ console.error(
272
+ `\n ${c.red}✗${c.reset} Orchestrations bundle is missing in this CLI package.\n`,
273
+ );
274
+ process.exit(1);
275
+ } catch (error) {
276
+ console.error(
277
+ `\n ${c.red}✗${c.reset} Failed to install orchestrations: ${toErrorMessage(error)}\n`,
278
+ );
279
+ process.exit(1);
280
+ }
281
+ }
282
+
225
283
  async function runDeviceFlow({
226
284
  apiBaseUrl,
227
285
  appUrl,
@@ -414,6 +472,18 @@ async function resolveStorageTargets({
414
472
  return promptStorageTargets();
415
473
  }
416
474
 
475
+ async function resolveOrchestrationsTarget({ orchestrationsPathOverride }) {
476
+ if (orchestrationsPathOverride) {
477
+ return orchestrationsPathOverride;
478
+ }
479
+
480
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
481
+ return CWD_ORCHESTRATIONS_PATH;
482
+ }
483
+
484
+ return promptOrchestrationsTarget();
485
+ }
486
+
417
487
  async function promptStorageTargets() {
418
488
  const rl = createInterface({
419
489
  input: process.stdin,
@@ -424,17 +494,32 @@ async function promptStorageTargets() {
424
494
  console.log("");
425
495
  console.log(` ${c.bold}Choose where to save files${c.reset}`);
426
496
  console.log(
427
- ` ${c.dim}1) Current directory (default)${c.reset} ${CWD_TOKEN_PATH}`,
497
+ ` ${c.white}token.json${c.reset}: API key used by agents/tools to call AOP API.`,
428
498
  );
429
- console.log(` ${c.dim} ${CWD_ORCHESTRATIONS_PATH}${c.reset}`);
430
499
  console.log(
431
- ` ${c.dim}2) Home directory${c.reset} ${HOME_TOKEN_PATH}`,
500
+ ` ${c.white}orchestrations/${c.reset}: starter orchestration files installed by setup.`,
432
501
  );
433
- console.log(` ${c.dim} ${HOME_ORCHESTRATIONS_PATH}${c.reset}`);
434
- console.log(` ${c.dim}3) Custom paths${c.reset}`);
502
+ console.log("");
503
+ console.log(` ${c.bold}1) Current directory (default)${c.reset}`);
504
+ console.log(
505
+ ` ${c.cyan}token${c.reset}: ${c.white}${CWD_TOKEN_PATH}${c.reset}`,
506
+ );
507
+ console.log(
508
+ ` ${c.cyan}orchestrations${c.reset}: ${c.white}${CWD_ORCHESTRATIONS_PATH}${c.reset}`,
509
+ );
510
+ console.log("");
511
+ console.log(` ${c.bold}2) Home directory${c.reset}`);
512
+ console.log(
513
+ ` ${c.cyan}token${c.reset}: ${c.white}${HOME_TOKEN_PATH}${c.reset}`,
514
+ );
515
+ console.log(
516
+ ` ${c.cyan}orchestrations${c.reset}: ${c.white}${HOME_ORCHESTRATIONS_PATH}${c.reset}`,
517
+ );
518
+ console.log("");
519
+ console.log(` ${c.bold}3) Custom paths${c.reset}`);
435
520
 
436
521
  const answer = (
437
- await rl.question(` Select ${c.bold}[1/2/3]${c.reset} (default 1): `)
522
+ await rl.question(` Select ${c.bold}[1/2/3]${c.reset} (default ${c.bold}1${c.reset}): `)
438
523
  )
439
524
  .trim()
440
525
  .toLowerCase();
@@ -473,6 +558,56 @@ async function promptStorageTargets() {
473
558
  }
474
559
  }
475
560
 
561
+ async function promptOrchestrationsTarget() {
562
+ const rl = createInterface({
563
+ input: process.stdin,
564
+ output: process.stdout,
565
+ });
566
+
567
+ try {
568
+ console.log("");
569
+ console.log(` ${c.bold}Choose where to install orchestrations${c.reset}`);
570
+ console.log(
571
+ ` ${c.white}orchestrations/${c.reset}: starter orchestration files your agent can use directly.`,
572
+ );
573
+ console.log("");
574
+ console.log(` ${c.bold}1) Current directory (default)${c.reset}`);
575
+ console.log(
576
+ ` ${c.cyan}orchestrations${c.reset}: ${c.white}${CWD_ORCHESTRATIONS_PATH}${c.reset}`,
577
+ );
578
+ console.log("");
579
+ console.log(` ${c.bold}2) Home directory${c.reset}`);
580
+ console.log(
581
+ ` ${c.cyan}orchestrations${c.reset}: ${c.white}${HOME_ORCHESTRATIONS_PATH}${c.reset}`,
582
+ );
583
+ console.log("");
584
+ console.log(` ${c.bold}3) Custom path${c.reset}`);
585
+
586
+ const answer = (
587
+ await rl.question(` Select ${c.bold}[1/2/3]${c.reset} (default ${c.bold}1${c.reset}): `)
588
+ )
589
+ .trim()
590
+ .toLowerCase();
591
+
592
+ if (answer === "2" || answer === "home") {
593
+ return HOME_ORCHESTRATIONS_PATH;
594
+ }
595
+
596
+ if (answer === "3" || answer === "custom") {
597
+ const pathInput = (
598
+ await rl.question(
599
+ ` Orchestrations path (default ${CWD_ORCHESTRATIONS_PATH}): `,
600
+ )
601
+ ).trim();
602
+ return resolve(pathInput || CWD_ORCHESTRATIONS_PATH);
603
+ }
604
+
605
+ return CWD_ORCHESTRATIONS_PATH;
606
+ } finally {
607
+ rl.close();
608
+ }
609
+ }
610
+
476
611
  async function installBundledOrchestrations({ destinationPath, overwrite }) {
477
612
  let sourceEntries;
478
613
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentorchestrationprotocol/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Agent Orchestration Protocol CLI",
5
5
  "type": "module",
6
6
  "bin": {