Action import type {Action} from '@fuzdev/fuz_template/molt.js'; A single filesystem transformation in a molt plan. Paths are relative to the repo root.
32 declarations
Action import type {Action} from '@fuzdev/fuz_template/molt.js'; A single filesystem transformation in a molt plan. Paths are relative to the repo root.
(root: string, plan: Action[]): void import {apply} from '@fuzdev/fuz_template/molt.js'; Applies a verified plan at root. Callers must run verify first —
apply assumes anchors match and targets exist.
rootstringplanAction[]void (wetrun: boolean, clean: boolean, is_interactive: boolean): ApplyGate import {apply_gate} from '@fuzdev/fuz_template/molt.js'; wetrunbooleancleanbooleanis_interactivebooleanApplyGate ApplyGate import type {ApplyGate} from '@fuzdev/fuz_template/molt.js'; What stands between a printed plan and applying it, given the run mode.
A terminal always gets a confirm prompt — the wizard's answers were just
typed, and one keystroke catches a typo'd name before it hits disk. The
one combination with no gate at all is --wetrun on a clean tree without
a terminal — there git reset --hard && git clean -fd restores the
pre-molt state (the tree was clean, so git clean removes only files
molt created). A dirty tree (reachable only via --force) never applies
without the dirty-specific in-the-moment confirmation, and without a
terminal it never applies at all: "commit first" is always available, so
an override flag would just recreate the hole.
(config: MoltConfig, templates: Templates): Action[] import {build_plan} from '@fuzdev/fuz_template/molt.js'; Builds the full molt plan from resolved choices. Pure — reads nothing.
configtemplatesAction[] (kept: Set<string>): void import {cascade} from '@fuzdev/fuz_template/molt.js'; Strips any feature whose requires parent is stripped.
keptSet<string>void (root: string): string[] import {check_all} from '@fuzdev/fuz_template/molt.js'; Verifies the plans for both sample configs, covering every anchor molt can touch (each feature exercised kept in one config and stripped in the other), plus the embedded-template invariants that anchors alone can't see.
rootstringstring[] "cli" import {CLI} from '@fuzdev/fuz_template/molt.js'; import {CliError} from '@fuzdev/fuz_template/molt.js'; Errors surfaced by molt.
Exit-code dialect: 0 success; 2 = the caller must change something
local (arguments, git state, modified files) before retrying; 1 =
everything else.
Errorkindtype CliErrorKind
remediationtype string | null
constructortype new (kind: CliErrorKind, message: string, remediation?: string | null): CliError
kindmessagestringremediationstring | nullnullusagetype (message: string): CliError
messagestringpreconditiontype (message: string, hint?: string | null): CliError
messagestringhintstring | nullnulldrifttype (issues: string[]): CliError
issuesstring[]exit_codeMaps the error to its stable exit code.
type (): number
numberhintAn optional remediation hint printed under the error.
type (): string | null
string | nullCliErrorKind import type {CliErrorKind} from '@fuzdev/fuz_template/molt.js'; (action: Action): string import {describe} from '@fuzdev/fuz_template/molt.js'; actionstring "docs" import {DOCS} from '@fuzdev/fuz_template/molt.js'; (kept: Set<string>): string[] import {empty_groups} from '@fuzdev/fuz_template/molt.js'; Kept features whose required members are all stripped — invalid combinations the caller must reject (or repair by stripping the parent too). Registry order, so callers report deterministically.
keptSet<string>string[] Feature import type {Feature} from '@fuzdev/fuz_template/molt.js'; A molt-selectable feature of the template.
idStable id used by --keep/--strip (kebab-case).
type string
promptWizard prompt, phrased as "keep X?".
type string
default_keepWhether the feature is kept when unspecified.
type boolean
requiresA feature this one is part of — stripping the parent strips this too.
type string | null
member_ofA feature this one provides a required member for — the parent can't be kept unless at least one of its members is kept (e.g. cargo refuses to load a workspace with no member crates).
type string | null
Feature[] import {FEATURES} from '@fuzdev/fuz_template/molt.js'; "github-extras" import {GITHUB_EXTRAS} from '@fuzdev/fuz_template/molt.js'; (value: string): string import {json_escape} from '@fuzdev/fuz_template/molt.js'; Escapes a string for embedding in a JSON string literal (also valid for
TOML basic strings, which share the \"/\\/\n escapes).
valuestringstring (root: string): Templates import {load_templates} from '@fuzdev/fuz_template/molt.js'; rootstringTemplates (parent: string): Feature[] import {members_of} from '@fuzdev/fuz_template/molt.js'; The features that provide required members for parent.
parentstringFeature[] MoltConfig import type {MoltConfig} from '@fuzdev/fuz_template/molt.js'; Fully-resolved molt choices, assembled from flags and wizard answers.
kept holds the feature ids (from FEATURES) to keep.
nametype string
npm_nametype string
descriptiontype string
domaintype string | null
repo_urltype string | null
kepttype Set<string>
(url: string): string | null import {normalize_remote_url} from '@fuzdev/fuz_template/molt.js'; Normalizes a git remote url (https, scp-style git@host:, or
ssh://git@host/) to an https repository url, returning null for the
template's own remote (a plain git clone of fuz_template keeps origin
pointed at the template — deriving that would be wrong).
urlstringstring | null (values: string[]): string[] import {parse_ids} from '@fuzdev/fuz_template/molt.js'; Splits repeatable/CSV flag values into feature ids, validating each.
valuesstring[]string[] (template: string, substitutions: [string, string][]): string import {render} from '@fuzdev/fuz_template/molt.js'; Substitutes __PLACEHOLDER__ tokens in a template.
Single-pass over the template: inserted values are never re-scanned, so
user-provided text (a description containing __RUST_SECTION__, say)
can't corrupt the output.
templatestringsubstitutions[string, string][]string (keep: string[], strip: string[]): { kept: Set<string>; explicit: Set<string>; } import {resolve} from '@fuzdev/fuz_template/molt.js'; Resolves the kept-feature set from --keep/--strip flags, applying
defaults and the requires cascade. explicit returns which features the
flags decided (the wizard prompts only for the rest).
keepstring[]stripstring[]{ kept: Set<string>; explicit: Set<string>; } "rust" import {RUST} from '@fuzdev/fuz_template/molt.js'; (): [MoltConfig, MoltConfig] import {sample_configs} from '@fuzdev/fuz_template/molt.js'; Two configs that together exercise every plan branch: one keeps every registry feature (derived from FEATURES, so a new feature is covered without touching this) and sets every optional value, one strips every feature and clears the optional values.
[MoltConfig, MoltConfig] Templates import type {Templates} from '@fuzdev/fuz_template/molt.js'; The output templates from crates/molt/templates/, substituted with
__PLACEHOLDER__ tokens. The Rust twin embeds these at compile time;
here they're read from the working tree (always present pre-molt).
PAGE_SVELTEtype string
README_MDtype string
CLAUDE_MDtype string
README_RUST_SECTIONtype string
CLAUDE_RUST_SECTIONtype string
WORKSPACE_CARGO_TOMLtype string
FUNDING_YMLtype string
(description: string): void import {validate_description} from '@fuzdev/fuz_template/molt.js'; Validates a project description: a single line, no control characters
(it lands in package.json, TOML, and markdown blockquotes).
descriptionstringvoid (domain: string): void import {validate_domain} from '@fuzdev/fuz_template/molt.js'; Validates a bare domain like example.com (no scheme, no path).
domainstringvoid (name: string): void import {validate_name} from '@fuzdev/fuz_template/molt.js'; Validates a project name: snake_case, usable as a crate name.
namestringvoid (name: string): void import {validate_npm_name} from '@fuzdev/fuz_template/molt.js'; Validates an npm package name (scoped names like @you/name allowed):
lowercase url-safe characters, no ./_ prefix, npm's 214-char limit.
namestringvoid (root: string, plan: Action[]): string[] import {verify} from '@fuzdev/fuz_template/molt.js'; Verifies every action's preconditions against the tree at root,
returning human-readable issues (empty = the plan is applicable).
rootstringplanAction[]string[]