vibepro 0.1.0-alpha.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.
Files changed (89) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +9 -0
  3. package/README.ja.md +448 -0
  4. package/README.md +520 -0
  5. package/agent-instructions/codex/AGENTS.vibepro.md +45 -0
  6. package/bin/vibepro.js +9 -0
  7. package/docs/assets/vibepro-header.png +0 -0
  8. package/package.json +51 -0
  9. package/skills/vibepro-diagnosis-packages/SKILL.md +133 -0
  10. package/skills/vibepro-human-review/SKILL.md +73 -0
  11. package/skills/vibepro-story-refactor/SKILL.md +89 -0
  12. package/skills/vibepro-workflow/SKILL.md +139 -0
  13. package/src/agent-harness-map.js +230 -0
  14. package/src/agent-harness-scanner.js +337 -0
  15. package/src/agent-review.js +2180 -0
  16. package/src/api-boundary-scanner.js +452 -0
  17. package/src/architecture-profiler.js +423 -0
  18. package/src/authorization-scoring.js +149 -0
  19. package/src/brainbase-importer.js +534 -0
  20. package/src/change-risk-classifier.js +195 -0
  21. package/src/check-packs.js +605 -0
  22. package/src/checkpoint-manager.js +233 -0
  23. package/src/cli.js +2213 -0
  24. package/src/code-quality-scanner.js +310 -0
  25. package/src/codex-manager.js +143 -0
  26. package/src/component-style-scanner.js +336 -0
  27. package/src/coverage-report.js +99 -0
  28. package/src/database-access-scanner.js +163 -0
  29. package/src/decision-records.js +315 -0
  30. package/src/design-modernize.js +1435 -0
  31. package/src/design-system.js +1732 -0
  32. package/src/diagnostic-engine.js +1945 -0
  33. package/src/diagram-requirement-resolver.js +194 -0
  34. package/src/doctor.js +677 -0
  35. package/src/environment-graph.js +424 -0
  36. package/src/execution-state.js +849 -0
  37. package/src/explore-evidence.js +425 -0
  38. package/src/flow-design-scanner.js +896 -0
  39. package/src/flow-verifier.js +887 -0
  40. package/src/gesture-interaction-scanner.js +330 -0
  41. package/src/graph-context.js +263 -0
  42. package/src/graphify-adapter.js +189 -0
  43. package/src/html-report.js +1035 -0
  44. package/src/journey-map.js +1299 -0
  45. package/src/language.js +48 -0
  46. package/src/lazy-pattern-detector.js +182 -0
  47. package/src/local-dev-scanner.js +135 -0
  48. package/src/managed-worktree-gate.js +187 -0
  49. package/src/managed-worktree.js +766 -0
  50. package/src/merge-manager.js +501 -0
  51. package/src/network-contract-scanner.js +442 -0
  52. package/src/nocodb-story-sync.js +386 -0
  53. package/src/oss-readiness-scanner.js +417 -0
  54. package/src/performance-evidence.js +756 -0
  55. package/src/performance-measurer.js +591 -0
  56. package/src/pr-manager.js +8220 -0
  57. package/src/presets.js +682 -0
  58. package/src/public-discovery-scanner.js +519 -0
  59. package/src/refactoring-delta-reporter.js +367 -0
  60. package/src/refactoring-opportunity-generator.js +797 -0
  61. package/src/regression-risk-scanner.js +146 -0
  62. package/src/repo-status.js +266 -0
  63. package/src/report-fingerprint.js +188 -0
  64. package/src/report-pr-body-prompt-template.md +108 -0
  65. package/src/report-pr-body-schema.json +95 -0
  66. package/src/report-store.js +135 -0
  67. package/src/report-validator.js +192 -0
  68. package/src/requirement-consistency.js +1066 -0
  69. package/src/runtime-info.js +134 -0
  70. package/src/self-dogfood-scanner.js +476 -0
  71. package/src/session-learning.js +164 -0
  72. package/src/skills-manager.js +157 -0
  73. package/src/spec-drift.js +378 -0
  74. package/src/spec-fingerprint.js +445 -0
  75. package/src/spec-prompt-template.md +155 -0
  76. package/src/spec-schema.json +219 -0
  77. package/src/spec-store.js +258 -0
  78. package/src/spec-validator.js +459 -0
  79. package/src/static-site-scanner.js +316 -0
  80. package/src/story-candidate-generator.js +85 -0
  81. package/src/story-catalog-generator.js +2813 -0
  82. package/src/story-html.js +156 -0
  83. package/src/story-manager.js +2144 -0
  84. package/src/story-task-generator.js +522 -0
  85. package/src/task-manager.js +1029 -0
  86. package/src/terminal-link-scanner.js +238 -0
  87. package/src/usage-report.js +417 -0
  88. package/src/verification-evidence.js +284 -0
  89. package/src/workspace.js +126 -0
