Skip to content

Conversation

@trobrock
Copy link
Contributor

@trobrock trobrock commented Dec 3, 2025

Summary

This allows the customization of the kebinding in the CLI to be customized using the GOOSE_CLI_NEWLINE_KEY.

For example (CTRL-N will enter a newline):

GOOSE_CLI_NEWLINE_KEY="n" goose

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Unit tests have been added.
I also manually tested this.

Copilot AI review requested due to automatic review settings December 3, 2025 00:43
@trobrock trobrock force-pushed the custom-new-line-key branch from be28b3b to e8fdc51 Compare December 3, 2025 00:44
Copy link
Contributor

Copilot AI left a comment

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 adds customization support for the CLI newline keybinding through the GOOSE_CLI_NEWLINE_KEY environment variable, allowing users to change from the default Ctrl+J to any other Ctrl+ combination.

Key Changes

  • Added get_newline_key() function to read and validate the environment variable with sensible defaults
  • Updated all user-facing documentation (system prompt, help text, and comments) to reflect the customizable keybinding
  • Added comprehensive unit tests covering default behavior, custom keys, edge cases (empty strings, multi-char strings, case conversion)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/goose-cli/src/session/input.rs Implements the configurable keybinding logic, updates help text, and adds unit tests
crates/goose-cli/src/session/prompt.rs Updates the system prompt to dynamically show the configured keybinding

@trobrock trobrock force-pushed the custom-new-line-key branch from 7d54e73 to 7c0bff8 Compare December 3, 2025 15:28
Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

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

nice one - if you can clean it up a bit, let's get this in

Copilot AI review requested due to automatic review settings December 17, 2025 19:13
@trobrock trobrock requested a review from DOsinga December 17, 2025 19:14
@trobrock trobrock force-pushed the custom-new-line-key branch from 9b7ad0d to 2b915af Compare December 17, 2025 19:15
Copy link
Contributor

Copilot AI left a comment

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 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +58 to +65
pub fn get_newline_key() -> char {
Config::global()
.get_param::<String>("GOOSE_CLI_NEWLINE_KEY")
.ok()
.and_then(|s| s.chars().next())
.map(|c| c.to_ascii_lowercase())
.unwrap_or('j')
}
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The get_newline_key() function lacks test coverage. Consider adding tests to verify: (1) default behavior when the environment variable is not set, (2) custom single-character values (both uppercase and lowercase), (3) empty string handling, (4) multi-character strings (verifying only the first character is used), and (5) non-ASCII character handling.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DOsinga taking a look at other usages of settings, it seems like it's not typical to test this sort of logic like https://github.com/block/goose/blob/main/crates/goose-cli/src/session/builder.rs#L500

Though that's not in a separate function. What are your thoughts on these tests?

Loved the blog post btw.

@DOsinga DOsinga merged commit d512b49 into block:main Jan 13, 2026
17 checks passed
wpfleger96 added a commit that referenced this pull request Jan 13, 2026
* main: (41 commits)
  Allow customizing the new line keybinding in the CLI (#5956)
  Ask for permission in the CLI (#6475)
  docs: add Ralph Loop tutorial for multi-model iterative development (#6455)
  Remove gitignore fallback from gooseignore docs (#6480)
  fix: clean up result recording for code mode (#6343)
  fix(code_execution): handle model quirks with tool calls (#6352)
  feat(ui): support prefersBorder option for MCP Apps (#6465)
  fixed line breaks (#6459)
  Use Intl.NumberFormat for token formatting in SessionsInsights (#6466)
  feat(ui): format large and small token counts for readability (#6449)
  fix: apply subrecipes when using slash commands (#6460)
  Fix: exclude platform_schedule_tool in CLI (#6442)
  Fix: Small update in how ML-based prompt injection determines final result (#6439)
  docs: remove SSE transport and rename to Streamable HTTP (#6319)
  fix: correct Cloudinary extension command and env variable (#6453)
  fix: add gap between buttons in MacDesktopInstallButtons.js (#6452)
  refactor: include hidden dotfiles folders in file picker search (#6315)
  upgraded safe npm packages (#6450)
  chore(deps): bump react-router and react-router-dom in /ui/desktop (#6408)
  chore(deps): bump lru from 0.12.5 to 0.16.3 (#6379)
  ...
lifeizhou-ap added a commit that referenced this pull request Jan 14, 2026
* main:
  fix: require auth when running goose on non loopback address (#6478)
  chore(deps): bump hono from 4.11.3 to 4.11.4 in /ui/desktop (#6485)
  feat(cli): graceful fallback for keyring failures (#5808)
  fix: support global .gooseignore and negation patterns (#6157)
  docs: manual config for jetbrains (#6490)
  fix: Recipe slash command doesn't work with single optional parameter (#6235)
  fix(openrouter): Handle Gemini thoughtSignature for tool calls (#6370)
  docs: fix extensions page (#6484)
  Allow customizing the new line keybinding in the CLI (#5956)
  Ask for permission in the CLI (#6475)
  docs: add Ralph Loop tutorial for multi-model iterative development (#6455)
  Remove gitignore fallback from gooseignore docs (#6480)
  fix: clean up result recording for code mode (#6343)
  fix(code_execution): handle model quirks with tool calls (#6352)
  feat(ui): support prefersBorder option for MCP Apps (#6465)
  fixed line breaks (#6459)
  Use Intl.NumberFormat for token formatting in SessionsInsights (#6466)
  feat(ui): format large and small token counts for readability (#6449)
  fix: apply subrecipes when using slash commands (#6460)
ThanhNguyxn pushed a commit to ThanhNguyxn/goose that referenced this pull request Jan 14, 2026
zanesq added a commit that referenced this pull request Jan 14, 2026
…ased

* 'main' of github.com:block/goose:
  fix(code_execution): serialize record_result output as JSON (#6495)
  perf(google): avoid accumulating thoughtSignatures across conversation history (#6462)
  fix(openai): make tool_call arguments optional and fix silent stream termination (#6309)
  fix: Improve error messages for invalid tool calls (#6483)
  fix: require auth when running goose on non loopback address (#6478)
  chore(deps): bump hono from 4.11.3 to 4.11.4 in /ui/desktop (#6485)
  feat(cli): graceful fallback for keyring failures (#5808)
  fix: support global .gooseignore and negation patterns (#6157)
  docs: manual config for jetbrains (#6490)
  fix: Recipe slash command doesn't work with single optional parameter (#6235)
  fix(openrouter): Handle Gemini thoughtSignature for tool calls (#6370)
  docs: fix extensions page (#6484)
  Allow customizing the new line keybinding in the CLI (#5956)
  Ask for permission in the CLI (#6475)
  docs: add Ralph Loop tutorial for multi-model iterative development (#6455)
  Remove gitignore fallback from gooseignore docs (#6480)
  fix: clean up result recording for code mode (#6343)
  fix(code_execution): handle model quirks with tool calls (#6352)
  feat(ui): support prefersBorder option for MCP Apps (#6465)
  fixed line breaks (#6459)
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.

2 participants