dotmd-cli 0.48.0 → 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/config.mjs +9 -0
- package/src/new.mjs +21 -7
- package/src/runlist.mjs +30 -2
- package/src/validate.mjs +7 -2
package/package.json
CHANGED
package/src/config.mjs
CHANGED
|
@@ -66,6 +66,11 @@ const DEFAULTS = {
|
|
|
66
66
|
|
|
67
67
|
taxonomy: {
|
|
68
68
|
surfaces: null,
|
|
69
|
+
// modules: when null (default), the project doesn't enumerate product
|
|
70
|
+
// modules — the modules-required validator silently skips. When set to
|
|
71
|
+
// an array, modules are taxonomy-enforced AND moduleRequiredFor activates.
|
|
72
|
+
// Mirrors the long-standing semantics of `taxonomy.surfaces`.
|
|
73
|
+
modules: null,
|
|
69
74
|
moduleRequiredFor: ['partial', 'paused', 'awaiting', 'queued-after'],
|
|
70
75
|
},
|
|
71
76
|
|
|
@@ -444,6 +449,9 @@ export async function resolveConfig(cwd, explicitConfigPath) {
|
|
|
444
449
|
const validSurfaces = config.taxonomy.surfaces
|
|
445
450
|
? new Set(config.taxonomy.surfaces)
|
|
446
451
|
: null;
|
|
452
|
+
const validModules = config.taxonomy.modules
|
|
453
|
+
? new Set(config.taxonomy.modules)
|
|
454
|
+
: null;
|
|
447
455
|
const moduleRequiredStatuses = new Set(config.taxonomy.moduleRequiredFor);
|
|
448
456
|
|
|
449
457
|
const indexPath = config.index?.path
|
|
@@ -497,6 +505,7 @@ export async function resolveConfig(cwd, explicitConfigPath) {
|
|
|
497
505
|
lifecycle: { archiveStatuses, skipStaleFor, skipWarningsFor, terminalStatuses, filedStatuses },
|
|
498
506
|
|
|
499
507
|
validSurfaces,
|
|
508
|
+
validModules,
|
|
500
509
|
moduleRequiredStatuses,
|
|
501
510
|
|
|
502
511
|
indexPath,
|
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
|
|
package/src/validate.mjs
CHANGED
|
@@ -117,8 +117,13 @@ export function validateDoc(doc, frontmatter, headingTitle, config) {
|
|
|
117
117
|
doc.errors.push({ path: doc.path, level: 'error', message: '`modules` must be a YAML list when present.' });
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
// modules-required gate: only fires when the project has actively declared
|
|
121
|
+
// a module taxonomy (`taxonomy.modules` is an array). Repos with no product
|
|
122
|
+
// modules (CLIs, dev tooling, single-domain apps) shouldn't be forced to
|
|
123
|
+
// sprinkle `modules: [none]` on every plan as a sentinel. Mirrors the
|
|
124
|
+
// long-standing `taxonomy.surfaces` opt-in semantics.
|
|
125
|
+
if (config.validModules && config.moduleRequiredStatuses.has(doc.status) && !doc.modules?.length) {
|
|
126
|
+
doc.errors.push({ path: doc.path, level: 'error', message: '`modules` is required for this status; declare a real module from `taxonomy.modules`, or `none` as the explicit no-module sentinel.' });
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
if (config.validSurfaces && !config.lifecycle.skipWarningsFor.has(doc.status)) {
|