create-gef 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.
Files changed (53) hide show
  1. package/.gef/ENGINEERING_PLAYBOOK.md +141 -0
  2. package/.gef/prompts/adr_writing.md +50 -0
  3. package/.gef/prompts/bugfix.md +31 -0
  4. package/.gef/prompts/code_review.md +40 -0
  5. package/.gef/prompts/feature_development.md +37 -0
  6. package/.gef/prompts/new_project_kickoff.md +41 -0
  7. package/.gef/prompts/system_prompt.md +41 -0
  8. package/.github/workflows/release-please.yml +19 -0
  9. package/CHANGELOG.md +63 -0
  10. package/ENGINEERING_PLAYBOOK.md +88 -341
  11. package/PROJECT_CONFIG.template.md +15 -28
  12. package/README.md +87 -20
  13. package/generator/cli/help.js +65 -0
  14. package/generator/cli/questions.js +98 -0
  15. package/generator/features/scaffold-ci.js +441 -0
  16. package/generator/features/scaffold-docker.js +159 -0
  17. package/generator/features/scaffold-gef.js +158 -0
  18. package/generator/features/scaffold-git.js +138 -0
  19. package/generator/features/scaffold-linter.js +91 -0
  20. package/generator/features/scaffold-stack.js +101 -0
  21. package/generator/features/update.js +61 -0
  22. package/generator/index.js +37 -668
  23. package/generator/templates/adr-template.md +22 -0
  24. package/hooks/commit-msg +4 -3
  25. package/hooks/pre-commit +2 -2
  26. package/package.json +1 -1
  27. package/prompts/adr_writing.md +45 -9
  28. package/prompts/bugfix.md +24 -8
  29. package/prompts/code_review.md +34 -8
  30. package/prompts/feature_development.md +10 -1
  31. package/prompts/new_project_kickoff.md +33 -6
  32. package/prompts/system_prompt.md +30 -13
  33. package/website/.oxlintrc.json +8 -0
  34. package/website/README.md +16 -0
  35. package/website/index.html +13 -0
  36. package/website/package-lock.json +1372 -0
  37. package/website/package.json +25 -0
  38. package/website/public/favicon.svg +1 -0
  39. package/website/public/icons.svg +24 -0
  40. package/website/src/App.css +1 -0
  41. package/website/src/App.tsx +167 -0
  42. package/website/src/assets/hero.png +0 -0
  43. package/website/src/assets/react.svg +1 -0
  44. package/website/src/assets/vite.svg +1 -0
  45. package/website/src/components/FeatureCard.tsx +28 -0
  46. package/website/src/components/TerminalDemo.tsx +84 -0
  47. package/website/src/index.css +152 -0
  48. package/website/src/main.tsx +10 -0
  49. package/website/tsconfig.app.json +26 -0
  50. package/website/tsconfig.json +7 -0
  51. package/website/tsconfig.node.json +23 -0
  52. package/website/vite.config.ts +7 -0
  53. package/hooks/pre-push +0 -25
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Gildas Engineering Framework (GEF)
2
2
 
3
3
  > Un framework d'ingénierie logicielle qui transforme des règles de travail en outils automatisés. Il garantit traçabilité, sécurité et qualité sur chaque projet, dès le premier commit.
4
+ >
5
+ > **🛡️ Standards de l'Industrie Enforcés :** GitHub Flow (PRs obligatoires), OWASP Security Limits (Rate Limiting, JWT Exp), et Clean Code Metrics adaptatifs (Startup / Standard / Mission Critical).
4
6
 
5
7
  ---
6
8
 
@@ -39,12 +41,24 @@ GEF/
39
41
  ├── package.json ← Package NPM (rend le GEF exécutable via npx)
40
42
 
41
43
  ├── generator/ ← Brique A : CLI de génération de projet
