eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
59 lines (58 loc) • 2.55 kB
TypeScript
import { isEveProject } from "#setup/scaffold/index.js";
import { type Asker } from "../ask.js";
import { pathExists } from "../path-exists.js";
import { type ResolvedProjectPath, type SetupState } from "../state.js";
import type { SetupBox } from "../step.js";
/** Injected for tests; defaults to the real filesystem probes. */
export interface ResolveTargetDeps {
pathExists: typeof pathExists;
isEveProject: typeof isEveProject;
}
export interface ResolveTargetOptions {
/** Resolves the name and directory questions; the composed stack decides how. */
asker: Asker;
/**
* Interactive-only notice surface for the duplicate-directory re-ask loop.
* Narrower than the prompter it forwards to; goes away when notices get a
* channel of their own.
*/
notify(message: string): void;
/**
* Skip the name question and use this value. Stays a factory option (not a
* `withAnswers` rung) so it keeps short-circuiting before any ask while
* still being validated, exactly as the dual-face box did.
*/
presetName?: string;
/** Parent directory the project folder is created inside. Defaults to cwd. */
targetDirectory?: string;
/** Force scaffolding into the target directory instead of a `./<name>` child. */
inPlace?: boolean;
/**
* Treat an existing `./<name>` that is already an eve project as resumable
* instead of refusing it. Composed on for headless runs so re-runs converge;
* interactive runs keep refusing so a human notices the collision.
*/
resumeExisting?: boolean;
deps?: ResolveTargetDeps;
}
/** The name + directory decision gather produces. */
export interface ResolveTargetInput {
agentName: string;
inPlace: boolean;
}
export interface ResolveTargetPayload {
agentName: string;
projectPath: Extract<ResolvedProjectPath, {
kind: "resolved";
}>;
}
/**
* THE TARGET BOX (Q1 + Q2): resolve the agent name (the shared identity for
* the directory and the Vercel project) and decide whether to scaffold in
* place or into a new `./<name>` child. The current-vs-new question only fires
* when the target directory already looks like a project; otherwise creating a
* new directory is the announced default. A headless re-run resumes an
* existing eve project directory instead of refusing it (composed via
* `resumeExisting`), so re-runs converge.
*/
export declare function resolveTarget(options: ResolveTargetOptions): SetupBox<SetupState, ResolveTargetInput, ResolveTargetPayload>;