mddd-cli 1.0.10 → 1.0.11
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/bin/cli.js +1 -1
- package/bin/cli.spec.md +30 -12
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -40,7 +40,7 @@ function findClosestMacro(currentDir) {
|
|
|
40
40
|
program
|
|
41
41
|
.name('md')
|
|
42
42
|
.description('Manager for co-located specifications for Mermaid Diagram Driven Development (MDDD)')
|
|
43
|
-
.version('1.0.
|
|
43
|
+
.version('1.0.11');
|
|
44
44
|
|
|
45
45
|
// ==========================================
|
|
46
46
|
// COMMAND: md init
|
package/bin/cli.spec.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# CLI: mddd-cli | v1.1
|
|
1
|
+
# CLI: mddd-cli | v1.2.1
|
|
2
2
|
|
|
3
3
|
## 1. Flow Contract (Mermaid)
|
|
4
4
|
|
|
5
5
|
```mermaid
|
|
6
|
-
%% @spec-version v1.1
|
|
6
|
+
%% @spec-version v1.2.1
|
|
7
7
|
stateDiagram-v2
|
|
8
8
|
[*] --> Idle
|
|
9
9
|
Idle --> ParseArgs: md <command> [args]
|
|
@@ -17,8 +17,9 @@ stateDiagram-v2
|
|
|
17
17
|
DetectCommand --> CmdImpl: impl <file>
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
CmdInit -->
|
|
21
|
-
|
|
20
|
+
CmdInit --> MkdirDotAgents: mkdir .agents/
|
|
21
|
+
MkdirDotAgents --> MkdirSkills: mkdir .agents/skills/
|
|
22
|
+
MkdirSkills --> WriteSystemPrompt: write system_prompt.md
|
|
22
23
|
WriteSystemPrompt --> WriteSkills: write 4 SKILL.md files
|
|
23
24
|
WriteSkills --> Done: ✅ Success
|
|
24
25
|
|
|
@@ -74,7 +75,7 @@ stateDiagram-v2
|
|
|
74
75
|
| `./.agents/skills` does not exist | `mkdir .agents/skills` | Continue |
|
|
75
76
|
| Always | Write `system_prompt.md` | Continue |
|
|
76
77
|
| For each skill (`md-new`, `md-edit`, `md-audit`, `md-impl`) | Create folder + `SKILL.md` | Continue → Done |
|
|
77
|
-
| Skill `SKILL.md` already exists |
|
|
78
|
+
| Skill `SKILL.md` already exists | Overwrite silently via `fs.writeFileSync` | Replace |
|
|
78
79
|
|
|
79
80
|
### 2.3 `new` Command — Parent Linking
|
|
80
81
|
|
|
@@ -82,8 +83,7 @@ stateDiagram-v2
|
|
|
82
83
|
| :--- | :--- | :--- |
|
|
83
84
|
| `--parent` provided AND file exists | Append link line to parent | ✅ Linked |
|
|
84
85
|
| `--parent` provided AND file NOT found | `process.exit(1)` with error | ❌ Fatal |
|
|
85
|
-
| `--parent` NOT provided
|
|
86
|
-
| `--macro` flag set | Skip parent linking (unless `-p` explicit) | Macro template generated |
|
|
86
|
+
| `--parent` NOT provided | Auto-search via `findClosestMacro()` | ✅ Linked (if found) / No link (if none) |
|
|
87
87
|
|
|
88
88
|
### 2.4 `findClosestMacro(currentDir)` — Traversal Logic
|
|
89
89
|
|
|
@@ -111,6 +111,7 @@ stateDiagram-v2
|
|
|
111
111
|
| :--- | :--- | :--- | :--- |
|
|
112
112
|
| 2026-05-26 | AI (MDDD audit) | v1.0.0 | Initial spec: code is modular, cohesive, clean. Mapped as-is. |
|
|
113
113
|
| 2026-05-26 | AI (MDDD audit) | v1.1.0 | Deep audit of `bin/cli.js` source code. Code is clean and modular — mapped as-is (architecture diagram below). |
|
|
114
|
+
| 2026-05-26 | AI (MDDD audit) | v1.2.0 | Re-audit `bin/cli.js` v1.0.10 vs spec v1.1.0. Minor divergences found in `init` flow granularity and `new` guard logic. Spec updated to reflect real code. |
|
|
114
115
|
|
|
115
116
|
### Audit Report: `bin/cli.js` (2026-05-26)
|
|
116
117
|
|
|
@@ -137,10 +138,30 @@ stateDiagram-v2
|
|
|
137
138
|
5. ⚠️ **Template strings** in `new` action: Extract to `templates/` directory for maintainability.
|
|
138
139
|
6. ⚠️ **`process.exit()` scattering**: If this grows into a library, consider centralizing error handling and returning exit codes.
|
|
139
140
|
|
|
140
|
-
|
|
141
|
+
### Audit Report: `bin/cli.js` (2026-05-26) — v1.2.0 Re-audit
|
|
142
|
+
|
|
143
|
+
**Target**: `bin/cli.js` — CLI entry point (v1.0.10)
|
|
144
|
+
|
|
145
|
+
**Discrepancies Found vs Spec v1.1.0**:
|
|
146
|
+
|
|
147
|
+
| Item | Spec Said | Code Does | Verdict |
|
|
148
|
+
| :--- | :--- | :--- | :--- |
|
|
149
|
+
| `init` flow — directory creation | `CreateDotAgents: mkdir .agents/skills/` | Two separate conditional mkdir: `mkdir .agents/` then `mkdir .agents/skills/` | ⚠️ Minor — spec combined into one state; fixed in v1.2.0 diagram |
|
|
150
|
+
| `init` — SKILL.md overwrite | "Delete old, write new" | `fs.writeFileSync` overwrites silently, no deletion | ⚠️ Minor — wording fixed in v1.2.0 matrix |
|
|
151
|
+
| `new` — `CheckExists` guard order | CheckExists branches to Skip or GenerateSpec | Code checks `fs.existsSync(normalizedPath)` for mkdir, then checks `fs.existsSync(finalFile)` separately | ✅ Correct — diagram simplified, no semantic error |
|
|
152
|
+
| `new` — trailing slash normalization | Not mentioned | `normalizedPath` uses `.replace(/[\\/]+$/, '')` | ✅ Enhancement — documented below |
|
|
153
|
+
| `findClosestMacro` — dir exclusion | Not specified | Excludes file named `${path.basename(currentDir)}.spec.md` | ✅ Enhancement — documented in matrix |
|
|
154
|
+
| Version metadata | N/A (spec refers to v1.0.8) | Code declares `v1.0.10` | ✅ Cosmetic — spec now at v1.2.0 |
|
|
155
|
+
|
|
156
|
+
**Newly Documented Behaviors**:
|
|
157
|
+
- **Trailing slash cleanup**: `path.normalize(targetPath).replace(/[\\/]+$/, '')` strips trailing slashes before mkdir.
|
|
158
|
+
- **Self-exclusion in `findClosestMacro`**: The macro search excludes `${path.basename(currentDir)}.spec.md` to avoid matching the directory's own spec file.
|
|
159
|
+
- **Permission-denied break**: On `EACCES`/`EPERM`, the loop breaks and returns `null`. All other `fs.readdirSync` errors are rethrown.
|
|
160
|
+
|
|
161
|
+
**Architecture Diagram (Current State — v1.0.10)**:
|
|
141
162
|
|
|
142
163
|
```mermaid
|
|
143
|
-
%% @spec-version v1.
|
|
164
|
+
%% @spec-version v1.2.0
|
|
144
165
|
graph LR
|
|
145
166
|
subgraph "Entry Point"
|
|
146
167
|
CLI["bin/cli.js"]
|
|
@@ -195,7 +216,4 @@ graph LR
|
|
|
195
216
|
EDIT --> PC
|
|
196
217
|
```
|
|
197
218
|
|
|
198
|
-
**Recommendations for v2.0.0** (future):
|
|
199
|
-
- Replace `process.exit()` with thrown exceptions or a centralized error handler for better testability
|
|
200
|
-
|
|
201
219
|
</details>
|