@duyquangnvx/create-agent-cli 0.6.0 → 0.7.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/bin.js +57 -36
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ What changed in each release of `@duyquangnvx/agent-cli` (the Runtime) and `@duy
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## v0.7.0 (2026-10-20)
8
+
9
+ ### Added
10
+
11
+ - Every Runtime code is exported under its name: `OUTPUT_EXISTS`, `PROJECT_INVALID`, `INVALID_INPUT`, `UNKNOWN_OPTION`, `UNKNOWN_COMMAND`, `UNKNOWN_FIELD`, `CONFIRMATION_REQUIRED`, `CONFIRMATION_MISMATCH`, `NOT_CONFIRMED`, `TOOL_FAILED`, `TOOL_MISSING`, `DOCTOR_PROBLEMS`, `INTERNAL`, `NOT_GLOBAL_INSTALL`, `REGISTRY_UNREACHABLE`, `REGISTRY_AUTH`, `INSTALL_FAILED`, `NPM_FAILED` and `NO_LATEST`. The agent-cli skill says which of them a Command may throw, and asserts codes through them.
12
+ - A CLI's `doctor` rows read the Project file as `ctx.project`, which was always `undefined` there. `doctor` reads the file once for all its rows; a row that reads `ctx.project` while the file is unusable is skipped, since the `project` row reports it. See `DoctorCheck.run`. The agent-cli skill's example adds a `tag` row that reads it.
13
+
14
+ ### Changed
15
+
16
+ - **Breaking:** `doctor`'s `project` row carries the code of the failed read, so a Project file its schema rejects fails `doctor` with `PROJECT_INVALID` instead of `DOCTOR_PROBLEMS` (still exit 2), the code a Command fails with on the same file. The row's message adds the error's hint.
17
+
7
18
  ## v0.6.0 (2026-10-20)
8
19
 
9
20
  ### Changed
package/dist/bin.js CHANGED
@@ -5795,7 +5795,7 @@ var UsageError = class extends CliError {
5795
5795
  this.name = "UsageError";
5796
5796
  }
5797
5797
  };
5798
- const INTERNAL_CODE = "INTERNAL";
5798
+ const INTERNAL = "INTERNAL";
5799
5799
  function errnoOf(error) {
5800
5800
  return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : void 0;
5801
5801
  }
@@ -5835,7 +5835,7 @@ function fieldsOf$1(error, format) {
5835
5835
  };
5836
5836
  }
5837
5837
  return {
5838
- code: INTERNAL_CODE,
5838
+ code: INTERNAL,
5839
5839
  message: messageOf(error),
5840
5840
  hint: bugHint(format)
5841
5841
  };
@@ -7190,22 +7190,41 @@ function nodeRow(cli) {
7190
7190
  }
7191
7191
  };
7192
7192
  }
7193
- function projectRow(projectFile) {
7194
- const { file } = projectFile;
7193
+ /** A row's thrown error as its problem: a `CliError` with its hint and code, anything else a bug. */
7194
+ function problemOfError(name, error) {
7195
+ if (error instanceof CliError) return {
7196
+ state: "problem",
7197
+ message: `${error.message}; ${error.hint}`,
7198
+ code: error.code
7199
+ };
7200
+ return {
7201
+ state: "problem",
7202
+ message: `the ${name} row hit a bug: ${messageOf(error)}`
7203
+ };
7204
+ }
7205
+ function readProject(projectFile, ctx) {
7206
+ if (projectFile === void 0) return {
7207
+ ok: true,
7208
+ project: void 0
7209
+ };
7210
+ try {
7211
+ return {
7212
+ ok: true,
7213
+ project: projectOf(projectFile, ctx.cwd, ctx.fileError)
7214
+ };
7215
+ } catch (error) {
7216
+ return {
7217
+ ok: false,
7218
+ error
7219
+ };
7220
+ }
7221
+ }
7222
+ function projectRow({ file }, read) {
7195
7223
  return {
7196
7224
  name: "project",
7197
7225
  run: (ctx) => {
7198
- let project;
7199
- try {
7200
- project = projectOf(projectFile, ctx.cwd, ctx.fileError);
7201
- } catch (error) {
7202
- if (error instanceof CliError && error.code === "PROJECT_INVALID") return {
7203
- state: "problem",
7204
- message: error.message
7205
- };
7206
- throw error;
7207
- }
7208
- return ok(project === void 0 ? `none found: no ${file} at or above ${ctx.cwd}` : join(project.root, file));
7226
+ if (!read.ok) return problemOfError("project", read.error);
7227
+ return ok(read.project === void 0 ? `none found: no ${file} at or above ${ctx.cwd}` : join(read.project.root, file));
7209
7228
  }
7210
7229
  };
7211
7230
  }
@@ -7273,11 +7292,11 @@ function skillRow(cli) {
7273
7292
  };
7274
7293
  }
7275
7294
  /** Every row `doctor` reports, in order: the fixed rows around the CLI's own and its tools'. */
7276
- function doctorChecks(cli, launch) {
7295
+ function doctorChecks(cli, launch, read) {
7277
7296
  return [
7278
7297
  buildRow(cli),
7279
7298
  nodeRow(cli),
7280
- ...cli.project === void 0 ? [] : [projectRow(cli.project)],
7299
+ ...cli.project === void 0 ? [] : [projectRow(cli.project, read)],
7281
7300
  ...cli.doctor ?? [],
7282
7301
  ...toolRows(cli.tools ?? [], cli.commands),
7283
7302
  installRow(cli, launch),
@@ -7310,28 +7329,29 @@ function problemOf(check, error, { signal, deadline, ms }) {
7310
7329
  state: "problem",
7311
7330
  message: `${check.name} did not answer within ${ms / MS_PER_SECOND} s`
7312
7331
  };
7313
- if (error instanceof CliError) return {
7314
- state: "problem",
7315
- message: `${error.message}; ${error.hint}`,
7316
- code: error.code
7317
- };
7318
- return {
7319
- state: "problem",
7320
- message: `the ${check.name} row hit a bug: ${messageOf(error)}`
7321
- };
7332
+ return problemOfError(check.name, error);
7322
7333
  }
7323
- function withSignal(ctx, signal) {
7324
- return Object.create(ctx, { signal: { value: signal } });
7334
+ function rowContext(ctx, signal, read) {
7335
+ return Object.create(ctx, {
7336
+ signal: { value: signal },
7337
+ project: { get: () => {
7338
+ if (!read.ok) throw read.error;
7339
+ return read.project;
7340
+ } }
7341
+ });
7325
7342
  }
7326
- async function rowOf(check, ctx) {
7343
+ async function rowOf(check, ctx, read) {
7327
7344
  const ms = check.deadlineMs ?? DEFAULT_DEADLINE_MS;
7328
7345
  const signal = ctx.deadline(ms);
7329
7346
  let finding;
7330
7347
  try {
7331
- finding = await Promise.race([Promise.resolve().then(() => check.run(withSignal(ctx, signal))), untilAborted(signal)]);
7348
+ finding = await Promise.race([Promise.resolve().then(() => check.run(rowContext(ctx, signal, read))), untilAborted(signal)]);
7332
7349
  } catch (error) {
7333
7350
  if (ctx.signal.aborted) return void 0;
7334
- finding = problemOf(check, error, {
7351
+ finding = !read.ok && error === read.error ? {
7352
+ state: "skipped",
7353
+ message: "the Project file is unusable; the project row says why"
7354
+ } : problemOf(check, error, {
7335
7355
  signal: ctx.signal,
7336
7356
  deadline: signal,
7337
7357
  ms
@@ -7379,7 +7399,8 @@ function doctorCommand(cli, launch) {
7379
7399
  effect: "read",
7380
7400
  output: reportSchema,
7381
7401
  run: async (_input, ctx) => {
7382
- const checked = (await Promise.all(doctorChecks(cli, launch).map((check) => rowOf(check, ctx)))).filter((row) => row !== void 0);
7402
+ const read = readProject(cli.project, ctx);
7403
+ const checked = (await Promise.all(doctorChecks(cli, launch, read).map((check) => rowOf(check, ctx, read)))).filter((row) => row !== void 0);
7383
7404
  const rows = checked.map(({ row }) => row);
7384
7405
  const report = {
7385
7406
  rows,
@@ -8075,7 +8096,7 @@ const RUNTIME_EXIT_CLASSES = {
8075
8096
  [STDIN_STALLED]: "caller",
8076
8097
  [INTERRUPTED]: "interrupted",
8077
8098
  [DEADLINE_EXCEEDED]: "wait",
8078
- [INTERNAL_CODE]: "bug",
8099
+ [INTERNAL]: "bug",
8079
8100
  [PERMISSION_DENIED]: "operator",
8080
8101
  [DISK_FULL]: "operator",
8081
8102
  [NOT_FOUND]: "caller",
@@ -9387,14 +9408,14 @@ async function runProcess(cli) {
9387
9408
  }
9388
9409
  //#endregion
9389
9410
  //#region package.json
9390
- var version$1 = "0.6.0";
9411
+ var version$1 = "0.7.0";
9391
9412
  var description = "Creates a new Agent CLI repository wired to @duyquangnvx/agent-cli.";
9392
9413
  //#endregion
9393
9414
  //#region src/build.ts
9394
9415
  const build = {
9395
- "sha": "6821473",
9416
+ "sha": "10574f5",
9396
9417
  "dirty": false,
9397
- "builtAt": "2026-10-20T02:08:46.888Z"
9418
+ "builtAt": "2026-10-20T03:42:41.670Z"
9398
9419
  };
9399
9420
  //#endregion
9400
9421
  //#region src/steps.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duyquangnvx/create-agent-cli",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Creates a new Agent CLI repository wired to @duyquangnvx/agent-cli.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -19,7 +19,7 @@
19
19
  "access": "public"
20
20
  },
21
21
  "devDependencies": {
22
- "@duyquangnvx/agent-cli": "0.6.0",
22
+ "@duyquangnvx/agent-cli": "0.7.0",
23
23
  "tsdown": "0.23.0",
24
24
  "zod": "4.6.7"
25
25
  },