/** * Agent template scaffolding + validation. * Spec: §5.11 — `/agents create`, `/agents validate` * * Pure module — no ctx.ui dependency. The slash-command handler in index.ts * collects user input and then calls these functions with concrete options. */ import type { AgentIsolation } from "@pi-orca/core"; export type TemplateScope = "user" | "project"; export interface ScaffoldOptions { name: string; scope: TemplateScope; description: string; isolation: AgentIsolation; model: string; tools: string[]; /** Project cwd, used to resolve the project scope directory. */ cwd: string; /** If true, overwrite an existing template file. Default false. */ force?: boolean; } export interface ScaffoldResult { path: string; scope: TemplateScope; name: string; } export interface ValidateResult { /** Template name (from filename without `.md`). */ name: string; /** Where the template was loaded from. */ scope: TemplateScope; /** Absolute path to the template file. */ path: string; /** True if the template parsed and passed required-field validation. */ ok: boolean; /** Hard error (parse failure / missing required field / enum mismatch). */ error?: string; /** Non-fatal advisory messages (unknown model alias, unknown tool name). */ warnings: string[]; } /** `~/.pi/agent/orca/agents` — matches bootstrap.ts. */ export declare function getUserTemplatesDir(): string; /** `/.pi/orca/agents` — matches template.ts search order. */ export declare function getProjectTemplatesDir(cwd: string): string; /** * Validate a template name. Names become filenames (`.md`) and identify * the template inside `/agents spawn`, so we enforce kebab-case to avoid both * filesystem-quoting issues and shell-arg ambiguity. */ export declare function validateTemplateName(name: string): string | undefined; /** * Write a well-commented agent template file. Returns the absolute path of * the created file. * * @throws If the name is invalid, or the target file exists and `force` is * not set. */ export declare function scaffoldTemplate(opts: ScaffoldOptions): Promise; export interface ValidateOptions { /** Working directory used to find the project-scoped templates. */ cwd: string; /** If provided, restrict validation to the named template. */ name?: string; /** Active parent tool list — when set, unknown tool names emit warnings. */ knownTools?: string[]; /** Extra accepted model aliases beyond the built-ins. */ extraModelAliases?: string[]; } /** * Validate one or all templates. * Returns one result per template encountered. Errors are captured in the * `error` field rather than thrown so a single bad template doesn't hide * results for the rest. */ export declare function validateTemplates(opts: ValidateOptions): Promise; //# sourceMappingURL=scaffold.d.ts.map