AI-powered error monitoring — report errors, get AI fixes, and list recent errors
Codemend 捕获生产环境中的 JavaScript/TypeScript 错误,通过 AI 进行分析,并生成修复方案——既可以作为 GitHub PR 提交,也可以生成粘贴提示,供 Lovable、Replit 和 Cursor 等 AI 编码工具使用。
向 Codemend 报告一个生产环境错误。AI 将在数秒内分析该错误。
bash
curl -X POST https://codemend.ai/api/errors/ingest \
-H Content-Type: application/json \
-d {
key: $CODEMENDAPIKEY,
message: TypeError: Cannot read properties of undefined (reading \map\),
stack: TypeError: Cannot read properties of undefined\n at renderList (src/components/List.tsx:15:23),
source_url: https://myapp.com/dashboard,
source_type: openclaw
}
响应:
json
{ status: queued, error_id: uuid-here }
获取针对已报告错误的 AI 生成修复方案。包含解释、根本原因、置信度分数以及可粘贴到 AI 编码工具中的修复提示。
bash
curl -s https://codemend.ai/api/errors/{ERROR_ID}/fix \
-H x-api-key: $CODEMENDAPIKEY
响应:
json
{
error: {
id: uuid,
status: analyzed,
message: TypeError: Cannot read properties of undefined,
stack_trace: ...,
source_url: https://myapp.com/dashboard
},
fix: {
id: uuid,
explanation: map() 调用失败,因为首次渲染时 data 为 undefined,
root_cause: 数组操作前缺少空值检查,
confidence: 0.92,
fix_prompt: 在 src/components/List.tsx 中,如果 data 为 undefined,则添加提前返回...,
pr_url: https://github.com/user/repo/pull/42
},
dashboard_url: https://codemend.ai/errors/uuid
}
如果错误仍在分析中,fix 字段将为 null。请先使用 check_status 轮询。
检查错误是否已被分析。
bash
curl -s https://codemend.ai/api/errors/{ERROR_ID}/status \
-H x-api-key: $CODEMENDAPIKEY
响应:
json
{
status: analyzed,
message: TypeError: Cannot read properties of undefined,
has_fix: true,
fix_id: uuid-here,
dashboard_url: https://codemend.ai/dashboard/errors/uuid
}
状态:new → analyzing → analyzed / fix_applied / ignored
列出该项目最近的错误。
bash
curl -s https://codemend.ai/api/errors?limit=10&status=analyzed \
-H x-api-key: $CODEMENDAPIKEY
响应:
json
{
errors: [
{
id: uuid,
status: analyzed,
message: TypeError: Cannot read properties of undefined,
source_type: openclaw,
has_fix: true,
fix_id: uuid,
created_at: 2026-03-11T12:00:00Z
}
],
total: 42
}
添加到 HTML 的
中:html
或者,如果使用 AI 编码工具(Lovable、Replit、Bolt 等),粘贴以下提示:
将以下错误监控脚本添加到我的应用中。将其放在 index.html 的
部分:
bash
npm install codemend
javascript
const codemend = require(codemend);
codemend.init({ apiKey: process.env.CODEMENDAPIKEY });
codemend.setupProcessHandlers();
javascript
const codemend = require(codemend);
codemend.init({ apiKey: process.env.CODEMENDAPIKEY });
app.use(codemend.expressErrorHandler());
javascript
import codemend from codemend/react-native;
codemend.init({ apiKey: YOURAPIKEY });
codemend.setupErrorHandler();
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 codemend-1775883602 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 codemend-1775883602 技能
skillhub install codemend-1775883602
文件大小: 4.06 KB | 发布时间: 2026-4-12 09:30