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
package/lib/verify.cjs
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
const fs = require('node:fs');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const { withFileLock, atomicWriteFileSync, NubosPilotError } = require('./core.cjs');
|
|
4
|
+
const { getPhase } = require('./roadmap.cjs');
|
|
5
|
+
const { paddedPhase, findPhaseDir } = require('./phase.cjs');
|
|
6
|
+
|
|
7
|
+
const _SUBJECTIVE_RE = /\b(subjective|feels?|UX|usability|look|looks|aesthetic|intuitive)\b/i;
|
|
8
|
+
|
|
9
|
+
function verifyPhase(n, { cwd = process.cwd() } = {}) {
|
|
10
|
+
const phase = getPhase(n, cwd);
|
|
11
|
+
const criteria = phase.success_criteria || [];
|
|
12
|
+
return criteria.map((sc, idx) => ({
|
|
13
|
+
id: 'SC-' + (idx + 1),
|
|
14
|
+
text: sc,
|
|
15
|
+
status: null,
|
|
16
|
+
classified_by: null,
|
|
17
|
+
evidence: [],
|
|
18
|
+
notes: '',
|
|
19
|
+
needs_user_confirm: _SUBJECTIVE_RE.test(sc),
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function _phaseStatusFromResults(results) {
|
|
24
|
+
|
|
25
|
+
if (results.some((r) => r.status === 'Fail')) return 'failed';
|
|
26
|
+
|
|
27
|
+
if (results.some((r) => r.status === 'Defer')) return 'deferred';
|
|
28
|
+
if (results.some((r) => r.needs_user_confirm && r.status == null)) return 'deferred';
|
|
29
|
+
|
|
30
|
+
if (results.every((r) => r.status === 'Pass')) return 'verified';
|
|
31
|
+
|
|
32
|
+
return 'deferred';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function renderVerificationMd(n, phaseName, results) {
|
|
36
|
+
const phaseStatus = _phaseStatusFromResults(results);
|
|
37
|
+
const ts = new Date().toISOString().slice(0, 10);
|
|
38
|
+
const lines = [];
|
|
39
|
+
lines.push('# Phase ' + n + ': ' + phaseName + ' - Verification');
|
|
40
|
+
lines.push('');
|
|
41
|
+
lines.push('**Verified:** ' + ts);
|
|
42
|
+
lines.push('**Phase Status:** ' + phaseStatus);
|
|
43
|
+
lines.push('');
|
|
44
|
+
lines.push('## Success Criteria');
|
|
45
|
+
lines.push('');
|
|
46
|
+
for (const r of results) {
|
|
47
|
+
lines.push('### ' + r.id + ': ' + r.text);
|
|
48
|
+
lines.push('- **Status:** ' + (r.status || 'Pending'));
|
|
49
|
+
lines.push('- **Classified by:** ' + (r.classified_by || 'n/a'));
|
|
50
|
+
const evidence = Array.isArray(r.evidence) && r.evidence.length > 0
|
|
51
|
+
? r.evidence.join(', ')
|
|
52
|
+
: '—';
|
|
53
|
+
lines.push('- **Evidence:** ' + evidence);
|
|
54
|
+
if (r.notes) {
|
|
55
|
+
lines.push('- **Notes:** ' + r.notes);
|
|
56
|
+
}
|
|
57
|
+
if (r.needs_user_confirm && r.status == null) {
|
|
58
|
+
lines.push('- **Needs user confirm:** true');
|
|
59
|
+
}
|
|
60
|
+
lines.push('');
|
|
61
|
+
}
|
|
62
|
+
return lines.join('\n');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const _SC_RE = /^### (SC-\d+): ([^\n]+)\n- \*\*Status:\*\* (\w+)/gm;
|
|
66
|
+
|
|
67
|
+
function parseVerificationMd(filePath) {
|
|
68
|
+
let raw;
|
|
69
|
+
try {
|
|
70
|
+
raw = fs.readFileSync(filePath, 'utf-8');
|
|
71
|
+
} catch (err) {
|
|
72
|
+
throw new NubosPilotError(
|
|
73
|
+
'verify-file-unreadable',
|
|
74
|
+
'VERIFICATION.md not readable at ' + filePath,
|
|
75
|
+
{ path: filePath, cause: err && err.code },
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
const out = [];
|
|
82
|
+
for (const m of raw.matchAll(_SC_RE)) {
|
|
83
|
+
out.push({
|
|
84
|
+
id: m[1],
|
|
85
|
+
text: m[2].trim(),
|
|
86
|
+
status: m[3],
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function writeVerificationMd(n, cwd = process.cwd()) {
|
|
93
|
+
const phase = getPhase(n, cwd);
|
|
94
|
+
const phaseDir = findPhaseDir(n, cwd);
|
|
95
|
+
if (!phaseDir) {
|
|
96
|
+
throw new NubosPilotError(
|
|
97
|
+
'verify-phase-dir-missing',
|
|
98
|
+
'Phase directory not found for phase ' + n,
|
|
99
|
+
{ phase: n },
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
const padded = paddedPhase(n);
|
|
103
|
+
const target = path.join(phaseDir, padded + '-VERIFICATION.md');
|
|
104
|
+
const results = verifyPhase(n, { cwd });
|
|
105
|
+
const md = renderVerificationMd(n, phase.name, results);
|
|
106
|
+
return withFileLock(target, () => atomicWriteFileSync(target, md));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
module.exports = {
|
|
110
|
+
verifyPhase,
|
|
111
|
+
renderVerificationMd,
|
|
112
|
+
parseVerificationMd,
|
|
113
|
+
writeVerificationMd,
|
|
114
|
+
|
|
115
|
+
_phaseStatusFromResults,
|
|
116
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
const fs = require('node:fs');
|
|
2
|
+
const os = require('node:os');
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const { test } = require('node:test');
|
|
5
|
+
const assert = require('node:assert/strict');
|
|
6
|
+
|
|
7
|
+
const verify = require('./verify.cjs');
|
|
8
|
+
const {
|
|
9
|
+
verifyPhase,
|
|
10
|
+
renderVerificationMd,
|
|
11
|
+
parseVerificationMd,
|
|
12
|
+
writeVerificationMd,
|
|
13
|
+
} = verify;
|
|
14
|
+
|
|
15
|
+
const _sandboxes = [];
|
|
16
|
+
|
|
17
|
+
function makeRoadmapSandbox(phases) {
|
|
18
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'np-verify-'));
|
|
19
|
+
fs.mkdirSync(path.join(root, '.nubos-pilot'), { recursive: true });
|
|
20
|
+
fs.mkdirSync(path.join(root, '.nubos-pilot', 'phases'), { recursive: true });
|
|
21
|
+
const doc = {
|
|
22
|
+
milestones: [
|
|
23
|
+
{
|
|
24
|
+
id: 'v1.0',
|
|
25
|
+
name: 'verify-test-milestone',
|
|
26
|
+
phases: phases,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const YAML = require('yaml');
|
|
32
|
+
fs.writeFileSync(
|
|
33
|
+
path.join(root, '.nubos-pilot', 'roadmap.yaml'),
|
|
34
|
+
YAML.stringify(doc, { indent: 2 }),
|
|
35
|
+
'utf-8',
|
|
36
|
+
);
|
|
37
|
+
_sandboxes.push(root);
|
|
38
|
+
return root;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function cleanupAll() {
|
|
42
|
+
while (_sandboxes.length) {
|
|
43
|
+
const r = _sandboxes.pop();
|
|
44
|
+
try { fs.rmSync(r, { recursive: true, force: true }); } catch { }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
test.afterEach(() => cleanupAll());
|
|
49
|
+
|
|
50
|
+
test('VR-1: renderVerificationMd emits D-24-schema headers and per-SC blocks', () => {
|
|
51
|
+
const results = [
|
|
52
|
+
{
|
|
53
|
+
id: 'SC-1', text: 'first criterion', status: 'Pass',
|
|
54
|
+
classified_by: 'np-verifier', evidence: ['abc1234', 'lib/foo.cjs'],
|
|
55
|
+
notes: '', needs_user_confirm: false,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'SC-2', text: 'second criterion', status: 'Fail',
|
|
59
|
+
classified_by: 'np-verifier', evidence: [], notes: 'missing export',
|
|
60
|
+
needs_user_confirm: false,
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
const md = renderVerificationMd(6, 'test-phase', results);
|
|
64
|
+
|
|
65
|
+
assert.match(md, /^# Phase 6: test-phase - Verification$/m);
|
|
66
|
+
assert.match(md, /^\*\*Verified:\*\* \d{4}-\d{2}-\d{2}$/m);
|
|
67
|
+
assert.match(md, /^\*\*Phase Status:\*\* (verified|failed|deferred)$/m);
|
|
68
|
+
assert.match(md, /^## Success Criteria$/m);
|
|
69
|
+
|
|
70
|
+
assert.match(md, /^### SC-1: first criterion$/m);
|
|
71
|
+
assert.match(md, /^- \*\*Status:\*\* Pass$/m);
|
|
72
|
+
assert.match(md, /^- \*\*Classified by:\*\* np-verifier$/m);
|
|
73
|
+
assert.match(md, /^- \*\*Evidence:\*\* abc1234, lib\/foo\.cjs$/m);
|
|
74
|
+
assert.match(md, /^### SC-2: second criterion$/m);
|
|
75
|
+
assert.match(md, /^- \*\*Status:\*\* Fail$/m);
|
|
76
|
+
assert.match(md, /^- \*\*Notes:\*\* missing export$/m);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('VR-2: parseVerificationMd round-trip extracts id/text/status', () => {
|
|
80
|
+
const results = [
|
|
81
|
+
{ id: 'SC-1', text: 'alpha', status: 'Pass', classified_by: 'np-verifier', evidence: [], notes: '', needs_user_confirm: false },
|
|
82
|
+
{ id: 'SC-2', text: 'beta', status: 'Fail', classified_by: 'user', evidence: [], notes: '', needs_user_confirm: false },
|
|
83
|
+
{ id: 'SC-3', text: 'gamma', status: 'Defer', classified_by: 'user', evidence: [], notes: '', needs_user_confirm: false },
|
|
84
|
+
];
|
|
85
|
+
const md = renderVerificationMd(7, 'round-trip-phase', results);
|
|
86
|
+
|
|
87
|
+
const tmp = path.join(os.tmpdir(), 'np-verify-round-' + Date.now() + '.md');
|
|
88
|
+
fs.writeFileSync(tmp, md, 'utf-8');
|
|
89
|
+
try {
|
|
90
|
+
const parsed = parseVerificationMd(tmp);
|
|
91
|
+
assert.equal(parsed.length, 3);
|
|
92
|
+
assert.deepEqual(
|
|
93
|
+
parsed.map((r) => ({ id: r.id, text: r.text, status: r.status })),
|
|
94
|
+
[
|
|
95
|
+
{ id: 'SC-1', text: 'alpha', status: 'Pass' },
|
|
96
|
+
{ id: 'SC-2', text: 'beta', status: 'Fail' },
|
|
97
|
+
{ id: 'SC-3', text: 'gamma', status: 'Defer' },
|
|
98
|
+
],
|
|
99
|
+
);
|
|
100
|
+
} finally {
|
|
101
|
+
try { fs.unlinkSync(tmp); } catch {}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('VR-3: phase status — any Fail → failed', () => {
|
|
106
|
+
const results = [
|
|
107
|
+
{ id: 'SC-1', text: 't', status: 'Pass', classified_by: 'np-verifier', evidence: [], notes: '', needs_user_confirm: false },
|
|
108
|
+
{ id: 'SC-2', text: 't', status: 'Fail', classified_by: 'np-verifier', evidence: [], notes: '', needs_user_confirm: false },
|
|
109
|
+
{ id: 'SC-3', text: 't', status: 'Defer', classified_by: 'user', evidence: [], notes: '', needs_user_confirm: false },
|
|
110
|
+
];
|
|
111
|
+
const md = renderVerificationMd(1, 'n', results);
|
|
112
|
+
assert.match(md, /^\*\*Phase Status:\*\* failed$/m);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('VR-4: phase status — no Fail, any Defer → deferred', () => {
|
|
116
|
+
const results = [
|
|
117
|
+
{ id: 'SC-1', text: 't', status: 'Pass', classified_by: 'np-verifier', evidence: [], notes: '', needs_user_confirm: false },
|
|
118
|
+
{ id: 'SC-2', text: 't', status: 'Defer', classified_by: 'user', evidence: [], notes: '', needs_user_confirm: false },
|
|
119
|
+
];
|
|
120
|
+
const md = renderVerificationMd(1, 'n', results);
|
|
121
|
+
assert.match(md, /^\*\*Phase Status:\*\* deferred$/m);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('VR-5: phase status — all Pass → verified', () => {
|
|
125
|
+
const results = [
|
|
126
|
+
{ id: 'SC-1', text: 't', status: 'Pass', classified_by: 'np-verifier', evidence: [], notes: '', needs_user_confirm: false },
|
|
127
|
+
{ id: 'SC-2', text: 't', status: 'Pass', classified_by: 'np-verifier', evidence: [], notes: '', needs_user_confirm: false },
|
|
128
|
+
];
|
|
129
|
+
const md = renderVerificationMd(1, 'n', results);
|
|
130
|
+
assert.match(md, /^\*\*Phase Status:\*\* verified$/m);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('VR-6: verifyPhase returns skeleton Result[] with null status per SC', () => {
|
|
134
|
+
const sb = makeRoadmapSandbox([
|
|
135
|
+
{
|
|
136
|
+
number: 6,
|
|
137
|
+
name: 'exec-phase',
|
|
138
|
+
slug: 'exec-phase',
|
|
139
|
+
goal: 'execute things',
|
|
140
|
+
success_criteria: [
|
|
141
|
+
'criterion one works',
|
|
142
|
+
'criterion two works',
|
|
143
|
+
'criterion three works',
|
|
144
|
+
],
|
|
145
|
+
requirements: [],
|
|
146
|
+
status: 'pending',
|
|
147
|
+
plans: [],
|
|
148
|
+
},
|
|
149
|
+
]);
|
|
150
|
+
const results = verifyPhase(6, { cwd: sb });
|
|
151
|
+
assert.equal(results.length, 3);
|
|
152
|
+
for (let i = 0; i < results.length; i++) {
|
|
153
|
+
const r = results[i];
|
|
154
|
+
assert.equal(r.id, 'SC-' + (i + 1));
|
|
155
|
+
assert.equal(r.status, null);
|
|
156
|
+
assert.equal(r.classified_by, null);
|
|
157
|
+
assert.ok(Array.isArray(r.evidence));
|
|
158
|
+
assert.equal(r.needs_user_confirm, false);
|
|
159
|
+
}
|
|
160
|
+
assert.equal(results[0].text, 'criterion one works');
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test('VR-7: writeVerificationMd persists under <phase_dir>/<padded>-VERIFICATION.md', () => {
|
|
164
|
+
const sb = makeRoadmapSandbox([
|
|
165
|
+
{
|
|
166
|
+
number: 6,
|
|
167
|
+
name: 'exec-phase',
|
|
168
|
+
slug: 'exec-phase',
|
|
169
|
+
goal: 'execute things',
|
|
170
|
+
success_criteria: ['only one thing'],
|
|
171
|
+
requirements: [],
|
|
172
|
+
status: 'pending',
|
|
173
|
+
plans: [],
|
|
174
|
+
},
|
|
175
|
+
]);
|
|
176
|
+
|
|
177
|
+
const phaseDir = path.join(sb, '.nubos-pilot', 'phases', '06-exec-phase');
|
|
178
|
+
fs.mkdirSync(phaseDir, { recursive: true });
|
|
179
|
+
|
|
180
|
+
writeVerificationMd(6, sb);
|
|
181
|
+
|
|
182
|
+
const target = path.join(phaseDir, '06-VERIFICATION.md');
|
|
183
|
+
assert.ok(fs.existsSync(target), 'VERIFICATION.md should exist at ' + target);
|
|
184
|
+
const content = fs.readFileSync(target, 'utf-8');
|
|
185
|
+
assert.match(content, /^# Phase 6: exec-phase - Verification$/m);
|
|
186
|
+
assert.match(content, /^### SC-1: only one thing$/m);
|
|
187
|
+
});
|
package/np-tools.cjs
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const crypto = require('node:crypto');
|
|
5
|
+
const { projectStateDir, NubosPilotError } = require('./lib/core.cjs');
|
|
6
|
+
const { getPhase } = require('./lib/roadmap.cjs');
|
|
7
|
+
const { paddedPhase, phaseSlug, findPhaseDir } = require('./lib/phase.cjs');
|
|
8
|
+
const { parsePlan, listPlans } = require('./lib/plan.cjs');
|
|
9
|
+
const { loadTaskGraph } = require('./lib/tasks.cjs');
|
|
10
|
+
const { COMMANDS } = require('./bin/np-tools/_commands.cjs');
|
|
11
|
+
|
|
12
|
+
const initWorkflows = {
|
|
13
|
+
'plan-phase': require('./bin/np-tools/plan-phase.cjs'),
|
|
14
|
+
'discuss-phase': require('./bin/np-tools/discuss-phase.cjs'),
|
|
15
|
+
'discuss-phase-power': require('./bin/np-tools/discuss-phase-power.cjs'),
|
|
16
|
+
'research-phase': require('./bin/np-tools/research-phase.cjs'),
|
|
17
|
+
'new-project': require('./bin/np-tools/new-project.cjs'),
|
|
18
|
+
'new-milestone': require('./bin/np-tools/new-milestone.cjs'),
|
|
19
|
+
'plan-milestone-gaps': require('./bin/np-tools/plan-milestone-gaps.cjs'),
|
|
20
|
+
|
|
21
|
+
'execute-phase': require('./bin/np-tools/execute-phase.cjs'),
|
|
22
|
+
'execute-plan': require('./bin/np-tools/execute-plan.cjs'),
|
|
23
|
+
'autonomous': require('./bin/np-tools/autonomous.cjs'),
|
|
24
|
+
'verify-work': require('./bin/np-tools/verify-work.cjs'),
|
|
25
|
+
'add-tests': require('./bin/np-tools/add-tests.cjs'),
|
|
26
|
+
'pause-work': require('./bin/np-tools/pause-work.cjs'),
|
|
27
|
+
'resume-work': require('./bin/np-tools/resume-work.cjs'),
|
|
28
|
+
|
|
29
|
+
'ai-integration-phase': require('./bin/np-tools/ai-integration-phase.cjs'),
|
|
30
|
+
'ui-phase': require('./bin/np-tools/ui-phase.cjs'),
|
|
31
|
+
'ui-review': require('./bin/np-tools/ui-review.cjs'),
|
|
32
|
+
'eval-review': require('./bin/np-tools/eval-review.cjs'),
|
|
33
|
+
|
|
34
|
+
'code-review': require('./bin/np-tools/code-review.cjs'),
|
|
35
|
+
|
|
36
|
+
'add-todo': require('./bin/np-tools/add-todo.cjs'),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const topLevelCommands = {
|
|
40
|
+
'agent-skills': require('./bin/np-tools/agent-skills.cjs'),
|
|
41
|
+
|
|
42
|
+
'commit-task': require('./bin/np-tools/commit-task.cjs'),
|
|
43
|
+
'checkpoint': require('./bin/np-tools/checkpoint.cjs'),
|
|
44
|
+
|
|
45
|
+
'undo': require('./bin/np-tools/undo.cjs'),
|
|
46
|
+
'undo-task': require('./bin/np-tools/undo-task.cjs'),
|
|
47
|
+
'reset-slice': require('./bin/np-tools/reset-slice.cjs'),
|
|
48
|
+
'skip': require('./bin/np-tools/skip.cjs'),
|
|
49
|
+
'park': require('./bin/np-tools/park.cjs'),
|
|
50
|
+
'unpark': require('./bin/np-tools/unpark.cjs'),
|
|
51
|
+
'askuser': require('./bin/np-tools/askuser.cjs'),
|
|
52
|
+
'commit': require('./bin/np-tools/commit.cjs'),
|
|
53
|
+
'config-get': require('./bin/np-tools/config.cjs'),
|
|
54
|
+
'dispatch': require('./bin/np-tools/dispatch.cjs'),
|
|
55
|
+
'doctor': require('./bin/np-tools/doctor.cjs'),
|
|
56
|
+
'generate-slug': require('./bin/np-tools/slug.cjs'),
|
|
57
|
+
'metrics': require('./bin/np-tools/metrics.cjs'),
|
|
58
|
+
'phase': require('./bin/np-tools/phase.cjs'),
|
|
59
|
+
'plan-diff': require('./bin/np-tools/plan-diff.cjs'),
|
|
60
|
+
'queue': require('./bin/np-tools/queue.cjs'),
|
|
61
|
+
'resolve-model': require('./bin/np-tools/resolve-model.cjs'),
|
|
62
|
+
'stats': require('./bin/np-tools/stats.cjs'),
|
|
63
|
+
'triage': require('./bin/np-tools/triage.cjs'),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const THRESHOLD = 16 * 1024;
|
|
67
|
+
|
|
68
|
+
function _resolveStateDir(cwd) {
|
|
69
|
+
try {
|
|
70
|
+
return projectStateDir(cwd);
|
|
71
|
+
} catch (err) {
|
|
72
|
+
if (err && err.code === 'not-in-project') {
|
|
73
|
+
const boot = path.join(path.resolve(cwd), '.planning');
|
|
74
|
+
if (fs.existsSync(boot)) return boot;
|
|
75
|
+
}
|
|
76
|
+
throw err;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function _resolvePhaseDir(n, cwd) {
|
|
81
|
+
try {
|
|
82
|
+
const hit = findPhaseDir(n, cwd);
|
|
83
|
+
if (hit) return hit;
|
|
84
|
+
} catch (err) {
|
|
85
|
+
if (!err || err.code !== 'not-in-project') throw err;
|
|
86
|
+
}
|
|
87
|
+
const padded = paddedPhase(n);
|
|
88
|
+
const stateDir = _resolveStateDir(cwd);
|
|
89
|
+
const phasesRoot = path.join(stateDir, 'phases');
|
|
90
|
+
let entries;
|
|
91
|
+
try {
|
|
92
|
+
entries = fs.readdirSync(phasesRoot, { withFileTypes: true });
|
|
93
|
+
} catch (err) {
|
|
94
|
+
if (err && err.code === 'ENOENT') return null;
|
|
95
|
+
throw err;
|
|
96
|
+
}
|
|
97
|
+
const matches = entries
|
|
98
|
+
.filter((e) => e.isDirectory())
|
|
99
|
+
.filter((e) => e.name === padded || e.name.startsWith(padded + '-'))
|
|
100
|
+
.map((e) => e.name)
|
|
101
|
+
.sort((a, b) => b.length - a.length);
|
|
102
|
+
if (matches.length === 0) return null;
|
|
103
|
+
return path.join(phasesRoot, matches[0]);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function _sanitizeLabel(s) {
|
|
107
|
+
return String(s).replace(/[^a-zA-Z0-9-]/g, '_');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function emit(payload, _stdout, _cwd) {
|
|
111
|
+
const stdout = _stdout || process.stdout;
|
|
112
|
+
const cwd = _cwd || process.cwd();
|
|
113
|
+
const json = JSON.stringify(payload, null, 2);
|
|
114
|
+
if (Buffer.byteLength(json, 'utf-8') <= THRESHOLD) {
|
|
115
|
+
stdout.write(json);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const stateDir = _resolveStateDir(cwd);
|
|
119
|
+
const tmpDir = path.join(stateDir, '.tmp');
|
|
120
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
121
|
+
const workflow = _sanitizeLabel(payload && payload._workflow ? payload._workflow : 'init');
|
|
122
|
+
const suffix = process.pid + '-' + crypto.randomBytes(4).toString('hex');
|
|
123
|
+
const tmpPath = path.join(tmpDir, 'init-' + workflow + '-' + suffix + '.json');
|
|
124
|
+
fs.writeFileSync(tmpPath, json, 'utf-8');
|
|
125
|
+
stdout.write('@file:' + tmpPath);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function _makePhasePayload(n, cwd, workflowLabel) {
|
|
129
|
+
const padded = paddedPhase(n);
|
|
130
|
+
const phase = getPhase(n, cwd);
|
|
131
|
+
const phase_dir = _resolvePhaseDir(n, cwd);
|
|
132
|
+
const stateDir = _resolveStateDir(cwd);
|
|
133
|
+
let has_context = false;
|
|
134
|
+
let has_research = false;
|
|
135
|
+
let has_plans = false;
|
|
136
|
+
if (phase_dir) {
|
|
137
|
+
has_context = fs.existsSync(path.join(phase_dir, padded + '-CONTEXT.md'));
|
|
138
|
+
has_research = fs.existsSync(path.join(phase_dir, padded + '-RESEARCH.md'));
|
|
139
|
+
has_plans = listPlans(phase_dir).length > 0;
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
_workflow: workflowLabel,
|
|
143
|
+
phase_number: String(n),
|
|
144
|
+
padded_phase: padded,
|
|
145
|
+
phase_slug: phase_dir ? path.basename(phase_dir).slice(padded.length + 1) : phaseSlug(phase.name),
|
|
146
|
+
phase_name: phase.name,
|
|
147
|
+
phase_dir,
|
|
148
|
+
phase_found: !!phase_dir,
|
|
149
|
+
roadmap_path: path.join(stateDir, 'ROADMAP.md'),
|
|
150
|
+
state_path: path.join(stateDir, 'STATE.md'),
|
|
151
|
+
has_context,
|
|
152
|
+
has_research,
|
|
153
|
+
has_plans,
|
|
154
|
+
goal: phase.goal,
|
|
155
|
+
requirements: phase.requirements,
|
|
156
|
+
success_criteria: phase.success_criteria,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function composeInit(workflow, args, cwd) {
|
|
161
|
+
const useCwd = cwd || process.cwd();
|
|
162
|
+
switch (workflow) {
|
|
163
|
+
case 'phase-op':
|
|
164
|
+
return _makePhasePayload(args[0], useCwd, 'phase-op');
|
|
165
|
+
case 'plan-phase': {
|
|
166
|
+
const base = _makePhasePayload(args[0], useCwd, 'plan-phase');
|
|
167
|
+
if (base.phase_dir) {
|
|
168
|
+
base.planned_plans = listPlans(base.phase_dir);
|
|
169
|
+
base.context_path = base.has_context
|
|
170
|
+
? path.join(base.phase_dir, base.padded_phase + '-CONTEXT.md')
|
|
171
|
+
: null;
|
|
172
|
+
base.research_path = base.has_research
|
|
173
|
+
? path.join(base.phase_dir, base.padded_phase + '-RESEARCH.md')
|
|
174
|
+
: null;
|
|
175
|
+
} else {
|
|
176
|
+
base.planned_plans = [];
|
|
177
|
+
base.context_path = null;
|
|
178
|
+
base.research_path = null;
|
|
179
|
+
}
|
|
180
|
+
return base;
|
|
181
|
+
}
|
|
182
|
+
case 'execute-phase': {
|
|
183
|
+
const base = _makePhasePayload(args[0], useCwd, 'execute-phase');
|
|
184
|
+
base.plans = [];
|
|
185
|
+
if (base.phase_dir) {
|
|
186
|
+
for (const planPath of listPlans(base.phase_dir)) {
|
|
187
|
+
const parsed = parsePlan(planPath);
|
|
188
|
+
const planDir = path.dirname(planPath);
|
|
189
|
+
const tg = loadTaskGraph(planDir);
|
|
190
|
+
base.plans.push({
|
|
191
|
+
plan_path: planPath,
|
|
192
|
+
plan_frontmatter: parsed.frontmatter,
|
|
193
|
+
tasks_dir: path.join(planDir, 'tasks'),
|
|
194
|
+
task_count: tg.tasks.length,
|
|
195
|
+
waves: tg.waves,
|
|
196
|
+
warnings: tg.warnings,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return base;
|
|
201
|
+
}
|
|
202
|
+
default: {
|
|
203
|
+
if (args[0]) {
|
|
204
|
+
try {
|
|
205
|
+
return _makePhasePayload(args[0], useCwd, workflow);
|
|
206
|
+
} catch (err) {
|
|
207
|
+
if (err && err.code === 'phase-not-found') {
|
|
208
|
+
return { _workflow: workflow, phase_found: false, phase_number: String(args[0]) };
|
|
209
|
+
}
|
|
210
|
+
throw err;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return { _workflow: workflow, phase_found: false };
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function main() {
|
|
219
|
+
const args = process.argv.slice(2);
|
|
220
|
+
try {
|
|
221
|
+
const cmd = args[0];
|
|
222
|
+
let payload;
|
|
223
|
+
switch (cmd) {
|
|
224
|
+
case 'init': {
|
|
225
|
+
const wf = args[1];
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
if (wf && Object.prototype.hasOwnProperty.call(initWorkflows, wf)) {
|
|
231
|
+
const rc = initWorkflows[wf].run(args.slice(2));
|
|
232
|
+
if (rc && typeof rc.then === 'function') {
|
|
233
|
+
rc.then((code) => {
|
|
234
|
+
if (typeof code === 'number' && code !== 0) process.exit(code);
|
|
235
|
+
}).catch((err) => {
|
|
236
|
+
process.stderr.write(String((err && err.stack) || err) + '\n');
|
|
237
|
+
process.exit(1);
|
|
238
|
+
});
|
|
239
|
+
} else if (typeof rc === 'number' && rc !== 0) {
|
|
240
|
+
process.exit(rc);
|
|
241
|
+
}
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
payload = composeInit(wf, args.slice(2));
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
case 'next':
|
|
248
|
+
payload = require('./bin/np-tools/next.cjs').run(args.slice(1));
|
|
249
|
+
break;
|
|
250
|
+
case 'progress':
|
|
251
|
+
payload = require('./bin/np-tools/progress.cjs').run(args.slice(1));
|
|
252
|
+
break;
|
|
253
|
+
case 'state':
|
|
254
|
+
payload = require('./bin/np-tools/state.cjs').run(args.slice(1));
|
|
255
|
+
break;
|
|
256
|
+
case 'help':
|
|
257
|
+
payload = require('./bin/np-tools/help.cjs').run(args.slice(1));
|
|
258
|
+
break;
|
|
259
|
+
default: {
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
if (cmd && Object.prototype.hasOwnProperty.call(topLevelCommands, cmd)) {
|
|
263
|
+
const rc = topLevelCommands[cmd].run(args.slice(1));
|
|
264
|
+
if (rc && typeof rc.then === 'function') {
|
|
265
|
+
rc.then((code) => {
|
|
266
|
+
if (typeof code === 'number' && code !== 0) process.exit(code);
|
|
267
|
+
}).catch((err) => {
|
|
268
|
+
process.stderr.write(String((err && err.stack) || err) + '\n');
|
|
269
|
+
process.exit(1);
|
|
270
|
+
});
|
|
271
|
+
} else if (typeof rc === 'number' && rc !== 0) {
|
|
272
|
+
process.exit(rc);
|
|
273
|
+
}
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
throw new NubosPilotError(
|
|
277
|
+
'unknown-command',
|
|
278
|
+
'Unknown command: ' + cmd,
|
|
279
|
+
{ cmd },
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
emit(payload);
|
|
284
|
+
} catch (err) {
|
|
285
|
+
const code = (err && err.code) || 'init-internal-error';
|
|
286
|
+
const message = (err && err.message) || String(err);
|
|
287
|
+
const details = (err && err.details) || null;
|
|
288
|
+
fs.writeSync(2, JSON.stringify({ error: { code, message, details } }) + '\n');
|
|
289
|
+
process.exit(1);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (require.main === module) main();
|
|
294
|
+
|
|
295
|
+
module.exports = {
|
|
296
|
+
composeInit,
|
|
297
|
+
emit,
|
|
298
|
+
_makePhasePayload,
|
|
299
|
+
main,
|
|
300
|
+
COMMANDS,
|
|
301
|
+
initWorkflows,
|
|
302
|
+
topLevelCommands,
|
|
303
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nubos-pilot",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AI-driven planning and execution tool for code projects",
|
|
5
|
+
"homepage": "https://github.com/Nubos-AI/nubos-pilot",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Nubos-AI/nubos-pilot.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/Nubos-AI/nubos-pilot/issues"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=22"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"yaml": "^2.8.0"
|
|
19
|
+
},
|
|
20
|
+
"bin": {
|
|
21
|
+
"nubos-pilot": "bin/install.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"bin/",
|
|
25
|
+
"lib/",
|
|
26
|
+
"templates/",
|
|
27
|
+
"workflows/",
|
|
28
|
+
"agents/",
|
|
29
|
+
"docs/",
|
|
30
|
+
"np-tools.cjs",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"test": "node --test 'lib/**/*.test.cjs' 'tests/**/*.test.cjs' 'bin/**/*.test.cjs'",
|
|
35
|
+
"test:coverage": "node --test --experimental-test-coverage --test-coverage-include='lib/**' 'lib/**/*.test.cjs' 'tests/**/*.test.cjs' 'bin/**/*.test.cjs'",
|
|
36
|
+
"check-coverage": "node bin/check-coverage.cjs",
|
|
37
|
+
"ci": "npm run test && npm run check-coverage"
|
|
38
|
+
}
|
|
39
|
+
}
|