Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

feat: compose selectable registry packages (#1565)

OwenKepharte6f480821189
diff --git a/.changeset/quick-pandas-select.md b/.changeset/quick-pandas-select.md
new file mode 100644
index 000000000..1d52ab9a7
--- /dev/null
+++ b/.changeset/quick-pandas-select.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Add a single `eve add linear` flow that installs and configures both the Linear Channel and Linear MCP connection.
diff --git a/apps/docs/registry.json b/apps/docs/registry.json
index 5277aa3e0..1bf00d513 100644
--- a/apps/docs/registry.json
+++ b/apps/docs/registry.json
@@ -3,6 +3,31 @@
"name": "eve",
"homepage": "https://eve.dev",
"items": [
+ {
+ "name": "linear",
+ "type": "registry:item",
+ "title": "Linear",
+ "description": "Receive delegated Linear work and give your agent tools for issues, projects, and comments.",
+ "meta": {
+ "eve": {
+ "requires": ">=0.30.6",
+ "components": [
+ {
+ "item": "channel/linear-agent",
+ "label": "Linear Channel",
+ "description": "Interact with your eve agent natively in Linear",
+ "default": true
+ },
+ {
+ "item": "connection/linear",
+ "label": "Linear MCP",
+ "description": "Use the Linear MCP",
+ "default": true
+ }
+ ]
+ }
+ }
+ },
{
"name": "extension/agent-browser",
"type": "registry:item",
diff --git a/apps/docs/scripts/validate-channel-registry.ts b/apps/docs/scripts/validate-channel-registry.ts
index 5d16f9ecc..8718b298b 100644
--- a/apps/docs/scripts/validate-channel-registry.ts
+++ b/apps/docs/scripts/validate-channel-registry.ts
@@ -14,12 +14,19 @@ interface RegistryItem {
files?: RegistryFile[];
meta?: {
eve?: {
- setup?: {
- command?: string;
- package?: string;
- bin?: string;
- args?: string[];
- };
+ setup?:
+ | {
+ command?: string;
+ package?: string;
+ bin?: string;
+ args?: string[];
+ }
+ | Array<{
+ command?: string;
+ package?: string;
+ bin?: string;
+ args?: string[];
+ }>;
};
};
}
@@ -96,16 +103,24 @@ if (JSON.stringify(actualSlugs) !== JSON.stringify(expectedSlugs)) {
}
for (const [index, item] of items.entries()) {
- const setup = item.meta?.eve?.setup;
+ const declaredSetup = item.meta?.eve?.setup;
+ const setups =
+ declaredSetup === undefined
+ ? undefined
+ : Array.isArray(declaredSetup)
+ ? declaredSetup
+ : [declaredSetup];
if (
- setup !== undefined &&
- (setup.command === undefined ||
- setup.package === undefined ||
- setup.bin === undefined ||
- setup.args === undefined)
+ setups?.some(
+ (setup) =>
+ setup.command === undefined ||
+ setup.package === undefined ||
+ setup.bin === undefined ||
+ setup.args === undefined,
+ )
) {
throw new Error(
- `Registry item "${item.name}" setup must declare command, package, bin, and args during the migration.`,
+ `Registry item "${item.name}" setup entries must declare command, package, bin, and args.`,
);
}
@@ -127,10 +142,8 @@ for (const [index, item] of items.entries()) {
setupKindsByCatalogSlug[entry.slug] ?? registrySlug,
];
if (
- setup?.command !== "eve" ||
- setup.package !== "eve" ||
- setup.bin !== "eve" ||
- JSON.stringify(setup.args) !== JSON.stringify(expectedArgs)
+ JSON.stringify(setups) !==
+ JSON.stringify([{ command: "eve", package: "eve", bin: "eve", args: expectedArgs }])
) {
throw new Error(
`Registry item "${item.name}" must delegate setup to eve integration setup ${expectedArgs[2]}.`,
diff --git a/apps/docs/scripts/validate-connection-registry.ts b/apps/docs/scripts/validate-connection-registry.ts
index 10d3b0f38..6f422cbf8 100644
--- a/apps/docs/scripts/validate-connection-registry.ts
+++ b/apps/docs/scripts/validate-connection-registry.ts
@@ -15,12 +15,19 @@ interface RegistryItem {
files?: RegistryFile[];
meta?: {
eve?: {
- setup?: {
- command?: string;
- package?: string;
- bin?: string;
- args?: string[];
- };
+ setup?:
+ | {
+ command?: string;
+ package?: string;
+ bin?: string;
+ args?: string[];
+ }
+ | Array<{
+ command?: string;
+ package?: string;
+ bin?: string;
+ args?: string[];
+ }>;
};
};
}
@@ -52,16 +59,24 @@ if (JSON.stringify(actualSlugs) !== JSON.stringify(expectedSlugs)) {
}
for (const item of items) {
- const setup = item.meta?.eve?.setup;
+ const declaredSetup = item.meta?.eve?.setup;
+ const setups =
+ declaredSetup === undefined
+ ? undefined
+ : Array.isArray(declaredSetup)
+ ? declaredSetup
+ : [declaredSetup];
if (
- setup !== undefined &&
- (setup.command === undefined ||
- setup.package === undefined ||
- setup.bin === undefined ||
- setup.args === undefined)
+ setups?.some(
+ (setup) =>
+ setup.command === undefined ||
+ setup.package === undefined ||
+ setup.bin === undefined ||
+ setup.args === undefined,
+ )
) {
throw new Error(
- `Registry item "${item.name}" setup must declare command, package, bin, and args during the migration.`,
+ `Registry item "${item.name}" setup entries must declare command, package, bin, and args.`,
);
}
@@ -73,7 +88,7 @@ for (const item of items) {
bin: "eve",
args: ["integration", "connect", slug, CONNECT_SERVICES[slug] ?? slug, slug],
};
- if (JSON.stringify(setup) !== JSON.stringify(expectedSetup)) {
+ if (JSON.stringify(setups) !== JSON.stringify([expectedSetup])) {
throw new Error(
`Registry item "${item.name}" must configure its Vercel Connect connector through eve.`,
);
diff --git a/docs/channels/linear.mdx b/docs/channels/linear.mdx
index 4c8e372ec..ed10c536e 100644
--- a/docs/channels/linear.mdx
+++ b/docs/channels/linear.mdx
@@ -11,10 +11,12 @@ The Linear channel uses Linear's Agent Session surface rather than ordinary comm
Run the registry setup from the agent directory:
```bash
-eve add channel/linear-agent
+eve add linear
```
-The flow checks that the Vercel CLI is authenticated, creates or links a Vercel project when needed, provisions an app-scoped Linear Connect client, and replaces its default trigger with `/eve/v1/linear`. It then installs `@vercel/connect` and writes `agent/channels/linear.ts` with the connector UID.
+Select **Linear Channel** in the component checklist. **Linear MCP** is also selected by default if you want the agent to search and update Linear through MCP. Run `eve add channel/linear-agent` instead to install only the channel directly.
+
+The flow checks that the Vercel CLI is authenticated, creates or links a Vercel project when needed, reuses a compatible existing connector when available or provisions an app-scoped Linear Connect client, and replaces its default trigger with `/eve/v1/linear`. It then installs `@vercel/connect` and writes `agent/channels/linear.ts` with the connector UID.
Vercel Connect creates the Linear app with the `app:assignable` and `app:mentionable` scopes required for Agent Sessions, receives and verifies `AgentSessionEvent` webhooks, and forwards them to the deployed agent. After deploying, open the Linear app in the Connect dashboard and install it in the workspace where you want to delegate work. Then delegate an issue or mention the agent in a Linear Agent Session.
diff --git a/docs/install-integrations.mdx b/docs/install-integrations.mdx
index 666c91b83..f79db5e56 100644
--- a/docs/install-integrations.mdx
+++ b/docs/install-integrations.mdx
@@ -12,13 +12,15 @@ Run `eve add` from an eve agent project. This installs the integration's depende
```bash
eve add extension/agent-browser
-eve add connection/linear
+eve add linear
eve add instrumentation/braintrust
```
Extensions may create a mount under `agent/extensions/`. Connections write their initial definition under `agent/connections/` and install `@vercel/connect` when required. Instrumentation providers write `agent/instrumentation.ts`; because an agent has one instrumentation file, compose multiple exporters there by hand. Configure generated files and required environment variables before running your agent.
-When an official item has an interactive setup flow, eve asks whether to run it after installation. Run the printed `eve add <item> --skip-install` command to resume a skipped or cancelled setup later.
+Some integrations package several independently installable components. For example, `eve add linear` lets you choose the Linear Channel, Linear MCP, or both; both are selected by default. The specific `eve add channel/linear-agent` and `eve add connection/linear` commands remain available.
+
+When an official item declares an interactive setup flow or flows, eve asks whether to run them after installation and runs multiple flows in declaration order. Run the printed `eve add <item> --skip-install` command to resume a skipped or cancelled setup later; it reruns the selected components' declared flows from the beginning.
## Find an integration
diff --git a/docs/reference/cli.md b/docs/reference/cli.md
index 39934e443..02382a662 100644
--- a/docs/reference/cli.md
+++ b/docs/reference/cli.md
@@ -87,6 +87,7 @@ Commands for installing and discovering [shadcn registry](https://ui.shadcn.com/
```bash
eve add extension/agent-browser
+eve add linear
eve add channel/slack --skip-install
eve add https://example.com/r/my-extension.json --overwrite
eve registry add @acme=https://example.com/r/{name}.json
@@ -97,7 +98,9 @@ eve registry view @acme/my-extension
eve add @acme/my-extension
```
-`eve add` asks before running setup declared by an official item and prints the matching `eve add <item> --skip-install` command when setup is skipped or cancelled. `--skip-install` reruns setup without reinstalling the item.
+`eve add` asks before running setup declared by an official item and runs multiple declared flows in declaration order. Product-level packages can offer independently installable components: `eve add linear` lets you select the Linear Channel, Linear MCP, or both, with both selected by default. `--yes` installs a package's default components.
+
+When setup is skipped or cancelled, eve prints the matching `eve add <item> --skip-install` command. `--skip-install` reruns the selected components' declared flows from the beginning without reinstalling them.
`eve registry add` records configured sources in `package.json#registries`. `eve registry list` aggregates the official catalog and all configured sources by default. `eve registry search` also includes [skills.sh](https://skills.sh), available without configuration at `@skills`, and groups results by source with each source's available result count. Search returns up to 10 matches per source by default; pass `--limit <count>` to request between 1 and 100. Either command can browse one supplied URL or namespace. Official and other universal items with explicit file targets do not require shadcn project configuration.
diff --git a/packages/eve/src/cli/commands/registry-metadata.ts b/packages/eve/src/cli/commands/registry-metadata.ts
new file mode 100644
index 000000000..a4ccb2d1b
--- /dev/null
+++ b/packages/eve/src/cli/commands/registry-metadata.ts
@@ -0,0 +1,31 @@
+import { z } from "#compiled/zod/index.js";
+
+import { RegistryPackageComponentSchema } from "./registry-package.js";
+
+const RegistrySetupSchema = z.object({
+ package: z.string().min(1),
+ bin: z.string().min(1),
+ args: z.array(z.string()).default([]),
+});
+
+const EveRegistryItemMetadataSchema = z.object({
+ meta: z
+ .object({
+ eve: z
+ .object({
+ requires: z.string().optional(),
+ setup: z
+ .union([RegistrySetupSchema, z.array(RegistrySetupSchema).min(1)])
+ .transform((setup) => (Array.isArray(setup) ? setup : [setup]))
+ .optional(),
+ components: z.array(RegistryPackageComponentSchema).min(1).optional(),
+ })
+ .optional(),
+ })
+ .optional(),
+});
+
+/** Parses eve-owned metadata from a registry item manifest. */
+export function eveMetadataFromRegistryItem(item: unknown) {
+ return EveRegistryItemMetadataSchema.parse(item).meta?.eve;
+}
diff --git a/packages/eve/src/cli/commands/registry-package.ts b/packages/eve/src/cli/commands/registry-package.ts
new file mode 100644
index 000000000..d8297a3dd
--- /dev/null
+++ b/packages/eve/src/cli/commands/registry-package.ts
@@ -0,0 +1,122 @@
+import {
+ addRegistryItems,
+ getRegistryItems,
+ type RegistryConfig,
+} from "#compiled/shadcn-registry/index.js";
+import { z } from "#compiled/zod/index.js";
+import { createPrompter, type Prompter } from "#setup/prompter.js";
+
+import { hasInteractiveTerminal } from "./preconditions.js";
+import type { AddCommandOptions, RegistryCommandLogger } from "./registry.js";
+import type { RegistrySetupCommand } from "./registry-setup-command.js";
+
+export const RegistryPackageComponentSchema = z.object({
+ item: z.string().min(1),
+ label: z.string().min(1),
+ description: z.string().optional(),
+ default: z.boolean().default(false),
+});
+
+export type RegistryPackageComponent = z.infer<typeof RegistryPackageComponentSchema>;
+
+interface PackageMetadata {
+ requires?: string;
+ setup?: RegistrySetupCommand[];
+}
+
+export interface RegistryPackageDependencies {
+ createPrompter?: () => Prompter;
+ hasInteractiveTerminal?: () => boolean;
+}
+
+export interface RegistryPackageOperations {
+ itemAddress(item: string): string;
+ metadata(item: unknown): PackageMetadata | undefined;
+ assertCompatibleVersion(requiredVersion: string | undefined): void;
+ runSetups(input: {
+ item: string;
+ setups: RegistrySetupCommand[];
+ prompter: Prompter;
+ }): Promise<boolean>;
+ setupReminder(item: string): string;
+}
+
+async function selectComponents(
+ item: string,
+ components: readonly RegistryPackageComponent[],
+ options: AddCommandOptions & { prompter?: Prompter },
+ interactive: boolean,
+ getPrompter: () => Prompter,
+): Promise<readonly RegistryPackageComponent[]> {
+ if (options.prompter === undefined && (options.yes === true || !interactive)) {
+ return components.filter((component) => component.default);
+ }
+ const prompter = getPrompter();
+ const selected = await prompter.select<string>({
+ message: `Add ${item}`,
+ description: "Select what you want to add to your agent.",
+ multiple: true,
+ required: true,
+ initialValues: components
+ .filter((component) => component.default)
+ .map((component) => component.item),
+ options: components.map((component) => ({
+ value: component.item,
+ label: component.label,
+ hint: component.description,
+ })),
+ });
+ const selectedItems = new Set(selected);
+ return components.filter((component) => selectedItems.has(component.item));
+}
+
+/** Resolves, installs, and configures the selected components of a registry package. */
+export async function runRegistryPackage(input: {
+ logger: RegistryCommandLogger;
+ appRoot: string;
+ item: string;
+ components: readonly RegistryPackageComponent[];
+ config: RegistryConfig;
+ options: AddCommandOptions & { prompter?: Prompter; signal?: AbortSignal };
+ dependencies: RegistryPackageDependencies;
+ operations: RegistryPackageOperations;
+}): Promise<void> {
+ const { logger, appRoot, item, components, config, options, dependencies, operations } = input;
+ const interactive = dependencies.hasInteractiveTerminal?.() ?? hasInteractiveTerminal();
+ let prompter = options.prompter;
+ const getPrompter = (): Prompter =>
+ (prompter ??= dependencies.createPrompter?.() ?? createPrompter());
+
+ const selected = await selectComponents(item, components, options, interactive, getPrompter);
+ const addresses = selected.map((component) => operations.itemAddress(component.item));
+ const manifests = await getRegistryItems(addresses, { config });
+ if (manifests.length !== selected.length) {
+ throw new Error(`Registry package "${item}" could not resolve all selected components.`);
+ }
+ const entries = manifests.map((manifest) => {
+ const metadata = operations.metadata(manifest);
+ operations.assertCompatibleVersion(metadata?.requires);
+ return metadata;
+ });
+
+ if (options.skipInstall !== true) {
+ await addRegistryItems(addresses, {
+ config,
+ cwd: appRoot,
+ overwrite: options.overwrite,
+ silent: options.silent,
+ });
+ }
+ if (options.skipSetup === true) return;
+
+ if (options.yes !== true && options.prompter === undefined && !interactive) {
+ logger.log(operations.setupReminder(item));
+ return;
+ }
+
+ for (const metadata of entries) {
+ if (metadata?.setup === undefined) continue;
+ if (!(await operations.runSetups({ item, setups: metadata.setup, prompter: getPrompter() })))
+ return;
+ }
+}
diff --git a/packages/eve/src/cli/commands/registry.test.ts b/packages/eve/src/cli/commands/registry.test.ts
index 780ad9a80..133273c4a 100644
--- a/packages/eve/src/cli/commands/registry.test.ts
+++ b/packages/eve/src/cli/commands/registry.test.ts
@@ -1,8 +1,10 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { createFakePrompter } from "#internal/testing/fake-prompter.js";
+import { WizardCancelledError } from "#setup/step.js";
import {
browseRegistryCatalog,
+ installRegistryItem,
runAddCommand,
runRegistryAddCommand,
runRegistryListCommand,
@@ -11,6 +13,10 @@ import {
runRegistryViewCommand,
type RegistryCommandLogger,
} from "./registry.js";
+import type {
+ RegistrySetupCommand,
+ RegistrySetupCommandOptions,
+} from "./registry-setup-command.js";
const {
addRegistryItems,
@@ -133,7 +139,7 @@ describe("registry commands", () => {
type: "registry:item",
meta: {
eve: {
- setup: { package: "eve", bin: "eve", args: ["integration", "setup", kind] },
+ setup: [{ package: "eve", bin: "eve", args: ["integration", "setup", kind] }],
},
},
},
@@ -166,12 +172,313 @@ describe("registry commands", () => {
},
);
+ it("lets interactive users select components from an official registry package", async () => {
+ const logger = createLogger();
+ const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, output: [] }));
+ const fake = createFakePrompter({
+ multiple: (options) => {
+ expect(options).toMatchObject({
+ message: "Add linear",
+ description: "Select what you want to add to your agent.",
+ initialValues: ["channel/linear-agent", "connection/linear"],
+ });
+ return ["connection/linear"];
+ },
+ });
+ getRegistryItems
+ .mockResolvedValueOnce([
+ {
+ meta: {
+ eve: {
+ components: [
+ {
+ item: "channel/linear-agent",
+ label: "Linear Channel",
+ description: "Interact with your eve agent natively in Linear",
+ default: true,
+ },
+ {
+ item: "connection/linear",
+ label: "Linear MCP",
+ description: "Use the Linear MCP",
+ default: true,
+ },
+ ],
+ },
+ },
+ },
+ ])
+ .mockResolvedValueOnce([
+ {
+ meta: {
+ eve: {
+ setup: [
+ {
+ package: "eve",
+ bin: "eve",
+ args: ["integration", "connect", "linear", "mcp.linear.app", "linear"],
+ },
+ ],
+ },
+ },
+ },
+ ]);
+
+ await runAddCommand(
+ logger,
+ "/project",
+ "linear",
+ { prompter: fake.prompter },
+ { hasInteractiveTerminal: () => true, loadSetupCommandRunner: async () => runSetupCommand },
+ );
+
+ expect(addRegistryItems).toHaveBeenCalledWith(
+ ["https://eve.dev/r/connection/linear.json"],
+ expect.objectContaining({ cwd: "/project" }),
+ );
+ expect(runSetupCommand).toHaveBeenCalledWith(
+ "/project",
+ expect.objectContaining({
+ args: ["integration", "connect", "linear", "mcp.linear.app", "linear"],
+ }),
+ "linear",
+ expect.objectContaining({ prompter: fake.prompter }),
+ );
+ });
+
+ it("cancels registry package component selection without reporting an error", async () => {
+ const logger = createLogger();
+ const fake = createFakePrompter({
+ multiple: () => {
+ throw new WizardCancelledError();
+ },
+ });
+ getRegistryItems.mockResolvedValueOnce([
+ {
+ meta: {
+ eve: {
+ components: [
+ { item: "channel/linear-agent", label: "Linear Channel", default: true },
+ { item: "connection/linear", label: "Linear MCP", default: true },
+ ],
+ },
+ },
+ },
+ ]);
+
+ await runAddCommand(
+ logger,
+ "/project",
+ "linear",
+ { prompter: fake.prompter },
+ { hasInteractiveTerminal: () => true, loadSetupCommandRunner: vi.fn() },
+ );
+
+ expect(logger.errors).toEqual([]);
+ expect(addRegistryItems).not.toHaveBeenCalled();
+ expect(process.exitCode).toBeUndefined();
+ });
+
+ it("keeps registry package setup interactive when called from the TUI", async () => {
+ const fake = createFakePrompter({
+ multiple: () => ["channel/linear-agent", "connection/linear"],
+ single: () => "yes",
+ });
+ const runSetupCommand = vi.fn(
+ async (
+ _appRoot: string,
+ _setup: RegistrySetupCommand,
+ _item: string,
+ _options?: RegistrySetupCommandOptions,
+ ) => ({ kind: "completed" as const, output: [] }),
+ );
+ getRegistryItems
+ .mockResolvedValueOnce([
+ {
+ meta: {
+ eve: {
+ components: [
+ { item: "channel/linear-agent", label: "Linear Channel", default: true },
+ { item: "connection/linear", label: "Linear MCP", default: true },
+ ],
+ },
+ },
+ },
+ ])
+ .mockResolvedValueOnce([
+ { meta: { eve: { setup: [{ package: "eve", bin: "eve", args: ["channel-setup"] }] } } },
+ { meta: { eve: { setup: [{ package: "eve", bin: "eve", args: ["connection-setup"] }] } } },
+ ]);
+
+ await installRegistryItem(
+ "/project",
+ "linear",
+ { prompter: fake.prompter },
+ { loadSetupCommandRunner: async () => runSetupCommand },
+ );
+
+ expect(fake.selectMessages).toEqual(["Add linear"]);
+ expect(runSetupCommand).toHaveBeenCalledTimes(2);
+ expect(runSetupCommand.mock.calls[0]?.[1]).toEqual({
+ package: "eve",
+ bin: "eve",
+ args: ["channel-setup"],
+ });
+ });
+
+ it("installs a registry package's default components with --yes", async () => {
+ const logger = createLogger();
+ const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, output: [] }));
+ getRegistryItems
+ .mockResolvedValueOnce([
+ {
+ meta: {
+ eve: {
+ components: [
+ { item: "channel/linear-agent", label: "Linear Channel", default: true },
+ { item: "connection/linear", label: "Linear MCP", default: true },
+ ],
+ },
+ },
+ },
+ ])
+ .mockResolvedValueOnce([
+ { meta: { eve: { setup: [{ package: "eve", bin: "eve", args: ["channel-setup"] }] } } },
+ { meta: { eve: { setup: [{ package: "eve", bin: "eve", args: ["connection-setup"] }] } } },
+ ]);
+
+ await runAddCommand(
+ logger,
+ "/project",
+ "linear",
+ { yes: true },
+ { loadSetupCommandRunner: async () => runSetupCommand },
+ );
+
+ expect(addRegistryItems).toHaveBeenCalledWith(
+ ["https://eve.dev/r/channel/linear-agent.json", "https://eve.dev/r/connection/linear.json"],
+ expect.objectContaining({ cwd: "/project" }),
+ );
+ expect(runSetupCommand).toHaveBeenCalledTimes(2);
+ });
+
+ it("accepts a legacy singular setup command", async () => {
+ const logger = createLogger();
+ const runSetupCommand = vi.fn(async () => ({ kind: "completed" as const, output: [] }));
+ getRegistryItems.mockResolvedValue([
+ {
+ meta: {
+ eve: {
+ setup: { package: "eve", bin: "eve", args: ["integration", "setup", "web"] },
+ },
+ },
+ },
+ ]);
+
+ await runAddCommand(
+ logger,
+ "/project",
+ "channel/web",
+ { yes: true },
+ { loadSetupCommandRunner: async () => runSetupCommand },
+ );
+
+ expect(runSetupCommand).toHaveBeenCalledWith(
+ "/project",
+ { package: "eve", bin: "eve", args: ["integration", "setup", "web", "--yes"] },
+ "channel/web",
+ expect.objectContaining({ prompter: expect.any(Object) }),
+ );
+ });
+
+ it("runs declared setups in order after installation", async () => {
+ const logger = createLogger();
+ const prompters: unknown[] = [];
+ const runSetupCommand = vi.fn(
+ async (
+ _appRoot: string,
+ _setup: RegistrySetupCommand,
+ _item: string,
+ options?: RegistrySetupCommandOptions,
+ ) => {
+ prompters.push(options?.prompter);
+ return { kind: "completed" as const, output: [] };
+ },
+ );
+ getRegistryItems.mockResolvedValue([
+ {
+ meta: {
+ eve: {
+ setup: [
+ { package: "eve", bin: "eve", args: ["integration", "setup", "linear-channel"] },
+ { package: "eve", bin: "eve", args: ["integration", "connect", "linear"] },
+ ],
+ },
+ },
+ },
+ ]);
+
+ await runAddCommand(
+ logger,
+ "/project",
+ "integration/linear",
+ { yes: true },
+ { loadSetupCommandRunner: async () => runSetupCommand },
+ );
+
+ expect(runSetupCommand).toHaveBeenNthCalledWith(
+ 1,
+ "/project",
+ { package: "eve", bin: "eve", args: ["integration", "setup", "linear-channel", "--yes"] },
+ "integration/linear",
+ expect.objectContaining({ prompter: expect.any(Object) }),
+ );
+ expect(runSetupCommand).toHaveBeenNthCalledWith(
+ 2,
+ "/project",
+ { package: "eve", bin: "eve", args: ["integration", "connect", "linear", "--yes"] },
+ "integration/linear",
+ expect.objectContaining({ prompter: expect.any(Object) }),
+ );
+ expect(prompters[0]).toBe(prompters[1]);
+ });
+
+ it("stops declared setups when one is cancelled", async () => {
+ const logger = createLogger();
+ const runSetupCommand = vi.fn(async () => ({ kind: "cancelled" as const }));
+ getRegistryItems.mockResolvedValue([
+ {
+ meta: {
+ eve: {
+ setup: [
+ { package: "eve", bin: "eve", args: ["integration", "setup", "linear-channel"] },
+ { package: "eve", bin: "eve", args: ["integration", "connect", "linear"] },
+ ],
+ },
+ },
+ },
+ ]);
+
+ await runAddCommand(
+ logger,
+ "/project",
+ "integration/linear",
+ { yes: true },
+ { loadSetupCommandRunner: async () => runSetupCommand },
+ );
+
+ expect(runSetupCommand).toHaveBeenCalledOnce();
+ expect(logger.logs).toEqual([
+ "Setup cancelled. Run `eve add integration/linear --skip-install` when you're ready.",
+ ]);
+ });
+
it("skips setup in non-interactive use and prints the resume command", async () => {
const logger = createLogger();
const runSetup = vi.fn(async () => ({ kind: "completed" as const, output: [] }));
getRegistryItems.mockResolvedValue([
{
- meta: { eve: { setup: { package: "@acme/slack", bin: "eve-slack", args: ["setup"] } } },
+ meta: { eve: { setup: [{ package: "@acme/slack", bin: "eve-slack", args: ["setup"] }] } },
},
]);
@@ -181,7 +488,7 @@ describe("registry commands", () => {
"channel/slack",
{},
{
- isInteractive: () => false,
+ hasInteractiveTerminal: () => false,
loadSetupCommandRunner: async () => runSetup,
},
);
@@ -198,7 +505,7 @@ describe("registry commands", () => {
const fake = createFakePrompter({ single: () => "no" });
getRegistryItems.mockResolvedValue([
{
- meta: { eve: { setup: { package: "@acme/slack", bin: "eve-slack", args: ["setup"] } } },
+ meta: { eve: { setup: [{ package: "@acme/slack", bin: "eve-slack", args: ["setup"] }] } },
},
]);
@@ -209,7 +516,7 @@ describe("registry commands", () => {
{},
{
createPrompter: () => fake.prompter,
- isInteractive: () => true,
+ hasInteractiveTerminal: () => true,
loadSetupCommandRunner: async () => runSetup,
},
);
@@ -226,7 +533,7 @@ describe("registry commands", () => {
const runSetup = vi.fn(async () => ({ kind: "cancelled" as const }));
getRegistryItems.mockResolvedValue([
{
- meta: { eve: { setup: { package: "@acme/slack", bin: "eve-slack", args: ["setup"] } } },
+ meta: { eve: { setup: [{ package: "@acme/slack", bin: "eve-slack", args: ["setup"] }] } },
},
]);
@@ -251,7 +558,7 @@ describe("registry commands", () => {
const runSetup = vi.fn(async () => ({ kind: "completed" as const, output: [] }));
getRegistryItems.mockResolvedValue([
{
- meta: { eve: { setup: { package: "@acme/slack", bin: "eve-slack", args: ["setup"] } } },
+ meta: { eve: { setup: [{ package: "@acme/slack", bin: "eve-slack", args: ["setup"] }] } },
},
]);
@@ -348,7 +655,7 @@ describe("registry commands", () => {
type: "registry:item",
meta: {
eve: {
- setup: { package: "eve", bin: "eve", args: ["integration", "setup", "web"] },
+ setup: [{ package: "eve", bin: "eve", args: ["integration", "setup", "web"] }],
},
},
},
@@ -377,7 +684,7 @@ describe("registry commands", () => {
type: "registry:item",
meta: {
eve: {
- setup: { package: "shell-package", bin: "sh", args: ["-c", "echo nope"] },
+ setup: [{ package: "shell-package", bin: "sh", args: ["-c", "echo nope"] }],
},
},
},
@@ -398,7 +705,7 @@ describe("registry commands", () => {
meta: {
eve: {
requires: ">=0.30.0",
- setup: { package: "eve", bin: "eve", args: ["integration", "setup", "web"] },
+ setup: [{ package: "eve", bin: "eve", args: ["integration", "setup", "web"] }],
},
},
},
diff --git a/packages/eve/src/cli/commands/registry.ts b/packages/eve/src/cli/commands/registry.ts
index 26608a79e..98f6c3ef8 100644
--- a/packages/eve/src/cli/commands/registry.ts
+++ b/packages/eve/src/cli/commands/registry.ts
@@ -8,13 +8,14 @@ import {
import { createCliTheme, sanitizeForTerminal } from "#cli/ui/output.js";
import { clipVisible, wrapVisibleLine } from "#cli/ui/terminal-text.js";
import semver from "#compiled/semver/index.js";
-import { z } from "#compiled/zod/index.js";
import { resolveInstalledPackageInfo } from "#internal/application/package.js";
import { createPrompter, type Prompter } from "#setup/prompter.js";
import { isEveProject } from "#setup/scaffold/index.js";
import { WizardCancelledError } from "#setup/step.js";
-import { NOT_AN_AGENT_MESSAGE } from "./preconditions.js";
+import { hasInteractiveTerminal, NOT_AN_AGENT_MESSAGE } from "./preconditions.js";
+import { eveMetadataFromRegistryItem } from "./registry-metadata.js";
+import { runRegistryPackage } from "./registry-package.js";
import type { runRegistrySetupCommand } from "./registry-setup-command.js";
import { addRegistryMappings, readRegistryConfig } from "./registry-project.js";
@@ -55,7 +56,7 @@ export interface RegistrySetupDependencies {
export interface AddCommandDependencies extends RegistrySetupDependencies {
createPrompter?: () => Prompter;
- isInteractive?: () => boolean;
+ hasInteractiveTerminal?: () => boolean;
}
/** One discoverable item from an eve-compatible registry catalog. */
@@ -77,7 +78,7 @@ export interface RegistryCatalogResult {
const defaultAddCommandDependencies: AddCommandDependencies = {
createPrompter,
- isInteractive: () => process.stdin.isTTY === true && process.stdout.isTTY === true,
+ hasInteractiveTerminal,
loadSetupCommandRunner: async () =>
(await import("./registry-setup-command.js")).runRegistrySetupCommand,
};
@@ -144,29 +145,6 @@ export async function installOfficialRegistryItem(
});
}
-const EveRegistryItemMetadataSchema = z.object({
- meta: z
- .object({
- eve: z
- .object({
- requires: z.string().optional(),
- setup: z
- .object({
- package: z.string().min(1),
- bin: z.string().min(1),
- args: z.array(z.string()).default([]),
- })
- .optional(),
- })
- .optional(),
- })
- .optional(),
-});
-
-function eveMetadataFromRegistryItem(item: unknown) {
- return EveRegistryItemMetadataSchema.parse(item).meta?.eve;
-}
-
function setupResumeCommand(item: string): string {
const argument = /^[\w@./:-]+$/.test(item) ? item : `'${item.replaceAll("'", `'\\''`)}'`;
return `eve add ${argument} --skip-install`;
@@ -211,6 +189,7 @@ async function runRegistryAction(
try {
await action();
} catch (error) {
+ if (error instanceof WizardCancelledError) return;
logger.error(errorMessage(error));
process.exitCode = 1;
}
@@ -469,29 +448,32 @@ export async function getRegistryItemManifest(appRoot: string, item: string): Pr
return items.length === 1 ? items[0] : items;
}
-async function runDeclaredSetup(
+async function runDeclaredSetups(
logger: RegistryCommandLogger,
appRoot: string,
item: string,
- setup: NonNullable<ReturnType<typeof eveMetadataFromRegistryItem>>["setup"],
+ setups: NonNullable<ReturnType<typeof eveMetadataFromRegistryItem>>["setup"],
options: SetupCommandOptions,
dependencies: RegistrySetupDependencies,
-): Promise<void> {
- if (setup === undefined) return;
+): Promise<boolean> {
+ if (setups === undefined) return true;
const runSetupCommand = await dependencies.loadSetupCommandRunner();
+ const prompter = options.prompter ?? createPrompter();
try {
- const prompter = options.prompter ?? createPrompter();
- const result = await runSetupCommand(
- appRoot,
- { ...setup, args: [...setup.args, ...(options.yes ? ["--yes"] : [])] },
- item,
- { prompter, signal: options.signal },
- );
- if (result.kind === "cancelled") {
- logger.log(setupReminder(item, "cancelled"));
- } else {
+ for (const setup of setups) {
+ const result = await runSetupCommand(
+ appRoot,
+ { ...setup, args: [...setup.args, ...(options.yes ? ["--yes"] : [])] },
+ item,
+ { prompter, signal: options.signal },
+ );
+ if (result.kind === "cancelled") {
+ logger.log(setupReminder(item, "cancelled"));
+ return false;
+ }
for (const line of result.output) logger.log(line);
}
+ return true;
} catch (error) {
throw new Error(`${errorMessage(error)} Try again with \`${setupResumeCommand(item)}\`.`);
}
@@ -513,7 +495,13 @@ export async function installRegistryItem(
log: (message) => output.push(message),
};
const previousExitCode = process.exitCode;
- await runAddCommand(logger, appRoot, item, { ...options, yes: true }, dependencies);
+ await runAddCommand(
+ logger,
+ appRoot,
+ item,
+ { ...options, yes: options.prompter === undefined ? true : options.yes },
+ dependencies,
+ );
process.exitCode = previousExitCode;
if (failure !== undefined) throw new Error(failure);
return output;
@@ -549,11 +537,41 @@ export async function runAddCommand(
: undefined;
assertCompatibleEveVersion(eveMetadata?.requires);
+ if (eveMetadata?.components !== undefined) {
+ if (!isOfficialItemAddress(address))
+ throw new Error("Registry packages require the official eve registry.");
+ await runRegistryPackage({
+ logger,
+ appRoot,
+ item,
+ components: eveMetadata.components,
+ config,
+ options,
+ dependencies,
+ operations: {
+ itemAddress,
+ metadata: eveMetadataFromRegistryItem,
+ assertCompatibleVersion: assertCompatibleEveVersion,
+ runSetups: ({ item: packageItem, setups, prompter }) =>
+ runDeclaredSetups(
+ logger,
+ appRoot,
+ packageItem,
+ setups,
+ { yes: options.yes, prompter, signal: options.signal },
+ dependencies,
+ ),
+ setupReminder: (packageItem) => setupReminder(packageItem, "skipped"),
+ },
+ });
+ return;
+ }
+
if (options.skipInstall === true) {
if (eveMetadata?.setup === undefined) {
throw new Error(`Registry item "${item}" does not declare a setup flow.`);
}
- await runDeclaredSetup(logger, appRoot, item, eveMetadata.setup, options, dependencies);
+ await runDeclaredSetups(logger, appRoot, item, eveMetadata.setup, options, dependencies);
return;
}
@@ -565,9 +583,10 @@ export async function runAddCommand(
});
if (eveMetadata?.setup === undefined) return;
- const isInteractive =
- dependencies.isInteractive?.() ?? defaultAddCommandDependencies.isInteractive!();
- if (options.skipSetup === true || (!options.yes && !isInteractive)) {
+ const interactive =
+ dependencies.hasInteractiveTerminal?.() ??
+ defaultAddCommandDependencies.hasInteractiveTerminal!();
+ if (options.skipSetup === true || (!options.yes && !interactive)) {
logger.log(setupReminder(item, "skipped"));
return;
}
@@ -575,7 +594,9 @@ export async function runAddCommand(
if (!options.yes) {
try {
const prompter =
- dependencies.createPrompter?.() ?? defaultAddCommandDependencies.createPrompter!();
+ options.prompter ??
+ dependencies.createPrompter?.() ??
+ defaultAddCommandDependencies.createPrompter!();
const shouldRun = await prompter.select({
message: `Set up ${item} now?`,
initialValue: "yes",
@@ -595,7 +616,7 @@ export async function runAddCommand(
}
}
- await runDeclaredSetup(logger, appRoot, item, eveMetadata.setup, options, dependencies);
+ await runDeclaredSetups(logger, appRoot, item, eveMetadata.setup, options, dependencies);
});
}
diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts
index 97d57005a..4175d7f9a 100644
--- a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts
+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts
@@ -1490,24 +1490,6 @@ describe("TerminalRenderer (inline scrollback)", () => {
expect(screen.snapshot()).toContain("⎿ ✓ Registry items added: connection/linear.");
});
- it("keeps a setup command result tight after its flow closes", async () => {
- const { screen, input, renderer } = makeRenderer();
-
- const prompt = renderer.readPrompt();
- input.type("/add");
- input.enter();
- await prompt;
- renderer.setupFlow.begin("/add");
- renderer.setupFlow.end({ preserveDiagnostics: false });
- renderer.renderCommandResult("Registry items added: channel/github.", "success");
- renderer.shutdown();
-
- const lines = screen.snapshot().split("\n");
- const command = lines.findIndex((line) => line.includes("│ /add"));
- const result = lines.findIndex((line) => line.includes("⎿ ✓ Registry items added"));
- expect(result).toBe(command + 1);
- });
-
it("marks a failed automatic command and keeps its multiline outcome in one result block", () => {
const { screen, renderer } = makeRenderer();
renderer.renderCommandInvocation("/vc:login", "failed");
diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.ts
index 11b279204..9f26316cb 100644
--- a/packages/eve/src/cli/dev/tui/terminal-renderer.ts
+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.ts
@@ -1648,8 +1648,6 @@ export class TerminalRenderer implements AgentTUIRenderer {
const content = stripTerminalControls(text);
if (content.trim().length === 0) return;
this.#start();
- const latest = this.#blocks.at(-1);
- if (latest?.kind === "command") latest.live = false;
this.#pushBlock(
tone === "success"
? { kind: "result", body: content, live: false, status: "done" }
@@ -1697,10 +1695,6 @@ export class TerminalRenderer implements AgentTUIRenderer {
if (flow === undefined) return;
this.#setupFlow = undefined;
this.#stopTicker();
- // The result belongs to the slash command that opened this flow. Its
- // elbow should stay adjacent even though closing the panel repaints first.
- const latest = this.#blocks.at(-1);
- if (latest?.kind === "command") latest.live = true;
if (preserveDiagnostics) {
let evidence: string[] = [];
diff --git a/packages/eve/src/setup/integrations/linear/setup.test.ts b/packages/eve/src/setup/integrations/linear/setup.test.ts
index 380651016..0fdbfeb7d 100644
--- a/packages/eve/src/setup/integrations/linear/setup.test.ts
+++ b/packages/eve/src/setup/integrations/linear/setup.test.ts
@@ -51,6 +51,16 @@ describe("Linear setup", () => {
value: "https://vercel.com/d?to=/%5Bteam%5D/~/connect&title=Open+Vercel+Connect",
kind: "url",
},
+ {
+ label: "Next step",
+ value:
+ "Deploy the agent, then open the Linear app in Vercel Connect and install it in the workspace where you want to delegate issues and comments.",
+ },
+ {
+ label: "In Linear",
+ value:
+ "Delegate an issue or mention the agent in an Agent Session to start a conversation.",
+ },
],
});
diff --git a/packages/eve/src/setup/integrations/linear/setup.ts b/packages/eve/src/setup/integrations/linear/setup.ts
index 08731fcee..e5fc0781e 100644
--- a/packages/eve/src/setup/integrations/linear/setup.ts
+++ b/packages/eve/src/setup/integrations/linear/setup.ts
@@ -148,13 +148,21 @@ export async function setupLinear(
{ force: context.force },
);
const dashboardUrl = "https://vercel.com/d?to=/%5Bteam%5D/~/connect&title=Open+Vercel+Connect";
- context.ui.nextSteps([
- "Deploy the agent, then open the Linear app in Vercel Connect and install it in the workspace where you want to delegate issues and comments.",
- "In Linear, delegate an issue or mention the agent in an Agent Session to start a conversation.",
- ]);
return {
kind: "done",
- facts: [{ label: "Vercel Connect", value: dashboardUrl, kind: "url" }],
+ facts: [
+ { label: "Vercel Connect", value: dashboardUrl, kind: "url" },
+ {
+ label: "Next step",
+ value:
+ "Deploy the agent, then open the Linear app in Vercel Connect and install it in the workspace where you want to delegate issues and comments.",
+ },
+ {
+ label: "In Linear",
+ value:
+ "Delegate an issue or mention the agent in an Agent Session to start a conversation.",
+ },
+ ],
};
} catch (error) {
if (error instanceof WizardCancelledError) return { kind: "cancelled" };