Repository navigation
Call the CLI bananasplit in its own output when run by that name - #50
Conversation
Help, examples, version, and the CLI's messages and errors use the name the CLI was started by. Compiled binaries read it from argv0, the Windows shim passes it in BANANA_INVOKED_AS, and the package's bananasplit bin is its own entry file. API data and the skill's name are left alone. README opens with both names.
[Low impact] The change affects the CLI’s displayed name and Windows alias recognition. The PR appears safe to merge, with non-blocking fixes needed for incomplete name changes and altered names in errors.
|
| const command = parseCommand(output.args); | ||
| if (command.kind === "help") { | ||
| stdout(colorizeHelp(command.text)); | ||
| say(colorizeHelp(command.text)); |
There was a problem hiding this comment.
Colored examples keep old name
On a color terminal, bananasplit --help still shows banana in its examples. colorizeHelp() puts a color escape before each example, so renameCommand() no longer sees banana at the start of the line. Rename the plain help text before adding color.
| say(colorizeHelp(command.text)); | |
| stdout(colorizeHelp(renameCommand(command.text, name))); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli.ts
Line: 351
Comment:
**Colored examples keep old name**
On a color terminal, `bananasplit --help` still shows `banana` in its examples. `colorizeHelp()` puts a color escape before each example, so `renameCommand()` no longer sees `banana` at the start of the line. Rename the plain help text before adding color.
```suggestion
stdout(colorizeHelp(renameCommand(command.text, name)));
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| export function renameCommand(text: string, name: string) { | ||
| return name === "banana" | ||
| ? text | ||
| : text.replace(/(^[ \t]*|`|for )banana(?![\w-])/gm, `$1${name}`); |
There was a problem hiding this comment.
bananasplit doctor still suggests banana login and banana skill install. formatChecks() puts → before these commands, but renameCommand() only accepts line-start whitespace, a backtick, or for . Pass the chosen name into these suggestions, or support their actual format.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/shared.ts
Line: 69
Comment:
**Doctor fixes keep old name**
`bananasplit doctor` still suggests `banana login` and `banana skill install`. `formatChecks()` puts `→ ` before these commands, but `renameCommand()` only accepts line-start whitespace, a backtick, or `for `. Pass the chosen name into these suggestions, or support their actual format.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| // The CLI's own messages, under the name it was run as. Responses go to | ||
| // stdout untouched. | ||
| const name = runtime.programName ?? "banana"; | ||
| const say = (text: string) => stdout(renameCommand(text, name)); |
There was a problem hiding this comment.
Follow-up commands keep old name
Keeping every request result outside say() also leaves the CLI's own follow-up commands unchanged. For example, bananasplit recurring list always prints banana recurring get, and paged group lists suggest banana groups list. Pass the chosen name to the presenters for their hints while leaving returned names and titles untouched.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli.ts
Line: 336-339
Comment:
**Follow-up commands keep old name**
Keeping every request result outside `say()` also leaves the CLI's own follow-up commands unchanged. For example, `bananasplit recurring list` always prints `banana recurring get`, and paged group lists suggest `banana groups list`. Pass the chosen name to the presenters for their hints while leaving returned names and titles untouched.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| } catch (error) { | ||
| const failure = serializeFailure(error, outputMode); | ||
| stderr(failure.output); | ||
| if (failure.authored) warn(failure.output); |
There was a problem hiding this comment.
Errors change actual group names
Renaming the whole error message can change names supplied by the user or returned by the API. If a group lookup for Dinner for banana matches several groups, the error now reports Dinner for bananasplit and can also change the listed group names. Rename command suggestions when building them, rather than rewriting the complete error.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli.ts
Line: 712
Comment:
**Errors change actual group names**
Renaming the whole error message can change names supplied by the user or returned by the API. If a group lookup for `Dinner for banana` matches several groups, the error now reports `Dinner for bananasplit` and can also change the listed group names. Rename command suggestions when building them, rather than rewriting the complete error.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Run as `bananasplit`, the CLI now uses that name throughout its own output: help, examples, `version`, and its messages and errors. For example, `bananasplit --help` shows `bananasplit [--json | --raw]`. Run as `banana`, nothing changes.
How it knows the name
What gets renamed
Also
Tested: `bun test` (326 pass) and `bun run typecheck`. I built a compiled binary and ran it through a symlink: no `banana` command remains in `bananasplit --help`, and `banana --help` is unchanged. The release workflow runs the Windows shim on this PR.