smart-spec-kit-mcp 2.0.0 → 2.0.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/README.md +111 -169
- package/dist/cli.d.ts +13 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +307 -0
- package/dist/cli.js.map +1 -0
- package/dist/tools/orchestrationTools.d.ts.map +1 -1
- package/dist/tools/orchestrationTools.js +84 -27
- package/dist/tools/orchestrationTools.js.map +1 -1
- package/dist/utils/starterKitInstaller.d.ts +44 -0
- package/dist/utils/starterKitInstaller.d.ts.map +1 -0
- package/dist/utils/starterKitInstaller.js +264 -0
- package/dist/utils/starterKitInstaller.js.map +1 -0
- package/package.json +10 -5
- package/starter-kit/memory/constitution.md +122 -0
- package/starter-kit/prompts/speckit.clarify.md +129 -0
- package/starter-kit/prompts/speckit.implement.md +122 -0
- package/starter-kit/prompts/speckit.init.md +153 -0
- package/starter-kit/prompts/speckit.plan.md +145 -0
- package/starter-kit/prompts/speckit.specify.md +123 -0
- package/starter-kit/prompts/speckit.tasks.md +137 -0
- package/starter-kit/templates/bugfix-report.md +127 -0
- package/starter-kit/templates/functional-spec.md +144 -0
- package/starter-kit/templates/plan-template.md +126 -0
- package/starter-kit/templates/tasks-template.md +153 -0
package/README.md
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
# 🚀 Spec-Kit MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/smart-spec-kit-mcp)
|
|
4
|
+
[](https://github.com/anthropic-ai/smart-spec-kit/actions/workflows/ci-cd.yml)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
Plateforme d'orchestration automatisée pour le **développement piloté par les spécifications** (Spec-Driven Development) via **GitHub Copilot** et **MCP** (Model Context Protocol).
|
|
4
8
|
|
|
5
9
|
## ✨ Fonctionnalités
|
|
6
10
|
|
|
7
|
-
-
|
|
11
|
+
- **📝 Slash Commands**: Commandes intégrées à VS Code Copilot (`/speckit.specify`, `/speckit.plan`, etc.)
|
|
12
|
+
- **🤖 Orchestration Automatisée**: Workflows guidés pour créer des spécifications complètes
|
|
8
13
|
- **🔄 Workflows YAML**: Processus personnalisables étape par étape
|
|
9
|
-
-
|
|
10
|
-
-
|
|
14
|
+
- **📋 Templates**: Spécifications fonctionnelles, plans d'implémentation, rapports de bugs
|
|
15
|
+
- **🛡️ Gouvernance Intégrée**: Constitution projet, principes de développement
|
|
11
16
|
- **🔗 Azure DevOps**: Intégration native via MCP
|
|
12
17
|
|
|
13
18
|
---
|
|
14
19
|
|
|
15
|
-
## ⚡ Installation
|
|
16
|
-
|
|
17
|
-
### Via Slash Command (Recommandé)
|
|
18
|
-
|
|
19
|
-
Dans **GitHub Copilot Chat**:
|
|
20
|
-
|
|
21
|
-
```text
|
|
22
|
-
/setupSpecKit
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
L'assistant configure tout automatiquement selon votre environnement.
|
|
20
|
+
## ⚡ Installation Rapide
|
|
26
21
|
|
|
27
|
-
###
|
|
22
|
+
### 1. Configurer VS Code
|
|
28
23
|
|
|
29
|
-
Ajoutez dans
|
|
24
|
+
Ajoutez dans `.vscode/settings.json` (créez le fichier si nécessaire):
|
|
30
25
|
|
|
31
26
|
```json
|
|
32
27
|
{
|
|
@@ -34,159 +29,104 @@ Ajoutez dans VS Code `settings.json`:
|
|
|
34
29
|
"servers": {
|
|
35
30
|
"spec-kit": {
|
|
36
31
|
"command": "npx",
|
|
37
|
-
"args": ["-y", "spec-kit-mcp"]
|
|
32
|
+
"args": ["-y", "smart-spec-kit-mcp"]
|
|
38
33
|
}
|
|
39
34
|
}
|
|
40
35
|
}
|
|
41
36
|
}
|
|
42
37
|
```
|
|
43
38
|
|
|
44
|
-
|
|
39
|
+
### 2. Recharger VS Code
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
`Ctrl+Shift+P` → "Developer: Reload Window"
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
git clone https://github.com/your-org/spec-kit-mcp.git
|
|
50
|
-
cd spec-kit-mcp
|
|
51
|
-
npm install
|
|
52
|
-
npm run build
|
|
53
|
-
```
|
|
43
|
+
### 3. Initialiser le Projet
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
"mcp": {
|
|
58
|
-
"servers": {
|
|
59
|
-
"spec-kit": {
|
|
60
|
-
"command": "node",
|
|
61
|
-
"args": ["/path/to/spec-kit-mcp/dist/index.js"]
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
45
|
+
Dans Copilot Chat, utilisez l'outil MCP `init` ou demandez:
|
|
66
46
|
```
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## 🚀 Usage
|
|
71
|
-
|
|
72
|
-
### Démarrer un Workflow
|
|
73
|
-
|
|
74
|
-
```text
|
|
75
|
-
@spec-kit start_workflow workflow_name="feature-standard" context_id="12345"
|
|
47
|
+
Initialise Spec-Kit dans ce projet
|
|
76
48
|
```
|
|
77
49
|
|
|
78
|
-
|
|
50
|
+
Cela crée:
|
|
51
|
+
```
|
|
52
|
+
votre-projet/
|
|
53
|
+
├── .github/
|
|
54
|
+
│ └── prompts/ # Slash commands pour Copilot
|
|
55
|
+
│ ├── speckit.init.md
|
|
56
|
+
│ ├── speckit.specify.md
|
|
57
|
+
│ ├── speckit.clarify.md
|
|
58
|
+
│ ├── speckit.plan.md
|
|
59
|
+
│ ├── speckit.tasks.md
|
|
60
|
+
│ └── speckit.implement.md
|
|
61
|
+
├── .spec-kit/
|
|
62
|
+
│ ├── templates/ # Templates de spécifications
|
|
63
|
+
│ └── memory/ # Contexte projet
|
|
64
|
+
│ └── constitution.md # Principes du projet
|
|
65
|
+
└── specs/ # Spécifications générées
|
|
66
|
+
```
|
|
79
67
|
|
|
80
|
-
|
|
81
|
-
2. Génération de la spécification (SpecAgent)
|
|
82
|
-
3. Planification technique (PlanAgent)
|
|
83
|
-
4. Validation gouvernance (GovAgent)
|
|
84
|
-
5. Création des artefacts
|
|
68
|
+
---
|
|
85
69
|
|
|
86
|
-
|
|
70
|
+
## 🎮 Slash Commands
|
|
87
71
|
|
|
88
|
-
|
|
72
|
+
Une fois installé, utilisez ces commandes dans Copilot Chat:
|
|
89
73
|
|
|
90
|
-
|
|
|
91
|
-
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
74
|
+
| Commande | Description |
|
|
75
|
+
|----------|-------------|
|
|
76
|
+
| `/speckit.init` | Initialise Spec-Kit dans le projet |
|
|
77
|
+
| `/speckit.specify` | Crée une spécification à partir des requirements |
|
|
78
|
+
| `/speckit.clarify` | Clarifie les zones ambiguës de la spec |
|
|
79
|
+
| `/speckit.plan` | Crée un plan d'implémentation technique |
|
|
80
|
+
| `/speckit.tasks` | Génère la liste des tâches à implémenter |
|
|
81
|
+
| `/speckit.implement` | Exécute les tâches d'implémentation |
|
|
95
82
|
|
|
96
83
|
---
|
|
97
84
|
|
|
98
|
-
##
|
|
85
|
+
## 🚀 Workflow Recommandé
|
|
99
86
|
|
|
100
|
-
###
|
|
87
|
+
### 1. Établir les principes du projet
|
|
101
88
|
|
|
102
|
-
|
|
103
|
-
| ----------------- | ------------------------------- |
|
|
104
|
-
| `start_workflow` | Démarre un workflow automatisé |
|
|
105
|
-
| `execute_step` | Continue à l'étape suivante |
|
|
106
|
-
| `workflow_status` | Statut de la session active |
|
|
107
|
-
| `list_workflows` | Liste les workflows disponibles |
|
|
108
|
-
| `abort_workflow` | Annule le workflow en cours |
|
|
89
|
+
Éditez `.spec-kit/memory/constitution.md` avec vos principes de développement.
|
|
109
90
|
|
|
110
|
-
###
|
|
91
|
+
### 2. Créer une spécification
|
|
111
92
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
| `help` | Aide et documentation |
|
|
93
|
+
```
|
|
94
|
+
/speckit.specify Build a user authentication feature with email/password login
|
|
95
|
+
```
|
|
116
96
|
|
|
117
|
-
|
|
97
|
+
### 3. Créer le plan technique
|
|
118
98
|
|
|
119
|
-
|
|
99
|
+
```
|
|
100
|
+
/speckit.plan Use TypeScript, Express.js, PostgreSQL, and JWT for authentication
|
|
101
|
+
```
|
|
120
102
|
|
|
121
|
-
|
|
122
|
-
| ------------ | ------------- | -------------------------------- |
|
|
123
|
-
| **SpecAgent**| Rédacteur | Spécifications fonctionnelles |
|
|
124
|
-
| **PlanAgent**| Planificateur | Découpage en tâches techniques |
|
|
125
|
-
| **GovAgent** | Validateur | Conformité RGPD, Sécurité, Archi |
|
|
126
|
-
| **TestAgent**| Testeur | Stratégies et cas de tests |
|
|
103
|
+
### 4. Générer les tâches
|
|
127
104
|
|
|
128
|
-
|
|
105
|
+
```
|
|
106
|
+
/speckit.tasks
|
|
107
|
+
```
|
|
129
108
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
├── src/
|
|
135
|
-
│ ├── index.ts # Entrypoint MCP Server
|
|
136
|
-
│ ├── engine/
|
|
137
|
-
│ │ ├── sessionManager.ts # Gestion des sessions
|
|
138
|
-
│ │ └── workflowEngine.ts # Moteur d'orchestration
|
|
139
|
-
│ ├── tools/
|
|
140
|
-
│ │ └── orchestrationTools.ts # Tools MCP
|
|
141
|
-
│ ├── prompts/
|
|
142
|
-
│ │ └── agents.ts # System prompts des agents
|
|
143
|
-
│ ├── schemas/
|
|
144
|
-
│ │ └── workflowSchema.ts # Validation Zod
|
|
145
|
-
│ └── utils/
|
|
146
|
-
│ ├── workflowLoader.ts # Chargeur YAML
|
|
147
|
-
│ └── markdownGenerator.ts # Générateur de templates
|
|
148
|
-
├── workflows/ # Définitions YAML
|
|
149
|
-
│ ├── feature-standard.yaml
|
|
150
|
-
│ ├── feature-full.yaml
|
|
151
|
-
│ └── bugfix.yaml
|
|
152
|
-
├── templates/ # Templates Markdown
|
|
153
|
-
│ ├── functional-spec.md
|
|
154
|
-
│ └── bugfix-report.md
|
|
155
|
-
└── .github/
|
|
156
|
-
└── copilot/
|
|
157
|
-
└── setupSpecKit.md # Slash command setup
|
|
109
|
+
### 5. Implémenter
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
/speckit.implement
|
|
158
113
|
```
|
|
159
114
|
|
|
160
115
|
---
|
|
161
116
|
|
|
162
|
-
##
|
|
117
|
+
## 🔧 Personnalisation
|
|
163
118
|
|
|
164
|
-
|
|
119
|
+
### Templates
|
|
165
120
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
"command": "npx",
|
|
172
|
-
"args": ["-y", "spec-kit-mcp"]
|
|
173
|
-
},
|
|
174
|
-
"azure-devops": {
|
|
175
|
-
"command": "npx",
|
|
176
|
-
"args": ["-y", "@modelcontextprotocol/server-azure-devops"],
|
|
177
|
-
"env": {
|
|
178
|
-
"AZURE_DEVOPS_ORG_URL": "https://dev.azure.com/your-org",
|
|
179
|
-
"AZURE_DEVOPS_PAT": "your-personal-access-token"
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
```
|
|
121
|
+
Personnalisez les templates dans `.spec-kit/templates/`:
|
|
122
|
+
- `functional-spec.md` - Spécification fonctionnelle
|
|
123
|
+
- `plan-template.md` - Plan d'implémentation
|
|
124
|
+
- `tasks-template.md` - Liste des tâches
|
|
125
|
+
- `bugfix-report.md` - Rapport de correction
|
|
186
126
|
|
|
187
|
-
|
|
127
|
+
### Workflows (Avancé)
|
|
188
128
|
|
|
189
|
-
|
|
129
|
+
Créez des workflows personnalisés dans `.spec-kit/workflows/`:
|
|
190
130
|
|
|
191
131
|
```yaml
|
|
192
132
|
name: mon-workflow
|
|
@@ -208,55 +148,57 @@ steps:
|
|
|
208
148
|
description: "Génère le contenu"
|
|
209
149
|
```
|
|
210
150
|
|
|
211
|
-
**Actions disponibles**: `fetch_ado`, `generate_content`, `call_agent`, `review`, `create_file`
|
|
212
|
-
|
|
213
151
|
---
|
|
214
152
|
|
|
215
|
-
##
|
|
153
|
+
## 🔗 Intégration Azure DevOps
|
|
216
154
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
155
|
+
Pour utiliser avec Azure DevOps:
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"mcp": {
|
|
160
|
+
"servers": {
|
|
161
|
+
"spec-kit": {
|
|
162
|
+
"command": "npx",
|
|
163
|
+
"args": ["-y", "smart-spec-kit-mcp"]
|
|
164
|
+
},
|
|
165
|
+
"azure-devops": {
|
|
166
|
+
"command": "npx",
|
|
167
|
+
"args": ["-y", "@anthropic-ai/azure-devops-mcp"],
|
|
168
|
+
"env": {
|
|
169
|
+
"AZURE_DEVOPS_ORG_URL": "https://dev.azure.com/your-org",
|
|
170
|
+
"AZURE_DEVOPS_PAT": "your-token"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
221
176
|
```
|
|
222
177
|
|
|
223
178
|
---
|
|
224
179
|
|
|
225
|
-
##
|
|
226
|
-
|
|
227
|
-
### Initialiser la config locale
|
|
180
|
+
## 🤖 Agents IA
|
|
228
181
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
182
|
+
| Agent | Rôle | Utilisation |
|
|
183
|
+
|-------|------|-------------|
|
|
184
|
+
| **SpecAgent** | Rédacteur | Spécifications fonctionnelles |
|
|
185
|
+
| **PlanAgent** | Planificateur | Découpage en tâches techniques |
|
|
186
|
+
| **GovAgent** | Validateur | Conformité RGPD, Sécurité, Archi |
|
|
187
|
+
| **TestAgent** | Testeur | Stratégies et cas de tests |
|
|
232
188
|
|
|
233
|
-
|
|
189
|
+
---
|
|
234
190
|
|
|
235
|
-
|
|
191
|
+
## 🧪 Développement
|
|
236
192
|
|
|
237
|
-
```
|
|
238
|
-
|
|
193
|
+
```bash
|
|
194
|
+
git clone https://github.com/anthropic-ai/smart-spec-kit.git
|
|
195
|
+
cd smart-spec-kit
|
|
196
|
+
npm install
|
|
197
|
+
npm run build
|
|
239
198
|
```
|
|
240
199
|
|
|
241
|
-
Affiche les chemins de recherche et workflows disponibles (locaux vs package).
|
|
242
|
-
|
|
243
|
-
### Ordre de résolution
|
|
244
|
-
|
|
245
|
-
1. **Local**: `.spec-kit/workflows/` et `.spec-kit/templates/`
|
|
246
|
-
2. **Package**: Workflows par défaut (feature-standard, bugfix, etc.)
|
|
247
|
-
|
|
248
|
-
> 📖 Voir [docs/PACKAGING.md](docs/PACKAGING.md) pour le guide complet de personnalisation.
|
|
249
|
-
|
|
250
200
|
---
|
|
251
201
|
|
|
252
|
-
##
|
|
202
|
+
## 📄 License
|
|
253
203
|
|
|
254
204
|
MIT
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
## 🙏 Technologies
|
|
259
|
-
|
|
260
|
-
- [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/sdk) - MCP Framework
|
|
261
|
-
- [Zod](https://zod.dev) - Schema Validation
|
|
262
|
-
- [js-yaml](https://github.com/nodeca/js-yaml) - YAML Parser
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Spec-Kit Setup CLI
|
|
4
|
+
*
|
|
5
|
+
* Automatise l'installation de Spec-Kit sur une machine de développement:
|
|
6
|
+
* - Copie les slash commands (prompts) dans le projet
|
|
7
|
+
* - Configure VS Code settings.json
|
|
8
|
+
* - Affiche les instructions
|
|
9
|
+
*
|
|
10
|
+
* Usage: npx smart-spec-kit-mcp setup [options]
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Spec-Kit Setup CLI
|
|
4
|
+
*
|
|
5
|
+
* Automatise l'installation de Spec-Kit sur une machine de développement:
|
|
6
|
+
* - Copie les slash commands (prompts) dans le projet
|
|
7
|
+
* - Configure VS Code settings.json
|
|
8
|
+
* - Affiche les instructions
|
|
9
|
+
*
|
|
10
|
+
* Usage: npx smart-spec-kit-mcp setup [options]
|
|
11
|
+
*/
|
|
12
|
+
import * as fs from "node:fs/promises";
|
|
13
|
+
import * as path from "node:path";
|
|
14
|
+
import * as os from "node:os";
|
|
15
|
+
import { fileURLToPath } from "node:url";
|
|
16
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const PACKAGE_ROOT = path.resolve(__dirname, "..");
|
|
18
|
+
// Couleurs pour le terminal
|
|
19
|
+
const colors = {
|
|
20
|
+
reset: "\x1b[0m",
|
|
21
|
+
green: "\x1b[32m",
|
|
22
|
+
yellow: "\x1b[33m",
|
|
23
|
+
blue: "\x1b[34m",
|
|
24
|
+
cyan: "\x1b[36m",
|
|
25
|
+
red: "\x1b[31m",
|
|
26
|
+
bold: "\x1b[1m",
|
|
27
|
+
};
|
|
28
|
+
function log(message, color = colors.reset) {
|
|
29
|
+
console.log(`${color}${message}${colors.reset}`);
|
|
30
|
+
}
|
|
31
|
+
function logStep(step, message) {
|
|
32
|
+
console.log(`\n${colors.cyan}[${step}/4]${colors.reset} ${colors.bold}${message}${colors.reset}`);
|
|
33
|
+
}
|
|
34
|
+
async function fileExists(filePath) {
|
|
35
|
+
try {
|
|
36
|
+
await fs.access(filePath);
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function ensureDir(dirPath) {
|
|
44
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
45
|
+
}
|
|
46
|
+
async function copyDir(src, dest) {
|
|
47
|
+
await ensureDir(dest);
|
|
48
|
+
const entries = await fs.readdir(src, { withFileTypes: true });
|
|
49
|
+
let count = 0;
|
|
50
|
+
for (const entry of entries) {
|
|
51
|
+
const srcPath = path.join(src, entry.name);
|
|
52
|
+
const destPath = path.join(dest, entry.name);
|
|
53
|
+
if (entry.isDirectory()) {
|
|
54
|
+
count += await copyDir(srcPath, destPath);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
await fs.copyFile(srcPath, destPath);
|
|
58
|
+
count++;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return count;
|
|
62
|
+
}
|
|
63
|
+
async function getVSCodeSettingsPath() {
|
|
64
|
+
const platform = os.platform();
|
|
65
|
+
let settingsPath;
|
|
66
|
+
if (platform === "win32") {
|
|
67
|
+
settingsPath = path.join(os.homedir(), "AppData", "Roaming", "Code", "User", "settings.json");
|
|
68
|
+
}
|
|
69
|
+
else if (platform === "darwin") {
|
|
70
|
+
settingsPath = path.join(os.homedir(), "Library", "Application Support", "Code", "User", "settings.json");
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
settingsPath = path.join(os.homedir(), ".config", "Code", "User", "settings.json");
|
|
74
|
+
}
|
|
75
|
+
// Check for VS Code Insiders
|
|
76
|
+
if (!(await fileExists(settingsPath))) {
|
|
77
|
+
const insidersPath = settingsPath.replace("Code", "Code - Insiders");
|
|
78
|
+
if (await fileExists(insidersPath)) {
|
|
79
|
+
return insidersPath;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return settingsPath;
|
|
83
|
+
}
|
|
84
|
+
async function updateVSCodeSettings(settingsPath) {
|
|
85
|
+
let settings = {};
|
|
86
|
+
// Read existing settings
|
|
87
|
+
if (await fileExists(settingsPath)) {
|
|
88
|
+
try {
|
|
89
|
+
const content = await fs.readFile(settingsPath, "utf-8");
|
|
90
|
+
// Remove comments (simple approach for JSON with comments)
|
|
91
|
+
const cleanContent = content.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
92
|
+
settings = JSON.parse(cleanContent);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
log("⚠️ Impossible de parser settings.json existant, création d'un nouveau", colors.yellow);
|
|
96
|
+
settings = {};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Check if MCP config already exists
|
|
100
|
+
const mcp = settings.mcp;
|
|
101
|
+
const servers = mcp?.servers;
|
|
102
|
+
if (servers?.["spec-kit"]) {
|
|
103
|
+
log(" spec-kit déjà configuré dans VS Code", colors.green);
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
// Add spec-kit configuration
|
|
107
|
+
if (!settings.mcp) {
|
|
108
|
+
settings.mcp = { servers: {} };
|
|
109
|
+
}
|
|
110
|
+
if (!settings.mcp.servers) {
|
|
111
|
+
settings.mcp.servers = {};
|
|
112
|
+
}
|
|
113
|
+
const mcpServers = settings.mcp.servers;
|
|
114
|
+
mcpServers["spec-kit"] = {
|
|
115
|
+
command: "npx",
|
|
116
|
+
args: ["-y", "smart-spec-kit-mcp"]
|
|
117
|
+
};
|
|
118
|
+
// Write updated settings
|
|
119
|
+
await ensureDir(path.dirname(settingsPath));
|
|
120
|
+
await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
async function copyPromptsToProject(projectPath) {
|
|
124
|
+
const srcPrompts = path.join(PACKAGE_ROOT, ".github", "copilot", "prompts");
|
|
125
|
+
const destPrompts = path.join(projectPath, ".github", "copilot", "prompts");
|
|
126
|
+
if (!(await fileExists(srcPrompts))) {
|
|
127
|
+
log("⚠️ Dossier prompts non trouvé dans le package", colors.yellow);
|
|
128
|
+
return 0;
|
|
129
|
+
}
|
|
130
|
+
return await copyDir(srcPrompts, destPrompts);
|
|
131
|
+
}
|
|
132
|
+
async function addToGitignore(projectPath) {
|
|
133
|
+
const gitignorePath = path.join(projectPath, ".gitignore");
|
|
134
|
+
const specKitIgnore = "\n# Spec-Kit sessions (auto-generated)\n.spec-kit-sessions/\n";
|
|
135
|
+
if (await fileExists(gitignorePath)) {
|
|
136
|
+
const content = await fs.readFile(gitignorePath, "utf-8");
|
|
137
|
+
if (!content.includes(".spec-kit-sessions")) {
|
|
138
|
+
await fs.appendFile(gitignorePath, specKitIgnore);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async function main() {
|
|
143
|
+
const args = process.argv.slice(2);
|
|
144
|
+
const command = args[0];
|
|
145
|
+
// Help command
|
|
146
|
+
if (command === "setup" && (args.includes("--help") || args.includes("-h"))) {
|
|
147
|
+
console.log(`
|
|
148
|
+
${colors.bold}Spec-Kit Setup CLI${colors.reset}
|
|
149
|
+
|
|
150
|
+
${colors.cyan}Usage:${colors.reset}
|
|
151
|
+
npx smart-spec-kit-mcp setup [options]
|
|
152
|
+
|
|
153
|
+
${colors.cyan}Options:${colors.reset}
|
|
154
|
+
--project <path> Chemin du projet (défaut: répertoire courant)
|
|
155
|
+
--skip-vscode Ne pas modifier VS Code settings.json
|
|
156
|
+
--skip-prompts Ne pas copier les slash commands
|
|
157
|
+
--dry-run Afficher ce qui serait fait sans rien modifier
|
|
158
|
+
-h, --help Afficher cette aide
|
|
159
|
+
|
|
160
|
+
${colors.cyan}Exemples:${colors.reset}
|
|
161
|
+
npx smart-spec-kit-mcp setup
|
|
162
|
+
npx smart-spec-kit-mcp setup --project ./mon-projet
|
|
163
|
+
npx smart-spec-kit-mcp setup --dry-run
|
|
164
|
+
npx smart-spec-kit-mcp setup --skip-vscode
|
|
165
|
+
`);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (command !== "setup") {
|
|
169
|
+
// If no setup command, run as MCP server (default behavior)
|
|
170
|
+
// Import and run the main server
|
|
171
|
+
await import("./index.js");
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
// Parse options
|
|
175
|
+
const projectPath = args.includes("--project")
|
|
176
|
+
? (args[args.indexOf("--project") + 1] ?? process.cwd())
|
|
177
|
+
: process.cwd();
|
|
178
|
+
const skipVSCode = args.includes("--skip-vscode");
|
|
179
|
+
const skipPrompts = args.includes("--skip-prompts");
|
|
180
|
+
const dryRun = args.includes("--dry-run");
|
|
181
|
+
console.log(`
|
|
182
|
+
${colors.cyan}╔═══════════════════════════════════════════════════════════╗
|
|
183
|
+
║ ║
|
|
184
|
+
║ ${colors.bold}🚀 Spec-Kit Setup${colors.reset}${colors.cyan}${dryRun ? " (DRY RUN)" : ""} ║
|
|
185
|
+
║ Installation automatisée pour développeurs ║
|
|
186
|
+
║ ║
|
|
187
|
+
╚═══════════════════════════════════════════════════════════╝${colors.reset}
|
|
188
|
+
`);
|
|
189
|
+
if (dryRun) {
|
|
190
|
+
log("🔍 Mode dry-run: aucune modification ne sera effectuée\n", colors.yellow);
|
|
191
|
+
}
|
|
192
|
+
log(`📁 Projet: ${projectPath}`, colors.blue);
|
|
193
|
+
// Step 1: Copy prompts to project
|
|
194
|
+
if (!skipPrompts) {
|
|
195
|
+
logStep(1, "Installation des slash commands...");
|
|
196
|
+
if (dryRun) {
|
|
197
|
+
log(" 📋 Copierait les prompts dans .github/copilot/prompts/", colors.yellow);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
const promptsCount = await copyPromptsToProject(projectPath);
|
|
201
|
+
if (promptsCount > 0) {
|
|
202
|
+
log(` ✅ ${promptsCount} fichiers copiés dans .github/copilot/prompts/`, colors.green);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
log(" ⏭️ Aucun prompt à copier", colors.yellow);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
logStep(1, "Slash commands (ignoré)");
|
|
211
|
+
}
|
|
212
|
+
// Step 2: Configure VS Code
|
|
213
|
+
if (!skipVSCode) {
|
|
214
|
+
logStep(2, "Configuration de VS Code...");
|
|
215
|
+
const settingsPath = await getVSCodeSettingsPath();
|
|
216
|
+
if (settingsPath) {
|
|
217
|
+
if (dryRun) {
|
|
218
|
+
log(` 📋 Ajouterait MCP server à ${settingsPath}`, colors.yellow);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
const updated = await updateVSCodeSettings(settingsPath);
|
|
222
|
+
if (updated) {
|
|
223
|
+
log(` ✅ MCP server ajouté à ${settingsPath}`, colors.green);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
log(" ⚠️ VS Code settings.json non trouvé", colors.yellow);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
logStep(2, "VS Code config (ignoré)");
|
|
233
|
+
}
|
|
234
|
+
// Step 3: Update .gitignore
|
|
235
|
+
logStep(3, "Mise à jour .gitignore...");
|
|
236
|
+
if (dryRun) {
|
|
237
|
+
log(" 📋 Ajouterait .spec-kit-sessions/ au .gitignore", colors.yellow);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
await addToGitignore(projectPath);
|
|
241
|
+
log(" ✅ .spec-kit-sessions/ ajouté au .gitignore", colors.green);
|
|
242
|
+
}
|
|
243
|
+
// Step 4: Create .spec-kit directory (optional)
|
|
244
|
+
logStep(4, "Création de la config locale...");
|
|
245
|
+
const specKitDir = path.join(projectPath, ".spec-kit");
|
|
246
|
+
if (!(await fileExists(specKitDir))) {
|
|
247
|
+
if (dryRun) {
|
|
248
|
+
log(" 📋 Créerait le dossier .spec-kit/", colors.yellow);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
await ensureDir(path.join(specKitDir, "workflows"));
|
|
252
|
+
await ensureDir(path.join(specKitDir, "templates"));
|
|
253
|
+
log(" ✅ Dossier .spec-kit/ créé", colors.green);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
log(" ⏭️ .spec-kit/ existe déjà", colors.yellow);
|
|
258
|
+
}
|
|
259
|
+
// Final instructions
|
|
260
|
+
if (dryRun) {
|
|
261
|
+
console.log(`
|
|
262
|
+
${colors.yellow}╔═══════════════════════════════════════════════════════════╗
|
|
263
|
+
║ ║
|
|
264
|
+
║ ${colors.bold}🔍 Dry run terminé - aucune modification effectuée${colors.reset}${colors.yellow} ║
|
|
265
|
+
║ ║
|
|
266
|
+
╚═══════════════════════════════════════════════════════════╝${colors.reset}
|
|
267
|
+
|
|
268
|
+
Exécutez sans --dry-run pour appliquer les changements.
|
|
269
|
+
`);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
console.log(`
|
|
273
|
+
${colors.green}╔═══════════════════════════════════════════════════════════╗
|
|
274
|
+
║ ║
|
|
275
|
+
║ ${colors.bold}✅ Installation terminée!${colors.reset}${colors.green} ║
|
|
276
|
+
║ ║
|
|
277
|
+
╚═══════════════════════════════════════════════════════════╝${colors.reset}
|
|
278
|
+
|
|
279
|
+
${colors.bold}Prochaines étapes:${colors.reset}
|
|
280
|
+
|
|
281
|
+
1. ${colors.cyan}Rechargez VS Code:${colors.reset}
|
|
282
|
+
Ctrl+Shift+P → "Developer: Reload Window"
|
|
283
|
+
|
|
284
|
+
2. ${colors.cyan}Testez l'installation:${colors.reset}
|
|
285
|
+
Dans Copilot Chat, tapez: /spec-kit-ping
|
|
286
|
+
|
|
287
|
+
3. ${colors.cyan}Démarrez un workflow:${colors.reset}
|
|
288
|
+
/spec-kit-start
|
|
289
|
+
|
|
290
|
+
${colors.bold}Slash commands disponibles:${colors.reset}
|
|
291
|
+
/spec-kit-ping Vérifie le serveur
|
|
292
|
+
/spec-kit-init Initialise les templates
|
|
293
|
+
/spec-kit-list Liste les workflows
|
|
294
|
+
/spec-kit-start Démarre un workflow
|
|
295
|
+
/spec-kit-status Statut du workflow
|
|
296
|
+
/spec-kit-continue Continue le workflow
|
|
297
|
+
/spec-kit-abort Annule le workflow
|
|
298
|
+
/spec-kit-config Affiche la config
|
|
299
|
+
|
|
300
|
+
${colors.blue}Documentation: https://github.com/anthropic-ai/smart-spec-kit${colors.reset}
|
|
301
|
+
`);
|
|
302
|
+
}
|
|
303
|
+
main().catch((error) => {
|
|
304
|
+
console.error(`${colors.red}Erreur:${colors.reset}`, error);
|
|
305
|
+
process.exit(1);
|
|
306
|
+
});
|
|
307
|
+
//# sourceMappingURL=cli.js.map
|