ai-cli-log 1.0.9 → 1.0.10

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/README.md CHANGED
@@ -38,6 +38,23 @@ ai-cli-log [global-options] run <command-to-log> [args...]
38
38
  ```
39
39
  This will use your default (or specified) summarizer to generate a descriptive filename like `gemini-20250713-153000-fix-database-connection-error.txt`.
40
40
 
41
+ ## Alias for Quick Access
42
+
43
+ For even faster access, you can create shell aliases. This allows you to start a logged session with a short command. Add these to your shell's configuration file (e.g., `~/.bashrc`, `~/.zshrc`).
44
+
45
+ ```bash
46
+ # Start a logged Gemini session with an AI-generated summary
47
+ alias ag='ai-cli-log -s run gemini'
48
+
49
+ # Start a logged Claude session with an AI-generated summary
50
+ alias ac='ai-cli-log -s run claude'
51
+
52
+ # You can also omit the -s flag for basic logging
53
+ alias ag-log='ai-cli-log run gemini'
54
+ ```
55
+
56
+ Now, you can simply run `ag` to start a recorded Gemini session.
57
+
41
58
  ## Configuration
42
59
 
43
60
  `ai-cli-log` loads configuration from `config.json` files. It prioritizes a local (project-specific) configuration over the global one.
@@ -109,7 +126,7 @@ Here is an example of a manual `config.json`:
109
126
 
110
127
  ## Development Notes
111
128
 
112
- This project was generated with the assistance of Google Gemini. You can review the detailed development process and interactions in the `.ai-cli-log` directory, specifically starting with `0001.txt` and subsequent log files.
129
+ This project was generated with the assistance of Google Gemini. You can review the detailed development process and interactions in the `.ai-cli-log` directory of the project's GitHub repository: [https://github.com/alingse/ai-cli-log/tree/main/.ai-cli-log](https://github.com/alingse/ai-cli-log/tree/main/.ai-cli-log). The development prompts are primarily in Chinese.
113
130
 
114
131
  Special thanks to Gemini for its invaluable help in the development of this tool!
115
132
 
@@ -159,6 +176,23 @@ ai-cli-log [全局选项] run <要记录的命令> [参数...]
159
176
  ```
160
177
  这将使用您默认(或指定)的摘要器生成一个描述性的文件名,例如 `gemini-20250713-153000-fix-database-connection-error.txt`。
161
178
 
179
+ ## 快捷别名 (Alias)
180
+
181
+ 为了更快捷地启动,您可以创建 shell 别名。这样,您可以用一个简短的命令开始一个带日志记录的会话。将以下内容添加到您的 shell 配置文件中(例如 `~/.bashrc`, `~/.zshrc`)。
182
+
183
+ ```bash
184
+ # 启动一个带 AI 摘要的 Gemini 会话
185
+ alias ag='ai-cli-log -s run gemini'
186
+
187
+ # 启动一个带 AI 摘要的 Claude 会话
188
+ alias ac='ai-cli-log -s run claude'
189
+
190
+ # 您也可以省略 -s 标志以进行基本日志记录
191
+ alias ag-log='ai-cli-log run gemini'
192
+ ```
193
+
194
+ 现在,您只需运行 `ag` 即可启动一个被记录的 Gemini 会话。
195
+
162
196
  ## 配置
163
197
 
164
198
  `ai-cli-log` 从 `config.json` 文件中加载配置。它会优先使用本地(项目特定)的配置,其次是全局配置。
@@ -253,7 +287,7 @@ ai-cli-log [全局选项] run <要记录的命令> [参数...]
253
287
 
254
288
  ## 开发说明
255
289
 
