You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- If the file **already exists** and versions match → skip, report "already up to date"
48
48
- If the file **does NOT exist** → copy it
49
49
50
-
**After copying**, update the `description` field in each installed file to prepend `(global)`so it is distinguishable from project-level copies in the Claude command list:
50
+
**After handling each file** (whether copied or skipped), always ensure the `(global)` prefix is present in the installed copy's `description` field. Run the sed unconditionally — it is idempotent and safe to run even if `(global)` is already present (the pattern only matches when `(global)` is absent):
51
51
52
52
```bash
53
-
#Prepend (global) to description in the installed copy
54
-
sed -i 's/^description: "\(.*\)"$/description: "(global) \1"/'~/.claude/commands/mdd.md
55
-
sed -i 's/^description: "\(.*\)"$/description: "(global) \1"/'~/.claude/commands/install-mdd.md
53
+
#Ensure (global) prefix — idempotent: only adds if not already present
54
+
sed -i 's/^description: "\([^(]\)/description: "(global) \1/'~/.claude/commands/mdd.md
55
+
sed -i 's/^description: "\([^(]\)/description: "(global) \1/'~/.claude/commands/install-mdd.md
56
56
```
57
57
58
58
This only modifies the installed copy at `~/.claude/commands/` — the source files in `.claude/commands/` are never touched.
✓ mdd.md — v<VERSION> already up to date [labelled "global"]
68
+
✓ install-mdd.md — already up to date [labelled "global"]
69
69
70
70
/mdd is now current in every project on this machine.
71
71
```
@@ -192,23 +192,23 @@ For each file (`mdd.md`, `install-mdd.md`):
192
192
- If the file **already exists** at `~/.claude/commands/` → ask: "mdd.md already exists globally (installed: v<INSTALLED_VERSION>, available: v<SOURCE_VERSION>). Overwrite? (yes / keep existing)"
193
193
- If it **does NOT exist** → copy it from `.claude/commands/`
194
194
195
-
**After copying**, prepend `(global)`to the `description` field in each installed file:
195
+
**After handling each file** (whether copied, updated, or skipped), always ensure the `(global)`prefix is present. Run the sed unconditionally — it is idempotent and only adds the prefix if absent:
196
196
```bash
197
-
sed -i 's/^description: "\(.*\)"$/description: "(global) \1"/'~/.claude/commands/mdd.md
198
-
sed -i 's/^description: "\(.*\)"$/description: "(global) \1"/'~/.claude/commands/install-mdd.md
197
+
sed -i 's/^description: "\([^(]\)/description: "(global) \1/'~/.claude/commands/mdd.md
198
+
sed -i 's/^description: "\([^(]\)/description: "(global) \1/'~/.claude/commands/install-mdd.md
199
199
```
200
200
201
201
Report:
202
202
```
203
203
Global MDD install:
204
-
+ mdd.md — installed (now available as /mdd in every project)
205
-
+ install-mdd.md — installed (now available as /install-mdd in every project)
0 commit comments