Skip to content

auth: taskless auth -d <dir> fails with "Unknown command", reading the directory as a subcommand #424

Description

@thecodedrift

taskless auth (the status path) declares -d, --dir, but passing it with a separate value fails:

$ taskless auth -d .
Unknown command `.`

$ taskless auth --dir=.
Logged in as … (…)

Reproduced on 0.12.0-next-0fb5221 (built from main plus #422, which does not touch auth). auth login -d <dir> works, because login is found first and the value never reaches the parent's resolution.

Cause

citty resolves a subcommand from the first raw argument that does not start with -. In auth -d . that argument is ., the flag's value, and . is neither login nor logout, so citty reports an unknown command before auth's own run is reached. --dir=. works only because the value stays inside the flag token.

auth's run has the same assumption. Its "was a subcommand given?" guard (packages/cli/src/commands/auth.ts, rawArgs.some((argument) => !argument.startsWith("-"))) would also read a flag value as a subcommand. So fixing only the citty side would turn the error into silently printing nothing.

Why it matters

auth login state is stored per project (.taskless/.env.local.json), so -d is the natural way to check whether another checkout is logged in. That was the use it failed on here.

Possible fix

agent.ts and check.ts already skip flag values when scanning rawArgs for positionals. The same scanner, or declaring the status path as a subcommand, would cover both halves.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions