aronrepo 3.0.1 → 3.0.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aron
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -10,7 +10,7 @@ One commit standard and one release engine for JavaScript repositories, built so
10
10
  bun add -d aronrepo husky
11
11
  ```
12
12
 
13
- `pnpm add -D aronrepo husky` and `npm install -D aronrepo husky` work too. This package is ESM-only and has no peer tools.
13
+ `pnpm add -D aronrepo husky` and `npm install -D aronrepo husky` work too. This package is ESM-only, needs Node.js 22.18 or later, and has no peer tools.
14
14
 
15
15
  ## Configure
16
16
 
@@ -24,6 +24,8 @@ export default {
24
24
  }
25
25
  ```
26
26
 
27
+ A CommonJS package uses `aronrepo.config.mjs`; `aronrepo.config.cjs` and `aronrepo.config.ts` (Node 22.18+) work too.
28
+
27
29
  ```sh
28
30
  # .husky/commit-msg
29
31
  aronrepo check --edit "$1"
package/dist/cli.js CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { releaseModes } from "./index.js";
3
- import { c as release, i as explain, n as check, o as policy, r as doctor, t as agents } from "./commands-BRnoLH3z.js";
3
+ import { i as explain, l as release, n as check, o as policy, r as doctor, t as agents } from "./commands-D2xBkCvw.js";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
4
6
  import { parseArgs } from "node:util";
5
7
  // src/cli.ts
6
8
  const help = `Usage: aronrepo <command> [options]
@@ -9,8 +11,9 @@ Commands:
9
11
  check Check commits against the release policy
10
12
  --edit <file> commit-msg hook: message file + staged files
11
13
  --message <text> a message + staged files (or --files)
12
- --title <text> [--base <ref> --head <ref>] a PR title + PR diff
14
+ --title <text> [--base <ref> --head <ref>] a PR title + PR diff (or --files)
13
15
  --from <ref> [--to <ref>] every commit in a range
16
+ --files <a,b,...> changed files, comma-separated, for --message or --title
14
17
  explain Print the next release and the reason for each commit
15
18
  [--from <ref>] [--to <ref>] defaults to the release range of the branch
16
19
  release Publish the next release: npm packages, the version tag, and the GitHub release
@@ -18,50 +21,137 @@ Commands:
18
21
  policy Print the release policy [--json | --markdown]
19
22
  agents Check the AGENTS.md policy block, or regenerate it with --write [--file <path>]
20
23
  doctor Check the Aronrepo setup of this repository
24
+ help Print this help
21
25
 
22
26
  Options:
23
- --cwd <dir> repository root (default: current directory)
27
+ --cwd <dir> repository root (default: the git repository around the current directory)
24
28
  --mode <explicit|auto> override release.mode from aronrepo.config.js
25
29
  --json machine-readable output
