mddd-cli 6.2.2 → 7.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/.agents/skills/md-audit/SKILL.md +36 -34
- package/.agents/skills/md-edit/SKILL.md +38 -50
- package/.agents/skills/md-impl/SKILL.md +58 -48
- package/.agents/skills/md-new/SKILL.md +29 -40
- package/.agents/templates/spec-template.md +22 -40
- package/AGENTS.md +192 -0
- package/bin/cli.js +15 -1
- package/package.json +2 -2
- package/readme.md +105 -19
- package/src/commands/init.js +3 -3
- package/src/commands/status.js +534 -0
- package/src/commands/status.spec.md +131 -0
- package/src/services/FileSystemService.spec.md +3 -1
- package/src/services/InitService.js +1 -1
- package/src/services/InitService.spec.md +7 -5
- package/system_prompt.md +0 -171
package/bin/cli.js
CHANGED
|
@@ -8,6 +8,7 @@ import { SpecFinderService } from '../src/services/SpecFinderService.js';
|
|
|
8
8
|
import { validateMermaidSyntax } from '../src/commands/validator.js';
|
|
9
9
|
import * as initCmd from '../src/commands/init.js';
|
|
10
10
|
import * as listSpecsCmd from '../src/commands/listSpecs.js';
|
|
11
|
+
import * as statusCmd from '../src/commands/status.js';
|
|
11
12
|
|
|
12
13
|
// ─── Services ───────────────────────────────────────────────────────────────
|
|
13
14
|
const fs = new FileSystemService();
|
|
@@ -20,7 +21,7 @@ const program = new Command();
|
|
|
20
21
|
program
|
|
21
22
|
.name('md')
|
|
22
23
|
.description('Manager for co-located specifications for Mermaid Diagram Driven Development (MDDD)')
|
|
23
|
-
.version('
|
|
24
|
+
.version('7.1.0');
|
|
24
25
|
|
|
25
26
|
// ==========================================
|
|
26
27
|
// COMMAND: md init
|
|
@@ -54,6 +55,19 @@ program
|
|
|
54
55
|
process.exit(0);
|
|
55
56
|
});
|
|
56
57
|
|
|
58
|
+
program
|
|
59
|
+
.command('status')
|
|
60
|
+
.description('Generate a beautiful MDDD coverage report with metrics from all .spec.md files')
|
|
61
|
+
.action(async () => {
|
|
62
|
+
try {
|
|
63
|
+
await statusCmd.execute(specFinderService);
|
|
64
|
+
process.exit(0);
|
|
65
|
+
} catch (err) {
|
|
66
|
+
console.error(pc.red(`❌ ${err.message}`));
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
57
71
|
program
|
|
58
72
|
.command('list-specs')
|
|
59
73
|
.description('List all .spec.md files in the project tree (returns JSON)')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mddd-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Official CLI for modular, co-located, and versioned Mermaid Diagram Driven Development (MDDD).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./bin/cli.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"src",
|
|
12
|
-
"
|
|
12
|
+
"AGENTS.md",
|
|
13
13
|
".agents/skills",
|
|
14
14
|
".agents/templates"
|
|
15
15
|
],
|
package/readme.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Mermaid Diagram Driven Development (MDDD) CLI 🚀
|
|
2
2
|
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-

|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -155,7 +155,7 @@ md init
|
|
|
155
155
|
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
This will create the `
|
|
158
|
+
This will create the `AGENTS.md` and `SKILL.md` files in the root directory, containing the global instructions that will guide the AI in understanding the MDDD methodology and interacting with Git logs. You can rename `AGENTS.md` to any .rules file you need (.cursorrules, .clinerules, etc.).
|
|
159
159
|
|
|
160
160
|
### 2. Audit legacy files or make new ones.
|
|
161
161
|
|
|
@@ -184,6 +184,33 @@ After running `md init`, your AI will understand these shortcuts when you type t
|
|
|
184
184
|
| `md-edit` | Requests changes to an existing `.spec.md` file (increments semantic version). |
|
|
185
185
|
| `md-audit` | Analyzes legacy code and proposes visual refactoring (Mermaid). |
|
|
186
186
|
| `md-impl` | Generates code and tests strictly based on the `.spec.md` layout, managing version history. |
|
|
187
|
+
| `mddd-context-map` | Generates a multi-level product architecture diagram (flowchart LR) from all `.spec.md` files. Classifies specs as MACRO/MICRO, maps data flows, and produces an `ARCHITECTURE.spec.md` with styled nodes and labeled edges. |
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## 🗺️ Architecture Context Map
|
|
192
|
+
|
|
193
|
+
The `mddd-context-map` skill teaches the AI agent to produce a **product architecture diagram** that visualizes your system at **multiple levels**:
|
|
194
|
+
|
|
195
|
+
- **Macro areas (domains)** — each MACRO spec represents a high-level domain or business capability.
|
|
196
|
+
- **Micro components/services** — MICRO specs are the building blocks inside each domain.
|
|
197
|
+
- **Data flows** — connections between users, UI, backend, serverless functions, and external infrastructure.
|
|
198
|
+
|
|
199
|
+
The output is a stylized **`flowchart LR`** that combines domain grouping with internal components and external integrations, using `classDef` styling to differentiate node types:
|
|
200
|
+
|
|
201
|
+
| Node Class | Purpose | Visual |
|
|
202
|
+
| :--- | :--- | :--- |
|
|
203
|
+
| `userNode` | People, personas, roles | Warm yellow |
|
|
204
|
+
| `systemNode` | Internal services/components | Professional blue |
|
|
205
|
+
| `externalNode` | Third-party APIs, partner systems | Stand-out red-orange |
|
|
206
|
+
| `infraNode` | Databases, queues, caches | Subdued italic gray |
|
|
207
|
+
|
|
208
|
+
### How to use
|
|
209
|
+
|
|
210
|
+
1. Initialize your project with `md init` (this copies the architecture template to `.agents/templates/`).
|
|
211
|
+
2. Ask the AI to generate the context map — it will scan all `.spec.md` files, classify them as MACRO/MICRO, and compose the diagram.
|
|
212
|
+
3. The output is saved to `ARCHITECTURE.spec.md` at the project root.
|
|
213
|
+
4. Every diagram is validated with `npx md validate` before being written.
|
|
187
214
|
|
|
188
215
|
---
|
|
189
216
|
|
|
@@ -208,8 +235,9 @@ src/
|
|
|
208
235
|
## 📦 CLI Commands
|
|
209
236
|
|
|
210
237
|
| Command | Description |
|
|
211
|
-
|
|
|
212
|
-
| `md init` | Configures the `
|
|
238
|
+
| :--- | :--- |
|
|
239
|
+
| `md init` | Configures the `AGENTS.md` file and the SKILL.md files which instructs the AI how to behave. Run this everytime you update MDDD-CLI NPM Package. |
|
|
240
|
+
| `md status` | Generates a beautiful MDDD coverage report with metrics from all `.spec.md` files. Shows specs classification (Cohesive/Chaotic), task progress, version changes, and impact metrics. |
|
|
213
241
|
|
|
214
242
|
### Project Architecture
|
|
215
243
|
|
|
@@ -222,10 +250,25 @@ bin/
|
|
|
222
250
|
|
|
223
251
|
src/
|
|
224
252
|
├── commands/ # Command layer
|
|
225
|
-
│
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
253
|
+
│ ├── init.js # Init command
|
|
254
|
+
│ ├── listSpecs.js # List specs command
|
|
255
|
+
│ ├── status.js # Status command
|
|
256
|
+
│ ├── status.spec.md # Status spec
|
|
257
|
+
│ └── validator.js # Validator utility
|
|
258
|
+
├── services/ # Shared services with DI
|
|
259
|
+
│ ├── FileSystemService.js
|
|
260
|
+
│ ├── FileSystemService.spec.md
|
|
261
|
+
│ ├── InitService.js
|
|
262
|
+
│ ├── InitService.spec.md
|
|
263
|
+
│ └── SpecFinderService.js
|
|
264
|
+
└── workflows/
|
|
265
|
+
└── mddd-preview.yml.js # GitHub Actions workflow
|
|
266
|
+
|
|
267
|
+
tests/
|
|
268
|
+
├── commands/
|
|
269
|
+
│ ├── init.spec.js
|
|
270
|
+
│ ├── listSpecs.spec.js
|
|
271
|
+
│ └── status.spec.js
|
|
229
272
|
```
|
|
230
273
|
|
|
231
274
|
---
|
|
@@ -248,7 +291,7 @@ If you encounter any issues, open a [GitHub Issue](https://github.com/JulioCRFil
|
|
|
248
291
|
|
|
249
292
|
## 📄 License
|
|
250
293
|
|
|
251
|
-
Distributed under the MIT license. See the [LICENSE](
|
|
294
|
+
Distributed under the MIT license. See the [LICENSE](./LICENSE) file for more information.
|
|
252
295
|
|
|
253
296
|
---
|
|
254
297
|
<a id="portuguese"></a>
|
|
@@ -396,7 +439,7 @@ md init
|
|
|
396
439
|
|
|
397
440
|
```
|
|
398
441
|
|
|
399
|
-
Isso criará os arquivos `
|
|
442
|
+
Isso criará os arquivos `AGENTS.md` e `SKILL.md` no diretório raiz, contendo as instruções globais que guiarão a IA na compreensão da metodologia MDDD e na interação com os logs do Git. Você pode renomear `AGENTS.md` para qualquer arquivo .rules que precisar (.cursorrules, .clinerules, etc.).
|
|
400
443
|
|
|
401
444
|
### 2. Auditar arquivos legados ou criar novos.
|
|
402
445
|
|
|
@@ -424,6 +467,33 @@ Após rodar o `md init`, a sua IA passará a entender estes atalhos quando você
|
|
|
424
467
|
| `md-edit` | Solicita alterações em um arquivo `.spec.md` existente (incrementa a versão semântica). |
|
|
425
468
|
| `md-audit` | Analisa código legado e propõe refatoração visual (Mermaid). |
|
|
426
469
|
| `md-impl` | Gera código e testes baseando-se estritamente na estrutura do `.spec.md`, gerenciando o histórico de versões. |
|
|
470
|
+
| `mddd-context-map` | Gera um diagrama de arquitetura do produto em múltiplos níveis (flowchart LR) a partir de todos os arquivos `.spec.md`. Classifica specs como MACRO/MICRO, mapeia fluxos de dados e produz um `ARCHITECTURE.spec.md` com nós estilizados e arestas rotuladas. |
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## 🗺️ Mapa de Contexto da Arquitetura
|
|
475
|
+
|
|
476
|
+
A skill `mddd-context-map` ensina o agente de IA a produzir um **diagrama de arquitetura do produto** que visualiza o sistema em **múltiplos níveis**:
|
|
477
|
+
|
|
478
|
+
- **Áreas Macro (domínios)** — cada spec MACRO representa um domínio ou capacidade de negócio de alto nível.
|
|
479
|
+
- **Micro componentes/serviços** — specs MICRO são os blocos construtivos dentro de cada domínio.
|
|
480
|
+
- **Fluxos de dados** — conexões entre usuários, UI, backend, funções serverless e infraestrutura externa.
|
|
481
|
+
|
|
482
|
+
O output é um **`flowchart LR`** estilizado que combina agrupamento por domínio com componentes internos e integrações externas, usando `classDef` para diferenciar os tipos de nós:
|
|
483
|
+
|
|
484
|
+
| Classe de Nó | Propósito | Visual |
|
|
485
|
+
| :--- | :--- | :--- |
|
|
486
|
+
| `userNode` | Pessoas, personas, perfis | Amarelo quente |
|
|
487
|
+
| `systemNode` | Serviços/componentes internos | Azul profissional |
|
|
488
|
+
| `externalNode` | APIs de terceiros, sistemas parceiros | Vermelho-alaranjado |
|
|
489
|
+
| `infraNode` | Bancos de dados, filas, caches | Cinza itálico sutil |
|
|
490
|
+
|
|
491
|
+
### Como usar
|
|
492
|
+
|
|
493
|
+
1. Inicialize seu projeto com `md init` (isso copia o template de arquitetura para `.agents/templates/`).
|
|
494
|
+
2. Peça à IA para gerar o mapa de contexto — ela escaneará todos os arquivos `.spec.md`, classificará como MACRO/MICRO e comporá o diagrama.
|
|
495
|
+
3. O output é salvo em `ARCHITECTURE.spec.md` na raiz do projeto.
|
|
496
|
+
4. Cada diagrama é validado com `npx md validate` antes de ser escrito.
|
|
427
497
|
|
|
428
498
|
---
|
|
429
499
|
|
|
@@ -448,8 +518,9 @@ src/
|
|
|
448
518
|
## 📦 Comandos da CLI
|
|
449
519
|
|
|
450
520
|
| Comando | Descrição |
|
|
451
|
-
|
|
|
452
|
-
| `md init` | Configura os arquivos `
|
|
521
|
+
| :--- | :--- |
|
|
522
|
+
| `md init` | Configura os arquivos `AGENTS.md` e `SKILL.md` que instruem a IA sobre como se comportar. Execute isto sempre que atualizar o pacote NPM do MDDD-CLI. |
|
|
523
|
+
| `md status` | Gera um relatório bonito de cobertura MDDD com métricas de todos os arquivos `.spec.md`. Mostra classificação dos specs (Coeso/Caótico), progresso de tarefas, mudanças de versão e métricas de impacto. |
|
|
453
524
|
|
|
454
525
|
### Arquitetura do Projeto
|
|
455
526
|
|
|
@@ -462,10 +533,25 @@ bin/
|
|
|
462
533
|
|
|
463
534
|
src/
|
|
464
535
|
├── commands/ # Camada de comandos
|
|
465
|
-
│
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
536
|
+
│ ├── init.js # Comando init
|
|
537
|
+
│ ├── listSpecs.js # Comando listSpecs
|
|
538
|
+
│ ├── status.js # Comando status
|
|
539
|
+
│ ├── status.spec.md # Spec do status
|
|
540
|
+
│ └── validator.js # Utilitário de validação
|
|
541
|
+
├── services/ # Serviços compartilhados com DI
|
|
542
|
+
│ ├── FileSystemService.js
|
|
543
|
+
│ ├── FileSystemService.spec.md
|
|
544
|
+
│ ├── InitService.js
|
|
545
|
+
│ ├── InitService.spec.md
|
|
546
|
+
│ └── SpecFinderService.js
|
|
547
|
+
└── workflows/
|
|
548
|
+
└── mddd-preview.yml.js # Workflow do GitHub Actions
|
|
549
|
+
|
|
550
|
+
tests/
|
|
551
|
+
├── commands/
|
|
552
|
+
│ ├── init.spec.js
|
|
553
|
+
│ ├── listSpecs.spec.js
|
|
554
|
+
│ └── status.spec.js
|
|
469
555
|
```
|
|
470
556
|
|
|
471
557
|
---
|
|
@@ -488,4 +574,4 @@ Se encontrar qualquer problema, abra uma [Issue no GitHub](https://github.com/Ju
|
|
|
488
574
|
|
|
489
575
|
## 📄 Licença
|
|
490
576
|
|
|
491
|
-
Distribuído sob a licença MIT. Veja o arquivo [LICENSE](
|
|
577
|
+
Distribuído sob a licença MIT. Veja o arquivo [LICENSE](./LICENSE) para mais informações.
|
package/src/commands/init.js
CHANGED
|
@@ -8,13 +8,13 @@ import pc from 'picocolors';
|
|
|
8
8
|
import { GITHUB_WORKFLOW_CONTENT } from '../workflows/mddd-preview.yml.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Resolve and read
|
|
11
|
+
* Resolve and read AGENTS.md from the project root.
|
|
12
12
|
* @returns {string}
|
|
13
13
|
*/
|
|
14
14
|
function readSystemPrompt() {
|
|
15
15
|
const currentFile = fileURLToPath(import.meta.url);
|
|
16
16
|
const rootDir = path.resolve(path.dirname(currentFile), '..', '..');
|
|
17
|
-
const promptPath = path.join(rootDir, '
|
|
17
|
+
const promptPath = path.join(rootDir, 'AGENTS.md');
|
|
18
18
|
return readFileSync(promptPath, 'utf-8');
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -49,6 +49,6 @@ export async function execute(initService) {
|
|
|
49
49
|
// 6. Copia o ARCHITECTURE template (usado pela skill mddd-context-map)
|
|
50
50
|
await initService.createArchitectureTemplate(cliArchitectureTemplatePath, (msg) => console.log(msg));
|
|
51
51
|
|
|
52
|
-
console.log(pc.green('\n🚀 Universal [
|
|
52
|
+
console.log(pc.green('\n🚀 Universal [AGENTS.md], SKILLS, spec template, and architecture template generated successfully in the project root!'));
|
|
53
53
|
console.log(pc.green('Run the "md init" command whenever you update the MDDD-CLI NPM package.'));
|
|
54
54
|
}
|