@zenera/cli 1.2.9 → 1.3.1

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 (107) hide show
  1. package/README.md +11 -3
  2. package/dist/command.d.ts +19 -0
  3. package/dist/command.js +5 -9
  4. package/dist/commands/index.d.ts +1 -1
  5. package/dist/commands/index.js +13 -3
  6. package/dist/commands/open.js +6 -1
  7. package/dist/commands/version.d.ts +11 -0
  8. package/dist/commands/version.js +129 -19
  9. package/dist/{completion.d.ts → complete.d.ts} +1 -1
  10. package/dist/{completion.js → complete.js} +14 -4
  11. package/dist/{meta/editor.js → editor.js} +7 -1
  12. package/dist/lib.d.ts +18 -1
  13. package/dist/lib.js +34 -0
  14. package/dist/main.js +1 -1
  15. package/dist/scaffold.js +7 -1
  16. package/package.json +6 -7
  17. package/templates/editor/.github/skills/zen-cli/references/meta.md +3 -0
  18. package/templates/editor/.github/skills/zen-cli/references/projects.md +7 -2
  19. package/dist/commands/meta.d.ts +0 -6
  20. package/dist/commands/meta.js +0 -1088
  21. package/dist/meta/finetune/analyze-brief.d.ts +0 -26
  22. package/dist/meta/finetune/analyze-brief.js +0 -131
  23. package/dist/meta/finetune/apply-brief.d.ts +0 -23
  24. package/dist/meta/finetune/apply-brief.js +0 -247
  25. package/dist/meta/finetune/brief.d.ts +0 -45
  26. package/dist/meta/finetune/brief.js +0 -158
  27. package/dist/meta/finetune/children.d.ts +0 -8
  28. package/dist/meta/finetune/children.js +0 -76
  29. package/dist/meta/finetune/command.d.ts +0 -30
  30. package/dist/meta/finetune/command.js +0 -516
  31. package/dist/meta/finetune/cost.d.ts +0 -46
  32. package/dist/meta/finetune/cost.js +0 -105
  33. package/dist/meta/finetune/dataset/anchors.d.ts +0 -41
  34. package/dist/meta/finetune/dataset/anchors.js +0 -239
  35. package/dist/meta/finetune/dataset/changes.d.ts +0 -36
  36. package/dist/meta/finetune/dataset/changes.js +0 -319
  37. package/dist/meta/finetune/dataset/command.d.ts +0 -17
  38. package/dist/meta/finetune/dataset/command.js +0 -1011
  39. package/dist/meta/finetune/dataset/drift.d.ts +0 -33
  40. package/dist/meta/finetune/dataset/drift.js +0 -71
  41. package/dist/meta/finetune/dataset/export.d.ts +0 -26
  42. package/dist/meta/finetune/dataset/export.js +0 -51
  43. package/dist/meta/finetune/dataset/index.d.ts +0 -2
  44. package/dist/meta/finetune/dataset/index.js +0 -2
  45. package/dist/meta/finetune/dataset/sample.d.ts +0 -50
  46. package/dist/meta/finetune/dataset/sample.js +0 -197
  47. package/dist/meta/finetune/dataset/schema.d.ts +0 -33
  48. package/dist/meta/finetune/dataset/schema.js +0 -216
  49. package/dist/meta/finetune/dataset/store.d.ts +0 -35
  50. package/dist/meta/finetune/dataset/store.js +0 -177
  51. package/dist/meta/finetune/dataset/types.d.ts +0 -127
  52. package/dist/meta/finetune/dataset/types.js +0 -39
  53. package/dist/meta/finetune/failure.d.ts +0 -15
  54. package/dist/meta/finetune/failure.js +0 -26
  55. package/dist/meta/finetune/feedback.d.ts +0 -57
  56. package/dist/meta/finetune/feedback.js +0 -104
  57. package/dist/meta/finetune/improvements.d.ts +0 -98
  58. package/dist/meta/finetune/improvements.js +0 -501
  59. package/dist/meta/finetune/index.d.ts +0 -2
  60. package/dist/meta/finetune/index.js +0 -2
  61. package/dist/meta/finetune/journal.d.ts +0 -35
  62. package/dist/meta/finetune/journal.js +0 -135
  63. package/dist/meta/finetune/live.d.ts +0 -84
  64. package/dist/meta/finetune/live.js +0 -272
  65. package/dist/meta/finetune/loop.d.ts +0 -3
  66. package/dist/meta/finetune/loop.js +0 -163
  67. package/dist/meta/finetune/memories.d.ts +0 -47
  68. package/dist/meta/finetune/memories.js +0 -171
  69. package/dist/meta/finetune/recheck.d.ts +0 -58
  70. package/dist/meta/finetune/recheck.js +0 -311
  71. package/dist/meta/finetune/report.d.ts +0 -40
  72. package/dist/meta/finetune/report.js +0 -1397
  73. package/dist/meta/finetune/retry.d.ts +0 -24
  74. package/dist/meta/finetune/retry.js +0 -96
  75. package/dist/meta/finetune/sampler.d.ts +0 -18
  76. package/dist/meta/finetune/sampler.js +0 -47
  77. package/dist/meta/finetune/system.d.ts +0 -27
  78. package/dist/meta/finetune/system.js +0 -132
  79. package/dist/meta/finetune/train.d.ts +0 -43
  80. package/dist/meta/finetune/train.js +0 -425
  81. package/dist/meta/finetune/tui.d.ts +0 -16
  82. package/dist/meta/finetune/tui.js +0 -316
  83. package/dist/meta/finetune/tuning.d.ts +0 -193
  84. package/dist/meta/finetune/tuning.js +0 -308
  85. package/dist/meta/finetune/usage.d.ts +0 -66
  86. package/dist/meta/finetune/usage.js +0 -260
  87. package/dist/meta/finetune/view.d.ts +0 -9
  88. package/dist/meta/finetune/view.js +0 -27
  89. package/dist/meta/host.d.ts +0 -16
  90. package/dist/meta/host.js +0 -22
  91. package/dist/meta/index.d.ts +0 -11
  92. package/dist/meta/index.js +0 -11
  93. package/dist/meta/launch.d.ts +0 -81
  94. package/dist/meta/launch.js +0 -288
  95. package/dist/meta/model.d.ts +0 -61
  96. package/dist/meta/model.js +0 -146
  97. package/dist/meta/prompts.d.ts +0 -23
  98. package/dist/meta/prompts.js +0 -84
  99. package/dist/meta/relay.d.ts +0 -20
  100. package/dist/meta/relay.js +0 -123
  101. package/dist/meta/tokens.d.ts +0 -52
  102. package/dist/meta/tokens.js +0 -226
  103. package/dist/meta/window.d.ts +0 -61
  104. package/dist/meta/window.js +0 -198
  105. package/dist/meta/wire.d.ts +0 -51
  106. package/dist/meta/wire.js +0 -159
  107. /package/dist/{meta/editor.d.ts → editor.d.ts} +0 -0
