deeper-cli 1.3.1 → 1.3.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/index.js +50 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +60 -60
- package/src/cli/chat-repl.ts +37 -3
- package/src/model/types.ts +1 -0
package/dist/cli/index.js
CHANGED
|
@@ -11881,6 +11881,7 @@ ${prevSummary.slice(0, 800)}` });
|
|
|
11881
11881
|
O(G(" /config") + G(" \u914D\u7F6E\u7BA1\u7406") + "\n");
|
|
11882
11882
|
O(G(" /cwd") + G(" \u5F53\u524D\u76EE\u5F55") + "\n");
|
|
11883
11883
|
O(G(" /export") + G(" \u5BFC\u51FA\u5BF9\u8BDD") + "\n");
|
|
11884
|
+
O(G(" /delete [n]") + G(" \u5220\u9664\u4F1A\u8BDD") + "\n");
|
|
11884
11885
|
O(G(" /init") + G(" \u521D\u59CB\u5316\u9879\u76EE") + "\n");
|
|
11885
11886
|
O("\n");
|
|
11886
11887
|
continue;
|
|
@@ -11941,6 +11942,46 @@ ${prevSummary.slice(0, 800)}` });
|
|
|
11941
11942
|
await exportHistory(history);
|
|
11942
11943
|
continue;
|
|
11943
11944
|
}
|
|
11945
|
+
if (cmd === "/delete" || cmd === "/rm") {
|
|
11946
|
+
if (!arg) {
|
|
11947
|
+
if (!existsSync53(SESSION_DIR)) {
|
|
11948
|
+
O(r(" \u65E0\u4FDD\u5B58\u7684\u4F1A\u8BDD\n\n"));
|
|
11949
|
+
continue;
|
|
11950
|
+
}
|
|
11951
|
+
const files = readdirSync4(SESSION_DIR).filter((f) => f.endsWith(".json") && !f.startsWith("_")).sort().reverse();
|
|
11952
|
+
if (!files.length) {
|
|
11953
|
+
O(r(" \u65E0\u4FDD\u5B58\u7684\u4F1A\u8BDD\n\n"));
|
|
11954
|
+
continue;
|
|
11955
|
+
}
|
|
11956
|
+
O(b(c(" Sessions")) + G(` \xB7 ${files.length} \u4E2A`) + "\n");
|
|
11957
|
+
O(G(` \u7528\u6CD5: /delete <\u540D\u79F0> \u5220\u9664\u6307\u5B9A\u4F1A\u8BDD
|
|
11958
|
+
`));
|
|
11959
|
+
for (let i = 0; i < Math.min(files.length, 15); i++) {
|
|
11960
|
+
const f = files[i];
|
|
11961
|
+
try {
|
|
11962
|
+
const data = JSON.parse(readFileSync37(join12(SESSION_DIR, f), "utf-8"));
|
|
11963
|
+
const label = f.replace(/^sess_|\.json$/g, "");
|
|
11964
|
+
O(G(` ${i + 1}. `) + c(label) + G(` \xB7 ${data.messages?.length || 0}\u6761 \xB7 ${data.savedAt?.slice(0, 16) || "?"}`) + "\n");
|
|
11965
|
+
} catch {
|
|
11966
|
+
}
|
|
11967
|
+
}
|
|
11968
|
+
O("\n");
|
|
11969
|
+
continue;
|
|
11970
|
+
}
|
|
11971
|
+
const targetFile = join12(SESSION_DIR, `sess_${arg}.json`);
|
|
11972
|
+
if (existsSync53(targetFile)) {
|
|
11973
|
+
const { unlinkSync: us } = await import("fs");
|
|
11974
|
+
us(targetFile);
|
|
11975
|
+
O(g(`\u5DF2\u5220\u9664: ${arg}
|
|
11976
|
+
|
|
11977
|
+
`));
|
|
11978
|
+
} else {
|
|
11979
|
+
O(r(` \u4F1A\u8BDD\u4E0D\u5B58\u5728: ${arg}
|
|
11980
|
+
|
|
11981
|
+
`));
|
|
11982
|
+
}
|
|
11983
|
+
continue;
|
|
11984
|
+
}
|
|
11944
11985
|
if (cmd === "/init") {
|
|
11945
11986
|
await initProject();
|
|
11946
11987
|
continue;
|
|
@@ -11993,7 +12034,7 @@ ${prevSummary.slice(0, 800)}` });
|
|
|
11993
12034
|
O(c(" /help /clear /quit /save [name] /load|resume [name] /sessions\n"));
|
|
11994
12035
|
O(c(" /tools [cat] /stats /memory /tasks /model /config /cwd /export /init /mcp /rules\n"));
|
|
11995
12036
|
O(c(" /plan <\u4EFB\u52A1> /spec <\u4EFB\u52A1> /review <\u8DEF\u5F84> /fix [\u76EE\u6807]\n"));
|
|
11996
|
-
O(c(" /commit /analyze [\u8DEF\u5F84] /diff <\u6587\u4EF6> /undo /status\n\n"));
|
|
12037
|
+
O(c(" /commit /analyze [\u8DEF\u5F84] /diff <\u6587\u4EF6> /undo /delete [n] /status\n\n"));
|
|
11997
12038
|
continue;
|
|
11998
12039
|
}
|
|
11999
12040
|
if (cmd === "/plan") {
|
|
@@ -12797,7 +12838,10 @@ async function loadNamedSession(history, name) {
|
|
|
12797
12838
|
}
|
|
12798
12839
|
const data = JSON.parse(readFileSync37(file, "utf-8"));
|
|
12799
12840
|
history.push({ role: "system", content: `[\u5DF2\u52A0\u8F7D: ${name} (${data.messages?.length || 0} \u6761)]` });
|
|
12800
|
-
if (data.messages) for (const m of data.messages)
|
|
12841
|
+
if (data.messages) for (const m of data.messages) {
|
|
12842
|
+
if (m.role === "tool" && !m.name) m.name = "tool";
|
|
12843
|
+
history.push(m);
|
|
12844
|
+
}
|
|
12801
12845
|
trimHistory(history, MAX_HISTORY);
|
|
12802
12846
|
O(g(`\u5DF2\u52A0\u8F7D: ${name}`) + "\n\n");
|
|
12803
12847
|
}
|
|
@@ -12815,7 +12859,10 @@ async function loadLatestSession(history) {
|
|
|
12815
12859
|
const data = JSON.parse(readFileSync37(file, "utf-8"));
|
|
12816
12860
|
const label = files[0].replace(/^sess_|\.json$/g, "");
|
|
12817
12861
|
history.push({ role: "system", content: `[\u5DF2\u52A0\u8F7D: ${label} (${data.messages?.length || 0} \u6761)]` });
|
|
12818
|
-
if (data.messages) for (const m of data.messages)
|
|
12862
|
+
if (data.messages) for (const m of data.messages) {
|
|
12863
|
+
if (m.role === "tool" && !m.name) m.name = "tool";
|
|
12864
|
+
history.push(m);
|
|
12865
|
+
}
|
|
12819
12866
|
trimHistory(history, MAX_HISTORY);
|
|
12820
12867
|
O(g(`\u5DF2\u52A0\u8F7D: ${label}`) + "\n\n");
|
|
12821
12868
|
}
|