@agentage/cli 0.41.0 → 0.41.2

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.
@@ -1,10 +1,6 @@
1
1
  import { type Command } from 'commander';
2
- import { type BuildOptions, type BuildResult } from '@agentage/extension/tool';
2
+ import type { BuildOptions } from '@agentage/extension/tool';
3
+ import { type LoadKitTool } from './kit-tool.js';
3
4
  export type ExtensionBuildOptions = Pick<BuildOptions, 'push' | 'dir' | 'registry'>;
4
- export interface BuildTool {
5
- build: (options: BuildOptions) => Promise<BuildResult>;
6
- buildLines: (result: BuildResult) => string[];
7
- }
8
- export declare const loadBuildTool: () => Promise<BuildTool>;
9
- export declare const runExtensionBuild: (opts?: ExtensionBuildOptions, tool?: () => Promise<BuildTool>) => Promise<void>;
5
+ export declare const runExtensionBuild: (opts?: ExtensionBuildOptions, tool?: LoadKitTool) => Promise<void>;
10
6
  export declare const addBuild: (group: Command, build: (opts: ExtensionBuildOptions) => Promise<void>) => void;
@@ -1,9 +1,7 @@
1
1
  import {} from 'commander';
2
- import {} from '@agentage/extension/tool';
3
- // Imported on use, so every other command starts without loading the kit.
4
- export const loadBuildTool = () => import('@agentage/extension/tool');
2
+ import { loadKitTool } from './kit-tool.js';
5
3
  // One line per image on stdout (part, tag, digest when pushed), then the record path.
