dotmd-cli 0.48.1 → 0.48.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/package.json +1 -1
- package/src/new.mjs +21 -7
- package/src/runlist.mjs +30 -2
package/package.json
CHANGED
package/src/new.mjs
CHANGED
|
@@ -22,6 +22,23 @@ function surfacesScaffold(ctx) {
|
|
|
22
22
|
return 'surfaces:';
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
// Module-taxonomy parallel of surfacesScaffold. When `taxonomy.modules` is set,
|
|
26
|
+
// scaffold lists valid values + a `- none` placeholder so the validator's
|
|
27
|
+
// modules-required check passes by default and the author can swap to a real
|
|
28
|
+
// module from the listed taxonomy. When unset, the project doesn't enumerate
|
|
29
|
+
// modules — drop the placeholder entirely so new plans aren't sprinkled with a
|
|
30
|
+
// meaningless sentinel.
|
|
31
|
+
function modulesScaffold(ctx, kind /* 'doc' | 'plan' */) {
|
|
32
|
+
const valid = ctx?.validModules;
|
|
33
|
+
if (Array.isArray(valid) && valid.length > 0) {
|
|
34
|
+
const comment = kind === 'plan'
|
|
35
|
+
? `# modules — valid: ${valid.join(', ')} (or \`none\` for tooling/infra plans)`
|
|
36
|
+
: `# modules — valid: ${valid.join(', ')} (or \`none\` for platform/infra docs)`;
|
|
37
|
+
return `${comment}\nmodules:\n - none`;
|
|
38
|
+
}
|
|
39
|
+
return 'modules:';
|
|
40
|
+
}
|
|
41
|
+
|
|
25
42
|
const BUILTIN_TEMPLATES = {
|
|
26
43
|
doc: {
|
|
27
44
|
description: 'Reference doc, design note, module overview — build-up shape lite',
|
|
@@ -35,9 +52,7 @@ const BUILTIN_TEMPLATES = {
|
|
|
35
52
|
`status: ${s}`,
|
|
36
53
|
`created: ${d}`,
|
|
37
54
|
`updated: ${d}`,
|
|
38
|
-
|
|
39
|
-
'modules:',
|
|
40
|
-
' - none',
|
|
55
|
+
modulesScaffold(ctx, 'doc'),
|
|
41
56
|
surfacesScaffold(ctx),
|
|
42
57
|
'domain:',
|
|
43
58
|
'audience: internal',
|
|
@@ -75,9 +90,7 @@ ${ctx?.bodyInput?.trim() ?? ''}
|
|
|
75
90
|
`created: ${d}`,
|
|
76
91
|
`updated: ${d}`,
|
|
77
92
|
surfacesScaffold(ctx),
|
|
78
|
-
|
|
79
|
-
'modules:',
|
|
80
|
-
' - none',
|
|
93
|
+
modulesScaffold(ctx, 'plan'),
|
|
81
94
|
'domain:',
|
|
82
95
|
'audience: internal',
|
|
83
96
|
'parent_plan:',
|
|
@@ -477,7 +490,8 @@ export async function runNew(argv, config, opts = {}) {
|
|
|
477
490
|
// Generate content
|
|
478
491
|
let content;
|
|
479
492
|
const validSurfaces = config.raw?.taxonomy?.surfaces ?? (config.validSurfaces ? [...config.validSurfaces] : null);
|
|
480
|
-
const
|
|
493
|
+
const validModules = config.raw?.taxonomy?.modules ?? (config.validModules ? [...config.validModules] : null);
|
|
494
|
+
const tmplCtx = { status, title: docTitle, today, bodyInput, validSurfaces, validModules };
|
|
481
495
|
if (typeof template === 'function') {
|
|
482
496
|
content = template(name, tmplCtx);
|
|
483
497
|
} else {
|
package/src/runlist.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { extractFrontmatter, parseSimpleFrontmatter } from './frontmatter.mjs';
|
|
4
4
|
import {
|
|
@@ -14,6 +14,34 @@ import { bold, cyan, dim, green, red, yellow } from './color.mjs';
|
|
|
14
14
|
|
|
15
15
|
const PICKUPABLE_STATUSES = new Set(['active', 'planned', 'in-session']);
|
|
16
16
|
|
|
17
|
+
// resolveDocPath only tries cwd / repo-root / docs-root joins, so bare plan
|
|
18
|
+
// slugs like `clear-the-deck` don't resolve when plans live under
|
|
19
|
+
// `<docsRoot>/plans/`. The other commands (`dotmd set <slug>`, `dotmd plans`)
|
|
20
|
+
// take slugs — runlist should too. Try the direct resolve first, then
|
|
21
|
+
// fall back to `<root>/plans/<slug>.md` under each configured doc root.
|
|
22
|
+
function resolveHubInput(input, config) {
|
|
23
|
+
const direct = resolveDocPath(input, config);
|
|
24
|
+
if (direct) return direct;
|
|
25
|
+
|
|
26
|
+
if (!input.endsWith('.md')) {
|
|
27
|
+
const withExt = resolveDocPath(input + '.md', config);
|
|
28
|
+
if (withExt) return withExt;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const slugFile = input.endsWith('.md') ? input : `${input}.md`;
|
|
32
|
+
const roots = config.docsRoots || (config.docsRoot ? [config.docsRoot] : []);
|
|
33
|
+
for (const root of roots) {
|
|
34
|
+
const candidate = path.join(root, 'plans', slugFile);
|
|
35
|
+
if (existsSync(candidate)) return candidate;
|
|
36
|
+
// Multi-root layouts may already have a `plans` root, so also try the
|
|
37
|
+
// root itself.
|
|
38
|
+
const rootCandidate = path.join(root, slugFile);
|
|
39
|
+
if (existsSync(rootCandidate)) return rootCandidate;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
17
45
|
// Read a hub plan's `runlist:` and resolve each entry to a repo-relative path
|
|
18
46
|
// plus its current status. Missing files are reported with `missing: true`;
|
|
19
47
|
// callers decide how to render them. Pure: no IO beyond file reads.
|
|
@@ -112,7 +140,7 @@ export async function runRunlist(argv, config, opts = {}) {
|
|
|
112
140
|
: 'Usage: dotmd runlist <hub-plan>');
|
|
113
141
|
}
|
|
114
142
|
|
|
115
|
-
const hubAbs =
|
|
143
|
+
const hubAbs = resolveHubInput(hubInput, config);
|
|
116
144
|
if (!hubAbs) die(`Hub plan not found: ${hubInput}`);
|
|
117
145
|
const hubRepoPath = toRepoPath(hubAbs, config.repoRoot);
|
|
118
146
|
|