-
Notifications
You must be signed in to change notification settings - Fork 8
Unified trace system for CLI and TUI observability #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a21340f
Add structured file-based tracer for CLI and TUI observability
jeremy f45cb3d
Wire TUI trace instrumentation and add bin/devtools for split-pane tr…
jeremy b699fc5
Address review feedback: nil guards, atomic cats, double-close, error…
jeremy 715100e
Address Copilot review: doc accuracy, test cleanup, hooks tracer test
jeremy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Launch the Basecamp TUI with a trace log tailed in a tmux split pane. | ||
| # | ||
| # Usage: | ||
| # bin/devtools [basecamp-tui-args...] | ||
| # | ||
| # Examples: | ||
| # bin/devtools # Launch TUI + trace tail | ||
| # bin/devtools 'https://3.basecamp.com/…' # Deep-link into a project | ||
| # | ||
| # Prerequisites: tmux | ||
| # | ||
| # The trace file is created under the standard cache dir. BASECAMP_TRACE is set | ||
| # to the absolute path so the CLI treats it as "TraceAll + custom path". | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| if ! command -v tmux &>/dev/null; then | ||
| echo "devtools requires tmux. Install it and try again." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Resolve the basecamp binary (prefer local build, then PATH). | ||
| if [[ -z "${BASECAMP:-}" ]]; then | ||
| if [[ -x ./bin/basecamp ]]; then | ||
| BASECAMP=./bin/basecamp | ||
| elif ! BASECAMP=$(command -v basecamp); then | ||
| echo "devtools requires the basecamp binary on PATH or BASECAMP=/path/to/basecamp." >&2 | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| # Unique session name for concurrent launches. | ||
| SESSION="basecamp-devtools-$$" | ||
|
|
||
| # Create trace file so tail -f doesn't race the TUI's first write. | ||
| TRACE_DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/basecamp" | ||
| TRACE_FILE="${TRACE_DIR}/trace-devtools-$$.log" | ||
| mkdir -p "$TRACE_DIR" | ||
| : > "$TRACE_FILE" | ||
|
|
||
| # tmux new-session and split-window accept shell-command as multiple arguments | ||
| # and exec them directly (no sh -c), so every token stays a discrete argv entry. | ||
| # This avoids all quoting/metacharacter issues with URLs or paths containing | ||
| # spaces, &, etc. | ||
| exec tmux new-session -s "$SESSION" \ | ||
| env "BASECAMP_TRACE=${TRACE_FILE}" "$BASECAMP" tui "$@" \; \ | ||
| split-window -h -l 40% tail -f "$TRACE_FILE" \; \ | ||
| select-pane -t 0 |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.