sinapse-ai 7.1.0 → 7.3.0

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.
Files changed (70) hide show
  1. package/.sinapse-ai/data/entity-registry.yaml +777 -881
  2. package/.sinapse-ai/data/registry-update-log.jsonl +2 -0
  3. package/.sinapse-ai/development/agents/sinapse-orqx.md +599 -443
  4. package/.sinapse-ai/install-manifest.yaml +6 -6
  5. package/bin/cli.js +116 -75
  6. package/package.json +2 -1
  7. package/packages/installer/src/wizard/i18n.js +2 -2
  8. package/packages/installer/src/wizard/index.js +14 -0
  9. package/packages/installer/src/wizard/questions.js +3 -3
  10. package/sinapse/agents/sinapse-orqx.md +32 -14
  11. package/squads/claude-code-mastery/CHANGELOG.md +22 -0
  12. package/squads/claude-code-mastery/README.md +146 -0
  13. package/squads/claude-code-mastery/agents/claude-mastery-chief.md +554 -0
  14. package/squads/claude-code-mastery/agents/config-engineer.md +865 -0
  15. package/squads/claude-code-mastery/agents/hooks-architect.md +1013 -0
  16. package/squads/claude-code-mastery/agents/mcp-integrator.md +791 -0
  17. package/squads/claude-code-mastery/agents/project-integrator.md +1196 -0
  18. package/squads/claude-code-mastery/agents/roadmap-sentinel.md +931 -0
  19. package/squads/claude-code-mastery/agents/skill-craftsman.md +1250 -0
  20. package/squads/claude-code-mastery/agents/swarm-orqx.md +1008 -0
  21. package/squads/claude-code-mastery/checklists/agent-team-readiness-checklist.md +88 -0
  22. package/squads/claude-code-mastery/checklists/brownfield-readiness-checklist.md +91 -0
  23. package/squads/claude-code-mastery/checklists/change-checklist.md +75 -0
  24. package/squads/claude-code-mastery/checklists/context-rot-checklist.md +114 -0
  25. package/squads/claude-code-mastery/checklists/integration-audit-checklist.md +104 -0
  26. package/squads/claude-code-mastery/checklists/multi-agent-review-checklist.md +77 -0
  27. package/squads/claude-code-mastery/checklists/pre-push-checklist.md +79 -0
  28. package/squads/claude-code-mastery/data/ci-cd-patterns.yaml +412 -0
  29. package/squads/claude-code-mastery/data/claude-code-quick-ref.yaml +314 -0
  30. package/squads/claude-code-mastery/data/hook-patterns.yaml +512 -0
  31. package/squads/claude-code-mastery/data/mcp-integration-catalog.yaml +323 -0
  32. package/squads/claude-code-mastery/data/project-type-signatures.yaml +335 -0
  33. package/squads/claude-code-mastery/scripts/validate-setup.js +163 -0
  34. package/squads/claude-code-mastery/squad.yaml +205 -0
  35. package/squads/claude-code-mastery/tasks/audit-integration.md +219 -0
  36. package/squads/claude-code-mastery/tasks/audit-settings.md +206 -0
  37. package/squads/claude-code-mastery/tasks/audit-setup.md +225 -0
  38. package/squads/claude-code-mastery/tasks/brownfield-setup.md +322 -0
  39. package/squads/claude-code-mastery/tasks/ci-cd-setup.md +335 -0
  40. package/squads/claude-code-mastery/tasks/claude-md-engineer.md +334 -0
  41. package/squads/claude-code-mastery/tasks/configure-claude-code.md +215 -0
  42. package/squads/claude-code-mastery/tasks/context-rot-audit.md +329 -0
  43. package/squads/claude-code-mastery/tasks/create-agent-definition.md +278 -0
  44. package/squads/claude-code-mastery/tasks/create-rules.md +206 -0
  45. package/squads/claude-code-mastery/tasks/create-team-topology.md +258 -0
  46. package/squads/claude-code-mastery/tasks/diagnose.md +166 -0
  47. package/squads/claude-code-mastery/tasks/enterprise-config.md +346 -0
  48. package/squads/claude-code-mastery/tasks/hook-designer.md +272 -0
  49. package/squads/claude-code-mastery/tasks/integrate-project.md +304 -0
  50. package/squads/claude-code-mastery/tasks/mcp-integration-plan.md +229 -0
  51. package/squads/claude-code-mastery/tasks/mcp-workflow.md +285 -0
  52. package/squads/claude-code-mastery/tasks/multi-project-setup.md +228 -0
  53. package/squads/claude-code-mastery/tasks/optimize-context.md +217 -0
  54. package/squads/claude-code-mastery/tasks/optimize-workflow.md +226 -0
  55. package/squads/claude-code-mastery/tasks/parallel-decomposition.md +293 -0
  56. package/squads/claude-code-mastery/tasks/permission-strategy.md +266 -0
  57. package/squads/claude-code-mastery/tasks/sandbox-setup.md +279 -0
  58. package/squads/claude-code-mastery/tasks/setup-repository.md +230 -0
  59. package/squads/claude-code-mastery/tasks/setup-wizard.md +236 -0
  60. package/squads/claude-code-mastery/tasks/worktree-strategy.md +320 -0
  61. package/squads/claude-code-mastery/templates/claude-md-fullstack.md +147 -0
  62. package/squads/claude-code-mastery/templates/claude-md-library.md +175 -0
  63. package/squads/claude-code-mastery/templates/claude-md-microservices.md +186 -0
  64. package/squads/claude-code-mastery/templates/claude-md-mobile.md +198 -0
  65. package/squads/claude-code-mastery/templates/claude-md-monorepo.md +139 -0
  66. package/squads/claude-code-mastery/templates/github-actions-claude-ci.yml +348 -0
  67. package/squads/claude-code-mastery/templates/github-actions-claude-review.yml +179 -0
  68. package/squads/claude-code-mastery/workflows/wf-audit-complete.yaml +140 -0
  69. package/squads/claude-code-mastery/workflows/wf-knowledge-update.yaml +165 -0
  70. package/squads/claude-code-mastery/workflows/wf-project-setup.yaml +192 -0
