one-design-mcp 0.2.0 → 0.2.1
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/dist/server.js +22 -5
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -15,16 +15,33 @@ import path3 from "node:path";
|
|
|
15
15
|
import os3 from "node:os";
|
|
16
16
|
|
|
17
17
|
// src/images.ts
|
|
18
|
-
import
|
|
19
|
-
import { promises as fs } from "node:fs";
|
|
18
|
+
import sharpLib from "sharp";
|
|
19
|
+
import { promises as fs, rmSync, statSync } from "node:fs";
|
|
20
20
|
import path from "node:path";
|
|
21
21
|
import os from "node:os";
|
|
22
|
-
import { execFile } from "node:child_process";
|
|
22
|
+
import { execFile, execFileSync } from "node:child_process";
|
|
23
23
|
import { promisify } from "node:util";
|
|
24
24
|
var EXT = { jpeg: ".jpg", png: ".png", webp: ".webp" };
|
|
25
25
|
var IMAGE_FILE = /\.(jpe?g|png|webp|avif|gif|tiff?|heic|heif)$/i;
|
|
26
26
|
var ToolError = class extends Error {
|
|
27
27
|
};
|
|
28
|
+
var heicCopies = /* @__PURE__ */ new Map();
|
|
29
|
+
process.once("exit", () => heicCopies.forEach((tmp) => rmSync(tmp, { force: true })));
|
|
30
|
+
function decodable(input) {
|
|
31
|
+
if (typeof input !== "string" || !/\.(heic|heif)$/i.test(input) || process.platform !== "darwin") return input;
|
|
32
|
+
const key = `${path.resolve(input)}:${statSync(input, { throwIfNoEntry: false })?.mtimeMs ?? 0}`;
|
|
33
|
+
const known = heicCopies.get(key);
|
|
34
|
+
if (known) return known;
|
|
35
|
+
const tmp = path.join(os.tmpdir(), `one-design-${process.pid}-${heicCopies.size}-${Math.random().toString(36).slice(2, 8)}.jpg`);
|
|
36
|
+
try {
|
|
37
|
+
execFileSync("sips", ["-s", "format", "jpeg", "-s", "formatOptions", "100", input, "--out", tmp], { stdio: "ignore" });
|
|
38
|
+
} catch {
|
|
39
|
+
throw new ToolError(`Couldn\u2019t open ${path.basename(input)} as a HEIC photo. It may be damaged.`);
|
|
40
|
+
}
|
|
41
|
+
heicCopies.set(key, tmp);
|
|
42
|
+
return tmp;
|
|
43
|
+
}
|
|
44
|
+
var sharp = Object.assign((input, options) => sharpLib(decodable(input), options), sharpLib);
|
|
28
45
|
async function openReadable(file) {
|
|
29
46
|
if (!/\.(heic|heif)$/i.test(file)) return { path: file, done: async () => void 0 };
|
|
30
47
|
if (process.platform !== "darwin") throw new ToolError(`${path.basename(file)} is a HEIC photo, which can only be opened here on a Mac. Convert it at https://one.design/heic-convert first.`);
|
|
@@ -320,7 +337,7 @@ function openInBrowser(url) {
|
|
|
320
337
|
}
|
|
321
338
|
function proPitch(what) {
|
|
322
339
|
return [
|
|
323
|
-
`${what} is part of One Design Pro.`,
|
|
340
|
+
`${what} ${/^your |s$/i.test(what) ? "are" : "is"} part of One Design Pro.`,
|
|
324
341
|
`Pro opens every tool (here and on one.design), batches of up to ${LIMITS.pro.batch} files instead of ${LIMITS.free.batch}, ${LIMITS.pro.qrCodes} QR codes at a time, and Brand Libraries.`,
|
|
325
342
|
`Lifetime is \xA3${PRICES.lifetime} once (was \xA3${PRICES.lifetimeWas}), launch price, no subscription.`,
|
|
326
343
|
'Say "buy Pro" and I\u2019ll open checkout (buy_pro). Already bought it? Sign in with that email (sign_in) and it unlocks here.'
|
|
@@ -6203,7 +6220,7 @@ ${notes.join("\n")}` : "");
|
|
|
6203
6220
|
}
|
|
6204
6221
|
|
|
6205
6222
|
// src/server.ts
|
|
6206
|
-
var VERSION = "0.2.
|
|
6223
|
+
var VERSION = "0.2.1";
|
|
6207
6224
|
var server = new McpServer({ name: "one-design", title: "One Design", version: VERSION, websiteUrl: "https://one.design" }, { instructions: INSTRUCTIONS });
|
|
6208
6225
|
var t = toolkit(server);
|
|
6209
6226
|
for (const m of [basics_exports, optimise_exports, privacy_docs_exports, brand_exports, account_exports]) m.register(t);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "one-design-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Every one.design tool for Claude and other MCP apps: compress, resize, convert, privacy, brand, store screenshots, PDFs and more, all on your own computer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|