nubos-pilot 0.1.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/agents/np-ai-researcher.md +140 -0
- package/agents/np-code-fixer.md +363 -0
- package/agents/np-code-reviewer.md +351 -0
- package/agents/np-domain-researcher.md +136 -0
- package/agents/np-eval-auditor.md +167 -0
- package/agents/np-eval-planner.md +153 -0
- package/agents/np-executor.md +72 -0
- package/agents/np-framework-selector.md +171 -0
- package/agents/np-nyquist-auditor.md +185 -0
- package/agents/np-plan-checker.md +165 -0
- package/agents/np-planner.md +199 -0
- package/agents/np-researcher.md +150 -0
- package/agents/np-security-auditor.md +206 -0
- package/agents/np-ui-auditor.md +369 -0
- package/agents/np-ui-checker.md +192 -0
- package/agents/np-ui-researcher.md +324 -0
- package/agents/np-verifier.md +79 -0
- package/bin/check-coverage.cjs +40 -0
- package/bin/check-workflows.cjs +171 -0
- package/bin/check-workflows.test.cjs +208 -0
- package/bin/install.js +500 -0
- package/bin/np-tools/_commands.cjs +70 -0
- package/bin/np-tools/add-tests.cjs +171 -0
- package/bin/np-tools/add-tests.test.cjs +122 -0
- package/bin/np-tools/add-todo.cjs +108 -0
- package/bin/np-tools/add-todo.test.cjs +112 -0
- package/bin/np-tools/agent-skills.cjs +14 -0
- package/bin/np-tools/agent-skills.test.cjs +42 -0
- package/bin/np-tools/ai-integration-phase.cjs +109 -0
- package/bin/np-tools/ai-integration-phase.test.cjs +123 -0
- package/bin/np-tools/askuser.cjs +53 -0
- package/bin/np-tools/askuser.test.cjs +49 -0
- package/bin/np-tools/autonomous.cjs +69 -0
- package/bin/np-tools/autonomous.test.cjs +74 -0
- package/bin/np-tools/checkpoint.cjs +101 -0
- package/bin/np-tools/checkpoint.test.cjs +119 -0
- package/bin/np-tools/code-review.cjs +133 -0
- package/bin/np-tools/code-review.test.cjs +96 -0
- package/bin/np-tools/commit-task.cjs +120 -0
- package/bin/np-tools/commit-task.test.cjs +160 -0
- package/bin/np-tools/commit.cjs +103 -0
- package/bin/np-tools/commit.test.cjs +93 -0
- package/bin/np-tools/config.cjs +101 -0
- package/bin/np-tools/config.test.cjs +71 -0
- package/bin/np-tools/discuss-phase-power.cjs +265 -0
- package/bin/np-tools/discuss-phase-power.test.cjs +242 -0
- package/bin/np-tools/discuss-phase.cjs +132 -0
- package/bin/np-tools/discuss-phase.test.cjs +148 -0
- package/bin/np-tools/dispatch.cjs +116 -0
- package/bin/np-tools/doctor.cjs +242 -0
- package/bin/np-tools/eval-review.cjs +116 -0
- package/bin/np-tools/eval-review.test.cjs +123 -0
- package/bin/np-tools/execute-phase.cjs +182 -0
- package/bin/np-tools/execute-phase.test.cjs +116 -0
- package/bin/np-tools/execute-plan.cjs +124 -0
- package/bin/np-tools/execute-plan.test.cjs +82 -0
- package/bin/np-tools/help.cjs +28 -0
- package/bin/np-tools/help.test.cjs +29 -0
- package/bin/np-tools/init-dispatch.test.cjs +91 -0
- package/bin/np-tools/metrics.cjs +97 -0
- package/bin/np-tools/metrics.test.cjs +188 -0
- package/bin/np-tools/new-milestone.cjs +288 -0
- package/bin/np-tools/new-milestone.test.cjs +166 -0
- package/bin/np-tools/new-project.cjs +284 -0
- package/bin/np-tools/new-project.test.cjs +165 -0
- package/bin/np-tools/next.cjs +7 -0
- package/bin/np-tools/next.test.cjs +30 -0
- package/bin/np-tools/park.cjs +48 -0
- package/bin/np-tools/park.test.cjs +50 -0
- package/bin/np-tools/pause-work.cjs +24 -0
- package/bin/np-tools/pause-work.test.cjs +74 -0
- package/bin/np-tools/phase.cjs +71 -0
- package/bin/np-tools/phase.test.cjs +81 -0
- package/bin/np-tools/plan-diff.cjs +57 -0
- package/bin/np-tools/plan-diff.test.cjs +134 -0
- package/bin/np-tools/plan-milestone-gaps.cjs +115 -0
- package/bin/np-tools/plan-milestone-gaps.test.cjs +122 -0
- package/bin/np-tools/plan-phase.cjs +350 -0
- package/bin/np-tools/plan-phase.test.cjs +263 -0
- package/bin/np-tools/progress.cjs +7 -0
- package/bin/np-tools/progress.test.cjs +44 -0
- package/bin/np-tools/queue.cjs +213 -0
- package/bin/np-tools/research-phase.cjs +144 -0
- package/bin/np-tools/research-phase.test.cjs +154 -0
- package/bin/np-tools/reset-slice.cjs +17 -0
- package/bin/np-tools/reset-slice.test.cjs +96 -0
- package/bin/np-tools/resolve-model.cjs +110 -0
- package/bin/np-tools/resolve-model.test.cjs +200 -0
- package/bin/np-tools/resume-work.cjs +76 -0
- package/bin/np-tools/resume-work.test.cjs +91 -0
- package/bin/np-tools/skip.cjs +48 -0
- package/bin/np-tools/skip.test.cjs +66 -0
- package/bin/np-tools/slug.cjs +34 -0
- package/bin/np-tools/slug.test.cjs +46 -0
- package/bin/np-tools/state.cjs +16 -0
- package/bin/np-tools/state.test.cjs +40 -0
- package/bin/np-tools/stats.cjs +151 -0
- package/bin/np-tools/stats.test.cjs +118 -0
- package/bin/np-tools/triage.cjs +128 -0
- package/bin/np-tools/ui-phase.cjs +108 -0
- package/bin/np-tools/ui-phase.test.cjs +121 -0
- package/bin/np-tools/ui-review.cjs +108 -0
- package/bin/np-tools/ui-review.test.cjs +120 -0
- package/bin/np-tools/undo-task.cjs +31 -0
- package/bin/np-tools/undo-task.test.cjs +117 -0
- package/bin/np-tools/undo.cjs +43 -0
- package/bin/np-tools/undo.test.cjs +120 -0
- package/bin/np-tools/unpark.cjs +48 -0
- package/bin/np-tools/unpark.test.cjs +50 -0
- package/bin/np-tools/verify-work.cjs +186 -0
- package/bin/np-tools/verify-work.test.cjs +97 -0
- package/docs/adr/0001-no-daemon-invariant.md +82 -0
- package/docs/adr/0002-zero-runtime-dependencies.md +90 -0
- package/docs/adr/0003-max-six-unit-types.md +85 -0
- package/docs/adr/0004-atomic-commit-per-unit.md +102 -0
- package/docs/adr/0005-three-orthogonal-file-trees.md +98 -0
- package/docs/adr/0006-yaml-dependency-amendment.md +60 -0
- package/docs/adr/README.md +27 -0
- package/docs/agent-frontmatter-schema.md +84 -0
- package/docs/phase-artifact-schemas.md +292 -0
- package/docs/phase-directory-layout.md +82 -0
- package/lib/__tests__/README.md +1 -0
- package/lib/agents.cjs +98 -0
- package/lib/agents.test.cjs +286 -0
- package/lib/askuser.cjs +36 -0
- package/lib/askuser.test.cjs +310 -0
- package/lib/checkpoint.cjs +135 -0
- package/lib/checkpoint.test.cjs +184 -0
- package/lib/core.cjs +165 -0
- package/lib/core.test.cjs +405 -0
- package/lib/fixtures/README.md +1 -0
- package/lib/fixtures/phase-tree/README.md +1 -0
- package/lib/fixtures/plans/cycle/PLAN.md +16 -0
- package/lib/fixtures/plans/cycle/tasks/T-01.md +20 -0
- package/lib/fixtures/plans/cycle/tasks/T-02.md +20 -0
- package/lib/fixtures/plans/cycle/tasks/T-03.md +20 -0
- package/lib/fixtures/plans/linear/PLAN.md +16 -0
- package/lib/fixtures/plans/linear/tasks/T-01.md +20 -0
- package/lib/fixtures/plans/linear/tasks/T-02.md +20 -0
- package/lib/fixtures/plans/linear/tasks/T-03.md +20 -0
- package/lib/fixtures/plans/parallel/PLAN.md +16 -0
- package/lib/fixtures/plans/parallel/tasks/T-01.md +20 -0
- package/lib/fixtures/plans/parallel/tasks/T-02.md +20 -0
- package/lib/fixtures/plans/parallel/tasks/T-03.md +20 -0
- package/lib/fixtures/plans/wave-conflict/PLAN.md +16 -0
- package/lib/fixtures/plans/wave-conflict/tasks/T-01.md +20 -0
- package/lib/fixtures/plans/wave-conflict/tasks/T-02.md +20 -0
- package/lib/fixtures/roadmap/ROADMAP-malformed.md +3 -0
- package/lib/fixtures/roadmap/ROADMAP-minimal.md +51 -0
- package/lib/fixtures/roadmap/roadmap-malformed.yaml +7 -0
- package/lib/fixtures/roadmap/roadmap-minimal.yaml +40 -0
- package/lib/fixtures/roadmap/roadmap-ten-phases.yaml +101 -0
- package/lib/fixtures/templates/phase-context.md +6 -0
- package/lib/fixtures/templates/plan-skeleton.md +6 -0
- package/lib/frontmatter.cjs +251 -0
- package/lib/frontmatter.test.cjs +177 -0
- package/lib/gaps.cjs +197 -0
- package/lib/gaps.test.cjs +200 -0
- package/lib/git.cjs +207 -0
- package/lib/git.test.cjs +305 -0
- package/lib/install/agents-md.cjs +77 -0
- package/lib/install/backup.cjs +70 -0
- package/lib/install/codex-toml.cjs +440 -0
- package/lib/install/managed-block.cjs +30 -0
- package/lib/install/manifest.cjs +148 -0
- package/lib/install/mcp-writer.cjs +127 -0
- package/lib/install/runtime-detect.cjs +44 -0
- package/lib/install/staging.cjs +149 -0
- package/lib/metrics-aggregate.cjs +229 -0
- package/lib/metrics-aggregate.test.cjs +192 -0
- package/lib/metrics.cjs +120 -0
- package/lib/metrics.test.cjs +182 -0
- package/lib/model-aliases.regression.test.cjs +16 -0
- package/lib/model-profiles.cjs +42 -0
- package/lib/model-profiles.test.cjs +61 -0
- package/lib/next.cjs +236 -0
- package/lib/next.test.cjs +194 -0
- package/lib/phase.cjs +95 -0
- package/lib/phase.test.cjs +189 -0
- package/lib/plan-checker-contract.test.cjs +72 -0
- package/lib/plan-diff.cjs +173 -0
- package/lib/plan-diff.test.cjs +217 -0
- package/lib/plan.cjs +85 -0
- package/lib/plan.test.cjs +263 -0
- package/lib/progress.cjs +95 -0
- package/lib/progress.test.cjs +116 -0
- package/lib/researcher-contract.test.cjs +61 -0
- package/lib/roadmap-render.cjs +206 -0
- package/lib/roadmap-render.test.cjs +121 -0
- package/lib/roadmap.cjs +416 -0
- package/lib/roadmap.test.cjs +371 -0
- package/lib/runtime/_contract.test.cjs +61 -0
- package/lib/runtime/_readline.cjs +119 -0
- package/lib/runtime/_readline.test.cjs +126 -0
- package/lib/runtime/claude.cjs +48 -0
- package/lib/runtime/claude.test.cjs +101 -0
- package/lib/runtime/codex.cjs +35 -0
- package/lib/runtime/codex.test.cjs +114 -0
- package/lib/runtime/gemini.cjs +35 -0
- package/lib/runtime/gemini.test.cjs +109 -0
- package/lib/runtime/index.cjs +49 -0
- package/lib/runtime/index.test.cjs +181 -0
- package/lib/runtime/opencode.cjs +35 -0
- package/lib/runtime/opencode.test.cjs +124 -0
- package/lib/state.cjs +205 -0
- package/lib/state.test.cjs +264 -0
- package/lib/surface-audit.test.cjs +46 -0
- package/lib/tasks.cjs +327 -0
- package/lib/tasks.test.cjs +389 -0
- package/lib/template.cjs +66 -0
- package/lib/template.test.cjs +159 -0
- package/lib/undo.cjs +179 -0
- package/lib/undo.test.cjs +261 -0
- package/lib/verify.cjs +116 -0
- package/lib/verify.test.cjs +187 -0
- package/np-tools.cjs +303 -0
- package/package.json +39 -0
- package/templates/AI-SPEC.md +90 -0
- package/templates/CONTEXT.md +32 -0
- package/templates/PLAN.md +69 -0
- package/templates/PROJECT.md +60 -0
- package/templates/REQUIREMENTS.md +38 -0
- package/templates/SECURITY.md +61 -0
- package/templates/UI-SPEC.md +64 -0
- package/templates/VALIDATION.md +76 -0
- package/templates/claude/payload/README.md +11 -0
- package/templates/opencode/opencode.json +6 -0
- package/templates/opencode/payload/AGENTS.md +9 -0
- package/workflows/add-backlog.md +212 -0
- package/workflows/add-tests.md +69 -0
- package/workflows/add-todo.md +222 -0
- package/workflows/ai-integration-phase.md +230 -0
- package/workflows/autonomous.md +94 -0
- package/workflows/cleanup.md +325 -0
- package/workflows/code-review-fix.md +435 -0
- package/workflows/code-review.md +447 -0
- package/workflows/discuss-phase-assumptions.md +269 -0
- package/workflows/discuss-phase-power.md +139 -0
- package/workflows/discuss-phase.md +386 -0
- package/workflows/dispatch.md +9 -0
- package/workflows/doctor.md +10 -0
- package/workflows/eval-review.md +243 -0
- package/workflows/execute-phase.md +142 -0
- package/workflows/execute-plan.md +82 -0
- package/workflows/help.md +8 -0
- package/workflows/new-milestone.md +166 -0
- package/workflows/new-project.md +213 -0
- package/workflows/next.md +8 -0
- package/workflows/note.md +244 -0
- package/workflows/park.md +29 -0
- package/workflows/pause-work.md +34 -0
- package/workflows/plan-milestone-gaps.md +233 -0
- package/workflows/plan-phase.md +351 -0
- package/workflows/progress.md +8 -0
- package/workflows/queue.md +9 -0
- package/workflows/research-phase.md +327 -0
- package/workflows/reset-slice.md +39 -0
- package/workflows/resume-work.md +79 -0
- package/workflows/review.md +489 -0
- package/workflows/secure-phase.md +209 -0
- package/workflows/session-report.md +243 -0
- package/workflows/skip.md +29 -0
- package/workflows/state.md +7 -0
- package/workflows/stats.md +170 -0
- package/workflows/thread.md +214 -0
- package/workflows/triage.md +9 -0
- package/workflows/ui-phase.md +246 -0
- package/workflows/ui-review.md +222 -0
- package/workflows/undo-task.md +42 -0
- package/workflows/undo.md +55 -0
- package/workflows/unpark.md +29 -0
- package/workflows/validate-phase.md +231 -0
- package/workflows/verify-work.md +83 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
const fs = require('node:fs');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const YAML = require('yaml');
|
|
4
|
+
const {
|
|
5
|
+
withFileLock,
|
|
6
|
+
atomicWriteFileSync,
|
|
7
|
+
projectStateDir,
|
|
8
|
+
NubosPilotError,
|
|
9
|
+
} = require('./core.cjs');
|
|
10
|
+
|
|
11
|
+
const GENERATED_HEADER = '<!-- Generated from roadmap.yaml — do not edit by hand -->';
|
|
12
|
+
|
|
13
|
+
function _yamlPath(cwd) {
|
|
14
|
+
try {
|
|
15
|
+
return path.join(projectStateDir(cwd), 'roadmap.yaml');
|
|
16
|
+
} catch (err) {
|
|
17
|
+
if (!err || err.code !== 'not-in-project') throw err;
|
|
18
|
+
return path.join(path.resolve(cwd), '.planning', 'roadmap.yaml');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function _mdPath(cwd) {
|
|
23
|
+
try {
|
|
24
|
+
return path.join(projectStateDir(cwd), 'ROADMAP.md');
|
|
25
|
+
} catch (err) {
|
|
26
|
+
if (!err || err.code !== 'not-in-project') throw err;
|
|
27
|
+
return path.join(path.resolve(cwd), '.planning', 'ROADMAP.md');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function _readYaml(p) {
|
|
32
|
+
let raw;
|
|
33
|
+
try {
|
|
34
|
+
raw = fs.readFileSync(p, 'utf-8');
|
|
35
|
+
} catch (err) {
|
|
36
|
+
throw new NubosPilotError(
|
|
37
|
+
'roadmap-render-read-error',
|
|
38
|
+
'roadmap.yaml not readable',
|
|
39
|
+
{ path: p, cause: err && err.code },
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
return YAML.parse(raw);
|
|
44
|
+
} catch (err) {
|
|
45
|
+
throw new NubosPilotError(
|
|
46
|
+
'roadmap-render-read-error',
|
|
47
|
+
'roadmap.yaml invalid YAML',
|
|
48
|
+
{ path: p, cause: err && err.message },
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function _statusLabel(status) {
|
|
54
|
+
switch (status) {
|
|
55
|
+
case 'done':
|
|
56
|
+
case 'complete':
|
|
57
|
+
return 'Complete';
|
|
58
|
+
case 'in-progress':
|
|
59
|
+
return 'In Progress';
|
|
60
|
+
case 'pending':
|
|
61
|
+
return 'Not started';
|
|
62
|
+
default:
|
|
63
|
+
return status ? String(status) : 'Not started';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function _plansComplete(plans) {
|
|
68
|
+
if (!Array.isArray(plans) || plans.length === 0) return '0/0';
|
|
69
|
+
const total = plans.length;
|
|
70
|
+
const done = plans.filter((p) => p && p.complete === true).length;
|
|
71
|
+
return `${done}/${total}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function _dependsOnStr(v) {
|
|
75
|
+
if (v == null) return '-';
|
|
76
|
+
if (Array.isArray(v)) return v.length ? v.map(String).join(', ') : '-';
|
|
77
|
+
return String(v);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function _renderPhaseDetail(lines, ph) {
|
|
81
|
+
lines.push(`### Phase ${ph.number}: ${ph.name || ''}`);
|
|
82
|
+
lines.push(`**Goal**: ${ph.goal || ''}`);
|
|
83
|
+
lines.push(`**Depends on**: ${_dependsOnStr(ph.depends_on)}`);
|
|
84
|
+
const reqs = Array.isArray(ph.requirements) ? ph.requirements : [];
|
|
85
|
+
lines.push(`**Requirements**: ${reqs.length ? reqs.join(', ') : '-'}`);
|
|
86
|
+
const sc = Array.isArray(ph.success_criteria) ? ph.success_criteria : [];
|
|
87
|
+
if (sc.length) {
|
|
88
|
+
lines.push('**Success Criteria**:');
|
|
89
|
+
for (let i = 0; i < sc.length; i++) {
|
|
90
|
+
lines.push(` ${i + 1}. ${sc[i]}`);
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
lines.push('**Success Criteria**: -');
|
|
94
|
+
}
|
|
95
|
+
const plans = Array.isArray(ph.plans) ? ph.plans : [];
|
|
96
|
+
if (plans.length) {
|
|
97
|
+
lines.push('**Plans**:');
|
|
98
|
+
for (const pl of plans) {
|
|
99
|
+
const box = pl && pl.complete ? 'x' : ' ';
|
|
100
|
+
const id = pl && pl.id ? pl.id : '';
|
|
101
|
+
const title = pl && pl.title ? pl.title : '';
|
|
102
|
+
lines.push(` - [${box}] ${id}${title ? ' — ' + title : ''}`);
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
lines.push('**Plans**: -');
|
|
106
|
+
}
|
|
107
|
+
lines.push('');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function _renderBacklogSection(lines, milestone) {
|
|
111
|
+
lines.push('## Backlog');
|
|
112
|
+
lines.push('');
|
|
113
|
+
const phases = Array.isArray(milestone.phases) ? milestone.phases : [];
|
|
114
|
+
if (phases.length === 0) {
|
|
115
|
+
lines.push('*No backlog items.*');
|
|
116
|
+
lines.push('');
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
for (const ph of phases) {
|
|
120
|
+
if (!ph || ph.number == null) continue;
|
|
121
|
+
lines.push(`- [ ] Phase ${ph.number}: ${ph.name || ''}`);
|
|
122
|
+
}
|
|
123
|
+
lines.push('');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function renderMarkdown(data) {
|
|
127
|
+
const lines = [];
|
|
128
|
+
lines.push(GENERATED_HEADER);
|
|
129
|
+
lines.push('');
|
|
130
|
+
lines.push('# Roadmap');
|
|
131
|
+
lines.push('');
|
|
132
|
+
lines.push('## Overview');
|
|
133
|
+
lines.push('');
|
|
134
|
+
|
|
135
|
+
if (!data || !Array.isArray(data.milestones)) {
|
|
136
|
+
lines.push('*No milestones defined.*');
|
|
137
|
+
lines.push('');
|
|
138
|
+
return lines.join('\n') + '\n';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const tablePhases = [];
|
|
142
|
+
for (const ms of data.milestones) {
|
|
143
|
+
if (!ms || !Array.isArray(ms.phases)) continue;
|
|
144
|
+
if (ms.id === 'backlog') continue;
|
|
145
|
+
for (const ph of ms.phases) {
|
|
146
|
+
if (!ph || ph.number == null) continue;
|
|
147
|
+
tablePhases.push(ph);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const regularMilestones = data.milestones.filter((m) => m && m.id !== 'backlog');
|
|
152
|
+
lines.push(`Milestones: ${regularMilestones.length}. Phases: ${tablePhases.length}.`);
|
|
153
|
+
lines.push('');
|
|
154
|
+
|
|
155
|
+
lines.push('## Progress');
|
|
156
|
+
lines.push('');
|
|
157
|
+
lines.push('| Phase | Plans Complete | Status |');
|
|
158
|
+
lines.push('|-------|----------------|--------|');
|
|
159
|
+
for (const ph of tablePhases) {
|
|
160
|
+
const num = String(ph.number);
|
|
161
|
+
const name = ph.name || '';
|
|
162
|
+
const pc = _plansComplete(ph.plans);
|
|
163
|
+
const st = _statusLabel(ph.status);
|
|
164
|
+
lines.push(`| ${num}. ${name} | ${pc} | ${st} |`);
|
|
165
|
+
}
|
|
166
|
+
lines.push('');
|
|
167
|
+
|
|
168
|
+
lines.push('## Phase Details');
|
|
169
|
+
lines.push('');
|
|
170
|
+
for (const ms of data.milestones) {
|
|
171
|
+
if (!ms || !Array.isArray(ms.phases)) continue;
|
|
172
|
+
if (ms.id === 'backlog') continue;
|
|
173
|
+
const phases = ms.phases.filter((ph) => ph && ph.number != null);
|
|
174
|
+
if (phases.length === 0) continue;
|
|
175
|
+
if (ms.collapsed === true) {
|
|
176
|
+
const at = ms.collapsed_at || '';
|
|
177
|
+
const summary = `${ms.id}${at ? ' — completed on ' + at : ''}`;
|
|
178
|
+
lines.push(`<details><summary>${summary}</summary>`);
|
|
179
|
+
lines.push('');
|
|
180
|
+
for (const ph of phases) _renderPhaseDetail(lines, ph);
|
|
181
|
+
lines.push('</details>');
|
|
182
|
+
lines.push('');
|
|
183
|
+
} else {
|
|
184
|
+
for (const ph of phases) _renderPhaseDetail(lines, ph);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const backlog = data.milestones.find((m) => m && m.id === 'backlog');
|
|
189
|
+
if (backlog) {
|
|
190
|
+
_renderBacklogSection(lines, backlog);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return lines.join('\n') + '\n';
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function renderRoadmap(cwd = process.cwd()) {
|
|
197
|
+
const ymlPath = _yamlPath(cwd);
|
|
198
|
+
const mdPath = _mdPath(cwd);
|
|
199
|
+
const data = _readYaml(ymlPath);
|
|
200
|
+
const content = renderMarkdown(data);
|
|
201
|
+
return withFileLock(mdPath, () => {
|
|
202
|
+
atomicWriteFileSync(mdPath, content);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
module.exports = { renderRoadmap, renderMarkdown, GENERATED_HEADER };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
const { test, afterEach } = require('node:test');
|
|
2
|
+
const assert = require('node:assert/strict');
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const os = require('node:os');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
|
|
7
|
+
const render = require('./roadmap-render.cjs');
|
|
8
|
+
|
|
9
|
+
const FIXTURES = path.join(__dirname, 'fixtures', 'roadmap');
|
|
10
|
+
const MINIMAL = fs.readFileSync(path.join(FIXTURES, 'roadmap-minimal.yaml'), 'utf-8');
|
|
11
|
+
|
|
12
|
+
const sandboxes = [];
|
|
13
|
+
|
|
14
|
+
function makeSandbox(yamlContent) {
|
|
15
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-rr-'));
|
|
16
|
+
fs.mkdirSync(path.join(dir, '.nubos-pilot'));
|
|
17
|
+
if (yamlContent != null) {
|
|
18
|
+
fs.writeFileSync(path.join(dir, '.nubos-pilot', 'roadmap.yaml'), yamlContent);
|
|
19
|
+
}
|
|
20
|
+
sandboxes.push(dir);
|
|
21
|
+
return dir;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
while (sandboxes.length) {
|
|
26
|
+
const d = sandboxes.pop();
|
|
27
|
+
try { fs.rmSync(d, { recursive: true, force: true }); } catch {}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('RR-1: renderRoadmap writes ROADMAP.md containing generated-header marker', () => {
|
|
32
|
+
const root = makeSandbox(MINIMAL);
|
|
33
|
+
render.renderRoadmap(root);
|
|
34
|
+
const out = fs.readFileSync(path.join(root, '.nubos-pilot', 'ROADMAP.md'), 'utf-8');
|
|
35
|
+
assert.ok(out.startsWith(render.GENERATED_HEADER), 'output starts with generated-header marker');
|
|
36
|
+
assert.match(out, /# Roadmap/);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('RR-2: renderRoadmap is byte-idempotent across two consecutive calls', () => {
|
|
40
|
+
const root = makeSandbox(MINIMAL);
|
|
41
|
+
render.renderRoadmap(root);
|
|
42
|
+
const first = fs.readFileSync(path.join(root, '.nubos-pilot', 'ROADMAP.md'));
|
|
43
|
+
render.renderRoadmap(root);
|
|
44
|
+
const second = fs.readFileSync(path.join(root, '.nubos-pilot', 'ROADMAP.md'));
|
|
45
|
+
assert.ok(Buffer.compare(first, second) === 0, 'byte-identical output');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('RR-3: renderRoadmap on missing roadmap.yaml throws roadmap-render-read-error', () => {
|
|
49
|
+
const root = makeSandbox(null);
|
|
50
|
+
assert.throws(
|
|
51
|
+
() => render.renderRoadmap(root),
|
|
52
|
+
(err) => err && err.name === 'NubosPilotError' && err.code === 'roadmap-render-read-error',
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('RR-4: rendered MD contains all three phase names from minimal fixture', () => {
|
|
57
|
+
const root = makeSandbox(MINIMAL);
|
|
58
|
+
render.renderRoadmap(root);
|
|
59
|
+
const out = fs.readFileSync(path.join(root, '.nubos-pilot', 'ROADMAP.md'), 'utf-8');
|
|
60
|
+
assert.match(out, /Foundation/);
|
|
61
|
+
assert.match(out, /Hotfix/);
|
|
62
|
+
assert.match(out, /Core/);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('RR-5: rendered MD progress table marks Phase 1 Complete', () => {
|
|
66
|
+
const root = makeSandbox(MINIMAL);
|
|
67
|
+
render.renderRoadmap(root);
|
|
68
|
+
const out = fs.readFileSync(path.join(root, '.nubos-pilot', 'ROADMAP.md'), 'utf-8');
|
|
69
|
+
|
|
70
|
+
assert.match(out, /\|\s*1\.\s*Foundation\s*\|[^|]*\|\s*Complete\s*\|/);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('ROAD-RENDER-BACKLOG: synthetic id:backlog renders as ## Backlog, excluded from progress table', () => {
|
|
74
|
+
const doc = {
|
|
75
|
+
milestones: [
|
|
76
|
+
{
|
|
77
|
+
id: 'v1.0',
|
|
78
|
+
name: 'v1',
|
|
79
|
+
phases: [
|
|
80
|
+
{ number: 1, name: 'First', slug: 'first', goal: 'g', status: 'done', plans: [] },
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 'backlog',
|
|
85
|
+
name: 'Backlog',
|
|
86
|
+
phases: [
|
|
87
|
+
{ number: '999.1', name: 'Fix deploy key auth', slug: 'fix-deploy-key-auth', status: 'backlog', plans: [] },
|
|
88
|
+
{ number: '999.2', name: 'Add feature X', slug: 'add-feature-x', status: 'backlog', plans: [] },
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
const md = render.renderMarkdown(doc);
|
|
94
|
+
assert.match(md, /## Backlog/);
|
|
95
|
+
assert.match(md, /Phase 999\.1: Fix deploy key auth/);
|
|
96
|
+
assert.match(md, /Phase 999\.2: Add feature X/);
|
|
97
|
+
const progressLines = md.split('\n').filter((l) => l.startsWith('|') && !l.startsWith('|-------'));
|
|
98
|
+
const progressText = progressLines.join('\n');
|
|
99
|
+
assert.doesNotMatch(progressText, /999\.1/);
|
|
100
|
+
assert.match(md, /Milestones:\s*1\./);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('ROAD-RENDER-COLLAPSED: collapsed:true wraps phase-details block in <details>', () => {
|
|
104
|
+
const doc = {
|
|
105
|
+
milestones: [
|
|
106
|
+
{
|
|
107
|
+
id: 'v1.0',
|
|
108
|
+
name: 'v1',
|
|
109
|
+
collapsed: true,
|
|
110
|
+
collapsed_at: '2026-04-17',
|
|
111
|
+
phases: [
|
|
112
|
+
{ number: 1, name: 'First', slug: 'first', goal: 'g', status: 'done', plans: [] },
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
const md = render.renderMarkdown(doc);
|
|
118
|
+
assert.match(md, /<details><summary>v1\.0 — completed on 2026-04-17<\/summary>/);
|
|
119
|
+
assert.match(md, /<\/details>/);
|
|
120
|
+
assert.match(md, /### Phase 1:/);
|
|
121
|
+
});
|