package/README.md CHANGED
@@ -82,9 +82,10 @@ token usage are available to inspect.
82
82
  Requires **Node.js 24 or newer**.
83
83
 
84
84
  ```sh
85
- npm install --global @zenera/cli
85
+ npm install --global @zenera/cli @zenera/meta
86
86
  ```
87
87
 
88
+ `@zenera/meta` adds `zen meta`, the meta-agent the quickstart below relies on.
88
89
  The CLI is available as `zen`, `zn`, and `zenera`. To try it without a global
89
90
  install:
90
91
 
@@ -233,17 +234,23 @@ for secure callers, storage, and common options.
233
234
 
234
235
  The CLI can expose commands supplied by sibling Zenera packages:
235
236
 
237
+ - **`@zenera/meta`** adds `zen meta`: the meta-agent, its dataset and the
238
+ fine-tuning loop, driven through GitHub Copilot on your own keys.
236
239
  - **`@zenera/rag`** adds `zen rag` for indexing and searching documents and API
237
240
  schemas.
238
241
  - **`@zenera/gym`** adds `zen gym` for building and serving mock APIs from
239
242
  OpenAPI or Swagger specifications.
240
243
 
241
- Install either package separately to use its command:
244
+ Install each package separately to use its command:
242
245
 
243
246
  ```sh
244
- npm install --global @zenera/rag @zenera/gym
247
+ npm install --global @zenera/meta @zenera/rag @zenera/gym
245
248
  ```
246
249
 
250
+ `zen version` lists every `@zenera/*` package this `zen` resolves, flags one
251
+ out of step with the CLI, and names the programs they run on (Node, Podman,
252
+ Copilot).
253
+
247
254
  ## The rest of the family
248
255
 
249
256
  `@zenera/cli` is the command-line front end for ZeneraNeo. The other packages
@@ -253,6 +260,7 @@ provide the runtime and optional capabilities that work alongside it:
253
260
  | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
