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/package.json CHANGED
@@ -1,60 +1,60 @@
1
- {
2
- "name": "deeper-cli",
3
- "version": "1.3.1",
4
- "description": "DeeperCode - 一句话生成完整项目的 AI Agentic CLI 工具",
5
- "type": "module",
6
- "bin": {
7
- "deeper": "dist/cli/index.js"
8
- },
9
- "main": "dist/index.js",
10
- "scripts": {
11
- "dev": "tsup --watch",
12
- "build": "tsup",
13
- "start": "node dist/cli/index.js",
14
- "test": "vitest run",
15
- "test:watch": "vitest",
16
- "lint": "eslint src/",
17
- "typecheck": "tsc --noEmit"
18
- },
19
- "keywords": [
20
- "ai",
21
- "agent",
22
- "cli",
23
- "deepseek",
24
- "coding-assistant"
25
- ],
26
- "license": "MIT",
27
- "engines": {
28
- "node": ">=20.0.0"
29
- },
30
- "dependencies": {
31
- "cheerio": "^1.2.0",
32
- "csv-parse": "^6.2.1",
33
- "diff": "^9.0.0",
34
- "fast-glob": "^3.3.3",
35
- "glob": "^13.0.6",
36
- "ink": "^5.2.1",
37
- "mkdirp": "^3.0.1",
38
- "open": "^11.0.0",
39
- "react": "^18.3.1",
40
- "toml": "^4.1.1",
41
- "ws": "^8.20.1",
42
- "yaml": "^2.9.0"
43
- },
44
- "devDependencies": {
45
- "@types/diff": "^7.0.2",
46
- "@types/node": "^25.7.0",
47
- "@types/react": "^19.2.14",
48
- "@types/ws": "^8.18.1",
49
- "tsup": "^8.5.1",
50
- "tsx": "^4.22.0",
51
- "typescript": "^5.9.3",
52
- "vitest": "^4.1.6"
53
- },
54
- "directories": {
55
- "doc": "docs",
56
- "test": "tests"
57
- },
58
- "author": "",
59
- "types": "./dist/index.d.ts"
60
- }
1
+ {
2
+ "name": "deeper-cli",
3
+ "version": "1.3.3",
4
+ "description": "DeeperCode - 一句话生成完整项目的 AI Agentic CLI 工具",
5
+ "type": "module",
6
+ "bin": {
7
+ "deeper": "dist/cli/index.js"
8
+ },
9
+ "main": "dist/index.js",
10
+ "scripts": {
11
+ "dev": "tsup --watch",
12
+ "build": "tsup",
13
+ "start": "node dist/cli/index.js",
14
+ "test": "vitest run",
15
+ "test:watch": "vitest",
16
+ "lint": "eslint src/",
17
+ "typecheck": "tsc --noEmit"
18
+ },
19
+ "keywords": [
20
+ "ai",
21
+ "agent",
22
+ "cli",
23
+ "deepseek",
24
+ "coding-assistant"
25
+ ],
26
+ "license": "MIT",
27
+ "engines": {
28
+ "node": ">=20.0.0"
29
+ },
30
+ "dependencies": {
31
+ "cheerio": "^1.2.0",
32
+ "csv-parse": "^6.2.1",
33
+ "diff": "^9.0.0",
34
+ "fast-glob": "^3.3.3",
35
+ "glob": "^13.0.6",
36
+ "ink": "^5.2.1",
37
+ "mkdirp": "^3.0.1",
38
+ "open": "^11.0.0",
39
+ "react": "^18.3.1",
40
+ "toml": "^4.1.1",
41
+ "ws": "^8.20.1",
42
+ "yaml": "^2.9.0"
43
+ },
44
+ "devDependencies": {
45
+ "@types/diff": "^7.0.2",
46
+ "@types/node": "^25.7.0",
47
+ "@types/react": "^19.2.14",
48
+ "@types/ws": "^8.18.1",
49
+ "tsup": "^8.5.1",
50
+ "tsx": "^4.22.0",
51
+ "typescript": "^5.9.3",
52
+ "vitest": "^4.1.6"
53
+ },
54
+ "directories": {
55
+ "doc": "docs",
56
+ "test": "tests"
57
+ },
58
+ "author": "",
59
+ "types": "./dist/index.d.ts"
60
+ }
@@ -309,6 +309,7 @@ export async function startRepl(opts: ReplOptions): Promise<void> {
309
309
  O(G(' /config') + G(' 配置管理') + '\n');
310
310
  O(G(' /cwd') + G(' 当前目录') + '\n');
311
311
  O(G(' /export') + G(' 导出对话') + '\n');
312
+ O(G(' /delete [n]') + G(' 删除会话') + '\n');
312
313
  O(G(' /init') + G(' 初始化项目') + '\n');
313
314
  O('\n'); continue;
314
315
  }