30
+ -h, --help print this help
31
+ -v, --version print the aronrepo version
26
32
  `;
33
+ const options = {
34
+ cwd: { type: "string" },
35
+ mode: { type: "string" },
36
+ json: { type: "boolean" },
37
+ markdown: { type: "boolean" },
38
+ write: { type: "boolean" },
39
+ file: { type: "string" },
40
+ edit: { type: "string" },
41
+ message: { type: "string" },
42
+ title: { type: "string" },
43
+ base: { type: "string" },
44
+ head: { type: "string" },
45
+ from: { type: "string" },
46
+ to: { type: "string" },
47
+ files: { type: "string" },
48
+ "dry-run": { type: "boolean" },
49
+ branch: { type: "string" },
50
+ help: {
51
+ type: "boolean",
52
+ short: "h"
53
+ },
54
+ version: {
55
+ type: "boolean",
56
+ short: "v"
57
+ }
58
+ };
59
+ const common = [
60
+ "cwd",
61
+ "mode",
62
+ "json",
63
+ "help"
64
+ ];
65
+ /** The options each command reads; any other option is a usage error instead of being ignored. */
66
+ const commandOptions = {
67
+ check: [
68
+ ...common,
69
+ "edit",
70
+ "message",
71
+ "title",
72
+ "base",
73
+ "head",
74
+ "from",
75
+ "to",
76
+ "files"
77
+ ],
78
+ explain: [
79
+ ...common,
80
+ "from",
81
+ "to"
82
+ ],
83
+ release: [
84
+ ...common,
85
+ "dry-run",
86
+ "branch"
87
+ ],
88
+ policy: [...common, "markdown"],
89
+ agents: [
90
+ ...common,
91
+ "file",
92
+ "write"
93
+ ],
94
+ doctor: common,
95
+ help: ["help"]
96
+ };
97
+ function parse(argv) {
98
+ try {
99
+ return parseArgs({
100
+ args: argv,
101
+ allowPositionals: true,
102
+ options
103
+ });
104
+ } catch (error) {
105
+ return error;
106
+ }
107
+ }
108
+ function readVersion() {
109
+ const file = new URL("../package.json", import.meta.url);
110
+ return JSON.parse(fs.readFileSync(file, "utf8")).version;
111
+ }
27
112
  async function main(argv) {
28
- const { positionals, values } = parseArgs({
29
- args: argv,
30
- allowPositionals: true,
31
- options: {
32
- cwd: { type: "string" },
33
- mode: { type: "string" },
34
- json: { type: "boolean" },
35
- markdown: { type: "boolean" },
36
- write: { type: "boolean" },
37
- check: { type: "boolean" },
38
- file: { type: "string" },
39
- edit: { type: "string" },
40
- message: { type: "string" },
41
- title: { type: "string" },
42
- base: { type: "string" },
43
- head: { type: "string" },
44
- from: { type: "string" },
45
- to: { type: "string" },
46
- files: { type: "string" },
47
- "dry-run": { type: "boolean" },
48
- branch: { type: "string" },
49
- help: {
50
- type: "boolean",
51
- short: "h"
52
- }
53
- }
54
- });
55
- const [command] = positionals;
56
- if (!command || values.help) return {
57
- code: command || values.help ? 0 : 2,
113
+ const parsed = parse(argv);
114
+ if (parsed instanceof Error) return {
115
+ code: 2,
116
+ output: `${parsed.message}\n\n${help}`
117
+ };
118
+ const { positionals, values } = parsed;
119
+ if (values.version) return {
120
+ code: 0,
121
+ output: readVersion()
122
+ };
123
+ const [command, ...extra] = positionals;
124
+ if (extra.length) return {
125
+ code: 2,
126
+ output: `Unexpected argument "${extra[0]}".\n\n${help}`
127
+ };
128
+ if (command === "help" || values.help && (!command || command in commandOptions)) return {
129
+ code: 0,
58
130
  output: help
59
131
  };
132
+ if (!command) return {
133
+ code: 2,
134
+ output: help
135
+ };
136
+ const allowed = commandOptions[command];
137
+ if (!allowed) return {
138
+ code: 2,
139
+ output: `Unknown command "${command}".\n\n${help}`
140
+ };
141
+ const unsupported = Object.keys(values).filter((key) => !allowed.includes(key));
142
+ if (unsupported.length) return {
143
+ code: 2,
144
+ output: `\`aronrepo ${command}\` does not take --${unsupported[0]}.\n\n${help}`
145
+ };
60
146
  if (values.mode && !releaseModes.includes(values.mode)) return {
61
147
  code: 2,
62
148
  output: `--mode must be one of: ${releaseModes.join(", ")}`
63
149
  };
