inkmap-mcp 0.3.4 → 0.3.6
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/bundles/antigravity/plugin.json +5 -5
- package/dist/bundles/antigravity/sidecars/inkmap/main.mjs +114 -21
- package/dist/bundles/codex/inkmap-codex/.codex-plugin/plugin.json +28 -3
- package/dist/bundles/codex/inkmap-codex/plugin.json +28 -3
- package/dist/bundles/harness/host.js +123 -22
- package/dist/bundles/harness/package.json +9 -1
- package/dist/bundles/vscode/dist/extension.js +203 -139
- package/dist/bundles/vscode/package.json +3 -11
- package/dist/bundles/vscode/package.nls.json +2 -4
- package/dist/bundles/vscode/package.nls.zh-cn.json +2 -4
- package/dist/cli.cjs +158 -69
- package/dist/codex.html +228 -228
- package/dist/web/app.js +7122 -7108
- package/package.json +23 -4
- package/server.json +14 -5
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "inkmap-vscode",
|
|
3
3
|
"displayName": "%displayName%",
|
|
4
4
|
"description": "%description%",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.6",
|
|
6
6
|
"publisher": "inkmap",
|
|
7
7
|
"homepage": "https://zhiyuanv.com/software.html",
|
|
8
8
|
"repository": {
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"latex",
|
|
42
42
|
"preview",
|
|
43
43
|
"cursor",
|
|
44
|
+
"trae",
|
|
44
45
|
"claude",
|
|
45
46
|
"codex",
|
|
46
47
|
"mcp",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"脑图",
|
|
49
50
|
"大纲",
|
|
50
51
|
"流程图",
|
|
52
|
+
"架构图",
|
|
51
53
|
"组织结构图",
|
|
52
54
|
"时间轴",
|
|
53
55
|
"鱼骨图",
|
|
@@ -118,16 +120,6 @@
|
|
|
118
120
|
"command": "inkmap.upgrade",
|
|
119
121
|
"title": "%command.upgrade%",
|
|
120
122
|
"category": "Inkmap"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"command": "inkmap.restorePro",
|
|
124
|
-
"title": "%command.restorePro%",
|
|
125
|
-
"category": "Inkmap"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"command": "inkmap.signOut",
|
|
129
|
-
"title": "%command.signOut%",
|
|
130
|
-
"category": "Inkmap"
|
|
131
123
|
}
|
|
132
124
|
],
|
|
133
125
|
"keybindings": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"displayName": "Inkmap — Markdown Mind Map &
|
|
3
|
-
"description": "Interactive two-way Markdown mind map (markmap) & Mermaid flowchart editor with LaTeX
|
|
2
|
+
"displayName": "Inkmap — Markdown Mind Map & Mermaid 思维导图 / 脑图",
|
|
3
|
+
"description": "Interactive two-way Markdown mind map (markmap) & Mermaid flowchart editor with LaTeX, XMind outline sync & PNG/SVG export | 双向编辑思维导图、脑图、流程图、大纲",
|
|
4
4
|
"virtualWorkspaces": "Inkmap edits Markdown files on disk.",
|
|
5
5
|
"editor.displayName": "Inkmap Mind Map",
|
|
6
6
|
"command.open": "Open as Inkmap",
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
"command.showSource": "Open Markdown to the Side",
|
|
10
10
|
"command.addToChat": "Add to Chat",
|
|
11
11
|
"command.upgrade": "Get Inkmap Pro",
|
|
12
|
-
"command.restorePro": "Sign In / Restore Pro",
|
|
13
|
-
"command.signOut": "Sign Out",
|
|
14
12
|
"config.billingOrigin": "HTTPS origin of the Inkmap checkout service.",
|
|
15
13
|
"config.browser": "Browser used by “Open Mind Map in Browser”",
|
|
16
14
|
"config.browser.chrome": "Google Chrome (falls back to the default browser when not found)",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"displayName": "Inkmap 墨图 — Markdown 思维导图 / 脑图 / Markmap
|
|
3
|
-
"description": "将 Markdown (.md / .markmap.md)
|
|
2
|
+
"displayName": "Inkmap 墨图 — Markdown 思维导图 / 脑图 / Markmap & Mermaid 流程图",
|
|
3
|
+
"description": "将 Markdown (.md / .markmap.md) 实时双向编辑为思维导图、脑图大纲与架构图,原生支持 Mermaid 流程图、LaTeX 公式、XMind 快捷键与高清 PNG/SVG 导出。",
|
|
4
4
|
"virtualWorkspaces": "Inkmap 需要编辑磁盘上的 Markdown 文件。",
|
|
5
5
|
"editor.displayName": "Inkmap 思维导图",
|
|
6
6
|
"command.open": "Open as Inkmap",
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
"command.showSource": "在侧边打开 Markdown",
|
|
10
10
|
"command.addToChat": "添加到对话",
|
|
11
11
|
"command.upgrade": "升级到 Inkmap Pro",
|
|
12
|
-
"command.restorePro": "登录账号 / 恢复 Pro",
|
|
13
|
-
"command.signOut": "退出登录",
|
|
14
12
|
"config.billingOrigin": "Inkmap 收费服务的 HTTPS 地址。",
|
|
15
13
|
"config.browser": "“在浏览器中打开思维导图”使用的浏览器",
|
|
16
14
|
"config.browser.chrome": "用 Google Chrome 打开(找不到时改用默认浏览器)",
|
package/dist/cli.cjs
CHANGED
|
@@ -114,6 +114,54 @@ var init_dist = __esm({
|
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
// packages/cli/dist/license.js
|
|
117
|
+
function detectOsLocale() {
|
|
118
|
+
const explicit = (process.env.INKMAP_LOCALE || "").trim();
|
|
119
|
+
if (/^zh\b/i.test(explicit))
|
|
120
|
+
return "zh";
|
|
121
|
+
if (/^en\b/i.test(explicit))
|
|
122
|
+
return "en";
|
|
123
|
+
if (cachedOsLocale)
|
|
124
|
+
return cachedOsLocale;
|
|
125
|
+
let domestic = false;
|
|
126
|
+
try {
|
|
127
|
+
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone || "";
|
|
128
|
+
if (/^(Asia\/(Shanghai|Chongqing|Chungking|Harbin|Urumqi|Beijing)|PRC)$/i.test(tz)) {
|
|
129
|
+
domestic = true;
|
|
130
|
+
}
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
if (!domestic) {
|
|
134
|
+
if (process.platform === "darwin") {
|
|
135
|
+
try {
|
|
136
|
+
const out = (0, import_node_child_process.execFileSync)("defaults", ["read", "-g", "AppleLanguages"], {
|
|
137
|
+
encoding: "utf8",
|
|
138
|
+
timeout: 800,
|
|
139
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
140
|
+
});
|
|
141
|
+
const firstLang = /"([^"]+)"/.exec(out)?.[1] ?? "";
|
|
142
|
+
if (/^zh\b/i.test(firstLang))
|
|
143
|
+
domestic = true;
|
|
144
|
+
} catch {
|
|
145
|
+
const raw = (process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
|
|
146
|
+
if (/^zh\b/i.test(raw))
|
|
147
|
+
domestic = true;
|
|
148
|
+
}
|
|
149
|
+
} else if (process.platform === "win32") {
|
|
150
|
+
try {
|
|
151
|
+
const loc = Intl.DateTimeFormat().resolvedOptions().locale || "";
|
|
152
|
+
if (/^zh\b/i.test(loc))
|
|
153
|
+
domestic = true;
|
|
154
|
+
} catch {
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
const raw = (process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
|
|
158
|
+
if (/^zh\b/i.test(raw))
|
|
159
|
+
domestic = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
cachedOsLocale = domestic ? "zh" : "en";
|
|
163
|
+
return cachedOsLocale;
|
|
164
|
+
}
|
|
117
165
|
function billingOrigin(raw) {
|
|
118
166
|
if (!raw)
|
|
119
167
|
throw new Error("Inkmap checkout is not configured.");
|
|
@@ -142,6 +190,13 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
142
190
|
let pendingWrite = Promise.resolve();
|
|
143
191
|
let pendingCheckout;
|
|
144
192
|
let cachedOrder;
|
|
193
|
+
let magicPollTimer;
|
|
194
|
+
let magicSession = 0;
|
|
195
|
+
function stopMagicPoll() {
|
|
196
|
+
++magicSession;
|
|
197
|
+
clearTimeout(magicPollTimer);
|
|
198
|
+
magicPollTimer = void 0;
|
|
199
|
+
}
|
|
145
200
|
function mergeCookies(existing, response) {
|
|
146
201
|
const map2 = /* @__PURE__ */ new Map();
|
|
147
202
|
if (existing) {
|
|
@@ -177,24 +232,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
177
232
|
return "zh";
|
|
178
233
|
if (/^en\b/i.test(h2))
|
|
179
234
|
return "en";
|
|
180
|
-
|
|
181
|
-
if (/^zh\b/i.test(envLocale))
|
|
182
|
-
return "zh";
|
|
183
|
-
if (/^en\b/i.test(envLocale))
|
|
184
|
-
return "en";
|
|
185
|
-
const raw = (process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
|
|
186
|
-
if (/^zh\b/i.test(raw))
|
|
187
|
-
return "zh";
|
|
188
|
-
try {
|
|
189
|
-
const opts = Intl.DateTimeFormat().resolvedOptions();
|
|
190
|
-
if (/^zh\b/i.test(opts.locale || ""))
|
|
191
|
-
return "zh";
|
|
192
|
-
const tz = opts.timeZone || "";
|
|
193
|
-
if (/^(Asia\/(Shanghai|Chongqing|Chungking|Harbin|Urumqi|Beijing)|PRC)$/i.test(tz))
|
|
194
|
-
return "zh";
|
|
195
|
-
} catch {
|
|
196
|
-
}
|
|
197
|
-
return "en";
|
|
235
|
+
return detectOsLocale();
|
|
198
236
|
}
|
|
199
237
|
function writeSession(operation) {
|
|
200
238
|
const next = pendingWrite.then(operation);
|
|
@@ -355,7 +393,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
355
393
|
if (version2 !== generation || disposed)
|
|
356
394
|
return;
|
|
357
395
|
applyEntitlement(state);
|
|
358
|
-
delay = state.active !== true && state.pending === true ?
|
|
396
|
+
delay = state.active !== true && state.pending === true ? 2500 : 6e4;
|
|
359
397
|
} catch {
|
|
360
398
|
if (version2 === generation && Date.now() - lastCheck > 15 * 6e4)
|
|
361
399
|
update(false);
|
|
@@ -368,6 +406,49 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
368
406
|
});
|
|
369
407
|
return connection;
|
|
370
408
|
}
|
|
409
|
+
function startMagicPoll(origin, pendingToken) {
|
|
410
|
+
stopMagicPoll();
|
|
411
|
+
const id = magicSession;
|
|
412
|
+
const deadline = Date.now() + 10 * 6e4;
|
|
413
|
+
const poll = () => {
|
|
414
|
+
if (disposed || id !== magicSession || Date.now() >= deadline)
|
|
415
|
+
return;
|
|
416
|
+
magicPollTimer = setTimeout(async () => {
|
|
417
|
+
if (disposed || id !== magicSession)
|
|
418
|
+
return;
|
|
419
|
+
try {
|
|
420
|
+
const res = await entitlement(origin, pendingToken);
|
|
421
|
+
if (disposed || id !== magicSession)
|
|
422
|
+
return;
|
|
423
|
+
if (res.status === 401) {
|
|
424
|
+
stopMagicPoll();
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if (res.ok) {
|
|
428
|
+
const body = await res.json();
|
|
429
|
+
if (body?.connected === true && body.entitlement === PRODUCT.entitlement) {
|
|
430
|
+
stopMagicPoll();
|
|
431
|
+
await writeSession(async () => {
|
|
432
|
+
if (disposed || origin !== billingOrigin(getOrigin()))
|
|
433
|
+
return;
|
|
434
|
+
await storage.write(JSON.stringify({ origin, token: pendingToken }));
|
|
435
|
+
++generation;
|
|
436
|
+
activeOrigin = origin;
|
|
437
|
+
applyEntitlement(body);
|
|
438
|
+
schedule(body.active === true ? 6e4 : 2500);
|
|
439
|
+
});
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
} catch {
|
|
444
|
+
}
|
|
445
|
+
if (!disposed && id === magicSession && Date.now() < deadline)
|
|
446
|
+
poll();
|
|
447
|
+
}, 2e3);
|
|
448
|
+
magicPollTimer.unref();
|
|
449
|
+
};
|
|
450
|
+
poll();
|
|
451
|
+
}
|
|
371
452
|
return {
|
|
372
453
|
async state() {
|
|
373
454
|
await (trial ??= startTrial());
|
|
@@ -530,7 +611,14 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
530
611
|
}
|
|
531
612
|
}
|
|
532
613
|
const response = await phoneRequest(origin, "send", phone, void 0, locale);
|
|
533
|
-
|
|
614
|
+
if (response.status === 204) {
|
|
615
|
+
const pendingToken = response.headers.get("x-inkmap-pending-token")?.trim();
|
|
616
|
+
if (pendingToken && /^[A-Za-z0-9_-]{43}$/.test(pendingToken)) {
|
|
617
|
+
startMagicPoll(origin, pendingToken);
|
|
618
|
+
}
|
|
619
|
+
return { ok: true, value: void 0 };
|
|
620
|
+
}
|
|
621
|
+
return phoneFailure(response.status);
|
|
534
622
|
} catch {
|
|
535
623
|
return phoneFailure();
|
|
536
624
|
}
|
|
@@ -614,6 +702,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
614
702
|
return await writeSession(async () => {
|
|
615
703
|
if (version2 !== generation || disposed || origin !== billingOrigin(getOrigin()))
|
|
616
704
|
return phoneFailure();
|
|
705
|
+
stopMagicPoll();
|
|
617
706
|
await storage.write(JSON.stringify({ origin, token, ...checkoutUrl && { checkoutUrl }, ...cookie && { cookie } }));
|
|
618
707
|
++generation;
|
|
619
708
|
activeOrigin = origin;
|
|
@@ -628,6 +717,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
628
717
|
}
|
|
629
718
|
},
|
|
630
719
|
async deactivate() {
|
|
720
|
+
stopMagicPoll();
|
|
631
721
|
pendingCheckout = void 0;
|
|
632
722
|
cachedOrder = void 0;
|
|
633
723
|
const saved = await writeSession(async () => {
|
|
@@ -705,7 +795,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
705
795
|
installId: id,
|
|
706
796
|
host: hostName,
|
|
707
797
|
os,
|
|
708
|
-
version: "0.3.
|
|
798
|
+
version: "0.3.6",
|
|
709
799
|
locale: clientLocale(),
|
|
710
800
|
tier,
|
|
711
801
|
events
|
|
@@ -719,6 +809,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
719
809
|
},
|
|
720
810
|
dispose() {
|
|
721
811
|
disposed = true;
|
|
812
|
+
stopMagicPoll();
|
|
722
813
|
clearTimeout(trialTimer);
|
|
723
814
|
clearTimeout(timer);
|
|
724
815
|
clearTimeout(telemetryTimer);
|
|
@@ -826,10 +917,11 @@ function adFeed(url2) {
|
|
|
826
917
|
}
|
|
827
918
|
};
|
|
828
919
|
}
|
|
829
|
-
var import_promises, import_node_crypto, import_node_os, import_node_path, AD_TTL;
|
|
920
|
+
var import_node_child_process, import_promises, import_node_crypto, import_node_os, import_node_path, cachedOsLocale, AD_TTL;
|
|
830
921
|
var init_license = __esm({
|
|
831
922
|
"packages/cli/dist/license.js"() {
|
|
832
923
|
"use strict";
|
|
924
|
+
import_node_child_process = require("node:child_process");
|
|
833
925
|
import_promises = require("node:fs/promises");
|
|
834
926
|
import_node_crypto = require("node:crypto");
|
|
835
927
|
import_node_os = require("node:os");
|
|
@@ -1103,8 +1195,16 @@ data: ${JSON.stringify(data)}
|
|
|
1103
1195
|
if (!full)
|
|
1104
1196
|
return json2(res, 403, { error: "forbidden" });
|
|
1105
1197
|
try {
|
|
1198
|
+
const ext = (0, import_node_path2.extname)(full).toLowerCase();
|
|
1199
|
+
if (ext === ".html") {
|
|
1200
|
+
const osLoc = detectOsLocale();
|
|
1201
|
+
const htmlText = (await (0, import_promises2.readFile)(full, "utf8")).replace(/<html\b([^>]*)>/i, `<html lang="${osLoc === "zh" ? "zh-CN" : "en"}" data-os-locale="${osLoc}">`);
|
|
1202
|
+
res.writeHead(200, { "content-type": TYPES[".html"], "cache-control": "no-store" });
|
|
1203
|
+
res.end(htmlText, "utf8");
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1106
1206
|
const body = await (0, import_promises2.readFile)(full);
|
|
1107
|
-
res.writeHead(200, { "content-type": TYPES[
|
|
1207
|
+
res.writeHead(200, { "content-type": TYPES[ext] ?? "application/octet-stream", "cache-control": sidebar ? "no-store" : "no-cache" });
|
|
1108
1208
|
res.end(body);
|
|
1109
1209
|
} catch {
|
|
1110
1210
|
json2(res, 404, { error: "not found" });
|
|
@@ -1312,6 +1412,7 @@ var init_server = __esm({
|
|
|
1312
1412
|
import_node_http = require("node:http");
|
|
1313
1413
|
import_node_os2 = require("node:os");
|
|
1314
1414
|
import_node_path2 = require("node:path");
|
|
1415
|
+
init_license();
|
|
1315
1416
|
SKIP_SCAN_DIRS = /* @__PURE__ */ new Set([
|
|
1316
1417
|
".git",
|
|
1317
1418
|
".hg",
|
|
@@ -39796,15 +39897,19 @@ function openSystemBrowser(url2) {
|
|
|
39796
39897
|
if (process.env.INKMAP_NO_OPEN === "1")
|
|
39797
39898
|
return;
|
|
39798
39899
|
const [cmd, args] = process.platform === "darwin" ? ["open", [url2]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url2]] : ["xdg-open", [url2]];
|
|
39799
|
-
(0,
|
|
39900
|
+
(0, import_node_child_process2.spawn)(cmd, args, { stdio: "ignore", detached: true }).unref();
|
|
39800
39901
|
}
|
|
39801
39902
|
async function createInkmapMcpServer(options = {}) {
|
|
39802
|
-
const loadHtml = async () =>
|
|
39803
|
-
|
|
39804
|
-
|
|
39805
|
-
|
|
39806
|
-
|
|
39807
|
-
|
|
39903
|
+
const loadHtml = async () => {
|
|
39904
|
+
const raw = options.html ?? await (0, import_promises4.readFile)(HTML, "utf8").catch((error62) => {
|
|
39905
|
+
if (error62.code === "ENOENT") {
|
|
39906
|
+
throw new Error("MCP App editor assets are missing. Run npm run build:sidebars.");
|
|
39907
|
+
}
|
|
39908
|
+
throw error62;
|
|
39909
|
+
});
|
|
39910
|
+
const osLoc = detectOsLocale();
|
|
39911
|
+
return raw.replace(/<html\b([^>]*)>/i, `<html lang="${osLoc === "zh" ? "zh-CN" : "en"}" data-os-locale="${osLoc}">`);
|
|
39912
|
+
};
|
|
39808
39913
|
await loadHtml();
|
|
39809
39914
|
const billingOrigin2 = options.billingOrigin ?? (() => process.env.INKMAP_BILLING_ORIGIN || YUNFAN_BILLING_ORIGIN);
|
|
39810
39915
|
const billing = licenseService(fileSessionStorage(), billingOrigin2, { loginOnly: true });
|
|
@@ -39812,7 +39917,7 @@ async function createInkmapMcpServer(options = {}) {
|
|
|
39812
39917
|
const fallbackEditors = /* @__PURE__ */ new Map();
|
|
39813
39918
|
const ads = adFeed(PRODUCT.adFeedUrl);
|
|
39814
39919
|
const workspaces = createMcpWorkspaceManager();
|
|
39815
|
-
const server = new McpServer({ name: "inkmap", version: "0.3.
|
|
39920
|
+
const server = new McpServer({ name: "inkmap", version: "0.3.6" });
|
|
39816
39921
|
function isAntigravityHost() {
|
|
39817
39922
|
const clientName = server.server.getClientVersion()?.name ?? "";
|
|
39818
39923
|
if (/antigravity/i.test(clientName))
|
|
@@ -40128,14 +40233,14 @@ async function serveCodex() {
|
|
|
40128
40233
|
};
|
|
40129
40234
|
await server.connect(transport);
|
|
40130
40235
|
}
|
|
40131
|
-
var
|
|
40236
|
+
var import_node_child_process2, import_node_fs2, import_promises4, import_node_os4, import_node_path4, import_node_url2, UI, HTML, WEB_ROOT, INLINE_DOC_LIMIT, appOnly;
|
|
40132
40237
|
var init_codex = __esm({
|
|
40133
40238
|
"packages/cli/dist/codex.js"() {
|
|
40134
40239
|
"use strict";
|
|
40135
40240
|
init_mcp();
|
|
40136
40241
|
init_stdio2();
|
|
40137
40242
|
init_server4();
|
|
40138
|
-
|
|
40243
|
+
import_node_child_process2 = require("node:child_process");
|
|
40139
40244
|
import_node_fs2 = require("node:fs");
|
|
40140
40245
|
import_promises4 = require("node:fs/promises");
|
|
40141
40246
|
import_node_os4 = require("node:os");
|
|
@@ -40248,24 +40353,7 @@ function normalizeTarget(raw) {
|
|
|
40248
40353
|
return null;
|
|
40249
40354
|
}
|
|
40250
40355
|
function isChineseTerminalLocale() {
|
|
40251
|
-
|
|
40252
|
-
if (explicit.startsWith("zh"))
|
|
40253
|
-
return true;
|
|
40254
|
-
if (explicit.startsWith("en"))
|
|
40255
|
-
return false;
|
|
40256
|
-
const envLang = (process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").toLowerCase();
|
|
40257
|
-
if (envLang.startsWith("zh"))
|
|
40258
|
-
return true;
|
|
40259
|
-
try {
|
|
40260
|
-
const loc = Intl.DateTimeFormat().resolvedOptions().locale || "";
|
|
40261
|
-
if (/^zh\b/i.test(loc))
|
|
40262
|
-
return true;
|
|
40263
|
-
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone || "";
|
|
40264
|
-
if (/^(Asia\/(Shanghai|Chongqing|Chungking|Harbin|Urumqi|Beijing)|PRC)$/i.test(tz))
|
|
40265
|
-
return true;
|
|
40266
|
-
} catch {
|
|
40267
|
-
}
|
|
40268
|
-
return false;
|
|
40356
|
+
return detectOsLocale() === "zh";
|
|
40269
40357
|
}
|
|
40270
40358
|
function getInkmapHome() {
|
|
40271
40359
|
return process.env.INKMAP_HOME || (0, import_node_path5.join)((0, import_node_os5.homedir)(), ".inkmap");
|
|
@@ -40298,7 +40386,7 @@ function getAntigravityConfigDir() {
|
|
|
40298
40386
|
function findCursorCommand() {
|
|
40299
40387
|
if (process.env.INKMAP_ISOLATED_DETECT)
|
|
40300
40388
|
return null;
|
|
40301
|
-
if ((0,
|
|
40389
|
+
if ((0, import_node_child_process3.spawnSync)("cursor", ["--version"], { stdio: "ignore" }).status === 0)
|
|
40302
40390
|
return "cursor";
|
|
40303
40391
|
if (process.platform === "darwin") {
|
|
40304
40392
|
for (const dir of ["/Applications", (0, import_node_path5.join)((0, import_node_os5.homedir)(), "Applications")]) {
|
|
@@ -40317,7 +40405,7 @@ function findCursorCommand() {
|
|
|
40317
40405
|
function findVscodeCommand() {
|
|
40318
40406
|
if (process.env.INKMAP_ISOLATED_DETECT)
|
|
40319
40407
|
return null;
|
|
40320
|
-
if ((0,
|
|
40408
|
+
if ((0, import_node_child_process3.spawnSync)("code", ["--version"], { stdio: "ignore" }).status === 0)
|
|
40321
40409
|
return "code";
|
|
40322
40410
|
if (process.platform === "darwin") {
|
|
40323
40411
|
for (const dir of ["/Applications", (0, import_node_path5.join)((0, import_node_os5.homedir)(), "Applications")]) {
|
|
@@ -40337,7 +40425,7 @@ function findCodexCommand() {
|
|
|
40337
40425
|
if (process.env.INKMAP_CODEX_BIN) {
|
|
40338
40426
|
return (0, import_node_fs3.existsSync)(process.env.INKMAP_CODEX_BIN) ? process.env.INKMAP_CODEX_BIN : null;
|
|
40339
40427
|
}
|
|
40340
|
-
if ((0,
|
|
40428
|
+
if ((0, import_node_child_process3.spawnSync)("codex", ["--version"], { stdio: "ignore" }).status === 0)
|
|
40341
40429
|
return "codex";
|
|
40342
40430
|
if (process.platform === "darwin") {
|
|
40343
40431
|
for (const dir of ["/Applications", (0, import_node_path5.join)((0, import_node_os5.homedir)(), "Applications")]) {
|
|
@@ -40357,7 +40445,7 @@ function findDshCommand() {
|
|
|
40357
40445
|
}
|
|
40358
40446
|
if (process.env.INKMAP_ISOLATED_DETECT)
|
|
40359
40447
|
return null;
|
|
40360
|
-
if ((0,
|
|
40448
|
+
if ((0, import_node_child_process3.spawnSync)("dsh", ["--version"], { stdio: "ignore" }).status === 0)
|
|
40361
40449
|
return "dsh";
|
|
40362
40450
|
if (process.platform === "darwin") {
|
|
40363
40451
|
for (const dir of ["/Applications", (0, import_node_path5.join)((0, import_node_os5.homedir)(), "Applications")]) {
|
|
@@ -40380,7 +40468,7 @@ function detectInstalledTargets() {
|
|
|
40380
40468
|
found.push("claude");
|
|
40381
40469
|
}
|
|
40382
40470
|
const claudeCodeCfg = getClaudeCodeConfigPath();
|
|
40383
|
-
if ((0, import_node_fs3.existsSync)(claudeCodeCfg) || !process.env.INKMAP_ISOLATED_DETECT && (0,
|
|
40471
|
+
if ((0, import_node_fs3.existsSync)(claudeCodeCfg) || !process.env.INKMAP_ISOLATED_DETECT && (0, import_node_child_process3.spawnSync)("claude", ["--version"], { stdio: "ignore" }).status === 0) {
|
|
40384
40472
|
found.push("claude-code");
|
|
40385
40473
|
}
|
|
40386
40474
|
if ((0, import_node_fs3.existsSync)(getCursorDir()) || Boolean(findCursorCommand())) {
|
|
@@ -40473,7 +40561,7 @@ function installIdeExtension(editorDir, cliCmd) {
|
|
|
40473
40561
|
return null;
|
|
40474
40562
|
}
|
|
40475
40563
|
const extPkg = JSON.parse((0, import_node_fs3.readFileSync)((0, import_node_path5.join)(vscodeBundle, "package.json"), "utf8"));
|
|
40476
|
-
const version2 = extPkg.version || "0.3.
|
|
40564
|
+
const version2 = extPkg.version || "0.3.6";
|
|
40477
40565
|
const staging = (0, import_node_fs3.mkdtempSync)((0, import_node_path5.join)((0, import_node_os5.tmpdir)(), "inkmap-vsix-"));
|
|
40478
40566
|
try {
|
|
40479
40567
|
const extStaging = (0, import_node_path5.join)(staging, "extension");
|
|
@@ -40509,7 +40597,7 @@ function installIdeExtension(editorDir, cliCmd) {
|
|
|
40509
40597
|
const vsixPath = (0, import_node_path5.join)(staging, `inkmap-${version2}.vsix`);
|
|
40510
40598
|
(0, import_node_fs3.writeFileSync)(vsixPath, buildZipBuffer(entries));
|
|
40511
40599
|
try {
|
|
40512
|
-
(0,
|
|
40600
|
+
(0, import_node_child_process3.execFileSync)(cliCmd, ["--install-extension", vsixPath, "--force"], { stdio: "pipe" });
|
|
40513
40601
|
return (0, import_node_path5.join)(editorDir, "extensions", `inkmap.inkmap-vscode-${version2}`);
|
|
40514
40602
|
} catch {
|
|
40515
40603
|
}
|
|
@@ -40532,7 +40620,7 @@ function uninstallIdeExtension(editorDir, cliCmd) {
|
|
|
40532
40620
|
let removed = false;
|
|
40533
40621
|
if (cliCmd) {
|
|
40534
40622
|
try {
|
|
40535
|
-
(0,
|
|
40623
|
+
(0, import_node_child_process3.execFileSync)(cliCmd, ["--uninstall-extension", "inkmap.inkmap-vscode"], { stdio: "pipe" });
|
|
40536
40624
|
removed = true;
|
|
40537
40625
|
} catch {
|
|
40538
40626
|
}
|
|
@@ -40664,13 +40752,13 @@ function installCodexPlugin() {
|
|
|
40664
40752
|
throw new Error("\u672A\u627E\u5230 Codex \u63D2\u4EF6\u8D44\u6E90 / Codex plugin bundle not found.");
|
|
40665
40753
|
}
|
|
40666
40754
|
const marketplaceName = "inkmap-local";
|
|
40667
|
-
const rawList = (0,
|
|
40755
|
+
const rawList = (0, import_node_child_process3.execFileSync)(codex, ["plugin", "marketplace", "list", "--json"], { encoding: "utf8" });
|
|
40668
40756
|
const { marketplaces = [] } = JSON.parse(rawList);
|
|
40669
40757
|
const existing = marketplaces.find((entry) => entry.name === marketplaceName);
|
|
40670
40758
|
if (!existing) {
|
|
40671
|
-
(0,
|
|
40759
|
+
(0, import_node_child_process3.execFileSync)(codex, ["plugin", "marketplace", "add", marketplaceRoot], { stdio: "pipe" });
|
|
40672
40760
|
}
|
|
40673
|
-
(0,
|
|
40761
|
+
(0, import_node_child_process3.execFileSync)(codex, ["plugin", "add", `inkmap-codex@${marketplaceName}`], { stdio: "pipe" });
|
|
40674
40762
|
return {
|
|
40675
40763
|
location: marketplaceRoot,
|
|
40676
40764
|
note: "\u91CD\u542F ChatGPT Desktop \u540E\uFF0C\u5728 Codex \u6A21\u5F0F\u70B9\u51FB .md \u6587\u4EF6\u6253\u5F00\u83DC\u5355\u9009\u62E9 Inkmap Mind Map"
|
|
@@ -40738,7 +40826,7 @@ function installDeepSeekHarnessPlugin() {
|
|
|
40738
40826
|
const dshCmd = findDshCommand();
|
|
40739
40827
|
const profileDir = (0, import_node_path5.join)(getDshHome(), "profiles", "desktop");
|
|
40740
40828
|
if (dshCmd) {
|
|
40741
|
-
(0,
|
|
40829
|
+
(0, import_node_child_process3.execFileSync)(dshCmd, ["plugin", "--profile", "desktop", "add", realStaged], { stdio: "pipe" });
|
|
40742
40830
|
} else if ((0, import_node_fs3.existsSync)(profileDir)) {
|
|
40743
40831
|
const nodeModulesTarget = (0, import_node_path5.join)(profileDir, "node_modules", "dsh-inkmap");
|
|
40744
40832
|
(0, import_node_fs3.rmSync)(nodeModulesTarget, { recursive: true, force: true });
|
|
@@ -40800,7 +40888,7 @@ async function runInstall(options = {}) {
|
|
|
40800
40888
|
const profileDir = (0, import_node_path5.join)(getDshHome(), "profiles", "desktop");
|
|
40801
40889
|
if (dshCmd && (0, import_node_fs3.existsSync)(profileDir)) {
|
|
40802
40890
|
try {
|
|
40803
|
-
(0,
|
|
40891
|
+
(0, import_node_child_process3.execFileSync)(dshCmd, ["plugin", "--profile", "desktop", "remove", "dsh-inkmap"], { stdio: "pipe" });
|
|
40804
40892
|
} catch {
|
|
40805
40893
|
}
|
|
40806
40894
|
}
|
|
@@ -41001,16 +41089,17 @@ async function runInstallCli(argv, uninstall = false) {
|
|
|
41001
41089
|
uninstall
|
|
41002
41090
|
});
|
|
41003
41091
|
}
|
|
41004
|
-
var
|
|
41092
|
+
var import_node_child_process3, import_node_fs3, import_node_os5, import_node_path5, import_node_url3, import_node_zlib, DIST_DIR, PKG_ROOT, SERVER_WRAPPER, CRC_TABLE;
|
|
41005
41093
|
var init_install = __esm({
|
|
41006
41094
|
"packages/cli/dist/install.js"() {
|
|
41007
41095
|
"use strict";
|
|
41008
|
-
|
|
41096
|
+
import_node_child_process3 = require("node:child_process");
|
|
41009
41097
|
import_node_fs3 = require("node:fs");
|
|
41010
41098
|
import_node_os5 = require("node:os");
|
|
41011
41099
|
import_node_path5 = require("node:path");
|
|
41012
41100
|
import_node_url3 = require("node:url");
|
|
41013
41101
|
import_node_zlib = require("node:zlib");
|
|
41102
|
+
init_license();
|
|
41014
41103
|
DIST_DIR = (0, import_node_path5.dirname)((0, import_node_url3.fileURLToPath)(inkmapModuleUrl));
|
|
41015
41104
|
PKG_ROOT = (0, import_node_path5.resolve)(DIST_DIR, "..");
|
|
41016
41105
|
SERVER_WRAPPER = `#!/usr/bin/env node
|
|
@@ -41040,13 +41129,13 @@ __export(index_exports, {
|
|
|
41040
41129
|
main: () => main
|
|
41041
41130
|
});
|
|
41042
41131
|
module.exports = __toCommonJS(index_exports);
|
|
41043
|
-
var
|
|
41132
|
+
var import_node_child_process4 = require("node:child_process");
|
|
41044
41133
|
var import_node_path6 = require("node:path");
|
|
41045
41134
|
var import_node_url4 = require("node:url");
|
|
41046
41135
|
init_dist();
|
|
41047
41136
|
init_license();
|
|
41048
41137
|
init_server();
|
|
41049
|
-
var INKMAP_VERSION = "0.3.
|
|
41138
|
+
var INKMAP_VERSION = "0.3.6";
|
|
41050
41139
|
var WEB_ROOT2 = (0, import_node_url4.fileURLToPath)(new URL("./web/", inkmapModuleUrl));
|
|
41051
41140
|
var USAGE = `Inkmap v${INKMAP_VERSION} \u2014 Markdown \u4EA4\u4E92\u601D\u7EF4\u5BFC\u56FE\u7F16\u8F91\u5668 & MCP App
|
|
41052
41141
|
|
|
@@ -41061,7 +41150,7 @@ var USAGE = `Inkmap v${INKMAP_VERSION} \u2014 Markdown \u4EA4\u4E92\u601D\u7EF4\
|
|
|
41061
41150
|
\u5728\u672C\u5730\u6D4F\u89C8\u5668\u4E2D\u4EE5\u601D\u7EF4\u5BFC\u56FE\u6253\u5F00\u5E76\u5B9E\u65F6\u53CC\u5411\u7F16\u8F91 Markdown \u6587\u4EF6`;
|
|
41062
41151
|
function openBrowser(url2) {
|
|
41063
41152
|
const [cmd, args] = process.platform === "darwin" ? ["open", [url2]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url2]] : ["xdg-open", [url2]];
|
|
41064
|
-
(0,
|
|
41153
|
+
(0, import_node_child_process4.spawn)(cmd, args, { stdio: "ignore", detached: true }).unref();
|
|
41065
41154
|
}
|
|
41066
41155
|
function appendEnvWorkspaces(dirs) {
|
|
41067
41156
|
if (dirs.length === 0)
|