mddd-cli 4.2.3 → 4.2.4
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.
|
@@ -64,13 +64,6 @@ diagramType
|
|
|
64
64
|
- **Notes and comments** - Add context and explanations
|
|
65
65
|
- **Alt/loop/opt blocks** - Complex flow control in sequences
|
|
66
66
|
|
|
67
|
-
### Integration Support
|
|
68
|
-
|
|
69
|
-
- **GitHub/GitLab** - Automatic rendering in Markdown files
|
|
70
|
-
- **VS Code** - Preview with Markdown Mermaid extension
|
|
71
|
-
- **Notion, Obsidian, Confluence** - Built-in support
|
|
72
|
-
- **Export** - PNG, SVG, PDF via Mermaid Live or CLI
|
|
73
|
-
|
|
74
67
|
## Usage Examples
|
|
75
68
|
|
|
76
69
|
### Example 1: Document a Domain Model
|
|
@@ -233,7 +226,6 @@ For comprehensive syntax and advanced features, see:
|
|
|
233
226
|
- **[Mermaid Live Editor](https://mermaid.live)** - Interactive editor with instant preview and export
|
|
234
227
|
- **[Official Documentation](https://mermaid.js.org)** - Comprehensive syntax reference
|
|
235
228
|
- **Mermaid CLI** - `npm install -g @mermaid-js/mermaid-cli` for batch exports
|
|
236
|
-
- **VS Code Extension** - "Markdown Preview Mermaid Support" for live preview
|
|
237
229
|
- **GitHub** - Native rendering in all `.md` files
|
|
238
230
|
|
|
239
231
|
## Support
|
package/bin/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ const program = new Command();
|
|
|
17
17
|
program
|
|
18
18
|
.name('md')
|
|
19
19
|
.description('Manager for co-located specifications for Mermaid Diagram Driven Development (MDDD)')
|
|
20
|
-
.version('4.2.
|
|
20
|
+
.version('4.2.4');
|
|
21
21
|
|
|
22
22
|
// ==========================================
|
|
23
23
|
// COMMAND: md init
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -67,8 +67,6 @@ Unlike traditional specification frameworks that generate dozens of text files a
|
|
|
67
67
|
|
|
68
68
|
## ✅ Mermaid Diagram Preview
|
|
69
69
|
|
|
70
|
-
To preview Mermaid diagrams directly in your editor during the MDDD workflow, you can use extensions that render ````mermaid```` blocks in Markdown files:
|
|
71
|
-
|
|
72
70
|
### Architectural Diagram Example
|
|
73
71
|
|
|
74
72
|
```mermaid
|
|
@@ -130,26 +128,6 @@ sequenceDiagram
|
|
|
130
128
|
|
|
131
129
|
---
|
|
132
130
|
|
|
133
|
-
### VS Code and derivated
|
|
134
|
-
|
|
135
|
-
* **Markdown Preview Mermaid Support** — Adds Mermaid diagram support to the native Markdown preview.
|
|
136
|
-
* **Mermaid Editor** — Visual editor with side-by-side preview and export.
|
|
137
|
-
* **bierner.markdown-mermaid** — Official extension that extends the Markdown preview to render Mermaid.
|
|
138
|
-
|
|
139
|
-
### JetBrains (IntelliJ, WebStorm, GoLand, etc.)
|
|
140
|
-
|
|
141
|
-
* Native Mermaid support starting from **2024.1** — Just open the `.spec.md` file and use the built-in Markdown preview.
|
|
142
|
-
|
|
143
|
-
### Other Editors
|
|
144
|
-
|
|
145
|
-
* **Neovim/Vim:** Use plugins like `iamcco/markdown-preview.nvim` (with `markdown-preview` configured for Mermaid).
|
|
146
|
-
* **Sublime Text:** `Mermaid` package from Package Control that adds preview and snippets.
|
|
147
|
-
* **Markdown Editors:** Tools like [Typora](https://typora.io), [Obsidian](https://obsidian.md), and [Notion](https://notion.so) already have native Mermaid support — just paste the `.spec.md` file and the diagram will render automatically.
|
|
148
|
-
|
|
149
|
-
> 💡 **Tip:** The better you can visualize the diagrams, the easier it is to validate business flows before implementation.
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
131
|
## 📥 Installation
|
|
154
132
|
|
|
155
133
|
Since the package is published on NPM, installation is global and simple:
|
|
@@ -391,26 +369,6 @@ sequenceDiagram
|
|
|
391
369
|
|
|
392
370
|
---
|
|
393
371
|
|
|
394
|
-
### VS Code e derivados
|
|
395
|
-
|
|
396
|
-
* **Markdown Preview Mermaid Support** — Adiciona suporte a diagramas Mermaid no preview nativo do Markdown.
|
|
397
|
-
* **Mermaid Editor** — Editor visual com preview lado a lado e exportação.
|
|
398
|
-
* **bierner.markdown-mermaid** — Extensão oficial que estende o preview de Markdown para renderizar Mermaid.
|
|
399
|
-
|
|
400
|
-
### JetBrains (IntelliJ, WebStorm, GoLand, etc.)
|
|
401
|
-
|
|
402
|
-
* Suporte nativo a Mermaid a partir do **2024.1** — Basta abrir o arquivo `.spec.md` e usar o preview de Markdown integrado.
|
|
403
|
-
|
|
404
|
-
### Outros Editores
|
|
405
|
-
|
|
406
|
-
* **Neovim/Vim:** Utilize plugins como `iamcco/markdown-preview.nvim` (com `markdown-preview` configurado para Mermaid).
|
|
407
|
-
* **Sublime Text:** Pacote `Mermaid` no Package Control que adiciona preview e snippets.
|
|
408
|
-
* **Markdown Editors:** Ferramentas como [Typora](https://typora.io), [Obsidian](https://obsidian.md) e [Notion](https://notion.so) já possuem suporte nativo a Mermaid — basta colar o arquivo `.spec.md` e o diagrama será renderizado automaticamente.
|
|
409
|
-
|
|
410
|
-
> 💡 **Dica:** Quanto melhor você conseguir visualizar os diagramas, mais fácil será validar os fluxos de negócio antes da implementação.
|
|
411
|
-
|
|
412
|
-
---
|
|
413
|
-
|
|
414
372
|
## 📥 Instalação
|
|
415
373
|
|
|
416
374
|
Como o pacote está publicado no NPM, a instalação é global e simples:
|
package/system_prompt.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
You are a Mermaid Diagram processing system. Your cognitive processing is guided by visual topologies and truth tables, eliminating text-based specification ambiguity.
|
|
4
4
|
Consume the mermaid-diagrams skill to learn how to produce it.
|
|
5
5
|
|
|
6
|
+
Spec template path: node_modules/seu-pacote/src/templates/spec-template.md
|
|
7
|
+
|
|
6
8
|
```mermaid
|
|
7
|
-
%% @spec-version v2.0.0
|
|
8
|
-
%% @protocol-version 1.0.0
|
|
9
9
|
stateDiagram-v2
|
|
10
10
|
[*] --> CheckSpec: UNIVERSAL RULE — Check specification file
|
|
11
11
|
|
|
@@ -17,14 +17,14 @@ stateDiagram-v2
|
|
|
17
17
|
state SkillCheck {
|
|
18
18
|
MdNew --> ReadSpecification: Request Allowed.
|
|
19
19
|
MdAudit --> ReadSpecification: Request Allowed.
|
|
20
|
-
MdEdit --> ReadSpecification: Request Allowed.
|
|
21
20
|
Other --> Denied: Specification file required.
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
Denied --> ConflictResolution: Explain missing spec
|
|
25
24
|
|
|
26
25
|
state ReadSpecification {
|
|
27
|
-
[*] -->
|
|
26
|
+
[*] --> CreateSpec: Create file from template
|
|
27
|
+
CreateSpec --> ParseMermaidDiagrams: Extract all diagrams
|
|
28
28
|
ParseMermaidDiagrams --> ExtractDecisionMatrices: Map topology nodes/edges
|
|
29
29
|
ExtractDecisionMatrices --> ValidatePrimitiveFactors: Check factor columns
|
|
30
30
|
ValidatePrimitiveFactors --> [*]: Spec loaded into context
|
|
@@ -50,71 +50,13 @@ stateDiagram-v2
|
|
|
50
50
|
UpdateDetailsFooter --> [*]
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Every `.spec.md` file MUST follow this structure:
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
%% @spec-version 1.0.0
|
|
59
|
-
%% @domain [domain_name]
|
|
60
|
-
%% @feature [feature_name] (optional for domain-level specs)
|
|
61
|
-
%% @author [author_name] (optional)
|
|
62
|
-
|
|
63
|
-
# [Feature/Domain Name] Specification
|
|
64
|
-
|
|
65
|
-
## Context
|
|
66
|
-
Brief description of the purpose and scope of this specification.
|
|
67
|
-
|
|
68
|
-
## Flow Diagram
|
|
69
|
-
```mermaid
|
|
70
|
-
[One or more Mermaid diagrams defining the topology/flow]
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Decision Matrix
|
|
74
|
-
| Primitive Factor 1 | Primitive Factor 2 | ... | Proposed Action | Decision |
|
|
75
|
-
| --- | --- | --- | --- | --- |
|
|
76
|
-
| ✅ YES / ❌ NO | ✅ YES / ❌ NO | ... | `ACTION_NAME` | ✅ ALLOW / ❌ DENY |
|
|
77
|
-
|
|
78
|
-
## Tasks
|
|
79
|
-
- [ ] Task extracted from spec
|
|
80
|
-
|
|
81
|
-
## Change History
|
|
82
|
-
| Version | Date | Author | Change Description |
|
|
83
|
-
| --- | --- | --- | --- |
|
|
84
|
-
| 1.0.0 | YYYY-MM-DD | ... | Initial spec creation |
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## 1. Co-location Architecture Tree
|
|
88
|
-
|
|
89
|
-
src/
|
|
90
|
-
└── [domain_name]/
|
|
91
|
-
├── [domain_name].spec.md # 🌎 Macro Module Domain
|
|
92
|
-
├── [feature_name]/
|
|
93
|
-
│ ├── [feature_name].spec.md # 🔬 Micro Flow Contract + Decision Matrix
|
|
94
|
-
│ └── [feature_name].[extension] # 💻 Target Production Code File (Any Extension)
|
|
95
|
-
└── ... # Additional features per domain
|
|
96
|
-
|
|
97
|
-
> **Note:** `[domain_name]` and `[feature_name]` are placeholders for your actual project names.
|
|
98
|
-
> A single domain can contain multiple features, each in its own subdirectory.
|
|
99
|
-
|
|
100
|
-
## 2. Parent Interaction Logic
|
|
101
|
-
|
|
102
|
-
```mermaid
|
|
103
|
-
graph TD
|
|
104
|
-
A[Create/Change Sub-Feature] --> B[Open Indicated Parent File]
|
|
105
|
-
B --> C[Locate Bifurcation Node in Parent Mermaid]
|
|
106
|
-
C --> D[Modify Parent Graph: Point Arrow to New State]
|
|
107
|
-
D --> E[Child File: Inherit Parent Context in Entry Node]
|
|
108
|
-
E --> F[Update Parent @spec-version: Increment PATCH]
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### 2.1 Reverse Consistency (Parent → Child)
|
|
53
|
+
### 2 Reverse Consistency (Parent → Child)
|
|
112
54
|
|
|
113
55
|
When a parent domain spec is modified, the following MUST be verified:
|
|
114
56
|
|
|
115
|
-
1. **Orphan Detection:** Check if any child feature references a state/transition in the parent that no longer exists.
|
|
116
|
-
2. **Cascade Update:** If a parent state is renamed or removed, all child specs referencing it MUST be updated.
|
|
117
|
-
3. **Version Bump:** Parent changes increment MINOR version. Child specs affected by the change increment PATCH version.
|
|
57
|
+
2.1. **Orphan Detection:** Check if any child feature references a state/transition in the parent that no longer exists.
|
|
58
|
+
2.2. **Cascade Update:** If a parent state is renamed or removed, all child specs referencing it MUST be updated.
|
|
59
|
+
2.3. **Version Bump:** Parent changes increment MINOR version. Child specs affected by the change increment PATCH version.
|
|
118
60
|
|
|
119
61
|
## 3. Decision Matrix & Primitive Factors
|
|
120
62
|
|
|
@@ -162,23 +104,11 @@ Every `.spec.md` file carries a `%% @spec-version` header. Use **Semantic Versio
|
|
|
162
104
|
| **MINOR** | Adding: new states/transitions, new factor columns, new features without breaking existing rows. | `1.2.3` → `1.3.0` |
|
|
163
105
|
| **PATCH** | Fixing: typos, clarifying descriptions, reformatting, updating child references. | `1.2.3` → `1.2.4` |
|
|
164
106
|
|
|
165
|
-
### 4.2
|
|
166
|
-
|
|
167
|
-
The `%% @spec-version` comment MUST be the **first line** of the `.spec.md` file:
|
|
168
|
-
|
|
169
|
-
```markdown
|
|
170
|
-
%% @spec-version 1.0.0
|
|
171
|
-
%% @domain payment
|
|
172
|
-
%% @feature refund-flow
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
### 4.3 Audit History (Change Log)
|
|
107
|
+
### 4.2 Audit History (Change Log)
|
|
176
108
|
|
|
177
109
|
Each change MUST append a row to the **Change History** table at the bottom of the `.spec.md` file:
|
|
178
110
|
|
|
179
111
|
```
|
|
180
|
-
%% @spec-version 1.1.0
|
|
181
|
-
|
|
182
112
|
## Change History
|
|
183
113
|
| Version | Date | Author | Change Description | Change Type |
|
|
184
114
|
| --- | --- | --- | --- | --- |
|