vibecode-anything 0.0.0-stage → 0.4.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 (180) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +407 -2
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +2519 -0
  5. package/dist/core/adapters.d.ts +31 -0
  6. package/dist/core/adapters.js +478 -0
  7. package/dist/core/agent-adapter.d.ts +67 -0
  8. package/dist/core/agent-adapter.js +312 -0
  9. package/dist/core/anti-cheat.d.ts +6 -0
  10. package/dist/core/anti-cheat.js +372 -0
  11. package/dist/core/badge.d.ts +18 -0
  12. package/dist/core/badge.js +360 -0
  13. package/dist/core/cache.d.ts +47 -0
  14. package/dist/core/cache.js +403 -0
  15. package/dist/core/ci-export.d.ts +35 -0
  16. package/dist/core/ci-export.js +796 -0
  17. package/dist/core/ci-formats.d.ts +21 -0
  18. package/dist/core/ci-formats.js +388 -0
  19. package/dist/core/client-codegen.d.ts +36 -0
  20. package/dist/core/client-codegen.js +2538 -0
  21. package/dist/core/compose.d.ts +71 -0
  22. package/dist/core/compose.js +1088 -0
  23. package/dist/core/diff.d.ts +10 -0
  24. package/dist/core/diff.js +207 -0
  25. package/dist/core/docs-export.d.ts +37 -0
  26. package/dist/core/docs-export.js +2706 -0
  27. package/dist/core/doctor.d.ts +70 -0
  28. package/dist/core/doctor.js +525 -0
  29. package/dist/core/errors.d.ts +32 -0
  30. package/dist/core/errors.js +81 -0
  31. package/dist/core/exec.d.ts +38 -0
  32. package/dist/core/exec.js +336 -0
  33. package/dist/core/fixtures.d.ts +153 -0
  34. package/dist/core/fixtures.js +2245 -0
  35. package/dist/core/format.d.ts +77 -0
  36. package/dist/core/format.js +632 -0
  37. package/dist/core/fs-snapshot.d.ts +37 -0
  38. package/dist/core/fs-snapshot.js +216 -0
  39. package/dist/core/graphql-export.d.ts +34 -0
  40. package/dist/core/graphql-export.js +2482 -0
  41. package/dist/core/har-export.d.ts +29 -0
  42. package/dist/core/har-export.js +988 -0
  43. package/dist/core/html-report.d.ts +27 -0
  44. package/dist/core/html-report.js +1535 -0
  45. package/dist/core/http-export.d.ts +31 -0
  46. package/dist/core/http-export.js +726 -0
  47. package/dist/core/impact.d.ts +80 -0
  48. package/dist/core/impact.js +1412 -0
  49. package/dist/core/lint.d.ts +38 -0
  50. package/dist/core/lint.js +1111 -0
  51. package/dist/core/load-export.d.ts +37 -0
  52. package/dist/core/load-export.js +1813 -0
  53. package/dist/core/mcp-export.d.ts +35 -0
  54. package/dist/core/mcp-export.js +1736 -0
  55. package/dist/core/mock-server.d.ts +47 -0
  56. package/dist/core/mock-server.js +1722 -0
  57. package/dist/core/openapi-export.d.ts +44 -0
  58. package/dist/core/openapi-export.js +1074 -0
  59. package/dist/core/parity.d.ts +14 -0
  60. package/dist/core/parity.js +173 -0
  61. package/dist/core/playwright-exporter.d.ts +23 -0
  62. package/dist/core/playwright-exporter.js +1343 -0
  63. package/dist/core/png.d.ts +7 -0
  64. package/dist/core/png.js +339 -0
  65. package/dist/core/regression.d.ts +54 -0
  66. package/dist/core/regression.js +529 -0
  67. package/dist/core/responsive.d.ts +86 -0
  68. package/dist/core/responsive.js +606 -0
  69. package/dist/core/run.d.ts +74 -0
  70. package/dist/core/run.js +696 -0
  71. package/dist/core/scheduler.d.ts +24 -0
  72. package/dist/core/scheduler.js +162 -0
  73. package/dist/core/schema-export.d.ts +29 -0
  74. package/dist/core/schema-export.js +2215 -0
  75. package/dist/core/schema.d.ts +18 -0
  76. package/dist/core/schema.js +1057 -0
  77. package/dist/core/security.d.ts +233 -0
  78. package/dist/core/security.js +1839 -0
  79. package/dist/core/server-export.d.ts +38 -0
  80. package/dist/core/server-export.js +3198 -0
  81. package/dist/core/slices.d.ts +24 -0
  82. package/dist/core/slices.js +294 -0
  83. package/dist/core/spec-writer.d.ts +9 -0
  84. package/dist/core/spec-writer.js +1202 -0
  85. package/dist/core/store.d.ts +26 -0
  86. package/dist/core/store.js +217 -0
  87. package/dist/core/target-map.d.ts +34 -0
  88. package/dist/core/target-map.js +262 -0
  89. package/dist/core/test-exporter.d.ts +25 -0
  90. package/dist/core/test-exporter.js +1918 -0
  91. package/dist/core/types.d.ts +919 -0
  92. package/dist/core/types.js +4 -0
  93. package/dist/core/visual-semantic.d.ts +67 -0
  94. package/dist/core/visual-semantic.js +673 -0
  95. package/dist/core/visual.d.ts +34 -0
  96. package/dist/core/visual.js +508 -0
  97. package/dist/core/watch.d.ts +78 -0
  98. package/dist/core/watch.js +495 -0
  99. package/dist/core/yaml.d.ts +5 -0
  100. package/dist/core/yaml.js +1009 -0
  101. package/dist/diagnostics/diagnose.d.ts +53 -0
  102. package/dist/diagnostics/diagnose.js +1083 -0
  103. package/dist/diagnostics/flake.d.ts +71 -0
  104. package/dist/diagnostics/flake.js +608 -0
  105. package/dist/diagnostics/mutation-audit.d.ts +69 -0
  106. package/dist/diagnostics/mutation-audit.js +769 -0
  107. package/dist/diagnostics/spatial.d.ts +42 -0
  108. package/dist/diagnostics/spatial.js +346 -0
  109. package/dist/diagnostics/trends.d.ts +122 -0
  110. package/dist/diagnostics/trends.js +1190 -0
  111. package/dist/discovery/discover.d.ts +111 -0
  112. package/dist/discovery/discover.js +2017 -0
  113. package/dist/discovery/lock.d.ts +116 -0
  114. package/dist/discovery/lock.js +1505 -0
  115. package/dist/discovery/routes.d.ts +36 -0
  116. package/dist/discovery/routes.js +1494 -0
  117. package/dist/discovery/test-importer.d.ts +92 -0
  118. package/dist/discovery/test-importer.js +4952 -0
  119. package/dist/index.d.ts +123 -0
  120. package/dist/index.js +99 -0
  121. package/dist/ingestors/api-collections.d.ts +28 -0
  122. package/dist/ingestors/api-collections.js +2335 -0
  123. package/dist/ingestors/api-repo.d.ts +6 -0
  124. package/dist/ingestors/api-repo.js +1120 -0
  125. package/dist/ingestors/asyncapi.d.ts +26 -0
  126. package/dist/ingestors/asyncapi.js +2105 -0
  127. package/dist/ingestors/bridges.d.ts +5 -0
  128. package/dist/ingestors/bridges.js +1264 -0
  129. package/dist/ingestors/cli.d.ts +10 -0
  130. package/dist/ingestors/cli.js +454 -0
  131. package/dist/ingestors/curl.d.ts +14 -0
  132. package/dist/ingestors/curl.js +1024 -0
  133. package/dist/ingestors/graphql.d.ts +56 -0
  134. package/dist/ingestors/graphql.js +1852 -0
  135. package/dist/ingestors/http-file.d.ts +20 -0
  136. package/dist/ingestors/http-file.js +923 -0
  137. package/dist/ingestors/image.d.ts +2 -0
  138. package/dist/ingestors/image.js +147 -0
  139. package/dist/ingestors/index.d.ts +5 -0
  140. package/dist/ingestors/index.js +577 -0
  141. package/dist/ingestors/openrpc.d.ts +29 -0
  142. package/dist/ingestors/openrpc.js +1807 -0
  143. package/dist/ingestors/proto.d.ts +47 -0
  144. package/dist/ingestors/proto.js +2690 -0
  145. package/dist/ingestors/trace.d.ts +10 -0
  146. package/dist/ingestors/trace.js +599 -0
  147. package/dist/ingestors/video.d.ts +50 -0
  148. package/dist/ingestors/video.js +655 -0
  149. package/dist/ingestors/web.d.ts +40 -0
  150. package/dist/ingestors/web.js +839 -0
  151. package/dist/mcp/server.d.ts +2 -0
  152. package/dist/mcp/server.js +3969 -0
  153. package/dist/oracles/api-repo.d.ts +2 -0
  154. package/dist/oracles/api-repo.js +286 -0
  155. package/dist/oracles/cli.d.ts +2 -0
  156. package/dist/oracles/cli.js +205 -0
  157. package/dist/oracles/http-workflow.d.ts +68 -0
  158. package/dist/oracles/http-workflow.js +828 -0
  159. package/dist/oracles/image.d.ts +2 -0
  160. package/dist/oracles/image.js +429 -0
  161. package/dist/oracles/index.d.ts +6 -0
  162. package/dist/oracles/index.js +320 -0
  163. package/dist/oracles/perf-budget.d.ts +90 -0
  164. package/dist/oracles/perf-budget.js +1329 -0
  165. package/dist/oracles/stream.d.ts +94 -0
  166. package/dist/oracles/stream.js +1268 -0
  167. package/dist/oracles/ui-states.d.ts +49 -0
  168. package/dist/oracles/ui-states.js +894 -0
  169. package/dist/oracles/video.d.ts +21 -0
  170. package/dist/oracles/video.js +627 -0
  171. package/dist/oracles/web.d.ts +2 -0
  172. package/dist/oracles/web.js +871 -0
  173. package/dist/plugins/builtins.d.ts +12 -0
  174. package/dist/plugins/builtins.js +1052 -0
  175. package/dist/plugins/registry.d.ts +86 -0
  176. package/dist/plugins/registry.js +554 -0
  177. package/dist/setup/index.d.ts +7 -0
  178. package/dist/setup/index.js +298 -0
  179. package/package.json +54 -4
  180. package/skills/vibecode-anything/SKILL.md +75 -0
