codex-genesis-harness 0.1.1 → 0.1.4
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/.codebase/ARCHITECTURE_REVIEW_COMPLETE.md +216 -0
- package/.codebase/CURRENT_STATE.md +2 -0
- package/.codebase/DOMAIN_MODELS.md +5 -3
- package/.codebase/FILE_NAMING_CLARIFICATION.md +161 -0
- package/.codebase/HARNESS_COMPLETENESS_AUDIT.md +613 -0
- package/.codebase/IMPLEMENTATION_COMPLETE.md +429 -0
- package/.codebase/IMPLEMENTATION_HANDOFF.md +351 -0
- package/.codebase/IMPROVEMENTS_SUMMARY.md +419 -0
- package/.codebase/PHASE3_SKILLS_NAMING_COMPLETE.md +292 -0
- package/.codebase/PHASE_DEPENDENCY_MAP.md +486 -0
- package/.codebase/QUICK_START_SPEC_IMPACT.md +456 -0
- package/.codebase/README.md +139 -0
- package/.codebase/RECOVERY_POINTS.md +438 -0
- package/.codex/skills/genesis-api-sync/SKILL.md +354 -0
- package/.codex/skills/genesis-api-sync/agents/openai.yaml +7 -0
- package/.codex/skills/genesis-api-sync/checklists/api-sync-checklist.md +101 -0
- package/.codex/skills/genesis-api-sync/examples/example.md +68 -0
- package/.codex/skills/genesis-api-sync/templates/api-change-template.md +257 -0
- package/.codex/skills/genesis-debug-guide/SKILL.md +479 -0
- package/.codex/skills/genesis-debug-guide/agents/openai.yaml +7 -0
- package/.codex/skills/genesis-debug-guide/checklists/flaky-test-investigation.md +339 -0
- package/.codex/skills/genesis-debug-guide/checklists/production-bug-debug.md +210 -0
- package/.codex/skills/genesis-debug-guide/checklists/test-failure-debug.md +158 -0
- package/.codex/skills/genesis-debug-guide/examples/example.md +48 -0
- package/.codex/skills/genesis-debug-guide/observability/debug-commands.md +365 -0
- package/.codex/skills/genesis-debug-guide/playbooks/unit-test-failures.md +289 -0
- package/.codex/skills/genesis-debug-guide/templates/debug-investigation-log.md +288 -0
- package/.codex/skills/genesis-docs-automation/SKILL.md +1003 -0
- package/.codex/skills/genesis-docs-automation/agents/openai.yaml +7 -0
- package/.codex/skills/genesis-docs-automation/checklists/docs-validation.md +359 -0
- package/.codex/skills/genesis-docs-automation/checklists/spec-alignment.md +312 -0
- package/.codex/skills/genesis-docs-automation/examples/example.md +59 -0
- package/.codex/skills/genesis-docs-automation/observability/docs-tracking.md +382 -0
- package/.codex/skills/genesis-docs-automation/playbooks/auto-update-flow.md +851 -0
- package/.codex/skills/genesis-docs-automation/playbooks/changelog-generation.md +491 -0
- package/.codex/skills/genesis-docs-automation/templates/changelog-entry-template.md +187 -0
- package/.codex/skills/genesis-docs-automation/templates/handoff-template.md +297 -0
- package/.codex/skills/genesis-harness/SKILL.md +734 -82
- package/.codex/skills/genesis-harness/checklists/bug-fix-qa.md +169 -0
- package/.codex/skills/genesis-harness/checklists/new-feature-qa.md +157 -0
- package/.codex/skills/genesis-harness/checklists/refactor-qa.md +216 -0
- package/.codex/skills/genesis-harness/checklists/requirements-validation.md +211 -0
- package/.codex/skills/genesis-harness/resources/change-impact-matrix-template.md +204 -0
- package/.codex/skills/genesis-harness/resources/foundation-phase-template.md +131 -0
- package/.codex/skills/genesis-harness/resources/phase-00-foundation-template.md +76 -0
- package/.codex/skills/genesis-harness/resources/post-implementation-guide.md +347 -0
- package/.codex/skills/genesis-harness/scripts/check-architecture-boundaries.sh +23 -23
- package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +24 -24
- package/.codex/skills/genesis-harness/scripts/check-no-debug-logs.sh +21 -21
- package/.codex/skills/genesis-harness/scripts/check-required-planning-files.sh +46 -46
- package/.codex/skills/genesis-harness/scripts/check-spec-changelog.sh +24 -24
- package/.codex/skills/genesis-harness/scripts/check-task-tracking.sh +25 -25
- package/.codex/skills/genesis-harness/scripts/compact-context.sh +54 -0
- package/.codex/skills/genesis-harness/scripts/create-adr.sh +74 -74
- package/.codex/skills/genesis-harness/scripts/create-bug.sh +160 -160
- package/.codex/skills/genesis-harness/scripts/create-feature.sh +217 -217
- package/.codex/skills/genesis-harness/scripts/detect-stack.sh +26 -26
- package/.codex/skills/genesis-harness/scripts/init-planning.sh +750 -719
- package/.codex/skills/genesis-harness/scripts/list-changed-files.sh +12 -12
- package/.codex/skills/genesis-harness/scripts/offload-log.sh +72 -0
- package/.codex/skills/genesis-harness/scripts/run-verification.sh +47 -47
- package/.codex/skills/genesis-harness/scripts/run-verify-loop.sh +75 -0
- package/.codex/skills/genesis-harness/scripts/update-state.sh +33 -33
- package/.codex/skills/genesis-harness-engineering/SKILL.md +159 -0
- package/.codex/skills/genesis-harness-engineering/checklists/checklist.md +48 -0
- package/.codex/skills/genesis-harness-engineering/examples/example.md +57 -0
- package/.codex/skills/genesis-harness-engineering/playbooks/harness-evolution.md +99 -0
- package/.codex/skills/genesis-harness-engineering/templates/harness-change-template.md +37 -0
- package/.codex/skills/genesis-observability-automation/SKILL.md +382 -0
- package/.codex/skills/genesis-observability-automation/agents/openai.yaml +7 -0
- package/.codex/skills/genesis-observability-automation/examples/example.md +86 -0
- package/.codex/skills/genesis-performance-profiling/SKILL.md +510 -0
- package/.codex/skills/genesis-performance-profiling/agents/openai.yaml +6 -0
- package/.codex/skills/genesis-performance-profiling/checklists/optimization-verification.md +199 -0
- package/.codex/skills/genesis-performance-profiling/checklists/performance-baseline.md +183 -0
- package/.codex/skills/genesis-performance-profiling/examples/example.md +234 -0
- package/.codex/skills/genesis-performance-profiling/observability/performance-tracking.md +202 -0
- package/.codex/skills/genesis-performance-profiling/playbooks/load-testing-orchestration.md +593 -0
- package/.codex/skills/genesis-performance-profiling/playbooks/profiling-playbook.md +601 -0
- package/.codex/skills/genesis-performance-profiling/templates/load-test-config-template.md +428 -0
- package/.codex/skills/genesis-performance-profiling/templates/performance-report-template.md +238 -0
- package/.codex/skills/genesis-release-orchestration/SKILL.md +653 -0
- package/.codex/skills/genesis-release-orchestration/agents/openai.yaml +7 -0
- package/.codex/skills/genesis-release-orchestration/checklists/post-deployment-verification.md +274 -0
- package/.codex/skills/genesis-release-orchestration/checklists/pre-release-validation.md +220 -0
- package/.codex/skills/genesis-release-orchestration/examples/example.md +78 -0
- package/.codex/skills/genesis-release-orchestration/observability/release-tracking.md +253 -0
- package/.codex/skills/genesis-release-orchestration/playbooks/canary-deployment-orchestration.md +472 -0
- package/.codex/skills/genesis-release-orchestration/playbooks/semantic-versioning-automation.md +494 -0
- package/.codex/skills/genesis-release-orchestration/templates/deployment-strategy-template.md +303 -0
- package/.codex/skills/genesis-release-orchestration/templates/release-runbook-template.md +420 -0
- package/.codex/skills/genesis-research-first/SKILL.md +237 -0
- package/.codex/skills/genesis-research-first/agents/openai.yaml +7 -0
- package/.codex/skills/genesis-research-first/examples/example.md +85 -0
- package/.codex/skills/genesis-spec-propagation/SKILL.md +534 -0
- package/.codex/skills/genesis-spec-propagation/agents/openai.yaml +7 -0
- package/.codex/skills/genesis-spec-propagation/checklists/phase-update-verification.md +384 -0
- package/.codex/skills/genesis-spec-propagation/checklists/spec-change-detection.md +257 -0
- package/.codex/skills/genesis-spec-propagation/examples/example.md +63 -0
- package/.codex/skills/genesis-spec-propagation/observability/propagation-tracking.md +373 -0
- package/.codex/skills/genesis-spec-propagation/playbooks/breaking-change-propagation.md +692 -0
- package/.codex/skills/genesis-spec-propagation/playbooks/feature-change-propagation.md +434 -0
- package/.codex/skills/genesis-spec-propagation/templates/migration-guide-template.md +407 -0
- package/.codex/skills/spec-impact-engine/SKILL.md +504 -0
- package/.codex/skills/spec-impact-engine/agents/openai.yaml +7 -0
- package/.codex/skills/spec-impact-engine/detect-spec-changes.sh +262 -0
- package/.codex/skills/spec-impact-engine/examples/example.md +98 -0
- package/.codex/skills/spec-impact-engine/templates/impact-report.md +248 -0
- package/.codex/skills/spec-impact-engine/templates/migration-guide.md +223 -0
- package/.codex-plugin/plugin.json +1 -1
- package/README.EN.md +719 -0
- package/README.VI.md +712 -0
- package/README.md +261 -107
- package/VERSION +1 -1
- package/bin/genesis-harness.js +20 -11
- package/package.json +1 -1
- package/scripts/README.md +342 -0
- package/scripts/compact-context.sh +54 -0
- package/scripts/detect-changes.sh +152 -0
- package/scripts/install.sh +50 -41
- package/scripts/offload-log.sh +72 -0
- package/scripts/run-evals.sh +70 -43
- package/scripts/run-verify-loop.sh +75 -0
- package/scripts/uninstall.sh +52 -43
- package/scripts/verify.sh +165 -73
- package/.codex/skills/harness-engineering-skill/SKILL.md +0 -45
- package/.codex/skills/harness-engineering-skill/checklists/checklist.md +0 -8
- package/.codex/skills/harness-engineering-skill/examples/example.md +0 -4
- package/.codex/skills/harness-engineering-skill/templates/harness-change-template.md +0 -8
- /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/SKILL.md +0 -0
- /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/agents/openai.yaml +0 -0
- /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/checklists/checklist.md +0 -0
- /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/examples/example.md +0 -0
- /package/.codex/skills/{ai-provider-skill → genesis-ai-provider}/templates/provider-contract-template.md +0 -0
- /package/.codex/skills/{api-contract-skill → genesis-api-contract}/SKILL.md +0 -0
- /package/.codex/skills/{api-contract-skill → genesis-api-contract}/agents/openai.yaml +0 -0
- /package/.codex/skills/{api-contract-skill → genesis-api-contract}/checklists/checklist.md +0 -0
- /package/.codex/skills/{api-contract-skill → genesis-api-contract}/examples/example.md +0 -0
- /package/.codex/skills/{api-contract-skill → genesis-api-contract}/templates/api-contract-template.md +0 -0
- /package/.codex/skills/{architecture-skill → genesis-architecture}/SKILL.md +0 -0
- /package/.codex/skills/{architecture-skill → genesis-architecture}/agents/openai.yaml +0 -0
- /package/.codex/skills/{architecture-skill → genesis-architecture}/checklists/checklist.md +0 -0
- /package/.codex/skills/{architecture-skill → genesis-architecture}/examples/example.md +0 -0
- /package/.codex/skills/{architecture-skill → genesis-architecture}/templates/architecture-decision-template.md +0 -0
- /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/SKILL.md +0 -0
- /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/agents/openai.yaml +0 -0
- /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/checklists/checklist.md +0 -0
- /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/examples/example.md +0 -0
- /package/.codex/skills/{codebase-map-skill → genesis-codebase-map}/templates/map-update-template.md +0 -0
- /package/.codex/skills/{design-spec-skill → genesis-design-spec}/SKILL.md +0 -0
- /package/.codex/skills/{design-spec-skill → genesis-design-spec}/agents/openai.yaml +0 -0
- /package/.codex/skills/{design-spec-skill → genesis-design-spec}/checklists/checklist.md +0 -0
- /package/.codex/skills/{design-spec-skill → genesis-design-spec}/examples/example.md +0 -0
- /package/.codex/skills/{design-spec-skill → genesis-design-spec}/templates/design-spec-template.md +0 -0
- /package/.codex/skills/{docs-skill → genesis-docs}/SKILL.md +0 -0
- /package/.codex/skills/{docs-skill → genesis-docs}/agents/openai.yaml +0 -0
- /package/.codex/skills/{docs-skill → genesis-docs}/checklists/checklist.md +0 -0
- /package/.codex/skills/{docs-skill → genesis-docs}/examples/example.md +0 -0
- /package/.codex/skills/{docs-skill → genesis-docs}/templates/docs-update-template.md +0 -0
- /package/.codex/skills/{harness-engineering-skill → genesis-harness-engineering}/agents/openai.yaml +0 -0
- /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/SKILL.md +0 -0
- /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/agents/openai.yaml +0 -0
- /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/checklists/checklist.md +0 -0
- /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/examples/example.md +0 -0
- /package/.codex/skills/{pipeline-orchestration-skill → genesis-pipeline-orchestration}/templates/orchestration-template.md +0 -0
- /package/.codex/skills/{planning-skill → genesis-planning}/SKILL.md +0 -0
- /package/.codex/skills/{planning-skill → genesis-planning}/agents/openai.yaml +0 -0
- /package/.codex/skills/{planning-skill → genesis-planning}/checklists/checklist.md +0 -0
- /package/.codex/skills/{planning-skill → genesis-planning}/examples/example.md +0 -0
- /package/.codex/skills/{planning-skill → genesis-planning}/templates/plan-template.md +0 -0
- /package/.codex/skills/{release-skill → genesis-release}/SKILL.md +0 -0
- /package/.codex/skills/{release-skill → genesis-release}/agents/openai.yaml +0 -0
- /package/.codex/skills/{release-skill → genesis-release}/checklists/checklist.md +0 -0
- /package/.codex/skills/{release-skill → genesis-release}/examples/example.md +0 -0
- /package/.codex/skills/{release-skill → genesis-release}/templates/release-checklist-template.md +0 -0
- /package/.codex/skills/{research-skill → genesis-research}/SKILL.md +0 -0
- /package/.codex/skills/{research-skill → genesis-research}/agents/openai.yaml +0 -0
- /package/.codex/skills/{research-skill → genesis-research}/checklists/checklist.md +0 -0
- /package/.codex/skills/{research-skill → genesis-research}/examples/example.md +0 -0
- /package/.codex/skills/{research-skill → genesis-research}/templates/research-note-template.md +0 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-sync-skill
|
|
3
|
+
description: Automatic API contract synchronization. Detects API changes in implementation, updates API_CONTRACTS.md, regenerates test contracts, and maintains backward compatibility documentation. Use after API-related implementation or when contracts drift from actual code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API Sync Skill
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Keep API contracts synchronized with actual implementation. Detect changes, update contracts, regenerate tests, and document breaking changes automatically.
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
Use after API-related implementation when:
|
|
15
|
+
- New endpoints added
|
|
16
|
+
- Endpoint behavior changed
|
|
17
|
+
- Request/response schemas modified
|
|
18
|
+
- Error handling updated
|
|
19
|
+
- Authentication/authorization changed
|
|
20
|
+
- Deprecated endpoints need removal
|
|
21
|
+
|
|
22
|
+
## When NOT to use
|
|
23
|
+
|
|
24
|
+
Do not use for read-only API documentation or when contract-first design hasn't been completed yet.
|
|
25
|
+
|
|
26
|
+
## Inputs required
|
|
27
|
+
|
|
28
|
+
- Changed implementation files (API routes, controllers, handlers)
|
|
29
|
+
- Current API_CONTRACTS.md file
|
|
30
|
+
- Test suite location
|
|
31
|
+
- Breaking change impact assessment
|
|
32
|
+
|
|
33
|
+
## Outputs required
|
|
34
|
+
|
|
35
|
+
- Updated API_CONTRACTS.md with all changes
|
|
36
|
+
- Updated API test contracts
|
|
37
|
+
- Test code reflecting new contracts
|
|
38
|
+
- Migration guide for breaking changes (if applicable)
|
|
39
|
+
- Backward compatibility documentation
|
|
40
|
+
|
|
41
|
+
## Required tests
|
|
42
|
+
|
|
43
|
+
- Contract validation tests (request/response schemas)
|
|
44
|
+
- API integration tests updated
|
|
45
|
+
- Backward compatibility tests (if versioning)
|
|
46
|
+
- Error handling tests
|
|
47
|
+
|
|
48
|
+
## Required fixtures
|
|
49
|
+
|
|
50
|
+
- Updated endpoint fixtures
|
|
51
|
+
- Request/response examples
|
|
52
|
+
- Error scenario fixtures
|
|
53
|
+
- Edge case payloads
|
|
54
|
+
|
|
55
|
+
## Required contract updates
|
|
56
|
+
|
|
57
|
+
- API_CONTRACTS.md (primary)
|
|
58
|
+
- Versioning info (if breaking changes)
|
|
59
|
+
- Deprecation notices (if applicable)
|
|
60
|
+
- Migration guide (if breaking changes)
|
|
61
|
+
|
|
62
|
+
## Required codebase map updates
|
|
63
|
+
|
|
64
|
+
- `.codebase/API_CONTRACTS.md` - complete update
|
|
65
|
+
- `.codebase/CURRENT_STATE.md` - note API changes
|
|
66
|
+
- `.codebase/KNOWN_PROBLEMS.md` - document migration issues
|
|
67
|
+
- `.codebase/EVOLUTION_PLAN.md` - next API phases
|
|
68
|
+
|
|
69
|
+
## Token saving rules
|
|
70
|
+
|
|
71
|
+
Extract schemas programmatically; don't paste entire files. Focus on deltas from previous contracts. Link to test fixtures rather than duplicating examples.
|
|
72
|
+
|
|
73
|
+
## Acceptance criteria
|
|
74
|
+
|
|
75
|
+
- API contracts match actual implementation
|
|
76
|
+
- All endpoints documented with schemas
|
|
77
|
+
- Breaking changes clearly marked
|
|
78
|
+
- Test contracts generated and passing
|
|
79
|
+
- Migration paths documented for breaking changes
|
|
80
|
+
- No contract drift validation passing
|
|
81
|
+
|
|
82
|
+
## Common mistakes
|
|
83
|
+
|
|
84
|
+
- Skipping breaking change documentation
|
|
85
|
+
- Not updating test contracts in parallel
|
|
86
|
+
- Leaving old endpoints undocumented
|
|
87
|
+
- Forgetting error response contracts
|
|
88
|
+
- Not validating backward compatibility
|
|
89
|
+
|
|
90
|
+
## Recovery workflow
|
|
91
|
+
|
|
92
|
+
If contracts drift or sync fails:
|
|
93
|
+
1. Read current API_CONTRACTS.md
|
|
94
|
+
2. Extract actual endpoint schemas from implementation
|
|
95
|
+
3. Identify changes and breaking status
|
|
96
|
+
4. Update contracts with full changelog
|
|
97
|
+
5. Regenerate test contracts
|
|
98
|
+
6. Validate all tests pass
|
|
99
|
+
7. Document migration guide if needed
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Workflow: API Change Detection & Sync
|
|
104
|
+
|
|
105
|
+
### Step 1: Detect API Changes
|
|
106
|
+
|
|
107
|
+
Identify which files contain API code:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
Scan for:
|
|
111
|
+
├─ src/api/**
|
|
112
|
+
├─ src/**/route.ts, routes.ts
|
|
113
|
+
├─ src/**/controller.ts
|
|
114
|
+
├─ src/**/endpoint.ts
|
|
115
|
+
└─ src/**/handler.ts
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For each file, extract:
|
|
119
|
+
- HTTP method (GET, POST, PUT, DELETE, PATCH)
|
|
120
|
+
- Route/path
|
|
121
|
+
- Request schema (params, query, body)
|
|
122
|
+
- Response schema (success, error)
|
|
123
|
+
- Status codes
|
|
124
|
+
- Authentication requirements
|
|
125
|
+
- Rate limiting or other middleware
|
|
126
|
+
|
|
127
|
+
### Step 2: Compare Against Current Contract
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
For each endpoint:
|
|
131
|
+
New? → Add to contract
|
|
132
|
+
Modified? → Mark change and version
|
|
133
|
+
Deleted? → Mark as deprecated
|
|
134
|
+
Unchanged? → Keep as-is
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Step 3: Generate Updated Contracts
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"endpoints": [
|
|
142
|
+
{
|
|
143
|
+
"id": "endpoint-id",
|
|
144
|
+
"method": "POST",
|
|
145
|
+
"path": "/api/v1/resource",
|
|
146
|
+
"description": "Create a new resource",
|
|
147
|
+
"version": "1.0",
|
|
148
|
+
"breaking_changes_from": [],
|
|
149
|
+
"request": {
|
|
150
|
+
"body": { /* schema */ },
|
|
151
|
+
"query": { /* schema */ },
|
|
152
|
+
"headers": { /* required headers */ }
|
|
153
|
+
},
|
|
154
|
+
"responses": {
|
|
155
|
+
"200": { /* success schema */ },
|
|
156
|
+
"400": { /* error schema */ },
|
|
157
|
+
"401": { /* auth error */ }
|
|
158
|
+
},
|
|
159
|
+
"auth_required": true,
|
|
160
|
+
"rate_limit": "100/hour"
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Step 4: Mark Breaking Changes
|
|
167
|
+
|
|
168
|
+
If changes break existing clients:
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
## Breaking Changes in v2.0
|
|
172
|
+
|
|
173
|
+
### Changed: POST /api/v1/resource
|
|
174
|
+
- Old: Returns `id`, `name`, `created_at`
|
|
175
|
+
- New: Returns `resourceId`, `title`, `timestamp`
|
|
176
|
+
- Impact: Clients expecting `id` field will break
|
|
177
|
+
- Migration: Map `resourceId` → `id` in client code
|
|
178
|
+
- Deadline: Migrate by [date], v1 endpoints removed [date]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Step 5: Generate Test Contracts
|
|
182
|
+
|
|
183
|
+
Automatically create test schemas:
|
|
184
|
+
|
|
185
|
+
```javascript
|
|
186
|
+
// tests/contracts/api.test.ts
|
|
187
|
+
import { apiContracts } from '.codebase/API_CONTRACTS.md'
|
|
188
|
+
|
|
189
|
+
describe('API Contracts', () => {
|
|
190
|
+
apiContracts.endpoints.forEach(endpoint => {
|
|
191
|
+
it(`${endpoint.method} ${endpoint.path}`, async () => {
|
|
192
|
+
const response = await request(endpoint.method, endpoint.path)
|
|
193
|
+
validateSchema(response, endpoint.responses)
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
})
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Step 6: Document Migration Path
|
|
200
|
+
|
|
201
|
+
If breaking changes exist:
|
|
202
|
+
|
|
203
|
+
```markdown
|
|
204
|
+
## Migration Guide
|
|
205
|
+
|
|
206
|
+
### From v1.0 → v2.0
|
|
207
|
+
|
|
208
|
+
#### Step 1: Update request payloads
|
|
209
|
+
```
|
|
210
|
+
// OLD
|
|
211
|
+
POST /api/v1/resource
|
|
212
|
+
{ "name": "Test" }
|
|
213
|
+
|
|
214
|
+
// NEW
|
|
215
|
+
POST /api/v2/resource
|
|
216
|
+
{ "title": "Test" }
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
#### Step 2: Update response parsing
|
|
220
|
+
```
|
|
221
|
+
// OLD
|
|
222
|
+
const id = data.id
|
|
223
|
+
|
|
224
|
+
// NEW
|
|
225
|
+
const id = data.resourceId
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
#### Step 3: Timeline
|
|
229
|
+
- June 1: v2 available alongside v1
|
|
230
|
+
- July 1: Clients should migrate
|
|
231
|
+
- August 1: v1 endpoints deprecated
|
|
232
|
+
- September 1: v1 endpoints removed
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Usage in Workflow
|
|
238
|
+
|
|
239
|
+
### During Feature Implementation
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# 1. Implement API changes
|
|
243
|
+
# 2. Write tests with new contract
|
|
244
|
+
# 3. Run tests - should pass
|
|
245
|
+
|
|
246
|
+
# 4. After tests pass, sync contracts:
|
|
247
|
+
invoke api-sync-skill
|
|
248
|
+
|
|
249
|
+
# Parameters:
|
|
250
|
+
- changed_files: ["src/api/users.ts", "src/routes/auth.ts"]
|
|
251
|
+
- contract_file: ".codebase/API_CONTRACTS.md"
|
|
252
|
+
- breaking_changes: true/false
|
|
253
|
+
- version_bump: "major/minor/patch"
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### After Sync Completed
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
✓ API_CONTRACTS.md updated
|
|
260
|
+
✓ Breaking changes documented
|
|
261
|
+
✓ Test contracts generated
|
|
262
|
+
✓ Migration guide created
|
|
263
|
+
✓ All tests still passing
|
|
264
|
+
|
|
265
|
+
→ Ready to merge
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Skills Integration
|
|
271
|
+
|
|
272
|
+
Works alongside:
|
|
273
|
+
- **planning-skill**: Captures API requirements in plan
|
|
274
|
+
- **api-contract-skill**: Defines contracts before implementation
|
|
275
|
+
- **design-spec-skill**: Documents API design decisions
|
|
276
|
+
- **docs-skill**: Updates README and API docs
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Common Patterns
|
|
281
|
+
|
|
282
|
+
### Pattern: API Versioning
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
OLD (v1)
|
|
286
|
+
GET /api/users
|
|
287
|
+
|
|
288
|
+
NEW (v2)
|
|
289
|
+
GET /api/v2/users
|
|
290
|
+
|
|
291
|
+
Contract update:
|
|
292
|
+
- Keep v1 endpoint
|
|
293
|
+
- Mark as deprecated
|
|
294
|
+
- Point to v2 docs
|
|
295
|
+
- Set removal date
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Pattern: Endpoint Evolution
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
Phase 1: New parameter added
|
|
302
|
+
POST /api/resource → POST /api/resource?newParam=true
|
|
303
|
+
Contract: Mark parameter as optional
|
|
304
|
+
|
|
305
|
+
Phase 2: Parameter required
|
|
306
|
+
POST /api/resource?newParam=true
|
|
307
|
+
Contract: Mark parameter as required
|
|
308
|
+
|
|
309
|
+
Phase 3: Old behavior removed
|
|
310
|
+
POST /api/resource → now requires newParam
|
|
311
|
+
Contract: Break version, update contract
|
|
312
|
+
|
|
313
|
+
Clients get: 2 quarters to migrate
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Pattern: Error Code Addition
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
OLD
|
|
320
|
+
POST /api/payment
|
|
321
|
+
Error: 400 Bad Request
|
|
322
|
+
|
|
323
|
+
NEW
|
|
324
|
+
POST /api/payment
|
|
325
|
+
Errors:
|
|
326
|
+
- 400 Bad Request
|
|
327
|
+
- 402 Payment Required (NEW)
|
|
328
|
+
- 429 Too Many Requests (NEW)
|
|
329
|
+
|
|
330
|
+
Contract: Document all codes with examples
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Acceptance Checklist
|
|
336
|
+
|
|
337
|
+
- [ ] All endpoints extracted from code
|
|
338
|
+
- [ ] Request/response schemas defined
|
|
339
|
+
- [ ] HTTP methods correct
|
|
340
|
+
- [ ] Status codes complete
|
|
341
|
+
- [ ] Auth requirements documented
|
|
342
|
+
- [ ] Breaking changes identified and marked
|
|
343
|
+
- [ ] Test contracts generated
|
|
344
|
+
- [ ] All API tests passing
|
|
345
|
+
- [ ] Migration guide created (if needed)
|
|
346
|
+
- [ ] `.codebase/API_CONTRACTS.md` updated
|
|
347
|
+
- [ ] Documentation updated
|
|
348
|
+
- [ ] Version number incremented
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
**Last Updated**: 2026-05-30
|
|
353
|
+
**Maintained By**: Genesis Harness Team
|
|
354
|
+
**Version**: 1.0
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "API Sync Skill"
|
|
3
|
+
short_description: "Automatic API contract synchronization with implementation"
|
|
4
|
+
default_prompt: "Use $genesis-api-sync to synchronize API contracts with the current implementation and detect breaking changes."
|
|
5
|
+
|
|
6
|
+
policy:
|
|
7
|
+
allow_implicit_invocation: true
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# API Sync Checklist
|
|
2
|
+
|
|
3
|
+
**Use this after implementing API changes to verify sync is complete.**
|
|
4
|
+
|
|
5
|
+
## Pre-Sync Verification
|
|
6
|
+
|
|
7
|
+
- [ ] Implementation matches planned contract
|
|
8
|
+
- [ ] All tests passing
|
|
9
|
+
- [ ] Code review approved
|
|
10
|
+
- [ ] No TODOs or incomplete sections
|
|
11
|
+
|
|
12
|
+
## Contract Detection
|
|
13
|
+
|
|
14
|
+
- [ ] Run API endpoint scanner
|
|
15
|
+
```bash
|
|
16
|
+
./scripts/extract-api-contracts.sh
|
|
17
|
+
```
|
|
18
|
+
- [ ] Compare with current API_CONTRACTS.md
|
|
19
|
+
- [ ] Identify new/modified/deprecated endpoints
|
|
20
|
+
- [ ] Log all changes
|
|
21
|
+
|
|
22
|
+
## Breaking Change Assessment
|
|
23
|
+
|
|
24
|
+
For each changed endpoint:
|
|
25
|
+
- [ ] Does it break existing client code?
|
|
26
|
+
- [ ] Do request parameters change? (required fields added?)
|
|
27
|
+
- [ ] Do response fields change? (removed or changed structure?)
|
|
28
|
+
- [ ] Do error codes change?
|
|
29
|
+
- [ ] Does authentication requirement change?
|
|
30
|
+
|
|
31
|
+
**Result: List all breaking changes**
|
|
32
|
+
|
|
33
|
+
## Contract Update
|
|
34
|
+
|
|
35
|
+
- [ ] Add new endpoints to API_CONTRACTS.md
|
|
36
|
+
- [ ] Update modified endpoints with version info
|
|
37
|
+
- [ ] Mark deprecated endpoints with removal date
|
|
38
|
+
- [ ] Document all breaking changes
|
|
39
|
+
- [ ] Add migration guide if needed
|
|
40
|
+
- [ ] Update version number in contract
|
|
41
|
+
|
|
42
|
+
## Test Contract Generation
|
|
43
|
+
|
|
44
|
+
- [ ] Generate request/response validation schemas
|
|
45
|
+
- [ ] Create test fixtures for new endpoints
|
|
46
|
+
- [ ] Update test fixtures for modified endpoints
|
|
47
|
+
- [ ] Create deprecation warning tests
|
|
48
|
+
- [ ] Add error handling tests
|
|
49
|
+
- [ ] Add edge case tests
|
|
50
|
+
|
|
51
|
+
## Test Execution
|
|
52
|
+
|
|
53
|
+
- [ ] All API tests passing
|
|
54
|
+
- [ ] Contract validation tests passing
|
|
55
|
+
- [ ] Integration tests passing
|
|
56
|
+
- [ ] Backward compatibility tests (if v2+)
|
|
57
|
+
- [ ] Coverage report generated (target: 80%+)
|
|
58
|
+
|
|
59
|
+
## Documentation Updates
|
|
60
|
+
|
|
61
|
+
- [ ] API_CONTRACTS.md complete and accurate
|
|
62
|
+
- [ ] Examples updated
|
|
63
|
+
- [ ] Migration guide created (if breaking changes)
|
|
64
|
+
- [ ] README API section updated
|
|
65
|
+
- [ ] CHANGELOG.md entry added
|
|
66
|
+
- [ ] Version bumped (major/minor/patch)
|
|
67
|
+
|
|
68
|
+
## Codebase State Update
|
|
69
|
+
|
|
70
|
+
- [ ] .codebase/CURRENT_STATE.md updated
|
|
71
|
+
- [ ] .codebase/API_CONTRACTS.md verified matches
|
|
72
|
+
- [ ] .codebase/DEPENDENCY_GRAPH.md checked (new deps?)
|
|
73
|
+
- [ ] .codebase/KNOWN_PROBLEMS.md updated if issues found
|
|
74
|
+
|
|
75
|
+
## Migration Path Documentation
|
|
76
|
+
|
|
77
|
+
If breaking changes:
|
|
78
|
+
- [ ] Old endpoints documented as deprecated
|
|
79
|
+
- [ ] Removal timeline specified
|
|
80
|
+
- [ ] Migration steps documented
|
|
81
|
+
- [ ] Code examples provided for migration
|
|
82
|
+
- [ ] Timeline communicated to stakeholders
|
|
83
|
+
|
|
84
|
+
## Final Verification
|
|
85
|
+
|
|
86
|
+
- [ ] All changes tracked in git
|
|
87
|
+
- [ ] No uncommitted files
|
|
88
|
+
- [ ] PR description written with contract changes
|
|
89
|
+
- [ ] All checklists marked complete
|
|
90
|
+
- [ ] Ready for code review
|
|
91
|
+
|
|
92
|
+
## Sign-Off
|
|
93
|
+
|
|
94
|
+
- [ ] **API Owner**: ☐ Approved
|
|
95
|
+
- [ ] **Technical Lead**: ☐ Approved
|
|
96
|
+
- [ ] **QA**: ☐ Tested
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
**Date Completed**: _YYYY-MM-DD_
|
|
101
|
+
**Completed By**: _Name_
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Example: Sync API Contracts After Adding Payment Endpoint
|
|
2
|
+
|
|
3
|
+
## Scenario
|
|
4
|
+
|
|
5
|
+
A developer adds a new `POST /api/v2/payments` endpoint and updates the `GET /api/v2/payments/:id` response to include a `receiptUrl` field. After implementation is complete, contracts need to be synced.
|
|
6
|
+
|
|
7
|
+
## Trigger
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
invoke api-sync-skill
|
|
11
|
+
# Parameters:
|
|
12
|
+
# changed_files: ["src/api/handlers/paymentHandler.ts", "src/routes/payments.ts"]
|
|
13
|
+
# contract_file: ".codebase/API_CONTRACTS.md"
|
|
14
|
+
# breaking_changes: false
|
|
15
|
+
# version_bump: "minor"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Step 1: Change Detection
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
Scanning changed files...
|
|
22
|
+
|
|
23
|
+
Endpoint extracted: POST /api/v2/payments
|
|
24
|
+
Method: POST
|
|
25
|
+
Path: /api/v2/payments
|
|
26
|
+
Auth required: true
|
|
27
|
+
Request body: { amount, currency, paymentMethodId }
|
|
28
|
+
Response 201: { id, status, amount, currency, createdAt }
|
|
29
|
+
Response 400: { error, details }
|
|
30
|
+
Response 402: { error: "Payment required" }
|
|
31
|
+
Status: NEW
|
|
32
|
+
|
|
33
|
+
Endpoint modified: GET /api/v2/payments/:id
|
|
34
|
+
Added field: receiptUrl (optional, string)
|
|
35
|
+
Breaking: NO (new optional field)
|
|
36
|
+
Status: CHANGED
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Step 2: Contract Updated
|
|
40
|
+
|
|
41
|
+
**`.codebase/API_CONTRACTS.md`** updated:
|
|
42
|
+
- Added full specification for `POST /api/v2/payments`
|
|
43
|
+
- Updated `GET /api/v2/payments/:id` with new `receiptUrl` field
|
|
44
|
+
- Version bumped: `1.2.0 → 1.3.0`
|
|
45
|
+
|
|
46
|
+
## Step 3: Test Contracts Generated
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
// tests/contracts/payments.test.ts (auto-generated)
|
|
50
|
+
it('POST /api/v2/payments — creates payment', async () => {
|
|
51
|
+
const res = await request.post('/api/v2/payments').send({...});
|
|
52
|
+
expect(res.status).toBe(201);
|
|
53
|
+
expect(res.body).toHaveProperty('id');
|
|
54
|
+
expect(res.body).toHaveProperty('status');
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Outcome
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
✓ API_CONTRACTS.md updated (v1.2.0 → v1.3.0)
|
|
62
|
+
✓ 1 new endpoint documented
|
|
63
|
+
✓ 1 endpoint updated (non-breaking)
|
|
64
|
+
✓ Test contracts generated (3 new tests)
|
|
65
|
+
✓ All API tests passing (12/12)
|
|
66
|
+
✓ No breaking changes — no migration guide needed
|
|
67
|
+
→ Ready to merge
|
|
68
|
+
```
|