@duyquangnvx/create-agent-cli 0.27.0 → 0.29.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duyquangnvx/create-agent-cli",
3
- "version": "0.27.0",
3
+ "version": "0.29.0",
4
4
  "description": "Creates a new Agent CLI repository wired to @duyquangnvx/agent-cli.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -21,7 +21,7 @@
21
21
  "access": "public"
22
22
  },
23
23
  "devDependencies": {
24
- "@duyquangnvx/agent-cli": "0.27.0",
24
+ "@duyquangnvx/agent-cli": "0.29.0",
25
25
  "tsdown": "0.23.0",
26
26
  "zod": "4.6.7"
27
27
  },
@@ -1,4 +1,4 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.5.15/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.6.2/schema.json",
3
3
  "extends": ["@duyquangnvx/harness/biome"]
4
4
  }
@@ -28,9 +28,9 @@
28
28
  "release": "node scripts/release.ts"
29
29
  },
30
30
  "devDependencies": {
31
- "@biomejs/biome": "2.5.15",
31
+ "@biomejs/biome": "2.6.2",
32
32
  "@duyquangnvx/agent-cli": "{{runtimeVersion}}",
33
- "@duyquangnvx/harness": "0.3.1",
33
+ "@duyquangnvx/harness": "0.5.2",
34
34
  "@duyquangnvx/release": "0.9.0",
35
35
  "@types/node": "^22.19.0",
36
36
  "tsdown": "0.23.0",
@@ -9,7 +9,7 @@ const { defineCli, defineCommand } = agentCli({ errors, ports });
9
9
  const FREE_LANGUAGE = "en";
10
10
  const PRICE_PER_CARD = "$0.01";
11
11
 
12
- const greet = defineCommand({
12
+ const greet = defineCommand.read({
13
13
  description: "Greet someone by name",
14
14
  examples: [
15
15
  {
@@ -21,14 +21,13 @@ const greet = defineCommand({
21
21
  note: "get the greeting as JSON",
22
22
  },
23
23
  ],
24
- effect: "read",
25
24
  args: z.object({
26
25
  name: z.string().min(1).describe("who to greet"),
27
26
  }),
28
27
  run: ({ name }) => ({ greeting: `Hello, ${name}!` }),
29
28
  });
30
29
 
31
- const card = defineCommand({
30
+ const card = defineCommand.write({
32
31
  description: "Write a greeting card to <name>.txt",
33
32
  help:
34
33
  `A card in English is free; one in another language costs ${PRICE_PER_CARD} and needs --yes. ` +
@@ -47,7 +46,6 @@ const card = defineCommand({
47
46
  note: "sign the card from Ben and Cy",
48
47
  },
49
48
  ],
50
- effect: "write",
51
49
  errors: ["LANGUAGE_UNSUPPORTED"],
52
50
  args: z.object({
53
51
  name: z
@@ -3,7 +3,7 @@ import { tmpdir } from "node:os";
3
3
  import { join, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { type Files, runCli } from "@duyquangnvx/agent-cli";
6
- import { checkExamples } from "@duyquangnvx/agent-cli/testing";
6
+ import { checkCli } from "@duyquangnvx/agent-cli/testing";
7
7
  import { describe, expect, test } from "vitest";
8
8
  import manifest from "../package.json" with { type: "json" };
9
9
  import { cli } from "../src/cli.ts";
@@ -36,7 +36,11 @@ function fakeFiles(existing: readonly string[] = []) {
36
36
  mkdir: async () => {},
37
37
  stat: async (path) => {
38
38
  const text = written.get(path);
39
- return text === undefined ? undefined : { size: text.length, id: path };
39
+ return text === undefined ? undefined : { size: text.length, id: path, folder: false };
40
+ },
41
+ realPath: async (path) => {
42
+ if (written.has(path)) return path;
43
+ return existing.some((name) => resolve(CWD, name) === path) ? path : undefined;
40
44
  },
41
45
  };
42
46
  return { files, written };
@@ -70,8 +74,8 @@ function run(
70
74
  return runCli(cli, argv, { cwd: CWD, files, ports: { greetings }, stdin });
71
75
  }
72
76
 
73
- test("every example parses, names a Command and passes its schemas", async () => {
74
- await checkExamples(cli);
77
+ test("every example runs, every Command help shows has one, and every arg and option is described", async () => {
78
+ await checkCli(cli);
75
79
  });
76
80
 
77
81
  describe("greet", () => {