baldart 3.6.2
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/CHANGELOG.md +599 -0
- package/README.md +566 -0
- package/VERSION +1 -0
- package/bin/baldart.js +143 -0
- package/framework/.claude/agents/REGISTRY.md +169 -0
- package/framework/.claude/agents/api-perf-cost-auditor.md +291 -0
- package/framework/.claude/agents/code-reviewer.md +350 -0
- package/framework/.claude/agents/codebase-architect.md +391 -0
- package/framework/.claude/agents/coder.md +291 -0
- package/framework/.claude/agents/deep-human-insight.md +198 -0
- package/framework/.claude/agents/doc-reviewer.md +440 -0
- package/framework/.claude/agents/email-deliverability-architect.md +193 -0
- package/framework/.claude/agents/hybrid-ml-architect.md +285 -0
- package/framework/.claude/agents/hyper-gamification-designer.md +149 -0
- package/framework/.claude/agents/legal-counsel-gdpr.md +179 -0
- package/framework/.claude/agents/marketing-conversion-strategist.md +162 -0
- package/framework/.claude/agents/motion-expert.md +108 -0
- package/framework/.claude/agents/onboarding-architect-lead.md +230 -0
- package/framework/.claude/agents/plan-auditor.md +546 -0
- package/framework/.claude/agents/prd-card-writer.md +372 -0
- package/framework/.claude/agents/prd.md +744 -0
- package/framework/.claude/agents/qa-sentinel.md +305 -0
- package/framework/.claude/agents/remotion-animator-orchestrator.md +218 -0
- package/framework/.claude/agents/security-reviewer.md +276 -0
- package/framework/.claude/agents/senior-researcher.md +175 -0
- package/framework/.claude/agents/seo-analytics-strategist.md +156 -0
- package/framework/.claude/agents/skill-improver.md +61 -0
- package/framework/.claude/agents/ui-expert.md +191 -0
- package/framework/.claude/agents/visual-designer.md +190 -0
- package/framework/.claude/agents/website-orchestrator.md +118 -0
- package/framework/.claude/agents/wiki-curator.md +145 -0
- package/framework/.claude/commands/baldart-push.md +15 -0
- package/framework/.claude/commands/check.md +237 -0
- package/framework/.claude/commands/codexreview.md +203 -0
- package/framework/.claude/commands/design-review.md +11 -0
- package/framework/.claude/commands/issue-review.md +34 -0
- package/framework/.claude/commands/new.md +331 -0
- package/framework/.claude/commands/qa.md +257 -0
- package/framework/.claude/hooks/framework-edit-gate.js +208 -0
- package/framework/.claude/hooks/lint-before-commit.sh.template +66 -0
- package/framework/.claude/settings.local.json.example +32 -0
- package/framework/.claude/skills/api-design-principles/SKILL.md +567 -0
- package/framework/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/framework/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/framework/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/framework/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/framework/.claude/skills/baldart-push/SKILL.md +222 -0
- package/framework/.claude/skills/bug/SKILL.md +200 -0
- package/framework/.claude/skills/bug/references/logging-patterns.md +174 -0
- package/framework/.claude/skills/capture/SKILL.md +125 -0
- package/framework/.claude/skills/capture/references/synthesis-template.md +42 -0
- package/framework/.claude/skills/context-primer/SKILL.md +189 -0
- package/framework/.claude/skills/copywriting/SKILL.md +273 -0
- package/framework/.claude/skills/copywriting/references/copy-frameworks.md +338 -0
- package/framework/.claude/skills/copywriting/references/natural-transitions.md +252 -0
- package/framework/.claude/skills/doc-writing-for-rag/SKILL.md +119 -0
- package/framework/.claude/skills/doc-writing-for-rag/references/before-after-examples.md +291 -0
- package/framework/.claude/skills/doc-writing-for-rag/references/compact-templates.md +183 -0
- package/framework/.claude/skills/doc-writing-for-rag/references/frontmatter-minimal.md +112 -0
- package/framework/.claude/skills/doc-writing-for-rag/references/line-count-targets.md +110 -0
- package/framework/.claude/skills/doc-writing-for-rag/references/schemas-and-errors.md +129 -0
- package/framework/.claude/skills/find-skills/SKILL.md +133 -0
- package/framework/.claude/skills/frontend-design/LICENSE.txt +177 -0
- package/framework/.claude/skills/frontend-design/SKILL.md +84 -0
- package/framework/.claude/skills/gamification-design/SKILL.md +130 -0
- package/framework/.claude/skills/issue-review/SKILL.md +45 -0
- package/framework/.claude/skills/kie-ai/SKILL.md +262 -0
- package/framework/.claude/skills/kie-ai/references/models-catalog.md +272 -0
- package/framework/.claude/skills/kie-ai/scripts/kie_api.sh +209 -0
- package/framework/.claude/skills/kie-ai/scripts/remove_greenscreen.py +69 -0
- package/framework/.claude/skills/kie-ai/scripts/setup_api_key.sh +77 -0
- package/framework/.claude/skills/motion-design/LICENSE +21 -0
- package/framework/.claude/skills/motion-design/README.md +82 -0
- package/framework/.claude/skills/motion-design/SKILL.md +336 -0
- package/framework/.claude/skills/motion-design/director/choreography.md +93 -0
- package/framework/.claude/skills/motion-design/director/context-adaptation.md +83 -0
- package/framework/.claude/skills/motion-design/director/core-philosophy.md +53 -0
- package/framework/.claude/skills/motion-design/director/decision-framework.md +91 -0
- package/framework/.claude/skills/motion-design/director/disney-principles.md +102 -0
- package/framework/.claude/skills/motion-design/director/emotion-mapping.md +71 -0
- package/framework/.claude/skills/motion-design/director/motion-personality.md +89 -0
- package/framework/.claude/skills/motion-design/director/narrative-structure.md +62 -0
- package/framework/.claude/skills/motion-design/patterns/ambient-continuous.md +81 -0
- package/framework/.claude/skills/motion-design/patterns/entrance-exit.md +82 -0
- package/framework/.claude/skills/motion-design/patterns/multi-element.md +69 -0
- package/framework/.claude/skills/motion-design/patterns/state-feedback.md +96 -0
- package/framework/.claude/skills/motion-design/reference/property-selection.md +95 -0
- package/framework/.claude/skills/motion-design/reference/quality-checklist.md +67 -0
- package/framework/.claude/skills/motion-design/reference/timing-easing-tables.md +106 -0
- package/framework/.claude/skills/motion-design/reference/troubleshooting.md +73 -0
- package/framework/.claude/skills/new/SKILL.md +1687 -0
- package/framework/.claude/skills/playwright-skill/API_REFERENCE.md +652 -0
- package/framework/.claude/skills/playwright-skill/SKILL.md +157 -0
- package/framework/.claude/skills/playwright-skill/package.json +26 -0
- package/framework/.claude/skills/prd/SKILL.md +228 -0
- package/framework/.claude/skills/prd/assets/card-template.yml +232 -0
- package/framework/.claude/skills/prd/assets/epic-template.yml +190 -0
- package/framework/.claude/skills/prd/assets/prd-template.md +230 -0
- package/framework/.claude/skills/prd/assets/state-template.md +78 -0
- package/framework/.claude/skills/prd/references/api-perf-gate.md +152 -0
- package/framework/.claude/skills/prd/references/audit-phase.md +478 -0
- package/framework/.claude/skills/prd/references/backlog-phase.md +145 -0
- package/framework/.claude/skills/prd/references/discovery-phase.md +359 -0
- package/framework/.claude/skills/prd/references/impact-analysis.md +233 -0
- package/framework/.claude/skills/prd/references/prd-add-phase.md +214 -0
- package/framework/.claude/skills/prd/references/prd-writing-phase.md +145 -0
- package/framework/.claude/skills/prd/references/research-phase.md +216 -0
- package/framework/.claude/skills/prd/references/ui-design-phase.md +61 -0
- package/framework/.claude/skills/prd/references/validation-phase.md +72 -0
- package/framework/.claude/skills/prd-add/SKILL.md +222 -0
- package/framework/.claude/skills/prd-add/references/impact-analysis.md +233 -0
- package/framework/.claude/skills/remotion-best-practices/SKILL.md +48 -0
- package/framework/.claude/skills/remotion-best-practices/rules/3d.md +86 -0
- package/framework/.claude/skills/remotion-best-practices/rules/animations.md +29 -0
- package/framework/.claude/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
- package/framework/.claude/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
- package/framework/.claude/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +108 -0
- package/framework/.claude/skills/remotion-best-practices/rules/assets.md +78 -0
- package/framework/.claude/skills/remotion-best-practices/rules/audio.md +169 -0
- package/framework/.claude/skills/remotion-best-practices/rules/calculate-metadata.md +104 -0
- package/framework/.claude/skills/remotion-best-practices/rules/can-decode.md +75 -0
- package/framework/.claude/skills/remotion-best-practices/rules/charts.md +58 -0
- package/framework/.claude/skills/remotion-best-practices/rules/compositions.md +141 -0
- package/framework/.claude/skills/remotion-best-practices/rules/display-captions.md +184 -0
- package/framework/.claude/skills/remotion-best-practices/rules/extract-frames.md +229 -0
- package/framework/.claude/skills/remotion-best-practices/rules/fonts.md +152 -0
- package/framework/.claude/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
- package/framework/.claude/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
- package/framework/.claude/skills/remotion-best-practices/rules/get-video-duration.md +58 -0
- package/framework/.claude/skills/remotion-best-practices/rules/gifs.md +141 -0
- package/framework/.claude/skills/remotion-best-practices/rules/images.md +130 -0
- package/framework/.claude/skills/remotion-best-practices/rules/import-srt-captions.md +69 -0
- package/framework/.claude/skills/remotion-best-practices/rules/light-leaks.md +73 -0
- package/framework/.claude/skills/remotion-best-practices/rules/lottie.md +67 -0
- package/framework/.claude/skills/remotion-best-practices/rules/maps.md +401 -0
- package/framework/.claude/skills/remotion-best-practices/rules/measuring-dom-nodes.md +34 -0
- package/framework/.claude/skills/remotion-best-practices/rules/measuring-text.md +143 -0
- package/framework/.claude/skills/remotion-best-practices/rules/parameters.md +98 -0
- package/framework/.claude/skills/remotion-best-practices/rules/sequencing.md +118 -0
- package/framework/.claude/skills/remotion-best-practices/rules/subtitles.md +36 -0
- package/framework/.claude/skills/remotion-best-practices/rules/tailwind.md +11 -0
- package/framework/.claude/skills/remotion-best-practices/rules/text-animations.md +20 -0
- package/framework/.claude/skills/remotion-best-practices/rules/timing.md +179 -0
- package/framework/.claude/skills/remotion-best-practices/rules/transcribe-captions.md +70 -0
- package/framework/.claude/skills/remotion-best-practices/rules/transitions.md +197 -0
- package/framework/.claude/skills/remotion-best-practices/rules/transparent-videos.md +106 -0
- package/framework/.claude/skills/remotion-best-practices/rules/trimming.md +52 -0
- package/framework/.claude/skills/remotion-best-practices/rules/videos.md +171 -0
- package/framework/.claude/skills/seo-audit/SKILL.md +394 -0
- package/framework/.claude/skills/seo-audit/references/aeo-geo-patterns.md +279 -0
- package/framework/.claude/skills/seo-audit/references/ai-writing-detection.md +190 -0
- package/framework/.claude/skills/simplify/SKILL.md +137 -0
- package/framework/.claude/skills/skill-creator/LICENSE.txt +202 -0
- package/framework/.claude/skills/skill-creator/SKILL.md +356 -0
- package/framework/.claude/skills/skill-creator/references/output-patterns.md +82 -0
- package/framework/.claude/skills/skill-creator/references/workflows.md +28 -0
- package/framework/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
- package/framework/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/framework/.claude/skills/skill-creator/scripts/quick_validate.py +95 -0
- package/framework/.claude/skills/ui-design/SKILL.md +199 -0
- package/framework/.claude/skills/ui-design/references/component-discovery.md +54 -0
- package/framework/.claude/skills/ui-design/references/evaluation.md +171 -0
- package/framework/.claude/skills/ui-design/references/generation.md +109 -0
- package/framework/.claude/skills/ui-design/references/inventory.md +59 -0
- package/framework/.claude/skills/webapp-testing/LICENSE.txt +202 -0
- package/framework/.claude/skills/webapp-testing/SKILL.md +123 -0
- package/framework/.claude/skills/webapp-testing/examples/console_logging.py +35 -0
- package/framework/.claude/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/framework/.claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/framework/.claude/skills/webapp-testing/scripts/with_server.py +106 -0
- package/framework/.claude/skills/worktree-manager/SKILL.md +680 -0
- package/framework/AGENTS.md +240 -0
- package/framework/agents/api-contracts.md +137 -0
- package/framework/agents/architecture.md +145 -0
- package/framework/agents/coding-standards.md +148 -0
- package/framework/agents/data-model.md +110 -0
- package/framework/agents/deployment-protocol.md +232 -0
- package/framework/agents/design-review.md +172 -0
- package/framework/agents/env-reference.md +171 -0
- package/framework/agents/github-issue-subagent.md +252 -0
- package/framework/agents/index.md +261 -0
- package/framework/agents/llm-wiki-methodology.md +216 -0
- package/framework/agents/maintenance-protocol.md +305 -0
- package/framework/agents/observability.md +162 -0
- package/framework/agents/performance.md +155 -0
- package/framework/agents/project-context.md +145 -0
- package/framework/agents/runbook.md +208 -0
- package/framework/agents/security.md +168 -0
- package/framework/agents/skills-mapping.md +286 -0
- package/framework/agents/testing.md +111 -0
- package/framework/agents/workflows.md +215 -0
- package/framework/docs/PROJECT-CONFIGURATION.md +336 -0
- package/framework/docs/references/brand-guidelines.md +170 -0
- package/framework/docs/references/ui-guidelines.template.md +182 -0
- package/framework/routines/code-review.routine.yml +46 -0
- package/framework/routines/doc-review.routine.yml +45 -0
- package/framework/routines/ds-drift.routine.yml +52 -0
- package/framework/routines/full-sweep.routine.yml +51 -0
- package/framework/routines/index.yml +70 -0
- package/framework/routines/skill-improve.routine.yml +50 -0
- package/framework/routines/wiki-review.routine.yml +45 -0
- package/framework/templates/baldart.config.template.yml +113 -0
- package/framework/templates/breaking-change-checklist.md +484 -0
- package/framework/templates/feature-card.template.yml +125 -0
- package/framework/templates/overlays/README.md +44 -0
- package/framework/templates/overlays/copywriting.fidelity-example.md +62 -0
- package/framework/templates/overlays/ui-design.fidelity-example.md +75 -0
- package/framework/templates/skill-project-context.snippet.md +19 -0
- package/framework/templates/spec.template.md +208 -0
- package/package.json +51 -0
- package/src/commands/add.js +229 -0
- package/src/commands/configure.js +385 -0
- package/src/commands/doctor.js +486 -0
- package/src/commands/migrate.js +185 -0
- package/src/commands/push.js +0 -0
- package/src/commands/routines.js +269 -0
- package/src/commands/status.js +130 -0
- package/src/commands/update.js +419 -0
- package/src/commands/version.js +88 -0
- package/src/utils/contamination.js +400 -0
- package/src/utils/git.js +181 -0
- package/src/utils/hooks.js +152 -0
- package/src/utils/routine-adapters/claude-code-cloud.js +78 -0
- package/src/utils/routine-adapters/cron.js +138 -0
- package/src/utils/routine-adapters/github-actions.js +141 -0
- package/src/utils/routine-adapters/index.js +21 -0
- package/src/utils/routines.js +166 -0
- package/src/utils/state.js +143 -0
- package/src/utils/symlinks.js +425 -0
- package/src/utils/ui.js +133 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
# REST API Best Practices
|
|
2
|
+
|
|
3
|
+
## URL Structure
|
|
4
|
+
|
|
5
|
+
### Resource Naming
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
# Good - Plural nouns
|
|
9
|
+
GET /api/users
|
|
10
|
+
GET /api/orders
|
|
11
|
+
GET /api/products
|
|
12
|
+
|
|
13
|
+
# Bad - Verbs or mixed conventions
|
|
14
|
+
GET /api/getUser
|
|
15
|
+
GET /api/user (inconsistent singular)
|
|
16
|
+
POST /api/createOrder
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Nested Resources
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
# Shallow nesting (preferred)
|
|
23
|
+
GET /api/users/{id}/orders
|
|
24
|
+
GET /api/orders/{id}
|
|
25
|
+
|
|
26
|
+
# Deep nesting (avoid)
|
|
27
|
+
GET /api/users/{id}/orders/{orderId}/items/{itemId}/reviews
|
|
28
|
+
# Better:
|
|
29
|
+
GET /api/order-items/{id}/reviews
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## HTTP Methods and Status Codes
|
|
33
|
+
|
|
34
|
+
### GET - Retrieve Resources
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
GET /api/users → 200 OK (with list)
|
|
38
|
+
GET /api/users/{id} → 200 OK or 404 Not Found
|
|
39
|
+
GET /api/users?page=2 → 200 OK (paginated)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### POST - Create Resources
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
POST /api/users
|
|
46
|
+
Body: {"name": "John", "email": "john@example.com"}
|
|
47
|
+
→ 201 Created
|
|
48
|
+
Location: /api/users/123
|
|
49
|
+
Body: {"id": "123", "name": "John", ...}
|
|
50
|
+
|
|
51
|
+
POST /api/users (validation error)
|
|
52
|
+
→ 422 Unprocessable Entity
|
|
53
|
+
Body: {"errors": [...]}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### PUT - Replace Resources
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
PUT /api/users/{id}
|
|
60
|
+
Body: {complete user object}
|
|
61
|
+
→ 200 OK (updated)
|
|
62
|
+
→ 404 Not Found (doesn't exist)
|
|
63
|
+
|
|
64
|
+
# Must include ALL fields
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### PATCH - Partial Update
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
PATCH /api/users/{id}
|
|
71
|
+
Body: {"name": "Jane"} (only changed fields)
|
|
72
|
+
→ 200 OK
|
|
73
|
+
→ 404 Not Found
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### DELETE - Remove Resources
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
DELETE /api/users/{id}
|
|
80
|
+
→ 204 No Content (deleted)
|
|
81
|
+
→ 404 Not Found
|
|
82
|
+
→ 409 Conflict (can't delete due to references)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Filtering, Sorting, and Searching
|
|
86
|
+
|
|
87
|
+
### Query Parameters
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
# Filtering
|
|
91
|
+
GET /api/users?status=active
|
|
92
|
+
GET /api/users?role=admin&status=active
|
|
93
|
+
|
|
94
|
+
# Sorting
|
|
95
|
+
GET /api/users?sort=created_at
|
|
96
|
+
GET /api/users?sort=-created_at (descending)
|
|
97
|
+
GET /api/users?sort=name,created_at
|
|
98
|
+
|
|
99
|
+
# Searching
|
|
100
|
+
GET /api/users?search=john
|
|
101
|
+
GET /api/users?q=john
|
|
102
|
+
|
|
103
|
+
# Field selection (sparse fieldsets)
|
|
104
|
+
GET /api/users?fields=id,name,email
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Pagination Patterns
|
|
108
|
+
|
|
109
|
+
### Offset-Based Pagination
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
GET /api/users?page=2&page_size=20
|
|
113
|
+
|
|
114
|
+
Response:
|
|
115
|
+
{
|
|
116
|
+
"items": [...],
|
|
117
|
+
"page": 2,
|
|
118
|
+
"page_size": 20,
|
|
119
|
+
"total": 150,
|
|
120
|
+
"pages": 8
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Cursor-Based Pagination (for large datasets)
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
GET /api/users?limit=20&cursor=eyJpZCI6MTIzfQ
|
|
128
|
+
|
|
129
|
+
Response:
|
|
130
|
+
{
|
|
131
|
+
"items": [...],
|
|
132
|
+
"next_cursor": "eyJpZCI6MTQzfQ",
|
|
133
|
+
"has_more": true
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Link Header Pagination (RESTful)
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
GET /api/users?page=2
|
|
141
|
+
|
|
142
|
+
Response Headers:
|
|
143
|
+
Link: <https://api.example.com/users?page=3>; rel="next",
|
|
144
|
+
<https://api.example.com/users?page=1>; rel="prev",
|
|
145
|
+
<https://api.example.com/users?page=1>; rel="first",
|
|
146
|
+
<https://api.example.com/users?page=8>; rel="last"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Versioning Strategies
|
|
150
|
+
|
|
151
|
+
### URL Versioning (Recommended)
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
/api/v1/users
|
|
155
|
+
/api/v2/users
|
|
156
|
+
|
|
157
|
+
Pros: Clear, easy to route
|
|
158
|
+
Cons: Multiple URLs for same resource
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Header Versioning
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
GET /api/users
|
|
165
|
+
Accept: application/vnd.api+json; version=2
|
|
166
|
+
|
|
167
|
+
Pros: Clean URLs
|
|
168
|
+
Cons: Less visible, harder to test
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Query Parameter
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
GET /api/users?version=2
|
|
175
|
+
|
|
176
|
+
Pros: Easy to test
|
|
177
|
+
Cons: Optional parameter can be forgotten
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Rate Limiting
|
|
181
|
+
|
|
182
|
+
### Headers
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
X-RateLimit-Limit: 1000
|
|
186
|
+
X-RateLimit-Remaining: 742
|
|
187
|
+
X-RateLimit-Reset: 1640000000
|
|
188
|
+
|
|
189
|
+
Response when limited:
|
|
190
|
+
429 Too Many Requests
|
|
191
|
+
Retry-After: 3600
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Implementation Pattern
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
from fastapi import HTTPException, Request
|
|
198
|
+
from datetime import datetime, timedelta
|
|
199
|
+
|
|
200
|
+
class RateLimiter:
|
|
201
|
+
def __init__(self, calls: int, period: int):
|
|
202
|
+
self.calls = calls
|
|
203
|
+
self.period = period
|
|
204
|
+
self.cache = {}
|
|
205
|
+
|
|
206
|
+
def check(self, key: str) -> bool:
|
|
207
|
+
now = datetime.now()
|
|
208
|
+
if key not in self.cache:
|
|
209
|
+
self.cache[key] = []
|
|
210
|
+
|
|
211
|
+
# Remove old requests
|
|
212
|
+
self.cache[key] = [
|
|
213
|
+
ts for ts in self.cache[key]
|
|
214
|
+
if now - ts < timedelta(seconds=self.period)
|
|
215
|
+
]
|
|
216
|
+
|
|
217
|
+
if len(self.cache[key]) >= self.calls:
|
|
218
|
+
return False
|
|
219
|
+
|
|
220
|
+
self.cache[key].append(now)
|
|
221
|
+
return True
|
|
222
|
+
|
|
223
|
+
limiter = RateLimiter(calls=100, period=60)
|
|
224
|
+
|
|
225
|
+
@app.get("/api/users")
|
|
226
|
+
async def get_users(request: Request):
|
|
227
|
+
if not limiter.check(request.client.host):
|
|
228
|
+
raise HTTPException(
|
|
229
|
+
status_code=429,
|
|
230
|
+
headers={"Retry-After": "60"}
|
|
231
|
+
)
|
|
232
|
+
return {"users": [...]}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Authentication and Authorization
|
|
236
|
+
|
|
237
|
+
### Bearer Token
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
|
|
241
|
+
|
|
242
|
+
401 Unauthorized - Missing/invalid token
|
|
243
|
+
403 Forbidden - Valid token, insufficient permissions
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### API Keys
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
X-API-Key: your-api-key-here
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Error Response Format
|
|
253
|
+
|
|
254
|
+
### Consistent Structure
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"error": {
|
|
259
|
+
"code": "VALIDATION_ERROR",
|
|
260
|
+
"message": "Request validation failed",
|
|
261
|
+
"details": [
|
|
262
|
+
{
|
|
263
|
+
"field": "email",
|
|
264
|
+
"message": "Invalid email format",
|
|
265
|
+
"value": "not-an-email"
|
|
266
|
+
}
|
|
267
|
+
],
|
|
268
|
+
"timestamp": "2025-10-16T12:00:00Z",
|
|
269
|
+
"path": "/api/users"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Status Code Guidelines
|
|
275
|
+
|
|
276
|
+
- `200 OK`: Successful GET, PATCH, PUT
|
|
277
|
+
- `201 Created`: Successful POST
|
|
278
|
+
- `204 No Content`: Successful DELETE
|
|
279
|
+
- `400 Bad Request`: Malformed request
|
|
280
|
+
- `401 Unauthorized`: Authentication required
|
|
281
|
+
- `403 Forbidden`: Authenticated but not authorized
|
|
282
|
+
- `404 Not Found`: Resource doesn't exist
|
|
283
|
+
- `409 Conflict`: State conflict (duplicate email, etc.)
|
|
284
|
+
- `422 Unprocessable Entity`: Validation errors
|
|
285
|
+
- `429 Too Many Requests`: Rate limited
|
|
286
|
+
- `500 Internal Server Error`: Server error
|
|
287
|
+
- `503 Service Unavailable`: Temporary downtime
|
|
288
|
+
|
|
289
|
+
## Caching
|
|
290
|
+
|
|
291
|
+
### Cache Headers
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
# Client caching
|
|
295
|
+
Cache-Control: public, max-age=3600
|
|
296
|
+
|
|
297
|
+
# No caching
|
|
298
|
+
Cache-Control: no-cache, no-store, must-revalidate
|
|
299
|
+
|
|
300
|
+
# Conditional requests
|
|
301
|
+
ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"
|
|
302
|
+
If-None-Match: "33a64df551425fcc55e4d42a148795d9f25f89d4"
|
|
303
|
+
→ 304 Not Modified
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Bulk Operations
|
|
307
|
+
|
|
308
|
+
### Batch Endpoints
|
|
309
|
+
|
|
310
|
+
```python
|
|
311
|
+
POST /api/users/batch
|
|
312
|
+
{
|
|
313
|
+
"items": [
|
|
314
|
+
{"name": "User1", "email": "user1@example.com"},
|
|
315
|
+
{"name": "User2", "email": "user2@example.com"}
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
Response:
|
|
320
|
+
{
|
|
321
|
+
"results": [
|
|
322
|
+
{"id": "1", "status": "created"},
|
|
323
|
+
{"id": null, "status": "failed", "error": "Email already exists"}
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## Idempotency
|
|
329
|
+
|
|
330
|
+
### Idempotency Keys
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
POST /api/orders
|
|
334
|
+
Idempotency-Key: unique-key-123
|
|
335
|
+
|
|
336
|
+
If duplicate request:
|
|
337
|
+
→ 200 OK (return cached response)
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## CORS Configuration
|
|
341
|
+
|
|
342
|
+
```python
|
|
343
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
344
|
+
|
|
345
|
+
app.add_middleware(
|
|
346
|
+
CORSMiddleware,
|
|
347
|
+
allow_origins=["https://example.com"],
|
|
348
|
+
allow_credentials=True,
|
|
349
|
+
allow_methods=["*"],
|
|
350
|
+
allow_headers=["*"],
|
|
351
|
+
)
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Documentation with OpenAPI
|
|
355
|
+
|
|
356
|
+
```python
|
|
357
|
+
from fastapi import FastAPI
|
|
358
|
+
|
|
359
|
+
app = FastAPI(
|
|
360
|
+
title="My API",
|
|
361
|
+
description="API for managing users",
|
|
362
|
+
version="1.0.0",
|
|
363
|
+
docs_url="/docs",
|
|
364
|
+
redoc_url="/redoc"
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
@app.get(
|
|
368
|
+
"/api/users/{user_id}",
|
|
369
|
+
summary="Get user by ID",
|
|
370
|
+
response_description="User details",
|
|
371
|
+
tags=["Users"]
|
|
372
|
+
)
|
|
373
|
+
async def get_user(
|
|
374
|
+
user_id: str = Path(..., description="The user ID")
|
|
375
|
+
):
|
|
376
|
+
"""
|
|
377
|
+
Retrieve user by ID.
|
|
378
|
+
|
|
379
|
+
Returns full user profile including:
|
|
380
|
+
- Basic information
|
|
381
|
+
- Contact details
|
|
382
|
+
- Account status
|
|
383
|
+
"""
|
|
384
|
+
pass
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## Health and Monitoring Endpoints
|
|
388
|
+
|
|
389
|
+
```python
|
|
390
|
+
@app.get("/health")
|
|
391
|
+
async def health_check():
|
|
392
|
+
return {
|
|
393
|
+
"status": "healthy",
|
|
394
|
+
"version": "1.0.0",
|
|
395
|
+
"timestamp": datetime.now().isoformat()
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
@app.get("/health/detailed")
|
|
399
|
+
async def detailed_health():
|
|
400
|
+
return {
|
|
401
|
+
"status": "healthy",
|
|
402
|
+
"checks": {
|
|
403
|
+
"database": await check_database(),
|
|
404
|
+
"redis": await check_redis(),
|
|
405
|
+
"external_api": await check_external_api()
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
```
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: baldart-push
|
|
3
|
+
description: "Guidance for contributing local framework improvements upstream to the BALDART repository. Use when the user says /baldart-push, 'contribuisci al framework', 'push del framework', 'manda upstream', 'pusha le modifiche al framework', or wants to share local improvements made to .framework/. The skill walks the user through the contribution flow and hands off to `npx baldart push` (which must run in the user's terminal because the CLI is interactive). Never pushes baldart.config.yml, .baldart/overlays/, or .claude/hooks/ customizations — only generic framework payload."
|
|
4
|
+
contamination_scan: skip
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /baldart-push — Contribute upstream
|
|
8
|
+
|
|
9
|
+
Guide the user through a safe, contamination-aware contribution flow that
|
|
10
|
+
pushes local improvements made under `.framework/` (or new consumer-authored
|
|
11
|
+
skills in `.claude/skills/`) back to the BALDART upstream repository —
|
|
12
|
+
without leaking any project-specific path, identity, stack, or workflow
|
|
13
|
+
opinion.
|
|
14
|
+
|
|
15
|
+
## Execution model — IMPORTANT
|
|
16
|
+
|
|
17
|
+
This is a **guidance skill**, not an executor. The CLI command
|
|
18
|
+
`npx baldart push` is interactive (`inquirer` prompts) and **cannot run
|
|
19
|
+
through Claude Code's Bash tool** because there is no TTY: prompts would
|
|
20
|
+
hang silently. The skill therefore:
|
|
21
|
+
|
|
22
|
+
1. Runs *read-only* preview commands you CAN execute (`npx baldart version --offline`, contamination scans via the Node API).
|
|
23
|
+
2. Explains what each interactive prompt will ask.
|
|
24
|
+
3. **Asks the user to run `npx baldart push` in their own terminal.**
|
|
25
|
+
4. After they return with the output (or paste a transcript), narrates the result and suggests next steps.
|
|
26
|
+
|
|
27
|
+
If the user insists on running it through Claude, refuse politely and link to this section — running an interactive CLI without a TTY will simply hang. The configure flow works the same way.
|
|
28
|
+
|
|
29
|
+
## When to use
|
|
30
|
+
|
|
31
|
+
- The user invokes `/baldart-push`.
|
|
32
|
+
- The user says "contribuisci al framework", "pusha le modifiche al framework",
|
|
33
|
+
"manda upstream", "contribute these improvements".
|
|
34
|
+
- The user finished a session in which they edited `.framework/.../*.md`,
|
|
35
|
+
`framework/agents/*.md`, or wrote a new skill in `.claude/skills/<name>/`
|
|
36
|
+
that should become a framework skill.
|
|
37
|
+
|
|
38
|
+
## When NOT to use
|
|
39
|
+
|
|
40
|
+
- The user wants to commit code **inside the consumer repo** (use git directly).
|
|
41
|
+
- The user wants to install / update the framework (use `/baldart-update` /
|
|
42
|
+
`npx baldart update`).
|
|
43
|
+
- The user wants to author a project-specific overlay (it lives in
|
|
44
|
+
`.baldart/overlays/`, never pushed upstream).
|
|
45
|
+
- The user wants to author a project-specific skill that is NOT meant for
|
|
46
|
+
the framework — they keep it under `.claude/skills/<name>/`, do not run
|
|
47
|
+
this skill.
|
|
48
|
+
|
|
49
|
+
## Project Context
|
|
50
|
+
|
|
51
|
+
**Reads from `baldart.config.yml`:** none (this skill operates on the
|
|
52
|
+
framework's own contents, not the consumer's project context).
|
|
53
|
+
**Gated by features:** none.
|
|
54
|
+
**Overlay:** loads `.baldart/overlays/baldart-push.md` if present — typical
|
|
55
|
+
overlay content: extra contamination rules specific to the consumer's domain
|
|
56
|
+
(e.g. internal codenames, private endpoints).
|
|
57
|
+
**On missing/empty keys:** not applicable.
|
|
58
|
+
|
|
59
|
+
## Hard rules
|
|
60
|
+
|
|
61
|
+
1. **NEVER push** `baldart.config.yml`, anything under `.baldart/`, anything
|
|
62
|
+
under `.claude/hooks/` that is not the `.template` file. The CLI's triage
|
|
63
|
+
already excludes these; do not override the CLI on this point.
|
|
64
|
+
2. **NEVER bypass the contamination scan**, not even on user request. If the
|
|
65
|
+
user wants to force a token through, they choose "keep & force" in the
|
|
66
|
+
per-file review — that is the only acceptable bypass.
|
|
67
|
+
3. **NEVER skip the auto-pull-then-push step**. If the remote is ahead, the
|
|
68
|
+
CLI runs `update` first. If that update has conflicts, the push aborts
|
|
69
|
+
and the user resolves them by hand.
|
|
70
|
+
4. **NEVER commit secrets**. The CLI hard-blocks on patterns matching AWS
|
|
71
|
+
keys, bearer tokens, API keys, PEM private key headers. If the CLI blocks,
|
|
72
|
+
the skill MUST surface that to the user and STOP.
|
|
73
|
+
5. **NEVER fabricate a CHANGELOG entry beyond what the diff supports.** The
|
|
74
|
+
description the skill solicits from the user is one line; everything else
|
|
75
|
+
(Added/Changed/Removed file lists) comes from the diff itself.
|
|
76
|
+
6. **Always show the user the current framework version + remote drift**
|
|
77
|
+
BEFORE asking any other question. This is the centralised-versioning
|
|
78
|
+
requirement: the user must always know which version they are on and what
|
|
79
|
+
the push will bump it to.
|
|
80
|
+
|
|
81
|
+
## Workflow
|
|
82
|
+
|
|
83
|
+
### Step 0 — Version snapshot
|
|
84
|
+
|
|
85
|
+
Before doing anything else, run:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
npx baldart version
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
and surface its output to the user. They should see:
|
|
92
|
+
|
|
93
|
+
- Installed framework version (with install date)
|
|
94
|
+
- Remote drift (ahead / behind / clean)
|
|
95
|
+
- Uncommitted improvements count
|
|
96
|
+
- Last push (version + date)
|
|
97
|
+
|
|
98
|
+
If the user is on a stale version with `behind > 0`, warn them that the
|
|
99
|
+
push step will auto-update first (this is expected, not an error).
|
|
100
|
+
|
|
101
|
+
### Step 1 — Pre-flight scan (read-only, safe to run)
|
|
102
|
+
|
|
103
|
+
Before handing off, optionally surface what the CLI WILL find. This is purely
|
|
104
|
+
informational — no commits, no autofix.
|
|
105
|
+
|
|
106
|
+
Diff preview:
|
|
107
|
+
```bash
|
|
108
|
+
git diff --name-status origin/main..HEAD -- .framework/
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Contamination preview (Node one-liner — does not modify anything):
|
|
112
|
+
```bash
|
|
113
|
+
node -e "
|
|
114
|
+
const fs=require('fs'), path=require('path'), c=require('.framework/src/utils/contamination');
|
|
115
|
+
const { execSync } = require('child_process');
|
|
116
|
+
const files = execSync('git diff --name-status origin/main..HEAD -- .framework/').toString().trim().split('\n').filter(Boolean).map(l => l.split('\t').pop());
|
|
117
|
+
let totals = { autofixable:0, requiresDecision:0, blocking:0 };
|
|
118
|
+
for (const f of files) {
|
|
119
|
+
if (!fs.existsSync(f) || fs.lstatSync(f).isDirectory()) continue;
|
|
120
|
+
const { findings } = c.scan(fs.readFileSync(f, 'utf8'));
|
|
121
|
+
const s = c.summarise(findings);
|
|
122
|
+
totals.autofixable += s.autofixable;
|
|
123
|
+
totals.requiresDecision += s.requiresDecision;
|
|
124
|
+
totals.blocking += s.blocking;
|
|
125
|
+
if (s.total) console.log(f, JSON.stringify(s));
|
|
126
|
+
}
|
|
127
|
+
console.log('TOTAL', JSON.stringify(totals));
|
|
128
|
+
"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Use the preview to:
|
|
132
|
+
|
|
133
|
+
- Spot **blocking** findings early (secrets) — fix BEFORE running push.
|
|
134
|
+
- Show the user how much manual review is coming (requiresDecision count).
|
|
135
|
+
- Confirm the new-skill list (`ls -d .claude/skills/*/ | xargs -I{} sh -c 'test ! -L "{}" && echo {}'`).
|
|
136
|
+
|
|
137
|
+
### Step 2 — Hand off to the user's terminal
|
|
138
|
+
|
|
139
|
+
Ask the user to run:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npx baldart push
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**in their own terminal** (NOT through Claude Code Bash). The CLI will:
|
|
146
|
+
|
|
147
|
+
1. Pre-flight + framework existence check.
|
|
148
|
+
2. Auto-pull when remote is ahead (calls `baldart update`).
|
|
149
|
+
3. Pending-files discovery in `.framework/`.
|
|
150
|
+
4. New-skill discovery in `.claude/skills/` — prompts which to contribute.
|
|
151
|
+
5. Triage (pushable / blocked / docs).
|
|
152
|
+
6. Contamination scan → autofix paths → review identity/stack tokens.
|
|
153
|
+
7. Classification prompt (suggests MAJOR/MINOR/PATCH from diff).
|
|
154
|
+
8. Description prompt (1-line — used in commit + tag annotation + CHANGELOG).
|
|
155
|
+
9. VERSION bump + CHANGELOG entry insertion (auto).
|
|
156
|
+
10. Subtree push + annotated tag push.
|
|
157
|
+
11. `.baldart/state.json` update.
|
|
158
|
+
|
|
159
|
+
Do NOT re-implement this logic. The CLI is the source of truth.
|
|
160
|
+
|
|
161
|
+
### Step 3 — Explain each prompt BEFORE the user sees it
|
|
162
|
+
|
|
163
|
+
So the user knows what to choose, narrate the prompts that the CLI will pose:
|
|
164
|
+
|
|
165
|
+
- "5 autofixable findings" → "the CLI found 5 hardcoded paths I can safely
|
|
166
|
+
replace with `${paths.X}` references. Confirming will rewrite those lines
|
|
167
|
+
in place; the diff stays clean."
|
|
168
|
+
- "Review project-specific tokens" → "the CLI found tokens like `Neo-Brutalism`
|
|
169
|
+
that are project opinions. For each file, decide: **keep & force push**
|
|
170
|
+
(the token is generic enough in context), **skip the file** (leave it out
|
|
171
|
+
of the push — for newly-added files the CLI runs `git rm`; for modifications
|
|
172
|
+
it restores from `origin/main`), or **abort everything** (the CLI surfaces
|
|
173
|
+
the rollback SHA so you can `git reset --hard <sha>` and clean up by hand,
|
|
174
|
+
e.g. by moving the project-specific content into `.baldart/overlays/`)."
|
|
175
|
+
- "Suggested classification" → "the CLI inferred this from the diff: added
|
|
176
|
+
files → MINOR, only modified → PATCH, deleted → MAJOR. Confirm or override."
|
|
177
|
+
|
|
178
|
+
### Step 4 — Post-push report
|
|
179
|
+
|
|
180
|
+
After the user returns with the CLI output, summarise back to them:
|
|
181
|
+
|
|
182
|
+
- Version bump that happened (old → new).
|
|
183
|
+
- One-line description.
|
|
184
|
+
- Number of files pushed.
|
|
185
|
+
- Any new skills contributed.
|
|
186
|
+
- Tag pushed.
|
|
187
|
+
- Updated state file (`.baldart/state.json`).
|
|
188
|
+
|
|
189
|
+
Suggest the next step:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
Verify on GitHub: https://github.com/<repo>/releases/tag/v<new>
|
|
193
|
+
Update local installs in other consumer repos: npx baldart update
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Failure modes
|
|
197
|
+
|
|
198
|
+
| Symptom | Cause | What you do |
|
|
199
|
+
|---|---|---|
|
|
200
|
+
| CLI hard-blocks on "secret detected" | Pattern looks like AWS key / bearer / PEM | STOP. Surface the offending line to the user. Ask them to remove it from `.framework/` and re-run. Do not attempt to bypass. |
|
|
201
|
+
| `baldart update` (called automatically) fails with conflict | Remote diverged | STOP. Print the conflict files. The user resolves manually, commits, then re-runs `/baldart-push`. |
|
|
202
|
+
| User refuses autofix | Authoring decision | Continue, but warn that hardcoded paths in upstream will likely be rejected on review. |
|
|
203
|
+
| User aborts during the per-file review | Authoring decision | Surface that the autofix commits are still in their working copy. They can undo via `git reset HEAD~1` if they want to discard them. |
|
|
204
|
+
| Tag push fails (auth issue) | Subtree push went through but tag did not | Surface the tag name. User pushes manually with `git push origin v<X.Y.Z>`. The release is recoverable. |
|
|
205
|
+
| `state.json` write fails | Disk / permissions | Non-fatal. Surface as a warning; the rest of the push succeeded. |
|
|
206
|
+
|
|
207
|
+
## Why this skill exists
|
|
208
|
+
|
|
209
|
+
Before v3.1.0, contributing back required: remembering to update VERSION by
|
|
210
|
+
hand, hand-writing a CHANGELOG entry, classifying severity without
|
|
211
|
+
suggestion, running `git tag` manually, and — most importantly — relying on
|
|
212
|
+
human discipline to NOT push hardcoded fidelity-app paths into the upstream
|
|
213
|
+
framework. The first two are tedium; the last is the single biggest source
|
|
214
|
+
of v2.x → v3.0.0 cleanup work.
|
|
215
|
+
|
|
216
|
+
This skill makes the contribution loop:
|
|
217
|
+
|
|
218
|
+
1. **Fast** (auto bump, auto CHANGELOG, auto tag).
|
|
219
|
+
2. **Safe** (contamination scan + autofix gate before any commit).
|
|
220
|
+
3. **Visible** (centralised versioning via `state.json`, version-aware UI).
|
|
221
|
+
4. **Conversational** (the user understands every step, has a chance to
|
|
222
|
+
abort, and the result is auditable).
|