diff --git a/packages/coding-agent/src/prompts/system/plan-mode-approved.md b/packages/coding-agent/src/prompts/system/plan-mode-approved.md index 55a43e6c2..b4d7d3974 100644 --- a/packages/coding-agent/src/prompts/system/plan-mode-approved.md +++ b/packages/coding-agent/src/prompts/system/plan-mode-approved.md @@ -9,7 +9,6 @@ Context was preserved for execution. Use the existing conversation history when Execution may be running in fresh context. Treat the finalized plan as the source of truth. {{/if}} - ## Plan {{planContent}} diff --git a/packages/coding-agent/test/autocomplete-max-visible.test.ts b/packages/coding-agent/test/autocomplete-max-visible.test.ts index 25b536a06..3ebd767b9 100644 --- a/packages/coding-agent/test/autocomplete-max-visible.test.ts +++ b/packages/coding-agent/test/autocomplete-max-visible.test.ts @@ -54,13 +54,16 @@ describe("autocompleteMaxVisible setting", () => { const settings = await Settings.init({ cwd: projectDir, agentDir }); expect(settings.get("autocompleteMaxVisible")).toBe(15); }); - + it("should let project config.yml override global config.yml", async () => { await Bun.write(path.join(agentDir, "config.yml"), YAML.stringify({ autocompleteMaxVisible: 15 }, null, 2)); - await Bun.write(path.join(getProjectAgentDir(projectDir), "config.yml"), YAML.stringify({ autocompleteMaxVisible: 20 }, null, 2)); - + await Bun.write( + path.join(getProjectAgentDir(projectDir), "config.yml"), + YAML.stringify({ autocompleteMaxVisible: 20 }, null, 2), + ); + const settings = await Settings.init({ cwd: projectDir, agentDir }); - + expect(settings.get("autocompleteMaxVisible")).toBe(20); }); diff --git a/packages/stats/build.ts b/packages/stats/build.ts index 071eccb7a..28de76b81 100644 --- a/packages/stats/build.ts +++ b/packages/stats/build.ts @@ -1,7 +1,6 @@ import * as fs from "node:fs/promises"; import * as path from "node:path"; import { compile } from "@tailwindcss/node"; -import { validateClientBundleReactVersions } from "./scripts/client-bundle-validation"; /** * Extract Tailwind class names from source files by scanning for className attributes. @@ -55,7 +54,6 @@ const result = await Bun.build({ outdir: "./dist/client", minify: true, naming: "[dir]/[name].[ext]", - metafile: true, }); if (!result.success) { @@ -66,14 +64,6 @@ if (!result.success) { process.exit(1); } -try { - const versions = await validateClientBundleReactVersions(result.metafile); - console.log(`Verified React bundle versions: react ${versions.react}, react-dom ${versions["react-dom"]}`); -} catch (error) { - console.error(error instanceof Error ? error.message : error); - process.exit(1); -} - // Create index.html const indexHtml = ` diff --git a/packages/stats/package.json b/packages/stats/package.json index bf9c9fb44..e95740d51 100644 --- a/packages/stats/package.json +++ b/packages/stats/package.json @@ -60,7 +60,6 @@ "files": [ "src", "build.ts", - "scripts/client-bundle-validation.ts", "tailwind.config.js", "README.md" ], diff --git a/packages/stats/scripts/client-bundle-validation.ts b/packages/stats/scripts/client-bundle-validation.ts deleted file mode 100644 index 5e7dcb45c..000000000 --- a/packages/stats/scripts/client-bundle-validation.ts +++ /dev/null @@ -1,87 +0,0 @@ -import * as path from "node:path"; - -type BundlePackage = "react" | "react-dom"; - -export interface ClientBundleReactVersions { - react: string | null; - "react-dom": string | null; -} - -interface PackageResolution { - name: BundlePackage; - root: string; -} - -function resolveBundledPackage(inputPath: string, cwd: string): PackageResolution | null { - const absolutePath = path.resolve(cwd, inputPath); - const parts = absolutePath.split(path.sep); - const nodeModulesIndex = parts.lastIndexOf("node_modules"); - if (nodeModulesIndex === -1) return null; - - const packageName = parts[nodeModulesIndex + 1]; - if (packageName !== "react" && packageName !== "react-dom") return null; - - return { - name: packageName, - root: parts.slice(0, nodeModulesIndex + 2).join(path.sep) || path.sep, - }; -} - -async function readPackageVersion(packageRoot: string): Promise { - const packageJson = (await Bun.file(path.join(packageRoot, "package.json")).json()) as { version?: unknown }; - if (typeof packageJson.version !== "string" || packageJson.version.length === 0) { - throw new Error(`Missing version in ${path.join(packageRoot, "package.json")}`); - } - return packageJson.version; -} - -export async function validateClientBundleReactVersions( - metafile: Bun.BuildMetafile | undefined, - cwd = process.cwd(), -): Promise { - if (!metafile) { - throw new Error("Stats client build did not emit a metafile; cannot verify bundled React versions"); - } - - const packageRoots: Record> = { - react: new Set(), - "react-dom": new Set(), - }; - - for (const inputPath of Object.keys(metafile.inputs)) { - const resolution = resolveBundledPackage(inputPath, cwd); - if (resolution) packageRoots[resolution.name].add(resolution.root); - } - - const versions: Record> = { - react: new Set(), - "react-dom": new Set(), - }; - - for (const packageName of ["react", "react-dom"] as const) { - for (const packageRoot of packageRoots[packageName]) { - versions[packageName].add(await readPackageVersion(packageRoot)); - } - } - - const reactVersions = [...versions.react].sort(); - const reactDomVersions = [...versions["react-dom"]].sort(); - const resolved: ClientBundleReactVersions = { - react: reactVersions.length === 1 ? reactVersions[0] : null, - "react-dom": reactDomVersions.length === 1 ? reactDomVersions[0] : null, - }; - - if (reactVersions.length !== 1 || reactDomVersions.length !== 1) { - throw new Error( - `Stats client bundle must include exactly one react and one react-dom version; got react: ${reactVersions.join(", ") || "none"}, react-dom: ${reactDomVersions.join(", ") || "none"}`, - ); - } - - if (resolved.react !== resolved["react-dom"]) { - throw new Error( - `Stats client bundle has incompatible React versions: react ${resolved.react}, react-dom ${resolved["react-dom"]}`, - ); - } - - return resolved; -} diff --git a/packages/stats/test/client-bundle-validation.test.ts b/packages/stats/test/client-bundle-validation.test.ts deleted file mode 100644 index 4afced1c6..000000000 --- a/packages/stats/test/client-bundle-validation.test.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { afterEach, describe, expect, it } from "bun:test"; -import * as fs from "node:fs/promises"; -import * as os from "node:os"; -import * as path from "node:path"; -import { validateClientBundleReactVersions } from "../scripts/client-bundle-validation"; - -let tempDir: string | null = null; - -afterEach(async () => { - if (tempDir) await fs.rm(tempDir, { recursive: true, force: true }); - tempDir = null; -}); - -async function writePackageVersion(packageName: "react" | "react-dom", version: string): Promise { - if (!tempDir) tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "omp-stats-react-bundle-")); - const packageRoot = path.join(tempDir, "node_modules", packageName); - await fs.mkdir(packageRoot, { recursive: true }); - await Bun.write(path.join(packageRoot, "package.json"), JSON.stringify({ name: packageName, version })); - await Bun.write(path.join(packageRoot, "index.js"), "export {};"); - return path.join(packageRoot, "index.js"); -} - -function metafileFor(inputs: string[]): Bun.BuildMetafile { - return { - inputs: Object.fromEntries(inputs.map(input => [input, { bytes: 1, imports: [] }])), - outputs: {}, - }; -} - -describe("stats client React bundle validation", () => { - it("accepts a bundle with matching react and react-dom versions", async () => { - const reactInput = await writePackageVersion("react", "19.2.5"); - const reactDomInput = await writePackageVersion("react-dom", "19.2.5"); - - await expect(validateClientBundleReactVersions(metafileFor([reactInput, reactDomInput]))).resolves.toEqual({ - react: "19.2.5", - "react-dom": "19.2.5", - }); - }); - - it("rejects a bundle with mismatched react and react-dom versions", async () => { - const reactInput = await writePackageVersion("react", "19.2.0"); - const reactDomInput = await writePackageVersion("react-dom", "19.2.5"); - - await expect(validateClientBundleReactVersions(metafileFor([reactInput, reactDomInput]))).rejects.toThrow( - "Stats client bundle has incompatible React versions: react 19.2.0, react-dom 19.2.5", - ); - }); -});