@agentage/cli 0.41.1 → 0.42.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 CHANGED
@@ -65,14 +65,13 @@ For extensions (see below):
65
65
  | `agentage extension remove <name> [--purge]` | Take it out of the profile and reinstall the rest |
66
66
  | `agentage extension list` | One row per extension: state, version, commands, last run |
67
67
  | `agentage extension doctor` | Load every extension once and refresh the states |
68
+ | `agentage extension check [dir]` | Check that an extension package conforms (the six kit rules) |
68
69
  | `agentage extension build [--push]` | Build the part images of an extension package; push with digests |
69
70
  | `agentage extension up` / `down` | Run an extension package on this machine with Docker, then stop |
70
71
  | `agentage extension token --scope <scope>` | Print a token from the dev issuer `extension up` started |
71
72
  | `agentage <command>` | Run a command an installed extension contributes |
72
73
  | `agentage <id> <command>` | The same for an extension built on the kit; always works |
73
74
 
74
- `agentage extension check` is the old name of `doctor`, kept for 90 days.
75
-
76
75
  Flags, exit codes and token auth are in [`docs/reference.md`](docs/reference.md).
77
76
 
78
77
  ## Extensions
@@ -2,5 +2,14 @@ import { type Command } from 'commander';
2
2
  import type { BuildOptions } from '@agentage/extension/tool';
3
3
  import { type LoadKitTool } from './kit-tool.js';
4
4
  export type ExtensionBuildOptions = Pick<BuildOptions, 'push' | 'dir' | 'registry'>;
5
+ export type ExtensionCheckOptions = {
6
+ dir?: string;
7
+ json?: boolean;
8
+ };
9
+ export declare const runExtensionCheck: ({ dir, json }?: ExtensionCheckOptions, tool?: LoadKitTool) => Promise<void>;
5
10
  export declare const runExtensionBuild: (opts?: ExtensionBuildOptions, tool?: LoadKitTool) => Promise<void>;
6
- export declare const addBuild: (group: Command, build: (opts: ExtensionBuildOptions) => Promise<void>) => void;
11
+ export interface BuildActions {
12
+ check: (opts: ExtensionCheckOptions) => Promise<void>;
13
+ build: (opts: ExtensionBuildOptions) => Promise<void>;
14
+ }
15
+ export declare const addBuild: (group: Command, { check, build }: BuildActions) => void;
@@ -1,5 +1,21 @@
1
1
  import {} from 'commander';
2
+ import { kitVersion } from '../../core/kit-version.js';
2
3
  import { loadKitTool } from './kit-tool.js';
4
+ // The kit's lines, or its report as JSON, on stdout; a package that does not conform exits 1.
5
+ export const runExtensionCheck = async ({ dir = '.', json } = {}, tool = loadKitTool) => {
6
+ const { check, checkLines } = await tool();
7
+ if (typeof check !== 'function')
8
+ throw new Error(`this package uses kit ${kitVersion()}; check needs @agentage/extension ^0.4`);
9
+ const report = await check(dir);
10
+ const lines = checkLines(report);
11
+ const shown = json
12
+ ? [JSON.stringify(report, null, 2)]
13
+ : lines.slice(0, report.conforms ? undefined : -1);
14
+ for (const line of shown)
15
+ console.log(line);
16
+ if (!report.conforms)
17
+ throw new Error(lines.at(-1));
18
+ };
3
19
  // One line per image on stdout (part, tag, digest when pushed), then the record path.
