@thedecipherist/mdd 1.1.1 → 1.3.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/README.md +114 -15
- package/commands/mdd-branch-guard.sh +38 -0
- package/commands/mdd-plan.md +50 -0
- package/commands/mdd.md +67 -13
- package/dist/cli.js +15 -3
- package/dist/cli.js.map +1 -1
- package/dist/install.d.ts +2 -0
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +80 -6
- package/dist/install.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,19 +83,21 @@ MDD flips this. You write structured documentation first. Then Claude reads **on
|
|
|
83
83
|
|
|
84
84
|
## How It Works
|
|
85
85
|
|
|
86
|
-
MDD installs
|
|
86
|
+
MDD installs one Claude slash command (`mdd.md`) plus six mode files read lazily at runtime. The main router reads your arguments and loads **only the mode file needed** — a `/mdd status` costs ~460 tokens instead of the full ~28,000.
|
|
87
87
|
|
|
88
88
|
```
|
|
89
|
-
mdd.md
|
|
90
|
-
|
|
91
|
-
mdd
|
|
92
|
-
mdd-
|
|
93
|
-
mdd-
|
|
94
|
-
mdd-
|
|
95
|
-
mdd-
|
|
89
|
+
~/.claude/commands/mdd.md Router — Steps 0/0a/0b, mode dispatch, Branch Guard
|
|
90
|
+
|
|
91
|
+
~/.claude/mdd/
|
|
92
|
+
mdd-build.md (~680 lines) BUILD MODE - Phases 0–7d
|
|
93
|
+
mdd-audit.md (~240 lines) AUDIT MODE - Phases A1–A7
|
|
94
|
+
mdd-manage.md (~340 lines) STATUS + NOTE + SCAN + UPDATE + DEPRECATE
|
|
95
|
+
mdd-lifecycle.md (~350 lines) REVERSE-ENGINEER + GRAPH + UPGRADE
|
|
96
|
+
mdd-plan.md (~350 lines) PLAN-INITIATIVE + PLAN-WAVE + PLAN-EXECUTE + PLAN-SYNC + …
|
|
97
|
+
mdd-ops.md (~380 lines) OPS DOCUMENT + OPS EXECUTE + OPS UPDATE + OPS LIST + COMMANDS
|
|
96
98
|
```
|
|
97
99
|
|
|
98
|
-
**Lazy loading is the key optimization.** Each invocation pays only for the mode it needs. The full 28,000-token set is always available but never loaded unnecessarily.
|
|
100
|
+
**Lazy loading is the key optimization.** Each invocation pays only for the mode it needs. The full 28,000-token set is always available but never loaded unnecessarily. Mode files live in `~/.claude/mdd/` (not `commands/`) so only `/mdd` appears in the Claude Code command picker.
|
|
99
101
|
|
|
100
102
|
---
|
|
101
103
|
|
|
@@ -103,13 +105,11 @@ mdd-ops.md (~380 lines) OPS DOCUMENT + OPS EXECUTE + OPS UPDATE + OPS LIST +
|
|
|
103
105
|
|
|
104
106
|
```bash
|
|
105
107
|
npm install -g @thedecipherist/mdd
|
|
106
|
-
mdd install #
|
|
108
|
+
mdd install # mdd.md → ~/.claude/commands/ | mode files → ~/.claude/mdd/
|
|
107
109
|
```
|
|
108
110
|
|
|
109
111
|
After installation, `/mdd` is available in every Claude Code session globally - no per-project setup needed.
|
|
110
112
|
|
|
111
|
-
`mdd install` also injects a guidance block into `~/.claude/CLAUDE.md` so Claude automatically suggests the right MDD workflow whenever you make an implementation request without the `/mdd` flag.
|
|
112
|
-
|
|
113
113
|
```bash
|
|
114
114
|
mdd update # update to latest installed version
|
|
115
115
|
mdd install --dir /custom/path # install to a custom directory (skips CLAUDE.md injection)
|
|
@@ -118,6 +118,55 @@ mdd install --install-local # install to .claude/commands/ + injects into
|
|
|
118
118
|
|
|
119
119
|
**Version safety:** `mdd install` compares `mdd_version` between the installed and available versions before overwriting. If you have a newer version installed, it won't silently downgrade.
|
|
120
120
|
|
|
121
|
+
### What `mdd install` sets up
|
|
122
|
+
|
|
123
|
+
| What | Where | Purpose |
|
|
124
|
+
|------|-------|---------|
|
|
125
|
+
| `mdd.md` (router) | `~/.claude/commands/` | The `/mdd` slash command entry point |
|
|
126
|
+
| 6 mode `.md` files | `~/.claude/mdd/` | Mode files (not exposed as commands) |
|
|
127
|
+
| Branch Guard hook | `~/.claude/hooks/mdd-branch-guard.sh` | Blocks file writes on `main` in any MDD project |
|
|
128
|
+
| Hook registration | `~/.claude/settings.json` | Wires the hook to Claude Code's PreToolUse event |
|
|
129
|
+
| Guidance block | `~/.claude/CLAUDE.md` | Teaches Claude to suggest MDD automatically |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Branch Guard — Never Work on `main`
|
|
134
|
+
|
|
135
|
+
`mdd install` registers a **Claude Code `PreToolUse` hook** that fires before every file write (`Write`, `Edit`, `NotebookEdit`) in any project with a `.mdd/` directory. If the current branch is `main` or `master`, the hook blocks the operation:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
⛔ MDD BRANCH GUARD
|
|
139
|
+
|
|
140
|
+
File modification is blocked on branch 'main'.
|
|
141
|
+
MDD never writes files directly on main or master.
|
|
142
|
+
|
|
143
|
+
Create a feature branch, then re-run your /mdd command:
|
|
144
|
+
|
|
145
|
+
git checkout -b feat/<feature-name>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Why a hook and not just instructions?**
|
|
149
|
+
|
|
150
|
+
Instruction-based branch checks can be lost through Claude's context compaction (when a conversation grows very long, earlier context is summarised). A `PreToolUse` hook fires at the OS level on every tool call — it cannot be compacted away, forgotten, or bypassed by stale context.
|
|
151
|
+
|
|
152
|
+
**How it works end-to-end:**
|
|
153
|
+
|
|
154
|
+
1. MDD instructions enforce branch hygiene in every command file (Branch Guard in `mdd.md`, Phase 0 in `mdd-build.md`, Phase PE1 in `mdd-plan.md`).
|
|
155
|
+
2. The hook acts as a permanent failsafe. If Claude is about to write a file on `main`, the hook fires before the write happens, exits with code `2`, and the operation is blocked.
|
|
156
|
+
3. The hook is a no-op outside `.mdd` projects and on any non-`main`/`master` branch.
|
|
157
|
+
|
|
158
|
+
**MDD branch naming conventions:**
|
|
159
|
+
|
|
160
|
+
| Mode | Auto-created branch |
|
|
161
|
+
|------|---------------------|
|
|
162
|
+
| `/mdd <feature>` | `feat/<feature-slug>` |
|
|
163
|
+
| `/mdd audit` | `fix/mdd-audit-<YYYY-MM-DD>` |
|
|
164
|
+
| `/mdd plan-initiative` | `feat/init-<initiative-slug>` |
|
|
165
|
+
| `/mdd plan-wave` | `feat/<wave-slug>` |
|
|
166
|
+
| `/mdd plan-execute` | `feat/<wave-slug>` |
|
|
167
|
+
|
|
168
|
+
When on a clean `main`, MDD creates the branch automatically. When on `main` with uncommitted changes, MDD stops and offers to commit or stash first.
|
|
169
|
+
|
|
121
170
|
---
|
|
122
171
|
|
|
123
172
|
## Quick Start
|
|
@@ -141,6 +190,52 @@ npm install -g @thedecipherist/mdd && mdd install
|
|
|
141
190
|
|
|
142
191
|
---
|
|
143
192
|
|
|
193
|
+
## Claude Automatically Suggests MDD
|
|
194
|
+
|
|
195
|
+
`mdd install` injects a small guidance block into your `~/.claude/CLAUDE.md` (or the project `CLAUDE.md` for `--install-local`). From that point on, whenever Claude detects a `.mdd/` directory in the current project it automatically evaluates every implementation or infrastructure request and suggests the right MDD workflow — even if you didn't type `/mdd`.
|
|
196
|
+
|
|
197
|
+
**What Claude checks, in order:**
|
|
198
|
+
|
|
199
|
+
**1. Does it already exist?**
|
|
200
|
+
Claude scans `.mdd/.startup.md` — which lists every documented feature and ops runbook with their tags. If your prompt overlaps with something already documented, Claude flags it before you duplicate work:
|
|
201
|
+
|
|
202
|
+
> *"This looks related to `02-user-auth` in your MDD docs. Want to use `/mdd update 02` to modify it, or `/mdd audit 02` to review it first?"*
|
|
203
|
+
|
|
204
|
+
**2. Is it ops/infrastructure?**
|
|
205
|
+
Deploy procedures, CI/CD pipelines, commit hooks, Docker builds, cron jobs, DNS changes — anything operational gets flagged for a runbook instead of ad-hoc implementation:
|
|
206
|
+
|
|
207
|
+
> *"This sounds like an ops procedure. Want to document it as a repeatable runbook with `/mdd ops deploy to production`?"*
|
|
208
|
+
|
|
209
|
+
**3. Is it initiative-scale?**
|
|
210
|
+
Large requests touching three or more independent concerns get routed to initiative/wave planning instead of a single feature doc:
|
|
211
|
+
|
|
212
|
+
> *"This looks initiative-scale. Want to plan it with `/mdd plan-initiative`?"*
|
|
213
|
+
|
|
214
|
+
**4. Is it a single new feature?**
|
|
215
|
+
Everything else gets the standard build mode prompt:
|
|
216
|
+
|
|
217
|
+
> *"Want me to use `/mdd add payment processing` to build this with documentation and tests first?"*
|
|
218
|
+
|
|
219
|
+
Claude always **asks** — it never auto-invokes `/mdd`. If you say no, it proceeds with direct implementation as normal. The detection is also intentionally narrow: bug fixes, typo corrections, config tweaks, and one-off shell commands are never flagged.
|
|
220
|
+
|
|
221
|
+
**How it detects overlap without loading full docs:**
|
|
222
|
+
|
|
223
|
+
Every feature doc and ops runbook has a `tags:` field (4–8 domain-concept keywords). These tags are surfaced in `.mdd/.startup.md` — a compact session-context file that's already injected into every Claude conversation. Claude scans the tag list in milliseconds, with no full-document loading and no context bloat.
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
## Features Documented
|
|
227
|
+
- 01-project-scaffolding (complete) [typescript, express, project-setup, scaffolding]
|
|
228
|
+
- 02-user-auth (in_progress) [auth, jwt, login, sessions, middleware]
|
|
229
|
+
- 03-payment-flow (draft) [stripe, payments, checkout, webhooks]
|
|
230
|
+
|
|
231
|
+
## Ops Runbooks
|
|
232
|
+
- prod-deploy [deploy, dokploy, docker, eu-west, canary, health-check]
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**The injection is idempotent.** Running `mdd install` or `mdd update` again never duplicates the block.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
144
239
|
## All 22 Modes at a Glance
|
|
145
240
|
|
|
146
241
|
```
|
|
@@ -239,6 +334,7 @@ last_synced: 2026-05-07
|
|
|
239
334
|
status: draft
|
|
240
335
|
phase: documentation
|
|
241
336
|
mdd_version: 8
|
|
337
|
+
tags: [auth, jwt, login, sessions, middleware]
|
|
242
338
|
known_issues: []
|
|
243
339
|
---
|
|
244
340
|
|
|
@@ -748,9 +844,12 @@ Generated: 2026-05-07 | Branch: feat/user-auth
|
|
|
748
844
|
Framework: Express + React | DB: PostgreSQL | Host: Dokploy
|
|
749
845
|
|
|
750
846
|
## Features Documented
|
|
751
|
-
01-project-scaffolding (complete)
|
|
752
|
-
02-user-auth (in_progress)
|
|
753
|
-
|
|
847
|
+
- 01-project-scaffolding (complete) [typescript, express, project-setup, scaffolding]
|
|
848
|
+
- 02-user-auth (in_progress) [auth, jwt, login, sessions, middleware]
|
|
849
|
+
- 03-payment-flow (draft) [stripe, payments, checkout, webhooks]
|
|
850
|
+
|
|
851
|
+
## Ops Runbooks
|
|
852
|
+
- prod-deploy [deploy, dokploy, docker, eu-west, canary, health-check]
|
|
754
853
|
|
|
755
854
|
## Last Audit
|
|
756
855
|
2026-05-01 - 20 findings, 17 fixed, 3 open
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# MDD Branch Guard
|
|
3
|
+
# PreToolUse hook — blocks Write/Edit/NotebookEdit on main/master in MDD projects.
|
|
4
|
+
# Installed by: mdd install (into .claude/hooks/ or ~/.claude/hooks/)
|
|
5
|
+
|
|
6
|
+
# Only active in MDD projects
|
|
7
|
+
[ -d ".mdd" ] || exit 0
|
|
8
|
+
|
|
9
|
+
# Check current branch
|
|
10
|
+
BRANCH=$(git branch --show-current 2>/dev/null)
|
|
11
|
+
[ -z "$BRANCH" ] && exit 0
|
|
12
|
+
|
|
13
|
+
# Only block on main/master
|
|
14
|
+
[[ "$BRANCH" == "main" || "$BRANCH" == "master" ]] || exit 0
|
|
15
|
+
|
|
16
|
+
# Count uncommitted changes for context
|
|
17
|
+
CHANGES=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
|
|
18
|
+
|
|
19
|
+
echo ""
|
|
20
|
+
echo "⛔ MDD BRANCH GUARD"
|
|
21
|
+
echo ""
|
|
22
|
+
echo " File modification is blocked on branch '${BRANCH}'."
|
|
23
|
+
echo " MDD never writes files directly on main or master."
|
|
24
|
+
echo ""
|
|
25
|
+
if [ "$CHANGES" -gt 0 ]; then
|
|
26
|
+
echo " You have ${CHANGES} uncommitted change(s). Commit or stash first:"
|
|
27
|
+
echo ""
|
|
28
|
+
echo " git add -A && git commit -m 'wip: ...' && git checkout -b feat/<name>"
|
|
29
|
+
echo " — or —"
|
|
30
|
+
echo " git stash && git checkout -b feat/<name>"
|
|
31
|
+
else
|
|
32
|
+
echo " Create a feature branch, then re-run your /mdd command:"
|
|
33
|
+
echo ""
|
|
34
|
+
echo " git checkout -b feat/<feature-name>"
|
|
35
|
+
fi
|
|
36
|
+
echo ""
|
|
37
|
+
|
|
38
|
+
exit 2
|
package/commands/mdd-plan.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Triggered when arguments start with `plan-initiative`. Creates a new initiative doc.
|
|
4
4
|
|
|
5
|
+
### Phase PI0 — Branch Guard
|
|
6
|
+
|
|
7
|
+
Run before any file creation:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
BRANCH=$(git branch --show-current)
|
|
11
|
+
DIRTY=$(git status --porcelain)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- **On `main` or `master` with uncommitted changes** → STOP. Show the Scenario A prompt from mdd.md Branch Guard.
|
|
15
|
+
- **On `main` or `master`, clean** → auto-branch to `feat/init-<initiative-slug>`. If the slug is not yet known (title not asked), use `feat/mdd-initiative` as a temporary name and rename the branch after the title is collected.
|
|
16
|
+
- **On a feature branch** → working dirty is fine. Proceed — initiative planning docs belong on whatever branch is current.
|
|
17
|
+
- **Never proceed on main.** Hard block.
|
|
18
|
+
|
|
5
19
|
### Phase PI1 — Mode choice
|
|
6
20
|
|
|
7
21
|
Ask the user:
|
|
@@ -86,6 +100,18 @@ Triggered when arguments start with `plan-wave`. Takes a wave slug (e.g. `auth-s
|
|
|
86
100
|
|
|
87
101
|
### Phase PW1 — Load and validate
|
|
88
102
|
|
|
103
|
+
**Step 0 — Branch guard:**
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
BRANCH=$(git branch --show-current)
|
|
107
|
+
DIRTY=$(git status --porcelain)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- **On `main` or `master` with uncommitted changes** → STOP. Show Scenario A from mdd.md Branch Guard.
|
|
111
|
+
- **On `main` or `master`, clean** → auto-branch to `feat/<wave-slug>`.
|
|
112
|
+
- **On a feature branch** → proceed (planning docs belong on this branch).
|
|
113
|
+
- **Never proceed on main.** Hard block.
|
|
114
|
+
|
|
89
115
|
1. Parse `<wave-slug>` from arguments — hard stop *"Wave slug required. Usage: /mdd plan-wave <wave-slug>"* if missing.
|
|
90
116
|
2. Derive initiative slug: everything before `-wave-N` (e.g. `auth-system-wave-2` → `auth-system`).
|
|
91
117
|
3. Read `initiatives/<initiative-slug>.md` fresh from disk — hard stop *"Initiative does not exist: `initiatives/<slug>.md`"* if not found.
|
|
@@ -160,6 +186,30 @@ Triggered when arguments start with `plan-execute`. Runs the full MDD build flow
|
|
|
160
186
|
|
|
161
187
|
### Phase PE1 — Load and validate
|
|
162
188
|
|
|
189
|
+
**Step 0 — Branch guard (runs before everything else):**
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
BRANCH=$(git branch --show-current)
|
|
193
|
+
DIRTY=$(git status --porcelain)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
- **On `main` or `master` with uncommitted changes** → STOP. Show the Scenario A prompt from the Branch Guard in mdd.md. Do not proceed until resolved.
|
|
197
|
+
- **On `main` or `master`, clean** → auto-branch to `feat/<wave-slug>` immediately. Report: `✅ Branched to feat/<wave-slug>`.
|
|
198
|
+
- **On a feature branch that doesn't match `<wave-slug>`** → mismatch. Show:
|
|
199
|
+
```
|
|
200
|
+
⚠️ Branch mismatch for wave execution.
|
|
201
|
+
|
|
202
|
+
Current branch: <branch-name>
|
|
203
|
+
Expected: feat/<wave-slug>
|
|
204
|
+
|
|
205
|
+
MDD expects one wave per branch. What would you like to do?
|
|
206
|
+
(a) Commit, merge to main, and branch fresh to feat/<wave-slug>
|
|
207
|
+
(b) Continue on this branch (not recommended — mixes work)
|
|
208
|
+
(c) Abort
|
|
209
|
+
```
|
|
210
|
+
Follow the same (a)/(b)/(c) logic as mdd-build.md Phase 0.
|
|
211
|
+
- **Never proceed on main.** This is a hard block regardless of clean/dirty state.
|
|
212
|
+
|
|
163
213
|
1. Parse `<wave-slug>` — hard stop *"Wave does not exist"* if `waves/<wave-slug>.md` not found.
|
|
164
214
|
2. Read the wave doc.
|
|
165
215
|
3. Derive and read the parent initiative — hard stop if not found.
|
package/commands/mdd.md
CHANGED
|
@@ -3,7 +3,7 @@ description: "MDD workflow — Document → Audit → Fix → Verify. Build feat
|
|
|
3
3
|
scope: project
|
|
4
4
|
argument-hint: "<feature-description> or audit [section]"
|
|
5
5
|
allowed-tools: Read, Write, Edit, Grep, Glob, Bash, AskUserQuestion, Agent
|
|
6
|
-
mdd_version:
|
|
6
|
+
mdd_version: 9
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# MDD — Manual-Driven Development Workflow
|
|
@@ -104,9 +104,11 @@ The user's full arguments are: **$ARGUMENTS**
|
|
|
104
104
|
|
|
105
105
|
Parse these arguments to determine the mode. **Before doing anything else, read the appropriate mode file listed below.** The mode file contains the complete instructions for that mode. When mode file instructions reference `$ARGUMENTS`, treat it as the arguments stated above.
|
|
106
106
|
|
|
107
|
-
Find the MDD
|
|
108
|
-
1. `.claude/
|
|
109
|
-
2. `~/.claude/
|
|
107
|
+
Find the MDD mode files directory by checking in this order:
|
|
108
|
+
1. `.claude/mdd/` in the current project (local install)
|
|
109
|
+
2. `~/.claude/mdd/` (global install)
|
|
110
|
+
3. `.claude/commands/` in the current project (legacy local install)
|
|
111
|
+
4. `~/.claude/commands/` (legacy global install)
|
|
110
112
|
|
|
111
113
|
Use whichever path contains `mdd-audit.md`. Store it as `$MDD_DIR` and use it for all mode file reads below.
|
|
112
114
|
|
|
@@ -131,21 +133,73 @@ Use whichever path contains `mdd-audit.md`. Store it as `$MDD_DIR` and use it fo
|
|
|
131
133
|
|
|
132
134
|
---
|
|
133
135
|
|
|
134
|
-
##
|
|
136
|
+
## Branch Guard (All Modes)
|
|
135
137
|
|
|
136
|
-
**
|
|
138
|
+
**This guard is mandatory. MDD never creates or modifies files directly on `main` or `master`. No exceptions — not even for documentation, planning, or ops files.**
|
|
137
139
|
|
|
138
|
-
|
|
140
|
+
**If the user already chose a worktree in Step 0, skip entirely** — the worktree has its own dedicated branch.
|
|
141
|
+
|
|
142
|
+
Otherwise, before creating or modifying any files, run:
|
|
139
143
|
|
|
140
144
|
```bash
|
|
141
|
-
git branch --show-current
|
|
145
|
+
BRANCH=$(git branch --show-current)
|
|
146
|
+
DIRTY=$(git status --porcelain)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### Scenario A — On `main` or `master`, working tree has uncommitted changes
|
|
152
|
+
|
|
153
|
+
**STOP. Do not create or modify any file.**
|
|
154
|
+
|
|
142
155
|
```
|
|
156
|
+
🚫 MDD Branch Guard — cannot proceed on main with uncommitted changes.
|
|
157
|
+
|
|
158
|
+
Branch: main
|
|
159
|
+
Dirty: <N> file(s) modified / untracked
|
|
160
|
+
|
|
161
|
+
MDD never works directly on main, and uncommitted changes must be
|
|
162
|
+
resolved before branching safely.
|
|
163
|
+
|
|
164
|
+
Choose:
|
|
165
|
+
(a) Commit now — stage all changes and commit, then MDD auto-branches
|
|
166
|
+
(b) Stash now — git stash, then MDD auto-branches
|
|
167
|
+
(c) Abort — handle git manually, then re-run /mdd
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
- **(a) Commit:** `git add -A`, generate a short conventional commit message from the changed files, commit, then proceed to Scenario B.
|
|
171
|
+
- **(b) Stash:** `git stash`, then proceed to Scenario B.
|
|
172
|
+
- **(c) Abort:** stop entirely — do not create any files.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### Scenario B — On `main` or `master`, clean working tree
|
|
177
|
+
|
|
178
|
+
Auto-branch immediately — no user prompt. Derive the branch name from the active mode:
|
|
179
|
+
|
|
180
|
+
| Mode | Branch name |
|
|
181
|
+
|------|-------------|
|
|
182
|
+
| Build (`/mdd <feature>`) | `feat/<feature-slug>` |
|
|
183
|
+
| Audit (`/mdd audit`) | `fix/mdd-audit-<YYYY-MM-DD>` |
|
|
184
|
+
| plan-initiative | `feat/init-<initiative-slug>` |
|
|
185
|
+
| plan-wave | `feat/<wave-slug>` |
|
|
186
|
+
| plan-execute | `feat/<wave-slug>` |
|
|
187
|
+
| Any other mode | `feat/<slug-from-arguments>` |
|
|
188
|
+
|
|
189
|
+
Run `git checkout -b <branch-name>` and report:
|
|
190
|
+
```
|
|
191
|
+
✅ Branched to <branch-name> — proceeding with MDD.
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### Scenario C — Already on a feature or fix branch
|
|
197
|
+
|
|
198
|
+
Working tree dirty (in-progress changes) is **expected and fine** — that work belongs on this branch.
|
|
199
|
+
|
|
200
|
+
Each mode's Phase 0 handles mismatch detection (does the new task belong on this branch?). See mdd-build.md Phase 0 and mdd-plan.md for details.
|
|
143
201
|
|
|
144
|
-
**
|
|
145
|
-
- If on `main` or `master`:
|
|
146
|
-
- Build mode: `git checkout -b feat/<feature-name>`
|
|
147
|
-
- Audit mode: `git checkout -b fix/mdd-audit-<date>`
|
|
148
|
-
- If already on a feature branch: proceed
|
|
202
|
+
**One hard rule:** A branch starting with `fix/mdd-audit-` is an audit branch. Build and plan modes must not reuse it — fall through to Scenario B naming instead.
|
|
149
203
|
|
|
150
204
|
---
|
|
151
205
|
|
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ program
|
|
|
16
16
|
.version(pkg.version);
|
|
17
17
|
program
|
|
18
18
|
.command('install')
|
|
19
|
-
.description('Install MDD
|
|
19
|
+
.description('Install MDD — mdd.md to ~/.claude/commands/, mode files to ~/.claude/mdd/')
|
|
20
20
|
.option('--dir <path>', 'Custom install directory (default: ~/.claude/commands)', '~/.claude/commands')
|
|
21
21
|
.option('--install-local', 'Install to .claude/commands/ in the current project directory', false)
|
|
22
22
|
.option('--force', 'Overwrite existing files even if already up to date', false)
|
|
@@ -24,10 +24,16 @@ program
|
|
|
24
24
|
const dirExplicit = this.getOptionValueSource('dir') === 'cli';
|
|
25
25
|
const local = options.installLocal && !dirExplicit;
|
|
26
26
|
const effectiveDir = local ? join(cwd(), '.claude/commands') : options.dir;
|
|
27
|
+
const modesDir = dirExplicit ? undefined
|
|
28
|
+
: local ? join(cwd(), '.claude/mdd')
|
|
29
|
+
: join(homedir(), '.claude', 'mdd');
|
|
27
30
|
const claudeMdPath = dirExplicit ? undefined
|
|
28
31
|
: local ? join(cwd(), 'CLAUDE.md')
|
|
29
32
|
: join(homedir(), '.claude', 'CLAUDE.md');
|
|
30
|
-
|
|
33
|
+
const settingsPath = dirExplicit ? undefined
|
|
34
|
+
: local ? join(cwd(), '.claude', 'settings.json')
|
|
35
|
+
: join(homedir(), '.claude', 'settings.json');
|
|
36
|
+
install({ dir: effectiveDir, modesDir, force: options.force, local, claudeMdPath, settingsPath });
|
|
31
37
|
});
|
|
32
38
|
program
|
|
33
39
|
.command('update')
|
|
@@ -38,10 +44,16 @@ program
|
|
|
38
44
|
const dirExplicit = this.getOptionValueSource('dir') === 'cli';
|
|
39
45
|
const local = options.installLocal && !dirExplicit;
|
|
40
46
|
const effectiveDir = local ? join(cwd(), '.claude/commands') : options.dir;
|
|
47
|
+
const modesDir = dirExplicit ? undefined
|
|
48
|
+
: local ? join(cwd(), '.claude/mdd')
|
|
49
|
+
: join(homedir(), '.claude', 'mdd');
|
|
41
50
|
const claudeMdPath = dirExplicit ? undefined
|
|
42
51
|
: local ? join(cwd(), 'CLAUDE.md')
|
|
43
52
|
: join(homedir(), '.claude', 'CLAUDE.md');
|
|
44
|
-
|
|
53
|
+
const settingsPath = dirExplicit ? undefined
|
|
54
|
+
: local ? join(cwd(), '.claude', 'settings.json')
|
|
55
|
+
: join(homedir(), '.claude', 'settings.json');
|
|
56
|
+
install({ dir: effectiveDir, modesDir, force: true, local, claudeMdPath, settingsPath });
|
|
45
57
|
});
|
|
46
58
|
program.parse();
|
|
47
59
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAwB,CAAC;AAEzG,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,0DAA0D,CAAC;KACvE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAExB,OAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WA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/D,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,IAAI,CAAC,WAAW,CAAC;IACnD,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAC3E,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS;QACtC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC;YACpC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS;QAC1C,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC;YAClC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS;QAC1C,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,eAAe,CAAC;YACjD,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC;AAC3F,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/install.d.ts
CHANGED
package/dist/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAQA,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAUD,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CA4GrD"}
|
package/dist/install.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { copyFileSync, mkdirSync, existsSync, readdirSync, readFileSync, writeFileSync, appendFileSync } from 'fs';
|
|
2
|
-
import { join, resolve } from 'path';
|
|
1
|
+
import { copyFileSync, mkdirSync, existsSync, readdirSync, readFileSync, writeFileSync, appendFileSync, chmodSync, unlinkSync } from 'fs';
|
|
2
|
+
import { join, resolve, dirname } from 'path';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
|
-
import { dirname } from 'path';
|
|
6
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
6
|
const __dirname = dirname(__filename);
|
|
8
7
|
export function install(options) {
|
|
9
8
|
const destDir = resolve(options.dir.replace('~', homedir()));
|
|
9
|
+
const modesDestDir = options.modesDir ? resolve(options.modesDir.replace('~', homedir())) : destDir;
|
|
10
10
|
const srcDir = join(__dirname, '../commands');
|
|
11
11
|
const version = getPackageVersion();
|
|
12
12
|
mkdirSync(destDir, { recursive: true });
|
|
13
|
+
if (modesDestDir !== destDir)
|
|
14
|
+
mkdirSync(modesDestDir, { recursive: true });
|
|
13
15
|
const files = readdirSync(srcDir)
|
|
14
16
|
.filter(f => f.endsWith('.md'))
|
|
15
17
|
.sort((a, b) => {
|
|
16
|
-
// mdd.md first, then alphabetical
|
|
17
18
|
if (a === 'mdd.md')
|
|
18
19
|
return -1;
|
|
19
20
|
if (b === 'mdd.md')
|
|
@@ -23,7 +24,19 @@ export function install(options) {
|
|
|
23
24
|
const results = [];
|
|
24
25
|
for (const file of files) {
|
|
25
26
|
const src = join(srcDir, file);
|
|
26
|
-
const
|
|
27
|
+
const isModeFile = file !== 'mdd.md';
|
|
28
|
+
const targetDir = isModeFile ? modesDestDir : destDir;
|
|
29
|
+
const dest = join(targetDir, file);
|
|
30
|
+
// Clean up legacy location: if mode file exists in commands dir but we're now using a separate modesDir, remove it
|
|
31
|
+
if (isModeFile && modesDestDir !== destDir) {
|
|
32
|
+
const legacyDest = join(destDir, file);
|
|
33
|
+
if (existsSync(legacyDest)) {
|
|
34
|
+
try {
|
|
35
|
+
unlinkSync(legacyDest);
|
|
36
|
+
}
|
|
37
|
+
catch { /* ignore */ }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
27
40
|
try {
|
|
28
41
|
if (existsSync(dest) && !options.force) {
|
|
29
42
|
if (file === 'mdd.md') {
|
|
@@ -37,7 +50,6 @@ export function install(options) {
|
|
|
37
50
|
results.push({ file, status: 'updated', fromVersion: destVer, toVersion: srcVer });
|
|
38
51
|
}
|
|
39
52
|
else {
|
|
40
|
-
// For mode files: compare modification — just overwrite silently
|
|
41
53
|
copyFileSync(src, dest);
|
|
42
54
|
results.push({ file, status: 'updated' });
|
|
43
55
|
}
|
|
@@ -82,6 +94,20 @@ export function install(options) {
|
|
|
82
94
|
console.log(` ${icon} CLAUDE.md — ${claudeResult.message}`);
|
|
83
95
|
console.log('');
|
|
84
96
|
}
|
|
97
|
+
if (options.settingsPath) {
|
|
98
|
+
const hookScriptSrc = join(srcDir, 'mdd-branch-guard.sh');
|
|
99
|
+
const hooksDir = join(resolve(options.settingsPath.replace('~', homedir()), '..'), 'hooks');
|
|
100
|
+
const hookScriptDest = join(hooksDir, 'mdd-branch-guard.sh');
|
|
101
|
+
const hookResult = installHook({
|
|
102
|
+
hookScriptSrc,
|
|
103
|
+
hookScriptDest,
|
|
104
|
+
settingsPath: resolve(options.settingsPath.replace('~', homedir())),
|
|
105
|
+
local: options.local ?? false,
|
|
106
|
+
});
|
|
107
|
+
const icon = hookResult.status === 'error' ? '✗' : hookResult.status === 'skipped' ? '·' : '✓';
|
|
108
|
+
console.log(` ${icon} Branch Guard hook — ${hookResult.message}`);
|
|
109
|
+
console.log('');
|
|
110
|
+
}
|
|
85
111
|
console.log('Open Claude Code and run /mdd to get started.\n');
|
|
86
112
|
}
|
|
87
113
|
function getMddVersion(content) {
|
|
@@ -131,6 +157,54 @@ Always ask — never auto-invoke. If the user says no, proceed as normal.
|
|
|
131
157
|
Skip entirely for: bug fixes, typos, config tweaks, single-line changes,
|
|
132
158
|
one-off shell commands.
|
|
133
159
|
`;
|
|
160
|
+
function installHook(opts) {
|
|
161
|
+
try {
|
|
162
|
+
// Install the hook script
|
|
163
|
+
mkdirSync(dirname(opts.hookScriptDest), { recursive: true });
|
|
164
|
+
copyFileSync(opts.hookScriptSrc, opts.hookScriptDest);
|
|
165
|
+
chmodSync(opts.hookScriptDest, 0o755);
|
|
166
|
+
// Derive hook command — local uses relative path, global uses $HOME
|
|
167
|
+
const hookCommand = opts.local
|
|
168
|
+
? 'bash .claude/hooks/mdd-branch-guard.sh'
|
|
169
|
+
: 'bash $HOME/.claude/hooks/mdd-branch-guard.sh';
|
|
170
|
+
const HOOK_MARKER = 'mdd-branch-guard';
|
|
171
|
+
// Read existing settings.json or start fresh
|
|
172
|
+
let settings = {};
|
|
173
|
+
if (existsSync(opts.settingsPath)) {
|
|
174
|
+
try {
|
|
175
|
+
settings = JSON.parse(readFileSync(opts.settingsPath, 'utf-8'));
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// Unparseable settings — leave existing file alone to avoid corruption
|
|
179
|
+
return { status: 'error', message: `could not parse ${opts.settingsPath}` };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// Check if hook already registered
|
|
183
|
+
const hooksSection = settings['hooks'];
|
|
184
|
+
const preToolUse = (hooksSection?.['PreToolUse'] ?? []);
|
|
185
|
+
const alreadyInstalled = preToolUse.some(group => {
|
|
186
|
+
const hooks = group['hooks'];
|
|
187
|
+
return hooks?.some(h => String(h['command'] ?? '').includes(HOOK_MARKER));
|
|
188
|
+
});
|
|
189
|
+
if (alreadyInstalled) {
|
|
190
|
+
return { status: 'skipped', message: 'already registered in settings.json' };
|
|
191
|
+
}
|
|
192
|
+
// Merge hook entry into PreToolUse
|
|
193
|
+
const newEntry = {
|
|
194
|
+
matcher: 'Write|Edit|NotebookEdit',
|
|
195
|
+
hooks: [{ type: 'command', command: hookCommand }],
|
|
196
|
+
};
|
|
197
|
+
settings['hooks'] = {
|
|
198
|
+
...(hooksSection ?? {}),
|
|
199
|
+
PreToolUse: [...preToolUse, newEntry],
|
|
200
|
+
};
|
|
201
|
+
writeFileSync(opts.settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf-8');
|
|
202
|
+
return { status: 'installed', message: `hook registered in ${opts.settingsPath}` };
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
return { status: 'error', message: String(err) };
|
|
206
|
+
}
|
|
207
|
+
}
|
|
134
208
|
function injectClaudeGuidance(claudeMdPath) {
|
|
135
209
|
try {
|
|
136
210
|
if (existsSync(claudeMdPath)) {
|
package/dist/install.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,I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