@@ -0,0 +1,233 @@
1
+ import path from 'node:path';
2
+
3
+ import { getAgentReviewStatus } from './agent-review.js';
4
+ import { preparePullRequest } from './pr-manager.js';
5
+
6
+ const CHECKPOINTS = {
7
+ story: {
8
+ label: 'Story / Architecture / Spec checkpoint',
9
+ description: 'Blocks implementation until Story, Architecture, and Spec gates are explicit.',
10
+ gate_ids: ['story', 'architecture', 'spec'],
11
+ review_stages: []
12
+ },
13
+ 'implementation-start': {
14
+ label: 'Implementation Start checkpoint',
15
+ description: 'Blocks coding until design gates and planning/spec reviews are complete.',
16
+ gate_ids: ['story', 'architecture', 'spec', 'gate:requirement'],
17
+ review_stages: ['planning_spec', 'architecture_spec']
18
+ },
19
+ 'test-plan': {
20
+ label: 'Test Plan checkpoint',
21
+ description: 'Blocks implementation handoff until the test plan review is complete.',
22
+ gate_ids: ['story', 'architecture', 'spec', 'gate:requirement'],
23
+ review_stages: ['test_plan']
24
+ },
25
+ 'implementation-complete': {
26
+ label: 'Implementation Complete checkpoint',
27
+ description: 'Blocks completion until implementation review and runtime gates are complete.',
28
+ gate_ids: ['gate:network_contract', 'gate:requirement', 'gate:unit', 'gate:integration', 'gate:e2e', 'gate:visual_qa'],
29
+ review_stages: ['implementation']
30
+ },
31
+ verification: {
32
+ label: 'Verification checkpoint',
33
+ description: 'Blocks PR handoff until verification, gate review, and current-head evidence are complete.',
34
+ gate_ids: [
35
+ 'gate:pr_route_classification',
36
+ 'gate:pr_body_contract',
37
+ 'gate:mirror_source_traceability',
38
+ 'gate:ci_status_or_waiver',
39
+ 'gate:vibepro_artifact_policy',
40
+ 'gate:split_resolution',
41
+ 'gate:network_contract',
42
+ 'gate:unit',
43
+ 'gate:integration',
44
+ 'gate:e2e',
45
+ 'gate:visual_qa'
46
+ ],
47
+ review_stages: ['gate']
48
+ },
49
+ pr: {
50
+ label: 'PR checkpoint',
51
+ description: 'Blocks PR creation until every required Gate DAG item is complete.',
52
+ gate_ids: null,
53
+ review_stages: []
54
+ }
55
+ };
56
+
57
+ const UNRESOLVED_STATUSES = new Set([
58
+ 'candidate',
59
+ 'missing',
60
+ 'transient',
61
+ 'implicit',
62
+ 'inferred_empty',
63
+ 'needs_evidence',
64
+ 'needs_setup',
65
+ 'needs_review',
66
+ 'needs_rebase',
67
+ 'needs_changes',
68
+ 'contradicted',
69
+ 'stale',
70
+ 'block',
71
+ 'failed',
72
+ 'not_generated'
73
+ ]);
74
+
75
+ export function listCheckpointStages() {
76
+ return Object.entries(CHECKPOINTS).map(([stage, policy]) => ({
77
+ stage,
78
+ label: policy.label,
79
+ description: policy.description,
80
+ gate_ids: policy.gate_ids,
81
+ review_stages: policy.review_stages
82
+ }));
83
+ }
84
+
85
+ export async function runCheckpoint(repoRoot, options = {}) {
86
+ const stage = normalizeCheckpointStage(options.stage);
87
+ const root = path.resolve(repoRoot);
88
+ const policy = CHECKPOINTS[stage];
89
+ const prepareResult = await preparePullRequest(root, {
90
+ storyId: options.storyId,
91
+ taskId: options.taskId,
92
+ groupId: options.groupId,
93
+ baseRef: options.baseRef,
94
+ headRef: options.headRef,
95
+ branchName: options.branchName,
96
+ strict: options.strict,
97
+ allowExtraFiles: options.allowExtraFiles,
98
+ language: options.language
99
+ });
100
+ const preparation = prepareResult.preparation;
101
+ const gateDag = preparation.pr_context?.gate_dag ?? null;
102
+ const gateFindings = collectCheckpointGateFindings(gateDag, policy);
103
+ const reviewFindings = await collectCheckpointReviewFindings(root, preparation.story.story_id, policy);
104
+ const findings = [...gateFindings, ...reviewFindings];
105
+ const status = findings.some((finding) => finding.severity === 'block') ? 'blocked' : 'passed';
106
+ return {
107
+ schema_version: '0.1.0',
108
+ stage,
109
+ label: policy.label,
110
+ description: policy.description,
111
+ status,
112
+ story_id: preparation.story.story_id,
113
+ generated_at: new Date().toISOString(),
114
+ required_gate_ids: policy.gate_ids ?? 'all_required',
115
+ required_review_stages: policy.review_stages,
116
+ findings,
117
+ artifacts: prepareResult.artifacts,
118
+ gate_dag_summary: gateDag ? {
119
+ overall_status: gateDag.overall_status,
120
+ needs_evidence_count: gateDag.summary?.needs_evidence_count ?? 0,
121
+ required_gate_count: gateDag.summary?.required_gate_count ?? 0
122
+ } : null,
123
+ next_actions: findings.map((finding) => finding.action).filter(Boolean)
124
+ };
125
+ }
126
+
127
+ export function renderCheckpointSummary(result) {
128
+ const lines = [
129
+ '# VibePro Checkpoint',
130
+ '',
131
+ `- stage: ${result.stage}`,
132
+ `- status: ${result.status}`,
133
+ `- story: ${result.story_id}`,
134
+ `- gate_dag: ${result.gate_dag_summary?.overall_status ?? '-'}`,
135
+ `- findings: ${result.findings.length}`,
136
+ ''
137
+ ];
138
+ if (result.findings.length > 0) {
139
+ lines.push('## Blocking Findings', '');
140
+ for (const finding of result.findings) {
141
+ lines.push(`- ${finding.kind}: ${finding.label} is ${finding.status} - ${finding.reason}`);
142
+ if (finding.action) lines.push(` action: ${finding.action}`);
143
+ }
144
+ lines.push('');
145
+ }
146
+ if (result.next_actions.length > 0) {
147
+ lines.push('## Next Actions', '');
148
+ for (const action of result.next_actions) {
149
+ lines.push(`- ${action}`);
150
+ }
151
+ lines.push('');
152
+ }
153
+ return `${lines.join('\n')}\n`;
154
+ }
155
+
156
+ function normalizeCheckpointStage(stage) {
157
+ const normalized = stage ?? 'pr';
158
+ if (!CHECKPOINTS[normalized]) {
159
+ throw new Error(`Unknown checkpoint stage: ${normalized}. Supported stages: ${Object.keys(CHECKPOINTS).join(', ')}`);
160
+ }
161
+ return normalized;
162
+ }
163
+
164
+ function collectCheckpointGateFindings(gateDag, policy) {
165
+ if (!gateDag) {
166
+ return [{
167
+ kind: 'gate_dag_missing',
168
+ severity: 'block',
169
+ label: 'Gate DAG',
170
+ status: 'missing',
171
+ reason: 'Gate DAG could not be generated',
172
+ action: 'Run `vibepro pr prepare` and resolve setup errors.'
173
+ }];
174
+ }
175
+ const gates = policy.gate_ids === null
176
+ ? gateDag.nodes.filter((node) => node.required === true)
177
+ : policy.gate_ids
178
+ .map((id) => gateDag.nodes.find((node) => node.id === id))
179
+ .filter(Boolean)
180
+ .filter((node) => node.required !== false);
181
+ return gates
182
+ .filter((gate) => UNRESOLVED_STATUSES.has(gate.status))
183
+ .map((gate) => ({
184
+ kind: 'gate_unresolved',
185
+ severity: 'block',
186
+ gate_id: gate.id,
187
+ label: gate.label ?? gate.id,
188
+ status: gate.status,
189
+ reason: gate.reason ?? 'Gate is unresolved',
190
+ action: buildGateAction(gate)
191
+ }));
192
+ }
193
+
194
+ async function collectCheckpointReviewFindings(root, storyId, policy) {
195
+ const findings = [];
196
+ for (const stage of policy.review_stages) {
197
+ const status = await getAgentReviewStatus(root, { storyId, stage });
198
+ const stageSummary = status.stages.find((item) => item.stage === stage);
199
+ if (stageSummary?.status === 'pass') continue;
200
+ findings.push({
201
+ kind: 'review_stage_unresolved',
202
+ severity: 'block',
203
+ review_stage: stage,
204
+ label: `Agent Review ${stage}`,
205
+ status: stageSummary?.status ?? 'missing',
206
+ reason: stageSummary
207
+ ? `${stageSummary.missing_count ?? 0} missing, ${stageSummary.stale_count ?? 0} stale, ${stageSummary.block_count ?? 0} blocking review role(s)`
208
+ : 'Agent review stage was not generated',
209
+ action: `Run \`vibepro review prepare . --id ${storyId} --stage ${stage}\`, dispatch the generated Codex/Claude Code subagents in parallel, close/shutdown every review subagent after receiving its result, record every role with parallel_subagent provenance and --agent-closed, then rerun this checkpoint.`
210
+ });
211
+ }
212
+ return findings;
213
+ }
214
+
215
+ function buildGateAction(gate) {
216
+ if (gate.id === 'story') return 'Create or select an explicit Story before continuing.';
217
+ if (gate.id === 'architecture') return 'Add an ADR or explicit architecture decision before implementation.';
218
+ if (gate.id === 'spec') return 'Write or regenerate the internal Spec before implementation.';
219
+ if (gate.id === 'gate:requirement') return 'Resolve Requirement Gate gaps or contradictions in Story/Spec/Architecture.';
220
+ if (gate.id === 'gate:unit') return `Record current-head unit evidence: \`vibepro verify record . --kind unit --status pass --command "${gate.command ?? 'npm test'}"\`.`;
221
+ if (gate.id === 'gate:integration') return `Record current-head integration evidence: \`vibepro verify record . --kind integration --status pass --command "${gate.command ?? 'npm run typecheck'}"\`.`;
222
+ if (gate.id === 'gate:e2e') return 'Record current-head E2E evidence and Story acceptance coverage.';
223
+ if (gate.id === 'gate:visual_qa') return 'Record Visual QA evidence for the current UI state.';
224
+ if (gate.id === 'gate:network_contract') return 'Resolve API route/network contract findings or record network-aware E2E evidence.';
225
+ if (gate.id === 'gate:pr_route_classification') return 'Resolve PR route classification before PR handoff.';
226
+ if (gate.id === 'gate:pr_body_contract') return 'Resolve the route-specific PR body contract before PR handoff.';
227
+ if (gate.id === 'gate:mirror_source_traceability') return 'Add source PR, source commit, or upstream ref evidence for mirror/release routes.';
228
+ if (gate.id === 'gate:ci_status_or_waiver') return 'Add target CI, source CI inheritance, or an explicit waiver for mirror/release routes.';
229
+ if (gate.id === 'gate:vibepro_artifact_policy') return 'Record an explicit policy decision for committed `.vibepro/` diagnostic artifacts.';
230
+ if (gate.id === 'gate:split_resolution') return 'Resolve or explicitly justify the split/clean-branch recommendation.';
231
+ if (gate.id === 'gate:agent_review') return 'Run required Agent Review stages with Codex/Claude Code parallel subagents, close/shutdown every review subagent after receiving its result, then record provenance with --agent-closed.';
232
+ return `Resolve ${gate.label ?? gate.id}.`;
233
+ }