deepseeker-code 1.0.2 → 1.0.3
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/cli.mjs +140 -14
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -67,6 +67,13 @@ var init_strings = __esm({
|
|
|
67
67
|
${yellow} \u5DE5\u5177\u5C06\u4EE5\u8BE5\u76EE\u5F55\u4E3A\u9879\u76EE\u6839\u8BFB\u5199\u6587\u4EF6\uFF0C\u5EFA\u8BAE\u5148 cd \u5230\u5177\u4F53\u9879\u76EE\u76EE\u5F55\u518D\u8FD0\u884C\u3002${reset}
|
|
68
68
|
${dim} \u9879\u76EE\u952E\uFF1A${projectKey}${reset}
|
|
69
69
|
|
|
70
|
+
`;
|
|
71
|
+
},
|
|
72
|
+
updateAvailable: (latest, current) => {
|
|
73
|
+
const cyan = "\x1B[36m", dim = "\x1B[2m", reset = "\x1B[0m";
|
|
74
|
+
return `${cyan}\u21BB \u68C0\u6D4B\u5230\u65B0\u7248\u672C ${latest}${reset} ${dim}\uFF08\u5F53\u524D ${current}\uFF09${reset}
|
|
75
|
+
${dim} \u8FD0\u884C npm i -g deepseeker-code@latest \u66F4\u65B0${reset}
|
|
76
|
+
|
|
70
77
|
`;
|
|
71
78
|
},
|
|
72
79
|
cmdHelp: "\u67E5\u770B\u5E2E\u52A9\u4E0E\u5FEB\u6377\u952E",
|
|
@@ -188,6 +195,13 @@ Set it as an env var and retry, or start serve for the Web UI.`,
|
|
|
188
195
|
${yellow} Tools will read/write files with this as project root\u2014cd into the actual project first.${reset}
|
|
189
196
|
${dim} Project key: ${projectKey}${reset}
|
|
190
197
|
|
|
198
|
+
`;
|
|
199
|
+
},
|
|
200
|
+
updateAvailable: (latest, current) => {
|
|
201
|
+
const cyan = "\x1B[36m", dim = "\x1B[2m", reset = "\x1B[0m";
|
|
202
|
+
return `${cyan}\u21BB New version ${latest} available${reset} ${dim}(current ${current})${reset}
|
|
203
|
+
${dim} Run npm i -g deepseeker-code@latest to update${reset}
|
|
204
|
+
|
|
191
205
|
`;
|
|
192
206
|
},
|
|
193
207
|
cmdHelp: "Show help & shortcuts",
|
|
@@ -2051,7 +2065,16 @@ var init_guard = __esm({
|
|
|
2051
2065
|
};
|
|
2052
2066
|
resolveReadablePath = (rel) => {
|
|
2053
2067
|
const root = getActiveWorkspaceRoot();
|
|
2054
|
-
|
|
2068
|
+
const absPath = path9.resolve(root, rel);
|
|
2069
|
+
if (!fsSync.existsSync(absPath)) {
|
|
2070
|
+
const rootName = path9.basename(root);
|
|
2071
|
+
const firstSeg = rel.split(/[\\/]/)[0];
|
|
2072
|
+
if (rootName && firstSeg === rootName) {
|
|
2073
|
+
const alt = path9.resolve(root, rel.slice(firstSeg.length + 1));
|
|
2074
|
+
if (fsSync.existsSync(alt)) return alt;
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
return absPath;
|
|
2055
2078
|
};
|
|
2056
2079
|
assertWithinWorkspace = (absPath, base) => {
|
|
2057
2080
|
const root = base ?? getActiveWorkspaceRoot();
|
|
@@ -4648,9 +4671,19 @@ var init_fs = __esm({
|
|
|
4648
4671
|
}
|
|
4649
4672
|
if (hits.length === 0) return { ok: false, reason: "none", count: 0 };
|
|
4650
4673
|
if (!replaceAll && hits.length > 1) return { ok: false, reason: "conflict", count: hits.length };
|
|
4651
|
-
const newLines = newBlock.split("\n");
|
|
4652
4674
|
const out = [...contentLines];
|
|
4653
|
-
for (let k = hits.length - 1; k >= 0; k--)
|
|
4675
|
+
for (let k = hits.length - 1; k >= 0; k--) {
|
|
4676
|
+
const start = hits[k];
|
|
4677
|
+
let baseIndent = "";
|
|
4678
|
+
for (let j = start; j < start + oldLines.length; j++) {
|
|
4679
|
+
if (contentLines[j].trim() !== "") {
|
|
4680
|
+
baseIndent = contentLines[j].match(/^[ \t]*/)?.[0] ?? "";
|
|
4681
|
+
break;
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
const aligned = baseIndent ? reindentToBase(newBlock, baseIndent) : newBlock;
|
|
4685
|
+
out.splice(start, oldLines.length, ...aligned.split("\n"));
|
|
4686
|
+
}
|
|
4654
4687
|
return { ok: true, content: out.join("\n"), count: hits.length };
|
|
4655
4688
|
};
|
|
4656
4689
|
diagnoseOldStr = (content, oldBlock) => {
|
|
@@ -10564,16 +10597,26 @@ var init_bootstrap = __esm({
|
|
|
10564
10597
|
if (typeof AbortSignal.any !== "function" || typeof AbortSignal.timeout !== "function") {
|
|
10565
10598
|
console.error("\u274C \u5F53\u524D Node \u7248\u672C\u7F3A\u5C11 AbortSignal.any/timeout\uFF08\u9700 Node 20.3+\uFF09\uFF0Cweb_fetch \u76F8\u5173\u80FD\u529B\u5C06\u4E0D\u53EF\u7528\uFF0C\u5EFA\u8BAE\u5347\u7EA7 Node\u3002");
|
|
10566
10599
|
}
|
|
10567
|
-
await
|
|
10568
|
-
|
|
10569
|
-
|
|
10570
|
-
|
|
10600
|
+
await Promise.all([
|
|
10601
|
+
// P2-13 worktree 孤儿清扫:进程重启 = 上次 run_workflow 未清理的 worktree 全是孤儿。best-effort,失败不阻断。
|
|
10602
|
+
sweepOrphanedWorktrees().catch((e) => console.warn(`worktree \u542F\u52A8\u671F\u6E05\u626B\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09: ${e?.message ?? e}`)),
|
|
10603
|
+
// 连接配置的 MCP 服务器并注入其工具(★ 通常最慢:spawn 子进程 + stdio 握手;无配置静默跳过)。仅读全局 mcp.json,不受 includeProject 影响。
|
|
10604
|
+
initMcpTools(into),
|
|
10605
|
+
// 加载声明式 hooks(settings.json;无配置时静默跳过)。未信任时跳过项目级(hooks 会 spawn 执行命令,高风险)
|
|
10606
|
+
initHooks(includeProject),
|
|
10607
|
+
// 加载细粒度权限规则(settings.json permissions.{allow,deny,ask};无配置时静默跳过)。未信任时跳过项目级(防 auto-approve 绕审批)
|
|
10608
|
+
initPermissions(includeProject),
|
|
10609
|
+
// 缓存项目指引(CLAUDE.md/AGENTS.md/AGENT.md)到内存,供每轮自动注入 system prompt。未信任时整体跳过(无全局源,防提示注入)
|
|
10610
|
+
initProjectGuide(includeProject),
|
|
10611
|
+
// 加载斜杠命令(builtin/global/project;用户输入 /<name> 时前置展开)。未信任时跳过项目级
|
|
10612
|
+
initCommands(includeProject),
|
|
10613
|
+
// 加载输出风格(builtin/global/project;用户经 CLI /output-style <name> 选用,runAgent 注入 persona)。未信任时跳过项目级
|
|
10614
|
+
initOutputStyles(includeProject),
|
|
10615
|
+
// 加载持久记忆(global/project;runAgent 注入一行索引,memory_read 按需召回全文)。未信任时跳过项目级(防提示注入)
|
|
10616
|
+
initMemories(includeProject)
|
|
10617
|
+
]);
|
|
10571
10618
|
await initSkills(into, includeProject);
|
|
10572
10619
|
await initAgents(into, includeProject);
|
|
10573
|
-
await initProjectGuide(includeProject);
|
|
10574
|
-
await initCommands(includeProject);
|
|
10575
|
-
await initOutputStyles(includeProject);
|
|
10576
|
-
await initMemories(includeProject);
|
|
10577
10620
|
return () => {
|
|
10578
10621
|
try {
|
|
10579
10622
|
disposeAllMcpClients();
|
|
@@ -13252,6 +13295,81 @@ ${listText}`);
|
|
|
13252
13295
|
}
|
|
13253
13296
|
});
|
|
13254
13297
|
|
|
13298
|
+
// src/updateCheck.ts
|
|
13299
|
+
var updateCheck_exports = {};
|
|
13300
|
+
__export(updateCheck_exports, {
|
|
13301
|
+
getCachedLatestIfNewer: () => getCachedLatestIfNewer,
|
|
13302
|
+
readLocalVersion: () => readLocalVersion,
|
|
13303
|
+
refreshUpdateCache: () => refreshUpdateCache
|
|
13304
|
+
});
|
|
13305
|
+
import { readFileSync as readFileSync3, writeFileSync, mkdirSync } from "node:fs";
|
|
13306
|
+
import path39 from "node:path";
|
|
13307
|
+
import os4 from "os";
|
|
13308
|
+
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
13309
|
+
var PKG_NAME, REGISTRY, CACHE_TTL_MS, FETCH_TIMEOUT_MS2, cacheFile, readLocalVersion, parseSemver, compareVersion, readCache, writeCache, getCachedLatestIfNewer, refreshUpdateCache;
|
|
13310
|
+
var init_updateCheck = __esm({
|
|
13311
|
+
"src/updateCheck.ts"() {
|
|
13312
|
+
"use strict";
|
|
13313
|
+
PKG_NAME = "deepseeker-code";
|
|
13314
|
+
REGISTRY = "https://registry.npmjs.org";
|
|
13315
|
+
CACHE_TTL_MS = 6 * 60 * 60 * 1e3;
|
|
13316
|
+
FETCH_TIMEOUT_MS2 = 3e3;
|
|
13317
|
+
cacheFile = () => path39.join(os4.homedir(), ".deepseeker-code", "update-check.json");
|
|
13318
|
+
readLocalVersion = () => {
|
|
13319
|
+
try {
|
|
13320
|
+
const here = path39.dirname(fileURLToPath6(import.meta.url));
|
|
13321
|
+
return JSON.parse(readFileSync3(path39.join(here, "..", "package.json"), "utf8")).version ?? "0.0.0";
|
|
13322
|
+
} catch {
|
|
13323
|
+
return "0.0.0";
|
|
13324
|
+
}
|
|
13325
|
+
};
|
|
13326
|
+
parseSemver = (v) => {
|
|
13327
|
+
const m = String(v ?? "").match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
13328
|
+
return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : [0, 0, 0];
|
|
13329
|
+
};
|
|
13330
|
+
compareVersion = (a, b) => {
|
|
13331
|
+
const [a1, a2, a3] = parseSemver(a);
|
|
13332
|
+
const [b1, b2, b3] = parseSemver(b);
|
|
13333
|
+
return a1 - b1 || a2 - b2 || a3 - b3;
|
|
13334
|
+
};
|
|
13335
|
+
readCache = () => {
|
|
13336
|
+
try {
|
|
13337
|
+
const obj = JSON.parse(readFileSync3(cacheFile(), "utf8"));
|
|
13338
|
+
return typeof obj.latestVersion === "string" && typeof obj.lastCheck === "number" ? obj : null;
|
|
13339
|
+
} catch {
|
|
13340
|
+
return null;
|
|
13341
|
+
}
|
|
13342
|
+
};
|
|
13343
|
+
writeCache = (latestVersion) => {
|
|
13344
|
+
try {
|
|
13345
|
+
mkdirSync(path39.dirname(cacheFile()), { recursive: true });
|
|
13346
|
+
writeFileSync(cacheFile(), JSON.stringify({ lastCheck: Date.now(), latestVersion }), "utf8");
|
|
13347
|
+
} catch {
|
|
13348
|
+
}
|
|
13349
|
+
};
|
|
13350
|
+
getCachedLatestIfNewer = (currentVersion) => {
|
|
13351
|
+
const cache = readCache();
|
|
13352
|
+
if (!cache) return null;
|
|
13353
|
+
return compareVersion(cache.latestVersion, currentVersion) > 0 ? cache.latestVersion : null;
|
|
13354
|
+
};
|
|
13355
|
+
refreshUpdateCache = () => {
|
|
13356
|
+
const cache = readCache();
|
|
13357
|
+
if (cache && Date.now() - cache.lastCheck < CACHE_TTL_MS) return;
|
|
13358
|
+
void (async () => {
|
|
13359
|
+
try {
|
|
13360
|
+
const res = await fetch(`${REGISTRY}/${PKG_NAME}/latest`, {
|
|
13361
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS2)
|
|
13362
|
+
});
|
|
13363
|
+
if (!res.ok) return;
|
|
13364
|
+
const info = await res.json();
|
|
13365
|
+
if (info.version) writeCache(info.version);
|
|
13366
|
+
} catch {
|
|
13367
|
+
}
|
|
13368
|
+
})();
|
|
13369
|
+
};
|
|
13370
|
+
}
|
|
13371
|
+
});
|
|
13372
|
+
|
|
13255
13373
|
// src/preload-config.ts
|
|
13256
13374
|
import { readFileSync } from "node:fs";
|
|
13257
13375
|
import path from "node:path";
|
|
@@ -13301,8 +13419,8 @@ init_strings();
|
|
|
13301
13419
|
init_prefs();
|
|
13302
13420
|
init_trust();
|
|
13303
13421
|
import { render } from "ink";
|
|
13304
|
-
import
|
|
13305
|
-
import
|
|
13422
|
+
import os5 from "os";
|
|
13423
|
+
import path40 from "path";
|
|
13306
13424
|
import { emitKeypressEvents } from "node:readline";
|
|
13307
13425
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
13308
13426
|
var parseArgs = (argv) => {
|
|
@@ -13314,6 +13432,7 @@ var parseArgs = (argv) => {
|
|
|
13314
13432
|
else if (a === "--auto" || a === "-a") out.auto = true;
|
|
13315
13433
|
else if (a === "--continue" || a === "-c") out.continue = true;
|
|
13316
13434
|
else if (a === "--trust") out.trust = true;
|
|
13435
|
+
else if (a === "--no-update-check") out.noUpdateCheck = true;
|
|
13317
13436
|
}
|
|
13318
13437
|
return out;
|
|
13319
13438
|
};
|
|
@@ -13428,12 +13547,19 @@ var main = async () => {
|
|
|
13428
13547
|
process.stdout.write("\x1B[2J\x1B[3J\x1B[1;1H");
|
|
13429
13548
|
const cwdIsHome = () => {
|
|
13430
13549
|
try {
|
|
13431
|
-
return
|
|
13550
|
+
return path40.resolve(cwd).toLowerCase() === path40.resolve(os5.homedir()).toLowerCase();
|
|
13432
13551
|
} catch {
|
|
13433
13552
|
return false;
|
|
13434
13553
|
}
|
|
13435
13554
|
};
|
|
13436
13555
|
process.stdout.write(S.startupBanner(cwd, appConfig2.userWorkspaceDir, cwdIsHome()));
|
|
13556
|
+
if (!args.noUpdateCheck) {
|
|
13557
|
+
const { readLocalVersion: readLocalVersion2, getCachedLatestIfNewer: getCachedLatestIfNewer2, refreshUpdateCache: refreshUpdateCache2 } = await Promise.resolve().then(() => (init_updateCheck(), updateCheck_exports));
|
|
13558
|
+
const current = readLocalVersion2();
|
|
13559
|
+
const latest = getCachedLatestIfNewer2(current);
|
|
13560
|
+
if (latest) process.stdout.write(S.updateAvailable(latest, current));
|
|
13561
|
+
refreshUpdateCache2();
|
|
13562
|
+
}
|
|
13437
13563
|
let resumeId = args.resume;
|
|
13438
13564
|
if (!resumeId && args.continue) {
|
|
13439
13565
|
const { getMostRecentSessionId: getMostRecentSessionId2 } = await Promise.resolve().then(() => (init_store(), store_exports));
|