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.
- package/LICENSE +21 -0
- package/README.md +407 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +2519 -0
- package/dist/core/adapters.d.ts +31 -0
- package/dist/core/adapters.js +478 -0
- package/dist/core/agent-adapter.d.ts +67 -0
- package/dist/core/agent-adapter.js +312 -0
- package/dist/core/anti-cheat.d.ts +6 -0
- package/dist/core/anti-cheat.js +372 -0
- package/dist/core/badge.d.ts +18 -0
- package/dist/core/badge.js +360 -0
- package/dist/core/cache.d.ts +47 -0
- package/dist/core/cache.js +403 -0
- package/dist/core/ci-export.d.ts +35 -0
- package/dist/core/ci-export.js +796 -0
- package/dist/core/ci-formats.d.ts +21 -0
- package/dist/core/ci-formats.js +388 -0
- package/dist/core/client-codegen.d.ts +36 -0
- package/dist/core/client-codegen.js +2538 -0
- package/dist/core/compose.d.ts +71 -0
- package/dist/core/compose.js +1088 -0
- package/dist/core/diff.d.ts +10 -0
- package/dist/core/diff.js +207 -0
- package/dist/core/docs-export.d.ts +37 -0
- package/dist/core/docs-export.js +2706 -0
- package/dist/core/doctor.d.ts +70 -0
- package/dist/core/doctor.js +525 -0
- package/dist/core/errors.d.ts +32 -0
- package/dist/core/errors.js +81 -0
- package/dist/core/exec.d.ts +38 -0
- package/dist/core/exec.js +336 -0
- package/dist/core/fixtures.d.ts +153 -0
- package/dist/core/fixtures.js +2245 -0
- package/dist/core/format.d.ts +77 -0
- package/dist/core/format.js +632 -0
- package/dist/core/fs-snapshot.d.ts +37 -0
- package/dist/core/fs-snapshot.js +216 -0
- package/dist/core/graphql-export.d.ts +34 -0
- package/dist/core/graphql-export.js +2482 -0
- package/dist/core/har-export.d.ts +29 -0
- package/dist/core/har-export.js +988 -0
- package/dist/core/html-report.d.ts +27 -0
- package/dist/core/html-report.js +1535 -0
- package/dist/core/http-export.d.ts +31 -0
- package/dist/core/http-export.js +726 -0
- package/dist/core/impact.d.ts +80 -0
- package/dist/core/impact.js +1412 -0
- package/dist/core/lint.d.ts +38 -0
- package/dist/core/lint.js +1111 -0
- package/dist/core/load-export.d.ts +37 -0
- package/dist/core/load-export.js +1813 -0
- package/dist/core/mcp-export.d.ts +35 -0
- package/dist/core/mcp-export.js +1736 -0
- package/dist/core/mock-server.d.ts +47 -0
- package/dist/core/mock-server.js +1722 -0
- package/dist/core/openapi-export.d.ts +44 -0
- package/dist/core/openapi-export.js +1074 -0
- package/dist/core/parity.d.ts +14 -0
- package/dist/core/parity.js +173 -0
- package/dist/core/playwright-exporter.d.ts +23 -0
- package/dist/core/playwright-exporter.js +1343 -0
- package/dist/core/png.d.ts +7 -0
- package/dist/core/png.js +339 -0
- package/dist/core/regression.d.ts +54 -0
- package/dist/core/regression.js +529 -0
- package/dist/core/responsive.d.ts +86 -0
- package/dist/core/responsive.js +606 -0
- package/dist/core/run.d.ts +74 -0
- package/dist/core/run.js +696 -0
- package/dist/core/scheduler.d.ts +24 -0
- package/dist/core/scheduler.js +162 -0
- package/dist/core/schema-export.d.ts +29 -0
- package/dist/core/schema-export.js +2215 -0
- package/dist/core/schema.d.ts +18 -0
- package/dist/core/schema.js +1057 -0
- package/dist/core/security.d.ts +233 -0
- package/dist/core/security.js +1839 -0
- package/dist/core/server-export.d.ts +38 -0
- package/dist/core/server-export.js +3198 -0
- package/dist/core/slices.d.ts +24 -0
- package/dist/core/slices.js +294 -0
- package/dist/core/spec-writer.d.ts +9 -0
- package/dist/core/spec-writer.js +1202 -0
- package/dist/core/store.d.ts +26 -0
- package/dist/core/store.js +217 -0
- package/dist/core/target-map.d.ts +34 -0
- package/dist/core/target-map.js +262 -0
- package/dist/core/test-exporter.d.ts +25 -0
- package/dist/core/test-exporter.js +1918 -0
- package/dist/core/types.d.ts +919 -0
- package/dist/core/types.js +4 -0
- package/dist/core/visual-semantic.d.ts +67 -0
- package/dist/core/visual-semantic.js +673 -0
- package/dist/core/visual.d.ts +34 -0
- package/dist/core/visual.js +508 -0
- package/dist/core/watch.d.ts +78 -0
- package/dist/core/watch.js +495 -0
- package/dist/core/yaml.d.ts +5 -0
- package/dist/core/yaml.js +1009 -0
- package/dist/diagnostics/diagnose.d.ts +53 -0
- package/dist/diagnostics/diagnose.js +1083 -0
- package/dist/diagnostics/flake.d.ts +71 -0
- package/dist/diagnostics/flake.js +608 -0
- package/dist/diagnostics/mutation-audit.d.ts +69 -0
- package/dist/diagnostics/mutation-audit.js +769 -0
- package/dist/diagnostics/spatial.d.ts +42 -0
- package/dist/diagnostics/spatial.js +346 -0
- package/dist/diagnostics/trends.d.ts +122 -0
- package/dist/diagnostics/trends.js +1190 -0
- package/dist/discovery/discover.d.ts +111 -0
- package/dist/discovery/discover.js +2017 -0
- package/dist/discovery/lock.d.ts +116 -0
- package/dist/discovery/lock.js +1505 -0
- package/dist/discovery/routes.d.ts +36 -0
- package/dist/discovery/routes.js +1494 -0
- package/dist/discovery/test-importer.d.ts +92 -0
- package/dist/discovery/test-importer.js +4952 -0
- package/dist/index.d.ts +123 -0
- package/dist/index.js +99 -0
- package/dist/ingestors/api-collections.d.ts +28 -0
- package/dist/ingestors/api-collections.js +2335 -0
- package/dist/ingestors/api-repo.d.ts +6 -0
- package/dist/ingestors/api-repo.js +1120 -0
- package/dist/ingestors/asyncapi.d.ts +26 -0
- package/dist/ingestors/asyncapi.js +2105 -0
- package/dist/ingestors/bridges.d.ts +5 -0
- package/dist/ingestors/bridges.js +1264 -0
- package/dist/ingestors/cli.d.ts +10 -0
- package/dist/ingestors/cli.js +454 -0
- package/dist/ingestors/curl.d.ts +14 -0
- package/dist/ingestors/curl.js +1024 -0
- package/dist/ingestors/graphql.d.ts +56 -0
- package/dist/ingestors/graphql.js +1852 -0
- package/dist/ingestors/http-file.d.ts +20 -0
- package/dist/ingestors/http-file.js +923 -0
- package/dist/ingestors/image.d.ts +2 -0
- package/dist/ingestors/image.js +147 -0
- package/dist/ingestors/index.d.ts +5 -0
- package/dist/ingestors/index.js +577 -0
- package/dist/ingestors/openrpc.d.ts +29 -0
- package/dist/ingestors/openrpc.js +1807 -0
- package/dist/ingestors/proto.d.ts +47 -0
- package/dist/ingestors/proto.js +2690 -0
- package/dist/ingestors/trace.d.ts +10 -0
- package/dist/ingestors/trace.js +599 -0
- package/dist/ingestors/video.d.ts +50 -0
- package/dist/ingestors/video.js +655 -0
- package/dist/ingestors/web.d.ts +40 -0
- package/dist/ingestors/web.js +839 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +3969 -0
- package/dist/oracles/api-repo.d.ts +2 -0
- package/dist/oracles/api-repo.js +286 -0
- package/dist/oracles/cli.d.ts +2 -0
- package/dist/oracles/cli.js +205 -0
- package/dist/oracles/http-workflow.d.ts +68 -0
- package/dist/oracles/http-workflow.js +828 -0
- package/dist/oracles/image.d.ts +2 -0
- package/dist/oracles/image.js +429 -0
- package/dist/oracles/index.d.ts +6 -0
- package/dist/oracles/index.js +320 -0
- package/dist/oracles/perf-budget.d.ts +90 -0
- package/dist/oracles/perf-budget.js +1329 -0
- package/dist/oracles/stream.d.ts +94 -0
- package/dist/oracles/stream.js +1268 -0
- package/dist/oracles/ui-states.d.ts +49 -0
- package/dist/oracles/ui-states.js +894 -0
- package/dist/oracles/video.d.ts +21 -0
- package/dist/oracles/video.js +627 -0
- package/dist/oracles/web.d.ts +2 -0
- package/dist/oracles/web.js +871 -0
- package/dist/plugins/builtins.d.ts +12 -0
- package/dist/plugins/builtins.js +1052 -0
- package/dist/plugins/registry.d.ts +86 -0
- package/dist/plugins/registry.js +554 -0
- package/dist/setup/index.d.ts +7 -0
- package/dist/setup/index.js +298 -0
- package/package.json +54 -4
- package/skills/vibecode-anything/SKILL.md +75 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { VibecodeError, errorMessage } from "../core/errors.js";
|
|
6
|
+
const SERVER_ID = "vibecode-anything";
|
|
7
|
+
const VALID_SCOPES = new Set(["project", "global"]);
|
|
8
|
+
const CLI_PATH = fileURLToPath(new URL("../cli.js", import.meta.url));
|
|
9
|
+
const SKILL_SOURCE = fileURLToPath(new URL("../../skills/vibecode-anything/SKILL.md", import.meta.url));
|
|
10
|
+
function serverEntry(local) {
|
|
11
|
+
return local
|
|
12
|
+
? { command: process.execPath, args: [CLI_PATH, "mcp"] }
|
|
13
|
+
: { command: SERVER_ID, args: ["mcp"] };
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Client layouts. `mcpPath` is the JSON config containing MCP server definitions;
|
|
17
|
+
* `skillPath` is where SKILL.md must land for that client.
|
|
18
|
+
*/
|
|
19
|
+
const CLIENTS = {
|
|
20
|
+
"claude-code": {
|
|
21
|
+
format: "mcpServers",
|
|
22
|
+
alwaysAuto: true,
|
|
23
|
+
layout: ({ scope, cwd, homeDir }) => ({
|
|
24
|
+
mcpPath: scope === "global" ? path.join(homeDir, ".claude.json") : path.join(cwd, ".mcp.json"),
|
|
25
|
+
skillPath: path.join(scope === "global" ? homeDir : cwd, ".claude", "skills", SERVER_ID, "SKILL.md")
|
|
26
|
+
})
|
|
27
|
+
},
|
|
28
|
+
cursor: {
|
|
29
|
+
format: "mcpServers",
|
|
30
|
+
alwaysAuto: true,
|
|
31
|
+
layout: ({ scope, cwd, homeDir }) => ({
|
|
32
|
+
mcpPath: path.join(scope === "global" ? homeDir : cwd, ".cursor", "mcp.json"),
|
|
33
|
+
skillPath: path.join(scope === "global" ? homeDir : cwd, ".cursor", "skills", SERVER_ID, "SKILL.md")
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
antigravity: {
|
|
37
|
+
format: "mcpServers",
|
|
38
|
+
alwaysAuto: true,
|
|
39
|
+
layout: ({ scope, cwd, homeDir, antigravityDir }) => ({
|
|
40
|
+
mcpPath: antigravityDir
|
|
41
|
+
? path.join(antigravityDir, "mcp_config.json")
|
|
42
|
+
: path.join(homeDir, ".gemini", "antigravity", "mcp_config.json"),
|
|
43
|
+
skillPath: scope === "global"
|
|
44
|
+
? path.join(homeDir, ".gemini", "antigravity", "skills", SERVER_ID, "SKILL.md")
|
|
45
|
+
: path.join(cwd, ".agents", "skills", SERVER_ID, "SKILL.md")
|
|
46
|
+
})
|
|
47
|
+
},
|
|
48
|
+
codex: {
|
|
49
|
+
format: "mcpServers",
|
|
50
|
+
layout: ({ scope, cwd, homeDir }) => ({
|
|
51
|
+
mcpPath: path.join(scope === "global" ? homeDir : cwd, ".codex", "mcp.json"),
|
|
52
|
+
skillPath: path.join(scope === "global" ? homeDir : cwd, ".codex", "skills", SERVER_ID, "SKILL.md")
|
|
53
|
+
}),
|
|
54
|
+
detectPaths: ({ cwd, homeDir }) => [
|
|
55
|
+
path.join(cwd, ".codex"),
|
|
56
|
+
path.join(cwd, ".codex", "mcp.json"),
|
|
57
|
+
path.join(homeDir, ".codex"),
|
|
58
|
+
path.join(homeDir, ".codex", "mcp.json")
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
opencode: {
|
|
62
|
+
format: "opencode",
|
|
63
|
+
layout: ({ scope, cwd, homeDir }) => ({
|
|
64
|
+
mcpPath: scope === "global"
|
|
65
|
+
? path.join(homeDir, ".config", "opencode", "opencode.json")
|
|
66
|
+
: path.join(cwd, "opencode.json"),
|
|
67
|
+
skillPath: path.join(scope === "global" ? homeDir : cwd, ".opencode", "skills", SERVER_ID, "SKILL.md")
|
|
68
|
+
}),
|
|
69
|
+
detectPaths: ({ cwd, homeDir }) => [
|
|
70
|
+
path.join(cwd, "opencode.json"),
|
|
71
|
+
path.join(cwd, ".opencode"),
|
|
72
|
+
path.join(homeDir, ".config", "opencode"),
|
|
73
|
+
path.join(homeDir, ".config", "opencode", "opencode.json"),
|
|
74
|
+
path.join(homeDir, ".opencode")
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
windsurf: {
|
|
78
|
+
format: "mcpServers",
|
|
79
|
+
layout: ({ scope, cwd, homeDir }) => ({
|
|
80
|
+
mcpPath: scope === "global"
|
|
81
|
+
? path.join(homeDir, ".codeium", "windsurf", "mcp_config.json")
|
|
82
|
+
: path.join(cwd, ".windsurf", "mcp.json"),
|
|
83
|
+
skillPath: path.join(scope === "global" ? homeDir : cwd, ".windsurf", "skills", SERVER_ID, "SKILL.md")
|
|
84
|
+
}),
|
|
85
|
+
detectPaths: ({ cwd, homeDir }) => [
|
|
86
|
+
path.join(cwd, ".windsurf"),
|
|
87
|
+
path.join(cwd, ".windsurf", "mcp.json"),
|
|
88
|
+
path.join(homeDir, ".codeium", "windsurf"),
|
|
89
|
+
path.join(homeDir, ".codeium", "windsurf", "mcp_config.json"),
|
|
90
|
+
path.join(homeDir, ".windsurf")
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
cline: {
|
|
94
|
+
format: "mcpServers",
|
|
95
|
+
layout: ({ scope, cwd, homeDir }) => ({
|
|
96
|
+
mcpPath: scope === "global"
|
|
97
|
+
? path.join(homeDir, ".cline", "mcp_settings.json")
|
|
98
|
+
: path.join(cwd, ".cline", "mcp.json"),
|
|
99
|
+
skillPath: path.join(scope === "global" ? homeDir : cwd, ".cline", "skills", SERVER_ID, "SKILL.md")
|
|
100
|
+
}),
|
|
101
|
+
detectPaths: ({ cwd, homeDir }) => [
|
|
102
|
+
path.join(cwd, ".cline"),
|
|
103
|
+
path.join(cwd, ".cline", "mcp.json"),
|
|
104
|
+
path.join(homeDir, ".cline"),
|
|
105
|
+
path.join(homeDir, ".cline", "mcp_settings.json")
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
export const SUPPORTED_CLIENTS = Object.keys(CLIENTS);
|
|
110
|
+
function detectAutoClients(ctx) {
|
|
111
|
+
const detected = [];
|
|
112
|
+
for (const name of SUPPORTED_CLIENTS) {
|
|
113
|
+
const def = CLIENTS[name];
|
|
114
|
+
if (def.alwaysAuto) {
|
|
115
|
+
detected.push(name);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (def.detectPaths && def.detectPaths(ctx).some((candidate) => fs.existsSync(candidate))) {
|
|
119
|
+
detected.push(name);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return detected;
|
|
123
|
+
}
|
|
124
|
+
function normalizeClients(input, ctx) {
|
|
125
|
+
const raw = input === undefined || input === null ? ["auto"] : Array.isArray(input) ? input : [input];
|
|
126
|
+
const picked = [];
|
|
127
|
+
for (const item of raw) {
|
|
128
|
+
for (const piece of String(item).split(",")) {
|
|
129
|
+
const client = piece.trim().toLowerCase();
|
|
130
|
+
if (client)
|
|
131
|
+
picked.push(client);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (picked.length === 0)
|
|
135
|
+
picked.push("auto");
|
|
136
|
+
const expanded = [];
|
|
137
|
+
for (const token of picked) {
|
|
138
|
+
if (token === "all") {
|
|
139
|
+
expanded.push(...SUPPORTED_CLIENTS);
|
|
140
|
+
}
|
|
141
|
+
else if (token === "auto") {
|
|
142
|
+
expanded.push(...detectAutoClients(ctx));
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
expanded.push(token);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return [...new Set(expanded)];
|
|
149
|
+
}
|
|
150
|
+
function describeJsonType(value) {
|
|
151
|
+
if (value === null)
|
|
152
|
+
return "null";
|
|
153
|
+
if (Array.isArray(value))
|
|
154
|
+
return "array";
|
|
155
|
+
return typeof value;
|
|
156
|
+
}
|
|
157
|
+
function readJsonIfExists(file) {
|
|
158
|
+
if (!fs.existsSync(file))
|
|
159
|
+
return { exists: false, value: null, raw: null };
|
|
160
|
+
if (fs.statSync(file).isDirectory()) {
|
|
161
|
+
throw new VibecodeError("CONFIG_INVALID", `Refusing to overwrite ${file}: path is a directory, expected a JSON file. Move or remove the directory and re-run setup.`, { details: { path: file, reason: "is_directory" } });
|
|
162
|
+
}
|
|
163
|
+
const text = fs.readFileSync(file, "utf8");
|
|
164
|
+
if (!text.trim())
|
|
165
|
+
return { exists: true, value: {}, raw: text };
|
|
166
|
+
let parsed;
|
|
167
|
+
try {
|
|
168
|
+
parsed = JSON.parse(text);
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
const parseError = errorMessage(err);
|
|
172
|
+
throw new VibecodeError("CONFIG_INVALID", `Refusing to overwrite ${file}: existing config is not valid JSON (${parseError}). Fix the JSON syntax or move the file aside, then re-run setup.`, { details: { path: file, reason: "invalid_json", parseError } });
|
|
173
|
+
}
|
|
174
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
175
|
+
const actualType = describeJsonType(parsed);
|
|
176
|
+
throw new VibecodeError("CONFIG_INVALID", `Refusing to overwrite ${file}: expected a top-level JSON object, found ${actualType}. Fix or back up the file before re-running setup.`, { details: { path: file, reason: "non_object_root", actualType } });
|
|
177
|
+
}
|
|
178
|
+
return { exists: true, value: parsed, raw: text };
|
|
179
|
+
}
|
|
180
|
+
/** Deep-merge only our server entry; every other key/server is preserved verbatim. */
|
|
181
|
+
function mergeMcpConfig(existing, server, file, format) {
|
|
182
|
+
const config = existing || {};
|
|
183
|
+
if (format === "opencode") {
|
|
184
|
+
if (Object.prototype.hasOwnProperty.call(config, "mcp") && config.mcp !== undefined) {
|
|
185
|
+
if (!config.mcp || typeof config.mcp !== "object" || Array.isArray(config.mcp)) {
|
|
186
|
+
const actualType = describeJsonType(config.mcp);
|
|
187
|
+
throw new VibecodeError("CONFIG_INVALID", `Refusing to overwrite ${file}: expected "mcp" to be a JSON object, found ${actualType}. Fix or back up the file before re-running setup.`, { details: { path: file, reason: "invalid_mcp", actualType } });
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const prevMcp = config.mcp || {};
|
|
191
|
+
return {
|
|
192
|
+
...config,
|
|
193
|
+
mcp: {
|
|
194
|
+
...prevMcp,
|
|
195
|
+
[SERVER_ID]: {
|
|
196
|
+
type: "local",
|
|
197
|
+
command: [server.command, ...server.args],
|
|
198
|
+
enabled: true
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
if (Object.prototype.hasOwnProperty.call(config, "mcpServers") && config.mcpServers !== undefined) {
|
|
204
|
+
if (!config.mcpServers || typeof config.mcpServers !== "object" || Array.isArray(config.mcpServers)) {
|
|
205
|
+
const actualType = describeJsonType(config.mcpServers);
|
|
206
|
+
throw new VibecodeError("CONFIG_INVALID", `Refusing to overwrite ${file}: expected "mcpServers" to be a JSON object, found ${actualType}. Fix or back up the file before re-running setup.`, { details: { path: file, reason: "invalid_mcp_servers", actualType } });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const prevServers = config.mcpServers || {};
|
|
210
|
+
return { ...config, mcpServers: { ...prevServers, [SERVER_ID]: server } };
|
|
211
|
+
}
|
|
212
|
+
function serialize(value) {
|
|
213
|
+
return JSON.stringify(value, null, 2) + "\n";
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Idempotently register the MCP server + install SKILL.md for coding agents.
|
|
217
|
+
* Never touches anything outside `cwd` / `homeDir` (both injectable for tests).
|
|
218
|
+
*/
|
|
219
|
+
export async function runSetup({ clients = ["auto"], scope = "project", local = false, dryRun = false, cwd = process.cwd(), homeDir = os.homedir(), antigravityDir } = {}) {
|
|
220
|
+
if (!VALID_SCOPES.has(scope)) {
|
|
221
|
+
throw new VibecodeError("CONTRACT_INVALID", `scope must be one of ${[...VALID_SCOPES].join(", ")} (got "${scope}"). Pass --scope project or --scope global.`);
|
|
222
|
+
}
|
|
223
|
+
const resolvedScope = scope;
|
|
224
|
+
if (!fs.existsSync(SKILL_SOURCE)) {
|
|
225
|
+
throw new VibecodeError("CONTRACT_NOT_FOUND", `Bundled SKILL.md is missing at ${SKILL_SOURCE}`);
|
|
226
|
+
}
|
|
227
|
+
const rootDir = path.resolve(cwd);
|
|
228
|
+
const home = path.resolve(homeDir);
|
|
229
|
+
const context = { scope: resolvedScope, cwd: rootDir, homeDir: home, antigravityDir };
|
|
230
|
+
const requested = normalizeClients(clients, context);
|
|
231
|
+
const server = serverEntry(local);
|
|
232
|
+
const skillText = fs.readFileSync(SKILL_SOURCE, "utf8");
|
|
233
|
+
const warnings = [];
|
|
234
|
+
const changes = [];
|
|
235
|
+
const pendingWrites = [];
|
|
236
|
+
const written = [];
|
|
237
|
+
const activeClients = [];
|
|
238
|
+
for (const client of requested) {
|
|
239
|
+
const def = CLIENTS[client];
|
|
240
|
+
if (!def) {
|
|
241
|
+
warnings.push({
|
|
242
|
+
code: "UNKNOWN_CLIENT",
|
|
243
|
+
message: `Unknown client "${client}". Supported clients: ${SUPPORTED_CLIENTS.join(", ")}, "auto", or "all".`,
|
|
244
|
+
client,
|
|
245
|
+
supported: SUPPORTED_CLIENTS
|
|
246
|
+
});
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
activeClients.push(client);
|
|
250
|
+
const { mcpPath, skillPath } = def.layout(context);
|
|
251
|
+
// 1) MCP config (merge, never clobber)
|
|
252
|
+
const existing = readJsonIfExists(mcpPath);
|
|
253
|
+
const merged = mergeMcpConfig(existing.value, server, mcpPath, def.format);
|
|
254
|
+
const desired = serialize(merged);
|
|
255
|
+
const mcpAction = !existing.exists ? "create" : existing.raw === desired ? "unchanged" : "update";
|
|
256
|
+
changes.push({ client, kind: "mcp", path: mcpPath, action: mcpAction });
|
|
257
|
+
if (!dryRun && mcpAction !== "unchanged") {
|
|
258
|
+
pendingWrites.push({ path: mcpPath, content: desired });
|
|
259
|
+
}
|
|
260
|
+
// 2) SKILL.md
|
|
261
|
+
if (fs.existsSync(skillPath) && fs.statSync(skillPath).isDirectory()) {
|
|
262
|
+
throw new VibecodeError("CONFIG_INVALID", `Refusing to overwrite ${skillPath}: path is a directory, expected a file. Move or remove the directory and re-run setup.`, { details: { path: skillPath, reason: "is_directory" } });
|
|
263
|
+
}
|
|
264
|
+
const skillCurrent = fs.existsSync(skillPath) ? fs.readFileSync(skillPath, "utf8") : null;
|
|
265
|
+
const skillAction = skillCurrent === null ? "create" : skillCurrent === skillText ? "unchanged" : "update";
|
|
266
|
+
changes.push({ client, kind: "skill", path: skillPath, action: skillAction });
|
|
267
|
+
if (!dryRun && skillAction !== "unchanged") {
|
|
268
|
+
pendingWrites.push({ path: skillPath, content: skillText });
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (!dryRun) {
|
|
272
|
+
for (const item of pendingWrites) {
|
|
273
|
+
fs.mkdirSync(path.dirname(item.path), { recursive: true });
|
|
274
|
+
fs.writeFileSync(item.path, item.content, "utf8");
|
|
275
|
+
written.push(item.path);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const summary = {
|
|
279
|
+
created: changes.filter((c) => c.action === "create").length,
|
|
280
|
+
updated: changes.filter((c) => c.action === "update").length,
|
|
281
|
+
unchanged: changes.filter((c) => c.action === "unchanged").length,
|
|
282
|
+
written: written.length,
|
|
283
|
+
warnings: warnings.length
|
|
284
|
+
};
|
|
285
|
+
return {
|
|
286
|
+
ok: warnings.length === 0 || activeClients.length > 0,
|
|
287
|
+
dryRun: Boolean(dryRun),
|
|
288
|
+
scope: resolvedScope,
|
|
289
|
+
local: Boolean(local),
|
|
290
|
+
clients: activeClients,
|
|
291
|
+
server,
|
|
292
|
+
skillSource: SKILL_SOURCE,
|
|
293
|
+
summary,
|
|
294
|
+
changes,
|
|
295
|
+
written,
|
|
296
|
+
warnings
|
|
297
|
+
};
|
|
298
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibecode-anything",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"mcpName": "io.github.nguyenthanhthe/vibecode-anything",
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"description": "Vibecode any app from any reference — piece by piece, differentially verified against an automated oracle at every step.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./cli": "./dist/cli.js"
|
|
15
|
+
},
|
|
16
|
+
"bin": {
|
|
17
|
+
"vibecode-anything": "dist/cli.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"skills",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/nguyenthanhthe/vibecode-anything.git"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/nguyenthanhthe/vibecode-anything#readme",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"typecheck:all": "npm run build && tsc -p tsconfig.check.json --noEmit",
|
|
34
|
+
"prepare": "npm run build",
|
|
35
|
+
"start": "node ./dist/cli.js",
|
|
36
|
+
"test": "npm run build && tsc -p tsconfig.check.json --noEmit && node --test ./test/*.test.ts",
|
|
37
|
+
"bench": "npm run build && node benchmarks/run.ts"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"vibecode",
|
|
41
|
+
"ai-agents",
|
|
42
|
+
"mcp",
|
|
43
|
+
"differential-testing",
|
|
44
|
+
"claude-code",
|
|
45
|
+
"agent-skills"
|
|
46
|
+
],
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=20.0.0"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^26.6.11",
|
|
54
|
+
"typescript": "^7.0.2"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vibecode-anything
|
|
3
|
+
description: Differential vibecoding workflow — ingest any reference into .vibecode/contract.json, build incrementally, and verify hard/soft parity with an automated oracle at every step. Use when cloning, rebuilding, or porting CLI, web, API, repo, image, or video behavior.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# vibecode-anything
|
|
7
|
+
|
|
8
|
+
Use this skill to rebuild, clone, port, or verify software against a reference (`cli`, `script`, `web`, `url`, `api`, `repo`, `image`, `video`, `rea`, `cli-anything`, `postman`, `curl`, `graphql`, `http-file`, `insomnia`, `bruno`, `asyncapi`, `proto`, `openrpc`) using **automated differential verification**.
|
|
9
|
+
|
|
10
|
+
## Core loop
|
|
11
|
+
|
|
12
|
+
1. **Discover, Lock, or Ingest Contract & Spec**
|
|
13
|
+
- Inspect workspace: `vibecode-anything discover [--dir <path>] [--pretty]` detects frameworks, routes, specs, entrypoints, ports, and ready-to-run commands.
|
|
14
|
+
- Refactor safety lock: `vibecode-anything lock [--source "<ref>"] [--domain <domain>] [--target "<cmd-or-url>"] [--name <id>] [--force] [--strict] [--no-spec] [--no-verify] [--check] [--pretty]` snapshots golden behavior + `.vibecode/lock.json` (auto-discovering source when omitted; `--check` verifies contract tamper & source drift; shares CLI/web/API probe, route, endpoint, header, env, and `--fs-diff` flags).
|
|
15
|
+
- Starter stub: `vibecode-anything init --domain <cli|web|api> --source "<ref>" [--name <id>] [--force]`
|
|
16
|
+
- Auto-probed v0.2 contract + `.vibecode/SPEC.md`: `vibecode-anything ingest --source "<ref>" [--domain <domain>] [--name <id>] [--force] [--no-spec]`
|
|
17
|
+
- CLI & Trace options: `--probe "<args>"`, `--probes probes.json`, `--env <KEY=VAL>`, `--fs-diff`, `--from-commands <file>`, `--from-tests <path>` (static JS/TS/pytest import; no `--source` needed)
|
|
18
|
+
- Web, API & Video options: `--route /path`, `--crawl-depth <1-3>`, `--holdout-route <path>`, `--flow flow.json`, `--endpoints endpoints.json`, `--base-url <url>`, `--header <Key: Value>`, `--storage-state <file>`, `--from-har <file>`, `--scene-threshold <n>`, `--max-frames <n>`, `--crop <w:h:x:y>`
|
|
19
|
+
|
|
20
|
+
2. **Build Piece by Piece**
|
|
21
|
+
- Follow `.vibecode/SPEC.md` (or `vibecode://spec`); implement one invariant or slice at a time rather than guessing "done".
|
|
22
|
+
|
|
23
|
+
3. **Verify or Run Closed Loop Against the Oracle**
|
|
24
|
+
- `vibecode-anything verify --target "<cmd-or-url>" [--target-map <domain=target>] [--var <KEY=VAL>] [--mode <exact|structural|functional|reskin>] [--concurrency <1-8>] [--plugin <file.mjs>] [--affected] [--strict] [--invariant <id>] [--slice <id>] [--reveal-holdouts] [--no-report] [--no-fixtures] [--allow-fixture-commands] [--cache] [--pretty] [--header <Key: Value>] [--storage-state <file>]` (repeatable `--target-map web=http://localhost:3000` routes each domain, making `--target` optional; `--affected` verifies only git-changed impacted invariants with fail-closed full fallback; repeatable `--var` / `VIBECODE_VAR_*` fill `{{vars.NAME}}` secrets that bypass the cache and are redacted everywhere; `contract.fixtures` auto-snapshot & roll back unless `--no-fixtures`, and command hooks require CLI `--allow-fixture-commands`)
|
|
25
|
+
- `vibecode-anything run --target "<cmd-or-url>" [--target-map <domain=target>] [--var <KEY=VAL>] [--mode <exact|structural|functional|reskin>] [--concurrency <1-8>] [--plugin <file.mjs>] [--source <ref>] [--domain <domain>] [--agent <auto|claude|codex|agy|opencode|mock:script>] [--max-iterations <n>] [--max-minutes <m>] [--slice <id>] [--strict] [--dry-run] [--force] [--no-report] [--no-fixtures] [--allow-fixture-commands] [--cache] [--pretty] [--header <Key: Value>] [--storage-state <file>]` (`--target-map` makes `--target` optional)
|
|
26
|
+
- `vibecode-anything report [--out <file>] [--badge <file.svg>] [--markdown <file.md>] [--sarif <file.sarif>] [--junit <file.xml>] [--no-report]` generates `.vibecode/report.html`, SVG badges, PR Markdown, SARIF 2.1.0, and JUnit XML.
|
|
27
|
+
- `vibecode-anything export-tests [--format <node-test|vitest|pytest|shell|playwright>] [--out <file>] [--target <cmd-or-url>]` emits standalone regression tests (holdouts excluded).
|
|
28
|
+
- `vibecode-anything export-openapi [--format <yaml|json>] [--out <file>] [--name <title>] [--base-url <url>]` compiles HTTP invariants to OpenAPI 3.0.3 specs.
|
|
29
|
+
- `vibecode-anything export-http [--format <http-file|curl|postman>] [--out <file>] [--name <title>] [--base-url <url>]` exports `.http`, cURL, or Postman collections.
|
|
30
|
+
- `vibecode-anything export-client [--format <ts-fetch|python|go>] [--out <file>] [--name <title>] [--base-url <url>] [--pretty]` emits typed TS, Python, or Go clients.
|
|
31
|
+
- `vibecode-anything export-har [--out <file>] [--name <title>] [--base-url <url>] [--pretty]` exports visible HTTP/web routes as a W3C HAR 1.2 archive.
|
|
32
|
+
- `vibecode-anything export-graphql [--format <sdl|introspection>] [--out <file>] [--name <title>] [--pretty]` exports GraphQL SDL or Introspection JSON.
|
|
33
|
+
- `vibecode-anything export-mcp [--format <node-mjs|ts>] [--out <file>] [--name <title>] [--base-url <url>] [--pretty]` compiles a standalone stdio MCP server.
|
|
34
|
+
- `vibecode-anything export-schema [--format <zod|json-schema|typescript>] [--out <file>] [--name <title>] [--strict] [--pretty]` compiles Zod/JSON Schema/TS guards.
|
|
35
|
+
- `vibecode-anything export-load [--format <k6|artillery|node-bench>] [--out <file>] [--name <title>] [--base-url <url>] [--strict] [--pretty]` compiles load suites.
|
|
36
|
+
- `vibecode-anything export-docs [--format <markdown|html|llms-txt>] [--out <file>] [--name <title>] [--base-url <url>] [--strict] [--pretty]` exports docs & `llms.txt`.
|
|
37
|
+
- `vibecode-anything export-ci [--format <github-actions|gitlab-ci|makefile>] [--out <file>] [--name <title>] [--target <cmd-or-url>] [--strict] [--cache] [--pretty]` emits CI parity workflows.
|
|
38
|
+
- `vibecode-anything export-server [--format <node-http|express-ts|python-http>] [--out <file>] [--name <title>] [--port <n>] [--strict] [--pretty]` generates runnable Node, Express TS, or Python HTTP server scaffolds.
|
|
39
|
+
- `vibecode-anything mock [--port <n>] [--dry-run] [--pretty]` serves a deterministic HTTP/web mock server from `.vibecode/contract.json`.
|
|
40
|
+
- API/protocol oracles also verify stateful multi-step `http_workflow` chains (cookies, extraction, `finallySteps`), `http_stream` (SSE/NDJSON), RFC 6455 `ws_protocol` exchanges, and live `perf_budget` latency/payload checks (bypassing cache); `web_ui_states` checks hover/focus, keyboard Tab order & focus traps, disabled/empty/error states, and local/session storage.
|
|
41
|
+
- `--mode <exact|structural|functional|reskin>` selects semantic verification (`reskin` enforces WCAG 2.1 contrast; `web_route` supports `responsiveViewports`); `--concurrency <1-8>` runs bounded parallel verification with deterministic result ordering; `--plugin <file.mjs>` (repeatable, CLI-only) loads workspace-confined ESM plugins alongside built-in `plugin_svg_a11y` and `plugin_state_file`; `--strict` promotes soft mismatches to exit `1`; `--cache` reuses SHA-256 `exact` local passes; `--pretty` formats terminal output; `--reveal-holdouts` is CLI-only (never exposed over MCP).
|
|
42
|
+
- Visible failures include copy-pasteable `repro` commands and `antiCheat` diagnostics.
|
|
43
|
+
|
|
44
|
+
4. **Watch & Diagnose**
|
|
45
|
+
- `vibecode-anything watch --target "<cmd-or-url>" [--target-map <domain=target>] [--var <KEY=VAL>] [--mode <exact|structural|functional|reskin>] [--concurrency <1-8>] [--plugin <file.mjs>] [--smart] [--slice <id>] [--watch-path <dir>] [--debounce <ms>] [--strict] [--no-fixtures] [--allow-fixture-commands] [--cache] [--pretty] [--header <Key: Value>] [--storage-state <file>]` re-verifies on edits while preserving holdouts (`--smart` runs only impacted invariants per edit, skipping docs-only edits).
|
|
46
|
+
- `vibecode-anything diagnose [--brief] [--strict] [--pretty]` triages `.vibecode/last-report.json` into root-cause categories, 3×3 spatial heatmaps, bbox shifts, and a minimal-token repair brief (`--brief`).
|
|
47
|
+
- `vibecode-anything flake --target "<cmd-or-url>" [--target-map <domain=target>] [--var <KEY=VAL>] [--runs <2-10>] [--invariant <id>] [--slice <id>] [--strict] [--reveal-holdouts] [--no-fixtures] [--allow-fixture-commands] [--pretty] [--header <Key: Value>] [--storage-state <file>]` runs multi-pass flake/nondeterminism analysis (bypassing cache) and suggests `expected.normalize` rules.
|
|
48
|
+
- `vibecode-anything doctor [--scope project|global] [--strict] [--antigravity-dir <dir>] [--pretty]` checks Node, adapters, agent CLIs, and MCP registration.
|
|
49
|
+
- `vibecode-anything lint [--strength] [--strict] [--pretty]` audits `.vibecode/contract.json` for exposed secrets, weak checks, slice issues, and (`--strength`) stub-bypass oracle strength.
|
|
50
|
+
|
|
51
|
+
5. **Inspect Status & Diffs**
|
|
52
|
+
- `vibecode-anything status [--trends] [--pretty]` prints contract metadata, holdout/adapter counts, slices, the last report summary, and (`--trends`) `.vibecode/trends.ndjson` sparklines, latency drift & flaky hotspots.
|
|
53
|
+
- `vibecode-anything diff [--invariant <id> | --id <id>] [--baseline <report.json>] [--reveal-holdouts] [--strict] [--pretty]` compares against a baseline report or prints invariant diffs.
|
|
54
|
+
- `vibecode-anything merge --with <contract.json> [--out <file>] [--prefix <p>] [--on-conflict <prefix|overwrite|skip>] [--dry-run] [--no-spec] [--pretty]` composes multi-domain contracts safely.
|
|
55
|
+
- `vibecode-anything help` (or `--help` / `-h` after any subcommand) prints CLI usage safely.
|
|
56
|
+
|
|
57
|
+
## MCP & Setup
|
|
58
|
+
|
|
59
|
+
- Start stdio JSON-RPC 2.0 server: `vibecode-anything mcp` (no stdout log noise).
|
|
60
|
+
- Tools: `vibecode_discover` (`dir`, `maxDepth`, `maxFiles`), `vibecode_lock` (`check`, `noVerify`, auto-discovery when `source` omitted, incl. `asyncapi`/`proto`/`openrpc`; never exposes `revealHoldouts`), `vibecode_ingest` (`noSpec`, `crawlDepth`, `holdoutRoutes`, `fromTests` workspace-confined static test import with optional `target`, plus CLI/web/trace & `asyncapi`/`proto`/`openrpc` API domains), `vibecode_verify` (`affected` git-diff impact filter, `targets` domain map makes `target` optional, redacted `vars`, `mode`, `concurrency`, `sliceIds`, `useCache`, `noReport`, `skipFixtures`, `headers`, `storageState`; records `.vibecode/trends.ndjson` unless `noReport`; built-in `plugin_svg_a11y` & `plugin_state_file` work automatically; never exposes `--plugin`, `allowFixtureCommands`, or `revealHoldouts`), `vibecode_diagnose` (`includeVisualHeatmap`, `maxBriefChars`, `briefOnly`, `includeStrength`), `vibecode_flake` (`target` optional when `targets` given, `targets`, `vars`, `skipFixtures`, `runs`, `invariantIds`, `sliceIds`, `strict`, `headers`, `storageState`; never exposes `revealHoldouts` or `allowFixtureCommands`), `vibecode_report` (`sarifPath`, `junitPath`), `vibecode_status` (`includeTrends`, `trendWindow`), `vibecode_diff` (`invariantId` or `baselinePath`), `vibecode_doctor`.
|
|
61
|
+
- Prompts: `vibecode_rebuild_slice`, `vibecode_fix_failures` (`prompts/list`, `prompts/get`).
|
|
62
|
+
- Resources: `vibecode://contract`, `vibecode://spec`, `vibecode://last-report`, `vibecode://report`.
|
|
63
|
+
- Register MCP + `SKILL.md`: `vibecode-anything setup [--clients auto|all|claude-code,cursor,antigravity,codex,opencode,windsurf,cline] [--scope project|global] [--local] [--dry-run] [--antigravity-dir <dir>]`.
|
|
64
|
+
|
|
65
|
+
## Exit Codes & Gate Semantics
|
|
66
|
+
|
|
67
|
+
- **Exit `0` (`pass` / `pass_with_warnings`):** All evaluated hard invariants pass, `discover` succeeds, `diagnose` is clean, `flake` is stable, or `lock --check` is valid; soft warnings fail only with `--strict`.
|
|
68
|
+
- **Exit `1` (`fail`):** Hard parity or `antiCheat` fails, `--strict` fails a soft check, `diagnose` finds issues, `flake` finds flaky/nondeterministic/failing invariants, `lock` baseline/tamper/overwrite fails, `doctor` fails, or `setup`/`init` hits a conflict.
|
|
69
|
+
- **Exit `2` (`incomplete` / input error):** All invariants skipped (`ADAPTER_MISSING` / all `flake` invariants skipped), invalid flags (`--mode`, `--concurrency`, `--plugin`, `--dir`, `--runs`, `--crawl-depth`, `--crop`, `--env`, `--header`, missing files, combined `--from-commands` / `--from-har` / `--from-tests`), missing target/report/lock/contract/ID, or unknown command.
|
|
70
|
+
|
|
71
|
+
## Rules
|
|
72
|
+
|
|
73
|
+
- Never edit `.vibecode/contract.json` or attempt to locate isolated external holdouts outside the workspace.
|
|
74
|
+
- Secret auth headers are stripped or redacted from `.vibecode/SPEC.md`, `.vibecode/contract.json`, and `repro` (`--var` values print as `<REDACTED>`); CLI probes run in a temp sandbox.
|
|
75
|
+
- Keep `.vibecode/contract.json`, `.vibecode/SPEC.md`, and `.vibecode/last-report.json` as the source of truth.
|