Skip to content

fix(cli): Use correct CLI command for auth login references - #13

Merged
thecodedrift merged 2 commits into
mainfrom
fix/auth-login-cli-command
Apr 7, 2026
Merged

thecodedrift merged 2 commits into
mainfrom
fix/auth-login-cli-command

Conversation

@thecodedrift

Copy link
Copy Markdown
Member

All user-facing references to taskless auth login assumed the CLI was
installed globally, which is unlikely in agent environments. Agents would
waste tokens attempting commands that don't exist, then self-correct.

CLI error messages now dynamically detect the invoking package manager
via npm_config_user_agent (pnpm dlx, yarn dlx, bunx) and fall back
to npx. This is handled by a new getCliPrefix() utility used in
identity.ts, token.ts, and rules.ts.

Skills and commands now default to npx @taskless/cli@latest (the most
universal runner) and include a package manager detection note instructing
agents to prefer the project's lockfile-indicated manager.

Static help text files (rules-create.txt, rules-improve.txt) use npx
since they can't be dynamic.

Fixes #12

Replace bare `taskless auth login` with the proper package-manager-aware
invocation. CLI error messages now dynamically detect the invoking package
manager via npm_config_user_agent. Skills default to npx with a note to
prefer the project's package manager.

Closes #12

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 7, 2026 05:44
@thecodedrift
thecodedrift marked this pull request as ready for review April 7, 2026 05:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates user-facing auth login references to avoid assuming a globally-installed taskless binary, improving usability in agent/ephemeral environments by defaulting to npx @taskless/cli@latest and making CLI error messages suggest the invoking package manager.

Changes:

  • Added a new getCliPrefix() utility that detects the invoking package manager via npm_config_user_agent and uses it in CLI error messages.
  • Updated skills and tskl/* command docs to default to npx @taskless/cli@latest, with guidance on using lockfile-indicated package managers.
  • Updated static CLI help text (rules-create.txt, rules-improve.txt) to reference npx @taskless/cli@latest auth login.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
skills/taskless-logout/SKILL.md Switches example invocations to npx and adds package-manager guidance.
skills/taskless-login/SKILL.md Switches example invocations to npx and adds package-manager guidance.
skills/taskless-info/SKILL.md Switches example invocations to npx and adds package-manager guidance.
skills/taskless-improve-rule/SKILL.md Updates multiple CLI invocations and auth remediation guidance to npx.
skills/taskless-improve-rule-anonymous/SKILL.md Switches verify/delete examples to npx and adds package-manager guidance.
skills/taskless-delete-rule/SKILL.md Switches help/delete examples to npx and adds package-manager guidance.
skills/taskless-create-rule/SKILL.md Switches create/meta/auth remediation examples to npx and adds package-manager guidance.
skills/taskless-create-rule-anonymous/SKILL.md Switches verify/schema examples to npx and adds package-manager guidance.
skills/taskless-check/SKILL.md Switches check/init examples to npx and adds package-manager guidance.
packages/cli/src/util/package-manager.ts Introduces getCliPrefix() for dynamic, package-manager-specific command suggestions.
packages/cli/src/help/rules-improve.txt Replaces bare taskless auth login prerequisite with npx @taskless/cli@latest auth login.
packages/cli/src/help/rules-create.txt Replaces bare taskless auth login prerequisite with npx @taskless/cli@latest auth login.
packages/cli/src/auth/token.ts Updates legacy-auth warning to use getCliPrefix()-based login instruction.
packages/cli/src/auth/identity.ts Updates auth-required / missing-orgId errors to use getCliPrefix()-based login instruction.
packages/cli/src/api/rules.ts Updates API error guidance strings to use getCliPrefix()-based login instruction.
commands/tskl/rule.md Switches documented invocations to npx and adds package-manager guidance.
commands/tskl/logout.md Switches documented invocations to npx and adds package-manager guidance.
commands/tskl/login.md Switches documented invocations to npx and adds package-manager guidance.
commands/tskl/info.md Switches documented invocations to npx and adds package-manager guidance.
commands/tskl/improve.md Switches documented invocations to npx and adds package-manager guidance.
commands/tskl/check.md Switches documented invocations to npx and adds package-manager guidance.
.changeset/fix-auth-login-command.md Adds a changeset describing the user-facing command reference updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/cli/src/util/package-manager.ts Outdated
Comment thread packages/cli/src/util/package-manager.ts
Comment thread .changeset/fix-auth-login-command.md Outdated
Comment thread skills/taskless-login/SKILL.md Outdated
Comment thread skills/taskless-logout/SKILL.md Outdated
Comment thread commands/tskl/logout.md Outdated
Comment thread commands/tskl/info.md Outdated
Comment thread commands/tskl/check.md Outdated
Comment thread commands/tskl/improve.md Outdated
Comment thread commands/tskl/rule.md Outdated
- Fall back to npx for Yarn Classic (v1.x) since it lacks yarn dlx
- Clarify skill package manager notes with "(Yarn Berry/2+ only)"
- Narrow changeset description to match actual scope
- Add unit tests for getCliPrefix()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

packages/cli/src/help/rules-create.txt:12

  • The prerequisites now recommend running via npx @taskless/cli@latest, but the subsequent Usage: and Examples: sections still show taskless rules create ..., which continues to assume a globally-installed taskless binary. Consider updating those usage/examples to use the same runner (or otherwise clarify that taskless is only available when installed globally).
Prerequisites:
  Run `npx @taskless/cli@latest auth login` to authenticate first.
  Your repository must have a GitHub origin remote.

Usage:
  taskless rules create --from <file> [options]

packages/cli/src/help/rules-improve.txt:12

  • The prerequisites now recommend running via npx @taskless/cli@latest, but the Usage: and Examples: sections still show taskless rules improve ..., which assumes a globally-installed taskless binary. Consider updating those usage/examples to match the recommended invocation (or explicitly document the difference).
Prerequisites:
  Run `npx @taskless/cli@latest auth login` to authenticate first.
  Your repository must have a GitHub origin remote.

Usage:
  taskless rules improve --from <file> [options]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@thecodedrift
thecodedrift merged commit b585c87 into main Apr 7, 2026
5 checks passed
@thecodedrift
thecodedrift deleted the fix/auth-login-cli-command branch April 7, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"auth login" is the wrong CLI command

2 participants