64
- const common = {
150
+ if (values.cwd && !fs.existsSync(values.cwd)) return {
151
+ code: 2,
152
+ output: `--cwd ${values.cwd} does not exist.`
153
+ };
154
+ const shared = {
65
155
  ...values.cwd ? { cwd: values.cwd } : {},
66
156
  ...values.mode ? { mode: values.mode } : {},
67
157
  ...values.json ? { json: true } : {}
@@ -69,40 +159,48 @@ async function main(argv) {
69
159
  const optional = (...keys) => Object.fromEntries(keys.filter((key) => values[key] !== void 0).map((key) => [key, values[key]]));
70
160
  switch (command) {
71
161
  case "check": return check({
72
- ...common,
73
- ...optional("edit", "message", "title", "base", "head", "from", "to"),
162
+ ...shared,
163
+ ...optional("message", "title", "base", "head", "from", "to"),
164
+ ...values.edit !== void 0 ? { edit: path.resolve(values.edit) } : {},
74
165
  ...values.files !== void 0 ? { files: values.files.split(",").map((file) => file.trim()).filter(Boolean) } : {}
75
166
  });
76
167
  case "explain": return explain({
77
- ...common,
168
+ ...shared,
78
169
  ...optional("from", "to")
79
170
  });
80
171
  case "release": return release({
81
- ...common,
172
+ ...shared,
82
173
  ...optional("branch"),
83
174
  ...values["dry-run"] ? { dryRun: true } : {}
84
175
  });
85
176
  case "policy": return policy({
86
- ...common,
177
+ ...shared,
87
178
  ...values.markdown ? { markdown: true } : {}
88
179
  });
89
180
  case "agents": return agents({
90
- ...common,
181
+ ...shared,
91
182
  ...optional("file"),
92
183
  ...values.write ? { write: true } : {}
93
184
  });
94
- case "doctor": return doctor(common);
95
- default: return {
96
- code: 2,
97
- output: `Unknown command "${command}".\n\n${help}`
98
- };
185
+ default: return doctor(shared);
99
186
  }
100
187
  }
188
+ const json = process.argv.includes("--json");
101
189
  main(process.argv.slice(2)).then(({ code, output }) => {
102
- if (output) (code === 0 ? process.stdout : process.stderr).write(`${output}\n`);
190
+ if (output) {
191
+ const text = json && code === 2 && !output.trimStart().startsWith("{") ? JSON.stringify({
192
+ error: output.split("\n")[0],
193
+ code
194
+ }) : output;
195
+ (code === 2 ? process.stderr : process.stdout).write(`${text}\n`);
196
+ }
103
197
  process.exitCode = code;
104
198
  }).catch((error) => {
105
- process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
199
+ const message = error instanceof Error ? error.message : String(error);
200
+ process.stderr.write(`${json ? JSON.stringify({
201
+ error: message,
202
+ code: 1
203
+ }) : message}\n`);
106
204
  process.exitCode = 1;
107
205
  });
108
206
  export {};
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs } from 'node:util'\nimport { releaseModes, type ReleaseMode } from './index'\nimport { agents, check, doctor, explain, policy, release, type CommandResult } from './commands'\n\nconst help = `Usage: aronrepo <command> [options]\n\nCommands:\n check Check commits against the release policy\n --edit <file> commit-msg hook: message file + staged files\n --message <text> a message + staged files (or --files)\n --title <text> [--base <ref> --head <ref>] a PR title + PR diff\n --from <ref> [--to <ref>] every commit in a range\n explain Print the next release and the reason for each commit\n [--from <ref>] [--to <ref>] defaults to the release range of the branch\n release Publish the next release: npm packages, the version tag, and the GitHub release\n [--dry-run] [--branch <name>] prints the plan and notes without changes\n policy Print the release policy [--json | --markdown]\n agents Check the AGENTS.md policy block, or regenerate it with --write [--file <path>]\n doctor Check the Aronrepo setup of this repository\n\nOptions:\n --cwd <dir> repository root (default: current directory)\n --mode <explicit|auto> override release.mode from aronrepo.config.js\n --json machine-readable output\n`\n\nasync function main(argv: string[]): Promise<CommandResult> {\n const { positionals, values } = parseArgs({\n args: argv,\n allowPositionals: true,\n options: {\n cwd: { type: 'string' },\n mode: { type: 'string' },\n json: { type: 'boolean' },\n markdown: { type: 'boolean' },\n write: { type: 'boolean' },\n check: { type: 'boolean' },\n file: { type: 'string' },\n edit: { type: 'string' },\n message: { type: 'string' },\n title: { type: 'string' },\n base: { type: 'string' },\n head: { type: 'string' },\n from: { type: 'string' },\n to: { type: 'string' },\n files: { type: 'string' },\n 'dry-run': { type: 'boolean' },\n branch: { type: 'string' },\n help: { type: 'boolean', short: 'h' }\n }\n })\n const [command] = positionals\n if (!command || values.help) return { code: command || values.help ? 0 : 2, output: help }\n if (values.mode && !releaseModes.includes(values.mode as ReleaseMode)) {\n return { code: 2, output: `--mode must be one of: ${releaseModes.join(', ')}` }\n }\n const common = {\n ...(values.cwd ? { cwd: values.cwd } : {}),\n ...(values.mode ? { mode: values.mode as ReleaseMode } : {}),\n ...(values.json ? { json: true } : {})\n }\n const optional = <K extends keyof typeof values>(...keys: K[]) =>\n Object.fromEntries(keys.filter((key) => values[key] !== undefined).map((key) => [key, values[key]]))\n\n switch (command) {\n case 'check':\n return check({\n ...common,\n ...optional('edit', 'message', 'title', 'base', 'head', 'from', 'to'),\n ...(values.files !== undefined ? { files: values.files.split(',').map((file) => file.trim()).filter(Boolean) } : {})\n })\n case 'explain':\n return explain({ ...common, ...optional('from', 'to') })\n case 'release':\n return release({ ...common, ...optional('branch'), ...(values['dry-run'] ? { dryRun: true } : {}) })\n case 'policy':\n return policy({ ...common, ...(values.markdown ? { markdown: true } : {}) })\n case 'agents':\n return agents({ ...common, ...optional('file'), ...(values.write ? { write: true } : {}) })\n case 'doctor':\n return doctor(common)\n default:\n return { code: 2, output: `Unknown command \"${command}\".\\n\\n${help}` }\n }\n}\n\nmain(process.argv.slice(2))\n .then(({ code, output }) => {\n if (output) (code === 0 ? process.stdout : process.stderr).write(`${output}\\n`)\n process.exitCode = code\n })\n .catch((error: unknown) => {\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`)\n process.exitCode = 1\n })\n"],"mappings":";;;;;AAKA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;AAsBb,eAAe,KAAK,MAAwC;CACxD,MAAM,EAAE,aAAa,WAAW,UAAU;EACtC,MAAM;EACN,kBAAkB;EAClB,SAAS;GACL,KAAK,EAAE,MAAM,SAAS;GACtB,MAAM,EAAE,MAAM,SAAS;GACvB,MAAM,EAAE,MAAM,UAAU;GACxB,UAAU,EAAE,MAAM,UAAU;GAC5B,OAAO,EAAE,MAAM,UAAU;GACzB,OAAO,EAAE,MAAM,UAAU;GACzB,MAAM,EAAE,MAAM,SAAS;GACvB,MAAM,EAAE,MAAM,SAAS;GACvB,SAAS,EAAE,MAAM,SAAS;GAC1B,OAAO,EAAE,MAAM,SAAS;GACxB,MAAM,EAAE,MAAM,SAAS;GACvB,MAAM,EAAE,MAAM,SAAS;GACvB,MAAM,EAAE,MAAM,SAAS;GACvB,IAAI,EAAE,MAAM,SAAS;GACrB,OAAO,EAAE,MAAM,SAAS;GACxB,WAAW,EAAE,MAAM,UAAU;GAC7B,QAAQ,EAAE,MAAM,SAAS;GACzB,MAAM;IAAE,MAAM;IAAW,O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;EAAG,CAAC;EAC/E,KAAK,UACD,OAAO,OAAO;GAAE,GAAG;GAAQ,GAAG,SAAS,MAAM;GAAG,GAAI,OAAO,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;EAAG,CAAC;EAC9F,KAAK,UACD,OAAO,OAAO,MAAM;EACxB,SACI,OAAO;GAAE,MAAM;GAAG,QAAQ,oBAAoB,QAAQ,QAAQ;EAAO;CAC7E;AACJ;AAEA,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CACtB,MAAM,EAAE,MAAM,aAAa;CACxB,IAAI,QAAQ,CAAC,SAAS,IAAI,QAAQ,SAAS,QAAQ,OAAA,CAAQ,MAAM,GAAG,OAAO,GAAG;CAC9E,QAAQ,WAAW;AACvB,CAAC,CAAC,CACD,OAAO,UAAmB;CACvB,QAAQ,OAAO,MAAM,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GAAG;CAClF,QAAQ,WAAW;AACvB,CAAC"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { parseArgs } from 'node:util'\nimport { releaseModes, type ReleaseMode } from './index'\nimport { agents, check, doctor, explain, policy, release, type CommandResult } from './commands'\n\nconst help = `Usage: aronrepo <command> [options]\n\nCommands:\n check Check commits against the release policy\n --edit <file> commit-msg hook: message file + staged files\n --message <text> a message + staged files (or --files)\n --title <text> [--base <ref> --head <ref>] a PR title + PR diff (or --files)\n --from <ref> [--to <ref>] every commit in a range\n --files <a,b,...> changed files, comma-separated, for --message or --title\n explain Print the next release and the reason for each commit\n [--from <ref>] [--to <ref>] defaults to the release range of the branch\n release Publish the next release: npm packages, the version tag, and the GitHub release\n [--dry-run] [--branch <name>] prints the plan and notes without changes\n policy Print the release policy [--json | --markdown]\n agents Check the AGENTS.md policy block, or regenerate it with --write [--file <path>]\n doctor Check the Aronrepo setup of this repository\n help Print this help\n\nOptions:\n --cwd <dir> repository root (default: the git repository around the current directory)\n --mode <explicit|auto> override release.mode from aronrepo.config.js\n --json machine-readable output\n -h, --help print this help\n -v, --version print the aronrepo version\n`\n\nconst options = {\n cwd: { type: 'string' },\n mode: { type: 'string' },\n json: { type: 'boolean' },\n markdown: { type: 'boolean' },\n write: { type: 'boolean' },\n file: { type: 'string' },\n edit: { type: 'string' },\n message: { type: 'string' },\n title: { type: 'string' },\n base: { type: 'string' },\n head: { type: 'string' },\n from: { type: 'string' },\n to: { type: 'string' },\n files: { type: 'string' },\n 'dry-run': { type: 'boolean' },\n branch: { type: 'string' },\n help: { type: 'boolean', short: 'h' },\n version: { type: 'boolean', short: 'v' }\n} as const\n\ntype OptionName = keyof typeof options\n\nconst common: OptionName[] = ['cwd', 'mode', 'json', 'help']\n\n/** The options each command reads; any other option is a usage error instead of being ignored. */\nconst commandOptions: Record<string, OptionName[]> = {\n check: [...common, 'edit', 'message', 'title', 'base', 'head', 'from', 'to', 'files'],\n explain: [...common, 'from', 'to'],\n release: [...common, 'dry-run', 'branch'],\n policy: [...common, 'markdown'],\n agents: [...common, 'file', 'write'],\n doctor: common,\n help: ['help']\n}\n\nfunction parse(argv: string[]) {\n try {\n return parseArgs({ args: argv, allowPositionals: true, options })\n } catch (error) {\n return error as Error\n }\n}\n\nfunction readVersion() {\n const file = new URL('../package.json', import.meta.url)\n return (JSON.parse(fs.readFileSync(file, 'utf8')) as { version: string }).version\n}\n\nasync function main(argv: string[]): Promise<CommandResult> {\n const parsed = parse(argv)\n // A usage error exits with 2 and shows the usage, like an unknown command.\n if (parsed instanceof Error) return { code: 2, output: `${parsed.message}\\n\\n${help}` }\n const { positionals, values } = parsed\n if (values.version) return { code: 0, output: readVersion() }\n const [command, ...extra] = positionals\n if (extra.length) return { code: 2, output: `Unexpected argument \"${extra[0]}\".\\n\\n${help}` }\n if (command === 'help' || (values.help && (!command || command in commandOptions))) return { code: 0, output: help }\n if (!command) return { code: 2, output: help }\n const allowed = commandOptions[command]\n if (!allowed) return { code: 2, output: `Unknown command \"${command}\".\\n\\n${help}` }\n const unsupported = (Object.keys(values) as OptionName[]).filter((key) => !allowed.includes(key))\n if (unsupported.length) return { code: 2, output: `\\`aronrepo ${command}\\` does not take --${unsupported[0]}.\\n\\n${help}` }\n if (values.mode && !releaseModes.includes(values.mode as ReleaseMode)) {\n return { code: 2, output: `--mode must be one of: ${releaseModes.join(', ')}` }\n }\n if (values.cwd && !fs.existsSync(values.cwd)) return { code: 2, output: `--cwd ${values.cwd} does not exist.` }\n const shared = {\n ...(values.cwd ? { cwd: values.cwd } : {}),\n ...(values.mode ? { mode: values.mode as ReleaseMode } : {}),\n ...(values.json ? { json: true } : {})\n }\n const optional = <K extends keyof typeof values>(...keys: K[]) =>\n Object.fromEntries(keys.filter((key) => values[key] !== undefined).map((key) => [key, values[key]]))\n\n switch (command) {\n case 'check':\n return check({\n ...shared,\n ...optional('message', 'title', 'base', 'head', 'from', 'to'),\n // A path on the command line is relative to the current directory, not to --cwd.\n ...(values.edit !== undefined ? { edit: path.resolve(values.edit) } : {}),\n ...(values.files !== undefined ? { files: values.files.split(',').map((file) => file.trim()).filter(Boolean) } : {})\n })\n case 'explain':\n return explain({ ...shared, ...optional('from', 'to') })\n case 'release':\n return release({ ...shared, ...optional('branch'), ...(values['dry-run'] ? { dryRun: true } : {}) })\n case 'policy':\n return policy({ ...shared, ...(values.markdown ? { markdown: true } : {}) })\n case 'agents':\n return agents({ ...shared, ...optional('file'), ...(values.write ? { write: true } : {}) })\n default:\n return doctor(shared)\n }\n}\n\nconst json = process.argv.includes('--json')\n\nmain(process.argv.slice(2))\n .then(({ code, output }) => {\n // Reports, including failed checks, go to stdout so `--json > file` and pipes keep them; usage errors go to stderr.\n if (output) {\n const text = json && code === 2 && !output.trimStart().startsWith('{') ? JSON.stringify({ error: output.split('\\n')[0], code }) : output\n const stream = code === 2 ? process.stderr : process.stdout\n stream.write(`${text}\\n`)\n }\n process.exitCode = code\n })\n .catch((error: unknown) => {\n const message = error instanceof Error ? error.message : String(error)\n process.stderr.write(`${json ? JSON.stringify({ error: message, code: 1 }) : message}\\n`)\n process.exitCode = 1\n })\n"],"mappings":";;;;;;;AAOA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;AA0Bb,MAAM,UAAU;CACZ,KAAK,EAAE,MAAM,SAAS;CACtB,MAAM,EAAE,MAAM,SAAS;CACvB,MAAM,EAAE,MAAM,UAAU;CACxB,UAAU,EAAE,MAAM,UAAU;CAC5B,OAAO,EAAE,MAAM,UAAU;CACzB,MAAM,EAAE,MAAM,SAAS;CACvB,MAAM,EAAE,MAAM,SAAS;CACvB,SAAS,EAAE,MAAM,SAAS;CAC1B,OAAO,EAAE,MAAM,SAAS;CACxB,MAAM,EAAE,MAAM,SAAS;CACvB,MAAM,EAAE,MAAM,SAAS;CACvB,MAAM,EAAE,MAAM,SAAS;CACvB,IAAI,EAAE,MAAM,SAAS;CACrB,OAAO,EAAE,MAAM,SAAS;CACxB,WAAW,EAAE,MAAM,UAAU;CAC7B,QAAQ,EAAE,MAAM,SAAS;CACzB,MAAM;EAAE,MAAM;EAAW,OAAO;CAAI;CACpC,SAAS;EAAE,MAAM;EAAW,OAAO;CAAI;AAC3C;AAIA,MAAM,SAAuB;CAAC;CAAO;CAAQ;CAAQ;AAAM;;AAG3D,MAAM,iBAA+C;CACjD,OAAO;EAAC,GAAG;EAAQ;EAAQ;EAAW;EAAS;EAAQ;EAAQ;EAAQ;EAAM;CAAO;CACpF,SAAS;EAAC,GAAG;EAAQ;EAAQ;CAAI;CACjC,SAAS;EAAC,GAAG;EAAQ;EAAW;CAAQ;CACxC,QAAQ,CAAC,GAAG,QAAQ,UAAU;CAC9B,QAAQ;EAAC,GAAG;EAAQ;EAAQ;CAAO;CACnC,QAAQ;CACR,MAAM,CAAC,MAAM;AACjB;AAEA,SAAS,MAAM,MAAgB;CAC3B,IAAI;EACA,OAAO,UAAU;GAAE,MAAM;GAAM,kBAAkB;GAAM;EAA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