@ufira/vibma 1.0.0 → 1.1.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/README.md +48 -18
- package/dist/mcp.cjs +4805 -331
- package/dist/mcp.js +4821 -319
- package/dist/tools/generated/guards.cjs +72 -3
- package/dist/tools/generated/guards.d.cts +19 -1
- package/dist/tools/generated/guards.d.ts +19 -1
- package/dist/tools/generated/guards.js +63 -3
- package/dist/tools/registry.cjs +224 -54
- package/dist/tools/registry.js +224 -54
- package/dist/tools/types.d.cts +2 -0
- package/dist/tools/types.d.ts +2 -0
- package/dist/utils/coercion.cjs +18 -2
- package/dist/utils/coercion.d.cts +9 -1
- package/dist/utils/coercion.d.ts +9 -1
- package/dist/utils/coercion.js +16 -1
- package/package.json +1 -1
package/dist/tools/types.d.cts
CHANGED
|
@@ -25,6 +25,8 @@ interface ToolDef {
|
|
|
25
25
|
timeout?: number;
|
|
26
26
|
/** Pre-send validation (e.g. per-method item parsing for endpoints) */
|
|
27
27
|
validate?: (params: any) => void;
|
|
28
|
+
/** Async pre-processor — runs before sendCommand. Can transform params (e.g. download imageUrl → base64). */
|
|
29
|
+
preProcess?: (params: any) => Promise<void>;
|
|
28
30
|
/** Custom response formatter. Default: mcpJson */
|
|
29
31
|
formatResponse?: (result: unknown) => any;
|
|
30
32
|
/** Per-method response formatters. Overrides formatResponse for specific methods. */
|
package/dist/tools/types.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ interface ToolDef {
|
|
|
25
25
|
timeout?: number;
|
|
26
26
|
/** Pre-send validation (e.g. per-method item parsing for endpoints) */
|
|
27
27
|
validate?: (params: any) => void;
|
|
28
|
+
/** Async pre-processor — runs before sendCommand. Can transform params (e.g. download imageUrl → base64). */
|
|
29
|
+
preProcess?: (params: any) => Promise<void>;
|
|
28
30
|
/** Custom response formatter. Default: mcpJson */
|
|
29
31
|
formatResponse?: (result: unknown) => any;
|
|
30
32
|
/** Per-method response formatters. Overrides formatResponse for specific methods. */
|
package/dist/utils/coercion.cjs
CHANGED
|
@@ -21,7 +21,8 @@ var coercion_exports = {};
|
|
|
21
21
|
__export(coercion_exports, {
|
|
22
22
|
flexBool: () => flexBool,
|
|
23
23
|
flexJson: () => flexJson,
|
|
24
|
-
flexNum: () => flexNum
|
|
24
|
+
flexNum: () => flexNum,
|
|
25
|
+
flexStringList: () => flexStringList
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(coercion_exports);
|
|
27
28
|
var import_zod = require("zod");
|
|
@@ -40,6 +41,20 @@ var flexJson = (inner) => import_zod.z.preprocess((v) => {
|
|
|
40
41
|
}
|
|
41
42
|
return v;
|
|
42
43
|
}, inner);
|
|
44
|
+
var flexStringList = (inner) => import_zod.z.preprocess((v) => {
|
|
45
|
+
if (Array.isArray(v)) return v;
|
|
46
|
+
if (typeof v === "string") {
|
|
47
|
+
const trimmed = v.trim();
|
|
48
|
+
if (trimmed.startsWith("[")) {
|
|
49
|
+
try {
|
|
50
|
+
return JSON.parse(trimmed);
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return [v];
|
|
55
|
+
}
|
|
56
|
+
return v;
|
|
57
|
+
}, inner);
|
|
43
58
|
var flexNum = (inner) => import_zod.z.preprocess((v) => {
|
|
44
59
|
if (typeof v === "string") {
|
|
45
60
|
const n = Number(v);
|
|
@@ -51,6 +66,7 @@ var flexNum = (inner) => import_zod.z.preprocess((v) => {
|
|
|
51
66
|
0 && (module.exports = {
|
|
52
67
|
flexBool,
|
|
53
68
|
flexJson,
|
|
54
|
-
flexNum
|
|
69
|
+
flexNum,
|
|
70
|
+
flexStringList
|
|
55
71
|
});
|
|
56
72
|
//# sourceMappingURL=coercion.cjs.map
|
|
@@ -4,7 +4,15 @@ import { z } from 'zod';
|
|
|
4
4
|
declare const flexBool: <T extends z.ZodTypeAny>(inner: T) => z.ZodPipe<z.ZodTransform<unknown, unknown>, T>;
|
|
5
5
|
/** Coerce JSON strings to parsed values (for objects/arrays that agents may stringify) */
|
|
6
6
|
declare const flexJson: <T extends z.ZodTypeAny>(inner: T) => z.ZodPipe<z.ZodTransform<any, unknown>, T>;
|
|
7
|
+
/**
|
|
8
|
+
* String-array coercion: accept a JSON array, a JSON-encoded array, or a bare
|
|
9
|
+
* string (wrapped into a single-element array). Use for params that are
|
|
10
|
+
* semantically "one or more strings" — e.g. library.get `query`, selection.set
|
|
11
|
+
* `nodeIds`, lint `rules`. Without this, passing `query:"Button"` fails zod
|
|
12
|
+
* validation even though the docs promise "pass a single string or an array".
|
|
13
|
+
*/
|
|
14
|
+
declare const flexStringList: <T extends z.ZodTypeAny>(inner: T) => z.ZodPipe<z.ZodTransform<any, unknown>, T>;
|
|
7
15
|
/** Coerce numeric strings only when they're valid numbers (safe for use inside unions) */
|
|
8
16
|
declare const flexNum: <T extends z.ZodTypeAny>(inner: T) => z.ZodPipe<z.ZodTransform<unknown, unknown>, T>;
|
|
9
17
|
|
|
10
|
-
export { flexBool, flexJson, flexNum };
|
|
18
|
+
export { flexBool, flexJson, flexNum, flexStringList };
|
package/dist/utils/coercion.d.ts
CHANGED
|
@@ -4,7 +4,15 @@ import { z } from 'zod';
|
|
|
4
4
|
declare const flexBool: <T extends z.ZodTypeAny>(inner: T) => z.ZodPipe<z.ZodTransform<unknown, unknown>, T>;
|
|
5
5
|
/** Coerce JSON strings to parsed values (for objects/arrays that agents may stringify) */
|
|
6
6
|
declare const flexJson: <T extends z.ZodTypeAny>(inner: T) => z.ZodPipe<z.ZodTransform<any, unknown>, T>;
|
|
7
|
+
/**
|
|
8
|
+
* String-array coercion: accept a JSON array, a JSON-encoded array, or a bare
|
|
9
|
+
* string (wrapped into a single-element array). Use for params that are
|
|
10
|
+
* semantically "one or more strings" — e.g. library.get `query`, selection.set
|
|
11
|
+
* `nodeIds`, lint `rules`. Without this, passing `query:"Button"` fails zod
|
|
12
|
+
* validation even though the docs promise "pass a single string or an array".
|
|
13
|
+
*/
|
|
14
|
+
declare const flexStringList: <T extends z.ZodTypeAny>(inner: T) => z.ZodPipe<z.ZodTransform<any, unknown>, T>;
|
|
7
15
|
/** Coerce numeric strings only when they're valid numbers (safe for use inside unions) */
|
|
8
16
|
declare const flexNum: <T extends z.ZodTypeAny>(inner: T) => z.ZodPipe<z.ZodTransform<unknown, unknown>, T>;
|
|
9
17
|
|
|
10
|
-
export { flexBool, flexJson, flexNum };
|
|
18
|
+
export { flexBool, flexJson, flexNum, flexStringList };
|
package/dist/utils/coercion.js
CHANGED
|
@@ -15,6 +15,20 @@ var flexJson = (inner) => z.preprocess((v) => {
|
|
|
15
15
|
}
|
|
16
16
|
return v;
|
|
17
17
|
}, inner);
|
|
18
|
+
var flexStringList = (inner) => z.preprocess((v) => {
|
|
19
|
+
if (Array.isArray(v)) return v;
|
|
20
|
+
if (typeof v === "string") {
|
|
21
|
+
const trimmed = v.trim();
|
|
22
|
+
if (trimmed.startsWith("[")) {
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(trimmed);
|
|
25
|
+
} catch {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return [v];
|
|
29
|
+
}
|
|
30
|
+
return v;
|
|
31
|
+
}, inner);
|
|
18
32
|
var flexNum = (inner) => z.preprocess((v) => {
|
|
19
33
|
if (typeof v === "string") {
|
|
20
34
|
const n = Number(v);
|
|
@@ -25,6 +39,7 @@ var flexNum = (inner) => z.preprocess((v) => {
|
|
|
25
39
|
export {
|
|
26
40
|
flexBool,
|
|
27
41
|
flexJson,
|
|
28
|
-
flexNum
|
|
42
|
+
flexNum,
|
|
43
|
+
flexStringList
|
|
29
44
|
};
|
|
30
45
|
//# sourceMappingURL=coercion.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ufira/vibma",
|
|
3
3
|
"description": "Vibma — Vibe Design meets Figma. AI-powered MCP bridge for designing in Figma.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ufira <https://github.com/ufira-ai>",
|
|
7
7
|
"homepage": "https://github.com/ufira-ai/vibma",
|