mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-05 02:30:26 +08:00
feat: implement enterprise workflow with multi-backend support
## Overview Complete implementation of enterprise-level workflow features including multi-backend execution (Codex/Claude/Gemini), GitHub issue-to-PR automation, hooks system, and comprehensive documentation. ## Major Changes ### 1. Multi-Backend Support (codeagent-wrapper) - Renamed codex-wrapper → codeagent-wrapper - Backend interface with Codex/Claude/Gemini implementations - Multi-format JSON stream parser (auto-detects backend) - CLI flag: --backend codex|claude|gemini (default: codex) - Test coverage: 89.2% **Files:** - codeagent-wrapper/backend.go - Backend interface - codeagent-wrapper/parser.go - Multi-format parser - codeagent-wrapper/config.go - CLI parsing with backend selection - codeagent-wrapper/executor.go - Process execution - codeagent-wrapper/logger.go - Async logging - codeagent-wrapper/utils.go - Utilities ### 2. GitHub Workflow Commands - /gh-create-issue - Create structured issues via guided dialogue - /gh-implement - Issue-to-PR automation with full dev lifecycle **Files:** - github-workflow/commands/gh-create-issue.md - github-workflow/commands/gh-implement.md - skills/codeagent/SKILL.md ### 3. Hooks System - UserPromptSubmit hook for skill activation - Pre-commit example with code quality checks - merge_json operation in install.py for settings.json merging **Files:** - hooks/skill-activation-prompt.sh|.js - hooks/pre-commit.sh - hooks/hooks-config.json - hooks/test-skill-activation.sh ### 4. Skills System - skill-rules.json for auto-activation - codeagent skill for multi-backend wrapper **Files:** - skills/skill-rules.json - skills/codeagent/SKILL.md - skills/codex/SKILL.md (updated) ### 5. Installation System - install.py: Added merge_json operation - config.json: Added "gh" module - config.schema.json: Added op_merge_json schema ### 6. CI/CD - GitHub Actions workflow for testing and building **Files:** - .github/workflows/ci.yml ### 7. Comprehensive Documentation - Architecture overview with ASCII diagrams - Codeagent-wrapper complete usage guide - GitHub workflow detailed examples - Hooks customization guide **Files:** - docs/architecture.md (21KB) - docs/CODEAGENT-WRAPPER.md (9KB) - docs/GITHUB-WORKFLOW.md (9KB) - docs/HOOKS.md (4KB) - docs/enterprise-workflow-ideas.md - README.md (updated with doc links) ## Test Results - All tests passing ✅ - Coverage: 89.2% - Security scan: 0 issues (gosec) ## Breaking Changes - codex-wrapper renamed to codeagent-wrapper - Default backend: codex (documented in README) ## Migration Guide Users with codex-wrapper installed should: 1. Run: python3 install.py --module dev --force 2. Update shell aliases if any 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
407
docs/CODEAGENT-WRAPPER.md
Normal file
407
docs/CODEAGENT-WRAPPER.md
Normal file
@@ -0,0 +1,407 @@
|
||||
# Codeagent-Wrapper User Guide
|
||||
|
||||
Multi-backend AI code execution wrapper supporting Codex, Claude, and Gemini.
|
||||
|
||||
## Overview
|
||||
|
||||
`codeagent-wrapper` is a Go-based CLI tool that provides a unified interface to multiple AI coding backends. It handles:
|
||||
- Multi-backend execution (Codex, Claude, Gemini)
|
||||
- JSON stream parsing and output formatting
|
||||
- Session management and resumption
|
||||
- Parallel task execution with dependency resolution
|
||||
- Timeout handling and signal forwarding
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone https://github.com/cexll/myclaude.git
|
||||
cd myclaude
|
||||
|
||||
# Install via install.py (includes binary compilation)
|
||||
python3 install.py --module dev
|
||||
|
||||
# Or manual installation
|
||||
cd codeagent-wrapper
|
||||
go build -o ~/.claude/bin/codeagent-wrapper
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```bash
|
||||
# Simple task (default: codex backend)
|
||||
codeagent-wrapper "explain @src/main.go"
|
||||
|
||||
# With backend selection
|
||||
codeagent-wrapper --backend claude "refactor @utils.ts"
|
||||
|
||||
# With HEREDOC (recommended for complex tasks)
|
||||
codeagent-wrapper --backend gemini - <<'EOF'
|
||||
Implement user authentication:
|
||||
- JWT tokens
|
||||
- Password hashing with bcrypt
|
||||
- Session management
|
||||
EOF
|
||||
```
|
||||
|
||||
### Backend Selection
|
||||
|
||||
| Backend | Command | Best For |
|
||||
|---------|---------|----------|
|
||||
| **Codex** | `--backend codex` | General code tasks (default) |
|
||||
| **Claude** | `--backend claude` | Complex reasoning, architecture |
|
||||
| **Gemini** | `--backend gemini` | Fast iteration, prototyping |
|
||||
|
||||
## Core Features
|
||||
|
||||
### 1. Multi-Backend Support
|
||||
|
||||
```bash
|
||||
# Codex (default)
|
||||
codeagent-wrapper "add logging to @app.js"
|
||||
|
||||
# Claude for architecture decisions
|
||||
codeagent-wrapper --backend claude - <<'EOF'
|
||||
Design a microservices architecture for e-commerce:
|
||||
- Service boundaries
|
||||
- Communication patterns
|
||||
- Data consistency strategy
|
||||
EOF
|
||||
|
||||
# Gemini for quick prototypes
|
||||
codeagent-wrapper --backend gemini "create React component for user profile"
|
||||
```
|
||||
|
||||
### 2. File References with @ Syntax
|
||||
|
||||
```bash
|
||||
# Single file
|
||||
codeagent-wrapper "optimize @src/utils.ts"
|
||||
|
||||
# Multiple files
|
||||
codeagent-wrapper "refactor @src/auth.ts and @src/middleware.ts"
|
||||
|
||||
# Entire directory
|
||||
codeagent-wrapper "analyze @src for security issues"
|
||||
```
|
||||
|
||||
### 3. Session Management
|
||||
|
||||
```bash
|
||||
# First task
|
||||
codeagent-wrapper "add validation to user form"
|
||||
# Output includes: SESSION_ID: 019a7247-ac9d-71f3-89e2-a823dbd8fd14
|
||||
|
||||
# Resume session
|
||||
codeagent-wrapper resume 019a7247-ac9d-71f3-89e2-a823dbd8fd14 - <<'EOF'
|
||||
Now add error messages for each validation rule
|
||||
EOF
|
||||
```
|
||||
|
||||
### 4. Parallel Execution
|
||||
|
||||
Execute multiple tasks concurrently with dependency management:
|
||||
|
||||
```bash
|
||||
codeagent-wrapper --parallel <<'EOF'
|
||||
---TASK---
|
||||
id: backend_1701234567
|
||||
workdir: /project/backend
|
||||
---CONTENT---
|
||||
implement /api/users endpoints with CRUD operations
|
||||
|
||||
---TASK---
|
||||
id: frontend_1701234568
|
||||
workdir: /project/frontend
|
||||
---CONTENT---
|
||||
build Users page consuming /api/users
|
||||
|
||||
---TASK---
|
||||
id: tests_1701234569
|
||||
workdir: /project/tests
|
||||
dependencies: backend_1701234567, frontend_1701234568
|
||||
---CONTENT---
|
||||
add integration tests for user management flow
|
||||
EOF
|
||||
```
|
||||
|
||||
**Parallel Task Format:**
|
||||
- `---TASK---` - Starts task block
|
||||
- `id: <unique_id>` - Required, use `<feature>_<timestamp>` format
|
||||
- `workdir: <path>` - Optional, defaults to current directory
|
||||
- `dependencies: <id1>, <id2>` - Optional, comma-separated task IDs
|
||||
- `---CONTENT---` - Separates metadata from task content
|
||||
|
||||
**Features:**
|
||||
- Automatic topological sorting
|
||||
- Unlimited concurrency for independent tasks
|
||||
- Error isolation (failures don't stop other tasks)
|
||||
- Dependency blocking (skip if parent fails)
|
||||
|
||||
### 5. Working Directory
|
||||
|
||||
```bash
|
||||
# Execute in specific directory
|
||||
codeagent-wrapper "run tests" /path/to/project
|
||||
|
||||
# With backend selection
|
||||
codeagent-wrapper --backend claude "analyze code" /project/backend
|
||||
|
||||
# With HEREDOC
|
||||
codeagent-wrapper - /path/to/project <<'EOF'
|
||||
refactor database layer
|
||||
EOF
|
||||
```
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Timeout Control
|
||||
|
||||
```bash
|
||||
# Set custom timeout (1 hour = 3600000ms)
|
||||
CODEX_TIMEOUT=3600000 codeagent-wrapper "long running task"
|
||||
|
||||
# Default timeout: 7200000ms (2 hours)
|
||||
```
|
||||
|
||||
**Timeout behavior:**
|
||||
- Sends SIGTERM to backend process
|
||||
- Waits 5 seconds
|
||||
- Sends SIGKILL if process doesn't exit
|
||||
- Returns exit code 124 (consistent with GNU timeout)
|
||||
|
||||
### Complex Multi-line Tasks
|
||||
|
||||
Use HEREDOC to avoid shell escaping issues:
|
||||
|
||||
```bash
|
||||
codeagent-wrapper - <<'EOF'
|
||||
Refactor authentication system:
|
||||
|
||||
Current issues:
|
||||
- Password stored as plain text
|
||||
- No rate limiting on login
|
||||
- Sessions don't expire
|
||||
|
||||
Requirements:
|
||||
1. Hash passwords with bcrypt
|
||||
2. Add rate limiting (5 attempts/15min)
|
||||
3. Session expiry after 24h
|
||||
4. Add refresh token mechanism
|
||||
|
||||
Files to modify:
|
||||
- @src/auth/login.ts
|
||||
- @src/middleware/rateLimit.ts
|
||||
- @config/session.ts
|
||||
EOF
|
||||
```
|
||||
|
||||
### Backend-Specific Features
|
||||
|
||||
**Codex:**
|
||||
```bash
|
||||
# Best for code editing and refactoring
|
||||
codeagent-wrapper --backend codex - <<'EOF'
|
||||
extract duplicate code in @src into reusable helpers
|
||||
EOF
|
||||
```
|
||||
|
||||
**Claude:**
|
||||
```bash
|
||||
# Best for complex reasoning
|
||||
codeagent-wrapper --backend claude - <<'EOF'
|
||||
review @src/payment/processor.ts for:
|
||||
- Race conditions
|
||||
- Edge cases
|
||||
- Security vulnerabilities
|
||||
EOF
|
||||
```
|
||||
|
||||
**Gemini:**
|
||||
```bash
|
||||
# Best for fast iteration
|
||||
codeagent-wrapper --backend gemini "add TypeScript types to @api.js"
|
||||
```
|
||||
|
||||
## Output Format
|
||||
|
||||
Standard output includes parsed agent messages and session ID:
|
||||
|
||||
```
|
||||
Agent response text here...
|
||||
Implementation details...
|
||||
|
||||
---
|
||||
SESSION_ID: 019a7247-ac9d-71f3-89e2-a823dbd8fd14
|
||||
```
|
||||
|
||||
Error output (stderr):
|
||||
```
|
||||
ERROR: Error message details
|
||||
```
|
||||
|
||||
Parallel execution output:
|
||||
```
|
||||
=== Parallel Execution Summary ===
|
||||
Total: 3 | Success: 2 | Failed: 1
|
||||
|
||||
--- Task: backend_1701234567 ---
|
||||
Status: SUCCESS
|
||||
Session: 019a7247-ac9d-71f3-89e2-a823dbd8fd14
|
||||
|
||||
Implementation complete...
|
||||
|
||||
--- Task: frontend_1701234568 ---
|
||||
Status: SUCCESS
|
||||
Session: 019a7248-ac9d-71f3-89e2-a823dbd8fd14
|
||||
|
||||
UI components created...
|
||||
|
||||
--- Task: tests_1701234569 ---
|
||||
Status: FAILED (exit code 1)
|
||||
Error: dependency backend_1701234567 failed
|
||||
```
|
||||
|
||||
## Exit Codes
|
||||
|
||||
| Code | Meaning |
|
||||
|------|---------|
|
||||
| 0 | Success |
|
||||
| 1 | General error (missing args, no output) |
|
||||
| 124 | Timeout |
|
||||
| 127 | Backend command not found |
|
||||
| 130 | Interrupted (Ctrl+C) |
|
||||
| * | Passthrough from backend process |
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `CODEX_TIMEOUT` | 7200000 | Timeout in milliseconds |
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Backend not found:**
|
||||
```bash
|
||||
# Ensure backend CLI is installed
|
||||
which codex
|
||||
which claude
|
||||
which gemini
|
||||
|
||||
# Check PATH
|
||||
echo $PATH
|
||||
```
|
||||
|
||||
**Timeout too short:**
|
||||
```bash
|
||||
# Increase timeout to 4 hours
|
||||
CODEX_TIMEOUT=14400000 codeagent-wrapper "complex task"
|
||||
```
|
||||
|
||||
**Session ID not found:**
|
||||
```bash
|
||||
# List recent sessions (backend-specific)
|
||||
codex history
|
||||
|
||||
# Ensure session ID is copied correctly
|
||||
codeagent-wrapper resume <session_id> "continue task"
|
||||
```
|
||||
|
||||
**Parallel tasks not running:**
|
||||
```bash
|
||||
# Check task format
|
||||
# Ensure ---TASK--- and ---CONTENT--- delimiters are correct
|
||||
# Verify task IDs are unique
|
||||
# Check dependencies reference existing task IDs
|
||||
```
|
||||
|
||||
## Integration with Claude Code
|
||||
|
||||
Use via the `codeagent` skill:
|
||||
|
||||
```bash
|
||||
# In Claude Code conversation
|
||||
User: Use codeagent to implement authentication
|
||||
|
||||
# Claude will execute:
|
||||
codeagent-wrapper --backend codex - <<'EOF'
|
||||
implement JWT authentication in @src/auth
|
||||
EOF
|
||||
```
|
||||
|
||||
## Performance Tips
|
||||
|
||||
1. **Use parallel execution** for independent tasks
|
||||
2. **Choose the right backend** for the task type
|
||||
3. **Keep working directory specific** to reduce context
|
||||
4. **Resume sessions** for multi-step workflows
|
||||
5. **Use @ syntax** to minimize file content in prompts
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **HEREDOC for complex tasks** - Avoid shell escaping nightmares
|
||||
2. **Descriptive task IDs** - Use `<feature>_<timestamp>` format
|
||||
3. **Absolute paths** - Avoid relative path confusion
|
||||
4. **Session resumption** - Continue conversations with context
|
||||
5. **Timeout tuning** - Set appropriate timeouts for task complexity
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Code Review
|
||||
|
||||
```bash
|
||||
codeagent-wrapper --backend claude - <<'EOF'
|
||||
Review @src/payment/stripe.ts for:
|
||||
1. Security issues (API key handling, input validation)
|
||||
2. Error handling (network failures, API errors)
|
||||
3. Edge cases (duplicate charges, partial refunds)
|
||||
4. Code quality (naming, structure, comments)
|
||||
EOF
|
||||
```
|
||||
|
||||
### Example 2: Refactoring
|
||||
|
||||
```bash
|
||||
codeagent-wrapper --backend codex - <<'EOF'
|
||||
Refactor @src/utils:
|
||||
- Extract duplicate code into helpers
|
||||
- Add TypeScript types
|
||||
- Improve function naming
|
||||
- Add JSDoc comments
|
||||
EOF
|
||||
```
|
||||
|
||||
### Example 3: Full-Stack Feature
|
||||
|
||||
```bash
|
||||
codeagent-wrapper --parallel <<'EOF'
|
||||
---TASK---
|
||||
id: api_1701234567
|
||||
workdir: /project/backend
|
||||
---CONTENT---
|
||||
implement /api/notifications endpoints with WebSocket support
|
||||
|
||||
---TASK---
|
||||
id: ui_1701234568
|
||||
workdir: /project/frontend
|
||||
dependencies: api_1701234567
|
||||
---CONTENT---
|
||||
build Notifications component with real-time updates
|
||||
|
||||
---TASK---
|
||||
id: tests_1701234569
|
||||
workdir: /project
|
||||
dependencies: api_1701234567, ui_1701234568
|
||||
---CONTENT---
|
||||
add E2E tests for notification flow
|
||||
EOF
|
||||
```
|
||||
|
||||
## Further Reading
|
||||
|
||||
- [Codex CLI Documentation](https://codex.docs)
|
||||
- [Claude CLI Documentation](https://claude.ai/docs)
|
||||
- [Gemini CLI Documentation](https://ai.google.dev/docs)
|
||||
- [Architecture Overview](./architecture.md)
|
||||
468
docs/GITHUB-WORKFLOW.md
Normal file
468
docs/GITHUB-WORKFLOW.md
Normal file
@@ -0,0 +1,468 @@
|
||||
# GitHub Workflow Commands
|
||||
|
||||
Issue-to-PR automation with `codeagent-wrapper` integration.
|
||||
|
||||
## Overview
|
||||
|
||||
Two commands streamline GitHub workflows:
|
||||
- `/gh-create-issue` - Create structured issues through guided dialogue
|
||||
- `/gh-implement` - Implement issues with automated development lifecycle
|
||||
|
||||
## Prerequisites
|
||||
|
||||
```bash
|
||||
# Install GitHub CLI
|
||||
brew install gh
|
||||
|
||||
# Authenticate
|
||||
gh auth login
|
||||
|
||||
# Verify
|
||||
gh auth status
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
### /gh-create-issue
|
||||
|
||||
Create structured GitHub issues through multi-round dialogue.
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
/gh-create-issue "add user authentication"
|
||||
```
|
||||
|
||||
**Process:**
|
||||
|
||||
1. **Initial Analysis** - Claude analyzes your brief description
|
||||
2. **Clarification Questions** - Interactive Q&A to gather:
|
||||
- Technical requirements
|
||||
- Acceptance criteria
|
||||
- Dependencies
|
||||
- Priority/labels
|
||||
3. **Issue Creation** - Generates structured issue with:
|
||||
- Clear title
|
||||
- Detailed description
|
||||
- Acceptance criteria checklist
|
||||
- Relevant labels
|
||||
- Assignee (optional)
|
||||
|
||||
**Example Session:**
|
||||
|
||||
```
|
||||
User: /gh-create-issue "add dark mode"
|
||||
|
||||
Claude: I'll help create a structured issue for dark mode. Let me gather some details.
|
||||
|
||||
1. Scope: Just theme toggle, or also persist user preference?
|
||||
2. Which components need dark mode support?
|
||||
3. Design system: Using CSS variables or styled-components?
|
||||
|
||||
User:
|
||||
1. Toggle + persist in localStorage
|
||||
2. All components in src/components
|
||||
3. CSS variables
|
||||
|
||||
Claude: Creating issue...
|
||||
|
||||
✅ Issue created: #123 "Implement dark mode with theme persistence"
|
||||
URL: https://github.com/user/repo/issues/123
|
||||
```
|
||||
|
||||
**Generated Issue Format:**
|
||||
|
||||
```markdown
|
||||
# Implement dark mode with theme persistence
|
||||
|
||||
## Description
|
||||
Add dark mode support across all components with user preference persistence.
|
||||
|
||||
## Requirements
|
||||
- [ ] Add theme toggle component
|
||||
- [ ] Implement CSS variables for light/dark themes
|
||||
- [ ] Persist theme preference in localStorage
|
||||
- [ ] Update all components in src/components to support dark mode
|
||||
- [ ] Add theme toggle to app header
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] User can toggle between light and dark themes
|
||||
- [ ] Theme preference persists across sessions
|
||||
- [ ] All UI components render correctly in both themes
|
||||
- [ ] No flash of unstyled content on page load
|
||||
|
||||
## Technical Notes
|
||||
- Use CSS custom properties
|
||||
- Store preference as `theme: 'light' | 'dark'` in localStorage
|
||||
- Add `data-theme` attribute to root element
|
||||
|
||||
Labels: enhancement, ui
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### /gh-implement
|
||||
|
||||
Implement GitHub issue with full development lifecycle.
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
/gh-implement 123
|
||||
```
|
||||
|
||||
**Phases:**
|
||||
|
||||
#### Phase 1: Issue Analysis
|
||||
```bash
|
||||
# Fetches issue details
|
||||
gh issue view 123 --json title,body,labels,comments
|
||||
|
||||
# Parses:
|
||||
- Requirements
|
||||
- Acceptance criteria
|
||||
- Technical constraints
|
||||
- Related discussions
|
||||
```
|
||||
|
||||
#### Phase 2: Clarification (if needed)
|
||||
Claude asks questions about:
|
||||
- Implementation approach
|
||||
- Architecture decisions
|
||||
- Testing strategy
|
||||
- Edge cases
|
||||
|
||||
#### Phase 3: Development
|
||||
|
||||
**Option A: Simple scope** - Direct `codeagent-wrapper` call:
|
||||
```bash
|
||||
codeagent-wrapper --backend codex - <<'EOF'
|
||||
Implement dark mode toggle based on issue #123:
|
||||
- Add ThemeToggle component
|
||||
- Implement CSS variables
|
||||
- Add localStorage persistence
|
||||
EOF
|
||||
```
|
||||
|
||||
**Option B: Complex scope** - Use `/dev` workflow:
|
||||
```bash
|
||||
/dev "implement issue #123: dark mode with theme persistence"
|
||||
```
|
||||
|
||||
**Coverage requirement:** ≥90% test coverage enforced
|
||||
|
||||
#### Phase 4: Progress Updates
|
||||
```bash
|
||||
# After each milestone
|
||||
gh issue comment 123 --body "✅ Completed: ThemeToggle component"
|
||||
gh issue comment 123 --body "✅ Completed: CSS variables setup"
|
||||
gh issue comment 123 --body "✅ Completed: localStorage persistence"
|
||||
```
|
||||
|
||||
#### Phase 5: PR Creation
|
||||
```bash
|
||||
gh pr create \
|
||||
--title "[#123] Implement dark mode with theme persistence" \
|
||||
--body "Closes #123
|
||||
|
||||
## Changes
|
||||
- Added ThemeToggle component
|
||||
- Implemented light/dark CSS variables
|
||||
- Added localStorage persistence
|
||||
- Updated all components for theme support
|
||||
|
||||
## Testing
|
||||
- Unit tests: ThemeToggle, theme utilities
|
||||
- Integration tests: theme persistence across page loads
|
||||
- Coverage: 92%"
|
||||
```
|
||||
|
||||
**Output:**
|
||||
```
|
||||
✅ PR created: #124
|
||||
URL: https://github.com/user/repo/pull/124
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Bug Fix
|
||||
|
||||
```bash
|
||||
# Create issue
|
||||
/gh-create-issue "login form doesn't validate email"
|
||||
|
||||
# Implement
|
||||
/gh-implement 125
|
||||
```
|
||||
|
||||
**Process:**
|
||||
1. Analysis: Parse bug report, identify validation logic
|
||||
2. Clarification: Confirm expected validation rules
|
||||
3. Development: Fix validation, add tests
|
||||
4. Updates: Comment with fix details
|
||||
5. PR: Link to issue, show test coverage
|
||||
|
||||
---
|
||||
|
||||
### Example 2: Feature Development
|
||||
|
||||
```bash
|
||||
# Create issue
|
||||
/gh-create-issue "add export to CSV feature"
|
||||
|
||||
# Implement
|
||||
/gh-implement 126
|
||||
```
|
||||
|
||||
**Process:**
|
||||
1. Analysis: Understand data structure, export requirements
|
||||
2. Clarification: Which data fields? File naming? Encoding?
|
||||
3. Development:
|
||||
- Backend: CSV generation endpoint
|
||||
- Frontend: Export button + download handler
|
||||
- Tests: Unit + integration
|
||||
4. Updates: Milestone comments (backend done, frontend done, tests done)
|
||||
5. PR: Full feature description with screenshots
|
||||
|
||||
---
|
||||
|
||||
### Example 3: Refactoring
|
||||
|
||||
```bash
|
||||
# Create issue
|
||||
/gh-create-issue "refactor authentication module"
|
||||
|
||||
# Implement
|
||||
/gh-implement 127
|
||||
```
|
||||
|
||||
**Process:**
|
||||
1. Analysis: Review current auth code, identify issues
|
||||
2. Clarification: Scope (just refactor vs add features)?
|
||||
3. Development:
|
||||
- Modularize auth logic
|
||||
- Extract reusable utilities
|
||||
- Add missing tests
|
||||
- Update documentation
|
||||
4. Updates: Component-by-component progress
|
||||
5. PR: Before/after comparison, test coverage improvement
|
||||
|
||||
---
|
||||
|
||||
## Workflow Integration
|
||||
|
||||
### With /dev Workflow
|
||||
|
||||
```bash
|
||||
# Create issue first
|
||||
/gh-create-issue "implement real-time notifications"
|
||||
|
||||
# Then implement with /dev
|
||||
/gh-implement 128
|
||||
|
||||
# Claude will:
|
||||
# 1. Analyze issue #128
|
||||
# 2. Trigger /dev workflow internally
|
||||
# 3. Execute with 90% coverage requirement
|
||||
# 4. Post progress updates
|
||||
# 5. Create PR
|
||||
```
|
||||
|
||||
### With Parallel Tasks
|
||||
|
||||
For complex features, `/gh-implement` may use parallel execution:
|
||||
|
||||
```bash
|
||||
# Internally executes:
|
||||
codeagent-wrapper --parallel <<'EOF'
|
||||
---TASK---
|
||||
id: backend_notifications
|
||||
workdir: /project/backend
|
||||
---CONTENT---
|
||||
implement notifications API with WebSocket
|
||||
|
||||
---TASK---
|
||||
id: frontend_notifications
|
||||
workdir: /project/frontend
|
||||
dependencies: backend_notifications
|
||||
---CONTENT---
|
||||
build Notifications UI component
|
||||
|
||||
---TASK---
|
||||
id: tests_notifications
|
||||
workdir: /project
|
||||
dependencies: backend_notifications, frontend_notifications
|
||||
---CONTENT---
|
||||
add E2E tests for notification flow
|
||||
EOF
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
### Issue Templates
|
||||
|
||||
Create `.github/ISSUE_TEMPLATE/feature.md`:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest a new feature
|
||||
labels: enhancement
|
||||
---
|
||||
|
||||
## Description
|
||||
<!-- Clear description of the feature -->
|
||||
|
||||
## Requirements
|
||||
<!-- Specific requirements -->
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- Checklist of criteria -->
|
||||
```
|
||||
|
||||
### PR Templates
|
||||
|
||||
Create `.github/PULL_REQUEST_TEMPLATE.md`:
|
||||
|
||||
```markdown
|
||||
## Related Issue
|
||||
Closes #
|
||||
|
||||
## Changes
|
||||
<!-- List of changes -->
|
||||
|
||||
## Testing
|
||||
<!-- Test coverage and manual testing -->
|
||||
|
||||
## Screenshots (if applicable)
|
||||
<!-- Before/after screenshots -->
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Clear issue descriptions** - More context = better implementation
|
||||
2. **Incremental commits** - Easier to review and rollback
|
||||
3. **Test-driven** - Write tests before/during implementation
|
||||
4. **Milestone updates** - Keep issue comments up-to-date
|
||||
5. **Detailed PRs** - Explain why, not just what
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Issue not found:**
|
||||
```bash
|
||||
# Verify issue exists
|
||||
gh issue view 123
|
||||
|
||||
# Check repository
|
||||
gh repo view
|
||||
```
|
||||
|
||||
**PR creation failed:**
|
||||
```bash
|
||||
# Ensure branch is pushed
|
||||
git push -u origin feature-branch
|
||||
|
||||
# Check if PR already exists
|
||||
gh pr list --head feature-branch
|
||||
```
|
||||
|
||||
**Authentication error:**
|
||||
```bash
|
||||
# Re-authenticate
|
||||
gh auth login
|
||||
|
||||
# Check token scopes
|
||||
gh auth status
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Custom Labels
|
||||
|
||||
```bash
|
||||
# Add labels during issue creation
|
||||
gh issue create \
|
||||
--title "Feature: dark mode" \
|
||||
--body "..." \
|
||||
--label "enhancement,ui,priority:high"
|
||||
```
|
||||
|
||||
### Multiple Assignees
|
||||
|
||||
```bash
|
||||
# Assign to team members
|
||||
gh issue create \
|
||||
--title "..." \
|
||||
--assignee @user1,@user2
|
||||
```
|
||||
|
||||
### Milestone Assignment
|
||||
|
||||
```bash
|
||||
# Add to milestone
|
||||
gh issue create \
|
||||
--title "..." \
|
||||
--milestone "v2.0"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Integration with CI/CD
|
||||
|
||||
### Auto-close on merge
|
||||
|
||||
```yaml
|
||||
# .github/workflows/pr-merge.yml
|
||||
name: Close Issues on PR Merge
|
||||
on:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
|
||||
jobs:
|
||||
close-issues:
|
||||
if: github.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Close linked issues
|
||||
run: gh issue close ${{ github.event.pull_request.number }}
|
||||
```
|
||||
|
||||
### Coverage Check
|
||||
|
||||
```yaml
|
||||
# .github/workflows/coverage.yml
|
||||
name: Coverage Check
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
coverage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Run tests with coverage
|
||||
run: go test -coverprofile=coverage.out ./...
|
||||
- name: Check coverage threshold
|
||||
run: |
|
||||
coverage=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
||||
if (( $(echo "$coverage < 90" | bc -l) )); then
|
||||
echo "Coverage $coverage% is below 90% threshold"
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Further Reading
|
||||
|
||||
- [GitHub CLI Manual](https://cli.github.com/manual/)
|
||||
- [Codeagent-Wrapper Guide](./CODEAGENT-WRAPPER.md)
|
||||
- [Hooks Documentation](./HOOKS.md)
|
||||
- [Development Workflow](../README.md)
|
||||
197
docs/HOOKS.md
Normal file
197
docs/HOOKS.md
Normal file
@@ -0,0 +1,197 @@
|
||||
# Claude Code Hooks Guide
|
||||
|
||||
Hooks are shell scripts or commands that execute in response to Claude Code events.
|
||||
|
||||
## Available Hook Types
|
||||
|
||||
### 1. UserPromptSubmit
|
||||
Runs after user submits a prompt, before Claude processes it.
|
||||
|
||||
**Use cases:**
|
||||
- Auto-activate skills based on keywords
|
||||
- Add context injection
|
||||
- Log user requests
|
||||
|
||||
### 2. PostToolUse
|
||||
Runs after Claude uses a tool.
|
||||
|
||||
**Use cases:**
|
||||
- Validate tool outputs
|
||||
- Run additional checks (linting, formatting)
|
||||
- Log tool usage
|
||||
|
||||
### 3. Stop
|
||||
Runs when Claude Code session ends.
|
||||
|
||||
**Use cases:**
|
||||
- Cleanup temporary files
|
||||
- Generate session reports
|
||||
- Commit changes automatically
|
||||
|
||||
## Configuration
|
||||
|
||||
Hooks are configured in `.claude/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"UserPromptSubmit": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/hooks/skill-activation-prompt.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"PostToolUse": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/hooks/post-tool-check.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Creating Custom Hooks
|
||||
|
||||
### Example: Pre-Commit Hook
|
||||
|
||||
**File:** `hooks/pre-commit.sh`
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Get staged files
|
||||
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
|
||||
|
||||
# Run tests on Go files
|
||||
GO_FILES=$(echo "$STAGED_FILES" | grep '\.go$' || true)
|
||||
if [ -n "$GO_FILES" ]; then
|
||||
go test ./... -short || exit 1
|
||||
fi
|
||||
|
||||
# Validate JSON files
|
||||
JSON_FILES=$(echo "$STAGED_FILES" | grep '\.json$' || true)
|
||||
if [ -n "$JSON_FILES" ]; then
|
||||
for file in $JSON_FILES; do
|
||||
jq empty "$file" || exit 1
|
||||
done
|
||||
fi
|
||||
|
||||
echo "✅ Pre-commit checks passed"
|
||||
```
|
||||
|
||||
**Register in settings.json:**
|
||||
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/hooks/pre-commit.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example: Auto-Format Hook
|
||||
|
||||
**File:** `hooks/auto-format.sh`
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Format Go files
|
||||
find . -name "*.go" -exec gofmt -w {} \;
|
||||
|
||||
# Format JSON files
|
||||
find . -name "*.json" -exec jq --indent 2 . {} \; -exec mv {} {}.tmp \; -exec mv {}.tmp {} \;
|
||||
|
||||
echo "✅ Files formatted"
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Hooks have access to:
|
||||
- `$CLAUDE_PROJECT_DIR` - Project root directory
|
||||
- `$PWD` - Current working directory
|
||||
- All shell environment variables
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Keep hooks fast** - Slow hooks block Claude Code
|
||||
2. **Handle errors gracefully** - Return non-zero on failure
|
||||
3. **Use absolute paths** - Reference `$CLAUDE_PROJECT_DIR`
|
||||
4. **Make scripts executable** - `chmod +x hooks/script.sh`
|
||||
5. **Test independently** - Run hooks manually first
|
||||
6. **Document behavior** - Add comments explaining logic
|
||||
|
||||
## Debugging Hooks
|
||||
|
||||
Enable verbose logging:
|
||||
|
||||
```bash
|
||||
# Add to your hook
|
||||
set -x # Print commands
|
||||
set -e # Exit on error
|
||||
```
|
||||
|
||||
Test manually:
|
||||
|
||||
```bash
|
||||
cd /path/to/project
|
||||
./hooks/your-hook.sh
|
||||
echo $? # Check exit code
|
||||
```
|
||||
|
||||
## Built-in Hooks
|
||||
|
||||
This repository includes:
|
||||
|
||||
| Hook | File | Purpose |
|
||||
|------|------|---------|
|
||||
| Skill Activation | `skill-activation-prompt.sh` | Auto-suggest skills |
|
||||
| Pre-commit | `pre-commit.sh` | Code quality checks |
|
||||
|
||||
## Disabling Hooks
|
||||
|
||||
Remove hook configuration from `.claude/settings.json` or set empty array:
|
||||
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"UserPromptSubmit": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Hook not running?**
|
||||
- Check `.claude/settings.json` syntax
|
||||
- Verify script is executable: `ls -l hooks/`
|
||||
- Check script path is correct
|
||||
|
||||
**Hook failing silently?**
|
||||
- Add `set -e` to script
|
||||
- Check exit codes: `echo $?`
|
||||
- Add logging: `echo "debug" >> /tmp/hook.log`
|
||||
|
||||
## Further Reading
|
||||
|
||||
- [Claude Code Hooks Documentation](https://docs.anthropic.com/claude-code/hooks)
|
||||
- [Bash Scripting Guide](https://www.gnu.org/software/bash/manual/)
|
||||
502
docs/architecture.md
Normal file
502
docs/architecture.md
Normal file
@@ -0,0 +1,502 @@
|
||||
# System Architecture
|
||||
|
||||
## Overview
|
||||
|
||||
Multi-agent AI development system with Claude Code as orchestrator and pluggable execution backends.
|
||||
|
||||
## High-Level Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ User │
|
||||
└──────────────────┬──────────────────────────────────────────┘
|
||||
│
|
||||
│ /dev, /gh-implement, etc.
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Claude Code (Orchestrator) │
|
||||
│ ┌─────────────────────────────────────────────────────────┐│
|
||||
│ │ - Planning & context gathering ││
|
||||
│ │ - Requirements clarification ││
|
||||
│ │ - Task breakdown ││
|
||||
│ │ - Verification & reporting ││
|
||||
│ └─────────────────────────────────────────────────────────┘│
|
||||
└──────────────────┬──────────────────────────────────────────┘
|
||||
│
|
||||
│ via codeagent-wrapper
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Codeagent-Wrapper (Execution Layer) │
|
||||
│ ┌──────────────────────────────────────────────────────────┤
|
||||
│ │ Backend Interface │
|
||||
│ ├──────────────┬──────────────┬──────────────┐ │
|
||||
│ │ Codex │ Claude │ Gemini │ │
|
||||
│ │ Backend │ Backend │ Backend │ │
|
||||
│ └──────────────┴──────────────┴──────────────┘ │
|
||||
│ │
|
||||
│ ┌──────────────────────────────────────────────────────────┤
|
||||
│ │ Features: │
|
||||
│ │ - Multi-backend execution │
|
||||
│ │ - JSON stream parsing │
|
||||
│ │ - Session management │
|
||||
│ │ - Parallel task execution │
|
||||
│ │ - Timeout handling │
|
||||
│ └──────────────────────────────────────────────────────────┘
|
||||
└──────────────────┬──────────────────────────────────────────┘
|
||||
│
|
||||
│ CLI invocations
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ AI CLI Backends │
|
||||
│ ┌──────────────┬──────────────┬──────────────┐ │
|
||||
│ │ Codex CLI │ Claude CLI │ Gemini CLI │ │
|
||||
│ │ │ │ │ │
|
||||
│ │ Code editing │ Reasoning │ Fast proto │ │
|
||||
│ └──────────────┴──────────────┴──────────────┘ │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Component Architecture
|
||||
|
||||
### 1. Orchestrator Layer (Claude Code)
|
||||
|
||||
**Responsibilities:**
|
||||
- User interaction and requirements gathering
|
||||
- Context analysis and exploration
|
||||
- Task planning and breakdown
|
||||
- Workflow coordination
|
||||
- Verification and reporting
|
||||
|
||||
**Key Workflows:**
|
||||
```
|
||||
/dev
|
||||
├── Requirements clarification (AskUserQuestion)
|
||||
├── Codex analysis (Task tool → Explore agent)
|
||||
├── Dev plan generation (Task tool → dev-plan-generator)
|
||||
├── Parallel execution (codeagent-wrapper --parallel)
|
||||
├── Coverage validation (≥90%)
|
||||
└── Completion summary
|
||||
|
||||
/gh-implement <issue>
|
||||
├── Issue analysis (gh issue view)
|
||||
├── Clarification (if needed)
|
||||
├── Development (codeagent-wrapper or /dev)
|
||||
├── Progress updates (gh issue comment)
|
||||
└── PR creation (gh pr create)
|
||||
```
|
||||
|
||||
### 2. Execution Layer (Codeagent-Wrapper)
|
||||
|
||||
**Architecture:**
|
||||
|
||||
```go
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ Main Entry Point │
|
||||
│ - Parse CLI arguments │
|
||||
│ - Detect mode (new/resume/parallel) │
|
||||
│ - Select backend │
|
||||
└──────────────────┬──────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ Backend Selection │
|
||||
│ func SelectBackend(name string) Backend │
|
||||
│ ┌──────────────┬──────────────┬──────────────┐ │
|
||||
│ │ CodexBackend │ ClaudeBackend│ GeminiBackend│ │
|
||||
│ └──────────────┴──────────────┴──────────────┘ │
|
||||
└──────────────────┬──────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ Executor │
|
||||
│ func RunCodexTask(cfg *Config) (string, error) │
|
||||
│ ┌──────────────────────────────────────────────────────┤
|
||||
│ │ 1. Build command args via Backend.BuildArgs() │
|
||||
│ │ 2. Start process with timeout │
|
||||
│ │ 3. Stream stdout/stderr │
|
||||
│ │ 4. Parse JSON stream via ParseJSONStream() │
|
||||
│ │ 5. Extract session ID │
|
||||
│ │ 6. Handle signals (SIGINT, SIGTERM) │
|
||||
│ └──────────────────────────────────────────────────────┘
|
||||
└──────────────────┬──────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ Parser │
|
||||
│ func ParseJSONStream(r io.Reader) (string, string) │
|
||||
│ ┌──────────────────────────────────────────────────────┤
|
||||
│ │ Detects format: │
|
||||
│ │ - Codex: {"type":"thread.started","thread_id":...} │
|
||||
│ │ - Claude: {"type":"...","subtype":"result"} │
|
||||
│ │ - Gemini: {"type":"...","role":"assistant"} │
|
||||
│ │ │
|
||||
│ │ Extracts: │
|
||||
│ │ - Agent messages │
|
||||
│ │ - Session IDs │
|
||||
│ └──────────────────────────────────────────────────────┘
|
||||
└─────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Backend Interface:**
|
||||
|
||||
```go
|
||||
type Backend interface {
|
||||
Name() string
|
||||
Command() string
|
||||
BuildArgs(cfg *Config, targetArg string) []string
|
||||
}
|
||||
|
||||
// Codex: codex e --skip-git-repo-check -C <workdir> --json <task>
|
||||
// Claude: claude -p --dangerously-skip-permissions --output-format stream-json --verbose <task>
|
||||
// Gemini: gemini -o stream-json -y -p <task>
|
||||
```
|
||||
|
||||
**Key Files:**
|
||||
- `main.go` - Entry point and orchestration
|
||||
- `config.go` - CLI argument parsing
|
||||
- `backend.go` - Backend interface and implementations
|
||||
- `executor.go` - Process execution and stream handling
|
||||
- `parser.go` - JSON stream parsing (multi-format)
|
||||
- `logger.go` - Async logging with ring buffer
|
||||
- `utils.go` - Helper functions
|
||||
|
||||
### 3. Hooks System
|
||||
|
||||
**Architecture:**
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ Claude Code Events │
|
||||
│ UserPromptSubmit │ PostToolUse │ Stop │
|
||||
└──────────────────┬──────────────────────────────────────┘
|
||||
│
|
||||
│ reads
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ .claude/settings.json │
|
||||
│ { │
|
||||
│ "hooks": { │
|
||||
│ "UserPromptSubmit": [ │
|
||||
│ { │
|
||||
│ "hooks": [ │
|
||||
│ { │
|
||||
│ "type": "command", │
|
||||
│ "command": "$CLAUDE_PROJECT_DIR/hooks/..." │
|
||||
│ } │
|
||||
│ ] │
|
||||
│ } │
|
||||
│ ] │
|
||||
│ } │
|
||||
│ } │
|
||||
└──────────────────┬──────────────────────────────────────┘
|
||||
│
|
||||
│ executes
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ Hook Scripts │
|
||||
│ ┌────────────────────────────────────────────────────┐ │
|
||||
│ │ skill-activation-prompt.sh │ │
|
||||
│ │ - Reads skills/skill-rules.json │ │
|
||||
│ │ - Matches user prompt against triggers │ │
|
||||
│ │ - Injects skill suggestions │ │
|
||||
│ └────────────────────────────────────────────────────┘ │
|
||||
│ ┌────────────────────────────────────────────────────┐ │
|
||||
│ │ pre-commit.sh │ │
|
||||
│ │ - Validates staged files │ │
|
||||
│ │ - Runs tests │ │
|
||||
│ │ - Formats code │ │
|
||||
│ └────────────────────────────────────────────────────┘ │
|
||||
└─────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### 4. Skills System
|
||||
|
||||
**Structure:**
|
||||
|
||||
```
|
||||
skills/
|
||||
├── codex/
|
||||
│ └── SKILL.md # Codex CLI integration
|
||||
├── codeagent/
|
||||
│ └── SKILL.md # Multi-backend wrapper
|
||||
├── gemini/
|
||||
│ └── SKILL.md # Gemini CLI integration
|
||||
└── skill-rules.json # Auto-activation rules
|
||||
```
|
||||
|
||||
**skill-rules.json Format:**
|
||||
|
||||
```json
|
||||
{
|
||||
"rules": [
|
||||
{
|
||||
"trigger": {
|
||||
"pattern": "implement|build|create feature",
|
||||
"type": "regex"
|
||||
},
|
||||
"skill": "codeagent",
|
||||
"priority": 1,
|
||||
"suggestion": "Use codeagent skill for code implementation"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Data Flow
|
||||
|
||||
### Example: /dev Workflow
|
||||
|
||||
```
|
||||
1. User: /dev "add user authentication"
|
||||
│
|
||||
▼
|
||||
2. Claude Code:
|
||||
│ ├─ Clarifies requirements (AskUserQuestion)
|
||||
│ ├─ Analyzes codebase (Explore agent)
|
||||
│ └─ Generates dev-plan.md
|
||||
│
|
||||
▼
|
||||
3. Claude Code invokes: codeagent-wrapper --parallel <<EOF
|
||||
---TASK---
|
||||
id: auth_backend_1701234567
|
||||
workdir: /project/backend
|
||||
---CONTENT---
|
||||
implement JWT authentication in @src/auth
|
||||
|
||||
---TASK---
|
||||
id: auth_frontend_1701234568
|
||||
workdir: /project/frontend
|
||||
dependencies: auth_backend_1701234567
|
||||
---CONTENT---
|
||||
implement login form consuming /api/auth
|
||||
|
||||
---TASK---
|
||||
id: auth_tests_1701234569
|
||||
workdir: /project
|
||||
dependencies: auth_backend_1701234567, auth_frontend_1701234568
|
||||
---CONTENT---
|
||||
add integration tests for auth flow
|
||||
EOF
|
||||
│
|
||||
▼
|
||||
4. Codeagent-Wrapper:
|
||||
│ ├─ Parses parallel config
|
||||
│ ├─ Topological sort (resolves dependencies)
|
||||
│ ├─ Executes tasks concurrently:
|
||||
│ │ ├─ Task 1: codex e --json "implement JWT..."
|
||||
│ │ ├─ Task 2: waits for Task 1, then codex e --json "implement login..."
|
||||
│ │ └─ Task 3: waits for Tasks 1&2, then codex e --json "add tests..."
|
||||
│ └─ Aggregates results
|
||||
│
|
||||
▼
|
||||
5. Claude Code:
|
||||
│ ├─ Validates coverage (≥90%)
|
||||
│ ├─ Runs final tests
|
||||
│ └─ Reports summary
|
||||
│
|
||||
▼
|
||||
6. User receives:
|
||||
✅ Authentication implemented
|
||||
📊 Coverage: 92%
|
||||
📁 Files modified: 8
|
||||
🧪 Tests: 24 passed
|
||||
```
|
||||
|
||||
## Module System
|
||||
|
||||
Installation system uses modular architecture:
|
||||
|
||||
```
|
||||
config.json
|
||||
├── dev module (enabled)
|
||||
│ ├── merge_dir: dev-workflow → ~/.claude
|
||||
│ ├── copy_file: memorys/CLAUDE.md
|
||||
│ ├── copy_file: skills/codex/SKILL.md
|
||||
│ └── run_command: install codeagent-wrapper binary
|
||||
│
|
||||
├── gh module (enabled)
|
||||
│ ├── merge_dir: github-workflow → ~/.claude
|
||||
│ ├── copy_file: skills/codeagent/SKILL.md
|
||||
│ ├── copy_dir: hooks → ~/.claude/hooks
|
||||
│ └── merge_json: hooks-config.json → settings.json
|
||||
│
|
||||
└── essentials module (enabled)
|
||||
└── merge_dir: development-essentials → ~/.claude
|
||||
```
|
||||
|
||||
**Installation Flow:**
|
||||
|
||||
```bash
|
||||
python3 install.py --module dev,gh
|
||||
|
||||
1. Load config.json
|
||||
2. Validate against config.schema.json
|
||||
3. Select modules: dev, gh
|
||||
4. Execute operations:
|
||||
├─ dev:
|
||||
│ ├─ Merge dev-workflow/commands → ~/.claude/commands
|
||||
│ ├─ Copy CLAUDE.md → ~/.claude/CLAUDE.md
|
||||
│ ├─ Copy codex skill → ~/.claude/skills/codex/
|
||||
│ └─ Run install.sh (compile codeagent-wrapper)
|
||||
│
|
||||
└─ gh:
|
||||
├─ Merge github-workflow/commands → ~/.claude/commands
|
||||
├─ Copy codeagent skill → ~/.claude/skills/codeagent/
|
||||
├─ Copy hooks → ~/.claude/hooks
|
||||
└─ Merge hooks-config.json → ~/.claude/settings.json
|
||||
5. Write installed_modules.json
|
||||
6. Log to install.log
|
||||
```
|
||||
|
||||
## Parallel Execution Engine
|
||||
|
||||
**Algorithm:**
|
||||
|
||||
```
|
||||
1. Parse task config (---TASK--- delimited format)
|
||||
2. Build dependency graph
|
||||
3. Topological sort (detect cycles)
|
||||
4. Execute in layers:
|
||||
Layer 0: Tasks with no dependencies
|
||||
Layer 1: Tasks depending only on Layer 0
|
||||
Layer 2: Tasks depending on Layers 0-1
|
||||
...
|
||||
5. Within each layer: unlimited concurrency
|
||||
6. On failure: skip dependent tasks, continue others
|
||||
7. Aggregate results
|
||||
```
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
Tasks:
|
||||
A (no deps)
|
||||
B (no deps)
|
||||
C (depends on A)
|
||||
D (depends on A, B)
|
||||
E (depends on D)
|
||||
|
||||
Execution:
|
||||
Layer 0: A, B (parallel)
|
||||
Layer 1: C (waits for A), D (waits for A, B)
|
||||
Layer 2: E (waits for D)
|
||||
|
||||
Timeline:
|
||||
t=0: Start A, B
|
||||
t=1: A completes
|
||||
t=2: B completes, start C, D
|
||||
t=3: C completes
|
||||
t=4: D completes, start E
|
||||
t=5: E completes
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
|
||||
1. **No credential storage** - Uses existing CLI auth
|
||||
2. **Sandbox execution** - Tasks run in specified workdir
|
||||
3. **Timeout enforcement** - Prevents runaway processes
|
||||
4. **Signal handling** - Graceful shutdown on Ctrl+C
|
||||
5. **Input validation** - Sanitizes task configs
|
||||
|
||||
## Performance Characteristics
|
||||
|
||||
| Operation | Complexity | Notes |
|
||||
|-----------|------------|-------|
|
||||
| Backend selection | O(1) | Map lookup |
|
||||
| Task parsing | O(n) | Linear scan |
|
||||
| Topological sort | O(V+E) | Kahn's algorithm |
|
||||
| Parallel execution | O(depth) | Depth of dependency graph |
|
||||
| JSON parsing | O(n) | Streaming parser |
|
||||
|
||||
## Extensibility
|
||||
|
||||
### Adding New Backend
|
||||
|
||||
1. Implement `Backend` interface:
|
||||
```go
|
||||
type NewBackend struct{}
|
||||
|
||||
func (NewBackend) Name() string { return "new" }
|
||||
func (NewBackend) Command() string { return "new-cli" }
|
||||
func (NewBackend) BuildArgs(cfg *Config, targetArg string) []string {
|
||||
return []string{"--json", targetArg}
|
||||
}
|
||||
```
|
||||
|
||||
2. Register in `config.go`:
|
||||
```go
|
||||
backendRegistry = map[string]Backend{
|
||||
"codex": CodexBackend{},
|
||||
"claude": ClaudeBackend{},
|
||||
"gemini": GeminiBackend{},
|
||||
"new": NewBackend{},
|
||||
}
|
||||
```
|
||||
|
||||
3. Add JSON format detection in `parser.go`:
|
||||
```go
|
||||
if hasKey(obj, "new_specific_field") {
|
||||
// Parse new backend format
|
||||
}
|
||||
```
|
||||
|
||||
### Adding New Hook
|
||||
|
||||
1. Create script in `hooks/`:
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# hooks/my-custom-hook.sh
|
||||
echo "Hook executed"
|
||||
```
|
||||
|
||||
2. Register in `.claude/settings.json`:
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"UserPromptSubmit": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/hooks/my-custom-hook.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Adding New Skill
|
||||
|
||||
1. Create `skills/my-skill/SKILL.md`:
|
||||
```markdown
|
||||
---
|
||||
name: my-skill
|
||||
description: My custom skill
|
||||
---
|
||||
|
||||
# My Custom Skill
|
||||
|
||||
Usage instructions...
|
||||
```
|
||||
|
||||
2. Add activation rule in `skills/skill-rules.json`:
|
||||
```json
|
||||
{
|
||||
"rules": [
|
||||
{
|
||||
"trigger": {"pattern": "my keyword", "type": "regex"},
|
||||
"skill": "my-skill",
|
||||
"priority": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Further Reading
|
||||
|
||||
- [Codeagent-Wrapper Guide](./CODEAGENT-WRAPPER.md)
|
||||
- [GitHub Workflow Guide](./GITHUB-WORKFLOW.md)
|
||||
- [Hooks Documentation](./HOOKS.md)
|
||||
- [README](../README.md)
|
||||
445
docs/enterprise-workflow-ideas.md
Normal file
445
docs/enterprise-workflow-ideas.md
Normal file
@@ -0,0 +1,445 @@
|
||||
# 企业级 Claude Code 工作流方案
|
||||
|
||||
基于 Anthropic 官方最佳实践、GitHub Copilot 企业级功能、以及 showcase 项目的研究整理。
|
||||
|
||||
## 实施状态
|
||||
- ✅ codeagent-wrapper multi-backend
|
||||
- ✅ /gh-create-issue command
|
||||
- ✅ /gh-implement command
|
||||
- ✅ Hooks + Skills activation
|
||||
|
||||
## 核心工作流矩阵
|
||||
|
||||
| 工作流 | 触发方式 | 核心能力 | 企业应用场景 |
|
||||
|--------|----------|----------|--------------|
|
||||
| `/gh-create-issue` | Command | 多轮对话 → 结构化 Issue | 需求澄清、Bug 报告标准化 |
|
||||
| `/gh-implement` | Command | Issue → 开发 → PR | 自动化开发闭环 |
|
||||
| `/code-review` | Hook (PR) | AI 审查 + 人工确认 | 代码质量把控 |
|
||||
| `/incident-debug` | Command | 日志分析 → 根因定位 | 生产问题排查 |
|
||||
| `/migration` | Command | 批量代码迁移 | 技术债务清理 |
|
||||
| `/security-audit` | Hook/Scheduled | 安全扫描 + 修复建议 | 安全合规 |
|
||||
| `/onboarding` | Command | 代码库问答 | 新人培训 |
|
||||
|
||||
---
|
||||
|
||||
## 1. GitHub Issue 全生命周期工作流
|
||||
|
||||
### 1.1 `/gh-create-issue` - 需求创建
|
||||
|
||||
```
|
||||
用户输入 → 多轮澄清 → 结构化 Issue → gh issue create
|
||||
```
|
||||
|
||||
**流程设计:**
|
||||
```markdown
|
||||
---
|
||||
description: Create structured GitHub issue through multi-round dialogue
|
||||
argument-hint: Brief description of what you need (e.g., "user authentication feature")
|
||||
---
|
||||
|
||||
You are a Requirements Analyst. Help create a well-structured GitHub issue.
|
||||
|
||||
## Phase 1: Initial Understanding
|
||||
Ask 2-3 targeted questions to understand:
|
||||
- What problem does this solve? (Why)
|
||||
- Who benefits from this? (Who)
|
||||
- What's the expected outcome? (What)
|
||||
|
||||
## Phase 2: Technical Scoping
|
||||
Based on answers, clarify:
|
||||
- Acceptance criteria (testable conditions)
|
||||
- Technical constraints
|
||||
- Dependencies on other features/teams
|
||||
- Priority and urgency
|
||||
|
||||
## Phase 3: Issue Generation
|
||||
Generate issue with structure:
|
||||
- **Title**: [Type] Brief description
|
||||
- **Problem Statement**: Why this matters
|
||||
- **Proposed Solution**: High-level approach
|
||||
- **Acceptance Criteria**: Checkbox list
|
||||
- **Technical Notes**: Implementation hints
|
||||
- **Labels**: auto-suggest based on content
|
||||
|
||||
## Phase 4: Confirmation & Creation
|
||||
Show preview → User confirms → `gh issue create`
|
||||
```
|
||||
|
||||
### 1.2 `/gh-implement` - Issue 实现
|
||||
|
||||
```
|
||||
gh issue view → 理解 + 沟通 → /dev 开发 → gh issue comment → gh pr create
|
||||
```
|
||||
|
||||
**流程设计:**
|
||||
```markdown
|
||||
---
|
||||
description: Implement GitHub issue with full development lifecycle
|
||||
argument-hint: Issue number (e.g., "123")
|
||||
---
|
||||
|
||||
## Phase 1: Issue Analysis
|
||||
1. `gh issue view $ARGUMENTS --json title,body,labels,comments`
|
||||
2. Parse requirements and acceptance criteria
|
||||
3. Identify affected files via codebase exploration
|
||||
|
||||
## Phase 2: Clarification (if needed)
|
||||
If ambiguous, use AskUserQuestion to clarify:
|
||||
- Implementation approach choices
|
||||
- Scope boundaries
|
||||
- Testing requirements
|
||||
|
||||
## Phase 3: Development
|
||||
Invoke /dev workflow with parsed requirements:
|
||||
- Codex analysis
|
||||
- Task breakdown
|
||||
- Parallel execution
|
||||
- Coverage validation (≥90%)
|
||||
|
||||
## Phase 4: Progress Updates
|
||||
After each milestone:
|
||||
`gh issue comment $ARGUMENTS --body "✅ Completed: [milestone]"`
|
||||
|
||||
## Phase 5: PR Creation
|
||||
`gh pr create --title "[#$ARGUMENTS] ..." --body "Closes #$ARGUMENTS\n\n..."`
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. 代码审查工作流
|
||||
|
||||
### 2.1 PR 自动审查 Hook
|
||||
|
||||
**触发点:** PR 创建或更新时
|
||||
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Bash(gh pr create:*)",
|
||||
"hooks": [{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/auto-review.sh"
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**审查维度(参考 Anthropic 博客):**
|
||||
- 代码风格一致性
|
||||
- 潜在 bug 和边界条件
|
||||
- 安全漏洞(OWASP Top 10)
|
||||
- 性能影响
|
||||
- 文档完整性
|
||||
- 测试覆盖率
|
||||
|
||||
### 2.2 `/review-pr` Command
|
||||
|
||||
```markdown
|
||||
---
|
||||
description: Comprehensive PR review with actionable feedback
|
||||
argument-hint: PR number or URL
|
||||
---
|
||||
|
||||
1. Fetch PR details: `gh pr view $ARGUMENTS --json files,commits,body`
|
||||
2. Read changed files with context (±50 lines)
|
||||
3. Analyze against:
|
||||
- Repository coding standards (CLAUDE.md)
|
||||
- Security best practices
|
||||
- Performance implications
|
||||
- Test coverage
|
||||
4. Generate review with:
|
||||
- Summary of changes
|
||||
- 🟢 Approved / 🟡 Changes Requested / 🔴 Blocked
|
||||
- Specific line comments
|
||||
- Suggested improvements
|
||||
5. Post review: `gh pr review $ARGUMENTS --body "..." [--approve|--request-changes]`
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. 生产问题排查工作流
|
||||
|
||||
### 3.1 `/incident-debug`
|
||||
|
||||
```markdown
|
||||
---
|
||||
description: Debug production incidents from logs and traces
|
||||
argument-hint: Error message, log file path, or incident ID
|
||||
---
|
||||
|
||||
## Phase 1: Context Gathering
|
||||
- Parse provided logs/error messages
|
||||
- Search codebase for related code paths
|
||||
- Check recent deployments: `gh release list --limit 5`
|
||||
|
||||
## Phase 2: Root Cause Analysis
|
||||
Use Codex for deep analysis:
|
||||
- Stack trace interpretation
|
||||
- Data flow tracing
|
||||
- Dependency chain analysis
|
||||
|
||||
## Phase 3: Solution Proposal
|
||||
- Immediate mitigation steps
|
||||
- Long-term fix plan
|
||||
- Regression test suggestions
|
||||
|
||||
## Phase 4: Documentation
|
||||
Generate incident report:
|
||||
- Timeline
|
||||
- Root cause
|
||||
- Impact assessment
|
||||
- Resolution steps
|
||||
- Prevention measures
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 大规模迁移工作流
|
||||
|
||||
### 4.1 `/migration` - 批量代码迁移
|
||||
|
||||
**适用场景:**
|
||||
- 框架升级(React 17→18, Vue 2→3)
|
||||
- API 版本迁移
|
||||
- 依赖库替换
|
||||
- 代码模式重构
|
||||
|
||||
```markdown
|
||||
---
|
||||
description: Batch code migration with validation
|
||||
argument-hint: Migration type and scope (e.g., "React class to hooks in src/components")
|
||||
---
|
||||
|
||||
## Phase 1: Scope Analysis
|
||||
1. Use Codex to identify all affected files
|
||||
2. Generate migration task list (file by file)
|
||||
3. Estimate complexity per file
|
||||
|
||||
## Phase 2: Parallel Execution (Headless Mode)
|
||||
For each file, run:
|
||||
```bash
|
||||
claude -p "Migrate $FILE from [old] to [new]. Verify with tests." \
|
||||
--allowedTools Edit Bash(npm test:*)
|
||||
```
|
||||
|
||||
## Phase 3: Validation
|
||||
- Run full test suite
|
||||
- Type checking
|
||||
- Lint verification
|
||||
|
||||
## Phase 4: Report
|
||||
- Success/failure per file
|
||||
- Manual review required files
|
||||
- Rollback instructions
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. 安全审计工作流
|
||||
|
||||
### 5.1 `/security-audit`
|
||||
|
||||
```markdown
|
||||
---
|
||||
description: Security vulnerability scanning and remediation
|
||||
---
|
||||
|
||||
## Scan Categories
|
||||
1. **Dependency vulnerabilities**: `npm audit` / `pip-audit`
|
||||
2. **SAST**: Code pattern analysis for OWASP Top 10
|
||||
3. **Secrets detection**: Hardcoded credentials
|
||||
4. **Configuration**: Insecure defaults
|
||||
|
||||
## Output Format
|
||||
- Severity: Critical/High/Medium/Low
|
||||
- Location: File:Line
|
||||
- Description: What's wrong
|
||||
- Remediation: How to fix
|
||||
- Auto-fix available: Yes/No
|
||||
|
||||
## Auto-remediation
|
||||
For auto-fixable issues:
|
||||
1. Generate fix via Codex
|
||||
2. Run tests
|
||||
3. Create PR with security label
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. 新人培训工作流
|
||||
|
||||
### 6.1 Codebase Q&A(Anthropic 推荐)
|
||||
|
||||
直接使用 Claude Code 进行代码库问答,无需特殊配置:
|
||||
|
||||
**常见问题类型:**
|
||||
- "这个项目的架构是什么?"
|
||||
- "如何添加新的 API 端点?"
|
||||
- "日志系统是怎么工作的?"
|
||||
- "这个函数为什么这样设计?"(结合 git history)
|
||||
|
||||
### 6.2 `/onboarding` Command
|
||||
|
||||
```markdown
|
||||
---
|
||||
description: Interactive codebase onboarding for new team members
|
||||
---
|
||||
|
||||
## Phase 1: Overview
|
||||
- Read README, CLAUDE.md, package.json
|
||||
- Summarize tech stack and architecture
|
||||
|
||||
## Phase 2: Key Flows
|
||||
For each major feature:
|
||||
- Entry point
|
||||
- Data flow
|
||||
- Key files
|
||||
|
||||
## Phase 3: Development Setup
|
||||
- Environment setup steps
|
||||
- Common commands
|
||||
- Testing workflow
|
||||
|
||||
## Phase 4: Q&A Mode
|
||||
"Ask me anything about this codebase!"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. codeagent-wrapper 多后端架构
|
||||
|
||||
### 设计方案
|
||||
|
||||
```go
|
||||
// codeagent-wrapper architecture
|
||||
type AgentBackend interface {
|
||||
Name() string
|
||||
Execute(ctx context.Context, task TaskSpec, timeout int) TaskResult
|
||||
HealthCheck() error
|
||||
}
|
||||
|
||||
type CodexBackend struct{} // OpenAI Codex
|
||||
type ClaudeBackend struct{} // Claude CLI (claude -p)
|
||||
type GeminiBackend struct{} // Gemini API
|
||||
|
||||
// 命令行接口
|
||||
// codeagent-wrapper [--backend=codex|claude|gemini] "task" [workdir]
|
||||
// codeagent-wrapper --parallel --backend=claude < tasks.txt
|
||||
```
|
||||
|
||||
### 后端选择策略
|
||||
|
||||
| 任务类型 | 推荐后端 | 原因 |
|
||||
|----------|----------|------|
|
||||
| 代码生成/重构 | Codex | 代码专精 |
|
||||
| 复杂推理/规划 | Claude | 推理能力强 |
|
||||
| 快速原型 | Gemini | 速度快、成本低 |
|
||||
| 并行批量任务 | 混合 | 负载均衡 |
|
||||
|
||||
---
|
||||
|
||||
## 8. Hooks + Skills 协作模式
|
||||
|
||||
### 推荐配置
|
||||
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"UserPromptSubmit": [
|
||||
{
|
||||
"hooks": [{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/skill-activation-prompt.sh"
|
||||
}]
|
||||
}
|
||||
],
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Edit|MultiEdit|Write",
|
||||
"hooks": [{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/post-tool-tracker.sh"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"matcher": "Bash(gh pr create:*)",
|
||||
"hooks": [{
|
||||
"type": "command",
|
||||
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/auto-review-trigger.sh"
|
||||
}]
|
||||
}
|
||||
],
|
||||
"Stop": [
|
||||
{
|
||||
"hooks": [
|
||||
{"type": "command", "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/test-runner.sh"},
|
||||
{"type": "command", "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/coverage-check.sh"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### skill-rules.json 扩展
|
||||
|
||||
```json
|
||||
{
|
||||
"skills": {
|
||||
"gh-workflow": {
|
||||
"type": "domain",
|
||||
"enforcement": "suggest",
|
||||
"priority": "high",
|
||||
"promptTriggers": {
|
||||
"keywords": ["issue", "pr", "pull request", "github", "gh"],
|
||||
"intentPatterns": ["(create|implement|review).*?(issue|pr|pull)"]
|
||||
}
|
||||
},
|
||||
"incident-response": {
|
||||
"type": "domain",
|
||||
"enforcement": "suggest",
|
||||
"priority": "critical",
|
||||
"promptTriggers": {
|
||||
"keywords": ["error", "bug", "incident", "production", "debug", "crash"],
|
||||
"intentPatterns": ["(fix|debug|investigate).*?(error|bug|issue)"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. 实施优先级建议
|
||||
|
||||
### Phase 1: 基础设施(1-2 周)
|
||||
1. ✅ codeagent-wrapper 已完成
|
||||
2. 🔄 codeagent-wrapper 多后端改造
|
||||
3. 🆕 基础 hooks 配置
|
||||
|
||||
### Phase 2: 核心工作流(2-3 周)
|
||||
1. `/gh-create-issue` command
|
||||
2. `/gh-implement` command
|
||||
3. `/code-review` command
|
||||
|
||||
### Phase 3: 高级功能(3-4 周)
|
||||
1. skill-rules.json + activation hook
|
||||
2. `/migration` 批量迁移
|
||||
3. `/security-audit` 安全审计
|
||||
|
||||
### Phase 4: 企业级增强
|
||||
1. 多 Claude 实例协作
|
||||
2. CI/CD 集成(headless mode)
|
||||
3. 监控和分析仪表板
|
||||
|
||||
---
|
||||
|
||||
## 参考资料
|
||||
|
||||
- [Anthropic Claude Code Best Practices](https://www.anthropic.com/engineering/claude-code-best-practices)
|
||||
- [GitHub Copilot Coding Agent](https://docs.github.com/en/copilot/using-github-copilot/using-copilot-coding-agent-to-work-on-tasks)
|
||||
- [claude-code-infrastructure-showcase](https://github.com/hellogithub/claude-code-infrastructure-showcase)
|
||||
Reference in New Issue
Block a user