Skip to content

feat: accept template ids as init flags (--react-vite alongside --basic) #151

Description

@Bccorb

Problem

The template flag and the template id are different strings, and only the flag works.

From registry.json:

id alias flag that works today
react-vite basic --basic
react-oauth oauth --oauth
express (none) none
fastify (none) none

So someone asked for the React Vite starter types --react-vite, gets
Unknown option "--react-vite", and has no way to find --basic short of reading the
registry. The api layer is worse: neither express nor fastify has an alias, so there is no
flag for the backend at all and the prompt cannot be skipped.

resolveTemplateAliases() in src/commands/init.ts matches on
t.alias only.

Change

  • Match a flag against the template id as well as its alias, so --react-vite and
    --basic both select react-vite, and --express / --fastify start working with no
    registry change.
  • Keep aliases as the short form; they stay in the help text and the docs.
  • Extend the "Available template flags" error to list both forms, and point at
    seamless templates list.
  • Conflict detection is unchanged: two flags resolving to different templates of the same
    kind is still a hard error, and --basic --react-vite resolves to the same id so it is not
    a conflict.

Acceptance

  • seamless init --react-vite and seamless init --basic produce identical preselection.
  • seamless init --fastify preselects the api template and skips the backend prompt.
  • seamless init --basic --react-oauth still errors as a conflict.
  • Unknown flag error names both the id and alias forms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions