Config

crust.config.ts — default export, or an export named config — or crust.json holding the same object, in that order. The object is validated once at startup and unknown keys are rejected at every level, so a typo is a launch failure rather than a silently ignored option.

import type { CrustConfig } from "crust";

export default {
	app: { id: "land.jyz.example", name: "Example", version: "0.1.0" },
	windows: [{ label: "main", url: "/", width: 900, height: 640, title: "Example" }],
} satisfies CrustConfig;

Types are what the validator accepts. The default is what the consuming code does when the key is absent — the validator itself fills in nothing.

app

keytypedefaultwhat it does
idstringrequiredreverse-DNS bundle identifier written to Info.plist; also seeds the bridge port and is the notification identity
namestringrequiredapp name, and the name platform failures print
versionstringrequiredCFBundleShortVersionString
iconstringunsetPNG resolved against --dir by crust build; a missing file fails the build
activatestring"always"when creating a window brings the app to the front: "always", "first" or "never"

app.activate

Whether a window create raises the app, which is what puts the window on the active Space and therefore into AppKit's AXWindows. Only macOS reads it; the validator accepts it everywhere so one config serves every platform.

A second window of an already-active app is never re-raised, whatever the mode: the selector is guarded on -[NSApplication isActive], and the once-per-process -activate is shared with window.focus.

testing

activation (string, default "auto") — how a probe run treats activation. "auto" is an ordinary launch and app.activate decides, so the first window create brings the app forward. "none" never activates, and accessibility.elementCount then answers a typed needs-activation instead of the empty tree an inactive app gives. "on-demand" also launches without activating and raises the app once — -activateIgnoringOtherApps: — for the first accessibility read that needs it; later reads do not raise it again. Page-level testing needs no activation in any mode, because testing.* runs inside the window's own webview and window.capture renders that webview, so a probe still clicks, types, queries and captures a window that never takes the front. Pair it with window.create { activate: false } and nothing a probe does moves the human's focus.

windows

At least one entry. A missing or empty array is a config error, not a windowless app.

keytypedefaultwhat it does
labelstringrequiredthe handle window commands and platform.window(label) use
urlstring"/"appended to the bridge URL; ignored when dev.url is set
widthpositive integer1100content width in points
heightpositive integer760content height in points
minWidthpositive integerunset (0)minimum width, clamped into width; no height minimum is inferred
minHeightpositive integerunset (0)minimum height, clamped into height, independent of minWidth
titlestringunsetwindow title, applied from C and read back; a mismatch throws
materialstring"none"backdrop behind the webview; see below

Both minimums are independent: setting minWidth alone does not infer a minimum height, and a configured width/height below its own minimum is clamped up to it. Absent means 0, the no-constraint value AppKit expects.

windows[].material

A named backdrop the current OS can apply. Validation refuses a name the platform cannot use, so a typo or a cross-platform copy is a launch failure naming windows[0].material, never a grey window.

Absent is "none" — opaque, with no backdrop call. The parity page has the comparison row.

dev

keytypedefaultwhat it does
urlstringunsetone dev-server origin every window loads verbatim; windows[].url is then ignored, and its origin is the one extra origin the bridge allows
beforeDevCommandstringunsetstarted, not awaited, by crust dev through sh -c in the project directory
ignorestring arrayunsetextra path fragments that never restart the backend, for output the built-in rules cannot know — every entry is a substring of the changed path

With dev.url set, crust dev waits up to 30 s for a TCP connect on that port before starting the runtime, because the window loads the URL exactly once and cannot retry. A restart rotates the bridge token, so a file written into the project while the backend runs must not look like backend code: public/, dist/, node_modules/, .next/, out/, .crust/ and frontend extensions are already ignored, and dev.ignore covers the rest. See Dev server.

singleInstance

keytypedefaultwhat it does
idstringthe app id, plus a hash of the project directory under crust devnames the lock file, so a probe runs beside the user's copy instead of raising it; one file-name token

CRUST_SINGLE_INSTANCE=0 disables the check for one launch. See Single instance.

build

keytypedefaultwhat it does
beforeBuildCommandstringunsetrun to completion before the asset directory is read; a non-zero exit aborts the build naming the command and its exit code
assetsstring"public"directory crust build embeds, relative to --dir; must hold index.html, and may not resolve to dist/
minimumSystemVersionstring"13.0"LSMinimumSystemVersion
urlSchemestringunsetcustom URL scheme claimed in Info.plist as CFBundleURLTypes, so macOS hands scheme://… URLs to this app
sidecarsstring arrayunsetexecutables crust build copies beside the binary at 0755 and sidecar.spawn may run; each must be a relative path inside the project, and the plugin refuses a name that is not in this list

plugins

keytypedefaultwhat it does
pluginsstring arrayall built-insbuilt-ins to register; the crust: prefix is optional

Absent or [] registers every built-in plugin the runtime assembles — the core set (fs, dialog, notification, tray, autostart, logging) plus stronghold, window, store, database, shell, updater when its section exists, and all the platform's native plugins. stronghold, store and database are built with this app's own data root, so two crust apps never share a vault or a store file. Naming any restricts registration to exactly those, so every other name answers unknown-command. An unknown name fails startup with crust: unknown plugin "nope" — v1 ships …, where the tail is the full list of registered built-in names for this platform, built at runtime rather than a fixed five. The app namespace and any plugin mounted with app.use are always registered — this key selects built-ins only.

extensions

keytypedefaultwhat it does
extensionsstring arrayunset — discover *.tsextension files to load, relative to the project; a relative entry that climbs out of it is refused

