import { parseWorkspaceScope } from "./workspacify.js"; declare const REPO = "BuilderIO/agent-native"; declare const TEMPLATES_DIR = "templates"; /** * Tagged error for input that fails CLI-level validation (repo names, app * names, etc.). The Sentry `beforeSend` hook in cli/index.ts drops events * whose top-level exception type is `ValidationError` so we don't pollute * Sentry with expected user-input rejections. */ export declare class ValidationError extends Error { constructor(message: string); } export interface CreateAppOptions { /** Pre-select these templates in the picker. Comma-separated string or array. */ template?: string; /** Scaffold a single standalone app (old behavior). Skips workspace creation. */ standalone?: boolean; /** Internal: skip pnpm install at the end (for tests). */ noInstall?: boolean; /** * Internal: always scaffold a workspace and skip the start-shape prompt. * Used by the deprecated `create-workspace` alias, whose contract is an * unconditional workspace scaffold. */ forceWorkspace?: boolean; } /** * Main entry for `agent-native create [name]`. * * Default behavior: scaffold a workspace at / with a multi-select * template picker. Use --standalone for the single-app standalone flow. * * If run *inside* an existing workspace, falls through to the add-app * flow that scaffolds one new app under apps//. */ export declare function createApp(name?: string, opts?: CreateAppOptions): Promise; declare function startShapePromptOptions(): { message: string; initialValue: string; options: { value: string; label: string; hint: string; }[]; }; declare function workspaceAppNameForTemplateSelection(templateName: string): string; declare function scaffoldWorkspaceRoot(targetDir: string, name: string): Promise; /** * Entry for `agent-native add-app [name]`. Called from inside a workspace. * Shows the multi-select picker (excluding already-installed apps) and * scaffolds each selected template under apps//. * * When `name` is provided with `--template foo`, scaffolds exactly one app * named using template foo (non-interactive). */ export declare function addAppToWorkspace(name?: string, opts?: CreateAppOptions): Promise; /** Where a scaffolded template's bytes came from, recorded so * `agent-native template sync` can reproduce them later. */ export interface ScaffoldTemplateResolution { templateRef?: string; templateSource?: "github" | "bundled" | "local-checkout"; } export interface ScaffoldProvenance extends ScaffoldTemplateResolution { shape?: "workspace" | "standalone"; } /** * Scaffold a single app template into `targetDir`. Resolves: * - "headless" / legacy "blank" → bundled action-first template * - "github:user/repo" → download the whole repo * - first-party template name → use a bundled copy or download its subdir * from BuilderIO/agent-native */ declare function scaffoldAppTemplate(targetDir: string, template: string): Promise; /** A template dir inside the installed core package ships with the CLI; * anything above it belongs to a framework checkout. */ declare function localTemplateSourceKind(localTemplate: string): "bundled" | "local-checkout"; declare function templateSourceName(name: string): string; /** * Prefer a nearby templates/ or src/templates/ directory. This * covers the framework checkout, the dist/templates copy bundled into * published CLI packages, and source templates included in package files; * packages that do not bundle a template fall back to GitHub. */ declare function findLocalTemplate(name: string): string | undefined; declare function findLocalTemplateFrom(startDir: string, name: string): string | undefined; declare function normalizeTemplateName(template: string): string; /** * Scaffold internal workspace packages required by the selected templates. * Deduplicates so each package is only copied once even if multiple * templates need it. */ declare function scaffoldRequiredPackages(templateNames: string[], workspaceRoot: string): Promise; /** * Post-process a standalone scaffold: replace placeholders, strip * workspace:* deps, set up agent symlinks, etc. */ declare function postProcessStandalone(name: string, targetDir: string, templateName?: string, resolution?: ScaffoldTemplateResolution): void; /** * Walk up from startDir looking for a package.json with * `agent-native.workspaceCore` set. Returns the workspace root and core * package name, or null if not inside a workspace. */ export declare function detectWorkspace(startDir: string): { workspaceRoot: string; workspaceCoreName: string; } | null; export { parseWorkspaceScope }; /** @internal — exported for E2E tests */ export { scaffoldWorkspaceRoot as _scaffoldWorkspaceRoot, scaffoldAppTemplate as _scaffoldAppTemplate, scaffoldRequiredPackages as _scaffoldRequiredPackages, postProcessStandalone as _postProcessStandalone, loadCatalog as _loadCatalog, fixPackageJsonName as _fixPackageJsonName, renameGitignore as _renameGitignore, rewriteNetlifyToml as _rewriteNetlifyToml, getCoreDependencyVersion as _getCoreDependencyVersion, getDispatchDependencyVersion as _getDispatchDependencyVersion, getToolkitDependencyVersion as _getToolkitDependencyVersion, getCorePackageVersion as _getCorePackageVersion, getGitHubTemplateRef as _getGitHubTemplateRef, getGitHubTemplateRefCandidates as _getGitHubTemplateRefCandidates, githubTarballUrl as _githubTarballUrl, findLocalTemplateFrom as _findLocalTemplateFrom, workspaceAppNameForTemplateSelection as _workspaceAppNameForTemplateSelection, startShapePromptOptions as _startShapePromptOptions, shouldSkipScaffoldEntry as _shouldSkipScaffoldEntry, tarExtractArgs as _tarExtractArgs, downloadGitHubSubdir as _downloadGitHubSubdir, findLocalTemplate as _findLocalTemplate, templateSourceName as _templateSourceName, normalizeTemplateName as _normalizeTemplateName, appTitleForScaffold as _appTitleForScaffold, replacePlaceholders as _replacePlaceholders, rewriteTrackingAppId as _rewriteTrackingAppId, rewriteAgentChatAppId as _rewriteAgentChatAppId, fixWebManifestName as _fixWebManifestName, copyDir as _copyDir, localTemplateSourceKind as _localTemplateSourceKind, REPO as _REPO, TEMPLATES_DIR as _TEMPLATES_DIR, }; declare function tarExtractArgs(tarPath: string, destDir: string, options?: { skipAgentSymlinks?: boolean; }): string[]; /** Resolves to the ref that actually succeeded so callers can record it. */ declare function downloadGitHubSubdir(repo: string, subdir: string, targetDir: string, refOverride?: string[]): Promise; declare function githubTarballUrl(repo: string, ref: string, kind: "branch" | "tag"): string; /** * Load the pnpm workspace catalog. * First tries the build-time snapshot at dist/catalog.json (works when * running as a published npm package). Falls back to parsing the monorepo * pnpm-workspace.yaml (works during local framework development). */ declare function loadCatalog(): Record; declare function appTitleForScaffold(appName: string): string; declare function fixPackageJsonName(appDir: string, name: string, templateName?: string, provenance?: ScaffoldProvenance): void; declare function fixWebManifestName(appDir: string, name: string, templateName?: string): void; declare function getCoreDependencyVersion(): string; declare function getDispatchDependencyVersion(): string; declare function getToolkitDependencyVersion(): string; declare function getCorePackageVersion(): string | undefined; /** * Git refs to try, in priority order, when downloading templates from the * framework repo. The release tag scheme has shifted over time: * * - ≤ 0.7.83: single repo-wide tag `v` (legacy). * - ≥ 0.8.0: changesets per-package tags * `@agent-native/core@` (current). * * Published CLIs intentionally use only immutable version tags. Falling back * to mutable `main` can copy a template that imports exports not present in * the installed core package, leaving a generated app broken at SSR startup. * Local framework development uses the checkout's templates and packages * before this downloader runs, so it does not need a mutable fallback. */ declare function getGitHubTemplateRefCandidates(): string[]; /** @deprecated Kept for backward-compatible test imports. Returns the * highest-priority candidate; callers that need the full fallback list * should use `getGitHubTemplateRefCandidates()`. */ declare function getGitHubTemplateRef(): string; declare function rewriteNetlifyToml(appDir: string, appName: string, mode: "standalone" | "workspace"): void; declare function rewriteAgentChatAppId(appDir: string, appName: string, templateName?: string): void; declare function rewriteTrackingAppId(appDir: string, appName: string, templateName?: string): void; declare function renameGitignore(dir: string): void; declare function replacePlaceholders(dir: string, appName: string, appTitle: string, workspaceName?: string): void; declare function copyDir(src: string, dest: string, root?: string): void; declare function shouldSkipScaffoldEntry(name: string, srcPath?: string): boolean; //# sourceMappingURL=create.d.ts.map