-
Notifications
You must be signed in to change notification settings - Fork 8
Tighten Claude Code plugin #191
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
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0182364
Remove marketplace.json and dead symlink from plugin
jeremy 83a6cf3
Remove redundant plugin agents
jeremy 30e2abe
Slim session-start hook to single liveness check
jeremy 5876785
Add /basecamp-doctor command
jeremy 1048d7b
Document skip status in /basecamp-doctor command
jeremy 942d28b
Harden session-start hook against malformed JSON
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
| --- | ||
| name: basecamp-doctor | ||
| description: Check Basecamp plugin health — CLI, auth, API connectivity, project context. | ||
| invocable: true | ||
| --- | ||
|
|
||
| # /basecamp-doctor | ||
|
|
||
| Run the Basecamp CLI health check and report results. | ||
|
|
||
| ```bash | ||
| basecamp doctor --json | ||
| ``` | ||
|
|
||
| Interpret the output: | ||
| - **pass**: Working correctly | ||
| - **warn**: Non-critical issue (e.g., shell completion not installed) | ||
| - **skip**: Check not run (e.g., unauthenticated or not applicable) | ||
| - **fail**: Broken — needs attention | ||
|
|
||
| For any failures, follow the `hint` field in the check output. Common fixes: | ||
| - Authentication failed → `basecamp auth login` | ||
| - API unreachable → check network / VPN | ||
| - Plugin not installed → `claude plugin install basecamp` | ||
|
|
||
| Report results concisely: list failures and warnings with their hints. If everything passes, say so. | ||
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 |
|---|---|---|
| @@ -1,93 +1,52 @@ | ||
| #!/usr/bin/env bash | ||
| # session-start.sh - Load Basecamp context at session start | ||
| # session-start.sh - Basecamp plugin liveness check | ||
| # | ||
| # This hook runs when Claude Code starts a session and outputs | ||
| # relevant Basecamp project context if configured. | ||
| # Lightweight: one subprocess call. Confirms the CLI is available and, | ||
| # when jq is installed, whether it is authenticated. Context priming | ||
| # (project IDs, etc.) happens on first use via the /basecamp skill, | ||
| # not here. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Require jq for JSON parsing | ||
| if ! command -v jq &>/dev/null; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Find basecamp - prefer PATH, fall back to plugin's bin directory | ||
| if command -v basecamp &>/dev/null; then | ||
| BASECAMP_BIN="basecamp" | ||
| else | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| BASECAMP_BIN="${SCRIPT_DIR}/../../bin/basecamp" | ||
| if [[ ! -x "$BASECAMP_BIN" ]]; then | ||
| cat << 'EOF' | ||
| if ! command -v basecamp &>/dev/null; then | ||
| cat << 'EOF' | ||
| <hook-output> | ||
| Basecamp plugin: basecamp CLI not found. | ||
| Basecamp plugin active — CLI not found on PATH. | ||
| Install: https://github.com/basecamp/basecamp-cli#installation | ||
| </hook-output> | ||
| EOF | ||
| exit 0 | ||
| fi | ||
| fi | ||
|
|
||
| # Get CLI version (--version prints "basecamp version X.Y.Z") | ||
| cli_version=$("$BASECAMP_BIN" --version 2>/dev/null | awk '{print $NF}' || true) | ||
|
|
||
| # Check if we have any Basecamp configuration | ||
| config_output=$("$BASECAMP_BIN" config show --json 2>/dev/null || echo '{}') | ||
| has_config=$(echo "$config_output" | jq -r '.data // empty' 2>/dev/null) | ||
|
|
||
| if [[ -z "$has_config" ]] || [[ "$has_config" == "{}" ]]; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Extract config values | ||
| account_id=$(echo "$has_config" | jq -r '.account_id.value // empty') | ||
| project_id=$(echo "$has_config" | jq -r '.project_id.value // empty') | ||
| todolist_id=$(echo "$has_config" | jq -r '.todolist_id.value // empty') | ||
| # Single subprocess: auth status tells us if we're good to go | ||
| auth_json=$(basecamp auth status --json 2>/dev/null || echo '{}') | ||
|
|
||
| # Only output if we have at least account_id | ||
| if [[ -z "$account_id" ]]; then | ||
| if ! command -v jq &>/dev/null; then | ||
| # No jq — can't parse, just confirm presence | ||
| cat << 'EOF' | ||
| <hook-output> | ||
| Basecamp plugin active. | ||
| </hook-output> | ||
| EOF | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Build context message | ||
| context="Basecamp context loaded:" | ||
|
|
||
| if [[ -n "$cli_version" ]]; then | ||
| context+="\n CLI: v${cli_version}" | ||
| fi | ||
|
|
||
| # Show active profile if using named profiles | ||
| active_profile=$("$BASECAMP_BIN" profile show --json 2>/dev/null | jq -r '.data.name // empty' 2>/dev/null || true) | ||
| if [[ -n "$active_profile" ]]; then | ||
| context+="\n Profile: $active_profile" | ||
| fi | ||
|
|
||
| context+="\n Account: $account_id" | ||
|
|
||
| if [[ -n "$project_id" ]]; then | ||
| context+="\n Project: $project_id" | ||
| fi | ||
|
|
||
| if [[ -n "$todolist_id" ]]; then | ||
| context+="\n Todolist: $todolist_id" | ||
| is_auth=false | ||
| if parsed_auth=$(echo "$auth_json" | jq -er '.data.authenticated' 2>/dev/null); then | ||
| is_auth="$parsed_auth" | ||
| fi | ||
|
|
||
| # Check if authenticated | ||
| auth_status=$("$BASECAMP_BIN" auth status --json 2>/dev/null || echo '{}') | ||
| is_auth=$(echo "$auth_status" | jq -r '.data.authenticated // false') | ||
|
|
||
| if [[ "$is_auth" != "true" ]]; then | ||
| context+="\n Auth: Not authenticated (run: basecamp auth login)" | ||
| fi | ||
|
|
||
| cat << EOF | ||
| if [[ "$is_auth" == "true" ]]; then | ||
| cat << 'EOF' | ||
| <hook-output> | ||
| $(echo -e "$context") | ||
|
|
||
| Use \`basecamp\` commands to interact with Basecamp: | ||
| basecamp todos list # List todos in current project | ||
| basecamp search "query" # Search across projects | ||
| basecamp reports assigned # See what's assigned to you | ||
| basecamp clock <id> --hours 1.5 # Log time on a recording | ||
| Basecamp plugin active. | ||
| </hook-output> | ||
| EOF | ||
| else | ||
| cat << 'EOF' | ||
| <hook-output> | ||
| Basecamp plugin active — not authenticated. | ||
| Run: basecamp auth login | ||
| </hook-output> | ||
| EOF | ||
| fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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.