@@ -0,0 +1,348 @@
1
+ # GitHub Actions Workflow — CI with Claude Code
2
+ # Squad: claude-code-mastery
3
+ # Template: Drop into .github/workflows/ and configure secrets
4
+ #
5
+ # Prerequisites:
6
+ # 1. Store ANTHROPIC_API_KEY in GitHub repository secrets
7
+ # 2. Standard CI tools (Node.js, npm) available
8
+ #
9
+ # Features:
10
+ # - Standard CI checks (lint, typecheck, test)
11
+ # - Claude Code quality analysis on changed files
12
+ # - Test coverage gap detection
13
+ # - Auto-generate missing tests (optional, manual trigger)
14
+
15
+ name: CI with Claude Code
16
+
17
+ on:
18
+ push:
19
+ branches: [main, develop]
20
+ pull_request:
21
+ branches: [main, develop]
22
+ workflow_dispatch:
23
+ inputs:
24
+ generate_tests:
25
+ description: 'Auto-generate missing tests'
26
+ required: false
27
+ type: boolean
28
+ default: false
29
+ quality_check:
30
+ description: 'Run Claude quality analysis'
31
+ required: false
32
+ type: boolean
33
+ default: true
34
+
35
+ permissions:
36
+ contents: write
37
+ pull-requests: write
38
+ checks: write
39
+
40
+ jobs:
41
+ # -----------------------------------------------------------------------
42
+ # Job 1: Standard CI checks (always runs)
43
+ # -----------------------------------------------------------------------
44
+ standard-ci:
45
+ name: Lint, Typecheck, Test
46
+ runs-on: ubuntu-latest
47
+ timeout-minutes: 15
48
+
49
+ steps:
50
+ - name: Checkout
51
+ uses: actions/checkout@v4
52
+
53
+ - name: Setup Node.js
54
+ uses: actions/setup-node@v4
55
+ with:
56
+ node-version: '20'
57
+ cache: 'npm'
58
+
59
+ - name: Install Dependencies
60
+ run: npm ci
61
+
62
+ - name: Lint
63
+ run: npm run lint
64
+
65
+ - name: Type Check
66
+ run: npm run typecheck
67
+
68
+ - name: Test
69
+ run: npm test -- --coverage --ci
70
+ env:
71
+ CI: true
72
+
73
+ - name: Upload Coverage
74
+ if: always()
75
+ uses: actions/upload-artifact@v4
76
+ with:
77
+ name: coverage-report
78
+ path: coverage/
79
+ retention-days: 7
80
+
81
+ # -----------------------------------------------------------------------
82
+ # Job 2: Claude Code quality analysis (on PRs and manual trigger)
83
+ # -----------------------------------------------------------------------
84
+ claude-quality:
85
+ name: Claude Quality Analysis
86
+ needs: standard-ci
87
+ if: |
88
+ github.event_name == 'pull_request' ||
89
+ (github.event_name == 'workflow_dispatch' && github.event.inputs.quality_check == 'true')
90
+ runs-on: ubuntu-latest
91
+ timeout-minutes: 20
92
+
93
+ steps:
94
+ - name: Checkout
95
+ uses: actions/checkout@v4
96
+ with:
97
+ fetch-depth: 0
98
+
99
+ - name: Setup Node.js
100
+ uses: actions/setup-node@v4
101
+ with:
102
+ node-version: '20'
103
+
104
+ - name: Install Claude Code
105
+ run: npm install -g @anthropic-ai/claude-code
106
+
107
+ - name: Identify Changed Source Files
108
+ id: changed-files
109
+ run: |
110
+ if [ "${{ github.event_name }}" = "pull_request" ]; then
111
+ BASE="${{ github.base_ref }}"
112
+ else
113
+ BASE="HEAD~1"
114
+ fi
115
+
116
+ # Get changed source files (exclude tests, configs, docs)
117
+ FILES=$(git diff --name-only origin/$BASE...HEAD 2>/dev/null || git diff --name-only $BASE...HEAD \
118
+ | grep -E '\.(ts|tsx|js|jsx|py|rs|go)$' \
119
+ | grep -v -E '\.(test|spec|stories)\.' \
120
+ | grep -v -E '(node_modules|dist|build|\.next)/' \
121
+ | head -10)
122
+
123
+ echo "files<<EOF" >> $GITHUB_OUTPUT
124
+ echo "$FILES" >> $GITHUB_OUTPUT
125
+ echo "EOF" >> $GITHUB_OUTPUT
126
+
127
+ FILE_COUNT=$(echo "$FILES" | grep -c . || echo "0")
128
+ echo "count=$FILE_COUNT" >> $GITHUB_OUTPUT
129
+
130
+ - name: Run Quality Analysis
131
+ if: steps.changed-files.outputs.count > 0
132
+ env:
133
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
134
+ run: |
135
+ # Build file contents for analysis (limit to 30KB total)
136
+ FILE_CONTENTS=""
137
+ TOTAL_SIZE=0
138
+ MAX_SIZE=30000
139
+
140
+ for FILE in ${{ steps.changed-files.outputs.files }}; do
141
+ if [ -f "$FILE" ]; then
142
+ FILE_SIZE=$(wc -c < "$FILE")
143
+ NEW_TOTAL=$((TOTAL_SIZE + FILE_SIZE))
144
+ if [ $NEW_TOTAL -lt $MAX_SIZE ]; then
145
+ FILE_CONTENTS="$FILE_CONTENTS
146
+ --- FILE: $FILE ---
147
+ $(cat "$FILE")
148
+ --- END FILE ---
149
+ "
150
+ TOTAL_SIZE=$NEW_TOTAL
151
+ fi
152
+ fi
153
+ done
154
+
155
+ PROMPT="Analyze these source files for code quality. For each file, check:
156
+ 1. Code complexity (functions over 30 lines, deep nesting)
157
+ 2. Missing error handling
158
+ 3. Potential null/undefined issues
159
+ 4. Performance concerns (N+1 queries, unnecessary re-renders)
160
+ 5. Security issues (injection, XSS, exposed secrets)
161
+ 6. Missing input validation
162
+
163
+ Output JSON:
164
+ {
165
+ \"score\": 1-10,
166
+ \"files\": [
167
+ {
168
+ \"file\": \"path\",
169
+ \"issues\": [
170
+ {\"severity\": \"high|medium|low\", \"line\": N, \"issue\": \"description\", \"fix\": \"suggestion\"}
171
+ ]
172
+ }
173
+ ],
174
+ \"summary\": \"overall assessment\"
175
+ }
176
+
177
+ Files:
178
+ $FILE_CONTENTS"
179
+
180
+ claude -p \
181
+ --output-format text \
182
+ --max-turns 3 \
183
+ "$PROMPT" > /tmp/quality-results.txt 2>/dev/null || true
184
+
185
+ - name: Post Quality Results
186
+ if: steps.changed-files.outputs.count > 0 && github.event_name == 'pull_request'
187
+ uses: actions/github-script@v7
188
+ with:
189
+ script: |
190
+ const fs = require('fs');
191
+ let results = '';
192
+ try {
193
+ results = fs.readFileSync('/tmp/quality-results.txt', 'utf8');
194
+ } catch {
195
+ results = 'Quality analysis could not be completed.';
196
+ }
197
+
198
+ const { data: comments } = await github.rest.issues.listComments({
199
+ owner: context.repo.owner,
200
+ repo: context.repo.repo,
201
+ issue_number: context.issue.number,
202
+ });
203
+
204
+ const existing = comments.find(c =>
205
+ c.body.includes('<!-- claude-quality-analysis -->')
206
+ );
207
+
208
+ const body = `<!-- claude-quality-analysis -->
209
+ ## Code Quality Analysis
210
+
211
+ ${results}
212
+
213
+ ---
214
+ *Analysis by Claude Code CI*`;
215
+
216
+ if (existing) {
217
+ await github.rest.issues.updateComment({
218
+ owner: context.repo.owner,
219
+ repo: context.repo.repo,
220
+ comment_id: existing.id,
221
+ body: body,
222
+ });
223
+ } else {
224
+ await github.rest.issues.createComment({
225
+ owner: context.repo.owner,
226
+ repo: context.repo.repo,
227
+ issue_number: context.issue.number,
228
+ body: body,
229
+ });
230
+ }
231
+
232
+ # -----------------------------------------------------------------------
233
+ # Job 3: Auto-generate missing tests (manual trigger only)
234
+ # -----------------------------------------------------------------------
235
+ generate-tests:
236
+ name: Generate Missing Tests
237
+ needs: standard-ci
238
+ if: |
239
+ github.event_name == 'workflow_dispatch' &&
240
+ github.event.inputs.generate_tests == 'true'
241
+ runs-on: ubuntu-latest
242
+ timeout-minutes: 30
243
+
244
+ steps:
245
+ - name: Checkout
246
+ uses: actions/checkout@v4
247
+ with:
248
+ fetch-depth: 0
249
+
250
+ - name: Setup Node.js
251
+ uses: actions/setup-node@v4
252
+ with:
253
+ node-version: '20'
254
+ cache: 'npm'
255
+
256
+ - name: Install Dependencies
257
+ run: |
258
+ npm ci
259
+ npm install -g @anthropic-ai/claude-code
260
+
261
+ - name: Find Files Without Tests
262
+ id: untested
263
+ run: |
264
+ # Find source files that lack corresponding test files
265
+ UNTESTED=""
266
+ for FILE in $(find src -name '*.ts' -o -name '*.tsx' | grep -v -E '\.(test|spec|stories|d)\.' | grep -v __tests__ | head -5); do
267
+ TEST_FILE="${FILE%.ts}.test.ts"
268
+ TEST_FILE2="${FILE%.tsx}.test.tsx"
269
+ DIR_TEST="$(dirname "$FILE")/__tests__/$(basename "${FILE%.ts}").test.ts"
270
+ if [ ! -f "$TEST_FILE" ] && [ ! -f "$TEST_FILE2" ] && [ ! -f "$DIR_TEST" ]; then
271
+ UNTESTED="$UNTESTED $FILE"
272
+ fi
273
+ done
274
+
275
+ echo "files=$UNTESTED" >> $GITHUB_OUTPUT
276
+ echo "Found untested files: $UNTESTED"
277
+
278
+ - name: Generate Tests
279
+ if: steps.untested.outputs.files != ''
280
+ env:
281
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
282
+ run: |
283
+ for FILE in ${{ steps.untested.outputs.files }}; do
284
+ echo "Generating tests for: $FILE"
285
+
286
+ claude -p \
287
+ --output-format text \
288
+ --max-turns 5 \
289
+ --dangerously-skip-permissions \
290
+ "Generate comprehensive unit tests for the file '$FILE'. Requirements:
291
+ - Use Jest and React Testing Library (if React component)
292
+ - Test all exported functions/components
293
+ - Include edge cases and error scenarios
294
+ - Follow existing test patterns in this project
295
+ - Write the test file to the co-located path (same directory, .test.ts extension)
296
+ - Do NOT modify the source file
297
+ Read the source file first, then write the test file." || true
298
+ done
299
+
300
+ - name: Verify Generated Tests
301
+ run: |
302
+ # Run only newly generated test files
303
+ NEW_TESTS=$(git diff --name-only | grep -E '\.(test|spec)\.' || echo "")
304
+ if [ -n "$NEW_TESTS" ]; then
305
+ echo "Running generated tests: $NEW_TESTS"
306
+ npx jest $NEW_TESTS --passWithNoTests || true
307
+ else
308
+ echo "No new test files generated"
309
+ fi
310
+
311
+ - name: Create PR with Tests
312
+ run: |
313
+ if git diff --quiet; then
314
+ echo "No test files generated"
315
+ exit 0
316
+ fi
317
+
318
+ git config user.name "claude-code[bot]"
319
+ git config user.email "claude-code[bot]@users.noreply.github.com"
320
+
321
+ BRANCH="test/auto-generate-$(date +%Y%m%d-%H%M%S)"
322
+ git checkout -b "$BRANCH"
323
+ git add '*.test.ts' '*.test.tsx'
324
+ git commit -m "test: auto-generate unit tests for untested files
325
+
326
+ Generated by Claude Code CI pipeline.
327
+
328
+ Co-Authored-By: Claude Code <noreply@anthropic.com>"
329
+
330
+ git push origin "$BRANCH"
331
+
332
+ gh pr create \
333
+ --title "test: auto-generated unit tests" \
334
+ --body "## Auto-Generated Tests
335
+
336
+ These tests were automatically generated by Claude Code for files lacking test coverage.
337
+
338
+ **Action Required:** Review generated tests before merging. Auto-generated tests may need adjustments.
339
+
340
+ ### Files Tested
341
+ $(echo '${{ steps.untested.outputs.files }}' | tr ' ' '\n' | sed 's/^/- /')
342
+
343
+ ---
344
+ *Generated by Claude Code CI*" \
345
+ --base "${{ github.ref_name }}" \
346
+ --head "$BRANCH"
347
+ env:
348
+ GH_TOKEN: ${{ github.token }}
@@ -0,0 +1,179 @@
1
+ # GitHub Actions Workflow — Automated PR Review with Claude Code
2
+ # Squad: claude-code-mastery
3
+ # Template: Drop into .github/workflows/ and configure secrets
4
+ #
5
+ # Prerequisites:
6
+ # 1. Store ANTHROPIC_API_KEY in GitHub repository secrets
7
+ # 2. Enable "Allow GitHub Actions to create and approve pull requests" in repo settings
8
+ #
9
+ # Usage:
10
+ # Automatically triggered on PR open/update. Posts a review comment with findings.
11
+
12
+ name: Claude Code PR Review
13
+
14
+ on:
15
+ pull_request:
16
+ types: [opened, synchronize, ready_for_review]
17
+ # Optionally limit to specific paths:
18
+ # paths:
19
+ # - 'src/**'
20
+ # - 'packages/**'
21
+
22
+ # Required permissions for posting PR comments
23
+ permissions:
24
+ contents: read
25
+ pull-requests: write
26
+
27
+ # Prevent concurrent reviews on the same PR
28
+ concurrency:
29
+ group: claude-review-${{ github.event.pull_request.number }}
30
+ cancel-in-progress: true
31
+
32
+ jobs:
33
+ review:
34
+ name: Claude Code Review
35
+ # Skip draft PRs and bot-authored PRs
36
+ if: |
37
+ !github.event.pull_request.draft &&
38
+ github.event.pull_request.user.login != 'dependabot[bot]' &&
39
+ github.event.pull_request.user.login != 'claude-code[bot]'
40
+ runs-on: ubuntu-latest
41
+ timeout-minutes: 15
42
+
43
+ steps:
44
+ - name: Checkout Repository
45
+ uses: actions/checkout@v4
46
+ with:
47
+ fetch-depth: 0
48
+
49
+ - name: Setup Node.js
50
+ uses: actions/setup-node@v4
51
+ with:
52
+ node-version: '20'
53
+
54
+ - name: Install Claude Code
55
+ run: npm install -g @anthropic-ai/claude-code
56
+
57
+ - name: Get PR Context
58
+ id: pr-context
59
+ run: |
60
+ # Get the diff between base and head
61
+ git diff origin/${{ github.base_ref }}...HEAD > /tmp/pr-diff.txt
62
+ DIFF_SIZE=$(wc -c < /tmp/pr-diff.txt)
63
+ FILES_CHANGED=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | wc -l)
64
+ echo "diff_size=$DIFF_SIZE" >> $GITHUB_OUTPUT
65
+ echo "files_changed=$FILES_CHANGED" >> $GITHUB_OUTPUT
66
+
67
+ # Get the file list for context
68
+ git diff --name-only origin/${{ github.base_ref }}...HEAD > /tmp/files-changed.txt
69
+
70
+ - name: Skip Large PRs
71
+ if: steps.pr-context.outputs.diff_size > 200000
72
+ run: |
73
+ echo "PR diff is too large (${{ steps.pr-context.outputs.diff_size }} bytes). Skipping automated review."
74
+ echo "Consider breaking this PR into smaller changes."
75
+ exit 0
76
+
77
+ - name: Run Claude Review
78
+ id: review
79
+ env:
80
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
81
+ run: |
82
+ # Truncate diff to avoid token limits (50KB)
83
+ head -c 50000 /tmp/pr-diff.txt > /tmp/pr-diff-truncated.txt
84
+
85
+ PROMPT="You are a senior code reviewer. Review this pull request diff and provide actionable feedback.
86
+
87
+ PR Title: ${{ github.event.pull_request.title }}
88
+ PR Description: ${{ github.event.pull_request.body }}
89
+ Files Changed: ${{ steps.pr-context.outputs.files_changed }}
90
+ Changed Files: $(cat /tmp/files-changed.txt)
91
+
92
+ Focus on:
93
+ 1. Bugs and logic errors
94
+ 2. Security vulnerabilities
95
+ 3. Performance issues
96
+ 4. Code quality and maintainability
97
+ 5. Missing error handling
98
+ 6. Test coverage gaps
99
+
100
+ Format your response as:
101
+ ## Summary
102
+ [1-2 sentence summary]
103
+
104
+ ## Findings
105
+ For each finding:
106
+ - **[SEVERITY]** File: description
107
+ Suggestion: how to fix
108
+
109
+ Severity levels: CRITICAL, HIGH, MEDIUM, LOW, INFO
110
+
111
+ ## Verdict
112
+ APPROVE / REQUEST_CHANGES / COMMENT
113
+
114
+ Diff:
115
+ $(cat /tmp/pr-diff-truncated.txt)"
116
+
117
+ claude -p \
118
+ --output-format text \
119
+ --max-turns 3 \
120
+ "$PROMPT" > /tmp/review-output.txt 2>/tmp/review-error.txt || true
121
+
122
+ # Check if review was generated
123
+ if [ -s /tmp/review-output.txt ]; then
124
+ echo "review_success=true" >> $GITHUB_OUTPUT
125
+ else
126
+ echo "review_success=false" >> $GITHUB_OUTPUT
127
+ echo "Review generation failed. Error output:"
128
+ cat /tmp/review-error.txt
129
+ fi
130
+
131
+ - name: Post Review Comment
132
+ if: steps.review.outputs.review_success == 'true'
133
+ uses: actions/github-script@v7
134
+ with:
135
+ script: |
136
+ const fs = require('fs');
137
+ const review = fs.readFileSync('/tmp/review-output.txt', 'utf8');
138
+
139
+ // Check for existing Claude review comment and update it
140
+ const { data: comments } = await github.rest.issues.listComments({
141
+ owner: context.repo.owner,
142
+ repo: context.repo.repo,
143
+ issue_number: context.issue.number,
144
+ });
145
+
146
+ const existingComment = comments.find(c =>
147
+ c.body.includes('<!-- claude-code-review -->')
148
+ );
149
+
150
+ const body = `<!-- claude-code-review -->
151
+ ## Claude Code Review
152
+
153
+ ${review}
154
+
155
+ ---
156
+ *Automated review by [Claude Code](https://claude.ai/code) | Commit: \`${context.sha.substring(0, 7)}\` | Files: ${process.env.FILES_CHANGED}*`;
157
+
158
+ if (existingComment) {
159
+ await github.rest.issues.updateComment({
160
+ owner: context.repo.owner,
161
+ repo: context.repo.repo,
162
+ comment_id: existingComment.id,
163
+ body: body,
164
+ });
165
+ } else {
166
+ await github.rest.issues.createComment({
167
+ owner: context.repo.owner,
168
+ repo: context.repo.repo,
169
+ issue_number: context.issue.number,
170
+ body: body,
171
+ });
172
+ }
173
+ env:
174
+ FILES_CHANGED: ${{ steps.pr-context.outputs.files_changed }}
175
+
176
+ - name: Review Failed
177
+ if: steps.review.outputs.review_success == 'false'
178
+ run: |
179
+ echo "::warning::Claude Code review could not be generated. This is non-blocking."
@@ -0,0 +1,140 @@
1
+ # ============================================================================
2
+ # Workflow: Complete Audit
3
+ # Squad: claude-code-mastery
4
+ # Version: 1.0.0
5
+ # Purpose: Full audit of Claude Code setup using all specialist agents
6
+ # ============================================================================
7
+
8
+ workflow:
9
+ id: wf-audit-complete
10
+ name: "Complete Claude Code Audit"
11
+ version: "1.0.0"
12
+ description: |
13
+ Comprehensive audit that leverages all specialist agents to evaluate
14
+ every aspect of a Claude Code setup. Produces a detailed report with
15
+ scores per domain and actionable recommendations.
16
+
17
+ trigger: "*full-audit"
18
+ entry_agent: claude-mastery-chief
19
+ estimated_duration: "20-40 minutes"
20
+
21
+ # ────────────────────────────────────────────────────────────────────────────
22
+ # PHASES
23
+ # ────────────────────────────────────────────────────────────────────────────
24
+
25
+ phases:
26
+
27
+ # ─── PHASE 0: Baseline Scan ──────────────────────────────────────────────
28
+ - id: phase_0
29
+ name: "Baseline Scan"
30
+ agent: claude-mastery-chief
31
+ task: audit-setup.md
32
+ description: "Quick audit to establish baseline score and identify areas needing deep review."
33
+ outputs:
34
+ - baseline_score: "number (0-100)"
35
+ - areas_needing_review: "array of domain names"
36
+ checkpoint:
37
+ gate: "Baseline scan completed with score > 0"
38
+ veto: "If .claude/ directory does not exist, abort — no Claude Code setup to audit"
39
+
40
+ # ─── PHASE 1: Parallel Domain Audits ─────────────────────────────────────
41
+ - id: phase_1
42
+ name: "Domain-Specific Audits"
43
+ depends_on: [phase_0]
44
+ parallel: true
45
+ description: "Run domain audits in parallel for efficiency."
46
+ sub_phases:
47
+
48
+ - id: phase_1a
49
+ name: "Configuration Audit"
50
+ agent: config-engineer
51
+ task: audit-settings.md
52
+ description: "Audit settings hierarchy, permissions, deny rules."
53
+ outputs:
54
+ - config_score: "number (0-100)"
55
+ - config_issues: "array"
56
+ checkpoint:
57
+ gate: "Settings files parsed without errors"
58
+ veto: "If settings.json has syntax errors, fix before continuing"
59
+
60
+ - id: phase_1b
61
+ name: "Context Rot Audit"
62
+ agent: project-integrator
63
+ task: context-rot-audit.md
64
+ description: "Check CLAUDE.md and rules for staleness and bloat."
65
+ outputs:
66
+ - rot_score: "number (0-100, lower = more rot)"
67
+ - stale_entries: "array"
68
+ checkpoint:
69
+ gate: "CLAUDE.md and rules files accessible"
70
+ veto: "If rot_score < 20, flag as CRITICAL before continuing"
71
+
72
+ - id: phase_1c
73
+ name: "MCP Audit"
74
+ agent: mcp-integrator
75
+ task: mcp-workflow.md
76
+ description: "Verify MCP servers are configured, responsive, and within context budget."
77
+ outputs:
78
+ - mcp_score: "number (0-100)"
79
+ - context_budget_usage: "number (tokens)"
80
+ checkpoint:
81
+ gate: "MCP configuration readable"
82
+ veto: "If context_budget > 15K tokens, flag as WARNING"
83
+
84
+ # ─── PHASE 2: Synthesis ─────────────────────────────────────────────────
85
+ - id: phase_2
86
+ name: "Audit Synthesis"
87
+ agent: claude-mastery-chief
88
+ depends_on: [phase_1]
89
+ description: "Synthesize all domain audits into a comprehensive report."
90
+ steps:
91
+ - "Aggregate scores from all domain audits"
92
+ - "Calculate weighted overall score"
93
+ - "Rank issues by severity and impact"
94
+ - "Generate prioritized recommendation list"
95
+ - "Produce executive summary"
96
+ outputs:
97
+ - overall_score: "number (0-100)"
98
+ - grade: "string (A-F)"
99
+ - top_recommendations: "array (max 5)"
100
+ - full_report: "markdown"
101
+ checkpoint:
102
+ gate: "All domain scores aggregated and report generated"
103
+ veto: "If any domain score is 0 (audit failed to run), re-run that domain"
104
+
105
+ # ────────────────────────────────────────────────────────────────────────────
106
+ # VETO CONDITIONS (workflow-level)
107
+ # ────────────────────────────────────────────────────────────────────────────
108
+
109
+ veto_conditions:
110
+ - "No .claude/ directory — nothing to audit"
111
+ - "settings.json with syntax errors — fix first"
112
+ - "Critical security issue found — address before generating report"
113
+
114
+ # ────────────────────────────────────────────────────────────────────────────
115
+ # SCORING WEIGHTS
116
+ # ────────────────────────────────────────────────────────────────────────────
117
+
118
+ scoring:
119
+ weights:
120
+ configuration: 0.30
121
+ context_health: 0.25
122
+ mcp_integration: 0.20
123
+ baseline: 0.25
124
+
125
+ grade_thresholds:
126
+ A: 90
127
+ B: 80
128
+ C: 70
129
+ D: 60
130
+ F: 0
131
+
132
+ # ────────────────────────────────────────────────────────────────────────────
133
+ # COMPLETION CRITERIA
134
+ # ────────────────────────────────────────────────────────────────────────────
135
+
136
+ completion_criteria:
137
+ - "All domain audits completed"
138
+ - "Overall score calculated"
139
+ - "Top 5 recommendations generated"
140
+ - "Full report produced"