* Replace --internal flag with WT_DIRECTIVE_FILE environment variable
* Rename directive file environment variable to WORKTRUNK_DIRECTIVE_FILE
* Update stale comments referencing directive scripts
Codex review identified comments that still referenced "directive scripts"
after migrating to file-based directive passing. Updated to reference
"data output" which is the current terminology.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Address documentation review feedback
- Add WORKTRUNK_DIRECTIVE_FILE to env var tables (cli.rs, config.md)
- Update stale "directive mode" terminology in test comments to use
"shell integration" or "data output" as appropriate
- Regenerate help snapshot
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Refactor progressive table output to use output module
Remove finalize_non_tty method and simplify non-TTY output path to use
output::table() directly, consistent with buffered mode. Add WORKTRUNK_SHELL
environment variable support for PowerShell-specific path escaping. Update
documentation and templates accordingly.
* Preserve directive script exit code in PowerShell
Add logic to use the directive script's exit code when wt succeeds, and
add redaction for WORKTRUNK_DIRECTIVE_FILE in test snapshots.
---------
Co-authored-by: Claude <noreply@anthropic.com>
Replace implementation-specific validation (parsing sed patterns) with
black-box snapshot tests that verify actual completion output.
Each test:
- Sources the real shell integration script
- Triggers the completion pipeline
- Snapshots what users would see
Removes ZshDescribeSyntax validation that was checking implementation details.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
The sed command was incorrectly passing arguments to the -V flag, which
does not accept arguments in zsh's _describe function. The -V flag only
sets a flag for unsorted groups; the actual nosort behavior is handled
internally by _describe when passed to compadd.
Add validation tests to catch invalid _describe syntax patterns in
future changes, including checks for improper flag arguments and invalid
option combinations.
Replaces most uses of `.expect(...)` with `.unwrap()` in test code. This is a common pattern in Rust tests for operations that are expected to succeed, simplifying the code.
This refactoring introduces `wt_command` and `configure_cli_command` helper functions in `tests/common/mod.rs` to centralize the setup of `wt` CLI commands in integration tests.
The new helpers ensure all test commands:
- Clear host `GIT_*` and `WORKTRUNK_*` environment variables.
- Force color output (`CLICOLOR_FORCE=1`) for consistent snapshot testing.
- Set a default terminal width of 150 columns (`COLUMNS=150`) if not already specified.
This change reduces duplication across integration tests by moving common command environment configuration into reusable functions. Existing calls to `Command::new(get_cargo_bin("wt"))` have been replaced with `wt_command()`, and manual environment variable settings have been replaced with calls to `configure_cli_command`.
A new helper `set_temp_home_env` is also introduced to simplify setting `HOME` and `XDG_CONFIG_HOME` for commands requiring an isolated home directory.
This change centralizes the "✅" emoji into a `SUCCESS_EMOJI` constant.
It replaces hardcoded instances across `config`, `configure_shell`, `merge`,
`worktree`, `main`, and `output` modules, ensuring consistent
display for successful operations.
This commit refactors the completion generation logic to filter out hidden commands and flags more robustly. It also introduces a new integration test module for validating shell completions across different shells.
The changes include:
- Modifying `handle_init` to iterate through completion lines and filter out hidden commands (`completion`, `complete`) and the `--internal` flag.
- Removing a redundant `complete -c wt -l base` line from the Fish shell template, as `clap` already generates this.
- Adding `completion_validation.rs` with functions to:
- Validate Fish, Bash, and Zsh completions for hidden flags.
- Extract flags from completion content for cross-shell consistency checks.
- Perform cross-shell validation to ensure flags are consistent and hidden flags do not appear.
- Updating snapshot tests for Bash, Fish, and Zsh completions to reflect the filtering changes.
- Adding a specific test `test_fish_no_duplicate_base_completion` to ensure `--base` is not duplicated in Fish completions.
Co-authored-by: Claude <no-reply@anthropic.com>