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,194 @@
1
+ // Resolve which MUST-HAVE design diagrams a change requires.
2
+ // Inputs: { story: { ac_count, ac_keywords }, code_diff: { files, deps_added } }
3
+ // Output: { required_diagrams: [...kind], reasons: [{ kind, signal }] }
4
+ // Each rule is pure and order-independent. See docs/specs/vibepro-must-have-diagram-gate.md.
5
+
6
+ const QUEUE_DEPS = new Set([
7
+ 'bullmq', 'bull', 'kafkajs', 'nats', '@aws-sdk/client-sqs', 'amqplib', 'redis-streams'
8
+ ]);
9
+ const STREAM_DEPS = new Set([
10
+ 'kafkajs', '@aws-sdk/client-kinesis', 'nats', 'inngest', '@trigger.dev/sdk', 'temporal', '@temporalio/client'
11
+ ]);
12
+ const THIRD_PARTY_PREFIXES = [
13
+ 'stripe', 'twilio', 'sendgrid', '@slack/', '@google-cloud/', '@aws-sdk/', '@azure/', 'octokit', '@octokit/'
14
+ ];
15
+ const SECURITY_DEPS = new Set([
16
+ 'bcrypt', 'argon2', 'jose', 'passport', 'next-auth', '@auth/', 'stripe', 'jsonwebtoken'
17
+ ]);
18
+ const PII_KEYWORDS = ['email', 'phone', 'ssn', 'tax_id', 'dob', 'address', 'payment', 'credit_card'];
19
+ const SECURITY_PATH_KEYWORDS = ['auth', 'login', 'oauth', 'session', 'jwt', 'password', 'permission', 'policy', 'rbac', 'acl'];
20
+ const FLOW_KEYWORDS = ['checkout', 'onboarding', 'wizard', 'multi-step', 'flow', 'purchase', 'signup'];
21
+ const IAC_EXT = /\.(tf|tfvars)$/;
22
+ const IAC_PATH = /^(infra|pulumi|terraform)\//;
23
+ const DEPLOY_CONFIGS = new Set(['fly.toml', 'vercel.json', 'serverless.yml', 'serverless.yaml', 'wrangler.toml']);
24
+ const K8S_KIND_RE = /kind:\s*(Deployment|StatefulSet|DaemonSet|Service|Ingress|CronJob)/;
25
+
26
+ export function resolveRequiredDiagrams(input) {
27
+ const story = input?.story ?? { ac_count: 0, ac_keywords: [] };
28
+ const codeDiff = input?.code_diff ?? { files: [], deps_added: [] };
29
+ const files = Array.isArray(codeDiff.files) ? codeDiff.files : [];
30
+ const deps = Array.isArray(codeDiff.deps_added) ? codeDiff.deps_added : [];
31
+
32
+ const reasons = [];
33
+ const add = (kind, signal) => reasons.push({ kind, signal });
34
+
35
+ for (const rule of RULES) rule({ story, files, deps, add });
36
+
37
+ const required_diagrams = [...new Set(reasons.map((r) => r.kind))];
38
+ return { required_diagrams, reasons };
39
+ }
40
+
41
+ const RULES = [
42
+ // R1: ER for schema changes
43
+ ({ files, add }) => {
44
+ for (const f of files) {
45
+ const p = f.path ?? '';
46
+ if (p === 'prisma/schema.prisma' || /^prisma\/schema\.prisma$/.test(p)) {
47
+ add('er', `schema file modified: ${p}`);
48
+ return;
49
+ }
50
+ if (/^db\/migrations\//.test(p) || /^migrations\//.test(p)) {
51
+ add('er', `migration added: ${p}`);
52
+ return;
53
+ }
54
+ if (/\.sql$/.test(p)) {
55
+ const content = f.content ?? '';
56
+ if (/CREATE\s+TABLE|ALTER\s+TABLE/i.test(content) || !content) {
57
+ add('er', `SQL file changed: ${p}`);
58
+ return;
59
+ }
60
+ }
61
+ }
62
+ },
63
+
64
+ // R2: state machine for status / state changes
65
+ ({ files, add }) => {
66
+ for (const f of files) {
67
+ const p = f.path ?? '';
68
+ const c = f.content ?? '';
69
+ if (/xstate|state-machine|workflow/i.test(p)) {
70
+ add('state', `state machine file: ${p}`);
71
+ return;
72
+ }
73
+ if (/enum\s+\w*(Status|State)\b/.test(c) || /\b(status|state)\s+\w*Enum\b/i.test(c)) {
74
+ add('state', `status/state enum in ${p}`);
75
+ return;
76
+ }
77
+ if (/model\s+\w+\s*\{[^}]*\b(status|state)\b\s+\w+/m.test(c)) {
78
+ add('state', `status/state field declared in ${p}`);
79
+ return;
80
+ }
81
+ }
82
+ },
83
+
84
+ // R3: sequence for inter-actor messaging
85
+ ({ files, deps, add }) => {
86
+ for (const f of files) {
87
+ const p = f.path ?? '';
88
+ if (/\/webhook(s)?\//.test(p) || /webhook\.[tj]sx?$/.test(p)) {
89
+ add('sequence', `webhook route: ${p}`);
90
+ return;
91
+ }
92
+ }
93
+ for (const d of deps) {
94
+ if (QUEUE_DEPS.has(d)) {
95
+ add('sequence', `queue/messaging dep added: ${d}`);
96
+ return;
97
+ }
98
+ if (THIRD_PARTY_PREFIXES.some((prefix) => d === prefix || d.startsWith(prefix))) {
99
+ add('sequence', `3rd party SDK added: ${d}`);
100
+ return;
101
+ }
102
+ }
103
+ },
104
+
105
+ // R4: flow for multi-step user workflows
106
+ ({ story, files, add }) => {
107
+ const keywords = Array.isArray(story.ac_keywords) ? story.ac_keywords : [];
108
+ const acCount = Number(story.ac_count ?? 0);
109
+ if (acCount >= 3 && keywords.some((k) => FLOW_KEYWORDS.includes(String(k).toLowerCase()))) {
110
+ add('flow', `Story.AC count ${acCount} with workflow keyword`);
111
+ return;
112
+ }
113
+ for (const f of files) {
114
+ const p = (f.path ?? '').toLowerCase();
115
+ if (/\/(checkout|onboarding|wizard)\//.test(p)) {
116
+ add('flow', `workflow path: ${f.path}`);
117
+ return;
118
+ }
119
+ }
120
+ },
121
+
122
+ // R5: C4 context for new service boundaries
123
+ ({ files, add }) => {
124
+ for (const f of files) {
125
+ const p = f.path ?? '';
126
+ if (f.status === 'added' && /^packages\/[^/]+\/package\.json$/.test(p)) {
127
+ add('c4_context', `new package boundary: ${p}`);
128
+ return;
129
+ }
130
+ if (f.status === 'added' && /^services\/[^/]+\//.test(p)) {
131
+ add('c4_context', `new service directory: ${p}`);
132
+ return;
133
+ }
134
+ }
135
+ },
136
+
137
+ // R6: deployment for IaC changes
138
+ ({ files, add }) => {
139
+ for (const f of files) {
140
+ const p = f.path ?? '';
141
+ if (IAC_EXT.test(p) || IAC_PATH.test(p)) {
142
+ add('deployment', `IaC file: ${p}`);
143
+ return;
144
+ }
145
+ if (DEPLOY_CONFIGS.has(p)) {
146
+ add('deployment', `deploy config: ${p}`);
147
+ return;
148
+ }
149
+ if (/\.ya?ml$/.test(p) && K8S_KIND_RE.test(f.content ?? '')) {
150
+ add('deployment', `k8s manifest: ${p}`);
151
+ return;
152
+ }
153
+ }
154
+ },
155
+
156
+ // R7: threat model for security-sensitive changes
157
+ ({ files, deps, add }) => {
158
+ for (const f of files) {
159
+ const p = (f.path ?? '').toLowerCase();
160
+ if (SECURITY_PATH_KEYWORDS.some((kw) => p.includes(kw))) {
161
+ add('threat_model', `security-sensitive path: ${f.path}`);
162
+ return;
163
+ }
164
+ const content = String(f.content ?? '').toLowerCase();
165
+ if (PII_KEYWORDS.some((kw) => content.includes(kw))) {
166
+ add('threat_model', `PII column hint in ${f.path}`);
167
+ return;
168
+ }
169
+ }
170
+ for (const d of deps) {
171
+ if (SECURITY_DEPS.has(d) || THIRD_PARTY_PREFIXES.some((prefix) => d === prefix && (prefix === 'stripe'))) {
172
+ add('threat_model', `security/payment dep added: ${d}`);
173
+ return;
174
+ }
175
+ }
176
+ },
177
+
178
+ // R8: DFD for async pipelines
179
+ ({ files, deps, add }) => {
180
+ for (const f of files) {
181
+ const p = (f.path ?? '').toLowerCase();
182
+ if (/(^|\/)cron(\/|$|s?\.)/.test(p) || /\/(pipeline|etl|ingest|stream)\//.test(p)) {
183
+ add('dfd', `async pipeline path: ${f.path}`);
184
+ return;
185
+ }
186
+ }
187
+ for (const d of deps) {
188
+ if (STREAM_DEPS.has(d)) {
189
+ add('dfd', `stream/event dep added: ${d}`);
190
+ return;
191
+ }
192
+ }
193
+ }
194
+ ];