Conversation
…equirement Fixes #7 **Bug 1 — fish/bash/zsh completions corrupted at build time:** Capture `claude completions <shell>` output into a variable and validate the prefix before writing to disk. At build time the CLI is unauthenticated and may exit 0 while writing an error to stdout; the previous direct redirect saved that error verbatim into the completions file, causing fish to print parse errors on every shell start. Validation rules: - fish: must start with `complete` - bash: must start with `_` or `#` - zsh: must start with `#compdef` Invalid or empty output is skipped with a warning; no file is written. **Bug 2 — onboarding re-triggers when only ~/.claude is mounted:** Claude Code stores preferences/onboarding state in ~/.claude.json (a sibling of ~/.claude/, not inside it). Update README.md, src/claude-code/README.md, and the mountHostConfig logged snippet to document the two-mount requirement and warn that ~/.claude.json must exist on the host before the container starts (Docker creates it as a directory if absent).
- Add check_completion_file_contents helper to test.sh (accepts one or more valid prefix arguments, reads first line of file) - Replace coarse FOUND_COMPLETIONS OR-check in default_options.sh with per-shell blocks; each shell asserts both existence and content prefix - Add fish coverage: conditionally install fish via apt-get, re-source setup_completions, assert claude.fish starts with 'complete' - Add log_debug for empty completion output paths in install.sh - Fix misleading "Shell completions installed." log message Addresses test gaps identified in code review of fix #7.
Reject completion output whose first line does not start with a known-valid prefix (_,#,if,function for bash/zsh; complete,# for fish), so auth error messages like "Not logged in" can no longer be written into system completion files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #7
Bug 1 — Fish (and bash/zsh) completions corrupted at build time
claude completions <shell>runs at image build time when Claude Code is unauthenticated. The CLI exits 0 but writes an error message to stdout (e.g.Not logged in · Please run /login). The previous direct redirect saved that error verbatim into the completions file, causing fish to print parse errors on every shell start.Fix: capture output into a variable and validate the prefix before writing:
complete_or##compdefInvalid or empty output is skipped with a warning; no file is written.
Bug 2 — Onboarding re-triggers when only
~/.claudeis mountedClaude Code stores preferences and onboarding state in
~/.claude.json— a sibling of~/.claude/, not inside it. The previous README guidance mounted only the directory, so~/.claude.jsonwas never persisted and the onboarding wizard re-ran on every container start.Fix: update
README.md,src/claude-code/README.md, and themountHostConfiglogged snippet to document that two mounts are required and warn that~/.claude.jsonmust exist on the host before the container starts (Docker creates it as a directory if absent).Test plan
mountHostConfig: true— confirm logged snippet shows both mounts