@@ -0,0 +1,24 @@
1
+ import type { ContractSlice, ContractV02, ParityReport, SliceStatus, SliceSummary } from "./types.js";
2
+ /** Build deterministic slices from the invariant domains/types in a contract. */
3
+ export declare function deriveDefaultSlices(contract: ContractV02): ContractSlice[];
4
+ /** Return persisted slices when present, otherwise derived defaults. */
5
+ export declare function getContractSlices(contract: ContractV02): ContractSlice[];
6
+ /** Resolve slice IDs (single, comma-separated, or array) to slices and invariant IDs. */
7
+ export declare function resolveSliceInvariants(contract: ContractV02, sliceIds: string | string[]): {
8
+ slices: ContractSlice[];
9
+ invariantIds: string[];
10
+ };
11
+ /**
12
+ * Apply a parity report to slice progress. Untargeted slices are only touched when
13
+ * one of their invariants was actually evaluated in the report.
14
+ */
15
+ export declare function updateSliceProgress(contract: ContractV02, report: ParityReport, options?: {
16
+ sliceIds?: string[];
17
+ timestamp?: string;
18
+ }): ContractV02;
19
+ /** Summarize slice progress and identify the next actionable slice. */
20
+ export declare function summarizeSlices(contract: ContractV02): SliceSummary;
21
+ /** Insert or replace a slice, validating references and dependencies. */
22
+ export declare function addOrUpdateSlice(contract: ContractV02, slice: Omit<ContractSlice, "status"> & {
23
+ status?: SliceStatus;
24
+ }): ContractV02;
@@ -0,0 +1,294 @@
1
+ import { VibecodeError } from "./errors.js";
2
+ import { assertValidContract } from "./schema.js";
3
+ function clone(value) {
4
+ return JSON.parse(JSON.stringify(value));
5
+ }
6
+ const SLICE_RULES = [
7
+ {
8
+ id: "cli-core",
9
+ title: "CLI Commands & Behavior",
10
+ match: (domain, type) => domain === "cli" && type === "command"
11
+ },
12
+ {
13
+ id: "web-routes",
14
+ title: "Web Routes & Landmarks",
15
+ match: (domain, type) => domain === "web" && type === "web_route"
16
+ },
17
+ {
18
+ id: "web-flows",
19
+ title: "Interactive Web Flows & Network",
20
+ match: (domain, type) => domain === "web" && (type === "web_flow" || type === "web_network"),
21
+ dependsOn: ["web-routes"]
22
+ },
23
+ {
24
+ id: "api-endpoints",
25
+ title: "HTTP API Endpoints",
26
+ match: (domain, type) => domain === "api" && type === "http"
27
+ },
28
+ {
29
+ id: "repo-exports",
30
+ title: "Repository Exports",
31
+ match: (domain, type) => domain === "repo" && type === "repo_exports"
32
+ },
33
+ {
34
+ id: "image-layout",
35
+ title: "Image Dimensions & Layout",
36
+ match: (domain, type) => domain === "image" && type === "image_layout"
37
+ },
38
+ {
39
+ id: "image-perceptual",
40
+ title: "Image Perceptual Similarity",
41
+ match: (domain, type) => domain === "image" && type === "image_perceptual",
42
+ dependsOn: ["image-layout"]
43
+ },
44
+ {
45
+ id: "video-timeline",
46
+ title: "Video State Timeline & Motion",
47
+ match: (domain, type) => domain === "video" && type === "video_timeline"
48
+ }
49
+ ];
50
+ /** Build deterministic slices from the invariant domains/types in a contract. */
51
+ export function deriveDefaultSlices(contract) {
52
+ const severityById = new Map();
53
+ for (const inv of contract.invariants || []) {
54
+ severityById.set(inv.id, inv.severity);
55
+ }
56
+ const hardFirst = (a, b) => {
57
+ const aHard = severityById.get(a) === "hard" ? 0 : 1;
58
+ const bHard = severityById.get(b) === "hard" ? 0 : 1;
59
+ return aHard - bHard;
60
+ };
61
+ const slices = [];
62
+ const byId = new Map();
63
+ for (const rule of SLICE_RULES) {
64
+ const matches = (contract.invariants || [])
65
+ .filter((inv) => rule.match(inv.domain, inv.type))
66
+ .map((inv) => inv.id)
67
+ .sort(hardFirst);
68
+ if (matches.length === 0)
69
+ continue;
70
+ const slice = {
71
+ id: rule.id,
72
+ title: rule.title,
73
+ invariantIds: matches,
74
+ status: "pending"
75
+ };
76
+ const deps = rule.dependsOn;
77
+ if (deps && slices.some((s) => deps.includes(s.id))) {
78
+ slice.dependsOn = [...deps];
79
+ }
80
+ slices.push(slice);
81
+ byId.set(slice.id, slice);
82
+ }
83
+ const usedIds = new Set(slices.flatMap((s) => s.invariantIds));
84
+ for (const inv of contract.invariants || []) {
85
+ if (usedIds.has(inv.id))
86
+ continue;
87
+ const id = `${inv.domain}-${inv.type}`;
88
+ let slice = byId.get(id);
89
+ if (!slice) {
90
+ slice = {
91
+ id,
92
+ title: `${inv.domain} ${inv.type.replace(/_/g, " ")}`,
93
+ invariantIds: [],
94
+ status: "pending"
95
+ };
96
+ slices.push(slice);
97
+ byId.set(id, slice);
98
+ }
99
+ slice.invariantIds.push(inv.id);
100
+ }
101
+ for (const slice of slices) {
102
+ slice.invariantIds.sort(hardFirst);
103
+ }
104
+ return slices;
105
+ }
106
+ /** Return persisted slices when present, otherwise derived defaults. */
107
+ export function getContractSlices(contract) {
108
+ if (Array.isArray(contract.slices) && contract.slices.length > 0) {
109
+ return clone(contract.slices);
110
+ }
111
+ return deriveDefaultSlices(contract);
112
+ }
113
+ function parseSliceIds(sliceIds) {
114
+ const raw = Array.isArray(sliceIds)
115
+ ? sliceIds
116
+ : typeof sliceIds === "string"
117
+ ? sliceIds.split(",")
118
+ : [];
119
+ const out = [];
120
+ const seen = new Set();
121
+ for (const value of raw) {
122
+ const id = String(value).trim();
123
+ if (id && !seen.has(id)) {
124
+ seen.add(id);
125
+ out.push(id);
126
+ }
127
+ }
128
+ return out;
129
+ }
130
+ /** Resolve slice IDs (single, comma-separated, or array) to slices and invariant IDs. */
131
+ export function resolveSliceInvariants(contract, sliceIds) {
132
+ const requested = parseSliceIds(sliceIds);
133
+ if (requested.length === 0) {
134
+ throw new VibecodeError("TARGET_MISSING", "At least one slice id is required");
135
+ }
136
+ const available = getContractSlices(contract);
137
+ const byId = new Map(available.map((slice) => [slice.id, slice]));
138
+ const unknown = requested.filter((id) => !byId.has(id));
139
+ if (unknown.length > 0) {
140
+ const valid = available.map((slice) => slice.id);
141
+ throw new VibecodeError("NOT_FOUND", `Unknown slice id(s): ${unknown.join(", ")}. Valid slice ids: ${valid.length > 0 ? valid.join(", ") : "(none)"}`, { details: { unknown, valid } });
142
+ }
143
+ const slices = requested.map((id) => clone(byId.get(id)));
144
+ const invariantIds = [];
145
+ const seen = new Set();
146
+ for (const slice of slices) {
147
+ for (const id of slice.invariantIds) {
148
+ if (!seen.has(id)) {
149
+ seen.add(id);
150
+ invariantIds.push(id);
151
+ }
152
+ }
153
+ }
154
+ return { slices, invariantIds };
155
+ }
156
+ function clampScore(value) {
157
+ const bounded = Math.min(1, Math.max(0, value));
158
+ return Math.round(bounded * 10000) / 10000;
159
+ }
160
+ /**
161
+ * Apply a parity report to slice progress. Untargeted slices are only touched when
162
+ * one of their invariants was actually evaluated in the report.
163
+ */
164
+ export function updateSliceProgress(contract, report, options = {}) {
165
+ const results = new Map();
166
+ for (const result of report.results || []) {
167
+ results.set(result.id, result);
168
+ }
169
+ const targeted = options.sliceIds && options.sliceIds.length > 0 ? new Set(options.sliceIds) : null;
170
+ const timestamp = options.timestamp ?? report.timestamp ?? new Date().toISOString();
171
+ const updated = getContractSlices(contract);
172
+ const nextSlices = updated.map((slice) => {
173
+ const isTargeted = targeted !== null && targeted.has(slice.id);
174
+ const evaluated = slice.invariantIds
175
+ .map((id) => results.get(id))
176
+ .filter((entry) => entry !== undefined);
177
+ const hasEvaluated = evaluated.length > 0;
178
+ if (!hasEvaluated) {
179
+ if (isTargeted) {
180
+ const next = { ...slice, status: "skipped" };
181
+ delete next.lastScore;
182
+ return next;
183
+ }
184
+ return slice;
185
+ }
186
+ const anyFailure = evaluated.some((result) => result.status === "fail" || result.status === "error");
187
+ const allSkipped = evaluated.every((result) => result.status === "skipped");
188
+ const allEvaluated = evaluated.length === slice.invariantIds.length;
189
+ const nonSkipped = evaluated.filter((result) => result.status !== "skipped");
190
+ const allPassOrWarn = nonSkipped.every((result) => result.status === "pass" || result.status === "warn");
191
+ let status;
192
+ if (allSkipped) {
193
+ status = "skipped";
194
+ }
195
+ else if (anyFailure) {
196
+ status = "failed";
197
+ }
198
+ else if (allEvaluated && allPassOrWarn) {
199
+ status = "passed";
200
+ }
201
+ else {
202
+ status = "in_progress";
203
+ }
204
+ const next = { ...slice, status, lastVerifiedAt: timestamp };
205
+ if (nonSkipped.length === 0) {
206
+ delete next.lastScore;
207
+ }
208
+ else {
209
+ const scores = nonSkipped.map((result) => (typeof result.score === "number" ? result.score : 0));
210
+ next.lastScore = clampScore(scores.reduce((sum, value) => sum + value, 0) / scores.length);
211
+ }
212
+ return next;
213
+ });
214
+ const nextContract = clone(contract);
215
+ nextContract.slices = nextSlices;
216
+ return nextContract;
217
+ }
218
+ /** Summarize slice progress and identify the next actionable slice. */
219
+ export function summarizeSlices(contract) {
220
+ const slices = getContractSlices(contract);
221
+ const summary = {
222
+ total: slices.length,
223
+ passed: 0,
224
+ failed: 0,
225
+ inProgress: 0,
226
+ pending: 0,
227
+ skipped: 0,
228
+ completionRatio: 0,
229
+ nextSlice: null,
230
+ slices: []
231
+ };
232
+ const items = slices.map((slice) => {
233
+ switch (slice.status) {
234
+ case "passed":
235
+ summary.passed += 1;
236
+ break;
237
+ case "failed":
238
+ summary.failed += 1;
239
+ break;
240
+ case "in_progress":
241
+ summary.inProgress += 1;
242
+ break;
243
+ case "skipped":
244
+ summary.skipped += 1;
245
+ break;
246
+ default:
247
+ summary.pending += 1;
248
+ break;
249
+ }
250
+ return {
251
+ id: slice.id,
252
+ title: slice.title,
253
+ status: slice.status,
254
+ invariantCount: slice.invariantIds.length,
255
+ dependsOn: slice.dependsOn ? [...slice.dependsOn] : [],
256
+ ...(slice.lastVerifiedAt ? { lastVerifiedAt: slice.lastVerifiedAt } : {}),
257
+ ...(slice.lastScore !== undefined ? { lastScore: slice.lastScore } : {})
258
+ };
259
+ });
260
+ summary.completionRatio = summary.total > 0 ? summary.passed / summary.total : 0;
261
+ const notPassed = slices.filter((slice) => slice.status !== "passed");
262
+ const byId = new Map(slices.map((candidate) => [candidate.id, candidate]));
263
+ const ready = notPassed.find((slice) => {
264
+ const deps = slice.dependsOn || [];
265
+ return deps.every((dep) => byId.get(dep)?.status === "passed");
266
+ });
267
+ summary.nextSlice = (ready || notPassed[0])?.id ?? null;
268
+ summary.slices = items;
269
+ return summary;
270
+ }
271
+ /** Insert or replace a slice, validating references and dependencies. */
272
+ export function addOrUpdateSlice(contract, slice) {
273
+ const next = clone(contract);
274
+ const slices = getContractSlices(next);
275
+ const incoming = {
276
+ id: slice.id,
277
+ title: slice.title,
278
+ invariantIds: [...slice.invariantIds],
279
+ status: slice.status ?? "pending",
280
+ ...(slice.description !== undefined ? { description: slice.description } : {}),
281
+ ...(slice.dependsOn !== undefined ? { dependsOn: [...slice.dependsOn] } : {}),
282
+ ...(slice.lastVerifiedAt !== undefined ? { lastVerifiedAt: slice.lastVerifiedAt } : {}),
283
+ ...(slice.lastScore !== undefined ? { lastScore: slice.lastScore } : {}),
284
+ ...(slice.notes !== undefined ? { notes: slice.notes } : {})
285
+ };
286
+ const index = slices.findIndex((entry) => entry.id === incoming.id);
287
+ if (index >= 0)
288
+ slices[index] = incoming;
289
+ else
290
+ slices.push(incoming);
291
+ next.slices = slices;
292
+ assertValidContract(next);
293
+ return next;
294
+ }
@@ -0,0 +1,9 @@
1
+ import type { ContractV02 } from "./types.js";
2
+ export declare const MAX_GOLDEN_CHARS = 4096;
3
+ export interface WriteSpecOptions {
4
+ contract: ContractV02;
5
+ holdoutCount?: number;
6
+ outPath?: string;
7
+ }
8
+ export declare function buildSpecMarkdown(contract: ContractV02, holdoutCount?: number): string;
9
+ export declare function writeSpecFile(workspaceDir: string, options: WriteSpecOptions): string;