dotmd-cli 0.55.0 → 0.56.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/bin/dotmd.mjs +6 -1
- package/package.json +1 -1
- package/src/hud.mjs +16 -0
package/bin/dotmd.mjs
CHANGED
|
@@ -1233,7 +1233,12 @@ async function main() {
|
|
|
1233
1233
|
restArgs.push(args[i]);
|
|
1234
1234
|
}
|
|
1235
1235
|
|
|
1236
|
-
|
|
1236
|
+
// Hook commands (`hud`, `guard`) fire in EVERY repo via the globally-enabled
|
|
1237
|
+
// plugin — `guard` runs on every Bash/Read/Edit. They must stay silent where
|
|
1238
|
+
// dotmd isn't used, so don't nag them about a missing config (they no-op
|
|
1239
|
+
// cleanly on their own). The warning is still useful for interactive commands.
|
|
1240
|
+
const HOOK_COMMANDS = new Set(['hud', 'guard']);
|
|
1241
|
+
if (!config.configFound && command !== 'init' && !HOOK_COMMANDS.has(command)) {
|
|
1237
1242
|
warn('No dotmd config found — using defaults. Run `dotmd init` to create one.');
|
|
1238
1243
|
}
|
|
1239
1244
|
|
package/package.json
CHANGED
package/src/hud.mjs
CHANGED
|
@@ -229,20 +229,36 @@ const SUBAGENT_PRIMER = [
|
|
|
229
229
|
'git add/commit a prompt (they are session-local, often gitignored); hand-edit a `status:` field (use `dotmd set`).',
|
|
230
230
|
].join('\n');
|
|
231
231
|
|
|
232
|
+
// The plugin's SessionStart/SubagentStart hooks fire in EVERY repo (it's enabled
|
|
233
|
+
// globally), but the primer only helps where dotmd is actually used. Gate on a
|
|
234
|
+
// discovered config: `dotmd init` writes dotmd.config.mjs, so "has a config" is
|
|
235
|
+
// the zero-false-positive signal for "this is a dotmd repo." A bare docs/ dir is
|
|
236
|
+
// deliberately NOT enough — too many repos have one. In a non-dotmd repo the hook
|
|
237
|
+
// then contributes nothing to the session: no primer, no index build, no heal.
|
|
238
|
+
function isDotmdRepo(config) {
|
|
239
|
+
return Boolean(config?.configFound);
|
|
240
|
+
}
|
|
241
|
+
|
|
232
242
|
export function runHud(argv, config) {
|
|
233
243
|
const json = argv.includes('--json');
|
|
234
244
|
|
|
235
245
|
const drift = detectVersionDrift();
|
|
246
|
+
const dotmdRepo = isDotmdRepo(config);
|
|
236
247
|
|
|
237
248
|
// SubagentStart hook entry point — emit the compact primer and return. No
|
|
238
249
|
// index build, no journal read, no slash-command heal: a subagent doesn't
|
|
239
250
|
// need the operator-facing machinery, just the verbs and the guardrails.
|
|
240
251
|
if (argv.includes('--subagent')) {
|
|
252
|
+
if (!dotmdRepo) return; // silent in repos that don't use dotmd
|
|
241
253
|
process.stdout.write(dim(SUBAGENT_PRIMER) + '\n');
|
|
242
254
|
if (drift) process.stdout.write(yellow(drift) + '\n');
|
|
243
255
|
return;
|
|
244
256
|
}
|
|
245
257
|
|
|
258
|
+
// Non-dotmd repo, and not a programmatic --json caller → contribute nothing to
|
|
259
|
+
// the session. Skip the index build, slash-heal, primer, and drift line.
|
|
260
|
+
if (!dotmdRepo && !json) return;
|
|
261
|
+
|
|
246
262
|
const hud = buildHud(config);
|
|
247
263
|
|
|
248
264
|
// Self-heal stale slash-command files. Wrapped: a broken scaffolder must
|