@the-bearded-bear/claude-craft 8.21.0 → 8.22.0-next.63d46da
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/Dev/i18n/base/Common/commands/aliases.md +3 -0
- package/Dev/i18n/base/Common/commands/audit-claude-alignment.md +201 -0
- package/Dev/i18n/base/Common/commands/search.md +2 -1
- package/Dev/i18n/base/Vercel/checklists/new-feature.md +75 -0
- package/Dev/i18n/base/Vercel/checklists/pre-commit.md +59 -0
- package/Dev/i18n/base/Vercel/commands/check-architecture.md +152 -0
- package/Dev/i18n/base/Vercel/commands/check-code-quality.md +154 -0
- package/Dev/i18n/base/Vercel/commands/check-security.md +197 -0
- package/Dev/i18n/base/Vercel/commands/check-testing.md +189 -0
- package/Dev/i18n/base/Vercel/commands/deploy-config.md +134 -0
- package/Dev/i18n/base/Vercel/rules/00-project-context.md.template +133 -0
- package/Dev/i18n/base/Vercel/rules/02-architecture-vercel.md +228 -0
- package/Dev/i18n/base/Vercel/rules/03-coding-standards.md +180 -0
- package/Dev/i18n/base/Vercel/rules/06-tooling.md +149 -0
- package/Dev/i18n/base/Vercel/rules/07-testing-vercel.md +177 -0
- package/Dev/i18n/base/Vercel/rules/08-quality-tools.md +190 -0
- package/Dev/i18n/base/Vercel/rules/11-security-vercel.md +156 -0
- package/Dev/i18n/base/Vercel/templates/function-handler.template.ts +68 -0
- package/Dev/i18n/base/Vercel/templates/vercel.json.template +84 -0
- package/Dev/i18n/de/Vercel/CLAUDE.md.template +83 -0
- package/Dev/i18n/de/Vercel/agents/vercel-reviewer.md +841 -0
- package/Dev/i18n/de/Vercel/commands/check-compliance.md +281 -0
- package/Dev/i18n/en/Vercel/CLAUDE.md.template +83 -0
- package/Dev/i18n/en/Vercel/agents/vercel-reviewer.md +821 -0
- package/Dev/i18n/en/Vercel/commands/check-compliance.md +281 -0
- package/Dev/i18n/es/Vercel/CLAUDE.md.template +83 -0
- package/Dev/i18n/es/Vercel/agents/vercel-reviewer.md +832 -0
- package/Dev/i18n/es/Vercel/commands/check-compliance.md +280 -0
- package/Dev/i18n/fr/Vercel/CLAUDE.md.template +83 -0
- package/Dev/i18n/fr/Vercel/agents/vercel-reviewer.md +861 -0
- package/Dev/i18n/fr/Vercel/commands/check-compliance.md +280 -0
- package/Dev/i18n/pt/Vercel/CLAUDE.md.template +83 -0
- package/Dev/i18n/pt/Vercel/agents/vercel-reviewer.md +827 -0
- package/Dev/i18n/pt/Vercel/commands/check-compliance.md +281 -0
- package/Dev/scripts/install-vercel-rules.sh +185 -0
- package/README.md +4 -3
- package/bundles/cursor/.cursorrules +6 -2
- package/bundles/windsurf/.windsurfrules +6 -2
- package/cli/lib/tech-registry.js +10 -0
- package/package.json +2 -1
|
@@ -19,6 +19,7 @@ These aliases reduce typing and improve productivity by providing short mnemonic
|
|
|
19
19
|
| Alias | Full Command | Description |
|
|
20
20
|
|-------|-------------|-------------|
|
|
21
21
|
| `/ca` | `/common:audit-freshness` | Audit documentation freshness |
|
|
22
|
+
| `/caa` | `/common:audit-claude-alignment` | Weekly Claude ecosystem alignment audit |
|
|
22
23
|
| `/ci` | `/common:init` | Initialize Claude Craft |
|
|
23
24
|
| `/cr` | `/common:release-checklist` | Pre-release verification checklist |
|
|
24
25
|
| `/cs` | `/common:setup-project-context` | Setup project context for Claude |
|
|
@@ -123,6 +124,7 @@ Add to `~/.bashrc` or `~/.zshrc`:
|
|
|
123
124
|
```bash
|
|
124
125
|
# Claude Craft Aliases
|
|
125
126
|
alias ca='claude-code -p /common:audit-freshness'
|
|
127
|
+
alias caa='claude-code -p /common:audit-claude-alignment'
|
|
126
128
|
alias ci='claude-code -p /common:init'
|
|
127
129
|
alias cr='claude-code -p /common:release-checklist'
|
|
128
130
|
alias cs='claude-code -p /common:setup-project-context'
|
|
@@ -156,6 +158,7 @@ Add to `~/.config/fish/config.fish`:
|
|
|
156
158
|
```fish
|
|
157
159
|
# Claude Craft Aliases
|
|
158
160
|
alias ca 'claude-code -p /common:audit-freshness'
|
|
161
|
+
alias caa 'claude-code -p /common:audit-claude-alignment'
|
|
159
162
|
alias ci 'claude-code -p /common:init'
|
|
160
163
|
alias cr 'claude-code -p /common:release-checklist'
|
|
161
164
|
alias cs 'claude-code -p /common:setup-project-context'
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Audit hebdomadaire d'alignement sur l'écosystème Claude (CLI, modèles, best practices Anthropic, communauté) via équipe d'agents + PR de correction"
|
|
3
|
+
argument-hint: "[--quick|--full] [--lens=<nom>] [--since=YYYY-MM-DD] [--dry-run] [--no-pr]"
|
|
4
|
+
model: sonnet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Audit d'alignement Claude — claude-craft
|
|
8
|
+
|
|
9
|
+
Vérifie que claude-craft reste aligné sur l'état réel de l'écosystème Claude : version du CLI Claude Code, modèles et pricing, best practices Anthropic, features de la plateforme, avis de sécurité, et pratiques de la communauté.
|
|
10
|
+
|
|
11
|
+
Complémentaire de `/common:audit-freshness`, qui couvre les stacks applicatifs (React, Symfony, Flutter…) et **jamais Claude Code lui-même**.
|
|
12
|
+
|
|
13
|
+
**Résultat :** rapport `docs/audit/claude-alignment/<date>.md` + `<date>.json`, et une **PR** portant uniquement les corrections mécaniques. Tout ce qui demande un jugement part en checklist dans le corps de la PR, jamais en édition automatique.
|
|
14
|
+
|
|
15
|
+
## Arguments
|
|
16
|
+
|
|
17
|
+
$ARGUMENTS
|
|
18
|
+
|
|
19
|
+
- `--quick` (défaut) : n'audite que les lentilles dont la source externe a bougé depuis la baseline
|
|
20
|
+
- `--full` : force les 7 lentilles, effort `high` sur sécurité et modèles — cadence mensuelle
|
|
21
|
+
- `--lens=<nom>` : une seule lentille (`cli-release`, `models-pricing`, `prompt-context`, `cc-features`, `security-cve`, `community`, `internal-conformance`)
|
|
22
|
+
- `--since=YYYY-MM-DD` : force la date de baseline — rattrapage après un trou de cadence
|
|
23
|
+
- `--dry-run` : pré-collecte + liste des agents qui seraient lancés. **Aucun agent, aucune écriture**
|
|
24
|
+
- `--no-pr` : rapport seul, ni branche ni PR
|
|
25
|
+
|
|
26
|
+
## MISSION
|
|
27
|
+
|
|
28
|
+
### Étape 0 — Pré-vol et pré-collecte
|
|
29
|
+
|
|
30
|
+
1. **Worktree propre obligatoire.** `git status --porcelain` ; si la sortie n'est pas vide, **arrêter** et le signaler. Des agents d'audit ont déjà pollué le worktree par le passé — on ne construit pas une PR par-dessus des modifications non validées.
|
|
31
|
+
2. Lancer la pré-collecte déterministe (coût LLM nul) :
|
|
32
|
+
```bash
|
|
33
|
+
node scripts/collect-claude-signals.mjs [--since=<date>] [--dry-run]
|
|
34
|
+
```
|
|
35
|
+
Elle lit `config/claude-alignment-baseline.json`, interroge le registry npm, les avis de sécurité GitHub, le catalogue communautaire et les pages de doc suivies par empreinte, puis écrit `docs/audit/claude-alignment/signals-<date>.json`.
|
|
36
|
+
3. Lire ce fichier. Le champ **`agents_to_launch`** est la liste exacte des lentilles à réveiller. Une lentille absente n'est **pas** auditée : écrire `✅ aucun changement depuis <baseline.last_run>` dans le rapport, sans lancer d'agent. C'est le principal levier de coût de cette commande.
|
|
37
|
+
4. Calculer l'âge du dernier run (`baseline.last_run` → aujourd'hui). Au-delà de **10 jours**, ouvrir le rapport par un avertissement de cadence.
|
|
38
|
+
5. En `--full`, ignorer `agents_to_launch` et retenir les 7 lentilles. En `--lens=<nom>`, ne retenir que celle-là. En `--dry-run`, s'arrêter ici en affichant la liste retenue et le coût estimé.
|
|
39
|
+
|
|
40
|
+
### Étape 1 — Gates locaux (0 token)
|
|
41
|
+
|
|
42
|
+
Lancer, et consigner le résultat de chacun dans le rapport :
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run lint:versions # cohérence tech-registry ↔ versions.yaml + denylist dans les fichiers vitrine
|
|
46
|
+
npm run lint:includes # liens @<path> fantômes
|
|
47
|
+
npm run docs:check # dérive des références générées
|
|
48
|
+
npm run lint:i18n # parité i18n (comptage + taille)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Un gate rouge est un finding **P1** au minimum. Ne pas le corriger ici : il alimente le patch-plan de l'étape 3.
|
|
52
|
+
|
|
53
|
+
### Étape 2 — Équipe d'agents (un seul message, N appels Task en parallèle)
|
|
54
|
+
|
|
55
|
+
Lancer **en un seul message** un agent par lentille retenue. Le routing modèle n'est pas négociable : il est ce qui rend l'audit hebdomadaire soutenable.
|
|
56
|
+
|
|
57
|
+
| Lentille | `subagent_type` | `model` | `effort` |
|
|
58
|
+
|---|---|---|---|
|
|
59
|
+
| `cli-release` | `general-purpose` | `sonnet` | `medium` |
|
|
60
|
+
| `models-pricing` | `general-purpose` | `sonnet` | `medium` (`high` en `--full`) |
|
|
61
|
+
| `cc-features` | `claude-code-guide` | *(défaut de l'agent)* | — |
|
|
62
|
+
| `prompt-context` | `general-purpose` | `sonnet` | `medium` |
|
|
63
|
+
| `security-cve` | `general-purpose` | `sonnet` | `medium` (`high` en `--full`) |
|
|
64
|
+
| `community` | `general-purpose` | `sonnet` | `medium` |
|
|
65
|
+
| `internal-conformance` | `general-purpose` | `haiku` | `low` |
|
|
66
|
+
|
|
67
|
+
`internal-conformance` est un scan mécanique 100 % local : son prompt lui **interdit explicitement** WebSearch et WebFetch. Les six autres reçoivent les URLs exactes issues de `signals-<date>.json` — ils font du WebFetch ciblé, pas de la découverte par WebSearch (non déterministe et multi-requêtes).
|
|
68
|
+
|
|
69
|
+
**Socle commun à injecter dans chaque prompt d'agent :**
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Tu audites la lentille "<LENTILLE>" du dépôt claude-craft (framework Claude Code, v<version de package.json>).
|
|
73
|
+
|
|
74
|
+
CONTEXTE PRÉ-COLLECTÉ (ne pas re-chercher ce qui est déjà donné) :
|
|
75
|
+
<coller le bloc lenses["<LENTILLE>"] de docs/audit/claude-alignment/signals-<date>.json>
|
|
76
|
+
Baseline du dernier audit : <baseline.last_run>
|
|
77
|
+
|
|
78
|
+
ÉTAPES :
|
|
79
|
+
1. Lire les fichiers du dépôt listés ci-dessous : <PATHS>
|
|
80
|
+
2. Confronter au réel via les sources fournies (WebFetch sur les URLs exactes ci-dessus).
|
|
81
|
+
Ne remonter QUE ce qui a changé depuis la baseline.
|
|
82
|
+
3. Retourner EXACTEMENT ce format (< 300 mots) :
|
|
83
|
+
|
|
84
|
+
## <LENTILLE>
|
|
85
|
+
- **État déclaré dans le repo** : <valeur> (source: <path>:<ligne>)
|
|
86
|
+
- **État réel observé** : <valeur> (source: <URL>)
|
|
87
|
+
- **Écart** : aucun | mineur | majeur | critique
|
|
88
|
+
- **Findings** :
|
|
89
|
+
- [<sévérité P0-P3>] <constat> — source: <URL>
|
|
90
|
+
- **PATCH** : (uniquement les substitutions mécaniques sûres, une par ligne)
|
|
91
|
+
- <chemin> | <valeur actuelle> | <valeur cible> | <raison>
|
|
92
|
+
- **JUGEMENT REQUIS** : (ce qui demande un arbitrage humain, jamais de PATCH)
|
|
93
|
+
- <point> — pourquoi ça ne peut pas être automatisé
|
|
94
|
+
|
|
95
|
+
CONTRAINTES :
|
|
96
|
+
- Citer une source pour CHAQUE affirmation. Si une info est introuvable, écrire "non trouvé".
|
|
97
|
+
- Ne rien inventer, ne pas extrapoler une version depuis un numéro voisin.
|
|
98
|
+
- Ne JAMAIS modifier un fichier. Tu es en lecture seule.
|
|
99
|
+
- Un PATCH n'est légitime que si la substitution est littérale et sans ambiguïté
|
|
100
|
+
(numéro de version, identifiant de modèle, date). Toute reformulation de prose
|
|
101
|
+
va en JUGEMENT REQUIS.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Cibles par lentille :**
|
|
105
|
+
|
|
106
|
+
| Lentille | Fichiers du dépôt à confronter |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `cli-release` | `config/versions.yaml` (`claudeCode.*`), `.claude/COMPATIBILITY.md`, `.claude/rules/12-context-management.md`, `docs/PREREQUISITES.md` |
|
|
109
|
+
| `models-pricing` | `config/versions.yaml` (`claudeCode.models`, `denylist`), `.claude/rules/12-context-management.md`, `.claude/settings.json`, `.claude/settings.local.json.example` — charger le skill `claude-api` pour la référence modèles/pricing |
|
|
110
|
+
| `cc-features` | `.claude/COMPATIBILITY.md`, `.claude/settings.json`, `.claude-plugin/plugin.json`, `.claude/agents/*.md`, `.claude/skills/*/SKILL.md` — identifier les features de la plateforme non encore adoptées |
|
|
111
|
+
| `prompt-context` | `.claude/rules/12-context-management.md`, `.claude/rules/23-karpathy-principles.md`, `.claude/CLAUDE.md` |
|
|
112
|
+
| `security-cve` | `.claude/rules/11-security.md`, `.claude/settings.json` (permissions), `.claude/COMPATIBILITY.md` (section CVE) |
|
|
113
|
+
| `community` | `.claude/skills/ecosystem-tools/SKILL.md`, `docs/ECOSYSTEM.md` |
|
|
114
|
+
| `internal-conformance` | Les 3 inventaires : `.claude/agents/*.md`, `.claude/skills/*/SKILL.md`, `.claude/commands/**/*.md`. Vérifier : frontmatter YAML parsable et `description` non vide ; `context: fork` présent sur tout skill de plus de 60 lignes ; cohérence `model:`/`effort:` (un agent `haiku` ne doit pas être en `effort: xhigh`) ; hooks lisant leur payload sur **stdin via `jq`** et jamais via `$TOOL_INPUT` ; aucun token de `denylist` hors fichiers vitrine |
|
|
115
|
+
|
|
116
|
+
### Étape 3 — Synthèse, rapport, patch-plan
|
|
117
|
+
|
|
118
|
+
1. Agréger les retours. Un agent qui a échoué laisse `⚠️ audit incomplet : <raison>` — ne jamais inventer sa section.
|
|
119
|
+
2. Écrire `docs/audit/claude-alignment/<date>.md` :
|
|
120
|
+
|
|
121
|
+
```markdown
|
|
122
|
+
# Audit d'alignement Claude — <date>
|
|
123
|
+
|
|
124
|
+
**Version claude-craft** : <package.json>
|
|
125
|
+
**Mode** : quick | full
|
|
126
|
+
**Baseline** : <date> (<N> jours) <⚠️ si > 10 jours>
|
|
127
|
+
**Lentilles auditées** : <n>/7 — <liste> (les autres inchangées depuis la baseline)
|
|
128
|
+
|
|
129
|
+
## Résumé exécutif
|
|
130
|
+
|
|
131
|
+
| Sévérité | Nombre |
|
|
132
|
+
|----------|--------|
|
|
133
|
+
| 🔴 P0 | N |
|
|
134
|
+
| 🟠 P1 | N |
|
|
135
|
+
| 🟡 P2 | N |
|
|
136
|
+
| 🔵 P3 | N |
|
|
137
|
+
|
|
138
|
+
## Gates locaux
|
|
139
|
+
|
|
140
|
+
| Gate | Résultat |
|
|
141
|
+
|------|----------|
|
|
142
|
+
| lint:versions | ✅ / ❌ <extrait> |
|
|
143
|
+
| lint:includes | … |
|
|
144
|
+
| docs:check | … |
|
|
145
|
+
| lint:i18n | … |
|
|
146
|
+
|
|
147
|
+
## Findings par lentille
|
|
148
|
+
<coller chaque rapport d'agent>
|
|
149
|
+
|
|
150
|
+
## Patch-plan appliqué
|
|
151
|
+
| Fichier | Avant | Après | Raison |
|
|
152
|
+
|---|---|---|---|
|
|
153
|
+
|
|
154
|
+
## Jugement humain requis
|
|
155
|
+
- [ ] <point> — <pourquoi>
|
|
156
|
+
|
|
157
|
+
## Méthodologie
|
|
158
|
+
- Pré-collecte : `scripts/collect-claude-signals.mjs` (npm registry, GitHub advisories, empreintes de pages, catalogue communautaire)
|
|
159
|
+
- Agents : <n> (routing sonnet/haiku documenté dans la commande)
|
|
160
|
+
- Sources : toutes citées dans les sections ci-dessus
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
3. Écrire le jumeau structuré `docs/audit/claude-alignment/<date>.json` : `{ audit_date, mode, baseline, lenses{}, summary{P0..P3}, patch_plan[], human_decisions_required[], gates{} }`.
|
|
164
|
+
|
|
165
|
+
### Étape 4 — Branche et PR
|
|
166
|
+
|
|
167
|
+
Sauter entièrement cette étape si `--no-pr`, `--dry-run`, ou si le patch-plan est vide.
|
|
168
|
+
|
|
169
|
+
1. `git checkout -b chore/claude-alignment-<date>` depuis `main` à jour.
|
|
170
|
+
2. Appliquer **uniquement** les entrées du patch-plan, et **uniquement** dans l'allowlist :
|
|
171
|
+
- `config/versions.yaml` — `claudeCode.recommended|testedUpTo|models.*`, `meta.lastUpdated`, ajouts en `denylist`
|
|
172
|
+
- `.claude/COMPATIBILITY.md` — bandeau d'en-tête et ajout de lignes dans la table `Version Requirements`
|
|
173
|
+
- Substitutions de version littérales dans les fichiers de `SHOWCASE_FILES` (`scripts/verify-versions.mjs`)
|
|
174
|
+
- `Dev/i18n/<lang>/Common/templates/settings.json.template` et `Dev/i18n/<lang>/Common/rules/12-context-management.md` (les 5 langues, en une seule passe cohérente)
|
|
175
|
+
- `config/claude-alignment-baseline.json` — remplacer par `next_baseline` du fichier de signaux
|
|
176
|
+
3. **Interdit, sans exception** : `.github/workflows/` (le token `gh` n'a pas le scope `workflow`, la PR deviendrait non mergeable), tout fichier hors allowlist, toute reformulation de prose, tout fichier `.md` de documentation générée (`docs/*-FULL-REFERENCE.md` : passer par `npm run docs:generate`).
|
|
177
|
+
4. Rejouer les 4 gates. **Un seul rouge ⇒ pas de PR** : laisser la branche en place et l'expliquer dans le rapport.
|
|
178
|
+
5. `git add` limité aux fichiers de l'allowlist effectivement modifiés, puis commit en Conventional Commits :
|
|
179
|
+
`chore(alignment): sync Claude Code <ancienne> → <nouvelle> + modèles`
|
|
180
|
+
6. `gh pr create` avec, dans le corps : le résumé exécutif, le tableau du patch-plan, et la checklist « jugement humain requis ». **Jamais de merge automatique.**
|
|
181
|
+
7. Revenir sur `main` et confirmer à l'utilisateur l'URL de la PR.
|
|
182
|
+
|
|
183
|
+
## Règles strictes
|
|
184
|
+
|
|
185
|
+
- **Worktree propre** en préalable absolu ; sinon, arrêt immédiat.
|
|
186
|
+
- **Aucune édition hors allowlist**, et aucune édition du tout tant que les gates ne sont pas verts.
|
|
187
|
+
- **Toute affirmation de version cite une source** (URL ou `path:ligne`).
|
|
188
|
+
- **Fail-open assumé** : une source injoignable rend la lentille « à auditer », jamais « rien à signaler ».
|
|
189
|
+
- **Un agent en échec** laisse `⚠️ audit incomplet : <raison>` — pas de section inventée.
|
|
190
|
+
- **Parallélisme obligatoire** : un seul message contenant tous les appels Task de l'étape 2.
|
|
191
|
+
- **Langue du rapport** : français, avec accents.
|
|
192
|
+
|
|
193
|
+
## Exemples
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
/common:audit-claude-alignment # rituel hebdomadaire
|
|
197
|
+
/common:audit-claude-alignment --dry-run # quelles lentilles bougeraient ? coût nul
|
|
198
|
+
/common:audit-claude-alignment --full # passage mensuel approfondi
|
|
199
|
+
/common:audit-claude-alignment --lens=cli-release --no-pr
|
|
200
|
+
/common:audit-claude-alignment --since=2026-06-30 # rattrapage après un trou de cadence
|
|
201
|
+
```
|
|
@@ -102,7 +102,8 @@ When a user invokes `/common:search <keyword>`:
|
|
|
102
102
|
| `architecture` | architecture skill, @database-architect |
|
|
103
103
|
| `react` | /react:* commands, @react-reviewer |
|
|
104
104
|
| `symfony` | /symfony:* commands, @symfony-reviewer |
|
|
105
|
-
| `audit` | /team:audit, /common:audit-freshness |
|
|
105
|
+
| `audit` | /team:audit, /common:audit-freshness, /common:audit-claude-alignment |
|
|
106
|
+
| `claude code` | /common:audit-claude-alignment, .claude/COMPATIBILITY.md |
|
|
106
107
|
| `workflow` | /workflow:* commands, workflow-analysis skill |
|
|
107
108
|
|
|
108
109
|
---
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Vercel New Feature Checklist
|
|
2
|
+
|
|
3
|
+
> Covers adding a new Serverless Function, Cron Job, or platform-level config change. For the framework running on top of Vercel (Next.js, etc.), see that stack's own new-feature checklist — this covers **only** the Vercel-platform surface.
|
|
4
|
+
|
|
5
|
+
## Before Starting
|
|
6
|
+
|
|
7
|
+
- [ ] **Requirements clear** - expected behavior and acceptance criteria defined
|
|
8
|
+
- [ ] **Project shape identified** - static+rewrites / Serverless Functions / ISR-enabled / Cron+Scheduled (see `02-architecture-vercel.md`)
|
|
9
|
+
- [ ] **Ownership checked** - if a claude-craft framework stack already owns routing/caching for this concern, defer to it rather than adding a competing `vercel.json` entry (see the decision tree in `02-architecture-vercel.md`)
|
|
10
|
+
|
|
11
|
+
## Runtime Decision
|
|
12
|
+
|
|
13
|
+
- [ ] **Node.js runtime (Fluid Compute) chosen by default** - no explicit `runtime` export needed
|
|
14
|
+
- [ ] **Edge Runtime only chosen for an explicit, justified reason** - documented in a code comment at the top of the handler (e.g. genuine sub-Node-cold-start geo-routing need); never chosen by default or "for consistency" with older code
|
|
15
|
+
- [ ] **If migrating a legacy Edge handler**, treated as a migration-audit task with its own verification pass, not copied as a template for new code
|
|
16
|
+
|
|
17
|
+
## Caching Decision
|
|
18
|
+
|
|
19
|
+
- [ ] **ISR/cache-header need identified** - does this route need periodic regeneration, or is a static response sufficient?
|
|
20
|
+
- [ ] **If ISR is needed and a framework stack owns the route** - configured via that framework's own primitive, not hand-rolled `Cache-Control` headers in `vercel.json`
|
|
21
|
+
- [ ] **If no framework owns the route** - any manual revalidation is implemented as plain HTTP caching via `vercel.json` `headers`, and documented as such (not called "ISR" — that term is reserved for the framework-level primitive)
|
|
22
|
+
|
|
23
|
+
## Storage Decision
|
|
24
|
+
|
|
25
|
+
- [ ] **Provider chosen deliberately**: Vercel Blob (native, for file/object storage) vs. a Marketplace integration (Neon for Postgres, Upstash for KV/Redis) - never `@vercel/kv` or `@vercel/postgres` (deprecated native packages)
|
|
26
|
+
- [ ] **Connection/credentials sourced from the Marketplace integration's env vars**, not hardcoded or copied from a personal account
|
|
27
|
+
|
|
28
|
+
## Cron Feature (if applicable)
|
|
29
|
+
|
|
30
|
+
- [ ] **`crons` entry added to `vercel.json`** with a valid 5-field UTC schedule
|
|
31
|
+
- [ ] **Plan's minimum interval and cron cap checked** before committing to a sub-hourly schedule
|
|
32
|
+
- [ ] **Secret-guard implemented** in the handler (`Authorization: Bearer ${CRON_SECRET}`), see `templates/function-handler.template.ts`
|
|
33
|
+
|
|
34
|
+
## Implementation
|
|
35
|
+
|
|
36
|
+
- [ ] **Handler created** under `api/` (or the project's existing convention), one default export per file
|
|
37
|
+
- [ ] **Env var validation guard added** at the top of the handler for any newly required variable
|
|
38
|
+
- [ ] **`vercel.json` updated** with only the sections the new feature actually needs (`functions`, `crons`, `headers`) - no invented `regions`/`maxDuration`/`memory` values (YAGNI, rule 05)
|
|
39
|
+
- [ ] **No secret hardcoded** - read from `process.env` only
|
|
40
|
+
|
|
41
|
+
## Testing
|
|
42
|
+
|
|
43
|
+
### Unit Tests
|
|
44
|
+
|
|
45
|
+
- [ ] **Handler tested directly** by constructing a `Request` and asserting on the `Response` (or mocking the minimal `VercelRequest`/`VercelResponse` subset for legacy handlers)
|
|
46
|
+
- [ ] **Method-not-allowed and malformed-input branches covered**
|
|
47
|
+
- [ ] **Handler logic coverage >= 85%**
|
|
48
|
+
|
|
49
|
+
### Cron Tests (if applicable)
|
|
50
|
+
|
|
51
|
+
- [ ] **Secret-guard tested at 100%**: missing header, wrong secret, and correct secret — all three branches
|
|
52
|
+
|
|
53
|
+
### Integration
|
|
54
|
+
|
|
55
|
+
- [ ] **`vercel dev` smoke test** exercises the new route's `vercel.json` behavior (headers/rewrites/redirects), where applicable
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
|
|
59
|
+
- [ ] **`.env.example` updated** if a new env var was introduced
|
|
60
|
+
- [ ] **`vercel.json` changes reviewed like code** - diffed and explained in the PR description, not silently regenerated
|
|
61
|
+
|
|
62
|
+
## Final Checks
|
|
63
|
+
|
|
64
|
+
- [ ] **Lint passes** - `npx eslint .`
|
|
65
|
+
- [ ] **Types pass** - `tsc --noEmit`
|
|
66
|
+
- [ ] **Tests pass** - `npx vitest run`
|
|
67
|
+
- [ ] **`vercel.json` validated** - `npm run lint:vercel-config`
|
|
68
|
+
- [ ] **`vercel build`** succeeds locally before pushing
|
|
69
|
+
|
|
70
|
+
## Pull Request
|
|
71
|
+
|
|
72
|
+
- [ ] **Descriptive title**
|
|
73
|
+
- [ ] **Linked to issue/ticket**
|
|
74
|
+
- [ ] **Any new deprecated-package or Edge Runtime usage explicitly justified** in the description
|
|
75
|
+
- [ ] **Reviewers assigned**
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Vercel Pre-Commit Checklist
|
|
2
|
+
|
|
3
|
+
> Covers the platform-specific surface only (`vercel.json`, `api/**`, `middleware.ts`). For the framework running on top of Vercel (Next.js, etc.), see that stack's own pre-commit checklist.
|
|
4
|
+
|
|
5
|
+
## Quick Checks
|
|
6
|
+
|
|
7
|
+
Run before every commit:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx eslint . && tsc --noEmit && npx vitest run && npm run lint:vercel-config
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Checklist
|
|
14
|
+
|
|
15
|
+
### `vercel.json`
|
|
16
|
+
|
|
17
|
+
- [ ] **Validated against the platform schema** - `npx ajv validate -s schemas/vercel.schema.json -d vercel.json --strict=false`
|
|
18
|
+
- [ ] **No key duplicated from a framework's own config** - check the decision tree in `02-architecture-vercel.md` before adding `headers`/`regions`/`functions`
|
|
19
|
+
- [ ] **No invented `regions` or `functions.maxDuration`/`memory` value** - every non-default value has a concrete, documented reason (YAGNI, rule 05)
|
|
20
|
+
- [ ] **Existing `vercel.json` never silently overwritten** - a regenerated file was diffed and confirmed against the previous version, not blindly replaced
|
|
21
|
+
|
|
22
|
+
### Handler Code
|
|
23
|
+
|
|
24
|
+
- [ ] **No secrets in handler code** - all secrets read from `process.env`, none hardcoded
|
|
25
|
+
- [ ] **Env vars documented in `.env.example`** - every `process.env.X` referenced by a handler has a matching (empty/placeholder) entry
|
|
26
|
+
- [ ] **Env var validation guard present** for any handler with a required var (see `templates/function-handler.template.ts`)
|
|
27
|
+
- [ ] **No `console.log`** left in (warn/error only)
|
|
28
|
+
|
|
29
|
+
### Cron Endpoints
|
|
30
|
+
|
|
31
|
+
- [ ] **Secret-guard present** on every handler registered under `vercel.json`'s `crons` section - rejects requests missing or mismatching `Authorization: Bearer ${CRON_SECRET}`
|
|
32
|
+
- [ ] **Guard is not the only line of defense** - path is not assumed to be secret/obscure
|
|
33
|
+
|
|
34
|
+
### Deprecated Patterns
|
|
35
|
+
|
|
36
|
+
- [ ] **No new `@vercel/kv` or `@vercel/postgres` import** - these native storage packages are deprecated; use Vercel Blob (native) or the Marketplace integrations (Neon for Postgres, Upstash for KV/Redis) instead
|
|
37
|
+
- [ ] **No new `runtime: 'edge'` declaration** without an explicit migration comment - Edge Runtime is deprecated in favor of Fluid Compute; a legacy handler being touched must carry a comment explaining why it still targets Edge (see the migration note in `templates/function-handler.template.ts`)
|
|
38
|
+
|
|
39
|
+
### Testing
|
|
40
|
+
|
|
41
|
+
- [ ] **Tests pass** - `npx vitest run`
|
|
42
|
+
- [ ] **New handler has tests**
|
|
43
|
+
- [ ] **Coverage maintained** (>= 85% handler logic, 100% secret-guard branches)
|
|
44
|
+
|
|
45
|
+
## Commands
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Full pre-commit check
|
|
49
|
+
npx eslint . && tsc --noEmit && npx vitest run
|
|
50
|
+
|
|
51
|
+
# Validate vercel.json against the platform schema
|
|
52
|
+
npx ajv validate -s schemas/vercel.schema.json -d vercel.json --strict=false
|
|
53
|
+
|
|
54
|
+
# Check for deprecated storage packages
|
|
55
|
+
grep -rn "@vercel/kv\|@vercel/postgres" api/ package.json
|
|
56
|
+
|
|
57
|
+
# Check for un-annotated Edge Runtime declarations
|
|
58
|
+
grep -rn "runtime.*=.*['\"]edge['\"]" api/ middleware.ts 2>/dev/null
|
|
59
|
+
```
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Audit Vercel deployment configuration structure and project shape classification
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Vercel Architecture Audit
|
|
6
|
+
|
|
7
|
+
You are an expert Vercel platform architect. Analyze the project's `vercel.json` and deployment configuration for correctness and maintainability, strictly within the deployment-platform scope of this stack.
|
|
8
|
+
|
|
9
|
+
> Vercel is a **deployment platform**, not a framework. This command covers **only** `vercel.json`, Serverless Functions, ISR, Cron Jobs, Storage, and env/Preview Deployment config. For the framework's own routing/rendering/data-fetching conventions (e.g. Next.js App Router), use that framework's own `check-architecture` command instead.
|
|
10
|
+
|
|
11
|
+
## MISSION
|
|
12
|
+
|
|
13
|
+
Validate `vercel.json` schema correctness, classify the project's deployment shape, and flag configuration that duplicates or conflicts with a framework's native Vercel adapter.
|
|
14
|
+
|
|
15
|
+
## Plan Mode
|
|
16
|
+
|
|
17
|
+
> Plan mode is activated automatically when the scope spans multiple modules or requires cross-cutting investigation.
|
|
18
|
+
|
|
19
|
+
## AUDIT AREAS
|
|
20
|
+
|
|
21
|
+
### 1. Project Shape Detection
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
[ ] Identify shape: static+rewrites | Functions-backed | ISR-enabled | Cron+scheduled (or a combination)
|
|
25
|
+
[ ] api/ directory present and mapped to Serverless Functions — Functions-backed shape
|
|
26
|
+
[ ] revalidate / `Cache-Control: s-maxage` used on responses — ISR-enabled shape
|
|
27
|
+
[ ] crons[] declared in vercel.json — Cron+scheduled shape
|
|
28
|
+
[ ] Purely static output with rewrites/redirects only — static+rewrites shape
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. vercel.json Schema Validity
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
[ ] Valid JSON, conforms to the documented vercel.json schema (no unknown top-level keys)
|
|
35
|
+
[ ] "$schema" reference present (editor validation) — optional but recommended
|
|
36
|
+
[ ] No deprecated keys (e.g. legacy `routes` mixed with modern `rewrites`/`redirects`/`headers`)
|
|
37
|
+
[ ] version field absent or set to 2 (legacy v1 config not used)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 3. rewrites / redirects / headers Correctness
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
[ ] rewrites[] source patterns do not shadow static files unintentionally
|
|
44
|
+
[ ] redirects[] use explicit `permanent: true|false` (never left implicit)
|
|
45
|
+
[ ] headers[] scoped with precise `source` globs, not a blanket "/(.*)" for sensitive headers
|
|
46
|
+
[ ] No conflicting rules where two rewrites/redirects match the same source with different destinations
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 4. regions / functions Configuration
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
[ ] functions{} block scopes memory/duration per-function-glob, not globally overbroad
|
|
53
|
+
[ ] regions[] declared explicitly if data locality matters (default is auto/global)
|
|
54
|
+
[ ] maxDuration set deliberately per function tier (not left at platform default for long-running jobs)
|
|
55
|
+
[ ] Node.js runtime used by default; Edge Runtime only present with an explicit migration flag/comment
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 5. crons[] Configuration
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
[ ] Each cron entry has a valid path and schedule (standard cron syntax)
|
|
62
|
+
[ ] Cron target endpoint exists under api/ and is not also publicly routable without auth (cross-check with check-security)
|
|
63
|
+
[ ] No duplicate schedules pointing at the same path
|
|
64
|
+
[ ] Cron frequency respects plan limits (documented, not assumed)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 6. Framework Adapter Conflict Detection
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
[ ] No vercel.json rewrites duplicating a Next.js/Nuxt/SvelteKit adapter's own routing output
|
|
71
|
+
[ ] No manual functions{} overrides fighting the framework's auto-detected build output
|
|
72
|
+
[ ] next.config.js / nuxt.config.ts (or equivalent) is the source of truth for framework routing; vercel.json only for platform-level concerns
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## OUTPUT FORMAT
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
══════════════════════════════════════════════════════════════
|
|
79
|
+
VERCEL ARCHITECTURE AUDIT
|
|
80
|
+
══════════════════════════════════════════════════════════════
|
|
81
|
+
|
|
82
|
+
📊 ARCHITECTURE SCORE: XX/100
|
|
83
|
+
|
|
84
|
+
🧭 PROJECT SHAPE
|
|
85
|
+
──────────────────────────────────────────────────────────────
|
|
86
|
+
Detected Shape: [static+rewrites | Functions-backed | ISR-enabled | Cron+scheduled | combination]
|
|
87
|
+
Status: ✅ Consistent with conventions | ⚠️ Partial drift | ❌ Non-conforming
|
|
88
|
+
|
|
89
|
+
Issues:
|
|
90
|
+
- api/ directory present but no corresponding functions{} scoping in vercel.json
|
|
91
|
+
→ Add explicit memory/duration bounds per function glob
|
|
92
|
+
|
|
93
|
+
⚙️ VERCEL.JSON SCHEMA
|
|
94
|
+
──────────────────────────────────────────────────────────────
|
|
95
|
+
Status: ✅ Valid | ⚠️ Needs cleanup | ❌ Invalid
|
|
96
|
+
|
|
97
|
+
Issues:
|
|
98
|
+
- legacy `routes` array present alongside `rewrites`
|
|
99
|
+
→ Migrate fully to `rewrites`/`redirects`/`headers`, remove `routes`
|
|
100
|
+
|
|
101
|
+
🔀 REWRITES / REDIRECTS / HEADERS
|
|
102
|
+
──────────────────────────────────────────────────────────────
|
|
103
|
+
Rules found: X
|
|
104
|
+
Conflicting rules: X
|
|
105
|
+
|
|
106
|
+
Issues:
|
|
107
|
+
- two redirects match "/blog/:slug" with different destinations
|
|
108
|
+
→ Consolidate into a single unambiguous rule
|
|
109
|
+
|
|
110
|
+
🌎 REGIONS / FUNCTIONS
|
|
111
|
+
──────────────────────────────────────────────────────────────
|
|
112
|
+
Status: ✅ Scoped deliberately | ⚠️ Overbroad | ❌ Missing
|
|
113
|
+
|
|
114
|
+
Issues:
|
|
115
|
+
- functions{} block sets maxDuration: 60 globally via "api/**"
|
|
116
|
+
→ Scope duration per function tier; most handlers need far less
|
|
117
|
+
|
|
118
|
+
⏰ CRON JOBS
|
|
119
|
+
──────────────────────────────────────────────────────────────
|
|
120
|
+
Crons declared: X
|
|
121
|
+
Auth-guarded targets: X/X
|
|
122
|
+
|
|
123
|
+
Issues:
|
|
124
|
+
- crons[] target api/cleanup.ts also reachable as a public route
|
|
125
|
+
→ See check-security for the CRITICAL auth-guard finding
|
|
126
|
+
|
|
127
|
+
🧩 FRAMEWORK ADAPTER CONFLICTS
|
|
128
|
+
──────────────────────────────────────────────────────────────
|
|
129
|
+
Status: ✅ No conflicts | ⚠️ Overlap detected
|
|
130
|
+
|
|
131
|
+
Issues:
|
|
132
|
+
- vercel.json rewrites duplicate Next.js's own output routing
|
|
133
|
+
→ Remove; let the framework's adapter own this concern
|
|
134
|
+
|
|
135
|
+
📋 RECOMMENDATIONS
|
|
136
|
+
──────────────────────────────────────────────────────────────
|
|
137
|
+
Priority 1: [Resolve conflicting rewrite/redirect rules]
|
|
138
|
+
Priority 2: [Scope functions{} bounds per handler]
|
|
139
|
+
Priority 3: [Guard cron endpoints with a secret-header check]
|
|
140
|
+
|
|
141
|
+
══════════════════════════════════════════════════════════════
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## PROCESS
|
|
145
|
+
|
|
146
|
+
1. Parse `vercel.json` and validate against the documented schema
|
|
147
|
+
2. Detect project shape from directory layout (`api/`, cron declarations, revalidate usage)
|
|
148
|
+
3. Validate rewrites/redirects/headers for conflicts and overbroad globs
|
|
149
|
+
4. Review `regions`/`functions` scoping and runtime choice (Node.js default vs legacy Edge Runtime)
|
|
150
|
+
5. Validate `crons[]` entries and cross-check target auth (flag for `check-security`)
|
|
151
|
+
6. Detect configuration that duplicates or conflicts with a framework's native Vercel adapter
|
|
152
|
+
7. Generate architecture report with a score out of 100
|