Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

fix(eve): bootstrap the exact pnpm release under release-age policy (#2328)

OwenKephart84ddb098eeeb
diff --git a/.changeset/exact-eve-bootstrap-age.md b/.changeset/exact-eve-bootstrap-age.md
new file mode 100644
index 000000000..e57a8a5aa
--- /dev/null
+++ b/.changeset/exact-eve-bootstrap-age.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Apply release-age policies during project and extension setup instead of bypassing them. New standalone pnpm projects use strict enforcement, while projects inside an existing workspace retain that workspace's policy.
diff --git a/packages/eve/src/cli/commands/extension-init.integration.test.ts b/packages/eve/src/cli/commands/extension-init.integration.test.ts
index 7bfb47c47..06098458b 100644
--- a/packages/eve/src/cli/commands/extension-init.integration.test.ts
+++ b/packages/eve/src/cli/commands/extension-init.integration.test.ts
@@ -132,7 +132,7 @@ describe("runExtensionInitCommand", () => {
expect(deps.runPackageManagerInstall).toHaveBeenCalledWith(
"pnpm",
projectPath,
- expect.objectContaining({ bypassMinimumReleaseAge: true }),
+ expect.any(Object),
);
expect(deps.tryInitializeGit).toHaveBeenCalledWith(projectPath);
diff --git a/packages/eve/src/cli/commands/extension-init.ts b/packages/eve/src/cli/commands/extension-init.ts
index ca8cde9fe..37c1105b4 100644
--- a/packages/eve/src/cli/commands/extension-init.ts
+++ b/packages/eve/src/cli/commands/extension-init.ts
@@ -285,7 +285,6 @@ export async function runExtensionInitCommand(
const installFailureOutput: string[] = [];
const recentInstallOutput: string[] = [];
const installResult = await dependencies.runPackageManagerInstall(packageManager, projectPath, {
- bypassMinimumReleaseAge: true,
progressDetails: process.stdout.isTTY === true && !debug,
onOutput: (line) => {
if (line.text.trim() !== "") {
diff --git a/packages/eve/src/cli/commands/init.integration.test.ts b/packages/eve/src/cli/commands/init.integration.test.ts
index a54922f7a..3af12a0d3 100644
--- a/packages/eve/src/cli/commands/init.integration.test.ts
+++ b/packages/eve/src/cli/commands/init.integration.test.ts
@@ -39,9 +39,6 @@ const BASE_VERSIONS = {
zodPackageVersion: "4.0.0",
} as const;
-const RELEASE_AGE_POLICY =
- 'minimumReleaseAgeExclude:\n - "@ai-sdk/*"\n - "@rolldown/*"\n - "@vercel/*"\n - "@workflow/*"\n - ai\n - experimental-ai-sdk-code-mode\n - eve\n - nitro\n - rolldown\n - workflow\n';
-
const WEB_VERSIONS = {
...BASE_VERSIONS,
nextPackageVersion: "16.0.0",
@@ -172,11 +169,10 @@ describe("runInitCommand", () => {
expect(deps.runPackageManagerInstall).toHaveBeenCalledWith(
"pnpm",
projectPath,
- expect.objectContaining({ bypassMinimumReleaseAge: true }),
+ expect.any(Object),
);
expect(deps.tryInitializeGit).toHaveBeenCalledWith(projectPath);
expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectPath, [
- "--config.minimum-release-age=0",
"exec",
"eve",
"dev",
@@ -270,13 +266,13 @@ describe("runInitCommand", () => {
expect.objectContaining({
command: "codex",
cwd: projectPath,
- prompt: expect.stringContaining("pnpm --config.minimum-release-age=0 exec eve dev --no-ui"),
+ prompt: expect.stringContaining("pnpm exec eve dev --no-ui"),
}),
);
const prompt = deps.spawnCodingAgentRepl.mock.calls[0]?.[0].prompt;
expect(prompt).toBe(
initAgentReplPrompt({
- devCommand: "pnpm --config.minimum-release-age=0 exec eve dev",
+ devCommand: "pnpm exec eve dev",
}),
);
expect(prompt).toContain("What should the agent do?");
@@ -367,11 +363,10 @@ describe("runInitCommand", () => {
expect(deps.runPackageManagerInstall).toHaveBeenCalledWith(
"pnpm",
projectPath,
- expect.objectContaining({ bypassMinimumReleaseAge: true }),
+ expect.any(Object),
);
expect(deps.tryInitializeGit).toHaveBeenCalledWith(projectPath);
expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectPath, [
- "--config.minimum-release-age=0",
"exec",
"eve",
"dev",
@@ -473,12 +468,7 @@ describe("runInitCommand", () => {
["npm", "package-lock.json", "bun", ["exec", "--", "eve", "dev", "--input", "/model"]],
["yarn", "yarn.lock", "npm", ["eve", "dev", "--input", "/model"]],
["bun", "bun.lock", "npm", ["x", "eve", "dev", "--input", "/model"]],
- [
- "pnpm",
- "pnpm-lock.yaml",
- "npm",
- ["--config.minimum-release-age=0", "exec", "eve", "dev", "--input", "/model"],
- ],
+ ["pnpm", "pnpm-lock.yaml", "npm", ["exec", "eve", "dev", "--input", "/model"]],
] as const)(
"scaffolds a fresh named project with the ancestor %s lockfile before the launcher",
async (kind, lockfile, invokingManager, devArguments) => {
@@ -519,7 +509,11 @@ describe("runInitCommand", () => {
`${JSON.stringify({ private: true, engines: { node: "22.x" } }, null, 2)}\n`,
"utf8",
);
- await writeFile(join(workspaceRoot, "pnpm-workspace.yaml"), "packages:\n - apps/*\n", "utf8");
+ await writeFile(
+ join(workspaceRoot, "pnpm-workspace.yaml"),
+ "minimumReleaseAgeStrict: false\npackages:\n - apps/*\n",
+ "utf8",
+ );
const output = logger();
const deps = dependencies();
deps.detectInvokingPackageManager.mockReturnValue("npm");
@@ -529,7 +523,7 @@ describe("runInitCommand", () => {
const projectPath = join(appsDirectory, "my-agent");
await expect(pathExists(join(projectPath, "pnpm-workspace.yaml"))).resolves.toBe(false);
await expect(readFile(join(workspaceRoot, "pnpm-workspace.yaml"), "utf8")).resolves.toBe(
- `packages:\n - apps/*\n\nallowBuilds:\n sharp: false\n\n${RELEASE_AGE_POLICY}`,
+ "minimumReleaseAgeStrict: false\npackages:\n - apps/*\n\nallowBuilds:\n sharp: false\n",
);
const projectPackageJson = JSON.parse(
await readFile(join(projectPath, "package.json"), "utf8"),
@@ -578,7 +572,7 @@ describe("runInitCommand", () => {
const projectPath = join(agentsDirectory, "my-agent");
await expect(pathExists(join(projectPath, "pnpm-workspace.yaml"))).resolves.toBe(false);
await expect(readFile(join(workspaceRoot, "pnpm-workspace.yaml"), "utf8")).resolves.toBe(
- `packages:\n - apps/*\n - agents/*\n\nallowBuilds:\n sharp: false\n\n${RELEASE_AGE_POLICY}`,
+ "packages:\n - apps/*\n - agents/*\n\nallowBuilds:\n sharp: false\n",
);
const projectPackageJson = JSON.parse(
await readFile(join(projectPath, "package.json"), "utf8"),
@@ -620,7 +614,7 @@ describe("runInitCommand", () => {
await expect(pathExists(join(projectPath, "app/page.tsx"))).resolves.toBe(true);
await expect(pathExists(join(projectPath, "pnpm-workspace.yaml"))).resolves.toBe(false);
await expect(readFile(join(workspaceRoot, "pnpm-workspace.yaml"), "utf8")).resolves.toBe(
- `packages:\n - apps/*\n - agents/*\n\nallowBuilds:\n sharp: false\n\n${RELEASE_AGE_POLICY}`,
+ "packages:\n - apps/*\n - agents/*\n\nallowBuilds:\n sharp: false\n",
);
const projectPackageJson = JSON.parse(
await readFile(join(projectPath, "package.json"), "utf8"),
@@ -747,7 +741,6 @@ describe("runInitCommand", () => {
`Git initialization failed during commit: commit refused\nThe eve agent was created successfully. Git repository metadata and staged files were preserved at "${projectPath}"; the initial commit is optional.\n\nTo create it later, configure Git identity and run:\n git -C ${JSON.stringify(projectPath)} commit -m "Initial commit from eve"`,
);
expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectPath, [
- "--config.minimum-release-age=0",
"exec",
"eve",
"dev",
@@ -770,17 +763,12 @@ describe("runInitCommand", () => {
"export default withEve(nextConfig);",
);
expect(await readFile(join(projectPath, "package.json"), "utf8")).toContain('"eve": "^0.6.0"');
- // The compatibility extension stays limited to releases with the incomplete manifest.
- expect(await readFile(join(projectPath, "pnpm-workspace.yaml"), "utf8")).toContain(
- '"eve@>=0.6.0-beta.13 <=0.7.0":',
- );
expect(deps.runPackageManagerInstall).toHaveBeenCalledWith(
"pnpm",
projectPath,
expect.anything(),
);
expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectPath, [
- "--config.minimum-release-age=0",
"exec",
"eve",
"dev",
@@ -842,9 +830,6 @@ describe("runInitCommand", () => {
dependencies: { "@vercel/connect": "0.2.2", ai: "7.0.0", eve: "^0.6.0", zod: "^3.25.0" },
engines: { node: "24.x" },
});
- expect(await readFile(join(projectRoot, "pnpm-workspace.yaml"), "utf8")).toContain(
- '"eve@>=0.6.0-beta.13 <=0.7.0":',
- );
expect(deps.runPackageManagerInstall).toHaveBeenCalledWith(
"pnpm",
projectRoot,
@@ -854,7 +839,6 @@ describe("runInitCommand", () => {
expect(deps.tryInitializeGit).not.toHaveBeenCalled();
expect(deps.confirmInitInNonEmptyDirectory).not.toHaveBeenCalled();
expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectRoot, [
- "--config.minimum-release-age=0",
"exec",
"eve",
"dev",
@@ -1171,7 +1155,7 @@ describe("runInitCommand", () => {
const messages = stripAnsi(output.messages.join("\n"));
expect(messages).toContain(`✓ Model ${DEFAULT_AGENT_MODEL_ID} (eve default)`);
expect(messages).toContain(`✓ Instructions ${join(projectPath, "agent/instructions.md")}`);
- expect(messages).toContain("pnpm --config.minimum-release-age=0 exec eve dev --no-ui");
+ expect(messages).toContain("pnpm exec eve dev --no-ui");
});
it("derives the agent dev handoff command from the existing project's own manager", async () => {
@@ -1210,8 +1194,8 @@ describe("runInitCommand", () => {
expect(deps.spawnPackageManager).not.toHaveBeenCalled();
});
- it("carries the pnpm release-age bypass into the dev handoff", async () => {
- const parentDirectory = await mkdtemp(join(tmpdir(), "eve-init-dev-release-age-"));
+ it("hands off to pnpm dev without extra configuration", async () => {
+ const parentDirectory = await mkdtemp(join(tmpdir(), "eve-init-dev-"));
const output = logger();
const deps = dependencies();
@@ -1222,7 +1206,7 @@ describe("runInitCommand", () => {
expect(deps.spawnPackageManager).toHaveBeenCalledWith(
"pnpm",
join(parentDirectory, "my-agent"),
- ["--config.minimum-release-age=0", "exec", "eve", "dev", "--input", "/model"],
+ ["exec", "eve", "dev", "--input", "/model"],
);
});
diff --git a/packages/eve/src/cli/commands/init.ts b/packages/eve/src/cli/commands/init.ts
index f0bcbee88..e10e38392 100644
--- a/packages/eve/src/cli/commands/init.ts
+++ b/packages/eve/src/cli/commands/init.ts
@@ -135,13 +135,6 @@ function formatWorkspaceRootMutationWarning(mutation: WorkspaceRootMutation): st
return `Updated workspace root ${target} at ${mutation.path}${suffix}`;
}
-function initDevArguments(packageManager: PackageManagerKind): string[] {
- const args = [...eveDevArguments(packageManager)];
- // The immediately preceding install already accepted the project's dependency
- // graph with this one-run bypass, so the handoff must use the same policy.
- return packageManager === "pnpm" ? ["--config.minimum-release-age=0", ...args] : args;
-}
-
/**
* Adds the agent to an existing project and returns the
* detected manager, which drives the install and dev handoff.
@@ -482,9 +475,6 @@ async function runInitSteps(input: {
project.packageManager,
project.projectPath,
{
- // The scaffold pins versions younger than typical release-age cooldown
- // windows; gating them would fail every fresh bootstrap.
- bypassMinimumReleaseAge: true,
progressDetails: process.stdout.isTTY === true && !debug,
onOutput: (line) => {
if (line.text.trim() !== "") {
@@ -621,7 +611,7 @@ export async function runInitCommand(
}
}
- const baseDevArguments = initDevArguments(result.packageManager);
+ const baseDevArguments = [...eveDevArguments(result.packageManager)];
const agentDevCommand = [result.packageManager, ...baseDevArguments].join(" ");
const agentHandoff = initAgentDevHandoff({
projectPath: result.projectPath,
diff --git a/packages/eve/src/setup/primitives/pm/npm.ts b/packages/eve/src/setup/primitives/pm/npm.ts
index c080cce3d..69bdfe93e 100644
--- a/packages/eve/src/setup/primitives/pm/npm.ts
+++ b/packages/eve/src/setup/primitives/pm/npm.ts
@@ -8,7 +8,6 @@ export const npmPackageManager = {
devArguments: () => ["exec", "--", "eve", "dev"],
installArguments: (options) => [
"install",
- ...(options.bypassMinimumReleaseAge === true ? ["--min-release-age=0"] : []),
...(options.progressDetails === true ? ["--loglevel=silly"] : []),
],
prepareArguments: (_projectRoot, args) => args,
diff --git a/packages/eve/src/setup/primitives/pm/pnpm.ts b/packages/eve/src/setup/primitives/pm/pnpm.ts
index d5bc7ad3b..be33fcfa0 100644
--- a/packages/eve/src/setup/primitives/pm/pnpm.ts
+++ b/packages/eve/src/setup/primitives/pm/pnpm.ts
@@ -12,47 +12,16 @@ import type { PackageManagerStrategy } from "./types.js";
export const PNPM_WORKSPACE_PATH = "pnpm-workspace.yaml";
export const PNPM_WORKSPACE_MEMBERSHIP_ARGUMENTS = ["list", "--depth", "-1", "--json"] as const;
-const RELEASE_AGE_EXCLUSIONS = [
- "@ai-sdk/*",
- "@rolldown/*",
- "@vercel/*",
- "@workflow/*",
- "ai",
- "experimental-ai-sdk-code-mode",
- "eve",
- "nitro",
- "rolldown",
- "workflow",
-] as const;
-
-function formatReleaseAgeExclusion(exclusion: string): string {
- return ` - ${exclusion.includes("*") ? JSON.stringify(exclusion) : exclusion}`;
-}
-// [email protected] through 0.7.0 imported `oxc-parser` at runtime while
-// declaring it only as a devDependency. Fixed releases use their own manifest.
+const SHARP_BUILD_POLICY = " sharp: false";
+
export const PNPM_WORKSPACE_CONTENT = [
- "minimumReleaseAgeExclude:",
- ...RELEASE_AGE_EXCLUSIONS.map(formatReleaseAgeExclusion),
+ "minimumReleaseAgeStrict: true",
"allowBuilds:",
- " sharp: false",
- "# Compatibility for eve releases with an incomplete runtime manifest.",
- "packageExtensions:",
- ' "eve@>=0.6.0-beta.13 <=0.7.0":',
- " dependencies:",
- " oxc-parser: 0.134.0",
+ SHARP_BUILD_POLICY,
"",
].join("\n");
-const SHARP_BUILD_POLICY = " sharp: false";
-
-function releaseAgeExclusionName(line: string): string {
- return line
- .trim()
- .replace(/^-\s+/u, "")
- .replace(/^["']|["']$/gu, "");
-}
-
function findYamlBlockEnd(lines: readonly string[], startIndex: number): number {
let blockEnd = startIndex + 1;
while (blockEnd < lines.length) {
@@ -63,57 +32,28 @@ function findYamlBlockEnd(lines: readonly string[], startIndex: number): number
return blockEnd;
}
-function withSharpBuildPolicy(source: string): string {
+function withPnpmWorkspacePolicy(source: string): string {
const normalized = source.endsWith("\n") ? source : `${source}\n`;
- const lines = normalized.split("\n");
- const allowBuildsIndex = lines.findIndex((line) => line === "allowBuilds:");
+ const policyLines = normalized.split("\n");
+ const allowBuildsIndex = policyLines.findIndex((line) => line === "allowBuilds:");
if (allowBuildsIndex < 0) {
const prefix = normalized.trim().length === 0 ? "" : `${normalized}\n`;
return `${prefix}allowBuilds:\n${SHARP_BUILD_POLICY}\n`;
}
- const blockEnd = findYamlBlockEnd(lines, allowBuildsIndex);
- const allowBuildsBlock = lines.slice(allowBuildsIndex + 1, blockEnd);
+ const blockEnd = findYamlBlockEnd(policyLines, allowBuildsIndex);
+ const allowBuildsBlock = policyLines.slice(allowBuildsIndex + 1, blockEnd);
if (allowBuildsBlock.some((line) => /^\s+sharp:/.test(line))) {
- return source;
- }
-
- let insertAt = blockEnd;
- while (insertAt > allowBuildsIndex + 1 && lines[insertAt - 1] === "") {
- insertAt -= 1;
- }
- lines.splice(insertAt, 0, SHARP_BUILD_POLICY);
- return lines.join("\n");
-}
-
-function withReleaseAgeExclusions(source: string): string {
- const normalized = source.endsWith("\n") ? source : `${source}\n`;
- const lines = normalized.split("\n");
- const excludeIndex = lines.findIndex((line) => line === "minimumReleaseAgeExclude:");
-
- if (excludeIndex < 0) {
- const prefix = normalized.trim().length === 0 ? "" : `${normalized}\n`;
- const exclusions = RELEASE_AGE_EXCLUSIONS.map(formatReleaseAgeExclusion).join("\n");
- return `${prefix}minimumReleaseAgeExclude:\n${exclusions}\n`;
- }
-
- const blockEnd = findYamlBlockEnd(lines, excludeIndex);
- const excludeBlock = lines.slice(excludeIndex + 1, blockEnd);
- const existingExclusions = new Set(excludeBlock.map(releaseAgeExclusionName));
- const missingExclusions = RELEASE_AGE_EXCLUSIONS.filter(
- (exclusion) => !existingExclusions.has(exclusion),
- );
- if (missingExclusions.length === 0) {
- return source;
+ return normalized;
}
let insertAt = blockEnd;
- while (insertAt > excludeIndex + 1 && lines[insertAt - 1] === "") {
+ while (insertAt > allowBuildsIndex + 1 && policyLines[insertAt - 1] === "") {
insertAt -= 1;
}
- lines.splice(insertAt, 0, ...missingExclusions.map(formatReleaseAgeExclusion));
- return lines.join("\n");
+ policyLines.splice(insertAt, 0, SHARP_BUILD_POLICY);
+ return policyLines.join("\n");
}
async function ensurePnpmWorkspacePolicy(filePath: string): Promise<"skipped" | "written"> {
@@ -123,7 +63,7 @@ async function ensurePnpmWorkspacePolicy(filePath: string): Promise<"skipped" |
}
const current = await readFile(filePath, "utf8");
- const next = withReleaseAgeExclusions(withSharpBuildPolicy(current));
+ const next = withPnpmWorkspacePolicy(current);
if (next === current) {
return "skipped";
}
@@ -302,7 +242,6 @@ export const pnpmPackageManager = {
installArguments: (options) => [
"install",
"--no-frozen-lockfile",
- ...(options.bypassMinimumReleaseAge === true ? ["--config.minimum-release-age=0"] : []),
...(options.ignoreWorkspace === true ? ["--ignore-workspace"] : []),
],
prepareArguments: (projectRoot, args) => ["--dir", projectRoot, ...args],
diff --git a/packages/eve/src/setup/primitives/pm/types.ts b/packages/eve/src/setup/primitives/pm/types.ts
index 1769611f8..8ad6e2de9 100644
--- a/packages/eve/src/setup/primitives/pm/types.ts
+++ b/packages/eve/src/setup/primitives/pm/types.ts
@@ -24,8 +24,6 @@ export interface PackageManagerConfigurationOptions {
}
export interface PackageManagerInstallOptions {
- /** Disables the manager's minimum-release-age cooldown for this run when supported. */
- readonly bypassMinimumReleaseAge?: boolean;
/** Resolves the project standalone even when an ancestor workspace exists. */
readonly ignoreWorkspace?: boolean;
/** Requests verbose package-manager output for a live progress display. */
diff --git a/packages/eve/src/setup/primitives/run-pnpm.test.ts b/packages/eve/src/setup/primitives/run-pnpm.test.ts
index 95311463b..6f57e1e93 100644
--- a/packages/eve/src/setup/primitives/run-pnpm.test.ts
+++ b/packages/eve/src/setup/primitives/run-pnpm.test.ts
@@ -146,29 +146,6 @@ describe("runPnpmInstall", () => {
});
describe("runPackageManagerInstall", () => {
- test.each([
- [
- "pnpm",
- ["--dir", "/tmp/app", "install", "--no-frozen-lockfile", "--config.minimum-release-age=0"],
- ],
- ["npm", ["install", "--min-release-age=0"]],
- // yarn has no release-age gate, so the bypass adds nothing.
- ["yarn", ["install"]],
- ["bun", ["install"]],
- ] as const)("maps the release-age bypass onto %s", async (kind, expectedArgs) => {
- expect(
- packageManagerInstallSucceeded(
- await runPackageManagerInstall(kind, "/tmp/app", { bypassMinimumReleaseAge: true }),
- ),
- ).toBe(true);
-
- expect(mockedSpawn).toHaveBeenCalledWith(
- kind,
- expectedArgs,
- expect.objectContaining({ cwd: "/tmp/app" }),
- );
- });
-
test("requests npm output before registry operations complete", async () => {
expect(
packageManagerInstallSucceeded(
diff --git a/packages/eve/src/setup/scaffold/index.integration.test.ts b/packages/eve/src/setup/scaffold/index.integration.test.ts
index 096fe091a..9bfd68c44 100644
--- a/packages/eve/src/setup/scaffold/index.integration.test.ts
+++ b/packages/eve/src/setup/scaffold/index.integration.test.ts
@@ -25,9 +25,6 @@ async function createTempDir(): Promise<string> {
const TEST_EVE_PACKAGE = { version: "0.25.0", nodeEngine: ">=24" } as const;
const LATEST_EVE_PACKAGE = { version: "latest", nodeEngine: ">=24" } as const;
-const RELEASE_AGE_POLICY =
- 'minimumReleaseAgeExclude:\n - "@ai-sdk/*"\n - "@rolldown/*"\n - "@vercel/*"\n - "@workflow/*"\n - ai\n - experimental-ai-sdk-code-mode\n - eve\n - nitro\n - rolldown\n - workflow\n';
-
const TEST_WEB_PACKAGE_VERSIONS = {
evePackage: TEST_EVE_PACKAGE,
aiPackageVersion: "7.0.0",
@@ -593,10 +590,11 @@ describe("ensureChannel", () => {
);
});
- test("adds the Web Chat pnpm build policy to existing workspace policy", async () => {
+ test("adds Web Chat build policy after an existing YAML document marker", async () => {
const projectRoot = await createTempDir();
const pnpmWorkspacePath = join(projectRoot, "pnpm-workspace.yaml");
- const existingPolicy = "packages:\n - packages/*\nallowBuilds:\n esbuild: true\n";
+ const existingPolicy =
+ "# Existing workspace policy\n--- # Workspace document\npackages:\n - packages/*\nallowBuilds:\n esbuild: true\n";
await writeFile(
join(projectRoot, "package.json"),
`${JSON.stringify({ name: "demo", type: "module" }, null, 2)}\n`,
@@ -611,15 +609,16 @@ describe("ensureChannel", () => {
});
await expect(readFile(pnpmWorkspacePath, "utf8")).resolves.toBe(
- `packages:\n - packages/*\nallowBuilds:\n esbuild: true\n sharp: false\n\n${RELEASE_AGE_POLICY}`,
+ "# Existing workspace policy\n--- # Workspace document\npackages:\n - packages/*\nallowBuilds:\n esbuild: true\n sharp: false\n",
);
expect(result.filesWritten).toContain(pnpmWorkspacePath);
});
- test("preserves an existing explicit sharp build policy when adding Web Chat", async () => {
+ test("preserves an existing release-age policy", async () => {
const projectRoot = await createTempDir();
const pnpmWorkspacePath = join(projectRoot, "pnpm-workspace.yaml");
- const existingPolicy = "allowBuilds:\n sharp: true\n";
+ const existingPolicy =
+ '"minimumReleaseAgeStrict": &strict false # Keep this comment\notherPolicy: *strict\nallowBuilds:\n sharp: true\n';
await writeFile(
join(projectRoot, "package.json"),
`${JSON.stringify({ name: "demo", type: "module" }, null, 2)}\n`,
@@ -633,36 +632,8 @@ describe("ensureChannel", () => {
webPackageVersions: TEST_WEB_PACKAGE_VERSIONS,
});
- await expect(readFile(pnpmWorkspacePath, "utf8")).resolves.toBe(
- `${existingPolicy}\n${RELEASE_AGE_POLICY}`,
- );
- expect(result.filesWritten).toContain(pnpmWorkspacePath);
- });
-
- test("adds the release age exclusions to an existing pnpm workspace exclusion list", async () => {
- const projectRoot = await createTempDir();
- const pnpmWorkspacePath = join(projectRoot, "pnpm-workspace.yaml");
- await writeFile(
- join(projectRoot, "package.json"),
- `${JSON.stringify({ name: "demo", type: "module" }, null, 2)}\n`,
- "utf8",
- );
- await writeFile(
- pnpmWorkspacePath,
- "minimumReleaseAgeExclude:\n - react\nallowBuilds:\n sharp: false\n",
- "utf8",
- );
-
- const result = await ensureChannel({
- projectRoot,
- kind: "web",
- webPackageVersions: TEST_WEB_PACKAGE_VERSIONS,
- });
-
- await expect(readFile(pnpmWorkspacePath, "utf8")).resolves.toBe(
- 'minimumReleaseAgeExclude:\n - react\n - "@ai-sdk/*"\n - "@rolldown/*"\n - "@vercel/*"\n - "@workflow/*"\n - ai\n - experimental-ai-sdk-code-mode\n - eve\n - nitro\n - rolldown\n - workflow\nallowBuilds:\n sharp: false\n',
- );
- expect(result.filesWritten).toContain(pnpmWorkspacePath);
+ await expect(readFile(pnpmWorkspacePath, "utf8")).resolves.toBe(existingPolicy);
+ expect(result.filesSkipped).toContain(pnpmWorkspacePath);
});
test("adds Web Chat pnpm policy and a missing package pattern at the ancestor workspace root", async () => {
@@ -694,7 +665,7 @@ describe("ensureChannel", () => {
expect(result.filesWritten).not.toContain(join(projectRoot, "pnpm-workspace.yaml"));
await expect(pathExists(join(projectRoot, "pnpm-workspace.yaml"))).resolves.toBe(false);
await expect(readFile(join(workspaceRoot, "pnpm-workspace.yaml"), "utf8")).resolves.toBe(
- `packages:\n - apps/*\n - agents/*\n\nallowBuilds:\n sharp: false\n\n${RELEASE_AGE_POLICY}`,
+ "packages:\n - apps/*\n - agents/*\n\nallowBuilds:\n sharp: false\n",
);
const projectPackageJson = JSON.parse(
await readFile(join(projectRoot, "package.json"), "utf8"),
@@ -1115,6 +1086,11 @@ describe("scaffoldBaseProject", () => {
await expect(pathExists(join(projectRoot, "pnpm-workspace.yaml"))).resolves.toBe(
packageManager === "pnpm",
);
+ if (packageManager === "pnpm") {
+ await expect(readFile(join(projectRoot, "pnpm-workspace.yaml"), "utf8")).resolves.toContain(
+ "minimumReleaseAgeStrict: true",
+ );
+ }
const packageJson: unknown = JSON.parse(
await readFile(join(projectRoot, "package.json"), "utf8"),
);
@@ -1132,7 +1108,11 @@ describe("scaffoldBaseProject", () => {
`${JSON.stringify({ private: true, engines: { node: "22.x" } }, null, 2)}\n`,
"utf8",
);
- await writeFile(join(workspaceRoot, "pnpm-workspace.yaml"), "packages:\n - apps/*\n", "utf8");
+ await writeFile(
+ join(workspaceRoot, "pnpm-workspace.yaml"),
+ "minimumReleaseAgeStrict: false\npackages:\n - apps/*\n",
+ "utf8",
+ );
const projectRoot = await scaffoldBaseProject({
projectName: "demo-agent",
@@ -1147,7 +1127,7 @@ describe("scaffoldBaseProject", () => {
await expect(pathExists(join(projectRoot, "pnpm-workspace.yaml"))).resolves.toBe(false);
await expect(readFile(join(workspaceRoot, "pnpm-workspace.yaml"), "utf8")).resolves.toBe(
- `packages:\n - apps/*\n\nallowBuilds:\n sharp: false\n\n${RELEASE_AGE_POLICY}`,
+ "minimumReleaseAgeStrict: false\npackages:\n - apps/*\n\nallowBuilds:\n sharp: false\n",
);
const projectPackageJson = JSON.parse(
await readFile(join(projectRoot, "package.json"), "utf8"),
@@ -1190,7 +1170,7 @@ describe("scaffoldBaseProject", () => {
await expect(pathExists(join(projectRoot, "pnpm-workspace.yaml"))).resolves.toBe(false);
await expect(readFile(join(workspaceRoot, "pnpm-workspace.yaml"), "utf8")).resolves.toBe(
- `packages:\n - apps/*\n - agents/*\n\nallowBuilds:\n sharp: false\n\n${RELEASE_AGE_POLICY}`,
+ "packages:\n - apps/*\n - agents/*\n\nallowBuilds:\n sharp: false\n",
);
const projectPackageJson = JSON.parse(
await readFile(join(projectRoot, "package.json"), "utf8"),
@@ -1396,6 +1376,9 @@ describe("scaffoldBaseProject", () => {
await expect(readFile(join(projectRoot, "package.json"), "utf8")).resolves.toContain(
'"eve": "latest"',
);
+ await expect(readFile(join(projectRoot, "pnpm-workspace.yaml"), "utf8")).resolves.toBe(
+ PNPM_WORKSPACE_CONTENT,
+ );
});
test("scaffolds the default eve channel from the Web Chat channel template", async () => {
diff --git a/packages/eve/test/scenarios/eve-init.scenario.test.ts b/packages/eve/test/scenarios/eve-init.scenario.test.ts
index ab0b92eba..0d87c62a4 100644
--- a/packages/eve/test/scenarios/eve-init.scenario.test.ts
+++ b/packages/eve/test/scenarios/eve-init.scenario.test.ts
@@ -13,6 +13,7 @@ import { useTemporaryDirectories } from "../../src/internal/testing/use-temporar
const EVE_BIN_PATH = fileURLToPath(new URL("../../bin/eve.js", import.meta.url));
const runFile = promisify(execFile);
+const RELEASE_AGE_MINUTES = "2880";
const createScratchDirectory = useTemporaryDirectories();
@@ -155,6 +156,36 @@ async function createFakeNpmEnvironment(scratch: string): Promise<{
}
describe("eve init smoke", () => {
+ it("resolves a standalone pnpm scaffold under the release-age policy", async () => {
+ const scratch = await createScratchDirectory("eve-init-release-age-");
+ const env = {
+ ...withoutCodingAgentMarkers(process.env),
+ // The agent path skips the interactive dev handoff, which cannot run
+ // against the real pnpm install this scenario performs.
+ AI_AGENT: "claude",
+ CI: "true",
+ PNPM_CONFIG_MINIMUM_RELEASE_AGE: RELEASE_AGE_MINUTES,
+ // A fresh eve release is younger than the policy window, so resolution
+ // would rightly fail. Internal testing opts the framework package out
+ // through the environment instead of any scaffold-owned bypass.
+ PNPM_CONFIG_MINIMUM_RELEASE_AGE_EXCLUDE: '["eve"]',
+ };
+
+ const result = await runEveBin(scratch, ["init", "policy-agent"], env);
+
+ expect(result.exitCode, result.stderr).toBe(0);
+ const projectDir = join(scratch, "policy-agent");
+ await expect(readFile(join(projectDir, "pnpm-workspace.yaml"), "utf8")).resolves.not.toContain(
+ "minimumReleaseAgeExclude:",
+ );
+ await expect(
+ runFile("pnpm", ["add", "--ignore-scripts", "--lockfile-only", "[email protected]"], {
+ cwd: projectDir,
+ env,
+ }),
+ ).resolves.toMatchObject({ stderr: expect.any(String) });
+ });
+
it("creates the base template with the default model and no Vercel state", async () => {
const scratch = await createScratchDirectory("eve-init-");
const fakePnpm = await createFakePnpmEnvironment(scratch);
@@ -171,34 +202,19 @@ describe("eve init smoke", () => {
};
expect(agentSource).toContain(DEFAULT_AGENT_MODEL_ID);
expect(packageJson.engines?.node).toBe("24.x");
- expect(await readFile(join(projectDir, "pnpm-workspace.yaml"), "utf8")).toContain(
- '"eve@>=0.6.0-beta.13 <=0.7.0":',
+ await expect(readFile(join(projectDir, "pnpm-workspace.yaml"), "utf8")).resolves.toContain(
+ "minimumReleaseAgeStrict: true",
);
await expect(pathExists(join(projectDir, "app"))).resolves.toBe(false);
await expect(pathExists(join(projectDir, ".vercel"))).resolves.toBe(false);
await expect(pathExists(join(projectDir, "vercel.json"))).resolves.toBe(false);
expect(await fakePnpm.readCalls()).toEqual([
{
- args: [
- "--dir",
- canonicalProjectDir,
- "install",
- "--no-frozen-lockfile",
- "--config.minimum-release-age=0",
- ],
+ args: ["--dir", canonicalProjectDir, "install", "--no-frozen-lockfile"],
cwd: canonicalProjectDir,
},
{
- args: [
- "--dir",
- canonicalProjectDir,
- "--config.minimum-release-age=0",
- "exec",
- "eve",
- "dev",
- "--input",
- "/model",
- ],
+ args: ["--dir", canonicalProjectDir, "exec", "eve", "dev", "--input", "/model"],
cwd: canonicalProjectDir,
},
]);
@@ -236,11 +252,7 @@ describe("eve init smoke", () => {
"export default withEve(nextConfig);",
);
const [installCall, devCall] = await fakePnpm.readCalls();
- expect(installCall?.args.slice(-3)).toEqual([
- "install",
- "--no-frozen-lockfile",
- "--config.minimum-release-age=0",
- ]);
+ expect(installCall?.args.slice(-2)).toEqual(["install", "--no-frozen-lockfile"]);
expect(devCall?.args.slice(-5)).toEqual(["exec", "eve", "dev", "--input", "/model"]);
});
@@ -262,7 +274,7 @@ describe("eve init smoke", () => {
await expect(pathExists(join(projectDir, "package-lock.json"))).resolves.toBe(true);
expect(await fakeNpm.readCalls()).toEqual([
{
- args: ["install", "--min-release-age=0"],
+ args: ["install"],
cwd: canonicalProjectDir,
},
{
@@ -301,13 +313,12 @@ describe("eve init smoke", () => {
engines: { node: "24.x" },
});
expect(result.stdout).toContain('Overrode package.json engines.node from ">=24" to "24.x"');
- expect(await readFile(join(scratch, "pnpm-workspace.yaml"), "utf8")).toContain(
- '"eve@>=0.6.0-beta.13 <=0.7.0":',
+ await expect(readFile(join(scratch, "pnpm-workspace.yaml"), "utf8")).resolves.toContain(
+ "minimumReleaseAgeStrict: true",
);
- expect((await fakePnpm.readCalls()).map((call) => call.args.slice(-3))).toEqual([
- ["install", "--no-frozen-lockfile", "--config.minimum-release-age=0"],
- ["exec", "eve", "dev"],
- ]);
+ const calls = await fakePnpm.readCalls();
+ expect(calls[0]?.args.slice(-2)).toEqual(["install", "--no-frozen-lockfile"]);
+ expect(calls[1]?.args.slice(-3)).toEqual(["exec", "eve", "dev"]);
});
it("scaffolds the current directory for a coding agent that omits the target", async () => {
@@ -325,13 +336,7 @@ describe("eve init smoke", () => {
await expect(pathExists(join(scratch, ".git"))).resolves.toBe(true);
expect(await fakePnpm.readCalls()).toEqual([
{
- args: [
- "--dir",
- canonicalProjectDir,
- "install",
- "--no-frozen-lockfile",
- "--config.minimum-release-age=0",
- ],
+ args: ["--dir", canonicalProjectDir, "install", "--no-frozen-lockfile"],
cwd: canonicalProjectDir,
},
]);
@@ -370,26 +375,11 @@ describe("eve init smoke", () => {
await expect(pathExists(join(scratch, ".git"))).resolves.toBe(true);
expect(await fakePnpm.readCalls()).toEqual([
{
- args: [
- "--dir",
- canonicalProjectDir,
- "install",
- "--no-frozen-lockfile",
- "--config.minimum-release-age=0",
- ],
+ args: ["--dir", canonicalProjectDir, "install", "--no-frozen-lockfile"],
cwd: canonicalProjectDir,
},
{
- args: [
- "--dir",
- canonicalProjectDir,
- "--config.minimum-release-age=0",
- "exec",
- "eve",
- "dev",
- "--input",
- "/model",
- ],
+ args: ["--dir", canonicalProjectDir, "exec", "eve", "dev", "--input", "/model"],
cwd: canonicalProjectDir,
},
]);
@@ -417,13 +407,7 @@ describe("eve init smoke", () => {
// later in a controllable background process.
expect(await fakePnpm.readCalls()).toEqual([
{
- args: [
- "--dir",
- canonicalProjectDir,
- "install",
- "--no-frozen-lockfile",
- "--config.minimum-release-age=0",
- ],
+ args: ["--dir", canonicalProjectDir, "install", "--no-frozen-lockfile"],
cwd: canonicalProjectDir,
},
]);