create-quiver 0.12.0 → 0.13.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/CHANGELOG.md +52 -0
- package/README.md +65 -25
- package/README_FOR_AI.md +36 -29
- package/ROADMAP.md +22 -3
- package/docs/AI_ONBOARDING_PROMPT.md.template +7 -1
- package/docs/COMMANDS.md.template +53 -20
- package/docs/STATUS.md.template +5 -1
- package/docs/WORKFLOW.md.template +13 -11
- package/package.json +10 -3
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/EVIDENCE_REPORT.md +293 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/EXECUTION_PLAN.md +58 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/SPEC.md +242 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/STATUS.md +35 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/pr.md +77 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-00-spec-foundation/CLOSURE_BRIEF.md +34 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-00-spec-foundation/EXECUTION_BRIEF.md +52 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-00-spec-foundation/slice.json +52 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-01-cli-contract-compatibility/CLOSURE_BRIEF.md +36 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-01-cli-contract-compatibility/EXECUTION_BRIEF.md +52 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-01-cli-contract-compatibility/slice.json +56 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-02-run-state-phase-locks/CLOSURE_BRIEF.md +43 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-02-run-state-phase-locks/EXECUTION_BRIEF.md +54 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-02-run-state-phase-locks/slice.json +52 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-03-safe-ai-onboarding-docs/CLOSURE_BRIEF.md +35 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-03-safe-ai-onboarding-docs/EXECUTION_BRIEF.md +53 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-03-safe-ai-onboarding-docs/slice.json +54 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-04-agent-profiles-adapters/CLOSURE_BRIEF.md +34 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-04-agent-profiles-adapters/EXECUTION_BRIEF.md +54 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-04-agent-profiles-adapters/slice.json +52 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-05-approval-gates/CLOSURE_BRIEF.md +34 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-05-approval-gates/EXECUTION_BRIEF.md +54 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-05-approval-gates/slice.json +53 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-06-spec-slice-generator/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-06-spec-slice-generator/EXECUTION_BRIEF.md +56 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-06-spec-slice-generator/slice.json +55 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-07-slice-execution-planner/CLOSURE_BRIEF.md +33 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-07-slice-execution-planner/EXECUTION_BRIEF.md +54 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-07-slice-execution-planner/slice.json +52 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-08-controlled-slice-execution/CLOSURE_BRIEF.md +39 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-08-controlled-slice-execution/EXECUTION_BRIEF.md +56 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-08-controlled-slice-execution/slice.json +53 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-09-git-worktree-pr-lifecycle/CLOSURE_BRIEF.md +38 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-09-git-worktree-pr-lifecycle/EXECUTION_BRIEF.md +57 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-09-git-worktree-pr-lifecycle/slice.json +52 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-10-validation-errors-fixtures/CLOSURE_BRIEF.md +39 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-10-validation-errors-fixtures/EXECUTION_BRIEF.md +55 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-10-validation-errors-fixtures/slice.json +56 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-11-export-dashboard-migration/CLOSURE_BRIEF.md +36 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-11-export-dashboard-migration/EXECUTION_BRIEF.md +54 -0
- package/specs/quiver-v25-ai-first-lifecycle-orchestrator/slices/slice-11-export-dashboard-migration/slice.json +53 -0
- package/specs/quiver-v26-0121-smoke-hardening/EVIDENCE_REPORT.md +208 -0
- package/specs/quiver-v26-0121-smoke-hardening/EXECUTION_PLAN.md +57 -0
- package/specs/quiver-v26-0121-smoke-hardening/SPEC.md +137 -0
- package/specs/quiver-v26-0121-smoke-hardening/STATUS.md +32 -0
- package/specs/quiver-v26-0121-smoke-hardening/pr.md +96 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-00-docs-foundation/CLOSURE_BRIEF.md +35 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-00-docs-foundation/EXECUTION_BRIEF.md +55 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-00-docs-foundation/slice.json +73 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-01-cli-help-version-contract/CLOSURE_BRIEF.md +38 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-01-cli-help-version-contract/EXECUTION_BRIEF.md +51 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-01-cli-help-version-contract/slice.json +76 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-02-init-doc-links-and-flow-guidance/CLOSURE_BRIEF.md +37 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-02-init-doc-links-and-flow-guidance/EXECUTION_BRIEF.md +52 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-02-init-doc-links-and-flow-guidance/slice.json +75 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-03-ai-approval-review-consistency/CLOSURE_BRIEF.md +37 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-03-ai-approval-review-consistency/EXECUTION_BRIEF.md +53 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-03-ai-approval-review-consistency/slice.json +77 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-04-local-validation-brief-contracts/CLOSURE_BRIEF.md +35 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-04-local-validation-brief-contracts/EXECUTION_BRIEF.md +52 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-04-local-validation-brief-contracts/slice.json +77 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-05-demo-scaffold-readiness/CLOSURE_BRIEF.md +34 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-05-demo-scaffold-readiness/EXECUTION_BRIEF.md +54 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-05-demo-scaffold-readiness/slice.json +84 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-06-plan-graph-scope-performance/CLOSURE_BRIEF.md +35 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-06-plan-graph-scope-performance/EXECUTION_BRIEF.md +53 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-06-plan-graph-scope-performance/slice.json +82 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-07-smoke-release-readiness/CLOSURE_BRIEF.md +35 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-07-smoke-release-readiness/EXECUTION_BRIEF.md +55 -0
- package/specs/quiver-v26-0121-smoke-hardening/slices/slice-07-smoke-release-readiness/slice.json +92 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/AUDIT_V24_V25_V26.md +67 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/COMMAND_CONTRACTS.md +125 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/COVERAGE_MATRIX.md +74 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/EVIDENCE_REPORT.md +179 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/EXECUTION_PLAN.md +71 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/SPEC.md +176 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/STATUS.md +37 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/pr.md +132 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-00-docs-audit-coverage-and-contracts/CLOSURE_BRIEF.md +36 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-00-docs-audit-coverage-and-contracts/EXECUTION_BRIEF.md +56 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-00-docs-audit-coverage-and-contracts/slice.json +75 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-01-core-state-resolver-and-canonical-statuses/CLOSURE_BRIEF.md +37 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-01-core-state-resolver-and-canonical-statuses/EXECUTION_BRIEF.md +54 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-01-core-state-resolver-and-canonical-statuses/slice.json +79 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-02-json-export-contract-and-machine-output/CLOSURE_BRIEF.md +34 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-02-json-export-contract-and-machine-output/EXECUTION_BRIEF.md +54 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-02-json-export-contract-and-machine-output/slice.json +75 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-03-approved-plan-to-spec-create/CLOSURE_BRIEF.md +36 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-03-approved-plan-to-spec-create/EXECUTION_BRIEF.md +55 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-03-approved-plan-to-spec-create/slice.json +78 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-04-ai-artifact-storage-redaction-and-token-compaction/CLOSURE_BRIEF.md +31 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-04-ai-artifact-storage-redaction-and-token-compaction/EXECUTION_BRIEF.md +55 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-04-ai-artifact-storage-redaction-and-token-compaction/slice.json +77 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-05-worktree-lifecycle-locks-and-recovery/CLOSURE_BRIEF.md +31 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-05-worktree-lifecycle-locks-and-recovery/EXECUTION_BRIEF.md +55 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-05-worktree-lifecycle-locks-and-recovery/slice.json +84 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-06-validation-gates-and-scope-safety/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-06-validation-gates-and-scope-safety/EXECUTION_BRIEF.md +57 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-06-validation-gates-and-scope-safety/slice.json +99 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-07-context-analysis-and-doctor-flow/CLOSURE_BRIEF.md +31 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-07-context-analysis-and-doctor-flow/EXECUTION_BRIEF.md +57 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-07-context-analysis-and-doctor-flow/slice.json +88 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-08-cross-platform-help-auth-and-dx/CLOSURE_BRIEF.md +31 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-08-cross-platform-help-auth-and-dx/EXECUTION_BRIEF.md +56 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-08-cross-platform-help-auth-and-dx/slice.json +85 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-09-fixtures-smoke-docs-and-release-readiness/CLOSURE_BRIEF.md +32 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-09-fixtures-smoke-docs-and-release-readiness/EXECUTION_BRIEF.md +56 -0
- package/specs/quiver-v27-reliability-ai-workflow-hardening/slices/slice-09-fixtures-smoke-docs-and-release-readiness/slice.json +91 -0
- package/src/create-quiver/commands/ai.js +652 -27
- package/src/create-quiver/commands/flow.js +58 -9
- package/src/create-quiver/commands/graph.js +11 -9
- package/src/create-quiver/commands/plan.js +7 -16
- package/src/create-quiver/commands/spec.js +282 -0
- package/src/create-quiver/index.js +409 -31
- package/src/create-quiver/lib/actionable-error.js +27 -0
- package/src/create-quiver/lib/agent-profiles.js +16 -4
- package/src/create-quiver/lib/ai/artifacts.js +318 -0
- package/src/create-quiver/lib/ai/context-packs.js +4 -0
- package/src/create-quiver/lib/ai/execution-plan.js +16 -1
- package/src/create-quiver/lib/ai/executor.js +272 -21
- package/src/create-quiver/lib/ai/export-state.js +679 -0
- package/src/create-quiver/lib/ai/github.js +162 -2
- package/src/create-quiver/lib/ai/onboarding-template.js +215 -2
- package/src/create-quiver/lib/ai/plan-review.js +7 -2
- package/src/create-quiver/lib/ai/providers.js +4 -3
- package/src/create-quiver/lib/ai/run-state.js +414 -0
- package/src/create-quiver/lib/ai/spec-generator.js +84 -13
- package/src/create-quiver/lib/ai/spec-templates.js +150 -21
- package/src/create-quiver/lib/analyze.js +2 -2
- package/src/create-quiver/lib/approvals.js +36 -5
- package/src/create-quiver/lib/demo.js +189 -14
- package/src/create-quiver/lib/doctor.js +154 -0
- package/src/create-quiver/lib/git.js +40 -1
- package/src/create-quiver/lib/handoff.js +123 -12
- package/src/create-quiver/lib/init-docs.js +35 -13
- package/src/create-quiver/lib/init-layout.js +9 -0
- package/src/create-quiver/lib/json.js +53 -3
- package/src/create-quiver/lib/lifecycle.js +52 -3
- package/src/create-quiver/lib/locks.js +134 -0
- package/src/create-quiver/lib/package-safety.js +7 -0
- package/src/create-quiver/lib/paths.js +74 -0
- package/src/create-quiver/lib/project-scan.js +74 -0
- package/src/create-quiver/lib/project-state-resolver.js +236 -0
- package/src/create-quiver/lib/readiness.js +66 -10
- package/src/create-quiver/lib/scope.js +52 -8
- package/src/create-quiver/lib/slice-graph.js +138 -38
- package/src/create-quiver/lib/slice.js +14 -5
- package/src/create-quiver/lib/spec-worktrees.js +129 -32
- package/src/create-quiver/lib/statuses.js +115 -0
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
const fs = require('node:fs');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
|
|
4
|
+
const { listAgentProfiles } = require('../agent-profiles');
|
|
5
|
+
const { PLANNER_APPROVAL_PHASES, readPhaseApproval } = require('../approvals');
|
|
6
|
+
const { collectLayoutReport } = require('../doctor');
|
|
7
|
+
const {
|
|
8
|
+
filterSlicesForExecution,
|
|
9
|
+
groupSlicesBySpec: groupResolvedSlicesBySpec,
|
|
10
|
+
isBlockedStatus: isCanonicalBlockedStatus,
|
|
11
|
+
isCompletedStatus: isCanonicalCompletedStatus,
|
|
12
|
+
normalizeStatus,
|
|
13
|
+
progressForSlice: resolveProgressForSlice,
|
|
14
|
+
resolveProjectState,
|
|
15
|
+
summarizeGraph: summarizeResolvedGraph,
|
|
16
|
+
summarizeSliceProgress,
|
|
17
|
+
} = require('../project-state-resolver');
|
|
18
|
+
const { detectFileConflicts } = require('../slice-graph');
|
|
19
|
+
const { readPlanReview } = require('./plan-review');
|
|
20
|
+
const { listAiRuns, nextCommandForPhase } = require('./run-state');
|
|
21
|
+
|
|
22
|
+
const EXPORT_SCHEMA_VERSION = 2;
|
|
23
|
+
|
|
24
|
+
function toPosix(relativePath) {
|
|
25
|
+
return String(relativePath || '').split(path.sep).join('/');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function relativePath(projectRoot, filePath) {
|
|
29
|
+
return toPosix(path.relative(projectRoot, filePath));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function readJsonIfExists(filePath) {
|
|
33
|
+
if (!fs.existsSync(filePath)) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function readPackageSummary(projectRoot) {
|
|
41
|
+
const packageJson = readJsonIfExists(path.join(projectRoot, 'package.json'));
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
name: packageJson?.name || path.basename(projectRoot) || 'project',
|
|
45
|
+
package_manager: fs.existsSync(path.join(projectRoot, 'pnpm-lock.yaml'))
|
|
46
|
+
? 'pnpm'
|
|
47
|
+
: fs.existsSync(path.join(projectRoot, 'yarn.lock'))
|
|
48
|
+
? 'yarn'
|
|
49
|
+
: 'npm',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function isCompletedStatus(status) {
|
|
54
|
+
return isCanonicalCompletedStatus('slice', status);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function isBlockedStatus(slice) {
|
|
58
|
+
return isCanonicalBlockedStatus('slice', slice?.canonical_status || slice?.status, slice);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function progressForSlice(slice) {
|
|
62
|
+
return resolveProgressForSlice(slice);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function summarizeProgress(items) {
|
|
66
|
+
return summarizeSliceProgress(items);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function statusForSpec(specSlices) {
|
|
70
|
+
if (specSlices.length === 0) {
|
|
71
|
+
return 'empty';
|
|
72
|
+
}
|
|
73
|
+
if (specSlices.some((slice) => isBlockedStatus(slice))) {
|
|
74
|
+
return 'blocked';
|
|
75
|
+
}
|
|
76
|
+
if (specSlices.every((slice) => isCompletedStatus(slice.status))) {
|
|
77
|
+
return 'done';
|
|
78
|
+
}
|
|
79
|
+
if (specSlices.some((slice) => progressForSlice(slice) > 0)) {
|
|
80
|
+
return 'in-progress';
|
|
81
|
+
}
|
|
82
|
+
return 'planned';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function groupSlicesBySpec(slices) {
|
|
86
|
+
return groupResolvedSlicesBySpec(slices);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function buildGraphSummary(slices) {
|
|
90
|
+
return summarizeResolvedGraph(slices);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function filterGraphSummary(graph, selectedRefs) {
|
|
94
|
+
if (!graph.ok) {
|
|
95
|
+
return graph;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const levels = graph.levels
|
|
99
|
+
.map((level) => ({
|
|
100
|
+
original_level: level.level,
|
|
101
|
+
slices: level.slices.filter((ref) => selectedRefs.has(ref)),
|
|
102
|
+
}))
|
|
103
|
+
.filter((level) => level.slices.length > 0)
|
|
104
|
+
.map((level, index) => ({
|
|
105
|
+
level: index,
|
|
106
|
+
original_level: level.original_level,
|
|
107
|
+
slices: level.slices,
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
...graph,
|
|
112
|
+
edges: graph.edges.filter((edge) => selectedRefs.has(edge.to)),
|
|
113
|
+
levels,
|
|
114
|
+
conflicts: graph.conflicts
|
|
115
|
+
.map((conflict) => ({
|
|
116
|
+
files: conflict.files,
|
|
117
|
+
slices: conflict.slices.filter((ref) => selectedRefs.has(ref)),
|
|
118
|
+
}))
|
|
119
|
+
.filter((conflict) => conflict.slices.length > 1),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function normalizeSlice(projectRoot, slice, dependencyMap) {
|
|
124
|
+
const dependencies = dependencyMap.get(slice.ref) || slice.depends_on || slice.dependencies || [];
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
ref: slice.ref,
|
|
128
|
+
id: slice.sliceId,
|
|
129
|
+
title: slice.title,
|
|
130
|
+
status: slice.status,
|
|
131
|
+
canonical_status: slice.canonical_status || normalizeStatus('slice', slice.status, 'planned'),
|
|
132
|
+
progress: progressForSlice(slice),
|
|
133
|
+
spec_slug: slice.specSlug,
|
|
134
|
+
spec_family: slice.specFamily,
|
|
135
|
+
path: relativePath(projectRoot, slice.sliceDir),
|
|
136
|
+
slice_json: toPosix(path.join(slice.specFamily, slice.specSlug, 'slices', path.basename(slice.sliceDir), 'slice.json')),
|
|
137
|
+
dependencies,
|
|
138
|
+
parallel_safe: slice.parallel_safe,
|
|
139
|
+
parallel_safe_reason: slice.parallel_safe_reason,
|
|
140
|
+
allowed_write_paths: slice.allowed_write_paths,
|
|
141
|
+
expected_read_paths: slice.expected_read_paths,
|
|
142
|
+
validation_hints: slice.validation_hints,
|
|
143
|
+
files: slice.files,
|
|
144
|
+
evidence: Array.isArray(slice.json?.evidence) ? slice.json.evidence : [],
|
|
145
|
+
tests: Array.isArray(slice.json?.tests) ? slice.json.tests : [],
|
|
146
|
+
blocked_reason: slice.json?.blocked_reason || null,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function normalizeRuns(projectRoot) {
|
|
151
|
+
return listAiRuns(projectRoot).map((run) => ({
|
|
152
|
+
run_id: run.run_id,
|
|
153
|
+
status: run.status,
|
|
154
|
+
canonical_status: normalizeStatus('run', run.status, 'draft'),
|
|
155
|
+
phase: run.phase,
|
|
156
|
+
spec_slug: run.spec_slug || null,
|
|
157
|
+
requirement_path: run.requirement?.path || null,
|
|
158
|
+
approvals_path: run.approvals_path || null,
|
|
159
|
+
state_path: toPosix(path.join('.quiver', 'runs', run.run_id, 'state.json')),
|
|
160
|
+
next_command: nextCommandForPhase(run.phase),
|
|
161
|
+
updated_at: run.updated_at || run.created_at || null,
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function safeReadApproval(projectRoot, phase) {
|
|
166
|
+
try {
|
|
167
|
+
return readPhaseApproval(projectRoot, phase);
|
|
168
|
+
} catch (error) {
|
|
169
|
+
return {
|
|
170
|
+
phase,
|
|
171
|
+
status: 'invalid',
|
|
172
|
+
draft: null,
|
|
173
|
+
approved: null,
|
|
174
|
+
meta: null,
|
|
175
|
+
error: error.message,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function safeReadPlanReview(projectRoot) {
|
|
181
|
+
try {
|
|
182
|
+
return readPlanReview(projectRoot);
|
|
183
|
+
} catch (error) {
|
|
184
|
+
return {
|
|
185
|
+
status: 'invalid',
|
|
186
|
+
review: null,
|
|
187
|
+
meta: null,
|
|
188
|
+
error: error.message,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function normalizeApproval(projectRoot, phase, approval) {
|
|
194
|
+
const drafts = Array.isArray(approval?.meta?.drafts) ? approval.meta.drafts : [];
|
|
195
|
+
return {
|
|
196
|
+
phase,
|
|
197
|
+
status: approval?.status || 'missing',
|
|
198
|
+
canonical_status: normalizeStatus('approval', approval?.status || 'missing', 'pending'),
|
|
199
|
+
draft_path: approval?.draft?.path || null,
|
|
200
|
+
approved_path: approval?.approved?.path || null,
|
|
201
|
+
latest_draft_version: Number(approval?.meta?.draft?.version || 0) || null,
|
|
202
|
+
approved_version: Number(approval?.meta?.approved?.version || 0) || null,
|
|
203
|
+
draft_count: drafts.length,
|
|
204
|
+
source_file: approval?.meta?.approved?.source_file || approval?.meta?.draft?.source_file || null,
|
|
205
|
+
error: approval?.error || null,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function normalizeApprovals(projectRoot) {
|
|
210
|
+
const plannerApprovals = PLANNER_APPROVAL_PHASES.map((phase) => normalizeApproval(projectRoot, phase, safeReadApproval(projectRoot, phase)));
|
|
211
|
+
const planReview = safeReadPlanReview(projectRoot);
|
|
212
|
+
|
|
213
|
+
return plannerApprovals.concat({
|
|
214
|
+
phase: 'plan-review',
|
|
215
|
+
status: planReview.status || 'missing',
|
|
216
|
+
canonical_status: normalizeStatus('approval', planReview.status || 'missing', 'pending'),
|
|
217
|
+
draft_path: null,
|
|
218
|
+
approved_path: planReview.review?.path || null,
|
|
219
|
+
latest_draft_version: Number(planReview.meta?.source_version || 0) || null,
|
|
220
|
+
approved_version: null,
|
|
221
|
+
draft_count: 0,
|
|
222
|
+
source_file: planReview.meta?.source_file || null,
|
|
223
|
+
error: planReview.error || null,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function normalizeAgents(projectRoot) {
|
|
228
|
+
return listAgentProfiles(projectRoot).map((item) => ({
|
|
229
|
+
role: item.role,
|
|
230
|
+
status: 'idle',
|
|
231
|
+
canonical_status: normalizeStatus('agent', 'idle', 'idle'),
|
|
232
|
+
configured: item.configured,
|
|
233
|
+
provider: item.profile?.provider || null,
|
|
234
|
+
model: item.profile?.model || null,
|
|
235
|
+
label: item.profile?.label || null,
|
|
236
|
+
context: item.profile?.context || null,
|
|
237
|
+
updated_at: item.profile?.updated_at || null,
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function collectEvidenceEntries(slices) {
|
|
242
|
+
return (Array.isArray(slices) ? slices : [])
|
|
243
|
+
.flatMap((slice) => {
|
|
244
|
+
const evidence = Array.isArray(slice.json?.evidence) ? slice.json.evidence : [];
|
|
245
|
+
return evidence.map((item, index) => ({
|
|
246
|
+
slice_ref: slice.ref,
|
|
247
|
+
index,
|
|
248
|
+
value: item,
|
|
249
|
+
}));
|
|
250
|
+
})
|
|
251
|
+
.sort((left, right) => left.slice_ref.localeCompare(right.slice_ref) || left.index - right.index);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function countByStatus(items, statusKey = 'canonical_status') {
|
|
255
|
+
return (Array.isArray(items) ? items : []).reduce((acc, item) => {
|
|
256
|
+
const key = item?.[statusKey] || item?.status || 'unknown';
|
|
257
|
+
acc[key] = (acc[key] || 0) + 1;
|
|
258
|
+
return acc;
|
|
259
|
+
}, {});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function collectWarnings({ graph, layout, specs, slices }) {
|
|
263
|
+
const warnings = [];
|
|
264
|
+
|
|
265
|
+
if (!graph.ok && graph.error?.message) {
|
|
266
|
+
warnings.push({
|
|
267
|
+
code: graph.error.code || 'GRAPH_ERROR',
|
|
268
|
+
message: graph.error.message,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (layout.layout === 'legacy' || layout.layout === 'hybrid' || layout.layout === 'incomplete') {
|
|
273
|
+
warnings.push({
|
|
274
|
+
code: 'LAYOUT_REQUIRES_ATTENTION',
|
|
275
|
+
message: layout.recommendations.join(' '),
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (specs.length === 0) {
|
|
280
|
+
warnings.push({
|
|
281
|
+
code: 'NO_SPECS_FOUND',
|
|
282
|
+
message: 'No specs were found for the selected export filters.',
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (slices.length === 0) {
|
|
287
|
+
warnings.push({
|
|
288
|
+
code: 'NO_SLICES_FOUND',
|
|
289
|
+
message: 'No slices were found for the selected export filters.',
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return warnings;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function collectNextSteps(data) {
|
|
297
|
+
const activeRun = [...data.runs].reverse().find((run) => run.status !== 'closed');
|
|
298
|
+
const commands = [];
|
|
299
|
+
|
|
300
|
+
commands.push({
|
|
301
|
+
id: activeRun ? 'continue-active-run' : 'create-ai-run',
|
|
302
|
+
command: activeRun ? activeRun.next_command : 'npx create-quiver ai run create --input <requirements.md>',
|
|
303
|
+
reason: activeRun ? `Continue AI run ${activeRun.run_id}.` : 'Start a new AI lifecycle run.',
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
if (data.summary.slices > 0) {
|
|
307
|
+
commands.push({
|
|
308
|
+
id: 'inspect-slices',
|
|
309
|
+
command: 'npx create-quiver ai slices list',
|
|
310
|
+
reason: 'Inspect current slice state.',
|
|
311
|
+
});
|
|
312
|
+
commands.push({
|
|
313
|
+
id: 'export-json',
|
|
314
|
+
command: 'npx create-quiver ai export --format json',
|
|
315
|
+
reason: 'Export machine-readable lifecycle state.',
|
|
316
|
+
});
|
|
317
|
+
} else {
|
|
318
|
+
commands.push({
|
|
319
|
+
id: 'draft-acceptance',
|
|
320
|
+
command: 'npx create-quiver ai plan --phase acceptance --input <requirements.md> --dry-run',
|
|
321
|
+
reason: 'Preview acceptance criteria generation.',
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (data.migration.layout === 'legacy' || data.migration.layout === 'hybrid' || data.migration.layout === 'incomplete') {
|
|
326
|
+
commands.push({
|
|
327
|
+
id: 'preview-migration',
|
|
328
|
+
command: 'npx create-quiver migrate --dry-run',
|
|
329
|
+
reason: 'Preview migration to the current layout.',
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return commands;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function collectLifecycleExport(projectRoot, options = {}) {
|
|
337
|
+
const state = resolveProjectState(projectRoot, {
|
|
338
|
+
allowGraphErrors: true,
|
|
339
|
+
specSlug: options.specSlug,
|
|
340
|
+
});
|
|
341
|
+
const allSlices = state.graph.nodes;
|
|
342
|
+
const slices = filterSlicesForExecution(allSlices, {
|
|
343
|
+
includeCompleted: options.includeCompleted === true,
|
|
344
|
+
});
|
|
345
|
+
const fullGraph = buildGraphSummary(state.graph);
|
|
346
|
+
const selectedRefs = new Set(slices.map((slice) => slice.ref));
|
|
347
|
+
const graph = filterGraphSummary(fullGraph, selectedRefs);
|
|
348
|
+
if (graph.ok) {
|
|
349
|
+
graph.conflicts = detectFileConflicts(slices).map((conflict) => ({
|
|
350
|
+
files: conflict.files,
|
|
351
|
+
slices: conflict.slices,
|
|
352
|
+
}));
|
|
353
|
+
}
|
|
354
|
+
const dependencyMap = new Map(fullGraph.nodes.map((node) => [node.ref, node.depends_on || node.dependencies || []]));
|
|
355
|
+
const normalizedSlices = slices.map((slice) => normalizeSlice(projectRoot, slice, dependencyMap));
|
|
356
|
+
const specs = groupSlicesBySpec(slices).map((spec) => {
|
|
357
|
+
const progress = summarizeProgress(spec.slices);
|
|
358
|
+
const specPath = path.join(spec.specFamily, spec.specSlug);
|
|
359
|
+
return {
|
|
360
|
+
slug: spec.specSlug,
|
|
361
|
+
family: spec.specFamily,
|
|
362
|
+
path: specPath,
|
|
363
|
+
spec_path: fs.existsSync(path.join(projectRoot, specPath, 'SPEC.md')) ? toPosix(path.join(specPath, 'SPEC.md')) : null,
|
|
364
|
+
status_path: fs.existsSync(path.join(projectRoot, specPath, 'STATUS.md')) ? toPosix(path.join(specPath, 'STATUS.md')) : null,
|
|
365
|
+
pr_path: fs.existsSync(path.join(projectRoot, specPath, 'pr.md')) ? toPosix(path.join(specPath, 'pr.md')) : null,
|
|
366
|
+
status: spec.status || statusForSpec(spec.slices),
|
|
367
|
+
canonical_status: spec.canonical_status || normalizeStatus('spec', spec.status || statusForSpec(spec.slices), 'planned'),
|
|
368
|
+
progress,
|
|
369
|
+
slices: spec.slices.map((slice) => slice.ref),
|
|
370
|
+
blockers: spec.slices.filter((slice) => isBlockedStatus(slice)).map((slice) => ({
|
|
371
|
+
ref: slice.ref,
|
|
372
|
+
reason: slice.json?.blocked_reason || 'blocked',
|
|
373
|
+
})),
|
|
374
|
+
};
|
|
375
|
+
});
|
|
376
|
+
const layout = collectLayoutReport(projectRoot);
|
|
377
|
+
const runs = normalizeRuns(projectRoot);
|
|
378
|
+
const agents = normalizeAgents(projectRoot);
|
|
379
|
+
const approvals = normalizeApprovals(projectRoot);
|
|
380
|
+
const progress = summarizeProgress(slices);
|
|
381
|
+
const evidence = collectEvidenceEntries(slices);
|
|
382
|
+
const blockers = normalizedSlices
|
|
383
|
+
.filter((slice) => slice.blocked_reason || String(slice.status).toLowerCase() === 'blocked')
|
|
384
|
+
.map((slice) => ({ ref: slice.ref, reason: slice.blocked_reason || 'blocked' }));
|
|
385
|
+
|
|
386
|
+
if (!graph.ok) {
|
|
387
|
+
blockers.push({ ref: 'slice-graph', reason: graph.error.message });
|
|
388
|
+
}
|
|
389
|
+
if (layout.layout === 'legacy' || layout.layout === 'hybrid' || layout.layout === 'incomplete') {
|
|
390
|
+
blockers.push({ ref: 'migration', reason: layout.recommendations.join(' ') });
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const exportData = {
|
|
394
|
+
schema_version: EXPORT_SCHEMA_VERSION,
|
|
395
|
+
generated_at: new Date().toISOString(),
|
|
396
|
+
source_metadata: {
|
|
397
|
+
generator: 'create-quiver',
|
|
398
|
+
command: 'ai export',
|
|
399
|
+
resolver: 'project-state-resolver',
|
|
400
|
+
project_root_name: path.basename(projectRoot),
|
|
401
|
+
include_completed: options.includeCompleted === true,
|
|
402
|
+
spec_filter: options.specSlug || null,
|
|
403
|
+
families: Array.from(new Set(allSlices.map((slice) => slice.specFamily))).sort((left, right) => left.localeCompare(right)),
|
|
404
|
+
},
|
|
405
|
+
project: readPackageSummary(projectRoot),
|
|
406
|
+
summary: {
|
|
407
|
+
specs: specs.length,
|
|
408
|
+
slices: progress.total,
|
|
409
|
+
completed_slices: progress.completed,
|
|
410
|
+
open_slices: progress.open,
|
|
411
|
+
blocked_slices: progress.blocked,
|
|
412
|
+
progress_percent: progress.percent,
|
|
413
|
+
runs: runs.length,
|
|
414
|
+
configured_agents: agents.filter((agent) => agent.configured).length,
|
|
415
|
+
approvals: approvals.length,
|
|
416
|
+
warnings: 0,
|
|
417
|
+
},
|
|
418
|
+
agents,
|
|
419
|
+
approvals,
|
|
420
|
+
runs,
|
|
421
|
+
specs,
|
|
422
|
+
slices: normalizedSlices,
|
|
423
|
+
graph: {
|
|
424
|
+
ok: graph.ok,
|
|
425
|
+
edges: graph.edges,
|
|
426
|
+
levels: graph.levels,
|
|
427
|
+
conflicts: graph.conflicts,
|
|
428
|
+
error: graph.error,
|
|
429
|
+
},
|
|
430
|
+
migration: {
|
|
431
|
+
layout: layout.layout,
|
|
432
|
+
has_new_layout: layout.hasNewLayout,
|
|
433
|
+
has_legacy_layout: layout.hasLegacyLayout,
|
|
434
|
+
legacy_signals: layout.legacySignals,
|
|
435
|
+
missing_new_layout_files: layout.missingNewLayoutFiles,
|
|
436
|
+
recommendations: layout.recommendations,
|
|
437
|
+
dry_run_command: 'npx create-quiver migrate --dry-run',
|
|
438
|
+
},
|
|
439
|
+
evidence,
|
|
440
|
+
warnings: [],
|
|
441
|
+
blockers,
|
|
442
|
+
next_steps: [],
|
|
443
|
+
lifecycle: {
|
|
444
|
+
phase: runs.length > 0 ? runs[runs.length - 1].phase : 'no-active-run',
|
|
445
|
+
active_run_id: (runs.length > 0 ? [...runs].reverse().find((run) => run.status !== 'closed') : null)?.run_id || null,
|
|
446
|
+
include_completed: options.includeCompleted === true,
|
|
447
|
+
spec_filter: options.specSlug || null,
|
|
448
|
+
levels: graph.levels,
|
|
449
|
+
},
|
|
450
|
+
aggregates: {
|
|
451
|
+
specs_by_status: countByStatus(specs),
|
|
452
|
+
slices_by_status: countByStatus(normalizedSlices),
|
|
453
|
+
runs_by_status: countByStatus(runs),
|
|
454
|
+
approvals_by_status: countByStatus(approvals),
|
|
455
|
+
blockers: blockers.length,
|
|
456
|
+
evidence: evidence.length,
|
|
457
|
+
progress_percent: progress.percent,
|
|
458
|
+
},
|
|
459
|
+
dashboard: {
|
|
460
|
+
progress,
|
|
461
|
+
blockers,
|
|
462
|
+
agents: agents.map((agent) => ({
|
|
463
|
+
id: agent.role,
|
|
464
|
+
role: agent.role,
|
|
465
|
+
configured: agent.configured,
|
|
466
|
+
provider: agent.provider,
|
|
467
|
+
})),
|
|
468
|
+
specs: specs.map((spec) => ({
|
|
469
|
+
id: spec.slug,
|
|
470
|
+
status: spec.status,
|
|
471
|
+
progress: spec.progress.percent,
|
|
472
|
+
slice_count: spec.progress.total,
|
|
473
|
+
blockers: spec.blockers,
|
|
474
|
+
})),
|
|
475
|
+
slices: normalizedSlices.map((slice) => ({
|
|
476
|
+
id: slice.ref,
|
|
477
|
+
status: slice.status,
|
|
478
|
+
progress: slice.progress,
|
|
479
|
+
dependencies: slice.dependencies,
|
|
480
|
+
blocker: slice.blocked_reason,
|
|
481
|
+
})),
|
|
482
|
+
dependencies: graph.edges,
|
|
483
|
+
},
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
exportData.warnings = collectWarnings({
|
|
487
|
+
graph,
|
|
488
|
+
layout,
|
|
489
|
+
specs,
|
|
490
|
+
slices: normalizedSlices,
|
|
491
|
+
});
|
|
492
|
+
exportData.summary.warnings = exportData.warnings.length;
|
|
493
|
+
exportData.next_steps = collectNextSteps(exportData);
|
|
494
|
+
exportData.lifecycle.next_commands = exportData.next_steps.map((step) => step.command);
|
|
495
|
+
|
|
496
|
+
return exportData;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function formatLifecycleInspect(data) {
|
|
500
|
+
const lines = [
|
|
501
|
+
'Quiver lifecycle inspect',
|
|
502
|
+
`Project: ${data.project.name}`,
|
|
503
|
+
`Specs: ${data.summary.specs}`,
|
|
504
|
+
`Slices: ${data.summary.slices} total, ${data.summary.open_slices} open, ${data.summary.blocked_slices} blocked, ${data.summary.progress_percent}% done`,
|
|
505
|
+
`Runs: ${data.summary.runs}`,
|
|
506
|
+
`Agents configured: ${data.summary.configured_agents}/${data.agents.length}`,
|
|
507
|
+
`Layout: ${data.migration.layout}`,
|
|
508
|
+
'',
|
|
509
|
+
'Next safe commands',
|
|
510
|
+
];
|
|
511
|
+
|
|
512
|
+
for (const step of data.next_steps || collectNextSteps(data)) {
|
|
513
|
+
lines.push(`- ${step.command}`);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
if (data.dashboard.blockers.length > 0) {
|
|
517
|
+
lines.push('', 'Blockers');
|
|
518
|
+
for (const blocker of data.dashboard.blockers) {
|
|
519
|
+
lines.push(`- ${blocker.ref}: ${blocker.reason}`);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
lines.push('');
|
|
524
|
+
return `${lines.join('\n')}\n`;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function formatSpecsList(data) {
|
|
528
|
+
const lines = ['Quiver specs list'];
|
|
529
|
+
|
|
530
|
+
if (data.specs.length === 0) {
|
|
531
|
+
lines.push('- No specs found. Next: npx create-quiver spec create --dry-run');
|
|
532
|
+
lines.push('');
|
|
533
|
+
return `${lines.join('\n')}\n`;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
for (const spec of data.specs) {
|
|
537
|
+
lines.push(`- ${spec.slug}: ${spec.status}, ${spec.progress.percent}% done, ${spec.progress.total} slices (${spec.path})`);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
lines.push('');
|
|
541
|
+
return `${lines.join('\n')}\n`;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function formatSlicesList(data) {
|
|
545
|
+
const lines = ['Quiver slices list'];
|
|
546
|
+
|
|
547
|
+
if (data.slices.length === 0) {
|
|
548
|
+
lines.push('- No slices found. Next: npx create-quiver spec create --dry-run');
|
|
549
|
+
lines.push('');
|
|
550
|
+
return `${lines.join('\n')}\n`;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
for (const slice of data.slices) {
|
|
554
|
+
const deps = slice.dependencies.length > 0 ? ` deps=${slice.dependencies.join(',')}` : '';
|
|
555
|
+
const blocked = slice.blocked_reason ? ` blocked=${slice.blocked_reason}` : '';
|
|
556
|
+
lines.push(`- ${slice.ref}: ${slice.status}, ${slice.progress}% done${deps}${blocked}`);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
lines.push('');
|
|
560
|
+
return `${lines.join('\n')}\n`;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function formatTraceReport(data) {
|
|
564
|
+
const lines = [
|
|
565
|
+
'Quiver trace report',
|
|
566
|
+
`Project: ${data.project.name}`,
|
|
567
|
+
`Schema: ${data.schema_version}`,
|
|
568
|
+
'',
|
|
569
|
+
'Runs',
|
|
570
|
+
];
|
|
571
|
+
|
|
572
|
+
if (data.runs.length === 0) {
|
|
573
|
+
lines.push('- none');
|
|
574
|
+
} else {
|
|
575
|
+
for (const run of data.runs) {
|
|
576
|
+
lines.push(`- ${run.run_id}: ${run.phase} (${run.status}) -> ${run.next_command}`);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
lines.push('', 'Execution waves');
|
|
581
|
+
if (!data.graph.ok) {
|
|
582
|
+
lines.push(`- graph error: ${data.graph.error.message}`);
|
|
583
|
+
} else if (data.graph.levels.length === 0) {
|
|
584
|
+
lines.push('- none');
|
|
585
|
+
} else {
|
|
586
|
+
for (const level of data.graph.levels) {
|
|
587
|
+
lines.push(`- wave ${level.level}: ${level.slices.join(', ')}`);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
lines.push('', 'Migration');
|
|
592
|
+
lines.push(`- layout: ${data.migration.layout}`);
|
|
593
|
+
for (const recommendation of data.migration.recommendations) {
|
|
594
|
+
lines.push(`- ${recommendation}`);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
lines.push('');
|
|
598
|
+
return `${lines.join('\n')}\n`;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function formatLifecycleExportMarkdown(data) {
|
|
602
|
+
const lines = [
|
|
603
|
+
'# Quiver Lifecycle Export',
|
|
604
|
+
'',
|
|
605
|
+
`- Project: ${data.project.name}`,
|
|
606
|
+
`- Generated: ${data.generated_at}`,
|
|
607
|
+
`- Schema version: ${data.schema_version}`,
|
|
608
|
+
`- Specs: ${data.summary.specs}`,
|
|
609
|
+
`- Slices: ${data.summary.slices} total, ${data.summary.completed_slices} completed, ${data.summary.open_slices} open`,
|
|
610
|
+
`- Progress: ${data.summary.progress_percent}%`,
|
|
611
|
+
`- Layout: ${data.migration.layout}`,
|
|
612
|
+
'',
|
|
613
|
+
'## Specs',
|
|
614
|
+
'',
|
|
615
|
+
];
|
|
616
|
+
|
|
617
|
+
if (data.specs.length === 0) {
|
|
618
|
+
lines.push('No specs found.');
|
|
619
|
+
} else {
|
|
620
|
+
lines.push('| Spec | Status | Progress | Slices | Path |');
|
|
621
|
+
lines.push('|---|---|---:|---:|---|');
|
|
622
|
+
for (const spec of data.specs) {
|
|
623
|
+
lines.push(`| ${spec.slug} | ${spec.status} | ${spec.progress.percent}% | ${spec.progress.total} | ${spec.path} |`);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
lines.push('', '## Slices', '');
|
|
628
|
+
if (data.slices.length === 0) {
|
|
629
|
+
lines.push('No slices found.');
|
|
630
|
+
} else {
|
|
631
|
+
lines.push('| Slice | Status | Progress | Dependencies | Write Scope |');
|
|
632
|
+
lines.push('|---|---|---:|---|---|');
|
|
633
|
+
for (const slice of data.slices) {
|
|
634
|
+
lines.push(`| ${slice.ref} | ${slice.status} | ${slice.progress}% | ${slice.dependencies.join(', ') || '-'} | ${slice.allowed_write_paths.join(', ') || slice.files.join(', ') || '-'} |`);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
lines.push('', '## Agents', '');
|
|
639
|
+
if (data.agents.length === 0) {
|
|
640
|
+
lines.push('No agent roles available.');
|
|
641
|
+
} else {
|
|
642
|
+
lines.push('| Role | Configured | Provider | Model |');
|
|
643
|
+
lines.push('|---|---|---|---|');
|
|
644
|
+
for (const agent of data.agents) {
|
|
645
|
+
lines.push(`| ${agent.role} | ${agent.configured ? 'yes' : 'no'} | ${agent.provider || '-'} | ${agent.model || '-'} |`);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
lines.push('', '## Runs', '');
|
|
650
|
+
if (data.runs.length === 0) {
|
|
651
|
+
lines.push('No AI runs found.');
|
|
652
|
+
} else {
|
|
653
|
+
lines.push('| Run | Phase | Status | Next Command |');
|
|
654
|
+
lines.push('|---|---|---|---|');
|
|
655
|
+
for (const run of data.runs) {
|
|
656
|
+
lines.push(`| ${run.run_id} | ${run.phase} | ${run.status} | \`${run.next_command}\` |`);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
lines.push('', '## Migration', '');
|
|
661
|
+
lines.push(`- Layout: ${data.migration.layout}`);
|
|
662
|
+
for (const recommendation of data.migration.recommendations) {
|
|
663
|
+
lines.push(`- ${recommendation}`);
|
|
664
|
+
}
|
|
665
|
+
lines.push(`- Dry-run: \`${data.migration.dry_run_command}\``);
|
|
666
|
+
lines.push('');
|
|
667
|
+
|
|
668
|
+
return `${lines.join('\n')}\n`;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
module.exports = {
|
|
672
|
+
EXPORT_SCHEMA_VERSION,
|
|
673
|
+
collectLifecycleExport,
|
|
674
|
+
formatLifecycleExportMarkdown,
|
|
675
|
+
formatLifecycleInspect,
|
|
676
|
+
formatSlicesList,
|
|
677
|
+
formatSpecsList,
|
|
678
|
+
formatTraceReport,
|
|
679
|
+
};
|