@roulabs/mx 1.2.0 → 1.2.2
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/mx.js +15 -3
- package/package.json +1 -1
- package/templates/CLAUDE.md +2 -4
package/bin/mx.js
CHANGED
|
@@ -167,11 +167,23 @@ function initRuntime(target0, templatesDir2) {
|
|
|
167
167
|
removeStaleRuntimeReadme(target);
|
|
168
168
|
return { runtime: target, created };
|
|
169
169
|
}
|
|
170
|
+
function ensureWorkScaffolding(root, workName) {
|
|
171
|
+
const created = [];
|
|
172
|
+
const sessions = path3.join(workDir(root, workName), "sessions");
|
|
173
|
+
if (!exists(sessions)) {
|
|
174
|
+
fs4.mkdirSync(sessions, { recursive: true });
|
|
175
|
+
created.push(sessions);
|
|
176
|
+
}
|
|
177
|
+
return created;
|
|
178
|
+
}
|
|
170
179
|
function updateRuntime(root, templatesDir2) {
|
|
171
|
-
const
|
|
172
|
-
|
|
180
|
+
const updated = [];
|
|
181
|
+
updated.push(stampClaudeMd(root, templatesDir2));
|
|
173
182
|
const ctxIndex = stampContextIndex(root, templatesDir2);
|
|
174
183
|
if (ctxIndex) updated.push(ctxIndex);
|
|
184
|
+
for (const workName of listWorkNames(root)) {
|
|
185
|
+
updated.push(...ensureWorkScaffolding(root, workName));
|
|
186
|
+
}
|
|
175
187
|
removeStaleRuntimeReadme(root);
|
|
176
188
|
return { runtime: root, updated };
|
|
177
189
|
}
|
|
@@ -309,10 +321,10 @@ function workNew(root, name, description = "") {
|
|
|
309
321
|
const dir = workDir(root, name);
|
|
310
322
|
if (exists(dir)) throw new MxError(`work already exists: ${name}`, "EXISTS");
|
|
311
323
|
fs6.mkdirSync(dir, { recursive: true });
|
|
312
|
-
fs6.mkdirSync(path4.join(dir, "sessions"), { recursive: true });
|
|
313
324
|
const work = { name, description, worktrees: [] };
|
|
314
325
|
writeWork(root, work);
|
|
315
326
|
writeJson(workspaceFile(root, name), { folders: [], settings: {} });
|
|
327
|
+
ensureWorkScaffolding(root, name);
|
|
316
328
|
return { ...work, path: dir };
|
|
317
329
|
}
|
|
318
330
|
function listWorksInfo(root, opts = {}) {
|
package/package.json
CHANGED
package/templates/CLAUDE.md
CHANGED
|
@@ -115,7 +115,7 @@ Example entry:
|
|
|
115
115
|
|
|
116
116
|
Primary path:
|
|
117
117
|
|
|
118
|
-
1. Read `<runtime>/context/INDEX.json`
|
|
118
|
+
1. **Read `<runtime>/context/INDEX.json` on every task** — trivial or not, small or large. Skimming a metadata index is cheap; the cost of missing a relevant entry is high. This is a hard rule, not a heuristic.
|
|
119
119
|
2. Open files at `<runtime>/context/<path>.md` for entries whose metadata matches the current task.
|
|
120
120
|
|
|
121
121
|
When INDEX descriptions don't surface what you need — and often they won't — fall back to anything that works:
|
|
@@ -123,12 +123,10 @@ When INDEX descriptions don't surface what you need — and often they won't —
|
|
|
123
123
|
- **Grep `<runtime>/context/`** for keywords. Frequently the term you need lives in a body, not in any description.
|
|
124
124
|
- **`ls` the folder recursively** to spot entries on disk that aren't indexed (orphans), and read them directly when relevant.
|
|
125
125
|
- **Follow `related` chains** outward from a known-relevant entry to find the rest of a cluster.
|
|
126
|
-
- **Read everything**
|
|
126
|
+
- **Read everything** when in doubt — better than guessing.
|
|
127
127
|
|
|
128
128
|
INDEX is the *primary* discovery surface, not the only one. Use whatever gets you to the right entry fastest — direct grep, full-content scan, recursive read, following links, your judgment.
|
|
129
129
|
|
|
130
|
-
A 30-second skim of INDEX is free; do it before any non-trivial task. Skip only for typo-fix-level work.
|
|
131
|
-
|
|
132
130
|
### Maintain INDEX.json as you go
|
|
133
131
|
|
|
134
132
|
When you add, rename, remove, or restructure an entry, update INDEX in the same change. Drift means orphan files (invisible to future sessions) or stale entries (false positives). After editing INDEX, sanity-check it parses as valid JSON.
|