GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: optional TOML-based config file for brush-shell by reubeno · Pull Request #895 · reubeno/brush

Conversation

@reubeno

@reubeno reubeno commented Jan 1, 2026

Copy link
Copy Markdown
Owner

TL;DR: This adds a TOML-based config file under standard XDG config dir to configure user defaults for brush's user experience.

Background

brush uses bash-style profile/rc files for initialization scripts; that support is foundationally present in brush-core. However, we've recently found cases where it's useful to influence how brush-shell (i.e., the brush binary) behaves by default -- and in ways that need to be configured before it instantiates and starts running the interpreter.

The best current example is --enable-zsh-hooks. As discussed in #445, this flag is experimental and not enabled-by-default. It's also convenient for users who wish to opt into this behavior to be able to configure it as enabled for all brush instances run. (In particular, this is a requirement for the case where brush is the default shell, registered in /etc/passwd.) This isn't the only example, and we anticipate there will be more that are specific to the brush shell itself.

To address this, we add initial support for specifying user defaults for some brush user experience settings under standard XDG dirs. In practice, this will mean something like ~/.config/brush/config.toml.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@reubeno
reubeno requested a review from Copilot January 1, 2026 18:00
Copilot started reviewing on behalf of reubeno January 1, 2026 18:01
View session
Copilot AI reviewed Jan 1, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 TOML-based configuration file support for brush-shell, allowing users to persist settings like experimental features (e.g., --enable-zsh-hooks) without passing CLI flags on every invocation. The config is loaded from XDG-compliant directories (e.g., ~/.config/brush/config.toml) with graceful degradation for missing files.

Key Changes:

  • New config.rs module handles TOML parsing with forward-compatible unknown field handling and three-tier priority: defaults < config file < CLI args
  • CLI flags --config and --no-config added for explicit config control
  • Generated JSON schema and CI validation workflow ensure schema stays up-to-date
  • Comprehensive unit and integration tests cover config loading, merging logic, and error handling

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
brush-shell/src/config.rs Core config implementation with TOML deserialization, file loading, and CLI merging logic
brush-shell/src/args.rs Added --config and --no-config flags; new default_values() method for merge detection
brush-shell/src/entry.rs Integrates config loading before shell instantiation
brush-shell/src/lib.rs Exports new config module
brush-shell/Cargo.toml Added dependencies: etcetera, toml, serde, thiserror, schemars (optional)
brush-shell/tests/integration_tests.rs Integration tests for config flags and forward compatibility
xtask/src/main.rs New schema subcommand to generate JSON schemas
xtask/Cargo.toml Added schemars and serde_json dependencies
schemas/brush-config.schema.json Generated JSON schema for TOML validation
samples/config.toml Sample config with all available settings documented
docs/reference/configuration.md New comprehensive documentation for config file usage
docs/reference/README.md Added configuration.md to reference index
.github/workflows/ci.yaml New check-schemas job validates schema freshness
Cargo.lock Locked versions for new dependencies

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread schemas/config.schema.json Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/reference/configuration.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/reference/configuration.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

@tessus

tessus commented Jan 1, 2026

Copy link
Copy Markdown

Just a quick note. All available crates that return XDG_ paths on different OS make one mistake: they return ~/Library/Application Support on macOS.

This directory is supposed to be used for GUI applications only and should not be used for terminal/cli applications. (I believe this is even specified in the official Apple documentation.) Unfortunately the devs who created those crates ignored that part.
On macOS these crates should read the XDG_CONFIG_DIR env var and fallback to ~/.config

I haven't checked how etcetera handles the config dir on macOS, so maybe this comment is obdolete.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@reubeno

reubeno commented Jan 1, 2026

Copy link
Copy Markdown
Owner Author

Just a quick note. All available crates that return XDG_ paths on different OS make one mistake: they return ~/Library/Application Support on macOS.

This directory is supposed to be used for GUI applications only and should not be used for terminal/cli applications. (I believe this is even specified in the official Apple documentation.) Unfortunately the devs who created those crates ignored that part. On macOS these crates should read the XDG_CONFIG_DIR env var and fallback to ~/.config

I haven't checked how etcetera handles the config dir on macOS, so maybe this comment is obdolete.

Thanks for highlighting this, @tessus. Some other contributors (e.g., @lu-zero) previously raised the same concerns, and that helped influence our selection of etcetera. It's more flexible than some of the other crates and offers multiple "strategies" for platform-based selection. The strategy we're using is the first one ("base") mentioned in this excerpt from its docs:

Native Strategy

choose_base_strategy() and choose_app_strategy() will use the XDG strategy on Linux & macOS, and the Windows strategy on Windows. > This is used by most CLI tools & some GUI tools on each platform.

If you’re developing a GUI application, you might want to use the “Standard directories” on macOS by using choose_native_strategy() instead. Note that if your application expects the user to modify the configuration files, you should still prefer the XDG strategy on macOS.

We've got some more testing to do, but I believe this will align with your feedback.

tessus reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@reubeno
reubeno force-pushed the config branch from 978b5c6 to 30d8c9d Compare January 1, 2026 20:51
@github-actions

github-actions Bot commented Jan 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Public API changes for crate: brush-shell

Added items

