llm-sentry-tools 1.0.1 → 1.1.0
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 +16 -7
- package/package.json +1 -1
- package/scripts/setup-commands.js +86 -17
package/README.md
CHANGED
|
@@ -10,9 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
- 🔍 **智能错误分析**:自动从 Sentry 获取错误详情并进行深度分析
|
|
12
12
|
- 🛠️ **自动错误修复**:AI 辅助修复代码,减少人工调试时间
|
|
13
|
-
- 🤖
|
|
13
|
+
- 🤖 **广泛的 AI 工具支持**:支持 7 款主流 AI 编程工具
|
|
14
|
+
- Claude Code、Cursor、Windsurf、Continue
|
|
15
|
+
- Antigravity、Cline、GitHub Copilot
|
|
14
16
|
- 🎯 **简单易用**:通过斜杠命令快速调用,只需粘贴 Sentry URL
|
|
15
17
|
- 🏢 **自建 Sentry 支持**:完美支持自建 Sentry 站点
|
|
18
|
+
- 🔄 **智能检测**:自动检测已配置的工具,避免重复配置
|
|
16
19
|
|
|
17
20
|
## 📦 安装
|
|
18
21
|
|
|
@@ -48,18 +51,24 @@ npx llm-sentry-tools setup-commands
|
|
|
48
51
|
```
|
|
49
52
|
|
|
50
53
|
脚本会引导你:
|
|
51
|
-
1.
|
|
54
|
+
1. **输入项目根目录路径**(默认为当前目录)
|
|
55
|
+
2. **选择要配置的 AI 工具**(支持多选,空格选择,回车确认,✓ 表示已配置)
|
|
52
56
|
- ✅ Claude Code
|
|
53
57
|
- ✅ Cursor
|
|
54
58
|
- ✅ Windsurf
|
|
55
59
|
- ✅ Continue
|
|
56
|
-
|
|
60
|
+
- ✅ Antigravity
|
|
61
|
+
- ✅ Cline
|
|
62
|
+
- ✅ GitHub Copilot
|
|
57
63
|
|
|
58
64
|
配置完成后,对应的命令文件会自动创建:
|
|
59
|
-
- Claude Code → `.claude/skills/`
|
|
60
|
-
- Cursor → `.cursor/
|
|
61
|
-
- Windsurf → `.windsurf/commands/`
|
|
62
|
-
- Continue → `.continue/
|
|
65
|
+
- **Claude Code** → `.claude/skills/`
|
|
66
|
+
- **Cursor** → `.cursor/prompts/`
|
|
67
|
+
- **Windsurf** → `.windsurf/commands/`
|
|
68
|
+
- **Continue** → `.continue/prompts/`
|
|
69
|
+
- **Antigravity** → `.agent/workflows/`
|
|
70
|
+
- **Cline** → `.clinerules/workflows/`
|
|
71
|
+
- **GitHub Copilot** → `.github/prompts/`
|
|
63
72
|
|
|
64
73
|
## 💡 使用方法
|
|
65
74
|
|
package/package.json
CHANGED
|
@@ -17,9 +17,12 @@ const AI_TOOLS = {
|
|
|
17
17
|
configDir: '.claude/skills',
|
|
18
18
|
fileExtension: 'md',
|
|
19
19
|
createCommand: (commandName, promptContent) => {
|
|
20
|
-
|
|
20
|
+
const descriptions = {
|
|
21
|
+
'analyze-sentry-error': 'Sentry 错误分析',
|
|
22
|
+
'fix-sentry-error': 'Sentry 错误修复'
|
|
23
|
+
};
|
|
21
24
|
return `---
|
|
22
|
-
description: ${commandName
|
|
25
|
+
description: ${descriptions[commandName] || commandName}
|
|
23
26
|
---
|
|
24
27
|
|
|
25
28
|
${promptContent}`;
|
|
@@ -27,7 +30,7 @@ ${promptContent}`;
|
|
|
27
30
|
},
|
|
28
31
|
'cursor': {
|
|
29
32
|
name: 'Cursor',
|
|
30
|
-
configDir: '.cursor/
|
|
33
|
+
configDir: '.cursor/prompts',
|
|
31
34
|
fileExtension: 'md',
|
|
32
35
|
createCommand: (commandName, promptContent) => promptContent
|
|
33
36
|
},
|
|
@@ -39,24 +42,100 @@ ${promptContent}`;
|
|
|
39
42
|
},
|
|
40
43
|
'continue': {
|
|
41
44
|
name: 'Continue',
|
|
42
|
-
configDir: '.continue/
|
|
45
|
+
configDir: '.continue/prompts',
|
|
46
|
+
fileExtension: 'prompt',
|
|
47
|
+
createCommand: (commandName, promptContent) => {
|
|
48
|
+
const descriptions = {
|
|
49
|
+
'analyze-sentry-error': 'Sentry 错误分析',
|
|
50
|
+
'fix-sentry-error': 'Sentry 错误修复'
|
|
51
|
+
};
|
|
52
|
+
return `---
|
|
53
|
+
name: ${commandName}
|
|
54
|
+
description: ${descriptions[commandName] || commandName}
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
${promptContent}`;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
'antigravity': {
|
|
61
|
+
name: 'Antigravity',
|
|
62
|
+
configDir: '.agent/workflows',
|
|
63
|
+
fileExtension: 'md',
|
|
64
|
+
createCommand: (commandName, promptContent) => {
|
|
65
|
+
const descriptions = {
|
|
66
|
+
'analyze-sentry-error': 'Sentry 错误分析',
|
|
67
|
+
'fix-sentry-error': 'Sentry 错误修复'
|
|
68
|
+
};
|
|
69
|
+
return `---
|
|
70
|
+
description: ${descriptions[commandName] || commandName}
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
${promptContent}`;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
'cline': {
|
|
77
|
+
name: 'Cline',
|
|
78
|
+
configDir: '.clinerules/workflows',
|
|
43
79
|
fileExtension: 'md',
|
|
44
80
|
createCommand: (commandName, promptContent) => promptContent
|
|
81
|
+
},
|
|
82
|
+
'github-copilot': {
|
|
83
|
+
name: 'GitHub Copilot',
|
|
84
|
+
configDir: '.github/prompts',
|
|
85
|
+
fileExtension: 'prompt.md',
|
|
86
|
+
createCommand: (commandName, promptContent) => {
|
|
87
|
+
const descriptions = {
|
|
88
|
+
'analyze-sentry-error': 'Sentry 错误分析',
|
|
89
|
+
'fix-sentry-error': 'Sentry 错误修复'
|
|
90
|
+
};
|
|
91
|
+
return `---
|
|
92
|
+
name: ${commandName}
|
|
93
|
+
description: ${descriptions[commandName] || commandName}
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
${promptContent}`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// 检测已配置的工具
|
|
102
|
+
const detectConfiguredTools = (projectPath) => {
|
|
103
|
+
const configured = {};
|
|
104
|
+
|
|
105
|
+
for (const [key, tool] of Object.entries(AI_TOOLS)) {
|
|
106
|
+
// 检查工具配置目录是否存在
|
|
107
|
+
const configPath = join(projectPath, tool.configDir);
|
|
108
|
+
configured[key] = existsSync(configPath);
|
|
45
109
|
}
|
|
110
|
+
|
|
111
|
+
return configured;
|
|
46
112
|
};
|
|
47
113
|
|
|
48
114
|
const setupCommands = async () => {
|
|
49
115
|
try {
|
|
116
|
+
// 先询问项目路径
|
|
117
|
+
const { projectPath } = await inquirer.prompt([
|
|
118
|
+
{
|
|
119
|
+
type: 'input',
|
|
120
|
+
name: 'projectPath',
|
|
121
|
+
message: '请输入项目根目录路径(留空使用当前目录):',
|
|
122
|
+
default: process.cwd()
|
|
123
|
+
}
|
|
124
|
+
]);
|
|
125
|
+
|
|
126
|
+
// 检测已配置的工具
|
|
127
|
+
const configuredTools = detectConfiguredTools(projectPath);
|
|
128
|
+
|
|
50
129
|
// 让用户选择要配置的 AI 工具
|
|
51
130
|
const { selectedTools } = await inquirer.prompt([
|
|
52
131
|
{
|
|
53
132
|
type: 'checkbox',
|
|
54
133
|
name: 'selectedTools',
|
|
55
|
-
message: '请选择要配置的 AI
|
|
134
|
+
message: '请选择要配置的 AI 工具(空格选择,回车确认,✓ 表示已配置):',
|
|
56
135
|
choices: Object.entries(AI_TOOLS).map(([key, value]) => ({
|
|
57
|
-
name: value.name,
|
|
136
|
+
name: configuredTools[key] ? `${value.name} ✓` : value.name,
|
|
58
137
|
value: key,
|
|
59
|
-
checked: false
|
|
138
|
+
checked: configuredTools[key] || false
|
|
60
139
|
})),
|
|
61
140
|
validate: (answer) => {
|
|
62
141
|
if (answer.length === 0) {
|
|
@@ -67,16 +146,6 @@ const setupCommands = async () => {
|
|
|
67
146
|
}
|
|
68
147
|
]);
|
|
69
148
|
|
|
70
|
-
// 询问项目路径
|
|
71
|
-
const { projectPath } = await inquirer.prompt([
|
|
72
|
-
{
|
|
73
|
-
type: 'input',
|
|
74
|
-
name: 'projectPath',
|
|
75
|
-
message: '请输入项目根目录路径(留空使用当前目录):',
|
|
76
|
-
default: process.cwd()
|
|
77
|
-
}
|
|
78
|
-
]);
|
|
79
|
-
|
|
80
149
|
console.log('\n开始配置命令...\n');
|
|
81
150
|
|
|
82
151
|
// 读取 prompt 模板
|