llm-sentry-tools 1.1.0 → 1.1.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "llm-sentry-tools",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "基于 Sentry MCP 的错误分析和修复工具,支持 Claude Code、Cursor 等 AI 工具",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import inquirer from 'inquirer';
4
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
4
+ import { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync, statSync } from 'fs';
5
5
  import { join, dirname } from 'path';
6
6
  import { fileURLToPath } from 'url';
7
7
 
@@ -16,12 +16,14 @@ const AI_TOOLS = {
16
16
  name: 'Claude Code',
17
17
  configDir: '.claude/skills',
18
18
  fileExtension: 'md',
19
+ useSkillDirectory: true, // 每个 skill 是一个目录
19
20
  createCommand: (commandName, promptContent) => {
20
21
  const descriptions = {
21
- 'analyze-sentry-error': 'Sentry 错误分析',
22
- 'fix-sentry-error': 'Sentry 错误修复'
22
+ 'analyze-sentry-error': 'Sentry 获取错误详情并进行深度分析,定位问题代码,提供详细分析报告',
23
+ 'fix-sentry-error': '分析 Sentry 错误并自动修复代码,提供验证建议'
23
24
  };
24
25
  return `---
26
+ name: ${commandName}
25
27
  description: ${descriptions[commandName] || commandName}
26
28
  ---
27
29
 
@@ -103,9 +105,29 @@ const detectConfiguredTools = (projectPath) => {
103
105
  const configured = {};
104
106
 
105
107
  for (const [key, tool] of Object.entries(AI_TOOLS)) {
106
- // 检查工具配置目录是否存在
107
108
  const configPath = join(projectPath, tool.configDir);
108
- configured[key] = existsSync(configPath);
109
+
110
+ if (tool.useSkillDirectory) {
111
+ // Claude Code: 检查 skills 目录中是否有任何 skill 目录
112
+ if (existsSync(configPath)) {
113
+ try {
114
+ const items = readdirSync(configPath);
115
+ // 检查是否有包含 SKILL.md 的目录
116
+ configured[key] = items.some(item => {
117
+ const itemPath = join(configPath, item);
118
+ const skillPath = join(itemPath, 'SKILL.md');
119
+ return statSync(itemPath).isDirectory() && existsSync(skillPath);
120
+ });
121
+ } catch {
122
+ configured[key] = false;
123
+ }
124
+ } else {
125
+ configured[key] = false;
126
+ }
127
+ } else {
128
+ // 其他工具: 检查配置目录是否存在
129
+ configured[key] = existsSync(configPath);
130
+ }
109
131
  }
110
132
 
111
133
  return configured;
@@ -178,10 +200,22 @@ const setupCommands = async () => {
178
200
  // 创建命令文件
179
201
  for (const command of commands) {
180
202
  const commandContent = tool.createCommand(command.name, command.content);
181
- const commandFilePath = join(
182
- toolConfigDir,
183
- `${command.name}.${tool.fileExtension}`
184
- );
203
+
204
+ let commandFilePath;
205
+ if (tool.useSkillDirectory) {
206
+ // Claude Code: 创建目录结构 skill-name/SKILL.md
207
+ const skillDir = join(toolConfigDir, command.name);
208
+ if (!existsSync(skillDir)) {
209
+ mkdirSync(skillDir, { recursive: true });
210
+ }
211
+ commandFilePath = join(skillDir, `SKILL.${tool.fileExtension}`);
212
+ } else {
213
+ // 其他工具: 创建单个文件 skill-name.md
214
+ commandFilePath = join(
215
+ toolConfigDir,
216
+ `${command.name}.${tool.fileExtension}`
217
+ );
218
+ }
185
219
 
186
220
  writeFileSync(commandFilePath, commandContent, 'utf-8');
187
221
  console.log(`✓ 创建命令: ${commandFilePath}`);