create-shhs 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,424 @@
1
+ # SHHS — Installation et Mise en Place
2
+
3
+ **Version:** 1.0.0
4
+ **Date:** 2026-02-24
5
+
6
+ ---
7
+
8
+ ## Fichiers Créés
9
+
10
+ Cette mise à jour complète SHHS avec les briques suivantes:
11
+
12
+ ### 1. Gouvernance Centrale
13
+
14
+ | Fichier | Description |
15
+ |---------|-------------|
16
+ | `.ai/governance/constitution.md` | Constitution immuable (TDD, E2E, Knowledge Curator obligatoires) |
17
+ | `.ai/governance/definition-of-done.md` | Conditions de merge obligatoires (6 gates) |
18
+
19
+ ### 2. Nouveaux Agents
20
+
21
+ | Fichier | Rôle |
22
+ |---------|------|
23
+ | `.ai/agents/knowledge-curator.md` | Valide faisabilité technique via Context7 |
24
+ | `.ai/agents/fitness-enforcer.md` | Détecte violations architecturales automatiquement |
25
+
26
+ ### 3. Knowledge Base
27
+
28
+ | Fichier | Usage |
29
+ |---------|-------|
30
+ | `.ai/knowledge/knowledge-base.md` | Cache des contraintes techniques vérifiées |
31
+ | `.ai/knowledge/validation-reports/` | Rapports de validation du Knowledge Curator |
32
+
33
+ ### 4. Fitness Functions
34
+
35
+ | Fichier | Description |
36
+ |---------|-------------|
37
+ | `.ai/architecture/governance/fitness/README.md` | Guide d'utilisation des fitness functions |
38
+ | `.ai/architecture/governance/fitness/rules.json` | Règles architecturales automatisées |
39
+ | `.ai/architecture/governance/fitness/config.json` | Configuration (mode DETECT/PREVENT) |
40
+ | `.ai/architecture/governance/fitness/exemptions.json` | Exemptions temporaires |
41
+ | `.ai/reports/fitness-results.json` | Format des résultats d'exécution |
42
+
43
+ ### 5. Skills (Procédures Obligatoires)
44
+
45
+ | Fichier | Workflow |
46
+ |---------|----------|
47
+ | `.ai/skills/tdd/skill.md` | Procédure TDD (RED → GREEN → REFACTOR) |
48
+ | `.ai/skills/playwright/skill.md` | Tests E2E avec Playwright |
49
+ | `.ai/skills/context7/skill.md` | Queries de documentation live via Context7 |
50
+
51
+ ### 6. Mise à Jour Documentation
52
+
53
+ | Fichier | Changements |
54
+ |---------|-------------|
55
+ | `CLAUDE.md` | Ajout Knowledge Curator, Fitness Enforcer, Skills, Constitution |
56
+ | `SHHS-COMPLETION-ANALYSIS.md` | Auto-analyse critique du système complété |
57
+
58
+ ---
59
+
60
+ ## Installation dans un Nouveau Projet
61
+
62
+ ### Étape 1: Copier Structure `.ai/`
63
+
64
+ ```bash
65
+ # Depuis le répertoire de votre projet
66
+ cp -r /path/to/shhs/.ai .
67
+ ```
68
+
69
+ Structure copiée:
70
+ ```
71
+ .ai/
72
+ ├── agents/
73
+ │ ├── architect.md
74
+ │ ├── domain-architect.md
75
+ │ ├── developer.md
76
+ │ ├── static-reviewer.md
77
+ │ ├── qa.md
78
+ │ ├── debt-observer.md
79
+ │ ├── architecture-reviewer.md
80
+ │ ├── knowledge-curator.md ← NOUVEAU
81
+ │ └── fitness-enforcer.md ← NOUVEAU
82
+ ├── governance/
83
+ │ ├── constitution.md ← NOUVEAU
84
+ │ └── definition-of-done.md ← NOUVEAU
85
+ ├── architecture/
86
+ │ └── governance/
87
+ │ ├── fitness/
88
+ │ │ ├── README.md ← NOUVEAU
89
+ │ │ ├── rules.json ← NOUVEAU
90
+ │ │ ├── config.json ← NOUVEAU
91
+ │ │ └── exemptions.json ← NOUVEAU
92
+ ├── knowledge/
93
+ │ ├── knowledge-base.md ← NOUVEAU
94
+ │ └── validation-reports/ ← NOUVEAU
95
+ ├── skills/
96
+ │ ├── tdd/skill.md ← NOUVEAU
97
+ │ ├── playwright/skill.md ← NOUVEAU
98
+ │ └── context7/skill.md ← NOUVEAU
99
+ ├── ADR/
100
+ ├── contracts/
101
+ ├── features/
102
+ ├── memory/
103
+ │ ├── patterns.md
104
+ │ └── anti-patterns.md
105
+ ├── reports/
106
+ │ └── fitness-results.json ← NOUVEAU
107
+ └── debt/
108
+ ```
109
+
110
+ ### Étape 2: Copier CLAUDE.md
111
+
112
+ ```bash
113
+ cp /path/to/shhs/CLAUDE.md .
114
+ ```
115
+
116
+ ### Étape 3: Adapter Fitness Rules
117
+
118
+ Éditer `.ai/architecture/governance/fitness/rules.json` selon votre architecture:
119
+
120
+ ```json
121
+ {
122
+ "rules": [
123
+ {
124
+ "id": "your-custom-rule",
125
+ "description": "...",
126
+ "condition": { ... },
127
+ "threshold": N,
128
+ "severity": "BLOCK|WARN",
129
+ "scope": "src/**/*.ts"
130
+ }
131
+ ]
132
+ }
133
+ ```
134
+
135
+ ### Étape 4: Bootstrap Knowledge Base
136
+
137
+ Remplir `.ai/knowledge/knowledge-base.md` avec votre stack:
138
+
139
+ ```markdown
140
+ ### React Server Components — Version 18.x
141
+
142
+ #### Hard Constraints
143
+
144
+ | Constraint | Evidence | Impact |
145
+ |------------|----------|--------|
146
+ | Cannot use useState | [React Docs](https://react.dev/...) | ... |
147
+ ```
148
+
149
+ ### Étape 5: Configurer Mode Fitness
150
+
151
+ Démarrer en mode DETECT (`.ai/architecture/governance/fitness/config.json`):
152
+
153
+ ```json
154
+ {
155
+ "mode": "DETECT",
156
+ ...
157
+ }
158
+ ```
159
+
160
+ Cela permet d'établir une baseline sans bloquer les merges.
161
+
162
+ ---
163
+
164
+ ## Workflow d'Adoption Progressive
165
+
166
+ ### Phase 1: Observation (Semaine 1-2)
167
+
168
+ **Objectif:** Établir baseline
169
+
170
+ **Actions:**
171
+ 1. Activer Fitness Enforcer en mode DETECT
172
+ 2. Exécuter sur codebase existante
173
+ 3. Générer `.ai/reports/fitness-baseline.json`
174
+ 4. Identifier violations existantes
175
+
176
+ **Commande:**
177
+ ```bash
178
+ # À implémenter: fitness-enforcer CLI
179
+ fitness-enforcer --mode detect --baseline
180
+ ```
181
+
182
+ ### Phase 2: Nouveaux Développements (Semaine 3-4)
183
+
184
+ **Objectif:** Appliquer gouvernance sur nouveau code uniquement
185
+
186
+ **Actions:**
187
+ 1. Activer TDD skill pour nouvelles features
188
+ 2. Knowledge Curator valide nouvelles décisions architecturales
189
+ 3. Fitness Enforcer en DETECT pour nouveau code
190
+ 4. Legacy code exempt (via `exemptions.json`)
191
+
192
+ ### Phase 3: Cleanup Legacy (Mois 2-3)
193
+
194
+ **Objectif:** Réduire violations baseline de 20% par mois
195
+
196
+ **Actions:**
197
+ 1. Prioriser violations BLOCK-severity
198
+ 2. Créer ADRs pour migrations
199
+ 3. Tracker progrès via fitness metrics
200
+
201
+ ### Phase 4: Enforcement Strict (Mois 4+)
202
+
203
+ **Objectif:** Activer mode PREVENT
204
+
205
+ **Actions:**
206
+ 1. Passer Fitness Enforcer en mode PREVENT
207
+ 2. Bloquer merges sur violations BLOCK
208
+ 3. Tous les gates obligatoires
209
+ 4. Zero exemptions pour nouveau code
210
+
211
+ ---
212
+
213
+ ## Intégration CI/CD
214
+
215
+ ### GitHub Actions (Exemple)
216
+
217
+ Créer `.github/workflows/shhs-gates.yml`:
218
+
219
+ ```yaml
220
+ name: SHHS Governance Gates
221
+
222
+ on: pull_request
223
+
224
+ jobs:
225
+ gate-1-knowledge-validation:
226
+ runs-on: ubuntu-latest
227
+ steps:
228
+ - uses: actions/checkout@v3
229
+ - name: Knowledge Curator Validation
230
+ run: echo "Manual validation required if ADR added"
231
+
232
+ gate-2-contract-validation:
233
+ runs-on: ubuntu-latest
234
+ steps:
235
+ - uses: actions/checkout@v3
236
+ - name: Validate Feature Contracts
237
+ run: |
238
+ npm run test:cucumber
239
+
240
+ gate-3-structural-compliance:
241
+ runs-on: ubuntu-latest
242
+ steps:
243
+ - uses: actions/checkout@v3
244
+ - name: Static Review
245
+ run: npm run lint:architecture
246
+
247
+ gate-4-fitness-enforcement:
248
+ runs-on: ubuntu-latest
249
+ steps:
250
+ - uses: actions/checkout@v3
251
+ - name: Run Fitness Functions
252
+ run: |
253
+ # À implémenter
254
+ npm run fitness:enforce -- --mode prevent
255
+
256
+ gate-5-behavioral-compliance:
257
+ runs-on: ubuntu-latest
258
+ steps:
259
+ - uses: actions/checkout@v3
260
+ - name: Run All Tests
261
+ run: |
262
+ npm test -- --coverage
263
+ npm run test:e2e
264
+ - name: Upload Coverage
265
+ uses: codecov/codecov-action@v3
266
+
267
+ gate-6-domain-approval:
268
+ runs-on: ubuntu-latest
269
+ steps:
270
+ - name: Domain Architect Review Required
271
+ run: echo "Manual review required - enforce via branch protection"
272
+ ```
273
+
274
+ ### Branch Protection
275
+
276
+ Configuration GitHub:
277
+
278
+ - ✅ Require status checks to pass
279
+ - ✅ Require reviews (Domain Architect)
280
+ - ✅ Require linear history
281
+ - ✅ Include administrators
282
+
283
+ ---
284
+
285
+ ## Commandes NPM (À Implémenter)
286
+
287
+ Ajouter dans `package.json`:
288
+
289
+ ```json
290
+ {
291
+ "scripts": {
292
+ "validate:all": "npm run validate:contract && npm run validate:structure && npm run validate:behavior",
293
+ "validate:contract": "cucumber-js .ai/features",
294
+ "validate:structure": "npm run lint:architecture && npm run fitness:enforce",
295
+ "validate:behavior": "npm test && npm run test:e2e",
296
+ "fitness:enforce": "node scripts/fitness-enforcer.js",
297
+ "fitness:baseline": "node scripts/fitness-enforcer.js --baseline",
298
+ "lint:architecture": "eslint --config .ai/configs/eslint-architecture.js src",
299
+ "test:e2e": "playwright test"
300
+ }
301
+ }
302
+ ```
303
+
304
+ ---
305
+
306
+ ## Outils Requis
307
+
308
+ ### Minimum (Manuel)
309
+
310
+ - Git
311
+ - Node.js
312
+ - NPM
313
+ - Éditeur de texte
314
+
315
+ **Usage:** Suivre workflows manuellement, documenter dans `.ai/reports/`
316
+
317
+ ### Recommandé (Semi-Automatique)
318
+
319
+ - Jest / Vitest (tests)
320
+ - Cucumber.js (feature contracts)
321
+ - Playwright (E2E tests)
322
+ - ESLint (layer violations)
323
+ - Madge (dependency analysis)
324
+
325
+ **Usage:** Automatiser gates 2-5 partiellement
326
+
327
+ ### Idéal (Full Automation)
328
+
329
+ - Tout ci-dessus +
330
+ - Fitness Enforcer CLI (à développer)
331
+ - Context7 MCP integration
332
+ - SHHS Dashboard (HTML reports)
333
+ - GitHub Actions workflows
334
+
335
+ **Usage:** Full CI/CD automation, zero intervention manuelle
336
+
337
+ ---
338
+
339
+ ## FAQ
340
+
341
+ ### Q: Dois-je implémenter TOUS les fichiers immédiatement?
342
+
343
+ **R:** Non. Adoption progressive recommandée:
344
+
345
+ 1. **Semaine 1:** Constitution + Definition of Done (gouvernance)
346
+ 2. **Semaine 2:** Skills TDD + Playwright (discipline tests)
347
+ 3. **Semaine 3:** Knowledge Curator + Knowledge Base (validation technique)
348
+ 4. **Semaine 4:** Fitness Enforcer (mode DETECT)
349
+ 5. **Mois 2+:** Fitness Enforcer mode PREVENT
350
+
351
+ ### Q: Que faire si je n'ai pas accès à Context7?
352
+
353
+ **R:** Fallback manuel:
354
+
355
+ 1. Consulter documentation officielle directement
356
+ 2. Documenter quotes + URLs dans `.ai/knowledge/knowledge-base.md`
357
+ 3. Knowledge Curator fonctionne en mode manuel
358
+ 4. Réactiver Context7 quand disponible
359
+
360
+ ### Q: Comment gérer legacy code avec violations?
361
+
362
+ **R:** Exemptions temporaires:
363
+
364
+ 1. Créer ADR documentant plan de migration
365
+ 2. Ajouter exemption dans `.ai/architecture/governance/fitness/exemptions.json`
366
+ 3. Fixer expiration date (ex: 3 mois)
367
+ 4. Tracker progrès via fitness metrics
368
+
369
+ ### Q: Fitness Enforcer est-il exécutable actuellement?
370
+
371
+ **R:** Non, c'est de la documentation. Pour l'implémenter:
372
+
373
+ 1. Parser `rules.json`
374
+ 2. Analyser imports via TypeScript compiler API
375
+ 3. Calculer métriques via Madge
376
+ 4. Générer `fitness-results.json`
377
+
378
+ **Effort estimé:** 1-2 semaines développeur
379
+
380
+ ### Q: TDD est vraiment obligatoire pour TOUT?
381
+
382
+ **R:** Oui, selon Constitution Article II. Si TDD impraticable:
383
+
384
+ 1. Feature mal scoped (décomposer)
385
+ 2. Manque de compétence (formation requise)
386
+ 3. Contrainte technique réelle (Knowledge Curator valide)
387
+
388
+ Pas de bypass pour "gain de temps".
389
+
390
+ ---
391
+
392
+ ## Support et Contributions
393
+
394
+ ### Documentation
395
+
396
+ - Constitution: `.ai/governance/constitution.md`
397
+ - Agents: `.ai/agents/*.md`
398
+ - Skills: `.ai/skills/*/skill.md`
399
+ - Analysis: `SHHS-COMPLETION-ANALYSIS.md`
400
+
401
+ ### Prochaines Étapes Recommandées
402
+
403
+ 1. **Implémenter Fitness Enforcer CLI**
404
+ - Parser rules.json
405
+ - Intégration Madge + ESLint
406
+ - Génération rapports
407
+
408
+ 2. **Context7 Integration**
409
+ - MCP server connection
410
+ - Cache local
411
+ - Fallback web scraping
412
+
413
+ 3. **Migration Toolkit**
414
+ - Baseline analysis
415
+ - Automated exemptions
416
+ - Progress dashboard
417
+
418
+ 4. **GitHub Actions Templates**
419
+ - Copy-paste ready workflows
420
+ - Branch protection configs
421
+
422
+ ---
423
+
424
+ **END OF INSTALLATION GUIDE**
package/README.md CHANGED
@@ -26,19 +26,27 @@ Instead of one AI doing everything, SHHS mimics a mature engineering organizatio
26
26
  Install SHHS into any existing project:
27
27
 
28
28
  ```bash
29
- # Method 1: NPX (fastest)
29
+ # NPX (recommended)
30
30
  npx create-shhs
31
31
 
32
- # Method 2: Git submodule (recommended for tracking updates)
33
- git submodule add https://github.com/your-org/shhs .shhs
34
- .shhs/scripts/install.sh
32
+ # Or install in specific directory
33
+ npx create-shhs /path/to/your/project
34
+ ```
35
+
36
+ ### Updating
37
+
38
+ Update to the latest SHHS version:
35
39
 
36
- # Method 3: Direct installation
37
- git clone https://github.com/your-org/shhs /tmp/shhs
38
- /tmp/shhs/scripts/install.sh .
39
- rm -rf /tmp/shhs
40
+ ```bash
41
+ # Update to latest
42
+ npx create-shhs update
43
+
44
+ # Preview changes first
45
+ npx create-shhs update --dry-run
40
46
  ```
41
47
 
48
+ 📖 See [UPDATE-GUIDE.md](UPDATE-GUIDE.md) for detailed update instructions.
49
+
42
50
  ### What Gets Installed
43
51
 
44
52
  ```