diff --git a/.claude/AGENTS.md b/.claude/AGENTS.md index 93bb30ea..ca60af4d 100644 --- a/.claude/AGENTS.md +++ b/.claude/AGENTS.md @@ -14,6 +14,7 @@ ## GitHub - Your primary method for interacting with GitHub should be the GitHub CLI. +- Unless in GitHub issues, before DONE, use AskUserQuestion: "Ready to commit?" → if yes, git add/commit/push/PR. Never run those otherwise. ## Plans diff --git a/.claude/commands/brainstorm.md b/.claude/commands/brainstorm.md new file mode 100644 index 00000000..9282d324 --- /dev/null +++ b/.claude/commands/brainstorm.md @@ -0,0 +1,5 @@ +--- +description: Explore requirements through Q&A before planning +--- + +/workflows:brainstorm $ARGUMENTS diff --git a/.claude/commands/lfg.md b/.claude/commands/lfg.md new file mode 100644 index 00000000..30dd1043 --- /dev/null +++ b/.claude/commands/lfg.md @@ -0,0 +1,42 @@ +--- +name: lfg +description: Full autonomous engineering workflow +argument-hint: "[feature description]" +--- + +Run these slash commands in order. Do not do anything else. + +1. `/ralph-wiggum:ralph-loop "finish all slash commands" --completion-promise "DONE"` +2. `/workflows:plan $ARGUMENTS` +3. `/compound-engineering:deepen-plan` +4. `/workflows:work` +5. `/changeset` +6. `/workflows:review` +7. `/compound-engineering:resolve_todo_parallel` +8. `/compound-engineering:test-browser` +9. Output `DONE` when video is in PR + +## Overrides (apply to ALL commands above) + +**plan:** + +- Final checklist/acceptance criteria: include test-browser if any browser-based features + +**deepen-plan:** + +- Context7: only query when not covered by skills + +**work:** + +- Task loop: For UI tasks, run test-browser BEFORE marking complete (don't guess - verify visually) +- Never mark UI task complete without browser verification + +**review:** + +- performance-oracle: don't over-engineer, ship fast, keep simple + +**feature-video:** + +- Prefer PR comment over description update if PR already open + +Start with step 1 now. diff --git a/.claude/commands/plan.md b/.claude/commands/plan.md new file mode 100644 index 00000000..65e14e5c --- /dev/null +++ b/.claude/commands/plan.md @@ -0,0 +1,8 @@ +--- +description: Create implementation plan from requirements +--- + +Run these commands in order: + +1. `/workflows:plan $ARGUMENTS` +2. `/compound-engineering:deepen-plan`: Context7: only query when not covered by skills diff --git a/.claude/commands/review.md b/.claude/commands/review.md new file mode 100644 index 00000000..167f7238 --- /dev/null +++ b/.claude/commands/review.md @@ -0,0 +1,11 @@ +--- +description: Review code and update PR with feedback +--- + +Run these commands in order: + +1. `/workflows:review $ARGUMENTS` +2. `/compound-engineering:resolve_todo_parallel` +3. `/compound-engineering:test-browser` + +- performance-oracle: don't over-engineer, ship fast, keep simple diff --git a/.claude/commands/work.md b/.claude/commands/work.md new file mode 100644 index 00000000..b6b3dde2 --- /dev/null +++ b/.claude/commands/work.md @@ -0,0 +1,11 @@ +--- +description: Implement changes based on plan or requirements +--- + +Run these commands in order: + +1. `/workflows:work $ARGUMENTS` +2. `/changeset` + +- Task loop: For UI tasks, run test-browser BEFORE marking complete (don't guess - verify visually) +- Never mark UI task complete without browser verification diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml new file mode 100644 index 00000000..340a3e2a --- /dev/null +++ b/.github/workflows/claude-review.yml @@ -0,0 +1,71 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize, ready_for_review, reopened] + +jobs: + claude-review: + if: github.event.pull_request.user.login == 'zbeyens' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + actions: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Cache bun + uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} + restore-keys: | + ${{ runner.os }}-bun- + + - name: Install dependencies + run: bun install + + - name: Run Claude Code Review + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + prompt: /review + track_progress: true + + plugin_marketplaces: | + https://github.com/EveryInc/compound-engineering-plugin.git + https://github.com/udecode/dotai.git + plugins: | + compound-engineering@every-marketplace + dig@dotai + debug@dotai + test@dotai + + settings: | + { + "env": { + "BASH_DEFAULT_TIMEOUT_MS": "1800000" + }, + "permissions": { + "allow": ["Bash", "Edit", "Glob", "Grep", "Read", "Task", "Write", "WebFetch", "WebSearch"] + } + } + claude_args: | + --max-turns 1000 + + additional_permissions: | + actions: read + diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 00000000..f84e82a8 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,150 @@ +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + # Interactive mode - responds to @claude mentions with tracking comments + claude: + if: | + github.actor == 'zbeyens' && ( + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + ) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + actions: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Cache bun + uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} + restore-keys: | + ${{ runner.os }}-bun- + + - name: Install dependencies + run: bun install + + - name: Run Claude Code + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + # No prompt = interactive mode with tracking comments + + plugin_marketplaces: | + https://github.com/EveryInc/compound-engineering-plugin.git + https://github.com/udecode/dotai.git + plugins: | + compound-engineering@every-marketplace + dig@dotai + debug@dotai + test@dotai + + settings: | + { + "env": { + "BASH_DEFAULT_TIMEOUT_MS": "1800000" + }, + "permissions": { + "allow": ["Bash", "Edit", "Glob", "Grep", "Read", "Task", "Write", "WebFetch", "WebSearch"] + } + } + claude_args: | + --max-turns 1000 + + additional_permissions: | + actions: read + + # Automation mode - responds to /commands + slash-commands: + if: | + github.actor == 'zbeyens' && ( + (github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/')) || + (github.event_name == 'pull_request_review_comment' && startsWith(github.event.comment.body, '/')) + ) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + actions: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Cache bun + uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} + restore-keys: | + ${{ runner.os }}-bun- + + - name: Install dependencies + run: bun install + + - name: Run Claude Code + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + # Pass comment body for slash commands + prompt: ${{ github.event.comment.body }} + track_progress: true + + plugin_marketplaces: | + https://github.com/EveryInc/compound-engineering-plugin.git + https://github.com/udecode/dotai.git + plugins: | + compound-engineering@every-marketplace + dig@dotai + debug@dotai + test@dotai + + settings: | + { + "env": { + "BASH_DEFAULT_TIMEOUT_MS": "1800000" + }, + "permissions": { + "allow": ["Bash", "Edit", "Glob", "Grep", "Read", "Task", "Write", "WebFetch", "WebSearch"] + } + } + claude_args: | + --max-turns 1000 + + additional_permissions: | + actions: read diff --git a/docs/brainstorms/2026-01-30-github-slash-commands-brainstorm.md b/docs/brainstorms/2026-01-30-github-slash-commands-brainstorm.md new file mode 100644 index 00000000..8d17036c --- /dev/null +++ b/docs/brainstorms/2026-01-30-github-slash-commands-brainstorm.md @@ -0,0 +1,77 @@ +--- +date: 2026-01-30 +topic: github-slash-commands +--- + +# GitHub Slash Commands for Claude Code Action + +## What We're Building + +GitHub Actions-based slash commands that allow commenting `/lfg`, `/brainstorm`, `/plan`, `/work`, `/review` on PRs/issues to trigger Claude workflows. + +**Commands:** + +| Command | Purpose | Auto-commit? | Output | +|---------|---------|--------------|--------| +| `/lfg` | Full autonomous workflow | Yes | Branch + PR link | +| `/brainstorm` | Explore requirements | No | Questions/answers in comments | +| `/plan` | Create implementation plan | No | Plan in comment | +| `/work` | Implement changes | Yes | Branch + PR link | +| `/review` | Review code, update PR | Yes | Review comments, PR updates | + +## Why This Approach + +**Considered:** +- A: Separate commands (5 files) - **chosen** +- B: Single command with args - less discoverable +- C: Workflow + helpers - unclear separation + +**Chose A because:** +- Each command has distinct purpose/permissions +- Easy to iterate on individually +- Matches mental model of stepwise workflow + +## Key Decisions + +1. **Flexible ordering**: Any command works anytime. Auto-detects context from previous comments +2. **Auto-commit for code-producing commands**: `/lfg`, `/work`, `/review` auto-commit. `/brainstorm`, `/plan` don't +3. **PR creation**: Default Claude behavior - pushes branch, provides pre-filled PR link. User clicks to create +4. **Context detection**: Claude reads previous comments in thread to understand state + +## Implementation Details + +### Files to Create + +``` +.claude/commands/ +├── brainstorm.md # /brainstorm - explore requirements +├── plan.md # /plan - create implementation plan +├── work.md # /work - implement changes +└── review.md # /review - code review + PR update +``` + +Note: `/lfg` already exists in `.claude/commands/lfg.md` + +### Workflow File Updates + +Existing `.github/workflows/claude.yml` handles `@claude` mentions. +Slash commands are detected automatically from `.claude/commands/` directory. + +### Command Template Structure + +```markdown +--- +description: Brief description +allowed-tools: Bash(gh:*),Bash(bun:*),Edit,Read,Write +--- + +[Instructions for Claude] +``` + +## Open Questions + +- None remaining - ready for planning + +## Next Steps + +→ `/workflows:plan` for implementation details diff --git a/docs/plans/2026-01-30-feat-github-slash-commands-plan.md b/docs/plans/2026-01-30-feat-github-slash-commands-plan.md new file mode 100644 index 00000000..fc93e19d --- /dev/null +++ b/docs/plans/2026-01-30-feat-github-slash-commands-plan.md @@ -0,0 +1,193 @@ +--- +title: GitHub Slash Commands for Claude Code Action +type: feat +date: 2026-01-30 +--- + +# GitHub Slash Commands for Claude Code Action + +## Overview + +Create 4 new `.claude/commands/*.md` files that enable stepwise PR/issue workflows via GitHub comments: `/brainstorm`, `/plan`, `/work`, `/review`. These complement the existing `/lfg` command. + +**Source:** [brainstorm](../brainstorms/2026-01-30-github-slash-commands-brainstorm.md) + +## Commands Summary + +| Command | Purpose | Auto-commit | Allowed Tools | +|---------|---------|-------------|---------------| +| `/brainstorm` | Explore requirements via Q&A | No | Read, Grep, Glob, WebFetch | +| `/plan` | Create implementation plan | No | Read, Grep, Glob, Write (docs/) | +| `/work` | Implement changes | Yes | All standard + Bash(bun:*), Bash(gh:*) | +| `/review` | Review code, update PR | Yes | Read, Bash(gh pr:*) | + +## Files to Create + +``` +.claude/commands/ +├── brainstorm.md # NEW +├── plan.md # NEW +├── work.md # NEW +├── review.md # NEW +└── lfg.md # EXISTS - no changes needed +``` + +## Implementation + +### 1. brainstorm.md + +```markdown +--- +description: Explore requirements through Q&A before planning +allowed-tools: Read,Grep,Glob,WebFetch,WebSearch +--- + +You are helping explore and refine requirements for a feature or fix. + +## Context Detection + +1. Read the issue/PR description and previous comments +2. Check if a brainstorm doc exists in `docs/brainstorms/` +3. If continuing previous brainstorm, resume from last state + +## Workflow + +1. **Understand** - Ask clarifying questions one at a time +2. **Explore approaches** - Propose 2-3 options with pros/cons +3. **Capture** - Write decision to `docs/brainstorms/YYYY-MM-DD--brainstorm.md` +4. **Handoff** - Summarize and suggest next command (`/plan`) + +## Guidelines + +- Ask ONE question at a time +- Prefer multiple choice when options are clear +- Apply YAGNI - prefer simpler approaches +- Post summary as PR/issue comment when done +- DO NOT commit or push - this is exploratory only +``` + +### 2. plan.md + +```markdown +--- +description: Create implementation plan from requirements +allowed-tools: Read,Grep,Glob,Write,Task +--- + +You are creating an implementation plan for a feature or fix. + +## Context Detection + +1. Read the issue/PR description and previous comments +2. Check for relevant brainstorm in `docs/brainstorms/` +3. Review codebase patterns for similar features + +## Workflow + +1. **Research** - Analyze codebase for patterns and conventions +2. **Plan** - Create step-by-step implementation plan +3. **Write** - Save to `docs/plans/YYYY-MM-DD---plan.md` +4. **Handoff** - Post summary as comment, suggest `/work` + +## Plan Structure + +- Overview (1-2 sentences) +- Files to modify/create +- Step-by-step tasks with acceptance criteria +- Testing approach + +## Guidelines + +- Reference existing patterns in codebase +- Keep plans actionable and specific +- Include file paths and line numbers where relevant +- DO NOT commit or push - planning only +``` + +### 3. work.md + +```markdown +--- +description: Implement changes based on plan or requirements +allowed-tools: Read,Grep,Glob,Write,Edit,MultiEdit,Bash(bun:*),Bash(gh:*),Bash(npm:*),Task +--- + +You are implementing changes for a feature or fix. + +## Context Detection + +1. Read the issue/PR description and previous comments +2. Check for relevant plan in `docs/plans/` +3. Check for relevant brainstorm in `docs/brainstorms/` + +## Workflow + +1. **Understand** - Read plan/requirements, identify scope +2. **Implement** - Make changes following plan or requirements +3. **Verify** - Run typecheck (`bun typecheck`), lint (`bun lint:fix`) +4. **Commit** - Stage, commit with descriptive message, push to branch +5. **Report** - Post summary as comment with PR link if new branch + +## Guidelines + +- Follow existing codebase patterns +- Run verification before committing +- Commit message format: `: ` +- If on issue (not PR): create branch, push, provide PR creation link +- If on PR: push directly to PR branch +``` + +### 4. review.md + +```markdown +--- +description: Review code and update PR with feedback +allowed-tools: Read,Grep,Glob,Bash(gh pr:*),Bash(gh api:*) +--- + +You are reviewing code changes in this PR. + +## Workflow + +1. **Analyze** - Read PR diff and changed files +2. **Review** - Check for: + - Code quality and patterns + - Potential bugs or edge cases + - Test coverage + - Documentation accuracy + - Security concerns +3. **Comment** - Use inline comments for specific issues +4. **Update PR** - Update PR description with summary if needed + +## Guidelines + +- Be constructive and specific +- Only flag genuinely noteworthy issues +- Use inline comments for code-specific feedback +- Use top-level comment for general observations +- Keep feedback concise +``` + +## Acceptance Criteria + +- [x] `/brainstorm` - Wrapper created, invokes `/workflows:brainstorm` +- [x] `/plan` - Wrapper created, invokes `/workflows:plan` +- [x] `/work` - Wrapper created, invokes `/workflows:work` +- [x] `/review` - Wrapper created, invokes `/workflows:review` +- [x] Plugin marketplace configured in claude.yml +- [ ] Commands work on both issues and PRs (requires merge + testing) +- [x] Lint passes + +## Testing Approach + +1. Merge PR #63 (adds claude.yml workflow) +2. Create test issue, comment `/brainstorm add feature X` +3. Verify brainstorm doc created, Q&A in comments +4. Continue with `/plan`, `/work`, `/review` +5. Verify full workflow completes + +## References + +- claude-code-action docs: `/tmp/cc-repos/claude-code-action/docs/` +- Example commands: `/tmp/cc-repos/claude-code-action/.claude/commands/` +- Local lfg.md: `.claude/commands/lfg.md`