Skip to content

Alias validation reports every alias as broken before codegen has run #136

Description

@garretpremo

Problem

rewriteArgv validates every alias against realPaths and emits an error per alias that does not resolve (src/aliases.ts:181-186). It has no notion of "the generated command surface does not exist yet", so in a project whose aliases point at generated commands, every alias reports as broken on every invocation until codegen has run.

That is the exact state a fresh install starts in.

Reproduction

In a consumer with .apijack/generated/ gitignored (the normal setup — generated code is API/site-specific) and an aliases.json pointing at generated operations:

$ rrc --version
apijack: aliases: alias "matter list" → "matter matter-list" does not resolve to a known command
apijack: aliases: alias "matter create" → "admin matters create-matter" does not resolve to a known command
apijack: aliases: alias "matter docs" → "matter get-matter-document-count" does not resolve to a known command
... 7 more ...
1.15.0

Ten lines of noise ahead of one line of output, on every command, including setup — a new user's first interaction. After generate runs they all resolve and the output is silent, confirming the aliases were correct the whole time.

This is most visible for standalone-binary distributions, where generated/ cannot ship (it is gitignored by design), so every fresh install begins in the noisy state.

Suggested fix

Distinguish "nothing is generated yet" from "this alias is genuinely wrong":

  • If realPaths contains no generated commands (empty, or only built-ins), skip alias validation entirely — there is nothing meaningful to validate against.
  • Keep the current per-alias error when generated commands do exist but a specific expansion is missing. That case is a real broken alias and worth surfacing.

A coarser variant, if distinguishing built-ins from generated paths is awkward: collapse to a single line (aliases: N aliases unresolved — run 'generate' first) rather than one line per alias.

Notes

Not a correctness bug — the CLI continues fine and the aliases work after codegen. It is purely first-run noise, but it lands on the worst possible surface: the output of the first commands a new user ever runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmerged to devIssue has been merged to dev. Will be closed once merged to mainready-for-implementIssue has been triaged and can be implemented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions