@phcdevworks/spectre-init is the CLI scaffolding tool for the Spectre
ecosystem. It creates new Spectre-based TypeScript/Vite applications from
opinionated templates — structured app development, no framework, no magic.
Its job is to scaffold correctly, not to implement Spectre features itself.
Templates scaffold against these published packages:
| Package | Version | Role |
|---|---|---|
@phcdevworks/spectre-shell |
1.1.1 (+ unreleased bootstrapApp → Router return) |
SPA bootstrap — bootstrapApp, lifecycle callbacks, readiness signal |
@phcdevworks/spectre-shell-router |
1.1.0 | Client-side router — route matching, named routes, render/destroy hooks |
@phcdevworks/spectre-shell-signals |
1.1.0 (v1.2.0 queued — docs/manifest only, no API changes) | Reactive primitives — signals, computed, effects |
@phcdevworks/spectre-tokens |
3.3.1 | Design tokens — CSS variables (--sp-*), JS objects, Tailwind theme |
@phcdevworks/spectre-ui |
2.7.1 | Styling layer — CSS bundles, recipe functions, Tailwind preset |
@phcdevworks/spectre-components |
1.7.0 | Web component layer — custom elements used by shell-app starter |
@phcdevworks/spectre-ui-astro |
3.4.1 | Astro adapter — SSR-safe components |
- ESLint flat config with
typescript-eslint,jiti, lint and format scripts - GitHub Actions CI pipeline — Node 22/24 matrix,
npm run checkgate - Interactive prompts — name validation, type selection, output dir, confirmation
- Non-interactive path (positional arg) preserved for CI and scripting
- Post-scaffold output validation via
validateScaffold()beforenpm install
vanillatemplate —bootstrapApp, router, basic route pairshell-apptemplate —bootstrapApp, router, signals,effect/signalwired withrender/destroylifecycle
Both templates/*/package.json files pin current semver ranges.
Both templates import the spectre-ui base CSS bundle on entry. Shell-app
demonstrates --sp-* token variables in inline styles with no hardcoded hex
or px literals.
Both templates import only real exports from each package. routes() callback
returns Route[] per the BootstrapOptions contract. Navigation uses <a href="..."> links intercepted by the Router's click handler — no phantom
imports, no raw history.pushState. Both templates typecheck cleanly.
Add a spectre-ui-astro template for Astro-based projects.
Why it matters: spectre-ui-astro v3.4.1 ships 9 SSR-safe components and is
the supported path for Astro consumers. It has a different dependency graph
than vanilla and shell-app — no dependency on the shell packages.
Deliverables:
- Template at
templates/astro/generating a working Astro starter - Includes at least two
spectre-ui-astrocomponents (e.g.SpButton,SpCard) - New
astroentry in thePROJECT_TYPESregistry insrc/index.ts - Deps: Astro
^6.4.3,spectre-tokens,spectre-ui,spectre-ui-astro - Documented in
README.md
Implement after Phase 2 is confirmed stable.
Wire scaffolded projects into the spectre-manifest contract system.
spectre-manifest-check is shipped and wired into the check:ecosystem script
in upstream packages — the downstream tooling is in place. This can proceed
independently of Phase 3.
Remaining work in this repo:
- Scaffolded projects include a starter
spectre.manifest.jsonentry - README documents the manifest registration flow
Allow spectre-init update to sync an existing project to the latest template
structure.
Acceptance criteria:
- Syncs config files without overwriting custom application code
- Implement after Phase 3 templates are stable
Templates should demonstrate the full depth of the Spectre ecosystem. All APIs in this phase are shipped in current upstream packages.
Prerequisites — both now complete:
spectre-shell-routerPhase 3 P3 docs closed (meta, afterNavigate, onNavigationStart/End, subscribe patterns — README examples to copy from) ✓spectre-shellP2.5 implemented (bootstrapAppreturnsRouterinstance, decision is Option A) ✓ — in[Unreleased], queued for the nextspectre-shellrelease
Expose beforeMount, afterMount, and bootReady in both templates.
The examples/minimal-spa in spectre-shell is the canonical reference.
Acceptance criteria:
beforeMountandafterMountcallbacks present in thebootstrapAppcallbootReadysignal imported fromspectre-shelland observed viaeffect()in shell-app
spectre-shell-router v1.1.0 ships meta on route definitions and
afterNavigate on RouterOptions. Use them together for title management.
Acceptance criteria:
- Each route in the shell-app template carries
meta: { title: string } afterNavigatesetsdocument.titlefromcontext.meta?.title- Both routes (
/,/about) have distinct titles
onNavigationStart and onNavigationEnd are available on RouterOptions.
Wire a navigating signal to show/hide a loading indicator between route
changes. These are RouterOptions callbacks configured at bootstrap time —
no Router instance access required.
Acceptance criteria:
navigatingsignal toggled inonNavigationStart/onNavigationEnd- An
effect()reflects the loading state in the shell-app template DOM
bootstrapApp accepts plugins?: ShellPlugin[] as of spectre-shell v1.1.1.
A single minimal plugin (e.g., dev-mode boot logger) is enough to show the
pattern.
Acceptance criteria:
- One
ShellPlugindefined and passed in the shell-app template - Plugin uses
context.bootReadyto confirm startup state
Lint config✓CI pipeline✓Interactive prompts✓Output validation✓Vanilla template✓Shell-app template✓Bump version pins✓ (P2.1)Wire spectre-ui CSS✓ (P2.2)Fix phantom imports + broken route API✓ (P2.3)- Astro template ← next, unblocked (P3.1)
- Manifest integration ← can run in parallel with P3.1, unblocked (P4.1)
- Template modernization — lifecycle, metadata, loading state, plugins (P6.1–P6.4) Unblocked — both prerequisites are done; ready to start
- Update command (P5.1, after templates stable)
- Do not implement Spectre features here — this tool only scaffolds
- Do not add runtime code that is imported by generated projects
- Do not add framework logic, UI components, or design tokens
- WordPress scaffolding is out of scope — handled by
spectre-base - React, Vue, or other framework-specific templates are out of scope