@@ -331,6 +332,33 @@ export async function startRepl(opts: ReplOptions): Promise<void> {
331
332
  if (cmd === '/config') { O(c('配置: deeper config list | deeper config set <key> <value>\n\n')); continue; }
332
333
  if (cmd === '/cwd') { O(G(` ${process.cwd()}\n\n`)); continue; }
333
334
  if (cmd === '/export') { await exportHistory(history); continue; }
335
+ if (cmd === '/delete' || cmd === '/rm') {
336
+ if (!arg) {
337
+ if (!existsSync(SESSION_DIR)) { O(r(' 无保存的会话\n\n')); continue; }
338
+ const files = readdirSync(SESSION_DIR).filter(f => f.endsWith('.json') && !f.startsWith('_')).sort().reverse();
339
+ if (!files.length) { O(r(' 无保存的会话\n\n')); continue; }
340
+ O(b(c(' Sessions')) + G(` · ${files.length} 个`) + '\n');
341
+ O(G(` 用法: /delete <名称> 删除指定会话\n`));
342
+ for (let i = 0; i < Math.min(files.length, 15); i++) {
343
+ const f = files[i];
344
+ try {
345
+ const data = JSON.parse(readFileSync(join(SESSION_DIR, f), 'utf-8'));
346
+ const label = f.replace(/^sess_|\.json$/g, '');
347
+ O(G(` ${i + 1}. `) + c(label) + G(` · ${(data.messages?.length || 0)}条 · ${data.savedAt?.slice(0, 16) || '?'}`) + '\n');
348
+ } catch {}
349
+ }
350
+ O('\n'); continue;
351
+ }
352
+ const targetFile = join(SESSION_DIR, `sess_${arg}.json`);
353
+ if (existsSync(targetFile)) {
354
+ const { unlinkSync: us } = await import('node:fs');
355
+ us(targetFile);
356
+ O(g(`已删除: ${arg}\n\n`));
357
+ } else {
358
+ O(r(` 会话不存在: ${arg}\n\n`));
359
+ }
360
+ continue;
361
+ }
334
362
  if (cmd === '/init') { await initProject(); continue; }
335
363
  if (cmd === '/status') { O(B(`▸ API:${GS.api} 工具:${GS.tc} 字符:${GS.ch} · 上下文:${history.length}条`) + '\n\n'); continue; }
336
364
  if (cmd === '/mcp') {
@@ -369,7 +397,7 @@ export async function startRepl(opts: ReplOptions): Promise<void> {
369
397
  O(c(' /help /clear /quit /save [name] /load|resume [name] /sessions\n'));
370
398
  O(c(' /tools [cat] /stats /memory /tasks /model /config /cwd /export /init /mcp /rules\n'));
371
399
  O(c(' /plan <任务> /spec <任务> /review <路径> /fix [目标]\n'));
372
- O(c(' /commit /analyze [路径] /diff <文件> /undo /status\n\n'));
400
+ O(c(' /commit /analyze [路径] /diff <文件> /undo /delete [n] /status\n\n'));
373
401
  continue;
374
402
  }
375
403
  if (cmd === '/plan') {
@@ -1102,7 +1130,10 @@ async function loadNamedSession(history: Message[], name: string) {
1102
1130
  if (!existsSync(file)) { O(r(`会话不存在: ${name}\n\n`)); return; }
1103
1131
  const data = JSON.parse(readFileSync(file, 'utf-8'));
1104
1132
  history.push({ role: 'system', content: `[已加载: ${name} (${data.messages?.length || 0} 条)]` });
1105
- if (data.messages) for (const m of data.messages) history.push(m);
1133
+ if (data.messages) for (const m of data.messages) {
1134
+ if (m.role === 'tool' && !m.name) m.name = 'tool';
1135
+ history.push(m);
1136
+ }
1106
1137
  trimHistory(history, MAX_HISTORY);
1107
1138
  O(g(`已加载: ${name}`) + '\n\n');
1108
1139
  }
@@ -1115,7 +1146,10 @@ async function loadLatestSession(history: Message[]) {
1115
1146
  const data = JSON.parse(readFileSync(file, 'utf-8'));
1116
1147
  const label = files[0].replace(/^sess_|\.json$/g, '');
1117
1148
  history.push({ role: 'system', content: `[已加载: ${label} (${data.messages?.length || 0} 条)]` });
1118
- if (data.messages) for (const m of data.messages) history.push(m);
1149
+ if (data.messages) for (const m of data.messages) {
1150
+ if (m.role === 'tool' && !m.name) m.name = 'tool';
1151
+ history.push(m);
1152
+ }
1119
1153
  trimHistory(history, MAX_HISTORY);
1120
1154
  O(g(`已加载: ${label}`) + '\n\n');
1121
1155
  }
@@ -82,6 +82,7 @@ export const SLASH_COMMANDS: SlashCommand[] = [
82
82
  { command: '/analyze [路径]', description: '项目架构分析' },
83
83
  { command: '/diff <文件>', description: '查看文件变更' },
84
84
  { command: '/undo', description: '撤销最近文件修改' },
85
+ { command: '/delete [name]', description: '删除保存的会话' },
85
86
  ];
86
87
 
87
88
  export type DeepSeekMessage = ChatMessage;