@linzumi/cli 1.0.323 → 1.0.324

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": "@linzumi/cli",
3
- "version": "1.0.323",
3
+ "version": "1.0.324",
4
4
  "description": "Linzumi CLI \u2014 point a Codex agent at the real code on your laptop, with your team watching and steering from shared threads.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,17 +19,16 @@
19
19
  "build": "rescript build ../linzumi-cli-rescript && node scripts/build.mjs",
20
20
  "bump-version": "node scripts/bump-cli-version.mjs",
21
21
  "test": "pnpm --dir ../linzumi-cli-rescript test && npm run test:operational",
22
- "typecheck": "rescript build ../linzumi-cli-rescript && tsgo --noEmit -p tsconfig.source.json",
22
+ "typecheck": "rescript build ../linzumi-cli-rescript && npm run codex-protocol:declarations && tsgo --noEmit -p tsconfig.source.json",
23
23
  "prepack": "rescript build -q ../linzumi-cli-rescript && node scripts/build.mjs",
24
24
  "pack:dry-run": "npm pack --dry-run",
25
25
  "test:operational": "vitest run --config vitest.config.mjs",
26
- "vendor:codex-app-server-protocol": "tsx scripts/vendor-codex-app-server-protocol.ts",
26
+ "codex-protocol:declarations": "node ../linzumi-cli-rescript/scripts/CodexProtocolGenerate.res.mjs --repo-root ../.. --declarations-out packages/linzumi-cli/.generated/codex-app-server-protocol.d.ts",
27
27
  "test:startup": "npm run build && node --test --test-concurrency=1 ../linzumi-cli-rescript/src/parity/CommanderStartupRefusalConformance.res.mjs",
28
- "typecheck:all": "rescript build ../linzumi-cli-rescript && tsgo --noEmit -p tsconfig.json",
29
- "typecheck:watch": "rescript build ../linzumi-cli-rescript && tsgo --noEmit -w -p tsconfig.source.json",
28
+ "typecheck:all": "rescript build ../linzumi-cli-rescript && npm run codex-protocol:declarations && tsgo --noEmit -p tsconfig.json",
29
+ "typecheck:watch": "rescript build ../linzumi-cli-rescript && npm run codex-protocol:declarations && tsgo --noEmit -w -p tsconfig.source.json",
30
30
  "test:agent-source": "LINZUMI_CI_QUARANTINE=0 pnpm exec vitest run --config vitest.config.mjs test/channelSession.test.ts test/kandanQueue.test.ts -t '(retains three busy accepted source snapshots without fusing or interrupting|keeps different accepted agent sources distinct through interrupt pickup)' && pnpm --dir ../linzumi-cli-rescript build && pnpm --dir ../linzumi-cli-rescript exec node --import tsx src/parity/AgentOpenaiModelProviderConformance.res.mjs && pnpm --dir ../linzumi-cli-rescript exec node --import tsx src/parity/WorkerMintCredentialConformance.res.mjs",
31
- "codex:history-table": "node scripts/codex_history_table.mjs",
32
- "vendor:codex-app-server-protocol:check": "tsx scripts/vendor-codex-app-server-protocol.ts --check"
31
+ "codex:history-table": "node scripts/codex_history_table.mjs"
33
32
  },
