Files
vscode/build/codex/generate-protocol.d.mts
T
Giuseppe CianciandCopilot 5f3d6235d8 build: verify codex protocol client is regenerated in lockstep
Add a PR CI check that fails when the committed codex app-server protocol
client (src/vs/platform/agentHost/node/codex/protocol/generated/**) does not
match what `codex app-server generate-ts` produces for the @openai/codex
dev-dependency version, but only when a PR actually changes the generated
client or the version pin.

- build/codex/generate-protocol.mjs: export the reusable pieces (generate,
  resolveCodexBinary, readBinaryVersion, readPinnedVersion, paths) and only
  run main() when invoked directly, so the check can import it side-effect
  free. Types provided by generate-protocol.d.mts.
- build/codex/check-protocol-sync.ts: gate on a git diff touching the
  generated dir or codex-version.txt (its README.md excluded — preserved
  across regen), regenerate into a scratch dir with the dev-dependency binary,
  byte-compare against the committed client, and assert the pin matches. Never
  touches the working tree.
- build/codex/test/checkProtocolSync.test.ts: unit tests for the gate + diff
  helpers; wired in via the build/package.json test glob (adds `codex`).
- package.json: `codex:check-protocol` script.
- .github/workflows/pr.yml: run the gated check in the Compile & Hygiene job.
- generated/README.md: document the check.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-10 13:40:10 +02:00

34 lines
1.6 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Type declarations for the (plain-JS) codex protocol generator, so the TypeScript freshness
// check (check-protocol-sync.ts) can import its reusable pieces. The runnable logic lives in
// generate-protocol.mjs.
/** Absolute path to the repository root. */
export declare const REPO_ROOT: string;
/** Absolute path to the generated protocol client directory. */
export declare const OUT_DIR: string;
/** Absolute path to build/codex/codex-version.txt (the pinned codex version). */
export declare const VERSION_FILE: string;
/** Resolves the codex binary ($CODEX_BIN, vendored npm package, or PATH). */
export declare function resolveCodexBinary(): string;
/** Reads the `codex --version` of the given binary. */
export declare function readBinaryVersion(bin: string): string;
/** Reads the pinned version from build/codex/codex-version.txt. */
export declare function readPinnedVersion(): string;
/**
* Regenerates the protocol client into `outDir` using `bin`, stamping `codexVersion` into the
* per-file header. Wipes `outDir` first (except README.md). Output is byte-identical regardless
* of `outDir`, so a scratch-dir regeneration can be compared against the committed client.
*/
export declare function generate(bin: string, outDir: string, codexVersion: string): void;