| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import assert from "node:assert/strict";
- import test from "node:test";
- import { readFile } from "node:fs/promises";
- import { TOOL_DEFINITIONS } from "../src/mcp-server.js";
- test("README commands match package scripts and the executable MCP schemas", async () => {
- const [readme, packageText, gitVerifier] = await Promise.all([
- readFile(new URL("../../README.md", import.meta.url), "utf8"),
- readFile(new URL("../../package.json", import.meta.url), "utf8"),
- readFile(new URL("../../scripts/verify-git-package.mjs", import.meta.url), "utf8"),
- ]);
- const packageJson = JSON.parse(packageText) as {
- bin: Record<string, string>;
- files: string[];
- scripts: Record<string, string>;
- };
- for (const script of [
- "typecheck",
- "compile",
- "test",
- "start",
- "smoke",
- "verify:runtime",
- "verify:git-package",
- "verify:package",
- "pack:verified",
- ]) {
- assert.equal(typeof packageJson.scripts[script], "string");
- assert.equal(
- readme.includes(`npm run ${script}`)
- || (script === "start" && readme.includes("npm start"))
- || (script === "test" && readme.includes("npm test")),
- true,
- );
- }
- assert.equal(packageJson.bin["codex-chief-of-staff"], "dist/src/index.js");
- assert.deepEqual(packageJson.files, ["dist/src", "README.md"]);
- for (const tool of TOOL_DEFINITIONS) {
- assert.equal(readme.includes(`\`${tool.name}(`), true, `README is missing ${tool.name}`);
- }
- assert.match(readme, /codex mcp add codex-chief-of-staff/);
- assert.match(readme, /codex mcp remove codex-chief-of-staff/);
- assert.match(readme, /npm install --global/);
- assert.doesNotMatch(readme, /npm run build|prepack/);
- assert.match(readme, /git\+https:\/\/git\.bodicsek\.host\/bodicsek\/codex-chief-of-staff\.git#v0\.1\.1/);
- assert.match(readme, /full 40-character commit/i);
- assert.match(readme, /Do not use `#main`/);
- assert.match(readme, /end-user install intentionally omits `--prefix`/);
- assert.match(readme, /Restart Codex CLI after installation/);
- assert.match(readme, /0\.1\.0\.tgz/);
- assert.match(readme, /npm uninstall --global codex-chief-of-staff/);
- assert.match(readme, /command -v codex-chief-of-staff/);
- assert.match(readme, /-- codex-chief-of-staff/);
- for (const argument of ["--global", "--prefix", "--ignore-scripts", "--cache"]) {
- assert.equal(gitVerifier.includes(`"${argument}"`), true, `Git verifier is missing ${argument}`);
- }
- });
|