the-grid-cc 1.7.21 → 1.7.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grid",
3
3
  "description": "Multi-agent orchestration for Claude Code. Master Control coordinates specialized Programs for complex development tasks.",
4
- "version": "1.7.19",
4
+ "version": "1.7.22",
5
5
  "author": {
6
6
  "name": "James Weatherhead & Claude",
7
7
  "url": "https://github.com/JamesWeatherhead/grid"
@@ -0,0 +1,73 @@
1
+ # Example workflow showing Grid Review action usage
2
+ # Copy this to your repository and customize as needed
3
+
4
+ name: Grid Review
5
+
6
+ on:
7
+ pull_request:
8
+ types: [opened, synchronize, reopened]
9
+
10
+ permissions:
11
+ contents: read
12
+ pull-requests: write
13
+ security-events: write # Required for SARIF upload
14
+
15
+ jobs:
16
+ review:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0 # Full history needed for diff
23
+
24
+ - name: Grid Review
25
+ id: review
26
+ uses: ./action
27
+ with:
28
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
29
+ review-type: full
30
+ model-tier: balanced
31
+ output-format: markdown
32
+ fail-on: error
33
+
34
+ - name: Review Summary
35
+ if: always()
36
+ run: |
37
+ echo "============================================"
38
+ echo " GRID REVIEW SUMMARY "
39
+ echo "============================================"
40
+ echo ""
41
+ echo "Status: ${{ steps.review.outputs.status }}"
42
+ echo "Issues Found: ${{ steps.review.outputs.issues-count }}"
43
+ echo "Security Issues: ${{ steps.review.outputs.security-issues }}"
44
+ echo "Report Path: ${{ steps.review.outputs.report-path }}"
45
+ echo ""
46
+ echo "============================================"
47
+
48
+ - name: Upload Review Artifact
49
+ if: always()
50
+ uses: actions/upload-artifact@v4
51
+ with:
52
+ name: grid-review-report
53
+ path: .grid-review/
54
+ retention-days: 30
55
+
56
+ # Optional: Security-focused review job
57
+ security-review:
58
+ runs-on: ubuntu-latest
59
+ if: contains(github.event.pull_request.labels.*.name, 'security')
60
+ steps:
61
+ - name: Checkout
62
+ uses: actions/checkout@v4
63
+ with:
64
+ fetch-depth: 0
65
+
66
+ - name: Security-Focused Grid Review
67
+ uses: ./action
68
+ with:
69
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
70
+ review-type: security
71
+ model-tier: quality
72
+ output-format: sarif
73
+ fail-on: warning
package/README.md CHANGED
@@ -170,6 +170,38 @@ Collaborative. Grid proposes, you approve. More control, more questions.
170
170
 
171
171
  ---
172
172
 
173
+ ## Features
174
+
175
+ ### Prompt Upscaling
176
+
177
+ Every mission passes through the **Upscaler** - a research-backed agent that transforms vague prompts into industry-grade specifications:
178
+
179
+ - **Domain Detection**: Identifies software, science, business, healthcare, finance, legal contexts
180
+ - **Best Practice Research**: Searches for current industry standards using Exa
181
+ - **Constraint Decomposition**: Transforms vague requirements into explicit specifications
182
+ - **Industry Injection**: Auto-adds domain-specific requirements (security for code, HIPAA for healthcare, etc.)
183
+ - **Self-Refine Loop**: Scores and iteratively improves enhancement quality
184
+
185
+ **Example:**
186
+ ```
187
+ Input: "build me a login page"
188
+
189
+ Output: Secure authentication system with:
190
+ - OWASP-compliant input validation
191
+ - Rate limiting (5 attempts/15 min)
192
+ - Argon2 password hashing
193
+ - CSRF protection
194
+ - Accessible (WCAG 2.1 AA)
195
+ - Session security (httpOnly, secure, sameSite)
196
+ ```
197
+
198
+ Mode-aware behavior:
199
+ - **AUTOPILOT**: Silent enhancement, proceeds immediately
200
+ - **GUIDED**: Mostly silent, rare clarification if ambiguous
201
+ - **HANDS ON**: Shows enhanced version for approval before proceeding
202
+
203
+ ---
204
+
173
205
  ## Commands
174
206
 
175
207
  | Command | What It Does |
@@ -295,6 +327,7 @@ Grid uses some themed terminology. Here's the plain-English translation:
295
327
  |-----------|---------------|
296
328
  | Master Control | The orchestrating agent (your main conversation) |
297
329
  | Program | Worker agent (subagent doing a specific task) |
330
+ | Upscaler | Prompt enhancement agent (transforms vague input into detailed specs) |
298
331
  | Recognizer | Quality checker (verifies work meets goals) |
299
332
  | Refinement Swarm | Testing suite (visual, E2E, persona simulation) |
300
333
 
@@ -0,0 +1,223 @@
1
+ # Grid Review GitHub Action
2
+
3
+ AI-powered code review using The Grid and Claude.
4
+
5
+ ## Overview
6
+
7
+ Grid Review brings intelligent code analysis to your CI/CD pipeline. Powered by Claude and The Grid's Recognizer pattern, it automatically reviews pull requests for:
8
+
9
+ - Security vulnerabilities
10
+ - Code quality issues
11
+ - Potential bugs
12
+ - Test coverage gaps
13
+ - Performance concerns
14
+
15
+ ## Quick Start
16
+
17
+ ```yaml
18
+ name: Code Review
19
+
20
+ on:
21
+ pull_request:
22
+ types: [opened, synchronize]
23
+
24
+ jobs:
25
+ review:
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ with:
30
+ fetch-depth: 0
31
+
32
+ - name: Grid Review
33
+ uses: JamesWeatherhead/grid/action@main
34
+ with:
35
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
36
+ ```
37
+
38
+ ## Inputs
39
+
40
+ | Input | Description | Required | Default |
41
+ |-------|-------------|----------|---------|
42
+ | `anthropic-api-key` | Anthropic API key for Claude | **Yes** | - |
43
+ | `review-type` | Review type: `full`, `security`, `quality` | No | `full` |
44
+ | `model-tier` | Model tier: `quality`, `balanced`, `budget` | No | `balanced` |
45
+ | `fail-on` | Fail threshold: `error`, `warning`, `none` | No | `error` |
46
+ | `output-format` | Output: `json`, `markdown`, `sarif` | No | `markdown` |
47
+ | `files` | Files to review (glob pattern) | No | Changed files |
48
+
49
+ ### Review Types
50
+
51
+ - **full**: Comprehensive review covering security, quality, bugs, tests, and performance
52
+ - **security**: Focus exclusively on security vulnerabilities and risks
53
+ - **quality**: Focus on code quality, maintainability, and best practices
54
+
55
+ ### Model Tiers
56
+
57
+ - **quality**: Uses Claude Opus for most thorough analysis (higher cost)
58
+ - **balanced**: Uses Claude Sonnet for good balance of quality and cost
59
+ - **budget**: Uses Claude Haiku for fast, cost-effective reviews
60
+
61
+ ### Fail Thresholds
62
+
63
+ - **error**: Fail only if critical errors are found
64
+ - **warning**: Fail if warnings or errors are found
65
+ - **none**: Never fail the check (informational only)
66
+
67
+ ## Outputs
68
+
69
+ | Output | Description |
70
+ |--------|-------------|
71
+ | `status` | Review status: `pass`, `warn`, `fail` |
72
+ | `issues-count` | Total number of issues found |
73
+ | `security-issues` | Number of security-related issues |
74
+ | `report-path` | Path to the generated report file |
75
+
76
+ ## Examples
77
+
78
+ ### Security-Only Review
79
+
80
+ Focus on security vulnerabilities with stricter thresholds:
81
+
82
+ ```yaml
83
+ - name: Security Review
84
+ uses: JamesWeatherhead/grid/action@main
85
+ with:
86
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
87
+ review-type: security
88
+ fail-on: warning
89
+ ```
90
+
91
+ ### SARIF for GitHub Code Scanning
92
+
93
+ Integrate with GitHub's code scanning feature:
94
+
95
+ ```yaml
96
+ - name: Grid Review (SARIF)
97
+ uses: JamesWeatherhead/grid/action@main
98
+ with:
99
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
100
+ output-format: sarif
101
+ ```
102
+
103
+ Results appear in the Security tab of your repository.
104
+
105
+ ### Budget-Conscious Review
106
+
107
+ For high-volume repositories:
108
+
109
+ ```yaml
110
+ - name: Quick Review
111
+ uses: JamesWeatherhead/grid/action@main
112
+ with:
113
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
114
+ model-tier: budget
115
+ fail-on: error
116
+ ```
117
+
118
+ ### Review Specific Files
119
+
120
+ ```yaml
121
+ - name: Review API Changes
122
+ uses: JamesWeatherhead/grid/action@main
123
+ with:
124
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
125
+ files: 'src/api/**/*.ts'
126
+ ```
127
+
128
+ ### Informational Review (Never Fail)
129
+
130
+ ```yaml
131
+ - name: Informational Review
132
+ uses: JamesWeatherhead/grid/action@main
133
+ with:
134
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
135
+ fail-on: none
136
+ ```
137
+
138
+ ### Use Review Outputs
139
+
140
+ ```yaml
141
+ - name: Grid Review
142
+ id: review
143
+ uses: JamesWeatherhead/grid/action@main
144
+ with:
145
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
146
+ output-format: json
147
+
148
+ - name: Check Results
149
+ run: |
150
+ echo "Review Status: ${{ steps.review.outputs.status }}"
151
+ echo "Issues Found: ${{ steps.review.outputs.issues-count }}"
152
+ echo "Security Issues: ${{ steps.review.outputs.security-issues }}"
153
+
154
+ if [ "${{ steps.review.outputs.security-issues }}" -gt "0" ]; then
155
+ echo "::warning::Security issues detected!"
156
+ fi
157
+ ```
158
+
159
+ ## Setting Up Your Repository
160
+
161
+ 1. **Add your Anthropic API key as a secret:**
162
+ - Go to Settings > Secrets and variables > Actions
163
+ - Click "New repository secret"
164
+ - Name: `ANTHROPIC_API_KEY`
165
+ - Value: Your Anthropic API key
166
+
167
+ 2. **Create the workflow file:**
168
+ - Create `.github/workflows/grid-review.yml`
169
+ - Copy one of the examples above
170
+
171
+ 3. **Open a pull request** to see Grid Review in action!
172
+
173
+ ## How It Works
174
+
175
+ 1. **File Detection**: Identifies changed files in the PR (or uses provided glob pattern)
176
+ 2. **Analysis**: Claude Code analyzes each file using The Grid's Recognizer pattern
177
+ 3. **Report Generation**: Creates structured report in your chosen format
178
+ 4. **PR Comment**: Posts review findings as a PR comment (markdown format)
179
+ 5. **Status Check**: Passes or fails based on your configured threshold
180
+
181
+ ## Cost Considerations
182
+
183
+ Each review makes API calls to Claude. Approximate costs per PR:
184
+
185
+ | Model Tier | Typical Cost | Best For |
186
+ |------------|--------------|----------|
187
+ | budget (Haiku) | $0.01-0.05 | High-volume repos, quick checks |
188
+ | balanced (Sonnet) | $0.05-0.25 | Most repositories |
189
+ | quality (Opus) | $0.25-1.00 | Critical code, security audits |
190
+
191
+ Actual costs depend on PR size and complexity.
192
+
193
+ ## Troubleshooting
194
+
195
+ ### "ANTHROPIC_API_KEY not set"
196
+
197
+ Ensure you've added the secret to your repository settings.
198
+
199
+ ### Review times out
200
+
201
+ Large PRs may need more time. Consider:
202
+ - Using `files` input to limit scope
203
+ - Using `budget` model tier for faster reviews
204
+
205
+ ### No PR comment appears
206
+
207
+ Check that:
208
+ - `output-format` is set to `markdown` (default)
209
+ - The workflow has `pull-requests: write` permission
210
+
211
+ ## License
212
+
213
+ MIT
214
+
215
+ ## Links
216
+
217
+ - [The Grid Repository](https://github.com/JamesWeatherhead/grid)
218
+ - [The Grid on npm](https://www.npmjs.com/package/the-grid-cc)
219
+ - [Claude Code Documentation](https://docs.anthropic.com/claude-code)
220
+
221
+ ---
222
+
223
+ *Powered by The Grid - End of Line.*
@@ -0,0 +1,229 @@
1
+ name: 'Grid Review'
2
+ description: 'AI-powered code review using The Grid'
3
+ author: 'James Weatherhead'
4
+ branding:
5
+ icon: 'grid'
6
+ color: 'blue'
7
+
8
+ inputs:
9
+ anthropic-api-key:
10
+ description: 'Anthropic API key for Claude'
11
+ required: true
12
+ review-type:
13
+ description: 'Type of review: full, security, quality'
14
+ required: false
15
+ default: 'full'
16
+ model-tier:
17
+ description: 'Model tier: quality, balanced, budget'
18
+ required: false
19
+ default: 'balanced'
20
+ fail-on:
21
+ description: 'Fail threshold: error, warning, none'
22
+ required: false
23
+ default: 'error'
24
+ output-format:
25
+ description: 'Output format: json, markdown, sarif'
26
+ required: false
27
+ default: 'markdown'
28
+ files:
29
+ description: 'Files to review (glob pattern)'
30
+ required: false
31
+ default: ''
32
+
33
+ outputs:
34
+ status:
35
+ description: 'Review status: pass, warn, fail'
36
+ issues-count:
37
+ description: 'Number of issues found'
38
+ security-issues:
39
+ description: 'Number of security issues'
40
+ report-path:
41
+ description: 'Path to the generated report'
42
+
43
+ runs:
44
+ using: 'composite'
45
+ steps:
46
+ - name: Setup Node.js
47
+ uses: actions/setup-node@v4
48
+ with:
49
+ node-version: '20'
50
+
51
+ - name: Install Claude Code
52
+ shell: bash
53
+ run: |
54
+ npm install -g @anthropic-ai/claude-code
55
+
56
+ - name: Install The Grid
57
+ shell: bash
58
+ run: |
59
+ npm install -g the-grid-cc
60
+
61
+ - name: Get changed files
62
+ id: changed-files
63
+ shell: bash
64
+ run: |
65
+ if [ -n "${{ inputs.files }}" ]; then
66
+ echo "files=${{ inputs.files }}" >> $GITHUB_OUTPUT
67
+ elif [ "${{ github.event_name }}" == "pull_request" ]; then
68
+ FILES=$(gh pr diff ${{ github.event.pull_request.number }} --name-only | tr '\n' ' ')
69
+ echo "files=$FILES" >> $GITHUB_OUTPUT
70
+ else
71
+ FILES=$(git diff --name-only HEAD~1 | tr '\n' ' ')
72
+ echo "files=$FILES" >> $GITHUB_OUTPUT
73
+ fi
74
+ env:
75
+ GH_TOKEN: ${{ github.token }}
76
+
77
+ - name: Run Grid Review
78
+ id: review
79
+ shell: bash
80
+ run: |
81
+ export ANTHROPIC_API_KEY="${{ inputs.anthropic-api-key }}"
82
+ export GRID_MODEL_TIER="${{ inputs.model-tier }}"
83
+
84
+ # Create output directory
85
+ mkdir -p .grid-review
86
+
87
+ # Build review prompt based on review type
88
+ REVIEW_TYPE="${{ inputs.review-type }}"
89
+ case "$REVIEW_TYPE" in
90
+ security)
91
+ REVIEW_PROMPT="You are a Grid Security Recognizer. Review these files for security vulnerabilities, injection risks, authentication issues, and data exposure. Focus only on security concerns."
92
+ ;;
93
+ quality)
94
+ REVIEW_PROMPT="You are a Grid Quality Recognizer. Review these files for code quality, maintainability, best practices, and potential bugs. Focus on code quality and correctness."
95
+ ;;
96
+ *)
97
+ REVIEW_PROMPT="You are a Grid Recognizer. Perform a comprehensive code review covering: 1) Security vulnerabilities 2) Code quality issues 3) Potential bugs 4) Test coverage gaps 5) Performance concerns"
98
+ ;;
99
+ esac
100
+
101
+ # Run review with Claude Code headless mode
102
+ claude -p "$REVIEW_PROMPT
103
+
104
+ Files to review: ${{ steps.changed-files.outputs.files }}
105
+
106
+ Return your analysis in the following JSON format:
107
+ {
108
+ \"status\": \"pass|warn|fail\",
109
+ \"summary\": \"Brief overall summary\",
110
+ \"issues\": [
111
+ {
112
+ \"severity\": \"error|warning|info\",
113
+ \"category\": \"security|quality|bug|performance|testing\",
114
+ \"file\": \"path/to/file\",
115
+ \"line\": 123,
116
+ \"message\": \"Description of the issue\",
117
+ \"suggestion\": \"How to fix it\"
118
+ }
119
+ ],
120
+ \"stats\": {
121
+ \"files_reviewed\": 0,
122
+ \"errors\": 0,
123
+ \"warnings\": 0,
124
+ \"info\": 0
125
+ }
126
+ }" \
127
+ --allowedTools "Read,Grep,Glob" \
128
+ --output-format json \
129
+ > .grid-review/report.json 2>&1 || true
130
+
131
+ # Convert to requested output format
132
+ OUTPUT_FORMAT="${{ inputs.output-format }}"
133
+
134
+ if [ "$OUTPUT_FORMAT" == "markdown" ]; then
135
+ # Convert JSON to Markdown
136
+ cat .grid-review/report.json | jq -r '
137
+ "## Grid Code Review Results\n\n" +
138
+ "**Status:** " + (.result // . | fromjson? // . | .status // "unknown") + "\n\n" +
139
+ "### Summary\n" + (.result // . | fromjson? // . | .summary // "No summary available") + "\n\n" +
140
+ "### Issues Found\n\n" +
141
+ ((.result // . | fromjson? // . | .issues // []) | map(
142
+ "- **[" + .severity + "]** `" + .file + ":" + (.line | tostring) + "` - " + .message + "\n > " + .suggestion
143
+ ) | join("\n\n")) +
144
+ "\n\n---\n*Powered by The Grid*"
145
+ ' > .grid-review/report.markdown 2>/dev/null || cp .grid-review/report.json .grid-review/report.markdown
146
+ elif [ "$OUTPUT_FORMAT" == "sarif" ]; then
147
+ # Convert JSON to SARIF format for GitHub Code Scanning
148
+ cat .grid-review/report.json | jq '
149
+ {
150
+ "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
151
+ "version": "2.1.0",
152
+ "runs": [{
153
+ "tool": {
154
+ "driver": {
155
+ "name": "Grid Review",
156
+ "version": "1.7.x",
157
+ "informationUri": "https://github.com/JamesWeatherhead/grid",
158
+ "rules": []
159
+ }
160
+ },
161
+ "results": ((.result // . | fromjson? // . | .issues // []) | map({
162
+ "ruleId": .category,
163
+ "level": (if .severity == "error" then "error" elif .severity == "warning" then "warning" else "note" end),
164
+ "message": { "text": .message },
165
+ "locations": [{
166
+ "physicalLocation": {
167
+ "artifactLocation": { "uri": .file },
168
+ "region": { "startLine": .line }
169
+ }
170
+ }]
171
+ }))
172
+ }]
173
+ }
174
+ ' > .grid-review/report.sarif 2>/dev/null || echo '{"version":"2.1.0","runs":[]}' > .grid-review/report.sarif
175
+ fi
176
+
177
+ # Parse results for outputs
178
+ if [ -f ".grid-review/report.json" ]; then
179
+ # Try to parse the JSON result
180
+ PARSED=$(cat .grid-review/report.json | jq -r '.result // .' 2>/dev/null || cat .grid-review/report.json)
181
+ STATUS=$(echo "$PARSED" | jq -r 'if type == "string" then fromjson else . end | .status // "unknown"' 2>/dev/null || echo "unknown")
182
+ ISSUES=$(echo "$PARSED" | jq -r 'if type == "string" then fromjson else . end | .issues | length // 0' 2>/dev/null || echo "0")
183
+ SECURITY=$(echo "$PARSED" | jq -r 'if type == "string" then fromjson else . end | [.issues[] | select(.category == "security")] | length // 0' 2>/dev/null || echo "0")
184
+ else
185
+ STATUS="unknown"
186
+ ISSUES="0"
187
+ SECURITY="0"
188
+ fi
189
+
190
+ echo "status=$STATUS" >> $GITHUB_OUTPUT
191
+ echo "issues-count=$ISSUES" >> $GITHUB_OUTPUT
192
+ echo "security-issues=$SECURITY" >> $GITHUB_OUTPUT
193
+ echo "report-path=.grid-review/report.${{ inputs.output-format }}" >> $GITHUB_OUTPUT
194
+
195
+ - name: Upload SARIF (if applicable)
196
+ if: inputs.output-format == 'sarif'
197
+ uses: github/codeql-action/upload-sarif@v3
198
+ with:
199
+ sarif_file: .grid-review/report.sarif
200
+
201
+ - name: Comment on PR
202
+ if: github.event_name == 'pull_request' && inputs.output-format == 'markdown'
203
+ shell: bash
204
+ run: |
205
+ if [ -f ".grid-review/report.markdown" ]; then
206
+ gh pr comment ${{ github.event.pull_request.number }} \
207
+ --body-file .grid-review/report.markdown
208
+ fi
209
+ env:
210
+ GH_TOKEN: ${{ github.token }}
211
+
212
+ - name: Check fail threshold
213
+ shell: bash
214
+ run: |
215
+ STATUS="${{ steps.review.outputs.status }}"
216
+ FAIL_ON="${{ inputs.fail-on }}"
217
+
218
+ if [ "$FAIL_ON" == "none" ]; then
219
+ echo "Fail threshold set to 'none' - always passing"
220
+ exit 0
221
+ elif [ "$FAIL_ON" == "warning" ] && [ "$STATUS" != "pass" ]; then
222
+ echo "::error::Review found warnings or errors (status: $STATUS)"
223
+ exit 1
224
+ elif [ "$FAIL_ON" == "error" ] && [ "$STATUS" == "fail" ]; then
225
+ echo "::error::Review found errors (status: $STATUS)"
226
+ exit 1
227
+ fi
228
+
229
+ echo "Review completed with status: $STATUS"