42
- └── index.js ← Point d'entrée (interface interactive + commande update)
44
+ ├── index.js ← Point d'entrée (routage des commandes : help, version, update, interactif)
45
+ │ ├── cli/
46
+ │ │ ├── questions.js ← 11 questions Inquirer (stack, DB, cloud, git, lint, sévérité, langue...)
47
+ │ │ └── help.js ← Affichage de l'aide et de la version
48
+ │ ├── features/
49
+ │ │ ├── scaffold-stack.js ← Scaffolding du framework cible (Next, Vite, Express, FastAPI)
50
+ │ │ ├── scaffold-gef.js ← Moteur de templates (Playbook, Prompts IA, Diataxis)
51
+ │ │ ├── scaffold-git.js ← Génération dynamique des hooks Git
52
+ │ │ ├── scaffold-linter.js ← Génération des configs Biome, ESLint, Ruff
53
+ │ │ ├── scaffold-docker.js ← Dockerfile, docker-compose, init.sql
54
+ │ │ ├── scaffold-ci.js ← Workflows GitHub Actions (CI/CD, release-please)
55
+ │ │ └── update.js ← Mise à jour d'un projet existant
56
+ │ └── templates/
57
+ │ └── adr-template.md ← Template d'ADR prêt à l'emploi
43
58
 
