ai-project-bootstrap
Docs / Contributing / Adding an archetype

Adding an archetype

A preset-shaped stack selection plus real starter source. It composes three things that already exist rather than introducing a fourth authoring shape.

archetypes/<id>/
  manifest.json           required — { id, name, description, choices }
  package.fragment.json   optional — merged into package.json
  scaffold/**             optional — mirrored into the project root

choices is a preset's choices

Exactly the same shape as an entry in config/presets.json — copy one as a starting point if the archetype's stack is close. It is validated through the identical validate → resolve pipeline, so a choices referencing a dropped module id, or bundling two conflicting ones, fails on every test run rather than only when someone passes the flag.

Templating in scaffold files

scaffold/** is rendered with the same engine every technology template uses, but with only projectName and projectSlug as data — an archetype commits to one fixed stack by design, so it never needs branching on what else was selected.

A literal double-brace in a comment gets evaluated too

Explaining template syntax in prose inside a scaffold file is exactly how a real instance of this was caught. A contract test now checks every archetype's scaffold for it automatically.

Path collisions

Scaffold paths must not collide with anything a selected technology's own templates could write. Two different owners writing the same path throws PATH_COLLISION. A declared-but-empty folders.json entry is fine — only actual file writes collide.

Actually run it

ai-project-bootstrap --archetype <id> --yes
# then, inside the generated project:
npm install && npm run typecheck && npm run lint

This discipline caught two real, pre-existing gaps in the base template while the first archetype was built — @types/node never installed anywhere despite every module's docs using process.env, and dark-theme not handling react-native's 'unspecified' colour scheme value. Both were fixed at the source rather than worked around in the archetype.