/** * Validate a project name against the locked grammar. * * Returns `null` when valid; a human-readable error string when invalid. * Apply on every input path: CLI arg, interactive prompt, preset, and * programmatic API. */ export declare function validateProjectName(name: string): string | null; export type DestinationPath = { ok: true; destination: string; finalSegment: string; } | { ok: false; error: string; }; export type DestinationSplit = { ok: true; destination: string; projectName: string; } | { ok: false; error: string; }; /** * Normalize a destination path and expose its final segment. * * Upward traversal (`../ref-doc`) is **allowed** — `..` is simply a relative * way to name a directory outside the cwd, and absolute destinations are * accepted too, so rejecting it would be inconsistent. `.`, `..`, and a * filesystem root are rejected because they name no final segment. * * `path.resolve()` is deliberately NOT applied before extracting the segment: * resolving `"."` first would turn the *current* directory's basename into an * apparently valid project name and scaffold into the cwd. */ export declare function normalizeDestination(raw: string): DestinationPath; /** * Split a CLI destination argument into the directory to scaffold into and the * package name written to the generated `package.json`. * * The final path segment becomes the project name and goes through the * unchanged `validateProjectName`; everything before it is just a directory * path and is deliberately not validated as a package name. Callers that * supply the name separately (`--name`) use `normalizeDestination` instead, so * a directory segment that is not a legal package name stays acceptable. */ export declare function splitDestination(raw: string): DestinationSplit; /** The two destination-bearing fields every target-dir consumer needs. */ export interface DestinationChoices { projectName: string; /** * Directory to scaffold into, as given on the CLI. Absent on the * programmatic/preset paths, where the project name is also the directory. */ destination?: string; } /** The destination as the user expressed it — for messages and `cd` output. */ export declare function destinationLabel(choices: DestinationChoices): string; /** * The single source of truth for the absolute directory a scaffold is written * to. Every caller that needs it (scaffold.ts, api.ts, index.ts) must use this * rather than re-deriving it — that is how the three sites used to drift. */ export declare function resolveTargetDir(choices: DestinationChoices): string; export declare function installDependencies(dir: string, pm: string): void; export type GitInitResult = { status: "ok"; } | { status: "skipped-existing-repo"; } | { status: "skipped-no-git"; } | { status: "failed"; message: string; }; /** * Initialize a git repository in `dir` and create an initial commit. * * Why: zudo-doc's doc-history feature reads `git log` for each page's * Created/Updated/Author block. A scaffolded project with no git repo renders * empty history — and on older `@takazudo/zudo-doc-history-server` it crashed * `pnpm dev` outright (the preBuild hook ran `git rev-parse` and threw). * Initializing git here makes the feature work out of the box. * * Safe by construction: * - `skipped-no-git` when git is not installed; * - `skipped-existing-repo` when `dir` is already inside a git work tree (e.g. * scaffolding into an existing monorepo) — never nest repositories; * - the initial commit only falls back to a neutral identity when the user has * none configured, so a normal user's commit keeps their own identity. */ export declare function initGitRepo(dir: string): GitInitResult; /** * Whether an ANCESTOR of `dir` (walking up from `dir`'s parent, not `dir` * itself — `dir` is the fresh project root and never has one yet) already * has a `pnpm-workspace.yaml`. Mirrors `initGitRepo`'s "never nest" * precedent above: pnpm resolves the nearest `pnpm-workspace.yaml` upward * from cwd as the workspace root, so writing a new one inside an existing * pnpm monorepo (e.g. scaffolding into `apps/docs/` under a parent * workspace) would carve the generated project out of that parent * workspace's install/lockfile instead of joining it (codex-review finding, * #2923). */ export declare function hasAncestorPnpmWorkspace(dir: string): boolean; export declare function capitalize(str: string): string; /** Get a short uppercase label for a language code (e.g. "en" → "EN", "zh-cn" → "ZH-CN"). */ export declare function getLangLabel(langCode: string): string; /** * Build the command that runs a package.json script under `pm`. * * npm and bun BOTH require the `run` verb — `bun build` invokes Bun's bundler, * NOT the package.json `build` script (a real footgun), so bun must emit * `bun run build`. pnpm and yarn accept the bare script name (`pnpm build`). * The single source of truth for this rule across claude-md-gen.ts, * scaffold.ts, and features/tauri.ts. */ export declare function pmRunCommand(pm: "pnpm" | "npm" | "yarn" | "bun", script: string): string; /** * Determine the first additional locale code for legacy callers. * * @deprecated Internal emitters now consume the complete LocalePlan. Keep * this compatibility export for existing package consumers that still need * the former single-additional-locale helper. */ export declare function getSecondaryLang(defaultLang: string): string; /** Apply a list of regex replacements to a file (if it exists). */ export declare function patchFile(filePath: string, replacements: [RegExp, string][]): Promise;