34
33
  "keywords": [
35
34
  "linzumi",
@@ -8,19 +8,24 @@
8
8
  //
9
9
  // 1. pnpm bump-version <new-version> --spec plans/<release-spec>.md
10
10
  // (for example: 1.2.3-beta with its approved release spec)
11
- // 2. Run the test suite: pnpm vitest run --config vitest.config.mjs
11
+ // 2. Run the test suite: pnpm test
12
12
  // 3. Commit with a "[deploy-commander]" title and merge to main (the
13
13
  // deprecated "[deploy-cli]" marker was retired in the N3.9 window on
14
14
  // 2026-07-20 and is now loudly inert - naming program).
15
15
  // 4. The main publish workflow (.github/workflows/linzumi-cli-publish.yml)
16
16
  // publishes @linzumi/cli@<new-version> to npm.
17
17
  //
18
- // The package version is pinned in several places (package.json,
19
- // src/version.ts, README.md, the public alias manifest, and version-pinning tests). This script rewrites
20
- // every known site, FAILS LOUDLY if any expected pattern is missing, and then
21
- // scans package.json/src/README/test/scripts/bin for any leftover
22
- // exact old-version token - so a future, not-yet-listed pin site cannot silently
23
- // drift past a release.
18
+ // package.json is the SINGLE version source (scripts/build.mjs defines
19
+ // process.env.LINZUMI_CLI_VERSION from it). The version is still pinned in a
20
+ // few derived places (README.md, the public alias manifest and lockfile
21
+ // importer). No test pins the version: the package-manifest conformance
22
+ // derives it from package.json (spec/single-commander.md, zero-TS). This
23
+ // script rewrites every known site, FAILS LOUDLY if any expected pattern is
24
+ // missing, appends one entry to release-log.md (the release history; it never
25
+ // carries the exact version token), and then scans
26
+ // package.json/release-log.md/src/README/test/scripts/bin for any leftover
27
+ // exact old-version token - so a future, not-yet-listed pin site cannot
28
+ // silently drift past a release.
24
29
  //
25
30
  // Flags:
26
31
  // --spec <path> Required standalone release spec under plans/.
@@ -155,37 +160,32 @@ const knownSites = [
155
160
  pattern: `"version": "${oldVersion}"`,
156
161
  replacement: `"version": "${newVersion}"`,
157
162
  },
158
- {
159
- file: 'src/version.ts',
160
- description: 'linzumiCliVersion constant',
161
- pattern: `export const linzumiCliVersion = '${oldVersion}';`,
162
- replacement: `export const linzumiCliVersion = '${newVersion}';`,
163
- },
164
163
  {
165
164
  file: 'README.md',
166
165
  description: 'pinned npx --version example',
167
166
  pattern: `npx -y @linzumi/cli@${oldVersion} --version`,
168
167
  replacement: `npx -y @linzumi/cli@${newVersion} --version`,
169
168
  },
170
- {
171
- file: 'test/packageManifest.test.ts',
172
- description: 'package manifest version expectation',
173
- pattern: `expect(manifest.version).toBe('${oldVersion}');`,
174
- replacement: `expect(manifest.version).toBe('${newVersion}');`,
175
- },
176
169
  ];
177
170
 
178
171
  function countOccurrences(haystack, needle) {
179
172
  return haystack.split(needle).length - 1;
180
173
  }
181
174
 
