The Open Framework for Building Agents
fix(selfmod): ask install mode before deployment setup (#3377)
prhabca1b4ab5b32
diff --git a/.changeset/selfmod-setup-mode.md b/.changeset/selfmod-setup-mode.mdnew file mode 100644index 000000000..964939706--- /dev/null+++ b/.changeset/selfmod-setup-mode.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Self-modification registry setup now asks whether to enable deployed draft pull requests or keep source editing local before collecting deployment configuration.diff --git a/packages/eve/src/setup/integrations/self-modification/setup.test.ts b/packages/eve/src/setup/integrations/self-modification/setup.test.tsindex f70be0d9f..cef02a4d6 100644--- a/packages/eve/src/setup/integrations/self-modification/setup.test.ts+++ b/packages/eve/src/setup/integrations/self-modification/setup.test.ts@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from "vitest";import { createFakePrompter } from "#internal/testing/fake-prompter.js";import type { SelfModificationSetupOperations } from "#self-modification/setup.js";-import { headlessAsker, withAnswers } from "#setup/ask.js";+import { headlessAsker, interactiveAsker, withAnswers } from "#setup/ask.js";import type { ProjectResolution } from "#setup/project-resolution.js";import { integrationSetupEnvironment } from "../shared/environment.js";@@ -66,10 +66,40 @@ describe("self-modification integration setup", () => {expect(effects.writeConfig).not.toHaveBeenCalled();});+ it("offers deployed and local modes before collecting deployed settings", async () => {+ const effects = operations();+ const fake = createFakePrompter({+ single: (options) => {+ expect(options).toMatchObject({+ message: "How should self-modification be enabled?",+ options: [+ { value: "deployed", label: "Enable for deployed" },+ { value: "local", label: "Keep local" },+ ],+ });+ return "local";+ },+ });+ const ctx = createSetupContexts({+ appRoot: "/project",+ asker: interactiveAsker(fake.prompter),+ environment: integrationSetupEnvironment("authenticated", { kind: "unresolved" }),+ prompter: fake.prompter,+ resolveVercelProject: async () => ({ orgId: "team", projectId: "project" }),+ });++ await expect(prepareSelfModificationSetup(ctx.prepare, effects)).resolves.toEqual({+ kind: "local",+ });+ expect(effects.detectGitRepository).not.toHaveBeenCalled();+ expect(effects.detectChannelNames).not.toHaveBeenCalled();+ });+it("prepares deployed configuration before applying connector effects", async () => {const effects = operations();const ctx = contexts({+ "self-modification-mode": "deployed","self-modification-repository-owner": "acme","self-modification-repository-name": "agents","self-modification-repository-directory": "apps/support",@@ -104,6 +134,7 @@ describe("self-modification integration setup", () => {it("omits Vercel authorization when no Vercel backend is configured", async () => {const effects = operations();const ctx = contexts({+ "self-modification-mode": "deployed","self-modification-repository-owner": "acme","self-modification-repository-name": "agents","self-modification-repository-directory": "apps/support",diff --git a/packages/eve/src/setup/integrations/self-modification/setup.ts b/packages/eve/src/setup/integrations/self-modification/setup.tsindex a7ef27299..0ebea2993 100644--- a/packages/eve/src/setup/integrations/self-modification/setup.ts+++ b/packages/eve/src/setup/integrations/self-modification/setup.ts@@ -1,4 +1,4 @@-import { confirm, text } from "#setup/ask.js";+import { confirm, select, text } from "#setup/ask.js";import {classifySelfModificationConfig,connectorName,@@ -48,6 +48,30 @@ export async function prepareSelfModificationSetup(return { kind: "authored" };}+ const mode = await context.asker.ask(+ select({+ key: "self-modification-mode",+ message: "How should self-modification be enabled?",+ options: [+ {+ id: "deployed",+ value: "deployed" as const,+ label: "Enable for deployed",+ hint: "Let deployed agents propose source changes through draft pull requests",+ },+ {+ id: "local",+ value: "local" as const,+ label: "Keep local",+ hint: "Only enable source editing during local development",+ },+ ],+ recommended: "local" as const,+ required: true,+ }),+ );+ if (mode === "local") return { kind: "local" };+const [detected, channelNames] = await Promise.all([operations.detectGitRepository(),operations.detectChannelNames(),