sinapse-ai 7.0.5 → 7.2.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.
- package/.sinapse-ai/core-config.yaml +2 -26
- package/.sinapse-ai/data/entity-registry.yaml +742 -917
- package/.sinapse-ai/data/registry-update-log.jsonl +22 -0
- package/.sinapse-ai/infrastructure/scripts/ide-sync/index.js +1 -49
- package/.sinapse-ai/infrastructure/scripts/validate-parity.js +0 -7
- package/.sinapse-ai/install-manifest.yaml +11 -43
- package/README.en.md +6 -11
- package/README.md +6 -11
- package/bin/cli.js +116 -75
- package/bin/modules/env-config.js +1 -2
- package/bin/sinapse-init.js +23 -188
- package/docs/ide-integration.md +22 -263
- package/docs/installation/README.md +4 -6
- package/docs/installation/faq.md +10 -33
- package/docs/installation/linux.md +0 -23
- package/docs/installation/macos.md +0 -10
- package/docs/installation/troubleshooting.md +5 -9
- package/docs/installation/v4-quick-start.md +1 -1
- package/docs/installation/windows.md +0 -18
- package/package.json +2 -9
- package/packages/installer/src/config/ide-configs.js +3 -49
- package/squads/claude-code-mastery/CHANGELOG.md +22 -0
- package/squads/claude-code-mastery/README.md +146 -0
- package/squads/claude-code-mastery/agents/claude-mastery-chief.md +554 -0
- package/squads/claude-code-mastery/agents/config-engineer.md +865 -0
- package/squads/claude-code-mastery/agents/hooks-architect.md +1013 -0
- package/squads/claude-code-mastery/agents/mcp-integrator.md +791 -0
- package/squads/claude-code-mastery/agents/project-integrator.md +1196 -0
- package/squads/claude-code-mastery/agents/roadmap-sentinel.md +931 -0
- package/squads/claude-code-mastery/agents/skill-craftsman.md +1250 -0
- package/squads/claude-code-mastery/agents/swarm-orqx.md +1008 -0
- package/squads/claude-code-mastery/checklists/agent-team-readiness-checklist.md +88 -0
- package/squads/claude-code-mastery/checklists/brownfield-readiness-checklist.md +91 -0
- package/squads/claude-code-mastery/checklists/change-checklist.md +75 -0
- package/squads/claude-code-mastery/checklists/context-rot-checklist.md +114 -0
- package/squads/claude-code-mastery/checklists/integration-audit-checklist.md +104 -0
- package/squads/claude-code-mastery/checklists/multi-agent-review-checklist.md +77 -0
- package/squads/claude-code-mastery/checklists/pre-push-checklist.md +79 -0
- package/squads/claude-code-mastery/data/ci-cd-patterns.yaml +412 -0
- package/squads/claude-code-mastery/data/claude-code-quick-ref.yaml +314 -0
- package/squads/claude-code-mastery/data/hook-patterns.yaml +512 -0
- package/squads/claude-code-mastery/data/mcp-integration-catalog.yaml +323 -0
- package/squads/claude-code-mastery/data/project-type-signatures.yaml +335 -0
- package/squads/claude-code-mastery/scripts/validate-setup.js +163 -0
- package/squads/claude-code-mastery/squad.yaml +205 -0
- package/squads/claude-code-mastery/tasks/audit-integration.md +219 -0
- package/squads/claude-code-mastery/tasks/audit-settings.md +206 -0
- package/squads/claude-code-mastery/tasks/audit-setup.md +225 -0
- package/squads/claude-code-mastery/tasks/brownfield-setup.md +322 -0
- package/squads/claude-code-mastery/tasks/ci-cd-setup.md +335 -0
- package/squads/claude-code-mastery/tasks/claude-md-engineer.md +334 -0
- package/squads/claude-code-mastery/tasks/configure-claude-code.md +215 -0
- package/squads/claude-code-mastery/tasks/context-rot-audit.md +329 -0
- package/squads/claude-code-mastery/tasks/create-agent-definition.md +278 -0
- package/squads/claude-code-mastery/tasks/create-rules.md +206 -0
- package/squads/claude-code-mastery/tasks/create-team-topology.md +258 -0
- package/squads/claude-code-mastery/tasks/diagnose.md +166 -0
- package/squads/claude-code-mastery/tasks/enterprise-config.md +346 -0
- package/squads/claude-code-mastery/tasks/hook-designer.md +272 -0
- package/squads/claude-code-mastery/tasks/integrate-project.md +304 -0
- package/squads/claude-code-mastery/tasks/mcp-integration-plan.md +229 -0
- package/squads/claude-code-mastery/tasks/mcp-workflow.md +285 -0
- package/squads/claude-code-mastery/tasks/multi-project-setup.md +228 -0
- package/squads/claude-code-mastery/tasks/optimize-context.md +217 -0
- package/squads/claude-code-mastery/tasks/optimize-workflow.md +226 -0
- package/squads/claude-code-mastery/tasks/parallel-decomposition.md +293 -0
- package/squads/claude-code-mastery/tasks/permission-strategy.md +266 -0
- package/squads/claude-code-mastery/tasks/sandbox-setup.md +279 -0
- package/squads/claude-code-mastery/tasks/setup-repository.md +230 -0
- package/squads/claude-code-mastery/tasks/setup-wizard.md +236 -0
- package/squads/claude-code-mastery/tasks/worktree-strategy.md +320 -0
- package/squads/claude-code-mastery/templates/claude-md-fullstack.md +147 -0
- package/squads/claude-code-mastery/templates/claude-md-library.md +175 -0
- package/squads/claude-code-mastery/templates/claude-md-microservices.md +186 -0
- package/squads/claude-code-mastery/templates/claude-md-mobile.md +198 -0
- package/squads/claude-code-mastery/templates/claude-md-monorepo.md +139 -0
- package/squads/claude-code-mastery/templates/github-actions-claude-ci.yml +348 -0
- package/squads/claude-code-mastery/templates/github-actions-claude-review.yml +179 -0
- package/squads/claude-code-mastery/workflows/wf-audit-complete.yaml +140 -0
- package/squads/claude-code-mastery/workflows/wf-knowledge-update.yaml +165 -0
- package/squads/claude-code-mastery/workflows/wf-project-setup.yaml +192 -0
- package/.sinapse-ai/infrastructure/scripts/ide-sync/transformers/antigravity.js +0 -105
- package/.sinapse-ai/infrastructure/scripts/ide-sync/transformers/cursor.js +0 -94
- package/.sinapse-ai/infrastructure/scripts/ide-sync/transformers/github-copilot.js +0 -184
- package/.sinapse-ai/infrastructure/scripts/validate-gemini-integration.js +0 -151
- package/.sinapse-ai/product/templates/ide-rules/antigravity-rules.md +0 -115
- package/.sinapse-ai/product/templates/ide-rules/copilot-rules.md +0 -92
- package/.sinapse-ai/product/templates/ide-rules/cursor-rules.md +0 -115
- package/.sinapse-ai/product/templates/ide-rules/gemini-rules.md +0 -87
- package/docs/pt/platforms/antigravity.md +0 -508
- package/docs/pt/platforms/cursor.md +0 -633
- package/docs/pt/platforms/gemini-cli.md +0 -481
- package/docs/pt/platforms/github-copilot.md +0 -478
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
# CI/CD Integration Patterns — Claude Code in Automated Pipelines
|
|
2
|
+
# Squad: claude-code-mastery
|
|
3
|
+
# Last updated: 2026-03-02
|
|
4
|
+
|
|
5
|
+
version: "1.0.0"
|
|
6
|
+
|
|
7
|
+
# Claude Code can run in headless mode (--print / -p) for CI/CD integration.
|
|
8
|
+
# These patterns provide production-ready GitHub Actions workflows.
|
|
9
|
+
|
|
10
|
+
patterns:
|
|
11
|
+
|
|
12
|
+
# ---------------------------------------------------------------------------
|
|
13
|
+
# 1. PR REVIEW — Automated code review on pull requests
|
|
14
|
+
# ---------------------------------------------------------------------------
|
|
15
|
+
- name: pr-review
|
|
16
|
+
description: |
|
|
17
|
+
Automatically review pull requests using Claude Code in headless mode.
|
|
18
|
+
Triggered on PR open/update, posts review comments.
|
|
19
|
+
trigger: pull_request
|
|
20
|
+
security_notes:
|
|
21
|
+
- "Store ANTHROPIC_API_KEY in GitHub Secrets"
|
|
22
|
+
- "Use permissions: pull-requests: write for posting comments"
|
|
23
|
+
- "Limit concurrent reviews to avoid API rate limits"
|
|
24
|
+
- "Never expose API keys in logs (use --output-format json)"
|
|
25
|
+
environment_setup:
|
|
26
|
+
required_secrets:
|
|
27
|
+
- ANTHROPIC_API_KEY
|
|
28
|
+
required_permissions:
|
|
29
|
+
- "pull-requests: write"
|
|
30
|
+
- "contents: read"
|
|
31
|
+
github_actions_yaml: |
|
|
32
|
+
name: Claude Code PR Review
|
|
33
|
+
on:
|
|
34
|
+
pull_request:
|
|
35
|
+
types: [opened, synchronize, ready_for_review]
|
|
36
|
+
|
|
37
|
+
permissions:
|
|
38
|
+
contents: read
|
|
39
|
+
pull-requests: write
|
|
40
|
+
|
|
41
|
+
jobs:
|
|
42
|
+
review:
|
|
43
|
+
if: ${{ !github.event.pull_request.draft }}
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
timeout-minutes: 15
|
|
46
|
+
steps:
|
|
47
|
+
- name: Checkout
|
|
48
|
+
uses: actions/checkout@v4
|
|
49
|
+
with:
|
|
50
|
+
fetch-depth: 0
|
|
51
|
+
|
|
52
|
+
- name: Setup Node.js
|
|
53
|
+
uses: actions/setup-node@v4
|
|
54
|
+
with:
|
|
55
|
+
node-version: '20'
|
|
56
|
+
|
|
57
|
+
- name: Install Claude Code
|
|
58
|
+
run: npm install -g @anthropic-ai/claude-code
|
|
59
|
+
|
|
60
|
+
- name: Get PR Diff
|
|
61
|
+
run: |
|
|
62
|
+
git diff origin/${{ github.base_ref }}...HEAD > /tmp/pr-diff.txt
|
|
63
|
+
|
|
64
|
+
- name: Run Claude Review
|
|
65
|
+
env:
|
|
66
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
67
|
+
run: |
|
|
68
|
+
REVIEW=$(claude -p \
|
|
69
|
+
--output-format text \
|
|
70
|
+
--max-turns 3 \
|
|
71
|
+
"Review this pull request diff for bugs, security issues, and code quality. Be concise. Focus on actionable feedback only. Diff: $(cat /tmp/pr-diff.txt | head -c 50000)")
|
|
72
|
+
|
|
73
|
+
echo "$REVIEW" > /tmp/review-output.txt
|
|
74
|
+
|
|
75
|
+
- name: Post Review Comment
|
|
76
|
+
uses: actions/github-script@v7
|
|
77
|
+
with:
|
|
78
|
+
script: |
|
|
79
|
+
const fs = require('fs');
|
|
80
|
+
const review = fs.readFileSync('/tmp/review-output.txt', 'utf8');
|
|
81
|
+
|
|
82
|
+
await github.rest.issues.createComment({
|
|
83
|
+
owner: context.repo.owner,
|
|
84
|
+
repo: context.repo.repo,
|
|
85
|
+
issue_number: context.issue.number,
|
|
86
|
+
body: `## Claude Code Review\n\n${review}\n\n---\n*Automated review by Claude Code*`
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
# ---------------------------------------------------------------------------
|
|
90
|
+
# 2. COMMIT VALIDATION — Pre-commit quality check
|
|
91
|
+
# ---------------------------------------------------------------------------
|
|
92
|
+
- name: commit-validation
|
|
93
|
+
description: |
|
|
94
|
+
Validate commit messages and changed files before merge.
|
|
95
|
+
Runs on push to main/develop branches.
|
|
96
|
+
trigger: push
|
|
97
|
+
security_notes:
|
|
98
|
+
- "Only runs on protected branches"
|
|
99
|
+
- "Non-blocking by default (exit 0 on review pass)"
|
|
100
|
+
- "Set continue-on-error for advisory mode"
|
|
101
|
+
environment_setup:
|
|
102
|
+
required_secrets:
|
|
103
|
+
- ANTHROPIC_API_KEY
|
|
104
|
+
github_actions_yaml: |
|
|
105
|
+
name: Claude Commit Validation
|
|
106
|
+
on:
|
|
107
|
+
push:
|
|
108
|
+
branches: [main, develop]
|
|
109
|
+
|
|
110
|
+
permissions:
|
|
111
|
+
contents: read
|
|
112
|
+
|
|
113
|
+
jobs:
|
|
114
|
+
validate:
|
|
115
|
+
runs-on: ubuntu-latest
|
|
116
|
+
timeout-minutes: 10
|
|
117
|
+
steps:
|
|
118
|
+
- name: Checkout
|
|
119
|
+
uses: actions/checkout@v4
|
|
120
|
+
with:
|
|
121
|
+
fetch-depth: 2
|
|
122
|
+
|
|
123
|
+
- name: Setup Node.js
|
|
124
|
+
uses: actions/setup-node@v4
|
|
125
|
+
with:
|
|
126
|
+
node-version: '20'
|
|
127
|
+
|
|
128
|
+
- name: Install Claude Code
|
|
129
|
+
run: npm install -g @anthropic-ai/claude-code
|
|
130
|
+
|
|
131
|
+
- name: Validate Last Commit
|
|
132
|
+
env:
|
|
133
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
134
|
+
continue-on-error: true
|
|
135
|
+
run: |
|
|
136
|
+
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
137
|
+
DIFF=$(git diff HEAD~1 --stat)
|
|
138
|
+
|
|
139
|
+
claude -p \
|
|
140
|
+
--output-format json \
|
|
141
|
+
--max-turns 2 \
|
|
142
|
+
"Validate this commit. Check: 1) Conventional commit format, 2) Message matches changes, 3) No obvious issues. Commit: '$COMMIT_MSG'. Changes: $DIFF. Reply with JSON: {\"valid\": true/false, \"issues\": [...]}"
|
|
143
|
+
|
|
144
|
+
# ---------------------------------------------------------------------------
|
|
145
|
+
# 3. TEST GENERATION — Generate tests for changed files
|
|
146
|
+
# ---------------------------------------------------------------------------
|
|
147
|
+
- name: test-generation
|
|
148
|
+
description: |
|
|
149
|
+
Automatically generate unit tests for files changed in a PR.
|
|
150
|
+
Creates a follow-up commit with test files.
|
|
151
|
+
trigger: pull_request
|
|
152
|
+
security_notes:
|
|
153
|
+
- "Creates commits, needs contents: write permission"
|
|
154
|
+
- "Uses a bot token or GitHub App for commits"
|
|
155
|
+
- "Limit to specific file patterns to control scope"
|
|
156
|
+
- "Review generated tests before merge"
|
|
157
|
+
environment_setup:
|
|
158
|
+
required_secrets:
|
|
159
|
+
- ANTHROPIC_API_KEY
|
|
160
|
+
required_permissions:
|
|
161
|
+
- "contents: write"
|
|
162
|
+
- "pull-requests: write"
|
|
163
|
+
github_actions_yaml: |
|
|
164
|
+
name: Claude Test Generation
|
|
165
|
+
on:
|
|
166
|
+
pull_request:
|
|
167
|
+
types: [opened, synchronize]
|
|
168
|
+
paths:
|
|
169
|
+
- 'src/**/*.ts'
|
|
170
|
+
- 'src/**/*.tsx'
|
|
171
|
+
- '!src/**/*.test.ts'
|
|
172
|
+
- '!src/**/*.spec.ts'
|
|
173
|
+
|
|
174
|
+
permissions:
|
|
175
|
+
contents: write
|
|
176
|
+
pull-requests: write
|
|
177
|
+
|
|
178
|
+
jobs:
|
|
179
|
+
generate-tests:
|
|
180
|
+
runs-on: ubuntu-latest
|
|
181
|
+
timeout-minutes: 20
|
|
182
|
+
steps:
|
|
183
|
+
- name: Checkout PR Branch
|
|
184
|
+
uses: actions/checkout@v4
|
|
185
|
+
with:
|
|
186
|
+
ref: ${{ github.head_ref }}
|
|
187
|
+
fetch-depth: 0
|
|
188
|
+
|
|
189
|
+
- name: Setup Node.js
|
|
190
|
+
uses: actions/setup-node@v4
|
|
191
|
+
with:
|
|
192
|
+
node-version: '20'
|
|
193
|
+
|
|
194
|
+
- name: Install Dependencies
|
|
195
|
+
run: |
|
|
196
|
+
npm install -g @anthropic-ai/claude-code
|
|
197
|
+
npm ci
|
|
198
|
+
|
|
199
|
+
- name: Find Changed Files Without Tests
|
|
200
|
+
id: changed
|
|
201
|
+
run: |
|
|
202
|
+
FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD \
|
|
203
|
+
| grep -E '^src/.*\.(ts|tsx)$' \
|
|
204
|
+
| grep -v -E '\.(test|spec)\.' \
|
|
205
|
+
| head -5)
|
|
206
|
+
echo "files=$FILES" >> $GITHUB_OUTPUT
|
|
207
|
+
|
|
208
|
+
- name: Generate Tests
|
|
209
|
+
if: steps.changed.outputs.files != ''
|
|
210
|
+
env:
|
|
211
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
212
|
+
run: |
|
|
213
|
+
for FILE in ${{ steps.changed.outputs.files }}; do
|
|
214
|
+
TEST_FILE="${FILE%.ts}.test.ts"
|
|
215
|
+
if [ ! -f "$TEST_FILE" ]; then
|
|
216
|
+
claude -p \
|
|
217
|
+
--output-format text \
|
|
218
|
+
--max-turns 5 \
|
|
219
|
+
--dangerously-skip-permissions \
|
|
220
|
+
"Generate comprehensive unit tests for $FILE. Use Jest and React Testing Library if applicable. Write tests to $TEST_FILE. Follow existing test patterns in the project."
|
|
221
|
+
fi
|
|
222
|
+
done
|
|
223
|
+
|
|
224
|
+
- name: Check for Generated Tests
|
|
225
|
+
id: check
|
|
226
|
+
run: |
|
|
227
|
+
if git diff --name-only | grep -q '\.test\.'; then
|
|
228
|
+
echo "has_tests=true" >> $GITHUB_OUTPUT
|
|
229
|
+
else
|
|
230
|
+
echo "has_tests=false" >> $GITHUB_OUTPUT
|
|
231
|
+
fi
|
|
232
|
+
|
|
233
|
+
- name: Commit Generated Tests
|
|
234
|
+
if: steps.check.outputs.has_tests == 'true'
|
|
235
|
+
run: |
|
|
236
|
+
git config user.name "claude-code[bot]"
|
|
237
|
+
git config user.email "claude-code[bot]@users.noreply.github.com"
|
|
238
|
+
git add '*.test.ts' '*.test.tsx'
|
|
239
|
+
git commit -m "test: auto-generate tests for changed files
|
|
240
|
+
|
|
241
|
+
Co-Authored-By: Claude Code <noreply@anthropic.com>"
|
|
242
|
+
git push
|
|
243
|
+
|
|
244
|
+
# ---------------------------------------------------------------------------
|
|
245
|
+
# 4. CODE REVIEW — Structured review with parsed output
|
|
246
|
+
# ---------------------------------------------------------------------------
|
|
247
|
+
- name: code-review
|
|
248
|
+
description: |
|
|
249
|
+
Structured code review with severity-classified findings.
|
|
250
|
+
Outputs JSON for integration with other tools.
|
|
251
|
+
trigger: workflow_dispatch
|
|
252
|
+
security_notes:
|
|
253
|
+
- "Manual trigger only, controlled scope"
|
|
254
|
+
- "JSON output enables downstream automation"
|
|
255
|
+
- "Store results as artifacts for audit trail"
|
|
256
|
+
environment_setup:
|
|
257
|
+
required_secrets:
|
|
258
|
+
- ANTHROPIC_API_KEY
|
|
259
|
+
github_actions_yaml: |
|
|
260
|
+
name: Claude Structured Review
|
|
261
|
+
on:
|
|
262
|
+
workflow_dispatch:
|
|
263
|
+
inputs:
|
|
264
|
+
base_branch:
|
|
265
|
+
description: 'Base branch for comparison'
|
|
266
|
+
required: true
|
|
267
|
+
default: 'main'
|
|
268
|
+
review_scope:
|
|
269
|
+
description: 'Scope: all, security, performance, architecture'
|
|
270
|
+
required: true
|
|
271
|
+
default: 'all'
|
|
272
|
+
|
|
273
|
+
permissions:
|
|
274
|
+
contents: read
|
|
275
|
+
|
|
276
|
+
jobs:
|
|
277
|
+
structured-review:
|
|
278
|
+
runs-on: ubuntu-latest
|
|
279
|
+
timeout-minutes: 20
|
|
280
|
+
steps:
|
|
281
|
+
- name: Checkout
|
|
282
|
+
uses: actions/checkout@v4
|
|
283
|
+
with:
|
|
284
|
+
fetch-depth: 0
|
|
285
|
+
|
|
286
|
+
- name: Setup Node.js
|
|
287
|
+
uses: actions/setup-node@v4
|
|
288
|
+
with:
|
|
289
|
+
node-version: '20'
|
|
290
|
+
|
|
291
|
+
- name: Install Claude Code
|
|
292
|
+
run: npm install -g @anthropic-ai/claude-code
|
|
293
|
+
|
|
294
|
+
- name: Run Structured Review
|
|
295
|
+
env:
|
|
296
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
297
|
+
run: |
|
|
298
|
+
DIFF=$(git diff origin/${{ inputs.base_branch }}...HEAD)
|
|
299
|
+
|
|
300
|
+
claude -p \
|
|
301
|
+
--output-format json \
|
|
302
|
+
--max-turns 5 \
|
|
303
|
+
"Perform a ${{ inputs.review_scope }} code review on this diff. Output a JSON object with: {\"summary\": \"...\", \"findings\": [{\"severity\": \"critical|high|medium|low\", \"file\": \"...\", \"line\": N, \"title\": \"...\", \"description\": \"...\", \"suggestion\": \"...\"}], \"score\": 1-10, \"recommendation\": \"approve|request-changes|block\"}. Diff (truncated to 40000 chars): $(echo "$DIFF" | head -c 40000)" \
|
|
304
|
+
> /tmp/review-results.json
|
|
305
|
+
|
|
306
|
+
- name: Upload Review Results
|
|
307
|
+
uses: actions/upload-artifact@v4
|
|
308
|
+
with:
|
|
309
|
+
name: claude-review-${{ github.sha }}
|
|
310
|
+
path: /tmp/review-results.json
|
|
311
|
+
retention-days: 30
|
|
312
|
+
|
|
313
|
+
- name: Summary
|
|
314
|
+
run: |
|
|
315
|
+
echo "## Review Complete" >> $GITHUB_STEP_SUMMARY
|
|
316
|
+
cat /tmp/review-results.json | python3 -c "
|
|
317
|
+
import json, sys
|
|
318
|
+
data = json.load(sys.stdin)
|
|
319
|
+
if isinstance(data, dict):
|
|
320
|
+
print(f'Score: {data.get(\"score\", \"N/A\")}/10')
|
|
321
|
+
print(f'Recommendation: {data.get(\"recommendation\", \"N/A\")}')
|
|
322
|
+
findings = data.get('findings', [])
|
|
323
|
+
print(f'Findings: {len(findings)}')
|
|
324
|
+
for f in findings[:10]:
|
|
325
|
+
print(f'- [{f.get(\"severity\",\"?\")}] {f.get(\"title\",\"\")}')
|
|
326
|
+
" >> $GITHUB_STEP_SUMMARY || echo "Could not parse results" >> $GITHUB_STEP_SUMMARY
|
|
327
|
+
|
|
328
|
+
# ---------------------------------------------------------------------------
|
|
329
|
+
# 5. DOCUMENTATION SYNC — Auto-update docs on merge
|
|
330
|
+
# ---------------------------------------------------------------------------
|
|
331
|
+
- name: documentation-sync
|
|
332
|
+
description: |
|
|
333
|
+
Automatically update documentation when source code changes.
|
|
334
|
+
Runs after merge to main, creates a PR with doc updates.
|
|
335
|
+
trigger: push
|
|
336
|
+
security_notes:
|
|
337
|
+
- "Uses a GitHub App token for creating PRs"
|
|
338
|
+
- "Limited to docs/ directory changes"
|
|
339
|
+
- "Human review required before merge"
|
|
340
|
+
environment_setup:
|
|
341
|
+
required_secrets:
|
|
342
|
+
- ANTHROPIC_API_KEY
|
|
343
|
+
- BOT_TOKEN
|
|
344
|
+
github_actions_yaml: |
|
|
345
|
+
name: Claude Documentation Sync
|
|
346
|
+
on:
|
|
347
|
+
push:
|
|
348
|
+
branches: [main]
|
|
349
|
+
paths:
|
|
350
|
+
- 'src/**'
|
|
351
|
+
- 'packages/**'
|
|
352
|
+
- '!docs/**'
|
|
353
|
+
|
|
354
|
+
permissions:
|
|
355
|
+
contents: write
|
|
356
|
+
pull-requests: write
|
|
357
|
+
|
|
358
|
+
jobs:
|
|
359
|
+
sync-docs:
|
|
360
|
+
runs-on: ubuntu-latest
|
|
361
|
+
timeout-minutes: 15
|
|
362
|
+
steps:
|
|
363
|
+
- name: Checkout
|
|
364
|
+
uses: actions/checkout@v4
|
|
365
|
+
with:
|
|
366
|
+
fetch-depth: 2
|
|
367
|
+
|
|
368
|
+
- name: Setup Node.js
|
|
369
|
+
uses: actions/setup-node@v4
|
|
370
|
+
with:
|
|
371
|
+
node-version: '20'
|
|
372
|
+
|
|
373
|
+
- name: Install Claude Code
|
|
374
|
+
run: npm install -g @anthropic-ai/claude-code
|
|
375
|
+
|
|
376
|
+
- name: Check for API Changes
|
|
377
|
+
id: changes
|
|
378
|
+
run: |
|
|
379
|
+
CHANGED=$(git diff HEAD~1 --name-only | grep -E '^(src|packages)/' | head -20)
|
|
380
|
+
echo "files=$CHANGED" >> $GITHUB_OUTPUT
|
|
381
|
+
|
|
382
|
+
- name: Update Documentation
|
|
383
|
+
if: steps.changes.outputs.files != ''
|
|
384
|
+
env:
|
|
385
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
386
|
+
run: |
|
|
387
|
+
claude -p \
|
|
388
|
+
--output-format text \
|
|
389
|
+
--max-turns 5 \
|
|
390
|
+
--dangerously-skip-permissions \
|
|
391
|
+
"These source files changed: ${{ steps.changes.outputs.files }}. Check if any documentation in docs/ needs updating to reflect these changes. Only update docs that are directly affected. Do not create new docs."
|
|
392
|
+
|
|
393
|
+
- name: Create PR if Changes
|
|
394
|
+
run: |
|
|
395
|
+
if git diff --quiet; then
|
|
396
|
+
echo "No documentation changes needed"
|
|
397
|
+
exit 0
|
|
398
|
+
fi
|
|
399
|
+
git config user.name "claude-code[bot]"
|
|
400
|
+
git config user.email "claude-code[bot]@users.noreply.github.com"
|
|
401
|
+
BRANCH="docs/auto-sync-$(date +%Y%m%d-%H%M%S)"
|
|
402
|
+
git checkout -b "$BRANCH"
|
|
403
|
+
git add docs/
|
|
404
|
+
git commit -m "docs: auto-sync documentation with source changes"
|
|
405
|
+
git push origin "$BRANCH"
|
|
406
|
+
gh pr create \
|
|
407
|
+
--title "docs: auto-sync documentation" \
|
|
408
|
+
--body "Automated documentation update triggered by source code changes." \
|
|
409
|
+
--base main \
|
|
410
|
+
--head "$BRANCH"
|
|
411
|
+
env:
|
|
412
|
+
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
|