mcp-phase-gate 2.0.0 β 2.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.
- package/LICENSE +21 -21
- package/README.es.md +544 -570
- package/README.md +516 -497
- package/build/index.js +99 -74
- package/build/paths.d.ts +22 -1
- package/build/paths.js +223 -8
- package/build/phases.d.ts +3 -0
- package/build/phases.js +82 -5
- package/build/schemas.d.ts +94 -0
- package/build/schemas.js +108 -0
- package/build/tasks.d.ts +6 -2
- package/build/tasks.js +105 -23
- package/package.json +53 -53
- package/prompts/fase-1-descubrimiento.md +183 -167
- package/prompts/fase-2-decisiones.md +275 -208
- package/prompts/fase-3-plan-tecnico.md +321 -266
- package/prompts/fase-4-ejecucion.md +369 -235
- package/prompts/fase-5-auditoria-pr.md +231 -208
- package/prompts/global-rules.md +33 -4
package/README.md
CHANGED
|
@@ -1,497 +1,516 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
*Read this in [Spanish](README.es.md) Β· This is the English README.*
|
|
4
|
-
|
|
5
|
-
An MCP (Model Context Protocol) server that splits every incoming requirement into **five gated phases**, and forces each one to leave a written document behind before the next can start. Your client's panel will show it as `mcp-phase-gate`.
|
|
6
|
-
|
|
7
|
-
>
|
|
8
|
-
|
|
9
|
-
## The problem
|
|
10
|
-
|
|
11
|
-
You ask an AI assistant to implement a requirement and it does what they all do: it starts writing code. It breaks something it never read. It quietly makes decisions it never asked you about. And when you switch chats, or sit down at your other machine, the entire reasoning is gone β because it lived in the conversation, and **conversations don't travel**.
|
|
12
|
-
|
|
13
|
-
## How it solves it
|
|
14
|
-
|
|
15
|
-
The assistant doesn't get to touch code until phase 4. By then it has diagnosed the problem by reading the repository, asked you what it couldn't decide alone, and written a plan checked against the real code. Every phase leaves a document in a central folder, so the thinking outlives both the chat and the device.
|
|
16
|
-
|
|
17
|
-
```mermaid
|
|
18
|
-
flowchart TD
|
|
19
|
-
R([An email, a ticket, a requirement]) --> F1
|
|
20
|
-
F1["<b>1 Β· Discovery</b><br/>reads the code and diagnoses"]
|
|
21
|
-
F2["<b>2 Β· Decisions</b><br/>asks, validates, and stops"]
|
|
22
|
-
F3["<b>3 Β· Technical Plan</b><br/>turns decisions into exact code"]
|
|
23
|
-
F4["<b>4 Β· Execution</b><br/>implements and verifies by running"]
|
|
24
|
-
F5["<b>5 Β· Audit</b><br/>reviews as an outside reviewer"]
|
|
25
|
-
|
|
26
|
-
F1 -- "01 Β· Technical Analysis" --> F2
|
|
27
|
-
F2 -- "02 Β· Decisions" --> F3
|
|
28
|
-
F3 -- "03 Β· Technical Plan" --> F4
|
|
29
|
-
F4 -- "04 Β· Execution" --> F5
|
|
30
|
-
F5 --> PR([
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**The mandatory stop is phase 2**: it halts there and will not move on until you answer. This isn't a polite suggestion to ask questions β the phase does not close without your answers, and whatever you decide gets written down with its rationale.
|
|
34
|
-
|
|
35
|
-
And between one phase and the next there is a **gate**, which is what gives the server its name: ask for a phase while skipping the previous one and the server notices and warns you ([see below](#-the-gate-skipping-a-phase-stops-being-invisible)).
|
|
36
|
-
|
|
37
|
-
In phase
|
|
38
|
-
|
|
39
|
-
## Who it's for
|
|
40
|
-
|
|
41
|
-
For people working on **code that already exists and must not break**, who need a record of why each thing was done. It fits especially well if you work from more than one machine, or if you have to justify decisions weeks later.
|
|
42
|
-
|
|
43
|
-
It is not for throwaway prototypes or greenfield projects: five phases to change a colour is absurd ceremony.
|
|
44
|
-
|
|
45
|
-
It speaks standard MCP, so it works with any compatible client. It is **tested on Cursor, VS Code and Claude Code** β see [Installation](#-installation).
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## π How the documentation is organised
|
|
50
|
-
|
|
51
|
-
Every task lives in a folder with this fixed structure:
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
DOCUMENTATION/
|
|
55
|
-
βββ PROJECT-A/
|
|
56
|
-
β βββ Proyectos/
|
|
57
|
-
β βββ <task_name>/
|
|
58
|
-
β βββ 00 - Contexto Inicial.md β written by start_task
|
|
59
|
-
β βββ 01 - AnΓ‘lisis TΓ©cnico.md β Phase 1
|
|
60
|
-
β βββ 02 - Decisiones.md β Phase 2
|
|
61
|
-
β βββ 03 - Plan TΓ©cnico.md β Phase 3
|
|
62
|
-
β βββ 04 - EjecuciΓ³n
|
|
63
|
-
β
|
|
64
|
-
|
|
65
|
-
β
|
|
66
|
-
β
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
- **
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
"
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
- **
|
|
222
|
-
-
|
|
223
|
-
- **
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
`/
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
##
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
-
|
|
412
|
-
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
-
|
|
422
|
-
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
|
460
|
-
|
|
461
|
-
| `
|
|
462
|
-
| `
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
1
|
+
# mcp-phase-gate
|
|
2
|
+
|
|
3
|
+
*Read this in [Spanish](README.es.md) Β· This is the English README.*
|
|
4
|
+
|
|
5
|
+
An MCP (Model Context Protocol) server that splits every incoming requirement into **five gated phases**, and forces each one to leave a written document behind before the next can start. Your client's panel will show it as `mcp-phase-gate`.
|
|
6
|
+
|
|
7
|
+
> Tool names and most parameters are in English, but the tool descriptions and the server's messages are in Spanish, and so is one parameter: `crear_proyecto`. The **phase prompts that drive the AI's behaviour are written in Spanish**, so the documents it produces come out in Spanish. If you want them in another language, translate `prompts/*.md` β no code changes needed.
|
|
8
|
+
|
|
9
|
+
## The problem
|
|
10
|
+
|
|
11
|
+
You ask an AI assistant to implement a requirement and it does what they all do: it starts writing code. It breaks something it never read. It quietly makes decisions it never asked you about. And when you switch chats, or sit down at your other machine, the entire reasoning is gone β because it lived in the conversation, and **conversations don't travel**.
|
|
12
|
+
|
|
13
|
+
## How it solves it
|
|
14
|
+
|
|
15
|
+
The assistant doesn't get to touch code until phase 4. By then it has diagnosed the problem by reading the repository, asked you what it couldn't decide alone, and written a plan checked against the real code. Every phase leaves a document in a central folder, so the thinking outlives both the chat and the device.
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
R([An email, a ticket, a requirement]) --> F1
|
|
20
|
+
F1["<b>1 Β· Discovery</b><br/>reads the code and diagnoses"]
|
|
21
|
+
F2["<b>2 Β· Decisions</b><br/>asks, validates, and stops"]
|
|
22
|
+
F3["<b>3 Β· Technical Plan</b><br/>turns decisions into exact code"]
|
|
23
|
+
F4["<b>4 Β· Execution</b><br/>implements and verifies by running"]
|
|
24
|
+
F5["<b>5 Β· Audit</b><br/>reviews as an outside reviewer"]
|
|
25
|
+
|
|
26
|
+
F1 -- "01 Β· Technical Analysis" --> F2
|
|
27
|
+
F2 -- "02 Β· Decisions" --> F3
|
|
28
|
+
F3 -- "03 Β· Technical Plan" --> F4
|
|
29
|
+
F4 -- "04 Β· Execution" --> F5
|
|
30
|
+
F5 -- "05 Β· Audit" --> PR([PR description, also in the chat])
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**The mandatory stop is phase 2**: it halts there and will not move on until you answer. This isn't a polite suggestion to ask questions β the phase does not close without your answers, and whatever you decide gets written down with its rationale.
|
|
34
|
+
|
|
35
|
+
And between one phase and the next there is a **gate**, which is what gives the server its name: ask for a phase while skipping the previous one and the server notices and warns you ([see below](#-the-gate-skipping-a-phase-stops-being-invisible)).
|
|
36
|
+
|
|
37
|
+
In phase 4 the AI commits each batch only with your OK; it never pushes or opens the PR. In phase 5 it only reads.
|
|
38
|
+
|
|
39
|
+
## Who it's for
|
|
40
|
+
|
|
41
|
+
For people working on **code that already exists and must not break**, who need a record of why each thing was done. It fits especially well if you work from more than one machine, or if you have to justify decisions weeks later.
|
|
42
|
+
|
|
43
|
+
It is not for throwaway prototypes or greenfield projects: five phases to change a colour is absurd ceremony.
|
|
44
|
+
|
|
45
|
+
It speaks standard MCP, so it works with any compatible client. It is **tested on Cursor, VS Code and Claude Code** β see [Installation](#-installation).
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## π How the documentation is organised
|
|
50
|
+
|
|
51
|
+
Every task lives in a folder with this fixed structure:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
DOCUMENTATION/
|
|
55
|
+
βββ PROJECT-A/
|
|
56
|
+
β βββ Proyectos/
|
|
57
|
+
β βββ <task_name>/
|
|
58
|
+
β βββ 00 - Contexto Inicial.md β written by start_task
|
|
59
|
+
β βββ 01 - AnΓ‘lisis TΓ©cnico.md β Phase 1
|
|
60
|
+
β βββ 02 - Decisiones.md β Phase 2
|
|
61
|
+
β βββ 03 - Plan TΓ©cnico.md β Phase 3
|
|
62
|
+
β βββ 04 - EjecuciΓ³n/ β Phase 4, with more than one batch: one receipt each
|
|
63
|
+
β β βββ L01 - <slug>.md
|
|
64
|
+
β β βββ L02 - <slug>.md
|
|
65
|
+
β βββ 04 - EjecuciΓ³n.md β Phase 4: the receipt, or the index of receipts
|
|
66
|
+
β βββ 05 - AuditorΓa.md β Phase 5
|
|
67
|
+
βββ PROJECT-B/
|
|
68
|
+
β βββ Proyectos/
|
|
69
|
+
β βββ <task_name>/
|
|
70
|
+
βββ PROJECT-C/
|
|
71
|
+
βββ Proyectos/
|
|
72
|
+
βββ <task_name>/
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The `Proyectos` level is the tasks subfolder, and its name is configurable β see `ORQUESTADOR_TASKS_SUBDIR` below. The document names come from the phase prompts, which is why they are in Spanish by default.
|
|
76
|
+
|
|
77
|
+
**Batches and receipts.** The phase 3 plan splits the work into batches (`L01`, `L02`β¦): each one is a change that can be reverted on its own and leaves the application working. Phase 4 runs them one at a time and closes each batch with a short **receipt** (what was done, what was verified, what is waiting for you) and a commit. With a single batch, the receipt is `04 - EjecuciΓ³n.md` itself and there is no subfolder, unless that batch fails or is discarded: then its receipt goes in `04 - EjecuciΓ³n/` and the phase isn't marked as closed. With several, the receipts go in `04 - EjecuciΓ³n/` and `04 - EjecuciΓ³n.md` is the index written when the last one closes: until then the phase doesn't show as finished. When you ask for phase 4 or 5, the server appends the list of existing receipts to the prompt, so a new chat can pick up without guessing their names.
|
|
78
|
+
|
|
79
|
+
> The server builds this path **automatically**. You (or the LLM) only supply `project`, `task_name` and `file_name`; nobody has to type a full path.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## π» Installation
|
|
84
|
+
|
|
85
|
+
Two routes, same destination:
|
|
86
|
+
|
|
87
|
+
- **With `npx`** β nothing to clone or build, and it updates itself. Recommended if you just want to use it.
|
|
88
|
+
- **From source** β if you're going to edit the prompts in place, or contribute.
|
|
89
|
+
|
|
90
|
+
The code is identical everywhere; the only thing that changes between machines is **the paths to your folders**, because the system user and where you keep your documentation differ. That's why they are environment variables and not constants in the code.
|
|
91
|
+
|
|
92
|
+
### Prerequisites
|
|
93
|
+
- **Node.js 22 or newer.** Check with `node -v`. That's what `package.json` declares and the only thing CI tests (22 and 24); earlier versions are out of support.
|
|
94
|
+
- A folder for your central documentation, available locally. If it lives in a synced folder (OneDrive, Google Drive, Dropbox, iCloud) it travels between your machines on its own β that's the recommended setup, but not a requirement: the server only ever receives a local path and doesn't know what's behind it.
|
|
95
|
+
- **An MCP client**: Cursor, VS Code or Claude Code.
|
|
96
|
+
- **Git**, only for the from-source route.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### π Route A β with `npx` (recommended)
|
|
101
|
+
|
|
102
|
+
Nothing to install: `npx` fetches the package the first time and caches it. Everything is configured in your MCP client's file.
|
|
103
|
+
|
|
104
|
+
**The key you give it is what identifies the server and prefixes its tools**, so you can name it whatever you like. The examples use `mcp-phase-gate`, the same as the npm package and the name the server reports for itself β one name in all three places, so there's nothing to remember.
|
|
105
|
+
|
|
106
|
+
Remember that in JSON every `\` must be doubled as `\\`.
|
|
107
|
+
|
|
108
|
+
<details open>
|
|
109
|
+
<summary><b>Cursor</b> β <code>~/.cursor/mcp.json</code> (create it if missing)</summary>
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"mcpServers": {
|
|
114
|
+
"mcp-phase-gate": {
|
|
115
|
+
"command": "npx",
|
|
116
|
+
"args": ["-y", "mcp-phase-gate"],
|
|
117
|
+
"env": {
|
|
118
|
+
"ORQUESTADOR_DOCS_PATH": "C:\\Users\\YOUR_USER\\OneDrive - YOUR ORGANISATION\\Documents\\DOCUMENTATION",
|
|
119
|
+
"ORQUESTADOR_REPOS_PATH": "C:\\projects"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
</details>
|
|
126
|
+
|
|
127
|
+
<details>
|
|
128
|
+
<summary><b>VS Code</b> β <code>%APPDATA%\Code\User\mcp.json</code></summary>
|
|
129
|
+
|
|
130
|
+
Two differences to watch: the top-level key is `servers`, not `mcpServers`, and `type` must be declared.
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"servers": {
|
|
135
|
+
"mcp-phase-gate": {
|
|
136
|
+
"type": "stdio",
|
|
137
|
+
"command": "npx",
|
|
138
|
+
"args": ["-y", "mcp-phase-gate"],
|
|
139
|
+
"env": {
|
|
140
|
+
"ORQUESTADOR_DOCS_PATH": "C:\\Users\\YOUR_USER\\OneDrive - YOUR ORGANISATION\\Documents\\DOCUMENTATION",
|
|
141
|
+
"ORQUESTADOR_REPOS_PATH": "C:\\projects"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
</details>
|
|
148
|
+
|
|
149
|
+
<details>
|
|
150
|
+
<summary><b>Claude Code</b> β one line</summary>
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
claude mcp add mcp-phase-gate --env ORQUESTADOR_DOCS_PATH="C:\Users\YOUR_USER\Documents\DOCUMENTATION" --env ORQUESTADOR_REPOS_PATH="C:\projects" -- npx -y mcp-phase-gate
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Or by hand, in a `.mcp.json` at the project root, shaped like the Cursor one.
|
|
157
|
+
</details>
|
|
158
|
+
|
|
159
|
+
That `ORQUESTADOR_DOCS_PATH` is only an **example** using a OneDrive folder. `G:\My Drive\Documentation`, `D:\Dropbox\Docs` or plain `C:\Docs` with no cloud at all work just as well.
|
|
160
|
+
|
|
161
|
+
> **There is no `.env` on this route.** The package lives inside `node_modules`, which is no place to keep your configuration, so the paths go in the `"env"` block β that's the only option here. The `.env` file only exists on the route below.
|
|
162
|
+
|
|
163
|
+
**Both variables are required and have no default value.** If one is missing, or points at a folder that doesn't exist, the tools that need it say so by name instead of failing later for some unrelated-looking reason.
|
|
164
|
+
|
|
165
|
+
> Typing `npx mcp-phase-gate` straight into a terminal **looks like it hangs**, and nothing is broken: it's an MCP server waiting for messages on stdin. If you just want to check it's there, run `npx mcp-phase-gate --help`.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### π§ Route B β from source
|
|
170
|
+
|
|
171
|
+
Only needed if you're going to edit the repo's prompts directly, or contribute. You do *not* need it to add prompts of your own: that's done by layering folders, [see below](#-the-phase-prompts-live-in-prompts).
|
|
172
|
+
|
|
173
|
+
**1. Clone and build.** `build/` is **not** committed, so it has to be generated on every machine:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
git clone https://github.com/Montse2308/mcp-phase-gate.git
|
|
177
|
+
cd mcp-phase-gate
|
|
178
|
+
npm install
|
|
179
|
+
npm run build
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**2. Create your `.env`** with THIS machine's paths (never committed):
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
cp .env.example .env
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Single backslashes on Windows, no quotes:
|
|
189
|
+
|
|
190
|
+
```ini
|
|
191
|
+
ORQUESTADOR_DOCS_PATH=C:\Users\YOUR_USER\OneDrive - YOUR ORGANISATION\Documents\DOCUMENTATION
|
|
192
|
+
ORQUESTADOR_REPOS_PATH=C:\projects
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
> On Windows, save `.env` as **UTF-8 without BOM**. Creating it from PowerShell with `>` produces UTF-16, accented characters arrive mangled, and the path "doesn't exist" even though it looks right.
|
|
196
|
+
|
|
197
|
+
**3. Register the server** as in route A, but swapping `command` and `args` for your clone's `build/index.js`, and dropping the `"env"` block (the paths come from `.env` now):
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
"command": "node",
|
|
201
|
+
"args": ["C:\\<WHERE_YOU_CLONED>\\mcp-phase-gate\\build\\index.js"]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
In **Claude Code**, a `.mcp.json` at this repo's root can use a **relative** path (`"args": ["build/index.js"]`), since it launches the server from that folder. It's the only one of the three configs that works unchanged on any machine.
|
|
205
|
+
|
|
206
|
+
> If a variable is defined both in `.env` and in the client's `"env"` block, the client's wins.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### β
Verify it works
|
|
211
|
+
1. Restart the client, or toggle the server off and on in its MCP panel.
|
|
212
|
+
2. It should show up active with its 8 tools. In **Cursor** that's Settings β MCP; in **VS Code**, the extensions/MCP view; in **Claude Code**, `/mcp`.
|
|
213
|
+
3. Try it from the chat: *"Use the `get_active_task` tool from mcp-phase-gate"* β it should answer, even if only to say there's no active task yet.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## π Working across several machines
|
|
218
|
+
|
|
219
|
+
- If your documentation lives in a synced folder, it travels on its own. The only per-machine file is `.env` ([route B](#-route-b--from-source), step 2), which is local and never committed.
|
|
220
|
+
- The server remembers the **active task of each project** (see `get_active_task`). It's one pointer per project, not a single global one: you can have one window on one project and another on a different one without them clobbering each other. That record is **local to each machine** and lives in your user data folder, outside the repo, so it survives deleting `build/` or re-cloning:
|
|
221
|
+
- **Windows:** `%APPDATA%\mcp-phase-gate\active-tasks.json`
|
|
222
|
+
- **macOS:** `~/Library/Application Support/mcp-phase-gate/active-tasks.json`
|
|
223
|
+
- **Linux:** `~/.local/state/mcp-phase-gate/active-tasks.json`
|
|
224
|
+
|
|
225
|
+
If you switch machines or chats and the LLM "forgot" where to write, tell it to call `get_active_task`, or just give it `project` + `task_name`.
|
|
226
|
+
- **The phase isn't stored β it's derived.** The server looks at which documents the task folder already has and works out the phase from there, because each phase declares its own document's name. That's why the answer can never drift: delete `02 - Decisiones.md` because it came out wrong and the task drops back to Phase 2 on its own.
|
|
227
|
+
- And if the pointer file is lost β new machine, or you deleted it β `get_active_task` doesn't go silent: it proposes the most recently touched task and **tells you it's a guess**, so you can confirm before writing.
|
|
228
|
+
- **Golden rule:** if you use a synced folder, let the sync finish before starting work on the other machine, to avoid conflicted copies.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## π More than one documentation folder? (optional)
|
|
233
|
+
|
|
234
|
+
**This is not part of the flow. If one folder is enough for you, skip this section.**
|
|
235
|
+
|
|
236
|
+
You may want separate documentation sets that never mix β one for work and one for personal projects, say, each somewhere different, or one in the cloud and one not. Nothing new is needed: **register the server more than once** in your client, with a different `env` block each time.
|
|
237
|
+
|
|
238
|
+
```jsonc
|
|
239
|
+
{
|
|
240
|
+
"mcpServers": {
|
|
241
|
+
"orquestador-work": {
|
|
242
|
+
"command": "npx",
|
|
243
|
+
"args": ["-y", "mcp-phase-gate"],
|
|
244
|
+
"env": {
|
|
245
|
+
"ORQUESTADOR_DOCS_PATH": "C:\\Users\\YOUR_USER\\OneDrive - YOUR ORGANISATION\\Documents\\DOCUMENTATION",
|
|
246
|
+
"ORQUESTADOR_REPOS_PATH": "C:\\projects",
|
|
247
|
+
"ORQUESTADOR_STATE_PATH": "C:\\Users\\YOUR_USER\\.orquestador\\work"
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"orquestador-personal": {
|
|
251
|
+
"command": "npx",
|
|
252
|
+
"args": ["-y", "mcp-phase-gate"],
|
|
253
|
+
"env": {
|
|
254
|
+
"ORQUESTADOR_DOCS_PATH": "G:\\My Drive\\Documentation",
|
|
255
|
+
"ORQUESTADOR_REPOS_PATH": "D:\\dev",
|
|
256
|
+
"ORQUESTADOR_TASKS_SUBDIR": "",
|
|
257
|
+
"ORQUESTADOR_STATE_PATH": "C:\\Users\\YOUR_USER\\.orquestador\\personal"
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
It's the same package in both β only the paths differ. Each registration can even have its own tasks subfolder; above, the personal one leaves it empty so tasks hang directly off the project.
|
|
265
|
+
|
|
266
|
+
> β οΈ **`ORQUESTADOR_STATE_PATH` must differ between registrations.** Share it and the active-task pointers clobber each other **silently**: the state is keyed by project name, so two documentation roots holding a project with the same name end up sharing one entry, and one answers for the other. No error is raised β you just get the wrong task back.
|
|
267
|
+
|
|
268
|
+
Two more things that bite and aren't obvious:
|
|
269
|
+
|
|
270
|
+
- **Mirror mode, not streaming.** Google Drive in *streaming* mode and OneDrive with *Files On-Demand* leave files as placeholders until something opens them. This server lives on listing folders and checking whether files exist, so placeholders make it slow, or make it fail with no network. Keep the documentation folder **downloaded locally** if you can.
|
|
271
|
+
- **Keep code repos out of the synced folder.** Documentation in the cloud is fine. Code isn't: sync competing with git over `.git/` corrupts repositories. Point `ORQUESTADOR_REPOS_PATH` at a local disk.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## π§© What lives OUTSIDE the repo (one copy per machine)
|
|
276
|
+
|
|
277
|
+
`git pull` does **not** update these four things. If something stopped working right after pulling, the cause is almost always here.
|
|
278
|
+
|
|
279
|
+
| What | Where | Why it isn't in the repo |
|
|
280
|
+
|------|-------|--------------------------|
|
|
281
|
+
| The compiled server | `build/` in your clone | It's gitignored. **After every `git pull` that touches `src/`, run `npm run build`** or the client keeps executing the previous version. |
|
|
282
|
+
| This machine's paths | `.env` at the root ([route B](#-route-b--from-source), step 2) | The system user and the documentation folder differ per machine. |
|
|
283
|
+
| The MCP registration | Your client's config ([route A](#-route-a--with-npx-recommended), or step 3 of [route B](#-route-b--from-source)) | In Cursor and VS Code it holds the absolute path to `build/index.js`, which depends on where you cloned and points into a gitignored folder. No single path can be right on every machine. See [`docs/decisiones.md`](docs/decisiones.md). The exception is Claude Code's `.mcp.json`, which uses a relative path. |
|
|
284
|
+
| The `/f1`β`/f5` commands in **Cursor** | `~/.cursor/commands/f<N>.md` | Cursor only reads them from the user folder, so they're copied by hand on each machine. Not an issue in **Claude Code**: they're versioned in `.claude/commands/` and arrive with the pull. |
|
|
285
|
+
|
|
286
|
+
### The phase commands
|
|
287
|
+
|
|
288
|
+
You invoke them by typing `/f1`, `/f2`, etc. in the chat. **They are orchestration only**: which tools to call and in what order. The behaviour, the document's structure and its filename all come from the phase prompt in `prompts/`, so tuning a phase doesn't mean editing its command.
|
|
289
|
+
|
|
290
|
+
| Command | Calls | Document it leaves |
|
|
291
|
+
|---------|-------|--------------------|
|
|
292
|
+
| `/f1` | `start_task` + `get_phase_prompt(1)` | Phase 1's |
|
|
293
|
+
| `/f2` | `get_phase_prompt(2)`, reads phase 1's | Phase 2's, after you answer the questions |
|
|
294
|
+
| `/f3` | `get_phase_prompt(3)`, reads the previous ones | Phase 3's |
|
|
295
|
+
| `/f4` | `get_phase_prompt(4)`, reads the plan | One receipt per batch; the phase document when it closes |
|
|
296
|
+
| `/f5` | `get_phase_prompt(5)` | Phase 5's: the audit and the PR description, which also go in the chat |
|
|
297
|
+
|
|
298
|
+
No command names a file: the name is declared in each phase prompt's header and `get_phase_prompt` hands it to the model.
|
|
299
|
+
|
|
300
|
+
`/f1` expects data after the command: project, task_name and the full requirement. `/f5` accepts a commit range; without one it audits the commits recorded in the phase 4 receipts, and only asks if there are no receipts. The rest start from `get_active_task`.
|
|
301
|
+
|
|
302
|
+
**Where to put them, per client:**
|
|
303
|
+
|
|
304
|
+
- **Claude Code:** already in [`.claude/commands/`](.claude/commands), versioned. They work when you open this repo, no setup. To use them from your other projects, copy them to `~/.claude/commands/`.
|
|
305
|
+
- **Cursor:** copy them to `~/.cursor/commands/`. From there they work across all your projects.
|
|
306
|
+
- **VS Code:** no slash commands of its own; paste the file contents into the chat.
|
|
307
|
+
|
|
308
|
+
The exact contents of all five are also in [`docs/comandos-de-fase.md`](docs/comandos-de-fase.md) (Spanish).
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## π¦ The gate: skipping a phase stops being invisible
|
|
313
|
+
|
|
314
|
+
Ask for a phase ahead of the one you're on and the prompt arrives with a warning on top:
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
## ATENCIΓN β COMPUERTA DE FASE
|
|
318
|
+
|
|
319
|
+
Pediste la Fase 4, pero la tarea "login-sso" no tiene los documentos de fases anteriores:
|
|
320
|
+
|
|
321
|
+
- Fase 3: falta `03 - Plan TΓ©cnico.md`
|
|
322
|
+
|
|
323
|
+
Esta tarea va en la Fase 3 (Plan TΓ©cnico). NO hagas el trabajo de la Fase 4 sobre
|
|
324
|
+
documentos que no existen ni te los inventes a partir del contexto del chat.
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**It warns, it doesn't block.** The prompt is still delivered, so the day you want to skip a phase deliberately on a trivial change, you can. What changed is that it no longer goes unnoticed.
|
|
328
|
+
|
|
329
|
+
Three things it deliberately does **not** do:
|
|
330
|
+
|
|
331
|
+
- **It doesn't get in the way of going back.** On Phase 5 and asking for Phase 2 to fix decisions isn't skipping anything, and it stays quiet. It only looks for gaps behind you.
|
|
332
|
+
- **It doesn't make you type anything extra.** You still type `/f4` and nothing else. Working out which task you mean is the server's job, using the pointer it already keeps β not the model asking you.
|
|
333
|
+
- **It doesn't go quiet when it can't check.** If several projects have an active task and none was named, it says so instead of pretending everything is in order.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## π Protected documents
|
|
338
|
+
|
|
339
|
+
Each phase works on top of the previous phases' documents, so rewriting one that's already been passed silently changes the basis of everything that came after. That's why `write_central_doc` refuses, **without `force: true`**, to write:
|
|
340
|
+
|
|
341
|
+
- **The initial context** (`00 - Contexto Inicial.md`), always, even to create it. Only `start_task` writes it without `force`.
|
|
342
|
+
- **The document of a frozen phase.** A phase freezes as soon as a later phase's document exists, or as soon as phase 4 has any receipt in `04 - EjecuciΓ³n/`. Receipts count as phase 4: they and `04 - EjecuciΓ³n.md` are frozen only by phase 5.
|
|
343
|
+
|
|
344
|
+
Creating a phase document that doesn't exist yet is never refused; a new receipt is, once phase 5 is present. Names are compared ignoring case and in the same Unicode form, so spelling them differently doesn't get around the protection. If a legitimate fix is needed β a typo in the analysis when the decisions are already written β the refusal message explains how to ask for it: the AI only uses `force` with your explicit confirmation in the chat, and the response warns that the document was overwritten (or created, if it didn't exist).
|
|
345
|
+
|
|
346
|
+
On top of that, `write_central_doc` only writes **inside the folder of a task that already exists**: it doesn't create stray folders in the documentation.
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## π Available tools
|
|
351
|
+
|
|
352
|
+
| Tool | What it does |
|
|
353
|
+
|------|--------------|
|
|
354
|
+
| `start_task` | Creates the folder for a **new** task (`<PROJECT>/<tasks subfolder>/<task>`), saves the initial context and makes it the **active task of its project**. If the task already exists it refuses and points you at `switch_task`, so the initial context is never overwritten. |
|
|
355
|
+
| `get_active_task` | Returns the active task and **which phase it's on**, derived from the documents it already has. Without `project` it answers for every project. Use it when opening a new chat or after losing track. |
|
|
356
|
+
| `list_tasks` | Lists the tasks that exist and each one's phase, most recently touched first. For picking up something old or seeing what was left half-done. |
|
|
357
|
+
| `switch_task` | Changes which task is active for a project. **Touches no files**: it's the correct way to resume an existing task. |
|
|
358
|
+
| `get_phase_prompt` | Returns the behaviour rules for a phase (1β5), with the global rules prepended and the exact document filenames appended. The text lives in `prompts/`. It also checks the **gate**: pass `project` and, if you skipped a phase, the prompt arrives with the warning on top. |
|
|
359
|
+
| `read_central_doc` | Reads a file from the central documentation. **Recommended:** pass `project` + `task_name` + `file_name` and let the server build the path. It also accepts a relative `file_path`. |
|
|
360
|
+
| `write_central_doc` | Writes/overwrites a file inside a task folder. Same parameters as `read_central_doc` plus `content`, and `force` for [protected documents](#-protected-documents). |
|
|
361
|
+
| `read_cross_repo` | Reads files from your other local repos, so you can check how another codebase solved something without switching windows. |
|
|
362
|
+
|
|
363
|
+
### How the server builds paths
|
|
364
|
+
- **Documentation:** `ORQUESTADOR_DOCS_PATH` / `<PROJECT>` / `ORQUESTADOR_TASKS_SUBDIR` / `<task>` / `<file>`
|
|
365
|
+
- **Code repos:** `ORQUESTADOR_REPOS_PATH` / `<repo>` / `<file>`
|
|
366
|
+
|
|
367
|
+
### What counts as a project
|
|
368
|
+
|
|
369
|
+
There is no list of projects to maintain. **A project is any folder that contains the tasks subfolder**, so registering a new one just means creating that subfolder. Folders without it β credentials, shared material, dead archives β stay out on their own.
|
|
370
|
+
|
|
371
|
+
A project that doesn't exist is rejected, showing the list of the ones that do, instead of silently creating a stray folder. To **start** a brand new project you have to ask on purpose: `start_task` accepts `crear_proyecto: true`, and without that flag a typo can't pollute your documentation.
|
|
372
|
+
|
|
373
|
+
> If you leave `ORQUESTADOR_TASKS_SUBDIR` empty, the rule can't be applied and **any** folder counts as a project.
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## π The phase prompts live in `prompts/`
|
|
378
|
+
|
|
379
|
+
Each phase's text is a plain markdown file, not code:
|
|
380
|
+
|
|
381
|
+
```
|
|
382
|
+
prompts/
|
|
383
|
+
βββ global-rules.md β "Zero Breakage" rules, prepended to EVERY phase
|
|
384
|
+
βββ fase-1-descubrimiento.md
|
|
385
|
+
βββ fase-2-decisiones.md
|
|
386
|
+
βββ fase-3-plan-tecnico.md
|
|
387
|
+
βββ fase-4-ejecucion.md
|
|
388
|
+
βββ fase-5-auditoria-pr.md β includes the PR description contract
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
**They are read on every call.** Edit a `.md` and the next `get_phase_prompt` already returns the new version β no `npm run build`, no client restart. That's what makes it practical to tune a phase and test it immediately.
|
|
392
|
+
|
|
393
|
+
Each phase declares, in a header at the top of the file, what its document is called:
|
|
394
|
+
|
|
395
|
+
```markdown
|
|
396
|
+
---
|
|
397
|
+
documento: 02 - Decisiones.md
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
# Decisiones
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
`get_phase_prompt` reads that header and appends, at the end of the prompt, the exact filename for this phase and for the previous ones. **That's why the `/f1`β`/f5` commands no longer name any file:** the name lives in one place, so changing a prompt doesn't force you to edit a command on every machine too.
|
|
404
|
+
|
|
405
|
+
Phase 1 also declares `documento_inicial`, the file `start_task` writes with the initial context.
|
|
406
|
+
|
|
407
|
+
Format rules:
|
|
408
|
+
- The file must be named `fase-<N>-<anything>.md` (`phase-<N>-...` also works).
|
|
409
|
+
- The header is optional and never leaks into the prompt: it's stripped before delivery.
|
|
410
|
+
- **The number of phases is not hardcoded:** add `fase-6-deployment.md` and phase 6 exists immediately.
|
|
411
|
+
- The first `# Heading` in the file becomes the name shown in the tool description.
|
|
412
|
+
- `global-rules.md` is automatically prepended to the phase content.
|
|
413
|
+
|
|
414
|
+
### Using your own prompts without losing the packaged ones
|
|
415
|
+
|
|
416
|
+
`ORQUESTADOR_PROMPTS_PATH` points at a folder of yours that is **layered on top of** the packaged one. It does not replace it.
|
|
417
|
+
|
|
418
|
+
To change only phase 2, your folder holds **one file**:
|
|
419
|
+
|
|
420
|
+
```
|
|
421
|
+
my-prompts/
|
|
422
|
+
βββ fase-2-my-way.md
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
Phase 2 is now yours and phases 1, 3, 4 and 5 stay as the packaged ones β including whatever improvements new versions bring. This used to be a full replacement: changing one phase meant copying all six, ending up with frozen copies, and any phase you forgot to copy **disappeared with no warning**.
|
|
426
|
+
|
|
427
|
+
Three details that matter:
|
|
428
|
+
|
|
429
|
+
- **Layering is by phase number, not by filename.** Your `fase-2-my-way.md` overrides the package's `fase-2-decisiones.md`. You don't have to guess the original's name.
|
|
430
|
+
- **It also adds.** A `fase-6-deployment.md` in your folder creates phase 6, nothing else needed.
|
|
431
|
+
- **Your `global-rules.md` replaces the packaged one, it doesn't stack.** Concatenating two rule sets makes it impossible to tell which file an unwanted instruction came from, exactly when you need to know. If you want the packaged rules plus extras, copy them and add.
|
|
432
|
+
**Watch out:** the packaged rules include the `EVIDENCIA`, `BASE DE CADA DECISIΓN` and `PENDIENTES HEREDADOS` sections, which the phases refer to. A `global-rules.md` of your own without them leaves the phases pointing at rules that don't exist; copy them into your file.
|
|
433
|
+
|
|
434
|
+
On the `npx` route this is the **only** way to customise: the packaged prompts live inside `node_modules`, where editing them achieves nothing because the next install wipes them.
|
|
435
|
+
|
|
436
|
+
### The PR description contract (phase 5)
|
|
437
|
+
|
|
438
|
+
Phase 5 doesn't only audit: it drafts the PR description under a strict contract, so the result is consistent regardless of which AI model is used.
|
|
439
|
+
|
|
440
|
+
- **Title:** `type(area): sentence`, and nothing else β no ticket numbers.
|
|
441
|
+
- **Fixed structure:** the why (`Problem` if something was broken, `Context` if it's new) β grouped `Changes` β closing sections.
|
|
442
|
+
- **Closing sections are conditional**, each with its own trigger: `Scope` only if you touched existing code, `Verification` only if the testing was substantial, `Deployment notes` only if there are migrations.
|
|
443
|
+
- **How bullets are grouped depends on the shape of the change** (by component, by sub-feature, by data dimensionβ¦), with a decision table in the prompt. The description adapts to the size of the ticket without becoming unpredictable.
|
|
444
|
+
- **Length limits in words**, not adjectives: trivial (60β100), small (120β160), normal (200β260), large (350β450, hard cap 500).
|
|
445
|
+
- **Delivered inside a four-backtick code block**, so copy-pasting into GitHub gives you raw markdown instead of already-rendered text.
|
|
446
|
+
|
|
447
|
+
To adapt it to your own style, edit `prompts/fase-5-auditoria-pr.md`. The highest-leverage change is replacing the examples under "EJEMPLOS DE REFERENCIA" with PR descriptions of your own: models imitate that voice far more than they follow instructions.
|
|
448
|
+
|
|
449
|
+
> The reasoning behind each rule is in [`docs/decisiones.md`](docs/decisiones.md) (Spanish). Read it before changing things: several rules that look arbitrary are solving a concrete problem.
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## β Environment variables
|
|
454
|
+
|
|
455
|
+
Loaded from the `.env` at the repo root, or from the `"env"` block in your client config.
|
|
456
|
+
|
|
457
|
+
The first two are **required and have no default**: they point at folders that only exist on your machine, so any default would be somebody else's path. If one is missing, or points at something that doesn't exist or isn't a folder, the tools that use it return the variable name and where to configure it. Tools that don't depend on it β like `get_phase_prompt` β keep working.
|
|
458
|
+
|
|
459
|
+
| Variable | Default | Description |
|
|
460
|
+
|----------|---------|-------------|
|
|
461
|
+
| `ORQUESTADOR_DOCS_PATH` | **none, required** | Path to the root of your central documentation. **Different on each machine.** |
|
|
462
|
+
| `ORQUESTADOR_REPOS_PATH` | **none, required** | Path to the folder holding your code repositories. |
|
|
463
|
+
| `ORQUESTADOR_TASKS_SUBDIR` | `Proyectos` | Subfolder where tasks live inside each project. Empty means tasks hang directly off the project. It's also the rule that decides what counts as a project (see above). |
|
|
464
|
+
| `ORQUESTADOR_PROMPTS_PATH` | none | Folder holding your own prompts. They are **layered on top of** the packaged ones rather than replacing them, so you only drop in the phases you want to change ([see above](#using-your-own-prompts-without-losing-the-packaged-ones)). |
|
|
465
|
+
| `ORQUESTADOR_STATE_PATH` | Your user data folder (see above) | Where the active-task pointers are stored. Rarely needs touching; useful to isolate state in tests, and **required if you register the server more than once** (see [More than one documentation folder?](#-more-than-one-documentation-folder-optional)). |
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## π§βπ» Development (if you change the code)
|
|
470
|
+
|
|
471
|
+
> **Note:** this applies to **code** changes only. If all you edited was a prompt under `prompts/*.md`, there is **nothing to build and nothing to restart** β they're read on every call.
|
|
472
|
+
|
|
473
|
+
The source lives in `src/`, split by responsibility:
|
|
474
|
+
|
|
475
|
+
| File | What it handles |
|
|
476
|
+
|------|-----------------|
|
|
477
|
+
| `config.ts` | Environment paths, where state lives, server identity |
|
|
478
|
+
| `paths.ts` | How every path is built, and the check that it stays inside its base |
|
|
479
|
+
| `phases.ts` | Discovering the phases and assembling each one's prompt |
|
|
480
|
+
| `tasks.ts` | Which tasks exist, which phase each is on, and which one is active |
|
|
481
|
+
| `index.ts` | The server's tools. It computes nothing: it translates between the protocol and the above |
|
|
482
|
+
|
|
483
|
+
The client runs the compiled `build/index.js`, so after any change:
|
|
484
|
+
|
|
485
|
+
```bash
|
|
486
|
+
npm run build
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
Then restart the MCP server in your client so it picks up the new version.
|
|
490
|
+
|
|
491
|
+
Available scripts:
|
|
492
|
+
- `npm run build` β compiles TypeScript into `build/`.
|
|
493
|
+
- `npm test` β compiles the tests and runs them with Node's test runner (needs **Node 22+**).
|
|
494
|
+
- `npm start` β runs the compiled server.
|
|
495
|
+
- `npm run dev` β recompiles into `build/` on every change (`tsc --watch`).
|
|
496
|
+
|
|
497
|
+
Tests live in `test/` and need no extra dependency: they use `node:test`, which ships with
|
|
498
|
+
Node. They build a throwaway central-documentation tree in a temp folder, so they never touch
|
|
499
|
+
yours. CI runs them on every PR.
|
|
500
|
+
|
|
501
|
+
### Where everything is
|
|
502
|
+
|
|
503
|
+
| What you're looking for | Where |
|
|
504
|
+
|-------------------------|-------|
|
|
505
|
+
| What the project does today | This README (and its Spanish twin, [`README.es.md`](README.es.md) β **change one, change the other**) |
|
|
506
|
+
| Why it's designed this way | [`docs/decisiones.md`](docs/decisiones.md) (Spanish) |
|
|
507
|
+
| The `/f1`β`/f5` commands, to recreate them elsewhere | [`docs/comandos-de-fase.md`](docs/comandos-de-fase.md) (Spanish) |
|
|
508
|
+
| That a change broke nothing | [`test/`](test), via `npm test`. CI runs them on every PR |
|
|
509
|
+
| What's still missing | [Issues](https://github.com/Montse2308/mcp-phase-gate/issues) β grouped under the `v1-uso-propio` and `v2-publico` labels |
|
|
510
|
+
| What's already been done | The commit history and merged PRs |
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## π License
|
|
515
|
+
|
|
516
|
+
[MIT](LICENSE).
|