256
- 本项目是在 Google Gemini 的协助下生成的。您可以在 `.ai-cli-log` 目录中查看详细的开发过程和交互记录,特别是从 `0001.txt` 开始的日志文件。
290
+ 本项目是在 Google Gemini 的协助下生成的。您可以在本项目的 GitHub 仓库中查看详细的开发过程和交互记录,所有开发记录(中文 Prompt)都保存在 `.ai-cli-log` 目录中:[https://github.com/alingse/ai-cli-log/tree/main/.ai-cli-log](https://github.com/alingse/ai-cli-log/tree/main/.ai-cli-log)。
257
291
 
258
292
  特别感谢 Gemini 在本项目开发过程中提供的宝贵帮助!
259
293
 
package/dist/index.js CHANGED
@@ -350,10 +350,12 @@ function runLoggingSession(command, commandArgs, summaryArg) {
350
350
  const jsonMatch = rawSummaryJson.match(/\{.*\}/s);
351
351
  const cleanJson = jsonMatch ? jsonMatch[0] : rawSummaryJson;
352
352
  const summaryData = JSON.parse(cleanJson);
353
- const slug = summaryData.summary;
354
- if (typeof slug !== 'string') {
353
+ const slugFromAi = summaryData.summary;
354
+ if (typeof slugFromAi !== 'string') {
355
355
  throw new Error('Invalid JSON structure from summarizer: "summary" key is missing or not a string.');
356
356
  }
357
+ const slugify = (text) => text.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
358
+ const slug = slugify(slugFromAi).split('-').filter(Boolean).slice(0, 6).join('-');
357
359
  console.log(`\nSummary by ${summarizerName} (took ${duration.toFixed(1)}s): "${slug}"`);
358
360
  logFileName = `${prefix}-${timestamp}-${slug}.txt`;
359
361
  }
@@ -361,7 +363,7 @@ function runLoggingSession(command, commandArgs, summaryArg) {
361
363
  console.error(`\nError parsing summary JSON from ${summarizerName}. Using raw output as fallback.`);
362
364
  console.error(`Raw output: ${rawSummaryJson}`);
363
365
  const slugify = (text) => text.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
364
- const slug = slugify(rawSummaryJson).split('-').slice(0, 10).join('-');
366
+ const slug = slugify(rawSummaryJson).split('-').filter(Boolean).slice(0, 6).join('-');
365
367
  logFileName = `${prefix}-${timestamp}-${slug}.txt`;
366
368
  }
367
369
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-cli-log",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Seamlessly log your AI-powered coding conversations. This command-line interface (CLI) tool captures your terminal interactions with AI models like Gemini and Claude, saving entire sessions as clean plain text documents for easy review and documentation.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -363,12 +363,15 @@ function runLoggingSession(command: string, commandArgs: string[], summaryArg?:
363
363
  const cleanJson = jsonMatch ? jsonMatch[0] : rawSummaryJson;
364
364
 
365
365
  const summaryData = JSON.parse(cleanJson);
366
- const slug = summaryData.summary;
366
+ const slugFromAi = summaryData.summary;
367
367
 
368
- if (typeof slug !== 'string') {
368
+ if (typeof slugFromAi !== 'string') {
369
369
  throw new Error('Invalid JSON structure from summarizer: "summary" key is missing or not a string.');
370
370
  }
371
371
 
372
+ const slugify = (text: string) => text.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
373
+ const slug = slugify(slugFromAi).split('-').filter(Boolean).slice(0, 6).join('-');
374
+
372
375
  console.log(`\nSummary by ${summarizerName} (took ${duration.toFixed(1)}s): "${slug}"`);
373
376
  logFileName = `${prefix}-${timestamp}-${slug}.txt`;
374
377
 
@@ -376,7 +379,7 @@ function runLoggingSession(command: string, commandArgs: string[], summaryArg?:
376
379
  console.error(`\nError parsing summary JSON from ${summarizerName}. Using raw output as fallback.`);
377
380
  console.error(`Raw output: ${rawSummaryJson}`);
378
381
  const slugify = (text: string) => text.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
379
- const slug = slugify(rawSummaryJson).split('-').slice(0, 10).join('-');
382
+ const slug = slugify(rawSummaryJson).split('-').filter(Boolean).slice(0, 6).join('-');
380
383
  logFileName = `${prefix}-${timestamp}-${slug}.txt`;
381
384
  }
382
385
  }