Use pnpm wailspring from the repository root to scaffold source files in an existing Wailspring workspace: shared React components, Markdown guides, desktop app pages, and static Astro pages.
Every command runs in preview mode by default—it prints the file plan and complete new source without prompting or writing anything. Add --apply when ready to write.
Use pnpm run setup to rename the app identity, Go module, and native metadata (see Create an app). pnpm wailspring continues to work after rename.
Prerequisites and options
The CLI needs only Node 26 and pnpm 10.34.9 (root .npmrc selects the pinned pnpm version automatically) inside a Git checkout of the workspace. Go and Wails 3.1.0 are only needed if you later run native desktop builds or Go tests.
pnpm wailspring --help
pnpm wailspring <command> --help
| Command |
Creates or updates |
pnpm wailspring component <Name> [--storybook] |
Foundation recipe, shared React component, public export, optional Storybook story |
pnpm wailspring doc <path> --site [--draft] |
Markdown guide under packages/content/docs/ routed automatically by Astro |
pnpm wailspring doc <path> --repo |
Plain Markdown document under docs/, excluded from Astro site routes |
pnpm wailspring page desktop <slug> |
Lazy React route, sidebar nav entry, bundled en/de labels, and colocated styles |
pnpm wailspring page site <path> |
Static Astro page using BaseLayout and colocated foundation styles |
Global flags:
--dry-run — show the file plan and generated source without writing (default).
--apply — write the planned files immediately without a prompt, including in non-interactive shells. Use instead of --dry-run when ready to write.
--help — print usage information globally or after any subcommand.
Naming rules:
- Components:
PascalCase letters and digits, starting with an uppercase letter (max 64 characters).
- Docs and site pages: lowercase
kebab-case, starting with a letter (max 64 characters per segment). Nested paths with / are supported. Do not pass file extensions (.md, .mdx, .astro).
- Desktop pages: a single lowercase
kebab-case segment (no /).
Generate a shared React component
Preview first, then apply to create a styled React component backed by a foundation Panda recipe and an optional Storybook story:
pnpm wailspring component Notice --storybook
pnpm wailspring component Notice --storybook --apply
Omit --storybook if you do not want a starter story file.
Files changed
| Action |
Path |
Purpose |
| Create |
packages/design-system/src/notice.recipe.ts |
Foundation Panda recipe (componentNoticeRecipe, className: 'notice') using semantic light/dark tokens and 4px (square) radius |
| Update |
packages/design-system/src/recipes.ts |
Imports componentNoticeRecipe and registers componentNotice in recipes |
| Create |
packages/ui/src/components/notice.tsx |
React component exporting Notice and NoticeProps, styled with the foundation recipe |
| Update |
packages/ui/src/components/index.ts |
Exports Notice and type NoticeProps (re-exported at the @wailspring/ui package root) |
| Create |
apps/storybook/src/Notice.stories.tsx |
Optional CSF story (--storybook only) importing @wailspring/ui/components/notice with a visibility play check |
Keeping the recipe module at the root of packages/design-system/src/ lets @wailspring/design-system’s Panda library extraction include it automatically. Generated recipe helpers use component<Name> to stay distinct from Panda’s layout patterns. The React component keeps its requested name.
Imports and next edits
After rebuilding shared packages (pnpm run design-system:build), consumers can import:
- React component:
import { Notice, type NoticeProps } from '@wailspring/ui' or '@wailspring/ui/components/notice'
- Foundation recipe:
import { componentNotice } from '@wailspring/design-system/recipes' or '@wailspring/design-system/recipes/component-notice'
React consumers can also import the recipe from @wailspring/ui/recipes/component-notice.
Customize styling and variants in packages/design-system/src/notice.recipe.ts, component props or Ark primitives in packages/ui/src/components/notice.tsx, and interactive specimens in apps/storybook/src/Notice.stories.tsx. Keep shared packages host-agnostic: do not import Go bindings, app state, or app translations into packages/ui or packages/design-system.
Generate documentation
Choose --site for guides published on the Astro site, or --repo for repository-only Markdown. The two flags are mutually exclusive and exactly one is required.
Site documentation (--site)
Preview and create a site guide:
pnpm wailspring doc guides/my-guide --site
pnpm wailspring doc guides/my-guide --site --apply
This creates packages/content/docs/guides/my-guide.md with valid frontmatter (title, description, section: Guides, published: true). Astro automatically generates /docs/guides/my-guide/ and adds the page to the landing page, /docs/ index, and previous/next pager without manual route or navigation edits.
Pass --draft with --site to emit published: false:
pnpm wailspring doc guides/upcoming-topic --site --draft --apply
Astro validates draft frontmatter against apps/site/src/content.config.ts and omits drafts from generated routes, indexes, and pagers. Change published: false to published: true (or remove the line) when ready to publish. Draft files remain visible in the repository.
--draft is accepted only with doc --site. Path segments named readme or index are reserved for site docs. See Writing documentation for frontmatter fields, ordering, source-relative link rewriting, and static MDX components.
Repository documentation (--repo)
Preview and create a repository document outside the site’s content collection:
pnpm wailspring doc notes/release-checklist --repo
pnpm wailspring doc notes/release-checklist --repo --apply
This creates docs/notes/release-checklist.md with a # Release Checklist heading and no site frontmatter. Astro does not route files under docs/. Commit repository docs as ordinary tracked source.
Generate a desktop app page
Preview and create a lazy-loaded React page for apps/desktop/frontend:
pnpm wailspring page desktop reports
pnpm wailspring page desktop reports --apply
Desktop page names use a single segment (for example reports, not ops/reports). Built-in route names (overview, items, settings, developer) are reserved.
Files changed
| Action |
Path |
Purpose |
| Update |
apps/desktop/frontend/src/workspace-pages.ts |
Appends a lazy registry entry (id, path: '/reports', Page, and bundled en/de title and description) |
| Create |
apps/desktop/frontend/src/pages/reports.tsx |
React page using useTranslation() and PageHeading |
| Create |
apps/desktop/frontend/src/pages/reports.styles.ts |
Colocated Panda styles importing css from ../../styled-system/css/index.js |
apps/desktop/frontend/src/app.tsx automatically adds the sidebar NavLink and a <Suspense>-wrapped <Route> at #/reports, and apps/desktop/frontend/src/i18n/index.ts merges each entry’s English and German strings into bundled offline translations under workspacePages.<id>.*.
Ownership and customization
- Edit English and German navigation labels and descriptions in
apps/desktop/frontend/src/workspace-pages.ts.
- Build page markup in
apps/desktop/frontend/src/pages/reports.tsx using @wailspring/ui components and colocated styles in reports.styles.ts.
- Generated pages intentionally receive no
host prop or Go binding access and leave saved settings, theme/language lifecycle, and opt-in Developer mode (#/developer) gating untouched.
- If a page later needs persisted data or native OS actions, add typed methods in Go and wire them through
apps/desktop/frontend/src/host/contract.ts (see Build a feature and Desktop app). Browser preview (pnpm run dev:desktop) uses session-only memory with native actions disabled.
Generate an Astro site page
Preview and create a static page under apps/site/src/pages/:
pnpm wailspring page site about
pnpm wailspring page site about --apply
Nested paths work the same way—for example pnpm wailspring page site company/about --apply writes apps/site/src/pages/company/about.astro and apps/site/src/pages/company/_about.styles.ts. Top-level docs and any index segment are reserved—use pnpm wailspring doc <path> --site for documentation routes.
Files changed
| Action |
Path |
Purpose |
| Create |
apps/site/src/pages/about.astro |
Static Astro route using BaseLayout, @wailspring/design-system/recipes (shell, pageHeader), @wailspring/ui/astro (TextLink), and ./_about.styles |
| Create |
apps/site/src/pages/_about.styles.ts |
Colocated Panda styles importing css from @wailspring/design-system/css (prefixed with _ so Astro does not emit an endpoint route) |
The page renders statically at /about/ (or /<nested-path>/) with no React runtime or client hydration. Site header navigation is manual—add an entry to SITE.nav in apps/site/src/lib/site.ts if you want the page in the top navigation bar.
Build and verify after generating
Inspect generated files with git status and git diff, then run the relevant workspace checks. Root commands rebuild shared packages (@wailspring/design-system, @wailspring/icons, @wailspring/ui, @wailspring/docs) before running app builds or checks:
# Rebuild shared packages after editing or generating a component/recipe
pnpm run design-system:build
# Verify site pages and documentation
pnpm run build:site
pnpm --filter @wailspring/site check
pnpm --filter @wailspring/site test
# Verify desktop frontend pages
pnpm run build:desktop
pnpm --filter @wailspring/desktop check
pnpm --filter @wailspring/desktop test
# Full default web/workspace build, typecheck, and test suite
pnpm run build
pnpm run check
pnpm test
If you generated a Storybook story (--storybook), run the optional Storybook commands separately (Storybook stays outside the default root build, check, and test scripts):
pnpm run storybook
pnpm run check:storybook
pnpm run build:storybook
pnpm run test:storybook
Conflicts and interrupted writes
The CLI refuses unsafe or ambiguous edits instead of overwriting existing work:
- Existing target files, case collisions, duplicate component/recipe/export names, overlapping desktop or site routes, invalid or Windows-reserved path segments, symlinks/junctions, and concurrent edits to files read during planning are refused with exit code
1.
- Multi-file updates stage together and roll back if a write fails; if a run is interrupted mid-write, inspect the workspace and any reported
.wailspring.lock message before re-running.
- Required workspace files (
app.identity.json, package.json, and edited entrypoints) must be tracked in Git.
- The CLI performs no network requests, package installs, registry/plugin loads, Go/auth/migration changes, or npm publication.
- Architecture — package ownership, Astro vs. React styling paths, and desktop host boundaries.
- Build a feature — full-stack walkthrough connecting tokens, React components, Go services, bindings, and docs.
- Writing documentation — frontmatter schema, link rewriting, drafts, and MDX authoring.
- Create an app — rename app identity, Go module, and platform metadata with
pnpm run setup.
Use
pnpm wailspringfrom the repository root to scaffold source files in an existing Wailspring workspace: shared React components, Markdown guides, desktop app pages, and static Astro pages.Every command runs in preview mode by default—it prints the file plan and complete new source without prompting or writing anything. Add
--applywhen ready to write.Use
pnpm run setupto rename the app identity, Go module, and native metadata (see Create an app).pnpm wailspringcontinues to work after rename.Prerequisites and options
The CLI needs only Node 26 and pnpm 10.34.9 (root
.npmrcselects the pinned pnpm version automatically) inside a Git checkout of the workspace. Go and Wails 3.1.0 are only needed if you later run native desktop builds or Go tests.pnpm wailspring component <Name> [--storybook]pnpm wailspring doc <path> --site [--draft]packages/content/docs/routed automatically by Astropnpm wailspring doc <path> --repodocs/, excluded from Astro site routespnpm wailspring page desktop <slug>en/delabels, and colocated stylespnpm wailspring page site <path>BaseLayoutand colocated foundation stylesGlobal flags:
--dry-run— show the file plan and generated source without writing (default).--apply— write the planned files immediately without a prompt, including in non-interactive shells. Use instead of--dry-runwhen ready to write.--help— print usage information globally or after any subcommand.Naming rules:
PascalCaseletters and digits, starting with an uppercase letter (max 64 characters).kebab-case, starting with a letter (max 64 characters per segment). Nested paths with/are supported. Do not pass file extensions (.md,.mdx,.astro).kebab-casesegment (no/).Generate a shared React component
Preview first, then apply to create a styled React component backed by a foundation Panda recipe and an optional Storybook story:
Omit
--storybookif you do not want a starter story file.Files changed
packages/design-system/src/notice.recipe.tscomponentNoticeRecipe,className: 'notice') using semantic light/dark tokens and4px(square) radiuspackages/design-system/src/recipes.tscomponentNoticeRecipeand registerscomponentNoticeinrecipespackages/ui/src/components/notice.tsxNoticeandNoticeProps, styled with the foundation recipepackages/ui/src/components/index.tsNoticeandtype NoticeProps(re-exported at the@wailspring/uipackage root)apps/storybook/src/Notice.stories.tsx--storybookonly) importing@wailspring/ui/components/noticewith a visibility play checkKeeping the recipe module at the root of
packages/design-system/src/lets@wailspring/design-system’s Panda library extraction include it automatically. Generated recipe helpers usecomponent<Name>to stay distinct from Panda’s layout patterns. The React component keeps its requested name.Imports and next edits
After rebuilding shared packages (
pnpm run design-system:build), consumers can import:import { Notice, type NoticeProps } from '@wailspring/ui'or'@wailspring/ui/components/notice'import { componentNotice } from '@wailspring/design-system/recipes'or'@wailspring/design-system/recipes/component-notice'React consumers can also import the recipe from
@wailspring/ui/recipes/component-notice.Customize styling and variants in
packages/design-system/src/notice.recipe.ts, component props or Ark primitives inpackages/ui/src/components/notice.tsx, and interactive specimens inapps/storybook/src/Notice.stories.tsx. Keep shared packages host-agnostic: do not import Go bindings, app state, or app translations intopackages/uiorpackages/design-system.Generate documentation
Choose
--sitefor guides published on the Astro site, or--repofor repository-only Markdown. The two flags are mutually exclusive and exactly one is required.Site documentation (
--site)Preview and create a site guide:
This creates
packages/content/docs/guides/my-guide.mdwith valid frontmatter (title,description,section: Guides,published: true). Astro automatically generates/docs/guides/my-guide/and adds the page to the landing page,/docs/index, and previous/next pager without manual route or navigation edits.Pass
--draftwith--siteto emitpublished: false:Astro validates draft frontmatter against
apps/site/src/content.config.tsand omits drafts from generated routes, indexes, and pagers. Changepublished: falsetopublished: true(or remove the line) when ready to publish. Draft files remain visible in the repository.--draftis accepted only withdoc --site. Path segments namedreadmeorindexare reserved for site docs. See Writing documentation for frontmatter fields, ordering, source-relative link rewriting, and static MDX components.Repository documentation (
--repo)Preview and create a repository document outside the site’s content collection:
This creates
docs/notes/release-checklist.mdwith a# Release Checklistheading and no site frontmatter. Astro does not route files underdocs/. Commit repository docs as ordinary tracked source.Generate a desktop app page
Preview and create a lazy-loaded React page for
apps/desktop/frontend:Desktop page names use a single segment (for example
reports, notops/reports). Built-in route names (overview,items,settings,developer) are reserved.Files changed
apps/desktop/frontend/src/workspace-pages.tsid,path: '/reports',Page, and bundleden/detitleanddescription)apps/desktop/frontend/src/pages/reports.tsxuseTranslation()andPageHeadingapps/desktop/frontend/src/pages/reports.styles.tscssfrom../../styled-system/css/index.jsapps/desktop/frontend/src/app.tsxautomatically adds the sidebarNavLinkand a<Suspense>-wrapped<Route>at#/reports, andapps/desktop/frontend/src/i18n/index.tsmerges each entry’s English and German strings into bundled offline translations underworkspacePages.<id>.*.Ownership and customization
apps/desktop/frontend/src/workspace-pages.ts.apps/desktop/frontend/src/pages/reports.tsxusing@wailspring/uicomponents and colocated styles inreports.styles.ts.hostprop or Go binding access and leave saved settings, theme/language lifecycle, and opt-in Developer mode (#/developer) gating untouched.apps/desktop/frontend/src/host/contract.ts(see Build a feature and Desktop app). Browser preview (pnpm run dev:desktop) uses session-only memory with native actions disabled.Generate an Astro site page
Preview and create a static page under
apps/site/src/pages/:Nested paths work the same way—for example
pnpm wailspring page site company/about --applywritesapps/site/src/pages/company/about.astroandapps/site/src/pages/company/_about.styles.ts. Top-leveldocsand anyindexsegment are reserved—usepnpm wailspring doc <path> --sitefor documentation routes.Files changed
apps/site/src/pages/about.astroBaseLayout,@wailspring/design-system/recipes(shell,pageHeader),@wailspring/ui/astro(TextLink), and./_about.stylesapps/site/src/pages/_about.styles.tscssfrom@wailspring/design-system/css(prefixed with_so Astro does not emit an endpoint route)The page renders statically at
/about/(or/<nested-path>/) with no React runtime or client hydration. Site header navigation is manual—add an entry toSITE.navinapps/site/src/lib/site.tsif you want the page in the top navigation bar.Build and verify after generating
Inspect generated files with
git statusandgit diff, then run the relevant workspace checks. Root commands rebuild shared packages (@wailspring/design-system,@wailspring/icons,@wailspring/ui,@wailspring/docs) before running app builds or checks:If you generated a Storybook story (
--storybook), run the optional Storybook commands separately (Storybook stays outside the default rootbuild,check, andtestscripts):Conflicts and interrupted writes
The CLI refuses unsafe or ambiguous edits instead of overwriting existing work:
1..wailspring.lockmessage before re-running.app.identity.json,package.json, and edited entrypoints) must be tracked in Git.Related guides
pnpm run setup.