4
20
  export const runExtensionBuild = async (opts = {}, tool = loadKitTool) => {
5
21
  const { build, buildLines } = await tool();
@@ -13,7 +29,13 @@ each image, tagged ghcr.io/agentage/<id>-<part>:<version> with the commit and bu
13
29
  labels. --push pushes them (run docker login first) and writes dist/agentage-extension.json, the
14
30
  build record with every image by digest. Needs docker. Exits 1 when the manifest is invalid or a
15
31
  build or push fails.`;
16
- export const addBuild = (group, build) => {
32
+ export const addBuild = (group, { check, build }) => {
33
+ group
34
+ .command('check')
35
+ .description('Check that an extension package conforms, as every build does first')
36
+ .argument('[dir]', 'the extension package folder (default: the current folder)')
37
+ .option('--json', 'machine-readable report')
38
+ .action((dir, opts) => check({ dir, ...opts }));
17
39
  group
18
40
  .command('build')
19
41
  .description('Build the part images of an extension package; --push pushes them')
@@ -8,6 +8,4 @@ type BeforeLoad = (extensions: DiscoveredExtension[]) => Promise<void>;
8
8
  export declare const loadAndGather: (beforeLoad?: BeforeLoad, tree?: string, tool?: LoadKitTool) => Promise<ExtensionsGather>;
9
9
  export declare const failedError: (rows: ExtensionRow[]) => Error | null;
10
10
  export declare const runExtensionDoctor: (opts?: ExtensionDoctorOptions, tool?: LoadKitTool) => Promise<void>;
11
- export declare const CHECK_DEPRECATED: string;
12
- export declare const deprecatedCheck: (doctor: (opts: ExtensionDoctorOptions) => Promise<void>, writeErr: (text: string) => void) => (opts: ExtensionDoctorOptions) => Promise<void>;
13
11
  export {};
@@ -1,4 +1,3 @@
1
- import chalk from 'chalk';
2
1
  import { driftLines } from '../../core/installer/plan.js';
3
2
  import {} from '../../core/loader/discover.js';
4
3
  import { loadExtensions } from '../../core/loader/load.js';
@@ -34,10 +33,3 @@ export const runExtensionDoctor = async (opts = {}, tool) => {
34
33
  if (failure)
35
34
  throw failure;
36
35
  };
37
- export const CHECK_DEPRECATED = 'agentage extension check is now agentage extension doctor; ' +
38
- 'in 90 days check becomes the conformance check';
39
- // The old name for 90 days: one line on stderr, then doctor, so --json stdout stays the report.
40
- export const deprecatedCheck = (doctor, writeErr) => async (opts) => {
41
- writeErr(`${chalk.yellow(`warning: ${CHECK_DEPRECATED}`)}\n`);
42
- await doctor(opts);
43
- };
@@ -1,6 +1,6 @@
1
1
  import type * as Kit from '@agentage/extension/tool';
2
2
  import { type KitCheck } from '../../core/loader/load.js';
3
- export type KitTool = Pick<typeof Kit, 'build' | 'buildLines' | 'runCommand' | 'checkCli' | 'up' | 'down' | 'token'>;
3
+ export type KitTool = Pick<typeof Kit, 'check' | 'checkLines' | 'build' | 'buildLines' | 'runCommand' | 'checkCli' | 'up' | 'down' | 'token'>;
4
4
  export type LoadKitTool = () => Promise<KitTool>;
5
5
  export declare const loadKitTool: LoadKitTool;
6
6
  export declare const kitCheck: (tool?: LoadKitTool) => KitCheck;
@@ -1,5 +1,5 @@
1
1
  import { type Command } from 'commander';
2
- import { type ExtensionBuildOptions } from './build.js';
2
+ import { type BuildActions } from './build.js';
3
3
  import { type ExtensionDoctorOptions } from './doctor.js';
4
4
  import { type ExtensionInstallOptions } from './install.js';
5
5
  import { type ExtensionRemoveOptions } from './remove.js';
@@ -11,12 +11,10 @@ export interface ExtensionListOptions {
11
11
  export declare const printReport: ({ status, warnings }: ExtensionsGather, json?: boolean) => void;
12
12
  export declare const runExtensionList: (opts?: ExtensionListOptions) => Promise<void>;
13
13
  export declare const helpOrUnknown: (_opts: unknown, group: Command) => void;
14
- export interface ExtensionActions extends KitActions {
14
+ export interface ExtensionActions extends KitActions, BuildActions {
15
15
  install: (opts: ExtensionInstallOptions) => Promise<void>;
16
16
  remove: (opts: ExtensionRemoveOptions) => Promise<void>;
17
17
  list: (opts: ExtensionListOptions) => Promise<void>;
18
18
  doctor: (opts: ExtensionDoctorOptions) => Promise<void>;
19
- check: (opts: ExtensionDoctorOptions) => Promise<void>;
20
- build: (opts: ExtensionBuildOptions) => Promise<void>;
21
19
  }
22
20
  export declare const registerExtension: (program: Command, actions: ExtensionActions) => void;
@@ -58,7 +58,7 @@ while loading goes to stderr, state/<id>.json is rewritten for each, and the row
58
58
  failed with the reason (a dependent of a failed extension is blocked). An extension built on the
59
59
  extension kit is ok when its command entry exports create and its handlers are the commands it
60
60
  declares. Exits 1 when any extension failed, or on integrity drift between the lock and the
61
- installed tree. extension check is its old name, kept for 90 days.`;
61
+ installed tree.`;
62
62
  // Bare `extension` prints its help (exit 0); an unknown subcommand stays a usage error (exit 2).
63
63
  export const helpOrUnknown = (_opts, group) => {
64
64
  const name = group.args[0];
@@ -83,7 +83,7 @@ const addChanges = (group, { install, remove }) => {
83
83
  .addHelpText('after', REMOVE_HELP)
84
84
  .action((name, opts) => remove({ name, ...opts }));
85
85
  };
86
- const addReports = (group, { list, doctor, check }) => {
86
+ const addReports = (group, { list, doctor }) => {
87
87
  group
88
88
  .command('list')
89
89
  .description('Show one row per extension: state, versions, commands, last run')
@@ -96,13 +96,8 @@ const addReports = (group, { list, doctor, check }) => {
96
96
  .option('--json', 'machine-readable output')
97
97
  .addHelpText('after', DOCTOR_HELP)
98
98
  .action(doctor);
99
- group
100
- .command('check', { hidden: true })
101
- .description('Deprecated: the old name of doctor')
102
- .option('--json', 'machine-readable output')
103
- .action(check);
104
99
  };
105
- // Help lists the subcommands in this order: install, remove, list, doctor, build, up, down, token.
100
+ // Help lists the subcommands in this order: install, remove, list, doctor, check, build, up, down, token.
106
101
  export const registerExtension = (program, actions) => {
107
102
  const group = program
108
103
  .command('extension')
@@ -111,6 +106,6 @@ export const registerExtension = (program, actions) => {
111
106
  .action(helpOrUnknown);
112
107
  addChanges(group, actions);
113
108
  addReports(group, actions);
114
- addBuild(group, actions.build);
109
+ addBuild(group, actions);
115
110
  addKitTools(group, actions);
116
111
  };
@@ -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/dist/program.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
  import { type SetupOptions } from './commands/auth/setup.js';
3
- import { type ExtensionBuildOptions } from './commands/extension/build.js';
3
+ import { type ExtensionBuildOptions, type ExtensionCheckOptions } from './commands/extension/build.js';
4
4
  import { type ExtensionDoctorOptions } from './commands/extension/doctor.js';
5
5
  import { type ExtensionInstallOptions } from './commands/extension/install.js';
6
6
  import { type ExtensionListOptions } from './commands/extension/list.js';
@@ -17,6 +17,7 @@ export interface ProgramDeps {
17
17
  extensionRemove: (opts: ExtensionRemoveOptions) => Promise<void>;
18
18
  extensionList: (opts: ExtensionListOptions) => Promise<void>;
19
19
  extensionDoctor: (opts: ExtensionDoctorOptions) => Promise<void>;
20
+ extensionCheck: (opts: ExtensionCheckOptions) => Promise<void>;
20
21
  extensionBuild: (opts: ExtensionBuildOptions) => Promise<void>;
21
22
  extensionUp: (opts: ExtensionUpOptions) => Promise<void>;
22
23
  extensionDown: (opts: ExtensionDownOptions) => Promise<void>;
package/dist/program.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import chalk from 'chalk';
2
2
  import { Command, CommanderError } from 'commander';
3
3
  import { registerSetup } from './commands/auth/setup.js';
4
- import { runExtensionBuild } from './commands/extension/build.js';
4
+ import { runExtensionBuild, runExtensionCheck, } from './commands/extension/build.js';
5
5
  import { registerDelegates } from './commands/extension/delegate.js';
6
- import { deprecatedCheck, runExtensionDoctor, } from './commands/extension/doctor.js';
6
+ import { runExtensionDoctor } from './commands/extension/doctor.js';
7
7
  import { runExtensionInstall } from './commands/extension/install.js';
8
8
  import { registerExtension, runExtensionList, } from './commands/extension/list.js';
9
9
  import { runExtensionRemove, terminalIo, } from './commands/extension/remove.js';
@@ -33,6 +33,7 @@ const defaultDeps = {
33
33
  extensionRemove: (opts) => runExtensionRemove(opts, { ...editDeps, io: terminalIo() }),
34
34
  extensionList: (opts) => runExtensionList(opts),
35
35
  extensionDoctor: (opts) => runExtensionDoctor(opts),
36
+ extensionCheck: (opts) => runExtensionCheck(opts),
36
37
  extensionBuild: (opts) => runExtensionBuild(opts),
37
38
  extensionUp: (opts) => runExtensionUp(opts),
38
39
  extensionDown: (opts) => runExtensionDown(opts),
@@ -76,7 +77,7 @@ const addExtensions = (program, deps, argv) => {
76
77
  remove: withAction(deps, deps.extensionRemove),
77
78
  list: withAction(deps, deps.extensionList),
78
79
  doctor: withAction(deps, deps.extensionDoctor),
79
- check: withAction(deps, deprecatedCheck(deps.extensionDoctor, deps.writeErr)),
80
+ check: withAction(deps, deps.extensionCheck),
80
81
  build: withAction(deps, deps.extensionBuild),
81
82
  up: withAction(deps, deps.extensionUp),
82
83
  down: withAction(deps, deps.extensionDown),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentage/cli",
3
- "version": "0.41.1",
3
+ "version": "0.42.0",
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.1",
58
+ "@agentage/extension": "^0.2.1 || ^0.3.0 || ^0.4.0",
59
59
  "chalk": "^6.0.0",
60
60
  "commander": "^15.0.0",
61
61
  "open": "^11.0.0"