mddd-cli 4.2.3 → 4.4.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 +1 -1
- package/.agents/skills/mermaid-diagrams/README.md +0 -8
- package/.agents/skills/mermaid-diagrams/SKILL.md +0 -1
- package/{src → .agents}/templates/spec-template.md +2 -7
- package/bin/cli.js +1 -1
- package/package.json +3 -2
- package/readme.md +0 -42
- package/src/commands/init.js +14 -7
- package/src/services/InitService.js +22 -1
- package/src/services/InitService.spec.md +22 -17
- package/system_prompt.md +11 -79
|
@@ -17,7 +17,7 @@ stateDiagram-v2
|
|
|
17
17
|
|
|
18
18
|
state RenderTopology {
|
|
19
19
|
[*] --> CheckCode: Analyze current code structure and dependencies
|
|
20
|
-
CheckCode --> EvaluatedCodeIsClean: Map exact architecture as
|
|
20
|
+
CheckCode --> EvaluatedCodeIsClean: Map exact architecture as coese (v1.0.0 - stable)
|
|
21
21
|
CheckCode --> EvaluatedCodeIsChaotic: Draw BOTH current chaotic logic AND ideal target refactored graph (v1.0.0 - draft)
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
**SPEC_VERSION:** v1.0.0 — draft|stable
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# {{Feature Title}} — Specification
|
|
4
4
|
|
|
5
5
|
> ⚠️ **This is a freshly generated MDDD spec template.**
|
|
6
6
|
> Replace every `{{placeholder}}`, remove this banner, and refine the diagram + matrix
|
|
@@ -12,11 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
Describe **what** this spec governs and **why** it exists.
|
|
14
14
|
|
|
15
|
-
- **Domain:** `{{domain_name}}`
|
|
16
|
-
- **Feature / Module:** `{{feature_name}}`
|
|
17
|
-
- **Scope (in):** {{what is covered}}
|
|
18
|
-
- **Scope (out):** {{what is explicitly NOT covered}}
|
|
19
|
-
- **Owners:** {{team_or_person}}
|
|
20
15
|
- **Related specs:** {{parent_domain_spec, sibling_features}}
|
|
21
16
|
|
|
22
17
|
---
|
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.
|
|
20
|
+
.version('4.4.0');
|
|
21
21
|
|
|
22
22
|
// ==========================================
|
|
23
23
|
// COMMAND: md init
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mddd-cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.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",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"src",
|
|
12
12
|
"system_prompt.md",
|
|
13
|
-
".agents/skills"
|
|
13
|
+
".agents/skills",
|
|
14
|
+
".agents/templates"
|
|
14
15
|
],
|
|
15
16
|
"engines": {
|
|
16
17
|
"node": ">=18.0.0"
|
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/src/commands/init.js
CHANGED
|
@@ -26,18 +26,25 @@ function readSystemPrompt() {
|
|
|
26
26
|
export async function execute(initService) {
|
|
27
27
|
const systemPrompt = readSystemPrompt();
|
|
28
28
|
|
|
29
|
-
// 1.
|
|
30
|
-
// Subindo de: src/commands/ -> src/ -> raiz do pacote CLI -> .agents/skills
|
|
29
|
+
// 1. Resolve o caminho absoluto da raiz do pacote CLI
|
|
31
30
|
const currentFile = fileURLToPath(import.meta.url);
|
|
32
|
-
const
|
|
31
|
+
const cliRootDir = path.resolve(path.dirname(currentFile), '..', '..');
|
|
32
|
+
|
|
33
|
+
// 2. Caminhos de origem dentro do pacote da CLI
|
|
34
|
+
const cliSkillsSourceDir = path.join(cliRootDir, '.agents', 'skills');
|
|
35
|
+
const cliSpecTemplatePath = path.join(cliRootDir, '.agents', 'templates', 'spec-template.md');
|
|
33
36
|
|
|
34
37
|
await initService.createSystemPrompt(systemPrompt);
|
|
35
|
-
|
|
36
|
-
//
|
|
38
|
+
|
|
39
|
+
// 3. Passa o caminho da pasta oculta de origem para o serviço clonar recursivamente
|
|
37
40
|
await initService.createSkills(cliSkillsSourceDir, (msg) => console.log(msg));
|
|
38
|
-
|
|
41
|
+
|
|
42
|
+
// 4. Cria o workflow do GitHub
|
|
39
43
|
await initService.createGitHubWorkflow(GITHUB_WORKFLOW_CONTENT, (msg) => console.log(msg));
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
// 5. Copia o spec template para o projeto
|
|
46
|
+
await initService.createSpecTemplate(cliSpecTemplatePath, (msg) => console.log(msg));
|
|
47
|
+
|
|
48
|
+
console.log(pc.green('\n🚀 Universal [system_prompt.md], SKILLS, and spec template generated successfully in the project root!'));
|
|
42
49
|
console.log(pc.green('Run the "md init" command whenever you update the MDDD-CLI NPM package.'));
|
|
43
50
|
}
|
|
@@ -74,4 +74,25 @@ export class InitService {
|
|
|
74
74
|
|
|
75
75
|
return workflowFile;
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Copies the spec template file from the CLI package to the project's .agents/templates/ directory.
|
|
80
|
+
* @param {string} sourceTemplatePath - Absolute path to the CLI source spec-template.md
|
|
81
|
+
* @param {(message: string) => void} logger
|
|
82
|
+
* @returns {Promise<void>}
|
|
83
|
+
*/
|
|
84
|
+
async createSpecTemplate(sourceTemplatePath, logger) {
|
|
85
|
+
const templatesDir = path.join('.agents', 'templates');
|
|
86
|
+
const targetFile = path.join(templatesDir, 'spec-template.md');
|
|
87
|
+
|
|
88
|
+
if (!fs.existsSync(sourceTemplatePath)) {
|
|
89
|
+
throw new Error(`Source spec template not found at: ${sourceTemplatePath}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
this.#fs.ensureDir(templatesDir);
|
|
93
|
+
|
|
94
|
+
const content = fs.readFileSync(sourceTemplatePath, 'utf-8');
|
|
95
|
+
await this.#fs.writeFile(targetFile, content);
|
|
96
|
+
logger(`✅ Spec template copied: ${targetFile}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# InitService — Specification
|
|
2
2
|
|
|
3
|
-
**SPEC_VERSION: v1.
|
|
3
|
+
**SPEC_VERSION: v1.2.0 — stable**
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
@@ -13,24 +13,27 @@ Co-located with `src/services/InitService.js`.
|
|
|
13
13
|
## Behavioral Flow (Mermaid)
|
|
14
14
|
|
|
15
15
|
```mermaid
|
|
16
|
-
%% @spec-version v1.
|
|
16
|
+
%% @spec-version v1.2.0
|
|
17
17
|
stateDiagram-v2
|
|
18
18
|
[*] --> createSystemPrompt: initService.createSystemPrompt(promptContent)
|
|
19
19
|
createSystemPrompt --> writeFile: this.#fs.writeFile('system_prompt.md', content)
|
|
20
|
-
writeFile --> createSkills: initService.createSkills(
|
|
20
|
+
writeFile --> createSkills: initService.createSkills(sourceSkillsDir, logger)
|
|
21
21
|
|
|
22
|
-
createSkills -->
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
iterateSkills --> returnCreated: return created[]
|
|
28
|
-
returnCreated --> createGitHubWorkflow: initService.createGitHubWorkflow(workflowYaml, logger)
|
|
22
|
+
createSkills --> ensureAgentsDir: this.#fs.ensureDir('.agents')
|
|
23
|
+
ensureAgentsDir --> ensureTargetSkillsDir: this.#fs.ensureDir('.agents/skills')
|
|
24
|
+
ensureTargetSkillsDir --> cpSyncSkills: fs.cpSync(source, target, recursive)
|
|
25
|
+
cpSyncSkills --> logSkills: logger per copied skill
|
|
26
|
+
logSkills --> createGitHubWorkflow: initService.createGitHubWorkflow(workflowYaml, logger)
|
|
29
27
|
|
|
30
28
|
createGitHubWorkflow --> ensureWorkflowDir: this.#fs.ensureDir('.github/workflows')
|
|
31
29
|
ensureWorkflowDir --> writeWorkflowFile: this.#fs.writeFile('.github/workflows/mddd-preview.yml', content)
|
|
32
|
-
writeWorkflowFile --> logWorkflow: logger(`✅ GitHub workflow created
|
|
33
|
-
logWorkflow -->
|
|
30
|
+
writeWorkflowFile --> logWorkflow: logger(`✅ GitHub workflow created`)
|
|
31
|
+
logWorkflow --> createSpecTemplate: initService.createSpecTemplate(sourceTemplatePath, logger)
|
|
32
|
+
|
|
33
|
+
createSpecTemplate --> ensureTemplatesDir: this.#fs.ensureDir('.agents/templates')
|
|
34
|
+
ensureTemplatesDir --> writeTemplateFile: this.#fs.writeFile('.agents/templates/spec-template.md', content)
|
|
35
|
+
writeTemplateFile --> logTemplate: logger(`✅ Spec template copied`)
|
|
36
|
+
logTemplate --> [*]
|
|
34
37
|
```
|
|
35
38
|
|
|
36
39
|
---
|
|
@@ -40,13 +43,14 @@ stateDiagram-v2
|
|
|
40
43
|
| Step | Method | I/O | Conditional Branch? | Error Handling | FS Side Effect |
|
|
41
44
|
| :--- | :--- | :--- | :---: | :--- | :--- |
|
|
42
45
|
| 1 | `createSystemPrompt(promptContent)` | Input: `string`<br>Output: `Promise<void>` | ❌ No | Delegated to `#fs.writeFile` | ✅ Writes `system_prompt.md` |
|
|
43
|
-
| 2 | `createSkills(
|
|
46
|
+
| 2 | `createSkills(sourceSkillsDir, logger)` | Input: `string` (source dir) + logger fn<br>Output: `Promise<void>` | ✅ Checks `fs.existsSync(sourceSkillsDir)` | Throws `Error` if source dir not found | ✅ Creates `.agents/`, `.agents/skills/`, copies all skill folders recursively |
|
|
44
47
|
| 3 | `createGitHubWorkflow(workflowYaml, logger)` | Input: `string` + logger fn<br>Output: `Promise<string>` | ❌ No | Delegated to `#fs` methods | ✅ Creates `.github/workflows/mddd-preview.yml` |
|
|
45
|
-
| 4 | `
|
|
46
|
-
| 5 | `this.#fs.ensureDir(
|
|
47
|
-
| 6 | `this.#fs.ensureDir(
|
|
48
|
+
| 4 | `createSpecTemplate(sourceTemplatePath, logger)` | Input: `string` (source path) + logger fn<br>Output: `Promise<void>` | ✅ Checks `fs.existsSync(sourceTemplatePath)` | Throws `Error` if source file not found | ✅ Creates `.agents/templates/`, writes `spec-template.md` |
|
|
49
|
+
| 5 | `this.#fs.ensureDir(agentsDir)` | Path: `'.agents'` | ✅ Internal in FS: conditional mkdir | Delegated | ✅ Dir creation |
|
|
50
|
+
| 6 | `this.#fs.ensureDir(skillsDir)` | Path: `'.agents/skills'` | ✅ Internal in FS: conditional mkdir | Delegated | ✅ Dir creation |
|
|
48
51
|
| 7 | `this.#fs.ensureDir(workflowsDir)` | Path: `'.github/workflows'` | ✅ Internal in FS: conditional mkdir | Delegated | ✅ Dir creation |
|
|
49
|
-
| 8 | `
|
|
52
|
+
| 8 | `this.#fs.ensureDir(templatesDir)` | Path: `'.agents/templates'` | ✅ Internal in FS: conditional mkdir | Delegated | ✅ Dir creation |
|
|
53
|
+
| 9 | `logger(…)` | stdout message | ❌ No | N/A | ❌ None |
|
|
50
54
|
|
|
51
55
|
---
|
|
52
56
|
|
|
@@ -75,5 +79,6 @@ stateDiagram-v2
|
|
|
75
79
|
| :--- | :--- | :---: | :--- |
|
|
76
80
|
| 2026-05-28 | Cline (md-audit) | v1.0.0 | **Spec created by md-audit.** Reverse-engineered from `src/services/InitService.js` (52 lines). Code classified as **Clean / Service with DI**. All orchestration steps documented with primitive factor analysis. No modifications to production code. |
|
|
77
81
|
| 2026-05-28 | Cline (md-edit) | v1.1.0 | **New method `createGitHubWorkflow`.** Added to support `md init` creating `.github/workflows/mddd-preview.yml`. Updated behavioral flow diagram with new states. Updated Decision Matrix with steps 3, 7, 8. SPEC_VERSION bumped from v1.0.0 to v1.1.0 (minor — new method). Status promoted from **draft** to **stable** — implementation and tests verified. |
|
|
82
|
+
| 2026-06-04 | Cline (md-edit) | v1.2.0 | **New method `createSpecTemplate`.** Added to support `md init` copying `.agents/templates/spec-template.md` from the CLI package to the project. Reads the template file content via `fs.readFileSync`, ensures `.agents/templates/` dir exists, then writes `spec-template.md` via `#fs.writeFile`. Updated behavioral flow diagram with new states (`createSpecTemplate → ensureTemplatesDir → writeTemplateFile → logTemplate`). Updated Decision Matrix with steps 4, 8. SPEC_VERSION bumped from v1.1.0 to v1.2.0 (minor — new method). |
|
|
78
83
|
|
|
79
84
|
</details>
|
package/system_prompt.md
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
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: .agents/templates/spec-template.md
|
|
7
|
+
|
|
8
|
+
Mark the analysis as Coese or Chaotic
|
|
9
|
+
|
|
6
10
|
```mermaid
|
|
7
|
-
%% @spec-version v2.0.0
|
|
8
|
-
%% @protocol-version 1.0.0
|
|
9
11
|
stateDiagram-v2
|
|
10
12
|
[*] --> CheckSpec: UNIVERSAL RULE — Check specification file
|
|
11
13
|
|
|
@@ -17,14 +19,14 @@ stateDiagram-v2
|
|
|
17
19
|
state SkillCheck {
|
|
18
20
|
MdNew --> ReadSpecification: Request Allowed.
|
|
19
21
|
MdAudit --> ReadSpecification: Request Allowed.
|
|
20
|
-
MdEdit --> ReadSpecification: Request Allowed.
|
|
21
22
|
Other --> Denied: Specification file required.
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
Denied --> ConflictResolution: Explain missing spec
|
|
25
26
|
|
|
26
27
|
state ReadSpecification {
|
|
27
|
-
[*] -->
|
|
28
|
+
[*] --> CreateSpec: Create file from template
|
|
29
|
+
CreateSpec --> ParseMermaidDiagrams: Extract all diagrams
|
|
28
30
|
ParseMermaidDiagrams --> ExtractDecisionMatrices: Map topology nodes/edges
|
|
29
31
|
ExtractDecisionMatrices --> ValidatePrimitiveFactors: Check factor columns
|
|
30
32
|
ValidatePrimitiveFactors --> [*]: Spec loaded into context
|
|
@@ -50,71 +52,13 @@ stateDiagram-v2
|
|
|
50
52
|
UpdateDetailsFooter --> [*]
|
|
51
53
|
```
|
|
52
54
|
|
|
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)
|
|
55
|
+
### 2 Reverse Consistency (Parent → Child)
|
|
112
56
|
|
|
113
57
|
When a parent domain spec is modified, the following MUST be verified:
|
|
114
58
|
|
|
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.
|
|
59
|
+
2.1. **Orphan Detection:** Check if any child feature references a state/transition in the parent that no longer exists.
|
|
60
|
+
2.2. **Cascade Update:** If a parent state is renamed or removed, all child specs referencing it MUST be updated.
|
|
61
|
+
2.3. **Version Bump:** Parent changes increment MINOR version. Child specs affected by the change increment PATCH version.
|
|
118
62
|
|
|
119
63
|
## 3. Decision Matrix & Primitive Factors
|
|
120
64
|
|
|
@@ -162,23 +106,11 @@ Every `.spec.md` file carries a `%% @spec-version` header. Use **Semantic Versio
|
|
|
162
106
|
| **MINOR** | Adding: new states/transitions, new factor columns, new features without breaking existing rows. | `1.2.3` → `1.3.0` |
|
|
163
107
|
| **PATCH** | Fixing: typos, clarifying descriptions, reformatting, updating child references. | `1.2.3` → `1.2.4` |
|
|
164
108
|
|
|
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)
|
|
109
|
+
### 4.2 Audit History (Change Log)
|
|
176
110
|
|
|
177
111
|
Each change MUST append a row to the **Change History** table at the bottom of the `.spec.md` file:
|
|
178
112
|
|
|
179
113
|
```
|
|
180
|
-
%% @spec-version 1.1.0
|
|
181
|
-
|
|
182
114
|
## Change History
|
|
183
115
|
| Version | Date | Author | Change Description | Change Type |
|
|
184
116
|
| --- | --- | --- | --- | --- |
|