+pub brush_shell::args::CommandLineArgs::config_file: core::option::Option<std::path::PathBuf>
+pub brush_shell::args::CommandLineArgs::no_config: bool
+pub fn brush_shell::args::CommandLineArgs::default_values() -> Self
+pub mod brush_shell::config
+pub enum brush_shell::config::ConfigLoadError
+pub brush_shell::config::ConfigLoadError::Io(std::io::error::Error)
+pub brush_shell::config::ConfigLoadError::Parse(toml::de::error::Error)
+pub struct brush_shell::config::Config
+pub brush_shell::config::Config::experimental: brush_shell::config::ExperimentalConfig
+pub brush_shell::config::Config::ui: brush_shell::config::UiConfig
+impl brush_shell::config::Config
+pub fn brush_shell::config::Config::to_ui_options(&self, args: &brush_shell::args::CommandLineArgs) -> brush_interactive::options::UIOptions
+pub struct brush_shell::config::ConfigLoadResult
+pub brush_shell::config::ConfigLoadResult::config: brush_shell::config::Config
+pub brush_shell::config::ConfigLoadResult::error: core::option::Option<brush_shell::config::ConfigLoadError>
+pub brush_shell::config::ConfigLoadResult::explicit_path: bool
+pub brush_shell::config::ConfigLoadResult::path: core::option::Option<std::path::PathBuf>
+impl brush_shell::config::ConfigLoadResult
+pub fn brush_shell::config::ConfigLoadResult::into_config_or_log(self) -> core::result::Result<brush_shell::config::Config, alloc::string::String>
+pub struct brush_shell::config::ExperimentalConfig
+pub brush_shell::config::ExperimentalConfig::terminal_shell_integration: core::option::Option<bool>
+pub brush_shell::config::ExperimentalConfig::zsh_hooks: core::option::Option<bool>
+pub struct brush_shell::config::UiConfig
+pub brush_shell::config::UiConfig::syntax_highlighting: core::option::Option<bool>
+pub fn brush_shell::config::default_config_path() -> core::option::Option<std::path::PathBuf>
+pub fn brush_shell::config::load_config(disabled: bool, explicit_path: core::option::Option<&std::path::Path>) -> brush_shell::config::ConfigLoadResult
+pub fn brush_shell::config::load_from_path(path: &std::path::Path) -> brush_shell::config::ConfigLoadResult

Performance Benchmark Report

Benchmark name Baseline (μs) Test/PR (μs) Delta (μs) Delta %
clone_shell_object 16.87 μs 16.66 μs -0.22 μs 🟢 -1.29%
eval_arithmetic 0.15 μs 0.15 μs 0.00 μs ⚪ Unchanged
expand_one_string 1.48 μs 1.51 μs 0.03 μs ⚪ Unchanged
for_loop 22.19 μs 22.80 μs 0.61 μs 🟠 +2.73%
function_call 2.19 μs 2.17 μs -0.02 μs ⚪ Unchanged
instantiate_shell 51.52 μs 51.18 μs -0.34 μs ⚪ Unchanged
instantiate_shell_with_init_scripts 24980.60 μs 24671.85 μs -308.75 μs ⚪ Unchanged
parse_bash_completion 2040.61 μs 2029.03 μs -11.58 μs ⚪ Unchanged
parse_sample_script 2.07 μs 2.01 μs -0.07 μs 🟢 -3.23%
run_echo_builtin_command 15.62 μs 15.16 μs -0.46 μs ⚪ Unchanged
tokenize_sample_script 3.37 μs 3.46 μs 0.09 μs ⚪ Unchanged

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
brush-shell/src/config.rs 🔴 0% 🟢 95.79% 🟢 95.79%
brush-shell/src/entry.rs 🟢 86.52% 🟢 87.5% 🟢 0.98%
Overall Coverage 🟢 75.05% 🟢 75.27% 🟢 0.22%

Minimum allowed coverage is 70%, this run produced 75.27%

Test Summary: bash-completion test suite

Outcome Count Percentage
✅ Pass 1558 73.87
❗️ Error 18 0.85
❌ Fail 179 8.49
⏩ Skip 339 16.07
❎ Expected Fail 13 0.62
✔️ Unexpected Pass 2 0.09
📊 Total 2109 100.00
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tessus

tessus commented Jan 1, 2026

Copy link
Copy Markdown

Awesome, thanks for the info.

reubeno reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Jan 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Test Results

    3 files     26 suites   10m 20s ⏱️
1 518 tests 1 518 ✅ 0 💤 0 ❌
4 530 runs  4 530 ✅ 0 💤 0 ❌

Results for commit eb6bcec.

♻️ This comment has been updated with latest results.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@reubeno
reubeno marked this pull request as ready for review January 1, 2026 23:54
@reubeno
reubeno force-pushed the config branch from 7fb57e3 to 25a4f7a Compare January 2, 2026 08:19
reubeno added 8 commits January 2, 2026 00:22
@reubeno
feat: initial implementation
f0c7262
@reubeno
feat: improvements
cea96bd
@reubeno
fix: improvements
9d9a50c
@reubeno
docs: update docs
efa1245
@reubeno
fix: address PR feedback
12a9b65
@reubeno
fix: add no-config to test harnesses
e1830b1
@reubeno
fix: revert unintended change
bf9bb8c
@reubeno
chore: update schema
fc088e3
@reubeno
reubeno force-pushed the config branch from 25a4f7a to fc088e3 Compare January 2, 2026 08:22
@reubeno
fix: address PR feedback
eb6bcec
@reubeno reubeno changed the title feat: add TOML-based config file for brush-shell feat: optional TOML-based config file for brush-shell Jan 2, 2026
@reubeno
reubeno merged commit a881443 into main Jan 2, 2026
@reubeno
reubeno deleted the config branch January 2, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@reubeno @tessus
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.