Absent, the loader discovers extensions/*.ts; present, it loads exactly those files. Each is a flat non-empty string path, resolved against the project. See Extensions.

logging

keytypedefaultwhat it does
levelstring"info"quietest level written: trace, debug, info, warn or error; --log-level and CRUST_LOG beat it
consolebooleanfalsemirror records to the terminal, routed by level: debug/info to stdout, warn through console.warn, error to stderr; in a built app only warn and error are mirrored, while crust dev mirrors every level
dirstring"logs"directory for the JSONL files, relative to the app's data directory
generationspositive integer3rotated app.N.jsonl archives kept; the oldest is deleted last
maxBytespositive integer5242880size at which the live file rotates (5 MiB)

The framework logs a run itself — app and window lifecycle, every invoke with its duration and outcome, page console and errors, platform refusals — under ~/Library/Application Support/<app.id>/logs/. See Logging.

security

keytypedefaultwhat it does
cspstringDEFAULT_CSPContent-Security-Policy served with every document
capabilitiescapability arrayunset — allow allnamed grants a window label can hold; absent or empty allows every command
grantsobjectunset — deny allwhich capability names each window label holds; once capabilities is non-empty, a label with no entry holds none
microphonestringunset — deny allsentence macOS shows when this app asks for the microphone; setting it is the whole capture opt-in

DEFAULT_CSP is default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; media-src 'self' blob:; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'. script-src carries no 'unsafe-inline': the bridge mints a nonce per document, stamps its own bootstrap and any authored inline <script> with it, and an injected tag without the nonce is refused. style-src keeps 'unsafe-inline' because inline styles are not a script-injection door, and media-src admits blob: so a take recorded through MediaRecorder plays back from URL.createObjectURL — without it the fallback to default-src 'self' refuses it. Any replacement must keep connect-src 'self', or every invoke is a CSP violation, and setting csp wins whole: the bridge still mints and stamps its bootstrap nonce but never rewrites your policy to admit it — unlike the default, a custom policy cannot name that per-response nonce. Config validation resolves the effective script directive the way a browser does — script-src-elem, then script-src, then default-src — and refuses whichever one it finds when it does not admit inline scripts. A policy with no script-src is therefore not automatically fine: default-src 'self' is the effective directive and is refused. The message explains why — the inline bootstrap would be blocked, window.crust would never install and every invoke would fail silently.

A capability is { name, actions }, where each action is plugin:command with * as the one metacharacter: dialog:*, fs:read*, shell:spawn. The dotted shell.spawn is a config error rather than a second spelling. Empty actions, a duplicate capability name, and a grant naming a capability that does not exist are each a launch failure naming the key. Absent capabilities allows every command, which is what every app without this section sees; once it is non-empty the bridge denies by default, per window label. App commands take two action forms — the narrow app:<name> (e.g. app:notes.save) and the broad alias app:invoke; a grant of either authorizes, and the finest matching action is the one named in a refusal. See Permissions for the wildcard caveat and worked grants.

microphone is the whole capture opt-in: its sentence is copied verbatim into Info.plist as NSMicrophoneUsageDescription, which macOS shows in its permission prompt, so it is checked as a sentence — at least two words, ending in ., ? or ! — rather than merely non-empty. A hardened-runtime signature then seals com.apple.security.device.audio-input with it; without that entitlement a signed bundle cannot be granted the microphone at all. The page then calls navigator.mediaDevices.getUserMedia as it would anywhere — crust widens the grant and adds no recording API, so the stream, its tracks and where the bytes go are yours. Only a microphone-only request is granted: camera and mixed microphone-plus-camera requests are denied, because the bundle declares no purpose for them. Absent, every capture request is denied; crust dev denies too, since an unbundled run carries no Info.plist for macOS to read; and Windows and Linux deny today, because WebView2's PermissionRequested and WebKitGTK's permission-request each need their own handling before either can grant.

fs

keytypedefaultwhat it does
scopestring arrayunset — no boundaryabsolute path prefixes every fs command must stay inside; relative paths refused

Absent, fs has no scope and reaches any path the process can. A non-absolute entry is a config error, because a relative root would resolve against the process cwd and draw a different boundary in dev and in a built app. See Files.

shell

keytypedefaultwhat it does
allowstring arrayunset — deny allprograms a page may spawn: bare names or absolute paths; a relative path or an interpreter is respectively refused/warned
cwdRootstringunset — process cwdabsolute directory every cwd and relative program path must stay inside; name it absolutely

allow is deny-by-default: with no section every spawn is refused. cwdRoot must be absolute, because the consumer resolves it against the process cwd — the project under crust dev, but / in a built app. Allowing an interpreter (sh, node, python*, …) only warns; it stops the allow list bounding what runs. See Shell.

updater

keytypedefaultwhat it does
endpointstringunsetmanifest URL check falls back to when the page passes none
pubkeystringunsetbase64 of 32 raw bytes: the only signing key this app accepts
autoCheckbooleanunsetwhether the app wants a startup check; updater.config reports it
allowFileUrlbooleanunsetpermit a file: artifact URL in updater.download — for a test, not a shipped app

The section existing is what registers crust:updater; with no updater section the runtime carries no download-and-replace surface. pubkey is checked by shape at startup, so a wrong-size key fails a launch rather than every signature. See Updater.

pty

keytypedefaultwhat it does
shellstringunset — login shellthe section existing is the opt-in; program the terminal runs, and the only one open may name — Pty

preview

keytypedefaultwhat it does
widthpositive integerthe panel's owndefault panel width in points; absent still registers the plugin. Ships in 0.2.10 — Preview
heightpositive integerthe panel's owndefault panel height in points

browser

keytypedefaultwhat it does
originsstring arrayunset — deny allhttp(s) origins, scheme and host only, an embedded surface may load. Ships in 0.2.11 — Browser

See Config rules for what app.id decides at runtime, and how a bad config is reported.