254
261
  | [`@zenera/cli`](https://github.com/zenera-ai/ZeneraNeo/blob/main/packages/cli/README.md) | `zen` — agent projects on the command line |
255
262
  | [`@zenera/neo`](https://github.com/zenera-ai/ZeneraNeo/blob/main/packages/neo/README.md) | The runtime — agents, models, tools, skills, and memory |
263
+ | [`@zenera/meta`](https://github.com/zenera-ai/ZeneraNeo/blob/main/packages/meta/README.md) | `zen meta` — the meta-agent that builds and tunes a project |
256
264
  | [`@zenera/gym`](https://github.com/zenera-ai/ZeneraNeo/blob/main/packages/gym/README.md) | `zen gym` — mock APIs from OpenAPI or Swagger documents |
257
265
  | [`@zenera/rag`](https://github.com/zenera-ai/ZeneraNeo/blob/main/packages/rag/README.md) | `zen rag` — indexing and search for documents and API schemas |
258
266
  | [`@zenera/view`](https://github.com/zenera-ai/ZeneraNeo/blob/main/packages/view/README.md) | `zen view` — a live local viewer for a folder |
package/dist/command.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { BannerText } from './banner.ts';
2
+ import type { Candidate } from './candidates.ts';
2
3
  export interface Context {
3
4
  readonly args: readonly string[];
4
5
  readonly json: boolean;
@@ -23,6 +24,24 @@ export interface Command {
23
24
  * frame cannot see. Without it the frame prints this command's own page.
24
25
  */
25
26
  help?(ctx: Context): Promise<void> | void;
27
+ /**
28
+ * Tab completion past the command's name, for a command whose words the
29
+ * usage line cannot describe. `args` is what came after the name, without
30
+ * `cur`, the word being completed.
31
+ */
32
+ complete?(args: readonly string[], cur: string, cwd: string): Promise<Candidate[]>;
33
+ /**
34
+ * The programs outside Node this command runs on, for `zen version`. A
35
+ * command in another package names its own, since only it knows them.
36
+ */
37
+ subsystems?(): Promise<Subsystem[]>;
26
38
  run(ctx: Context): Promise<void>;
27
39
  }
40
+ export interface Subsystem {
41
+ readonly name: string;
42
+ /** absent when it is not there */
43
+ readonly version?: string;
44
+ /** where it was found, or what to do about it */
45
+ readonly detail?: string;
46
+ }
28
47
  //# sourceMappingURL=command.d.ts.map
package/dist/command.js CHANGED
@@ -1,12 +1,8 @@
1
- // ---------------------------------------------------------------------------
2
- // The command contract
1
+ // packages/cli/src/command.ts
3
2
  //
4
- // A command receives its own arguments, already stripped of the name, and the
5
- // two things the frame settled before dispatching: whether output should be
6
- // machine-readable, and which directory the whole invocation is relative to.
7
- //
8
- // It returns nothing. Success is the absence of a throw; every failure worth
9
- // distinguishing is a `CliError` carrying its exit code.
10
- // ---------------------------------------------------------------------------
3
+ // The `Command` contract every `zen` subcommand implements, built-in or loaded from a sibling package.
4
+ // Main: `Command` (summary, usage, help, run, and the optional `complete` and `subsystems` hooks), `Context`, `Subsystem`.
5
+ // Used by: every file in `src/commands/`, `main.ts` (dispatch), `complete.ts`, and through `lib.ts` by
6
+ // `@zenera/meta`, `@zenera/gym` and `@zenera/rag`, which export a `Command` as `<package>/command`.
11
7
  export {};
12
8
  //# sourceMappingURL=command.js.map
@@ -1,7 +1,7 @@
1
1
  import type { BannerText } from '../banner.ts';
2
2
  import type { Command } from '../command.ts';
3
3
  /**
4
- * Insertion order is the order help prints in, and it is deliberate: the four
4
+ * Insertion order is the order help prints in, and it is deliberate: the ones
5
5
  * a new user needs first, then the credentials-and-models pair, then the two
6
6
  * reports on a project, then the pair that moves a project between machines,
7
7
  * then the ones that are only ever run on purpose.
@@ -1,3 +1,8 @@
1
+ // packages/cli/src/commands/index.ts
2
+ //
3
+ // The table of `zen`'s commands: the built-in ones, their hidden aliases, and the ones that live in sibling packages.
4
+ // Main: `COMMANDS`, `ALIASES`, and `EXTERNAL` (meta, gym, rag: package, usage, install line, banner).
5
+ // Used by: `main.ts` (dispatch and help), `complete.ts`, `commands/version.ts` (which packages to report).
1
6
  import { cache } from "./cache.js";
2
7
  import { check } from "./check.js";
3
8
  import { completion } from "./completion.js";
@@ -8,7 +13,6 @@ import { inspect } from "./inspect.js";
8
13
  import { key } from "./key.js";
9
14
  import { list } from "./list.js";
10
15
  import { memory } from "./memory.js";
11
- import { meta } from "./meta.js";
12
16
  import { models } from "./models.js";
13
17
  import { open } from "./open.js";
14
18
  import { run } from "./run.js";
@@ -17,7 +21,7 @@ import { server } from "./server.js";
17
21
  import { version } from "./version.js";
18
22
  import { view } from "./view.js";
19
23
  /**
20
- * Insertion order is the order help prints in, and it is deliberate: the four
24
+ * Insertion order is the order help prints in, and it is deliberate: the ones
21
25
  * a new user needs first, then the credentials-and-models pair, then the two
22
26
  * reports on a project, then the pair that moves a project between machines,
23
27
  * then the ones that are only ever run on purpose.
@@ -29,7 +33,6 @@ export const COMMANDS = {
29
33
  init,
30
34
  list,
31
35
  run,
32
- meta,
33
36
  open,
34
37
  key,
35
38
  models,
@@ -64,6 +67,13 @@ export const ALIASES = {
64
67
  share: 'export',
65
68
  };
66
69
  export const EXTERNAL = {
70
+ meta: {
71
+ package: '@zenera/meta',
72
+ summary: 'Run the meta agent over this project, on your own keys.',
73
+ usage: 'zen meta <run|prompts|resume|model|dataset|finetune> [project] [args...]',
74
+ install: 'npm i -g @zenera/meta',
75
+ banner: { head: 'Zenera', accent: 'Meta', subtitle: 'Meta Agent', hue: 'cyan' },
76
+ },
67
77
  gym: {
68
78
  package: '@zenera/gym',
69
79
  summary: 'Simulated API environments for agent training and evaluation.',
@@ -1,9 +1,14 @@
1
+ // packages/cli/src/commands/open.ts
2
+ //
3
+ // `zen open [project]`: refreshes a project's editor files, then opens it in VS Code or `$EDITOR`.
4
+ // Main: `open: Command`. It calls `editorFiles()` from `editor.ts` before opening.
5
+ // Used by: `commands/index.ts`, which registers it as `zen open` (aliases `edit`, `code`).
1
6
  import { spawn } from 'node:child_process';
2
7
  import { accessSync, constants, existsSync, readFileSync } from 'node:fs';
3
8
  import { homedir } from 'node:os';
4
9
  import { delimiter, join, resolve, sep } from 'node:path';
5
10
  import { one, parse } from "../args.js";
6
- import { editorFiles } from "../meta/editor.js";
11
+ import { editorFiles } from "../editor.js";
7
12
  import { project as resolveProject } from "../resolve.js";
8
13
  import { CliError, cyan, dim, EXIT, isInteractive, json, note, usageError } from "../term.js";
9
14
  const USAGE = 'zen open [project] [--editor <cmd>] [--wait]';
@@ -2,5 +2,16 @@ import type { Command } from '../command.ts';
2
2
  /** A package's version, read from its manifest rather than inlined at build time. */
3
3
  export declare function versionOf(manifest: URL): Promise<string>;
4
4
  export declare const cliManifest: import("url").URL;
5
+ /**
6
+ * Where a package actually resolved from — the workspace symlink in
7
+ * development, `node_modules` once installed — found the way `zen` finds it.
8
+ * Not every package exports its manifest, so failing that it resolves an
9
+ * entry point it does export and climbs to the manifest that names it. That
10
+ * also fails loudly if an `exports` map is ever broken, which is the one
11
+ * packaging mistake nothing else catches.
12
+ */
13
+ export declare function installedVersion(name: string): Promise<string | undefined>;
14
+ /** The first line a program prints for `--version`, or nothing if it is not there to ask. */
15
+ export declare function askVersion(command: string, args?: string[]): Promise<string | undefined>;
5
16
  export declare const version: Command;
6
17
  //# sourceMappingURL=version.d.ts.map
@@ -1,39 +1,149 @@
1
+ // packages/cli/src/commands/version.ts
2
+ //
3
+ // `zen version`: the version of every `@zenera/*` package this `zen` resolves, and of the programs it runs on.
4
+ // Main: `version: Command`. Helpers: `versionOf`, `installedVersion` (manifest of a resolved package),
5
+ // `askVersion` (`<program> --version`). Siblings add their own subsystems through `Command.subsystems`.
6
+ // Used by: `commands/index.ts` (as `zen version`), `main.ts` (`--version` prints `cliManifest` alone),
7
+ // and the tests, which compare the sandbox image tag to `versionOf(cliManifest)`.
8
+ import { execFile } from 'node:child_process';
1
9
  import { readFile } from 'node:fs/promises';
2
- import { createRequire } from 'node:module';
3
- import { dim, json, pad, write } from "../term.js";
10
+ import { dirname, join } from 'node:path';
11
+ import { fileURLToPath } from 'node:url';
12
+ import { hasExternal, loadExternal } from "../external.js";
13
+ import { dim, json, pad, write, yellow } from "../term.js";
14
+ import { EXTERNAL } from "./index.js";
4
15
  /** A package's version, read from its manifest rather than inlined at build time. */
5
16
  export async function versionOf(manifest) {
6
17
  const { version } = JSON.parse(await readFile(manifest, 'utf8'));
7
18
  return version;
8
19
  }
9
20
  export const cliManifest = new URL('../../package.json', import.meta.url);
21
+ /** What `zen` itself is built on, as opposed to the packages it loads by name. */
22
+ const BUILT_ON = [
23
+ '@zenera/engine',
24
+ '@zenera/neo',
25
+ '@zenera/sandbox',
26
+ '@zenera/server',
27
+ '@zenera/view',
28
+ ];
10
29
  /**
11
- * Where the library actually resolved from — the workspace symlink in
12
- * development, `node_modules` once installed. Going through its `exports` map
13
- * rather than a guessed path means this also fails loudly if that map is ever
14
- * broken, which is the one packaging mistake nothing else catches.
30
+ * Where a package actually resolved from — the workspace symlink in
31
+ * development, `node_modules` once installed — found the way `zen` finds it.
32
+ * Not every package exports its manifest, so failing that it resolves an
33
+ * entry point it does export and climbs to the manifest that names it. That
34
+ * also fails loudly if an `exports` map is ever broken, which is the one
35
+ * packaging mistake nothing else catches.
15
36
  */
16
- function libraryManifest() {
17
- const resolve = createRequire(import.meta.url).resolve;
18
- return new URL(`file://${resolve('@zenera/neo/package.json')}`);
37
+ export async function installedVersion(name) {
38
+ for (const spec of [`${name}/package.json`, name, `${name}/command`]) {
39
+ let at;
40
+ try {
41
+ at = fileURLToPath(import.meta.resolve(spec));
42
+ }
43
+ catch {
44
+ continue;
45
+ }
46
+ for (let dir = dirname(at); dir !== dirname(dir); dir = dirname(dir)) {
47
+ try {
48
+ const found = JSON.parse(await readFile(join(dir, 'package.json'), 'utf8'));
49
+ if (found.name === name) {
50
+ return found.version;
51
+ }
52
+ }
53
+ catch {
54
+ // No manifest at this level; keep climbing.
55
+ }
56
+ }
57
+ }
58
+ return undefined;
59
+ }
60
+ /** The first line a program prints for `--version`, or nothing if it is not there to ask. */
61
+ export function askVersion(command, args = ['--version']) {
62
+ return new Promise((done) => {
63
+ execFile(command, args, { timeout: 5_000 }, (err, stdout) => {
64
+ done(err ? undefined : stdout.trim().split('\n')[0]?.trim() || undefined);
65
+ });
66
+ });
67
+ }
68
+ async function podman() {
69
+ const said = await askVersion('podman');
70
+ return said
71
+ ? { name: 'podman', version: said.split(' ').at(-1) }
72
+ : { name: 'podman', detail: 'needed by zen sandbox and zen server' };
73
+ }
74
+ /** What each installed sibling says it runs on. One that cannot say is left out, not fatal. */
75
+ async function siblings() {
76
+ const said = await Promise.all(Object.entries(EXTERNAL)
77
+ .filter(([, ext]) => hasExternal(ext))
78
+ .map(async ([name, ext]) => {
79
+ try {
80
+ return (await (await loadExternal(name, ext)).subsystems?.()) ?? [];
81
+ }
82
+ catch {
83
+ return [];
84
+ }
85
+ }));
86
+ return said.flat();
19
87
  }
20
88
  export const version = {
21
- summary: 'Print the CLI, library and Node versions.',
89
+ summary: 'Print the versions of every zen package and what they run on.',
22
90
  usage: 'zen version',
91
+ details: [
92
+ 'Packages are the @zenera/* ones this zen resolves: what it is built on,',
93
+ 'then the ones it loads by name (zen meta, zen gym, zen rag), which are',
94
+ 'installed apart. They are released in lockstep, so one whose version is',
95
+ 'not the CLI’s is marked: that is the usual reason a command misbehaves.',
96
+ '',
97
+ 'Subsystems are the programs outside Node that commands run: podman for',
98
+ 'the sandbox and the server, copilot for the meta agent.',
99
+ '',
100
+ '`zen --version` prints the CLI’s version alone.',
101
+ ],
23
102
  banner: { head: 'Zenera', accent: 'Version', subtitle: 'Runtime & Build', hue: 'steel' },
24
103
  run: async (ctx) => {
25
- const versions = {
26
- cli: await versionOf(cliManifest),
27
- '@zenera/neo': await versionOf(libraryManifest()),
28
- node: process.versions.node,
29
- };
104
+ const cli = await versionOf(cliManifest);
105
+ const [built, external, systems] = await Promise.all([
106
+ Promise.all(BUILT_ON.map(async (name) => ({ name, version: await installedVersion(name) }))),
107
+ Promise.all(Object.values(EXTERNAL).map(async (ext) => ({
108
+ name: ext.package,
109
+ version: await installedVersion(ext.package),
110
+ install: ext.install,
111
+ }))),
112
+ Promise.all([podman(), siblings()]),
113
+ ]);
114
+ const packages = [
115
+ { name: '@zenera/cli', version: cli },
116
+ ...built,
117
+ ...external.map((p) => (p.version ? p : { ...p, detail: p.install })),
118
+ ];
119
+ const subsystems = [
120
+ { name: 'node', version: process.versions.node },
121
+ systems[0],
122
+ ...systems[1],
123
+ ];
30
124
  if (ctx.json) {
31
- json(versions);
125
+ json({
126
+ packages: Object.fromEntries(packages.map((p) => [p.name, p.version ?? null])),
127
+ subsystems: Object.fromEntries(subsystems.map((s) => [
128
+ s.name,
129
+ { version: s.version ?? null, ...(s.detail ? { detail: s.detail } : {}) },
130
+ ])),
131
+ });
32
132
  return;
33
133
  }
34
- const width = Math.max(...Object.keys(versions).map((k) => k.length));
35
- for (const [name, value] of Object.entries(versions)) {
36
- write(`${dim(pad(name, width))} ${value}`);
134
+ const width = Math.max(...[...packages, ...subsystems].map((r) => r.name.length));
135
+ const line = (r, missing, skew = false) => {
136
+ const value = !r.version ? dim(missing) : skew ? yellow(r.version) : r.version;
137
+ const said = skew ? `expected ${cli}, as the CLI` : r.detail;
138
+ return ` ${pad(r.name, width)} ${value}${said ? ` ${dim(said)}` : ''}`;
139
+ };
140
+ write(dim('packages'));
141
+ for (const p of packages) {
142
+ write(line(p, 'not installed', p.version !== undefined && p.version !== cli));
143
+ }
144
+ write(dim('subsystems'));
145
+ for (const s of subsystems) {
146
+ write(line(s, 'not found'));
37
147
  }
38
148
  },
39
149
  };
@@ -6,4 +6,4 @@ import { type Candidate } from './candidates.ts';
6
6
  export declare function complete(words: readonly string[], cwd: string): Promise<Candidate[]>;
7
7
  /** The wire format. Whitespace in a description would break a line in two. */
8
8
  export declare function render(found: readonly Candidate[]): string;
9
- //# sourceMappingURL=completion.d.ts.map
9
+ //# sourceMappingURL=complete.d.ts.map
@@ -1,7 +1,13 @@
1
+ // packages/cli/src/complete.ts
2
+ //
3
+ // Shell tab completion: turns the words typed so far into candidates, the same way for zsh, bash and fish.
4
+ // Main: `complete(words, cwd)` and `render()` (the `value<TAB>description` wire format). A command with its own
5
+ // `complete` hook answers for itself; a sibling package (e.g. `@zenera/meta`) is loaded for that only if installed.
6
+ // Used by: `main.ts`, for the hidden `zen __complete` the shell scripts from `zen completion` call.
1
7
  import { resolve } from 'node:path';
2
8
  import { matching, projectNames } from "./candidates.js";
3
9
  import { ALIASES, COMMANDS, EXTERNAL } from "./commands/index.js";
4
- import { completeMeta } from "./commands/meta.js";
10
+ import { hasExternal, loadExternal } from "./external.js";
5
11
  // ---------------------------------------------------------------------------
6
12
  // Shell completion
7
13
  //
@@ -72,8 +78,12 @@ export async function complete(words, cwd) {
72
78
  if (name === 'help') {
73
79
  return args.length === 0 ? await complete([cur], at) : [];
74
80
  }
75
- if (name === 'meta') {
76
- return await completeMeta(args, cur, at);
81
+ // A command whose words the usage line cannot describe answers for itself.
82
+ // One in another package is loaded for it only if it is there to load.
83
+ const ext = COMMANDS[name] ? undefined : EXTERNAL[name];
84
+ const own = COMMANDS[name] ?? (ext && hasExternal(ext) ? await loadExternal(name, ext) : undefined);
85
+ if (own?.complete) {
86
+ return await own.complete(args, cur, at);
77
87
  }
78
88
  if (cur.startsWith('-') || args.some((a) => !a.startsWith('-'))) {
79
89
  return [];
@@ -90,4 +100,4 @@ export function render(found) {
90
100
  .map((c) => c.description ? `${c.value}\t${c.description.replace(/\s+/g, ' ').trim()}` : c.value)
91
101
  .join('\n');
92
102
  }
93
- //# sourceMappingURL=completion.js.map
103
+ //# sourceMappingURL=complete.js.map
@@ -1,6 +1,12 @@
1
+ // packages/cli/src/editor.ts
2
+ //
3
+ // The editor brief a project carries: the `.github/` tree (instructions and skills) and the `.vscode/` settings.
4
+ // Main: `editorFiles(dir)`, which rewrites them from `templates/editor` and retires prompt files `zen` used to ship.
5
+ // Used by: `scaffold.ts` (`zen init`), `commands/open.ts` (`zen open`), and through `lib.ts` by `@zenera/meta`,
6
+ // which refreshes them before `zen meta run` and before a fine-tuning loop.
1
7
  import { existsSync, readdirSync, rmdirSync, rmSync } from 'node:fs';
2
8
  import { join } from 'node:path';
3
- import { copyTree, TEMPLATES } from "./host.js";
9
+ import { copyTree, TEMPLATES } from "./scaffold.js";
4
10
  // ---------------------------------------------------------------------------
5
11
  // Telling the editor which instructions are not for it
6
12
  //
package/dist/lib.d.ts CHANGED
@@ -3,9 +3,26 @@ export { extract, invokedAs, one, parse, split, type Parsed, type Split } from '
3
3
  export { bannerArt, printBanner, type BannerText } from './banner.ts';
4
4
  export { Cache, items as cacheItems, cacheKey, kinds as cacheKinds, clear as clearCache, NO_CACHE, sweep as sweepCache, type CacheEntry, type CacheItem, type CacheKind, type CacheOptions, type CacheStore, type Swept, } from './cache.ts';
5
5
  export { CATALOG_TTL_MS, CURATED, fetchCatalog, loadCatalog, loadCatalogs, matches, PREFERRED, type Catalog, type CatalogEntry, type CatalogOptions, type Filters, type Role, } from './catalog.ts';
6
- export type { Command, Context } from './command.ts';
6
+ export type { Command, Context, Subsystem } from './command.ts';
7
7
  export { probe, probeAll } from './liveness.ts';
8
8
  export { engineDisk, ensurePodmanReady, ownedContainers, podmanStatus, removeContainers, type DiskLine, type EngineDisk, type OwnedContainer, type PodmanOptions, type PodmanStatus, } from './podman.ts';
9
9
  export { ago, bold, CliError, count, credentialError, cyan, dim, EXIT, fail, green, invalidError, isInteractive, italic, json, note, pad, red, table, underline, usageError, warn, write, writeAll, yellow, type ExitCode, } from './term.ts';
10
10
  export { formatBlocks, formatInline, formatMarkdown, wrapSpans } from './tui/markdown.ts';
11
+ export { matching, projectNames, type Candidate } from './candidates.ts';
12
+ export { editorFiles } from './editor.ts';
13
+ export { copilotEventLog, type EventLine } from './eventlog.ts';
14
+ export { probeChat, probeModel } from './liveness.ts';
15
+ export { PROVIDER_NAMES, splitRef } from './modelref.ts';
16
+ export { duration } from './narrate.ts';
17
+ export { rankModels } from './rank.ts';
18
+ export { project as resolveProject } from './resolve.ts';
19
+ export { copyTree, SHARED_RULES, TEMPLATES } from './scaffold.ts';
20
+ export { choose, confirm, cut, plain, progress, readStdin, styled } from './term.ts';
21
+ export { safe } from './trace.ts';
22
+ export { resolveTheme, THEMES, type Theme } from './tui/theme.ts';
23
+ export { boxWidth, wrap } from './tui/wrap.ts';
24
+ export { appendUsage, LEDGER_ENV, ledgerPath, META_PROMPT_ENV, META_SESSION_ENV } from './usage.ts';
25
+ export { validateProject, type Report as ProjectReport } from './validate.ts';
26
+ /** The model browser, loaded only when asked for: it is the one thing here that draws. */
27
+ export declare function browseModels(...args: Parameters<typeof import('./commands/models.ts').browseModels>): ReturnType<typeof import('./commands/models.ts').browseModels>;
11
28
  //# sourceMappingURL=lib.d.ts.map
package/dist/lib.js CHANGED
@@ -1,3 +1,9 @@
1
+ // packages/cli/src/lib.ts
2
+ //
3
+ // The public API of `@zenera/cli`, exported as `@zenera/cli/lib`: a hand-picked list, bound by the package version.
4
+ // Main: re-exports of the keyring, argument parsing, terminal styling, catalog, `Command`, and the section
5
+ // "For @zenera/meta" (project resolution, usage ledger, editor brief, theme, `browseModels`).
6
+ // Used by: sibling packages only - `@zenera/meta` (through its `src/host.ts`), `@zenera/gym`, `@zenera/rag`.
1
7
  // ---------------------------------------------------------------------------
2
8
  // The library face of the CLI
3
9
  //
@@ -30,4 +36,32 @@ export { probe, probeAll } from "./liveness.js";
30
36
  export { engineDisk, ensurePodmanReady, ownedContainers, podmanStatus, removeContainers, } from "./podman.js";
31
37
  export { ago, bold, CliError, count, credentialError, cyan, dim, EXIT, fail, green, invalidError, isInteractive, italic, json, note, pad, red, table, underline, usageError, warn, write, writeAll, yellow, } from "./term.js";
32
38
  export { formatBlocks, formatInline, formatMarkdown, wrapSpans } from "./tui/markdown.js";
39
+ // ---------------------------------------------------------------------------
40
+ // For @zenera/meta
41
+ //
42
+ // The meta agent was a part of `zen` until it became a package of its own, and
43
+ // it still drives `zen` the way the rest of the CLI does: the same project
44
+ // resolution, the same usage ledger, the same editor brief and the same look.
45
+ // These are what it reaches for, through `packages/meta/src/host.ts` alone.
46
+ // ---------------------------------------------------------------------------
47
+ export { matching, projectNames } from "./candidates.js";
48
+ export { editorFiles } from "./editor.js";
49
+ export { copilotEventLog } from "./eventlog.js";
50
+ export { probeChat, probeModel } from "./liveness.js";
51
+ export { PROVIDER_NAMES, splitRef } from "./modelref.js";
52
+ export { duration } from "./narrate.js";
53
+ export { rankModels } from "./rank.js";
54
+ export { project as resolveProject } from "./resolve.js";
55
+ export { copyTree, SHARED_RULES, TEMPLATES } from "./scaffold.js";
56
+ export { choose, confirm, cut, plain, progress, readStdin, styled } from "./term.js";
57
+ export { safe } from "./trace.js";
58
+ export { resolveTheme, THEMES } from "./tui/theme.js";
59
+ export { boxWidth, wrap } from "./tui/wrap.js";
60
+ export { appendUsage, LEDGER_ENV, ledgerPath, META_PROMPT_ENV, META_SESSION_ENV } from "./usage.js";
61
+ export { validateProject } from "./validate.js";
62
+ /** The model browser, loaded only when asked for: it is the one thing here that draws. */
63
+ export async function browseModels(...args) {
64
+ const { browseModels: browse } = await import("./commands/models.js");
65
+ return await browse(...args);
66
+ }
33
67
  //# sourceMappingURL=lib.js.map
package/dist/main.js CHANGED
@@ -40,7 +40,7 @@ const GLOBAL = {
40
40
  */
41
41
  async function completing(words) {
42
42
  try {
43
- const { complete, render } = await import("./completion.js");
43
+ const { complete, render } = await import("./complete.js");
44
44
  const found = render(await complete(words, process.cwd()));
45
45
  if (found) {
46
46
  process.stdout.write(`${found}\n`);
package/dist/scaffold.js CHANGED
@@ -1,7 +1,13 @@
1
+ // packages/cli/src/scaffold.ts
2
+ //
3
+ // Creating a project from `templates/`: `agents.yaml`, prompts, specification, house rules and the editor brief.
4
+ // Main: `scaffold(opts)`; also `TEMPLATES`, `copyTree`, `SHARED_RULES`, `refreshShared`/`staleShared`, `ownVersion`.
5
+ // Used by: `commands/init.ts`, `commands/check.ts` (`--fix`), `commands/export.ts`, `commands/completion.ts`,
6
+ // `validate.ts`, `editor.ts`, and through `lib.ts` by `@zenera/meta`.
1
7
  import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, } from 'node:fs';
2
8
  import { dirname, join, sep } from 'node:path';
3
9
  import { fileURLToPath } from 'node:url';
4
- import { editorFiles } from "./meta/editor.js";
10
+ import { editorFiles } from "./editor.js";
5
11
  // ---------------------------------------------------------------------------
6
12
  // Scaffolding
7
13
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenera/cli",
3
- "version": "1.2.9",
3
+ "version": "1.3.1",
4
4
  "description": "Command-line front end for @zenera/neo: agentic projects you can run, share and commit.",
5
5
  "keywords": [
6
6
  "agents",
@@ -56,16 +56,15 @@
56
56
  "@google/genai": "^2.30.0",
57
57
  "@inkjs/ui": "^2.0.0",
58
58
  "@openrouter/sdk": "^1.4.25",
59
- "@zenera/engine": "^1.2.9",
60
- "@zenera/neo": "^1.2.9",
61
- "@zenera/sandbox": "^1.2.9",
62
- "@zenera/server": "^1.2.9",
63
- "@zenera/view": "^1.2.9",
59
+ "@zenera/engine": "^1.3.1",
60
+ "@zenera/neo": "^1.3.1",
61
+ "@zenera/sandbox": "^1.3.1",
62
+ "@zenera/server": "^1.3.1",
63
+ "@zenera/view": "^1.3.1",
64
64
  "google-auth-library": "^10.0.0",
65
65
  "ink": "^7.1.1",
66
66
  "openai": "^6.0.0",
67
67
  "react": "^19.2.8",
68
- "yaml": "^2.9.1",
69
68
  "yauzl": "^3.4.0",
70
69
  "yazl": "^3.3.1"
71
70
  },
@@ -9,6 +9,9 @@ zen meta model [ref] show or set the model it uses
9
9
  zen meta dataset <verb> see dataset.md
10
10
  ```
11
11
 
12
+ Provided by `@zenera/meta` - `npm i -g @zenera/meta` if `zen meta` says it is
13
+ not installed. `zen meta dataset` and `zen meta finetune` come with it.
14
+
12
15
  `zen meta --help` has every option.
13
16
 
14
17
  ## `--json`
@@ -130,5 +130,10 @@ window immediately rather than after a prompt.
130
130
  zen version
131
131
  ```
132
132
 
133
- The CLI version, the library version and the Node version. `zen --version`
134
- prints the CLI version alone and returns before anything else loads.
133
+ Every `@zenera/*` package this `zen` resolves - what it is built on, then the
134
+ ones it loads by name (`@zenera/meta`, `@zenera/gym`, `@zenera/rag`), each with
135
+ its install line when missing - and the programs they run on: Node, Podman and,
136
+ with `@zenera/meta`, Copilot CLI. A package whose version is not the CLI's is
137
+ marked; they ship in lockstep, so that is the first thing to fix when a command
138
+ misbehaves. `--json` gives `{ packages, subsystems }`. `zen --version` prints
139
+ the CLI version alone and returns before anything else loads.
@@ -1,6 +0,0 @@
1
- import { type Candidate } from '../candidates.ts';
2
- import type { Command } from '../command.ts';
3
- export declare const meta: Command;
4
- /** `args` is what came after `meta`, without the word being completed. */
5
- export declare function completeMeta(args: readonly string[], cur: string, cwd: string): Promise<Candidate[]>;
6
- //# sourceMappingURL=meta.d.ts.map