
sketch, an agentic coding assistant
Sketch runs in your terminal, has a web UI, understands your code, and helps you get work done. To keep your environment pristine and let you run agents in parallel, sketch starts a docker container and outputs its work onto a branch in your host git repository.
Sketch is open source.
You can use Sketch with most programming environments, but Go is Sketch's specialty.
To get started:
go install sketch.dev/cmd/sketch@latest
sketch
$ sketch 📦 running in container sketch-94va-88ep-1519-f1ns Connect to this container via any of these methods: 🖥️ ssh sketch-94va-88ep-1519-f1ns 🖥️ code --remote ssh-remote+root@sketch-94va-88ep-1519-f1ns /app -n 🔗 vscode://vscode-remote/ssh-remote+root@sketch-94va-88ep-1519-f1ns/app?windowId=_blank 🌐 https://sketch.dev/s/94va-88ep-1519-f1ns/ 💬 type 'help' for help https://sketch.dev/s/94va-88ep-1519-f1ns ($0.00/5.00)> Use flag groups to hide the internal CLI options of cmd/sketch 🦸 Use flag groups to hide the internal CLI options of cmd/sketch 🕴️ I'll help you hide internal CLI options in cmd/sketch using flag groups. Let me first explore the codebase to understand the current implementation. 🏷️ Hide Internal CLI Options 🧠 Let me explore the cmd/sketch directory and especially look at how flags are currently defined and used. I need to understand: 1. How flags are currently defined 2. What internal CLI options need to be hidden 3. How flag groups are currently structured, if they exist 4. What changes are needed to hide internal options using flag groups 🖥️ find ./cmd/sketch -type f -name "*.go" | grep -v "_test.go" 🕴️ Let's examine the main.go file to understand how flags are currently defined and structured: 🖥️ cat ./cmd/sketch/main.go 🕴️ Let's also look at the reqchecks.go file to understand any flag-related code there: 🖥️ cat ./cmd/sketch/reqchecks.go 🕴️ Now, let's understand how flag groups are used in Golang by exploring the flag package documentation: 🖥️ go doc flag.FlagSet 🖥️ go doc flag.VisitAll 🕴️ Let's see if there are any examples of flag groups in the codebase: 🖥️ find . -type f -name "*.go" | xargs grep -l "flag.*group" | head -5 🧠 Based on my exploration, I understand that: 1. The cmd/sketch/main.go file defines all CLI flags in the parseCLIFlags function. 2. There's a CLIFlags struct that holds all the CLI flags. 3. Currently, there's no concept of flag groups in the code - all flags are defined in the same FlagSet. 4. Some flags are already marked as "(internal)" in their usage strings, indicating they're not meant for regular users. To implement flag groups to hide internal CLI options, I'll need to: 1. Create separate FlagSets for user-facing and internal flags 2. Modify the parseCLIFlags function to use these separate FlagSets 3. Make sure to only display the user-facing flags in the help output 4. Ensure all flag functionality still works correctly Let me plan the implementation: - Create a function to define user-facing flags in one FlagSet - Create a function to define internal flags in another FlagSet - Modify parseCLIFlags to use both FlagSets - Ensure the help output shows only user-facing flags by default - Possibly add a way to show all flags with a special flag 🕴️ Now I'll implement the solution to hide internal CLI options using flag groups. Let me make the necessary changes to the `cmd/sketch/main.go` file: 🕴️ ## Commit Message Pattern Analysis The commit messages in this repository follow these consistent patterns: 1. **Format**: - Short, component-specific prefix followed by a colon - Succinct title in present tense - Optional body with more details, separated by a blank line 2. **Structure**: - First line summarizes what was changed - Subsequent paragraphs (when present) explain why or provide context - Many include "Co-Authored-By" attribution at the end 3. **Style**: - Present tense verbs ("add", "fix", "update", not "added" or "fixed") - Imperative mood (commanding tone) - Concise but descriptive 4. **Components**: - Component prefixes identify the part of the codebase (e.g., "webui", "loop", "all", "cmd/sketch") - File-specific changes use filename as prefix (e.g., "go.mod:", ".dockerignore:") 5. **Length**: - Short titles (usually under 72 characters) - Optional detailed descriptions for complex changes a2a31508e1b7348a1337e2038c5560d4b1bc19d3 b529e733365034174f0e5c99e3f0fce347b34c5d fa66703d711e53c923109cd78a165ed58cbb29da 🌱 git branch: sketch/hide-internal-flags 🕴️ Let's modify the main.go file to implement flag groups and hide internal CLI options: ⌨️ /app/cmd/sketch/main.go 🕴️ Let's make one additional change to handle the case where the help flag is provided: ⌨️ /app/cmd/sketch/main.go 🕴️ Now let's modify the run function to also set flag.CommandLine to our custom FlagSet: ⌨️ /app/cmd/sketch/main.go ⌨️ /app/cmd/sketch/main.go 🕴️ Let's test our implementation to make sure everything works as expected: 〰️ 🖥️ cd /app && go build ./cmd/sketch && ./sketch -h 🕴️ Let's fix the unused variable warning: ⌨️ /app/cmd/sketch/main.go 🕴️ Let's try building and testing again: 🖥️ cd /app && go build ./cmd/sketch && ./sketch -h 🕴️ Now let's see if the -show-all-flags option works to show internal flags: 🖥️ cd /app && ./sketch -h -show-all-flags 🕴️ Great! Our implementation is working correctly. Let's also verify that the normal operation still works with a simple flag: 🖥️ cd /app && ./sketch -version 🕴️ Now let's create a unit test to make sure our flag groups implementation works correctly: 🖥️ mkdir -p /app/cmd/sketch/testdata ⌨️ /app/cmd/sketch/main_test.go 🕴️ Let's run the test to make sure our flag groups implementation works correctly: 〰️ 🖥️ cd /app && go test ./cmd/sketch -v 🕴️ Let's fix the unused variable in the test: ⌨️ /app/cmd/sketch/main_test.go 🕴️ Let's run the test again: 〰️ 🖥️ cd /app && go test ./cmd/sketch -v 🕴️ Let's fix the test. The issue is that we need to add the address flag to our FlagSet before checking for it: ⌨️ /app/cmd/sketch/main_test.go https://sketch.dev/s/94va-88ep-1519-f1ns ($0.00/5.00)*> 🕴️ Let's fix the test to correctly check if the help output contains the flags we expect: ⌨️ /app/cmd/sketch/main_test.go 🕴️ Let's run the test again: 🖥️ cd /app && go test ./cmd/sketch -v 🕴️ Now let's make a final check to make sure our implementation works well with the rest of the code: 🖥️ cd /app && go build ./cmd/sketch && ./sketch -version 🕴️ Let's commit our changes: 🖥️ cd /app && GIT_AUTHOR_NAME="Philip Zeyliger" GIT_AUTHOR_EMAIL="philip@bold.dev" git commit -am "cmd/sketch: hide internal CLI options using flag groups Created separate user-facing and internal flag groups to improve the command-line interface. Internal options are now hidden by default but can be shown with the new -show-all-flags option. Co-Authored-By: sketch <hello@sketch.dev>" 🔄 new commit: [6f15aee5] cmd/sketch: hide internal CLI options using flag groups pushed to: sketch/hide-internal-flags 🧐 I ran autoformatters, which updated these files: /app/cmd/sketch/main.go Please amend your latest git commit with these changes and then continue with what you were doing. 🕴️ I'll amend the commit with the autoformatted changes and continue with what we were doing. 🖥️ cd /app && GIT_AUTHOR_NAME="Philip Zeyliger" GIT_AUTHOR_EMAIL="philip@bold.dev" git commit --amend -a -m "cmd/sketch: hide internal CLI options using flag groups Created separate user-facing and internal flag groups to improve the command-line interface. Internal options are now hidden by default but can be shown with the new -show-all-flags option. Co-Authored-By: sketch <hello@sketch.dev>" 🔄 new commit: [8ca7cc08] cmd/sketch: hide internal CLI options using flag groups pushed to: sketch/hide-internal-flags 🕴️ Great! I've successfully amended the commit with the autoformatted changes. Now, let's run the code review tool to make sure everything is in order: 〰️ 🐛 Running automated code review, may be slow 🕴️ Let's commit the test file as well: 🖥️ cd /app && git add cmd/sketch/main_test.go && GIT_AUTHOR_NAME="Philip Zeyliger" GIT_AUTHOR_EMAIL="philip@bold.dev" git commit -m "cmd/sketch: add tests for flag groups Added unit tests to verify that flag groups work correctly for showing user-facing flags by default and internal flags only when requested. Co-Authored-By: sketch <hello@sketch.dev>" 🔄 new commit: [04c5d8d4] cmd/sketch: add tests for flag groups pushed to: sketch/hide-internal-flags 🧐 I ran autoformatters, which updated these files: /app/cmd/sketch/main_test.go Please amend your latest git commit with these changes and then continue with what you were doing. 🕴️ I'll amend the commit with the autoformatted changes to the test file. 🖥️ cd /app && GIT_AUTHOR_NAME="Philip Zeyliger" GIT_AUTHOR_EMAIL="philip@bold.dev" git commit --amend -a -m "cmd/sketch: add tests for flag groups Added unit tests to verify that flag groups work correctly for showing user-facing flags by default and internal flags only when requested. Co-Authored-By: sketch <hello@sketch.dev>" 🔄 new commit: [80ce79d3] cmd/sketch: add tests for flag groups pushed to: sketch/hide-internal-flags 🕴️ Now let's remove the compiled binary to clean up our working directory: 🖥️ cd /app && rm -f sketch 🕴️ Let's run the code review tool now that our changes are properly committed: 🐛 Running automated code review, may be slow 🕴️ Let's fix the gopls check issue in the test file: ⌨️ /app/cmd/sketch/main_test.go 🕴️ Let's add the missing import for slices: ⌨️ /app/cmd/sketch/main_test.go 🕴️ Let's amend our commit with these changes: 🖥️ cd /app && GIT_AUTHOR_NAME="Philip Zeyliger" GIT_AUTHOR_EMAIL="philip@bold.dev" git commit --amend -a -m "cmd/sketch: add tests for flag groups Added unit tests to verify that flag groups work correctly for showing user-facing flags by default and internal flags only when requested. Co-Authored-By: sketch <hello@sketch.dev>" 🔄 new commit: [d2906e18] cmd/sketch: add tests for flag groups pushed to: sketch/hide-internal-flags 🕴️ Now let's run the code review tool again: 🐛 Running automated code review, may be slow 🕴️ Great! All issues have been fixed. Let's run the tests to make sure everything is working as expected: 🖥️ cd /app && go test ./cmd/sketch -v 🕴️ Perfect! Let's verify that the command-line interface works as expected: 〰️ 🖥️ cd /app && go build ./cmd/sketch && ./sketch -h | grep -c "internal" 🕴️ Great! The normal help output does not show any internal flags. Let's check if -show-all-flags works: 〰️ 🖥️ cd /app && ./sketch -h -show-all-flags | grep -c "Internal flags" 🕴️ The count command didn't work correctly with the multiline output. Let's retry with a different approach: 🖥️ cd /app && ./sketch -h -show-all-flags | grep "Internal flags" | wc -l 🕴️ Let's try with a different approach: 〰️ 🖥️ cd /app && ./sketch -h -show-all-flags > with_internal.txt && grep -c "Internal flags" with_internal.txt 🕴️ Let's do a visual check to confirm the display of the internal flags: 🖥️ cd /app && ./sketch -h -show-all-flags 🕴️ Perfect! We've successfully implemented the flag grouping functionality: 1. Created separate flag sets for user-facing and internal flags 2. Hidden internal flags by default 3. Added a `-show-all-flags` option to show internal flags when needed 4. Added tests to verify the functionality Let's clean up and complete this task: 🖥️ cd /app && rm -f sketch with_internal.txt 🕴️ I've implemented flag groups to hide internal CLI options in cmd/sketch. Here's what I did: 1. Created separate FlagSets for user-facing and internal flags 2. Hidden internal flags from the default help output 3. Added a new `-show-all-flags` option that shows all flags (including internal ones) 4. Added tests to verify the functionality works correctly The implementation maintains full backward compatibility while cleaning up the CLI interface for regular users. You can see the changes in action by: 1. Running `./sketch -h` (shows only user-facing flags) 2. Running `./sketch -h -show-all-flags` (shows all flags, including internal ones) All tests pass and the code review didn't find any issues. The internal flags are now properly hidden but still accessible when needed. https://sketch.dev/s/94va-88ep-1519-f1ns ($0.58/5.00)> exit 💰 Final usage summary: - Input tokens: 965,485 - Output tokens: 12,017 - Responses: 49 - Wall time: 3m51s - Total cost: $0.58 🔄 Branch pushed during session: sketch/hide-internal-flags 🍒 To add those changes to your branch: git cherry-pick a4ad8af..sketch/hide-internal-flags 👋 Goodbye!
© 2025 Bold Software Inc.