182
- // src/version.ts keeps a spec-comment block where each bump appends an entry.
183
- function appendVersionSpecComment(content) {
184
- const anchor = `*/\nexport const linzumiCliVersion = '${newVersion}';`;
185
-
186
- if (!content.includes(anchor)) {
175
+ // Spec: spec/deploy-pipeline-rules.md (rule22 step 3, the autobump
176
+ // inheritance). release-log.md is the release history (formerly the
177
+ // src/version.ts spec comment): each bump appends exactly this fixed entry at
178
+ // the end of the file. The entry never carries the exact version token (the
179
+ // same token rule as the leftover scan; `1.2.3-foo` is a distinct version) - the leftover scan
180
+ // below refuses the old version anywhere in the log, and the entry itself is
181
+ // refused when it would carry the new one (a release spec path naming it), so
182
+ // the NEXT bump's scan can never trip on this one.
183
+ const releaseLogFile = 'release-log.md';
184
+
185
+ function appendReleaseLogEntry(content) {
186
+ if (!content.endsWith('\n')) {
187
187
  fail(
188
- 'src/version.ts spec-comment block convention not found (expected the comment to close right before the linzumiCliVersion export)'
188
+ `${releaseLogFile} must end with a newline so the release entry appends as whole lines`
189
189
  );
190
190
  }
191
191
 
@@ -199,7 +199,13 @@ function appendVersionSpecComment(content) {
199
199
  '',
200
200
  ].join('\n');
201
201
 
202
- return content.replace(anchor, `${entry}${anchor}`);
202
+ if (versionToken(newVersion).test(entry)) {
203
+ fail(
204
+ `the ${releaseLogFile} entry would name '${newVersion}' (release spec ${releaseSpec}); the release log never carries a version literal`
205
+ );
206
+ }
207
+
208
+ return `${content}${entry}`;
203
209
  }
204
210
 
205
211
  const plannedWrites = new Map();
@@ -224,13 +230,10 @@ for (const site of knownSites) {
224
230
  );
225
231
  }
226
232
 
227
- let rewritten = content.split(site.pattern).join(site.replacement);
228
-
229
- if (site.file === 'src/version.ts') {
230
- rewritten = appendVersionSpecComment(rewritten);
231
- }
232
-
233
- plannedWrites.set(site.file, rewritten);
233
+ plannedWrites.set(
234
+ site.file,
235
+ content.split(site.pattern).join(site.replacement)
236
+ );
234
237
  summary.push({
235
238
  file: site.file,
236
239
  description: site.description,
@@ -238,11 +241,30 @@ for (const site of knownSites) {
238
241
  });
239
242
  }
240
243
 
244
+ {
245
+ let releaseLog;
246
+
247
+ try {
248
+ releaseLog = readFileSync(join(packageRoot, releaseLogFile), 'utf8');
249
+ } catch (error) {
250
+ fail(
251
+ `expected release log ${releaseLogFile} could not be read: ${error.message}`
252
+ );
253
+ }
254
+
255
+ plannedWrites.set(releaseLogFile, appendReleaseLogEntry(releaseLog));
256
+ summary.push({
257
+ file: releaseLogFile,
258
+ description: 'release log entry appended',
259
+ occurrences: 1,
260
+ });
261
+ }
262
+
241
263
  // Leftover scan: after the planned rewrites, no exact old-version token may remain
242
264
  // anywhere in the package surface. This is what catches an unlisted 8th site.
243
265
  function scanTargets() {
244
266
  const roots = ['src', 'test', 'scripts', 'bin'];
245
- const files = ['package.json', 'README.md'];
267
+ const files = ['package.json', 'README.md', releaseLogFile];
246
268
 
247
269
  // Spec: plans/2026-07-12-linzumi-unscoped-npm-package-spec.md
248
270
  // The alias version and canonical dependency are one release invariant.
@@ -309,10 +331,13 @@ function walk(directory) {
309
331
  // A dependency with a longer patch/prerelease/build is a distinct version,
310
332
  // not another CLI pin. Conventional artifact prefixes (v, cli-) introduce pins;
311
333
  // only numeric/dotted prefixes can extend the version itself.
312
- const escapedOldVersion = oldVersion.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
313
- const oldVersionToken = new RegExp(
314
- `(^|[^0-9.])${escapedOldVersion}(?=$|[^0-9A-Za-z.+-])`
315
- );
334
+ function versionToken(version) {
335
+ const escaped = version.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
336
+
337
+ return new RegExp(`(^|[^0-9.])${escaped}(?=$|[^0-9A-Za-z.+-])`);
338
+ }
339
+
340
+ const oldVersionToken = versionToken(oldVersion);
316
341
  const leftovers = [];
317
342
 
318
343
  for (const file of scanTargets()) {
@@ -367,6 +392,6 @@ if (dryRun) {
367
392
  process.stdout.write('Dry run - no files were written.\n');
368
393
  } else {
369
394
  process.stdout.write(
370
- 'Done. Now run the test suite before committing:\n pnpm vitest run --config vitest.config.mjs\nThen commit with a "[deploy-commander]" title and merge to main to publish.\n'
395
+ 'Done. Now run the test suite before committing:\n pnpm test\nThen commit with a "[deploy-commander]" title and merge to main to publish.\n'
371
396
  );
372
397
  }
@@ -1,383 +0,0 @@
1
- /*
2
- - Date: 2026-06-29
3
- Spec: plans/2026-06-29-claude-code-raw-replay-harness-plan.md
4
- Relationship: Vendors OpenAI Codex app-server generated TypeScript protocol
5
- schemas as a single declaration bundle so Commander replay/coverage tests can
6
- type-check against the real JSON-RPC protocol surface without committing the
7
- upstream one-file-per-type layout.
8
- */
9
- import { cp, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
10
- import { existsSync } from 'node:fs';
11
- import { tmpdir } from 'node:os';
12
- import { dirname, join, relative, resolve } from 'node:path';
13
- import { fileURLToPath } from 'node:url';
14
- import { spawn } from 'node:child_process';
15
-
16
- type VendorOptions = {
17
- readonly sourceRepo: string | undefined;
18
- readonly sourceUrl: string;
19
- readonly sourceRef: string;
20
- readonly outFile: string;
21
- readonly manifestFile: string;
22
- readonly keepTemp: boolean;
23
- readonly check: boolean;
24
- };
25
-
26
- type PreparedSource = {
27
- readonly repoPath: string;
28
- readonly cleanup: (() => Promise<void>) | undefined;
29
- };
30
-
31
- const thisFile = fileURLToPath(import.meta.url);
32
- const packageRoot = resolve(dirname(thisFile), '..');
33
- const protocolSubtree = 'codex-rs/app-server-protocol/schema/typescript';
34
- const defaultSourceUrl = 'https://github.com/openai/codex.git';
35
- const vendorModuleName = '@linzumi/vendor/codex-app-server-protocol';
36
- const defaultOutFile = join(
37
- packageRoot,
38
- 'src/vendor/codex-app-server-protocol.d.ts'
39
- );
40
- const defaultManifestFile = join(
41
- packageRoot,
42
- 'src/vendor/codex-app-server-protocol-manifest.json'
43
- );
44
-
45
- async function main(): Promise<void> {
46
- const args = process.argv.slice(2);
47
-
48
- if (args.includes('--help')) {
49
- printHelp();
50
- return;
51
- }
52
-
53
- const options = parseArgs(args);
54
- const source = await prepareSource(options);
55
-
56
- try {
57
- const sourceDir = join(source.repoPath, protocolSubtree);
58
-
59
- if (!existsSync(sourceDir)) {
60
- throw new Error(
61
- `Codex protocol schema directory not found: ${sourceDir}`
62
- );
63
- }
64
-
65
- const sourceCommit = await git(source.repoPath, ['rev-parse', 'HEAD']);
66
- if (options.check) {
67
- await checkVendoredOutput(options, sourceDir, sourceCommit.trim());
68
- process.stdout.write(
69
- `verified Codex app-server protocol declaration bundle\n`
70
- );
71
- } else {
72
- await writeDeclarationBundle(options, sourceDir, sourceCommit.trim());
73
- await writeManifest(options, sourceCommit.trim());
74
- process.stdout.write(
75
- `vendored Codex app-server protocol declaration bundle\n`
76
- );
77
- }
78
- process.stdout.write(` source: ${options.sourceUrl}\n`);
79
- process.stdout.write(` ref: ${options.sourceRef}\n`);
80
- process.stdout.write(` commit: ${sourceCommit.trim()}\n`);
81
- process.stdout.write(` module: ${vendorModuleName}\n`);
82
- process.stdout.write(` out: ${options.outFile}\n`);
83
- process.stdout.write(` manifest: ${options.manifestFile}\n`);
84
- } finally {
85
- await source.cleanup?.();
86
- }
87
- }
88
-
89
- function parseArgs(args: readonly string[]): VendorOptions {
90
- return {
91
- sourceRepo: optionalResolvedArg(args, '--codex-repo'),
92
- sourceUrl: argValue(args, '--source-url') ?? defaultSourceUrl,
93
- sourceRef: argValue(args, '--ref') ?? 'main',
94
- outFile: optionalResolvedArg(args, '--out-file') ?? defaultOutFile,
95
- manifestFile:
96
- optionalResolvedArg(args, '--manifest-file') ?? defaultManifestFile,
97
- keepTemp: args.includes('--keep-temp'),
98
- check: args.includes('--check'),
99
- };
100
- }
101
-
102
- async function checkVendoredOutput(
103
- options: VendorOptions,
104
- sourceDir: string,
105
- sourceCommit: string
106
- ): Promise<void> {
107
- const checkRoot = await mkdtemp(
108
- join(packageRoot, '.linzumi-codex-protocol-check-')
109
- );
110
-
111
- try {
112
- const expectedOutFile = join(checkRoot, 'codex-app-server-protocol.d.ts');
113
- const expectedManifestFile = join(
114
- checkRoot,
115
- 'codex-app-server-protocol-manifest.json'
116
- );
117
- const expectedOptions = {
118
- ...options,
119
- outFile: expectedOutFile,
120
- manifestFile: expectedManifestFile,
121
- check: false,
122
- };
123
-
124
- await writeDeclarationBundle(expectedOptions, sourceDir, sourceCommit);
125
- await writeManifest(expectedOptions, sourceCommit);
126
- await normalizeExpectedManifestForCommittedPaths(
127
- expectedManifestFile,
128
- options.outFile
129
- );
130
- await assertSameFile(expectedOutFile, options.outFile);
131
- await assertSameFile(expectedManifestFile, options.manifestFile);
132
- } finally {
133
- await rm(checkRoot, { recursive: true, force: true });
134
- }
135
- }
136
-
137
- async function normalizeExpectedManifestForCommittedPaths(
138
- manifestPath: string,
139
- committedOutFile: string
140
- ): Promise<void> {
141
- const manifest = JSON.parse(await readFile(manifestPath, 'utf8')) as Record<
142
- string,
143
- unknown
144
- >;
145
- const normalized = {
146
- ...manifest,
147
- declarationFile: relative(packageRoot, committedOutFile),
148
- };
149
-
150
- await writeFile(
151
- manifestPath,
152
- `${JSON.stringify(normalized, null, 2)}\n`,
153
- 'utf8'
154
- );
155
- }
156
-
157
- async function assertSameFile(
158
- expectedPath: string,
159
- actualPath: string
160
- ): Promise<void> {
161
- const expected = await readFile(expectedPath, 'utf8');
162
- const actual = await readFile(actualPath, 'utf8');
163
-
164
- if (expected !== actual) {
165
- throw new Error(
166
- `vendored Codex protocol drift detected: ${actualPath} does not match regenerated output`
167
- );
168
- }
169
- }
170
-
171
- async function prepareSource(options: VendorOptions): Promise<PreparedSource> {
172
- if (options.sourceRepo !== undefined) {
173
- return { repoPath: options.sourceRepo, cleanup: undefined };
174
- }
175
-
176
- const repoPath = await mkdtemp(join(tmpdir(), 'linzumi-openai-codex-'));
177
- await git(undefined, [
178
- 'clone',
179
- '--filter=blob:none',
180
- '--sparse',
181
- options.sourceUrl,
182
- repoPath,
183
- ]);
184
- await git(repoPath, ['sparse-checkout', 'set', protocolSubtree]);
185
- await git(repoPath, ['fetch', '--depth', '1', 'origin', options.sourceRef]);
186
- await git(repoPath, ['checkout', 'FETCH_HEAD']);
187
-
188
- return {
189
- repoPath,
190
- cleanup: options.keepTemp
191
- ? undefined
192
- : async () => {
193
- await rm(repoPath, { recursive: true, force: true });
194
- },
195
- };
196
- }
197
-
198
- async function writeDeclarationBundle(
199
- options: VendorOptions,
200
- sourceDir: string,
201
- sourceCommit: string
202
- ): Promise<void> {
203
- const bundleRoot = await mkdtemp(
204
- join(tmpdir(), 'linzumi-codex-protocol-dts-')
205
- );
206
-
207
- try {
208
- const copiedProtocolDir = join(bundleRoot, 'protocol');
209
- const entryFile = join(bundleRoot, 'entry.ts');
210
- const rawBundleFile = join(bundleRoot, 'raw-bundle.d.ts');
211
-
212
- await cp(sourceDir, copiedProtocolDir, { recursive: true });
213
- await writeFile(
214
- entryFile,
215
- [
216
- "export * from './protocol/index';",
217
- "export * as v2 from './protocol/v2/index';",
218
- '',
219
- ].join('\n'),
220
- 'utf8'
221
- );
222
-
223
- await command(packageRoot, [
224
- 'pnpm',
225
- 'exec',
226
- 'tsc',
227
- '--declaration',
228
- '--emitDeclarationOnly',
229
- '--outFile',
230
- rawBundleFile,
231
- '--module',
232
- 'amd',
233
- '--moduleResolution',
234
- 'node',
235
- '--target',
236
- 'ES2022',
237
- '--skipLibCheck',
238
- entryFile,
239
- ]);
240
-
241
- const rawBundle = await readFile(rawBundleFile, 'utf8');
242
- const bundled = rawBundle
243
- .replaceAll(
244
- 'declare module "protocol/',
245
- `declare module "${vendorModuleName}/`
246
- )
247
- .replaceAll('from "protocol/', `from "${vendorModuleName}/`)
248
- .replace(
249
- 'declare module "entry" {',
250
- `declare module "${vendorModuleName}" {`
251
- );
252
- const header = [
253
- '// GENERATED CODE! DO NOT MODIFY BY HAND!',
254
- '// Bundled from OpenAI Codex app-server protocol TypeScript schemas.',
255
- `// Source commit: ${sourceCommit}`,
256
- `// Module: ${vendorModuleName}`,
257
- '',
258
- ].join('\n');
259
-
260
- await mkdir(dirname(options.outFile), { recursive: true });
261
- await writeFile(options.outFile, `${header}${bundled}`, 'utf8');
262
- await formatGeneratedFile(options.outFile);
263
- } finally {
264
- await rm(bundleRoot, { recursive: true, force: true });
265
- }
266
- }
267
-
268
- async function formatGeneratedFile(path: string): Promise<void> {
269
- await command(packageRoot, [
270
- 'pnpm',
271
- 'exec',
272
- 'biome',
273
- 'format',
274
- '--write',
275
- '--no-errors-on-unmatched',
276
- path,
277
- ]);
278
- }
279
-
280
- async function writeManifest(
281
- options: VendorOptions,
282
- sourceCommit: string
283
- ): Promise<void> {
284
- const manifest = {
285
- source: 'openai/codex codex-rs/app-server-protocol/schema/typescript',
286
- sourceUrl: options.sourceUrl,
287
- requestedRef: options.sourceRef,
288
- sourceCommit,
289
- protocolSubtree,
290
- moduleName: vendorModuleName,
291
- declarationFile: relative(packageRoot, options.outFile),
292
- updateCommand:
293
- 'pnpm --filter @linzumi/cli run vendor:codex-app-server-protocol -- --ref <openai-codex-ref>',
294
- };
295
-
296
- await mkdir(dirname(options.manifestFile), { recursive: true });
297
- await writeFile(
298
- options.manifestFile,
299
- `${JSON.stringify(manifest, null, 2)}\n`,
300
- 'utf8'
301
- );
302
- }
303
-
304
- function optionalResolvedArg(
305
- args: readonly string[],
306
- name: string
307
- ): string | undefined {
308
- const value = argValue(args, name);
309
- return value === undefined ? undefined : resolve(value);
310
- }
311
-
312
- function argValue(args: readonly string[], name: string): string | undefined {
313
- const index = args.indexOf(name);
314
-
315
- if (index === -1) {
316
- return undefined;
317
- }
318
-
319
- const value = args[index + 1];
320
-
321
- if (value === undefined) {
322
- throw new Error(`${name} requires a value`);
323
- }
324
-
325
- return value;
326
- }
327
-
328
- function git(
329
- cwd: string | undefined,
330
- args: readonly string[]
331
- ): Promise<string> {
332
- return command(cwd, ['git', ...args]);
333
- }
334
-
335
- function command(
336
- cwd: string | undefined,
337
- args: readonly string[]
338
- ): Promise<string> {
339
- return new Promise((resolvePromise, reject) => {
340
- const [commandName, ...commandArgs] = args;
341
-
342
- if (commandName === undefined) {
343
- reject(new Error('command requires at least one argument'));
344
- return;
345
- }
346
-
347
- const child = spawn(commandName, commandArgs, {
348
- cwd,
349
- stdio: ['ignore', 'pipe', 'pipe'],
350
- });
351
- const stdout: string[] = [];
352
- const stderr: string[] = [];
353
-
354
- child.stdout.on('data', (chunk) => stdout.push(String(chunk)));
355
- child.stderr.on('data', (chunk) => stderr.push(String(chunk)));
356
- child.on('error', reject);
357
- child.on('close', (code) => {
358
- if (code === 0) {
359
- resolvePromise(stdout.join(''));
360
- return;
361
- }
362
-
363
- reject(
364
- new Error(
365
- `${args.join(' ')} failed with exit ${code}: ${stderr.join('')}`
366
- )
367
- );
368
- });
369
- });
370
- }
371
-
372
- function printHelp(): void {
373
- process.stdout.write(
374
- `Usage: pnpm run vendor:codex-app-server-protocol -- [options]\n\nOptions:\n --codex-repo <path> Bundle from an existing OpenAI Codex checkout\n --ref <ref> Git ref to vendor when cloning. Default: main\n --source-url <url> Codex git URL. Default: ${defaultSourceUrl}\n --out-file <path> Declaration bundle path. Default: src/vendor/codex-app-server-protocol.d.ts\n --manifest-file <path> Manifest path. Default: src/vendor/codex-app-server-protocol-manifest.json\n --keep-temp Keep temporary clone when cloning\n --check Regenerate into a temp directory and fail if committed files differ\n\nExamples:\n pnpm --filter @linzumi/cli run vendor:codex-app-server-protocol -- --ref main\n pnpm --filter @linzumi/cli run vendor:codex-app-server-protocol -- --codex-repo /tmp/openai-codex\n pnpm --filter @linzumi/cli run vendor:codex-app-server-protocol -- --codex-repo /tmp/openai-codex --check\n`
375
- );
376
- }
377
-
378
- main().catch((error) => {
379
- process.stderr.write(
380
- `${error instanceof Error ? (error.stack ?? error.message) : String(error)}\n`
381
- );
382
- process.exitCode = 1;
383
- });