Remove dynamic help text from CLI #1426

Closed
opened 2026-03-13 08:39:39 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @rebasecase on GitHub (Jun 27, 2025).

To Reproduce

npx @better-auth/cli generate --help

Culprit:

e3ce89562d/packages/cli/src/commands/init.ts (L1031)

Current vs. Expected behavior

Currently prints out cwd. Why should it?

-c, --cwd <cwd> the working directory. defaults to the current directory. (default: "/workspaces/rebasecase/project")

Doesn't make sense.

Originally created by @rebasecase on GitHub (Jun 27, 2025). ### To Reproduce `npx @better-auth/cli generate --help` Culprit: https://github.com/better-auth/better-auth/blob/e3ce89562d2704acac80ca41d194cea8a03cc9a7/packages/cli/src/commands/init.ts#L1031 ### Current vs. Expected behavior Currently prints out cwd. Why should it? `-c, --cwd <cwd> the working directory. defaults to the current directory. (default: "/workspaces/rebasecase/project")` Doesn't make sense.
Author
Owner

@dosubot[bot] commented on GitHub (Jun 27, 2025):

Hi @rebasecase! I'm Dosu and I’m helping the better-auth team.

The dynamic default for the --cwd option in the CLI is set to the current working directory using process.cwd(). This isn't technically required, but it's a standard CLI pattern that improves usability—users can run the command from any directory without specifying --cwd every time. The only place this dynamic value appears is in the generated help output, not as a runtime message or log. Removing it would mean users always have to specify a value, which could break scripts or automation that rely on the current behavior and generally make the CLI less convenient to use. There are no dependencies or documentation that require this dynamic default, so removing it is possible, but it would be a UX regression rather than a technical improvement. If you want to remove it, just change the option definition in init.ts from:

.option("-c, --cwd <cwd>", "The working directory.", process.cwd())

to

.option("-c, --cwd <cwd>", "The working directory.")

This will make the option required or undefined by default, so users must always specify it if needed.
Reference: init.ts source

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jun 27, 2025): <!-- Greeting --> Hi @rebasecase! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> The dynamic default for the `--cwd` option in the CLI is set to the current working directory using `process.cwd()`. This isn't technically required, but it's a standard CLI pattern that improves usability—users can run the command from any directory without specifying `--cwd` every time. The only place this dynamic value appears is in the generated help output, not as a runtime message or log. Removing it would mean users always have to specify a value, which could break scripts or automation that rely on the current behavior and generally make the CLI less convenient to use. There are no dependencies or documentation that require this dynamic default, so removing it is possible, but it would be a UX regression rather than a technical improvement. If you want to remove it, just change the option definition in `init.ts` from: ```ts .option("-c, --cwd <cwd>", "The working directory.", process.cwd()) ``` to ```ts .option("-c, --cwd <cwd>", "The working directory.") ``` This will make the option required or undefined by default, so users must always specify it if needed. Reference: [init.ts source](https://github.com/better-auth/better-auth/blob/e3ce89562d2704acac80ca41d194cea8a03cc9a7/packages/cli/src/commands/init.ts) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/d74890f2-225d-452f-a86e-45715b0b6c3a?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d74890f2-225d-452f-a86e-45715b0b6c3a?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d74890f2-225d-452f-a86e-45715b0b6c3a?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d74890f2-225d-452f-a86e-45715b0b6c3a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d74890f2-225d-452f-a86e-45715b0b6c3a?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d74890f2-225d-452f-a86e-45715b0b6c3a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d74890f2-225d-452f-a86e-45715b0b6c3a?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/3193)
Author
Owner

@rebasecase commented on GitHub (Jun 27, 2025):

Not a /bad/ response, I'll give it that.

For clarity, the default should remain cwd, but it should not print it in the help output.

@rebasecase commented on GitHub (Jun 27, 2025): Not a /bad/ response, I'll give it that. For clarity, the default should remain cwd, but it should not print it in the help output.
Author
Owner

@Kinfe123 commented on GitHub (Jun 28, 2025):

it is more of providing additional context to current options. i dont think this would change anything. closing it now

@Kinfe123 commented on GitHub (Jun 28, 2025): it is more of providing additional context to current options. i dont think this would change anything. closing it now
Author
Owner

@rebasecase commented on GitHub (Jun 28, 2025):

-c, --cwd <cwd> the working directory. defaults to the current directory. (default: "/workspaces/rebasecase/project")

Implies that if I run it from any directory, the default would be "/workspaces/rebasecase/project"

@rebasecase commented on GitHub (Jun 28, 2025): `-c, --cwd <cwd> the working directory. defaults to the current directory. (default: "/workspaces/rebasecase/project")` Implies that if I run it from any directory, the default would be `"/workspaces/rebasecase/project"`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1426