6
- export const runExtensionBuild = async (opts = {}, tool = loadBuildTool) => {
4
+ export const runExtensionBuild = async (opts = {}, tool = loadKitTool) => {
7
5
  const { build, buildLines } = await tool();
8
6
  for (const line of buildLines(await build(opts)))
9
7
  console.log(line);
@@ -5,12 +5,11 @@ import { loadOrder } from '../../core/loader/order.js';
5
5
  import { loadSet, scan } from '../../core/loader/scan.js';
6
6
  import { claimVerbs, commandNames, readHeld } from '../../core/loader/verbs.js';
7
7
  import { NO_MACHINE, readMachine } from '../../core/profile/machine.js';
8
- import { registerKit } from './kit-commands.js';
8
+ import { registerKit, stub } from './kit-commands.js';
9
9
  import { kitCheck, loadKitTool } from './kit-tool.js';
10
10
  // Loads the command's extension and its peers only, then hands it the whole command line.
11
11
  const runDelegated = async (ext, name, extensions, program, argv) => {
12
- const order = loadOrder([ext], extensions);
13
- const session = await loadExtensions(order, program, kitCheck());
12
+ const session = await loadExtensions(loadOrder([ext], extensions), program, kitCheck());
14
13
  try {
15
14
  const loaded = session.loaded.get(ext.id ?? '');
16
15
  const run = session.outcomes.get(ext.pkg);
@@ -33,14 +32,7 @@ const unknownCommand = (program, core, extensions, verbs) => (operands) => {
33
32
  };
34
33
  const registerApi = (program, ext, run) => {
35
34
  for (const name of ext.commands)
36
- program
37
- .command(name)
38
- .description(`from the ${ext.id} extension`)
39
- .helpGroup(`${ext.id}:`)
40
- .helpOption(false)
41
- .allowUnknownOption()
42
- .allowExcessArguments()
43
- .action(run(name));
35
+ stub(program, name, `from the ${ext.id} extension`, run(name)).helpGroup(`${ext.id}:`);
44
36
  };
45
37
  // Manifests only, never code: each stub hands the command line, --help included, to the extension.
46
38
  export const registerDelegates = (program, argv, wrap, tool = loadKitTool) => {
@@ -7,8 +7,7 @@ import { loadMachine } from '../../core/profile/machine.js';
7
7
  import { kitCheck } from './kit-tool.js';
8
8
  import { printReport } from './list.js';
9
9
  import { gatherFrom, invalidProfileError, } from './rows.js';
10
- // Loads what can load, once: state files rewritten, rows carrying this run's ok and failed.
11
- // `tree` loads that tree instead of the current one; kit-shaped ones are checked by the kit.
10
+ // Loads what can load once (`tree`: that tree, not the current one); the kit checks kit-shaped ones.
12
11
  export const loadAndGather = async (beforeLoad = async () => undefined, tree, tool) => {
13
12
  const found = scan(await loadMachine(), tree);
14
13
  const extensions = loadSet(found);
@@ -9,5 +9,6 @@ export interface KitRegistration {
9
9
  wrap: (fn: () => Promise<void>) => Run;
10
10
  tool: LoadKitTool;
11
11
  }
12
+ export declare const stub: (parent: Command, name: string, summary: string, run: Run) => Command;
12
13
  export declare const registerKit: (program: Command, ext: DiscoveredExtension, verbs: Verbs, { argv, wrap, tool }: KitRegistration) => void;
13
14
  export {};
@@ -13,8 +13,8 @@ const runKit = async (tool, dir, command, argv) => {
13
13
  if (code !== 0)
14
14
  throw new CommanderError(code, KIT_EXIT, `${command} exited ${code}`);
15
15
  };
16
- // A stub per command: help from the manifest, everything after its own words to the kit.
17
- const stub = (parent, name, summary, run) => parent
16
+ // A stub per command: help from the manifest, the rest of the line to the extension's own code.
17
+ export const stub = (parent, name, summary, run) => parent
18
18
  .command(name)
19
19
  .description(summary)
20
20
  .helpOption(false)
@@ -1,31 +1,6 @@
1
+ import type * as Kit from '@agentage/extension/tool';
1
2
  import { type KitCheck } from '../../core/loader/load.js';
2
- export interface KitRun {
3
- dir: string;
4
- command: string;
5
- argv: string[];
6
- stdout?: (text: string) => void;
7
- stderr?: (text: string) => void;
8
- }
9
- export interface KitUp {
10
- dir?: string;
11
- onLine?: (line: string) => void;
12
- }
13
- export interface KitDown extends KitUp {
14
- keepData?: boolean;
15
- }
16
- export interface KitTool {
17
- runCommand: (options: KitRun) => Promise<number>;
18
- checkCli: (dir: string) => Promise<string | null>;
19
- up: (options: KitUp) => Promise<{
20
- parts: number;
21
- seconds: number;
22
- }>;
23
- down: (options: KitDown) => Promise<unknown>;
24
- token: (options: {
25
- scope: string;
26
- issuer?: string;
27
- }) => Promise<string>;
28
- }
3
+ export type KitTool = Pick<typeof Kit, 'build' | 'buildLines' | 'runCommand' | 'checkCli' | 'up' | 'down' | 'token'>;
29
4
  export type LoadKitTool = () => Promise<KitTool>;
30
5
  export declare const loadKitTool: LoadKitTool;
31
6
  export declare const kitCheck: (tool?: LoadKitTool) => KitCheck;
@@ -31,15 +31,19 @@ export const issuerUrl = (value) => {
31
31
  const UP_HELP = `
32
32
  Runs the extension package in --dir (default: the current folder) on this machine with Docker
33
33
  only, the way a deployment runs it: the part images built with the release recipe, the store
34
- with its migrations and seeds, a dev token issuer and a local gateway. Prints one line per step
35
- as the kit reports it, the last one once every part is healthy. Needs docker. Exits 1 when a
36
- step fails, with the kit's message.`;
34
+ with its migrations and seeds, a dev token issuer and a local gateway. Each working copy is its
35
+ own compose project; up refuses while another one holds localhost:4280 or 4281 and names it, and
36
+ on a kept store says what was already applied. Prints one line per step as the kit reports it,
37
+ the last one once every part is healthy. Needs docker; every docker call has a timeout. Exits 1
38
+ when a step fails, with the kit's message.`;
37
39
  const DOWN_HELP = `
38
- Removes what agentage extension up started for the package in --dir: its containers, network
39
- and the store's volume; --keep-data keeps the volume. Exits 1 when that fails.`;
40
+ Removes what agentage extension up started for the package in --dir, and nothing else: its
41
+ containers, network and the store's volume; --keep-data keeps the volume. The line it prints
42
+ names the compose project it removed. Exits 1 when that fails.`;
40
43
  const TOKEN_HELP = `
41
44
  Prints a token from the dev issuer agentage extension up started, alone on stdout, for calling
42
- /api/v1/ and /mcp by hand or from tests. Only up trusts it. Exits 1 when the issuer refuses.`;
45
+ /api/v1/ and /mcp by hand or from tests. Only up trusts it. Exits 1 when the issuer refuses or
46
+ does not answer within 5 s.`;
43
47
  const DIR = '--dir <path>';
44
48
  const DIR_TEXT = 'the extension package folder (default: the current folder)';
45
49
  const addUp = (group, up) => {
@@ -24,7 +24,7 @@ export const updateHint = () => {
24
24
  if (!c?.latest)
25
25
  return null;
26
26
  return compareVersions(VERSION, c.latest) < 0
27
- ? `update available: ${c.latest} -> ${INSTALL_HINT}`
27
+ ? `update available: ${VERSION} -> ${c.latest} - ${INSTALL_HINT}`
28
28
  : null;
29
29
  };
30
30
  // Shares fetchJsonUnref (node:https, unref'd timer) so an offline background check never stalls
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentage/cli",
3
- "version": "0.41.0",
3
+ "version": "0.41.2",
4
4
  "description": "The agentage CLI - connect this machine to agentage from the terminal",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -55,7 +55,7 @@
55
55
  "prepublishOnly": "npm run verify"
56
56
  },
57
57
  "dependencies": {
58
- "@agentage/extension": "^0.2.0",
58
+ "@agentage/extension": "^0.2.1 || ^0.3.0",
59
59
  "chalk": "^6.0.0",
60
60
  "commander": "^15.0.0",
61
61
  "open": "^11.0.0"