44
- ├── hooks/ ← Brique B : Hooks Git de sécurité
59
+ ├── hooks/ ← Hooks Git (installés dans le dépôt GEF lui-même)
45
60
  │ ├── commit-msg ← Conventional Commits + référence Kanban obligatoire (#XYZ)
46
- ├── pre-commit ← Détection secrets, lint
47
- │ └── pre-push ← Blocage push direct sur main
61
+ └── pre-commit ← Détection secrets, lint
48
62
 
49
63
  ├── ci-templates/ ← Brique C : Template de base CI/CD
50
64
  │ └── main.yml ← (le générateur produit un CI adapté à la stack)
@@ -53,7 +67,7 @@ GEF/
53
67
  │ └── release-please.yml ← Automatisation des releases du GEF lui-même
54
68
 
55
69
  └── prompts/ ← Brique D : Prompts pour assistants IA
56
- ├── system_prompt.md ← Prompt de base (à charger en début de session)
70
+ ├── system_prompt.md ← Prompt de base (avec variables de template {{MAX_LINES}} etc.)
57
71
  ├── feature_development.md ← Pour le développement d'une fonctionnalité
58
72
  ├── code_review.md ← Pour une revue de code
59
73
  ├── bugfix.md ← Pour une correction de bug
@@ -69,6 +83,15 @@ Le GEF est conçu pour être utilisé directement sans avoir besoin de cloner le
69
83
 
70
84
  **Prérequis :** Node.js (v18+), Git, GitHub CLI (`gh`) pour les fonctionnalités Kanban.
71
85
 
86
+ ### Commandes disponibles
87
+
88
+ | Commande | Description |
89
+ |---|---|
90
+ | `npx create-gef` | Lance le générateur interactif et crée un nouveau projet |
91
+ | `npx create-gef update` | Met à jour le Playbook, les Prompts et les Hooks dans un projet existant |
92
+ | `npx create-gef --help` | Affiche l'aide et toutes les commandes disponibles |
93
+ | `npx create-gef --version` | Affiche la version actuelle du framework |
94
+
72
95
  ### Créer un nouveau projet
73
96
 
74
97
  ```bash
@@ -83,6 +106,13 @@ Depuis la racine d'un projet existant généré par GEF, mettez à jour le Playb
83
106
  npx create-gef update
84
107
  ```
85
108
 
109
+ ### Afficher l'aide
110
+
111
+ ```bash
112
+ npx create-gef --help
113
+ npx create-gef --version
114
+ ```
115
+
86
116
  ### Développement local du framework
87
117
 
88
118
  Si vous modifiez le framework GEF lui-même et souhaitez tester la CLI localement :
@@ -105,22 +135,21 @@ npm link
105
135
 
106
136
  ### Ce que le générateur fait
107
137
 
108
- L'assistant pose 7 questions, puis exécute automatiquement :
138
+ L'assistant pose **11 questions**, puis exécute automatiquement :
109
139
 
110
140
  | Étape | Action |
111
141
  |---|---|
112
- | **1. Scaffolding** | Installe le framework choisi (`npx create-next-app`, `npm create vite`, etc.) en mode **entièrement interactif** |
113
- | **2. Arborescence GEF** | Crée `docs/adr/`, `docs/research/`, `tests/`, `scripts/`, `infra/`, `database/` |
114
- | **3. Template ADR** | Crée `docs/adr/0000-template.md` prêt à l'emploi |
115
- | **4. Playwright** | Installe Playwright (tests E2E) nativement pour les stacks React et Next.js |
116
- | **5. Configuration** | Génère `PROJECT_CONFIG.md` pré-rempli avec vos choix (stack, cloud, DB, phase) |
117
- | **6. Documentation** | Génère `README.md` et `docs/research/RESEARCH_LOG.md` |
118
- | **7. Docker** | Génère `docker/Dockerfile` et `docker/docker-compose.yml` adaptés à votre stack *(ignoré si Cloud = Vercel)* |
119
- | **8. Vercel** | Génère `vercel.json` si Vercel est choisi comme Cloud Provider |
120
- | **9. Supabase** | Génère `supabase/config.toml` et `supabase/migrations/` si Supabase est choisi |
121
- | **10. Git & Hooks** | Initialise Git et installe les 3 hooks de sécurité GEF |
122
- | **11. CI/CD** | Génère `.github/workflows/main.yml` adapté à la stack et au cloud provider |
123
- | **12. Release Please** | Génère `.github/workflows/release-please.yml` pour automatiser les tags et releases |
142
+ | **1. Scaffolding** | Installe le framework choisi (`npx create-next-app`, `npm create vite`, etc.) |
143
+ | **2. Arborescence GEF** | Crée la structure Diatáxis : `docs/tutorials/`, `docs/how-to/`, `docs/reference/`, `docs/explanation/adr/` |
144
+ | **3. Template ADR** | Crée `docs/explanation/adr/0000-template.md` prêt à l'emploi |
145
+ | **4. Configuration** | Génère `PROJECT_CONFIG.md` pré-rempli avec tous les choix (stack, cloud, DB, git, lint, sévérité, langue) |
146
+ | **5. Documentation** | Génère `README.md` et `docs/research/RESEARCH_LOG.md` |
147
+ | **6. Linter** | Génère `biome.json`, `.eslintrc.json`, ou `ruff.toml` selon le choix |
148
+ | **7. Docker** | Génère `docker/Dockerfile` et `docker/docker-compose.yml`. Si PostgreSQL : crée `database/init.sql` monté dans le container |
149
+ | **8. Playbook & Prompts IA** | Copie le Playbook et les Prompts dans `.gef/` **en injectant les Hard Limits adaptées** au niveau de sévérité choisi |
150
+ | **9. Hooks Git** | Génère les hooks dynamiques (`pre-push` bloque `main` si GitHub Flow, lance les tests si TBD) |
151
+ | **10. CI/CD** | Génère `.github/workflows/main.yml` adapté à la stack et au cloud provider |
152
+ | **11. Release Please** | Génère `.github/workflows/release-please.yml` pour automatiser les tags et releases |
124
153
 
125
154
  ### Stacks supportées
126
155
 
@@ -132,6 +161,42 @@ L'assistant pose 7 questions, puis exécute automatiquement :
132
161
  | API Python (FastAPI) | `venv` + `requirements.txt` | Python 3.12-slim + DB service | Setup Python 3.12 + flake8 + pytest |
133
162
  | Projet vide | — | Alpine générique | Générique |
134
163
 
164
+ ### Stratégies Git supportées
165
+
166
+ | Stratégie | Comportement du hook `pre-push` |
167
+ |---|---|
168
+ | **GitHub Flow** *(Recommandé)* | Bloque toute tentative de `git push` sur `main`. Force l'usage de branches et Pull Requests. |
169
+ | **Trunk-Based Development** | Autorise les pushes sur `main`, mais exécute les tests locaux avant de valider. |
170
+
171
+ ### Niveaux de sévérité (Hard Limits)
172
+
173
+ Le niveau choisi est injecté dans le Playbook et les Prompts IA générés dans `.gef/`. L'IA d'un projet "Mission Critical" ne générera **jamais** de fonction de plus de 15 lignes.
174
+
175
+ | Niveau | Fonctions max | Params max | Complexité max | Payload JSON max |
176
+ |---|---|---|---|---|
177
+ | **Startup / R&D** | 50 lignes | 4 | 15 | 5 Mo |
178
+ | **Standard / Enterprise** *(Recommandé)* | 30 lignes | 3 | 10 | 1 Mo |
179
+ | **Mission Critical** | 15 lignes | 2 | 5 | 100 Ko |
180
+
181
+ ### Linters supportés
182
+
183
+ | Linter | Fichier généré | Commandes ajoutées dans `package.json` |
184
+ |---|---|---|
185
+ | **Biome** | `biome.json` | `npm run lint`, `npm run lint:fix` |
186
+ | **ESLint + Prettier** | `.eslintrc.json` + `.prettierrc` | `npm run lint`, `npm run lint:fix` |
187
+ | **Ruff** *(Python)* | `ruff.toml` | — |
188
+ | **Aucun** | — | — |
189
+
190
+ ### Cloud Providers supportés
191
+
192
+ | Framework | Scaffolding | Docker | CI |
193
+ |---|---|---|---|
194
+ | Next.js (React) | `npx create-next-app@latest` | Multi-stage → Node | Setup Node 20 + lint + tests |
195
+ | React (Vite) | `npm create vite@latest` | Multi-stage → Nginx | Setup Node 20 + lint + tests |
196
+ | API Node.js (Express) | `npm init` + `express` | Node Alpine + DB service | Setup Node 20 + lint + tests |
197
+ | API Python (FastAPI) | `venv` + `requirements.txt` | Python 3.12-slim + DB service | Setup Python 3.12 + flake8 + pytest |
198
+ | Projet vide | — | Alpine générique | Générique |
199
+
135
200
  ### Cloud Providers supportés
136
201
 
137
202
  | Cloud | Effet |
@@ -159,8 +224,10 @@ Installés automatiquement par le générateur dans `.git/hooks/` de chaque proj
159
224
  | Hook | Règle appliquée |
160
225
  |---|---|
161
226
  | **`commit-msg`** | Bloque tout commit dont le message ne respecte pas le format `Conventional Commits + référence Kanban`. Format : `feat: description (#42)`. |
162
- | **`pre-commit`** | Détecte les secrets en clair (clés API, tokens). Bloquant. |
163
- | **`pre-push`** | Bloque tout push direct sur la branche `main`. |
227
+ | **`pre-commit`** | Détecte les secrets en clair (clés API, tokens). Vérifie le formatage (linter). Analyse la taille des fichiers selon la sévérité choisie. Bloquant. |
228
+ | **`pre-push`** | **Dynamique** : Bloque tout push direct sur `main` si le projet est en GitHub Flow. Exécute les tests locaux si en Trunk-Based Development. |
229
+
230
+ Ces hooks sont générés à la volée par le générateur en fonction des choix de l'équipe, et installablés dans `.git/hooks/` du projet.
164
231
 
165
232
  Pour mettre à jour les hooks dans un projet existant :
166
233
 
@@ -0,0 +1,65 @@
1
+ // cli/help.js — Affichage de l'aide et de la version du CLI GEF
2
+ // Réf. Playbook §1 : SRP
3
+
4
+ import chalk from 'chalk';
5
+ import { createRequire } from 'module';
6
+
7
+ const require = createRequire(import.meta.url);
8
+ const pkg = require('../../package.json');
9
+
10
+ /**
11
+ * Affiche la version du package.
12
+ */
13
+ export function printVersion() {
14
+ console.log(`create-gef v${pkg.version}`);
15
+ }
16
+
17
+ /**
18
+ * Affiche le panneau d'aide complet et coloré.
19
+ */
20
+ export function printHelp() {
21
+ console.log(`
22
+ ${chalk.bold.white('create-gef')} ${chalk.dim(`v${pkg.version}`)}
23
+ ${chalk.dim('Générateur interactif de projets respectant le Gildas Engineering Framework.')}
24
+
25
+ ${chalk.bold.cyan('USAGE')}
26
+
27
+ ${chalk.green('npx create-gef')} Lance le générateur interactif de projet
28
+ ${chalk.green('npx create-gef update')} Met à jour le Playbook, les Prompts et les Hooks d'un projet existant
29
+ ${chalk.green('npx create-gef --help')} Affiche ce message d'aide
30
+ ${chalk.green('npx create-gef --version')} Affiche la version du framework
31
+
32
+ ${chalk.bold.cyan('COMMANDES')}
33
+
34
+ ${chalk.yellow('(aucune)')} ${chalk.dim('─────────────────')} Mode interactif : pose 11 questions et génère un projet complet
35
+ ${chalk.yellow('update')} ${chalk.dim('─────────────────')} Met à jour les ressources GEF dans un projet existant
36
+
37
+ ${chalk.bold.cyan('OPTIONS DU GÉNÉRATEUR INTERACTIF')}
38
+
39
+ ${chalk.magenta('Stack')} Next.js, React (Vite), Express, FastAPI, Projet vide
40
+ ${chalk.magenta('Base de données')} PostgreSQL, MongoDB, Supabase, Aucune
41
+ ${chalk.magenta('Cloud Provider')} AWS, GCP, Azure, Vercel, Aucun
42
+ ${chalk.magenta('Workflow Git')} GitHub Flow ${chalk.dim('(PRs, main verrouillé — Recommandé)')} | Trunk-Based Development
43
+ ${chalk.magenta('Sévérité')} Startup ${chalk.dim('(souple)')} | Standard ${chalk.dim('(recommandé)')} | Mission Critical ${chalk.dim('(strict)')}
44
+ ${chalk.magenta('Linter')} ESLint + Prettier | Biome | Ruff | Aucun
45
+ ${chalk.magenta('Langue')} Français | English
46
+
47
+ ${chalk.bold.cyan('CE QUE LE GÉNÉRATEUR PRODUIT')}
48
+
49
+ ✅ Structure de projet (Feature-Sliced Design)
50
+ ✅ Documentation Diátaxis ${chalk.dim('(docs/tutorials, how-to, reference, explanation/adr)')}
51
+ ✅ ENGINEERING_PLAYBOOK.md ${chalk.dim('adapté à la sévérité choisie')}
52
+ ✅ Prompts IA ${chalk.dim('(.gef/prompts/) calibrés selon les Hard Limits du projet')}
53
+ ✅ Hooks Git dynamiques ${chalk.dim('(commit-msg, pre-commit, pre-push)')}
54
+ ✅ Fichiers de configuration du Linter ${chalk.dim('(biome.json, .eslintrc, ruff.toml)')}
55
+ ✅ Docker ${chalk.dim('(Dockerfile + docker-compose)')} + ${chalk.dim('database/init.sql si PostgreSQL')}
56
+ ✅ Pipeline CI/CD GitHub Actions ${chalk.dim('(tests, lint, déploiement)')}
57
+ ✅ Automatisation des Releases ${chalk.dim('(release-please)')}
58
+
59
+ ${chalk.bold.cyan('LIENS')}
60
+
61
+ 📦 NPM ${chalk.underline('https://npmjs.com/package/create-gef')}
62
+ 💻 GitHub ${chalk.underline('https://github.com/Gnzikoune/GEF')}
63
+
64
+ `);
65
+ }
@@ -0,0 +1,98 @@
1
+ // cli/questions.js — Questions interactives du générateur GEF
2
+ // Réf. Playbook §1 : Responsabilité Unique (SRP)
3
+
4
+ export const PROJECT_QUESTIONS = [
5
+ {
6
+ type: 'input',
7
+ name: 'projectName',
8
+ message: 'Quel est le nom de votre nouveau projet ?',
9
+ validate: (input) => (input ? true : 'Le nom du projet est requis.'),
10
+ },
11
+ {
12
+ type: 'list',
13
+ name: 'phase',
14
+ message: 'Dans quelle phase se situe ce projet ?',
15
+ choices: ['Prototype (R&D)', 'Développement contractuel / Production'],
16
+ },
17
+ {
18
+ type: 'list',
19
+ name: 'stack',
20
+ message: 'Quel Framework principal voulez-vous installer ?',
21
+ choices: [
22
+ 'Next.js (React)',
23
+ 'React (Vite)',
24
+ 'API Node.js (Express)',
25
+ 'API Python (FastAPI)',
26
+ 'Projet vide',
27
+ ],
28
+ },
29
+ {
30
+ type: 'list',
31
+ name: 'database',
32
+ message: 'Quelle Base de données principale ?',
33
+ choices: ['PostgreSQL', 'MongoDB', 'Supabase', 'Aucune'],
34
+ },
35
+ {
36
+ type: 'list',
37
+ name: 'cloud',
38
+ message: 'Quel Cloud Provider principal ?',
39
+ choices: ['AWS', 'GCP', 'Azure', 'Vercel', 'Aucun'],
40
+ },
41
+ {
42
+ type: 'confirm',
43
+ name: 'includeDocker',
44
+ message: 'Voulez-vous préparer un dossier Docker ?',
45
+ default: true,
46
+ when: (ans) => ans.cloud !== 'Vercel',
47
+ },
48
+ {
49
+ type: 'confirm',
50
+ name: 'includeCI',
51
+ message: 'Voulez-vous inclure le template de CI/CD GEF ?',
52
+ default: true,
53
+ },
54
+ {
55
+ type: 'list',
56
+ name: 'containerRegistry',
57
+ message: 'Vers quel Container Registry voulez-vous pousser vos images Docker ?',
58
+ choices: [
59
+ 'Docker Hub',
60
+ 'GitHub Container Registry (GHCR)',
61
+ 'AWS ECR',
62
+ 'Aucun (pas de push d\'image)',
63
+ ],
64
+ when: (ans) => ans.includeDocker && ans.includeCI && ans.cloud !== 'Vercel',
65
+ },
66
+ // NOUVELLES QUESTIONS DYNAMIQUES
67
+ {
68
+ type: 'list',
69
+ name: 'gitWorkflow',
70
+ message: 'Quelle stratégie Git souhaitez-vous utiliser ?',
71
+ choices: [
72
+ 'GitHub Flow (Branches + PRs obligatoires - Recommandé)',
73
+ 'Trunk-Based Development (Push direct sur main autorisé)',
74
+ ],
75
+ },
76
+ {
77
+ type: 'list',
78
+ name: 'strictness',
79
+ message: 'Niveau de sévérité du Clean Code (Hard Limits) ?',
80
+ choices: [
81
+ 'Standard / Enterprise (30 lignes/fonction, complexité 10 - Recommandé)',
82
+ 'Startup / R&D (Souple : 50 lignes/fonction, complexité 15)',
83
+ 'Mission Critical (Strict : 15 lignes/fonction, complexité 5)',
84
+ ],
85
+ },
86
+ {
87
+ type: 'list',
88
+ name: 'linter',
89
+ message: 'Quel outil de Linting / Formatage ?',
90
+ choices: ['ESLint + Prettier', 'Biome', 'Ruff (Python)', 'Aucun'],
91
+ },
92
+ {
93
+ type: 'list',
94
+ name: 'language',
95
+ message: 'Langue de la documentation et des prompts IA ?',
96
+ choices: ['Français', 'English'],
97
+ },
98
+ ];