监控、报告并获取针对 JavaScript 和 TypeScript 生产错误的 AI 生成修复,自动分析与 Pull Request 集成。
编码器AI Skill. 编码器捕获生产 JavaScript/TypeScript 错误,用AI分析错误,生成修正——作为GitHub PR或粘贴背提示,用于是一项面向实际任务的技能。它将相关步骤、工具调用和结果整理方式集中到统一流程中,帮助使用者更快完成目标并减少重复操作。
实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。
执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。
Codemend 捕获生产环境中的 JavaScript/TypeScript 错误,利用 AI 进行分析,并生成修复方案——既可直接创建 GitHub PR,也可输出可粘贴至 Lovable、Replit、Cursor 等 AI 编程工具的提示语(prompt)。
向 Codemend 上报一条生产环境错误。该错误将在数秒内由 AI 完成分析。
curl -X POST "https://codemend.ai/api/errors/ingest"
-H "Content-Type: application/json"
-d '{
"key": "'$CODEMEND_API_KEY'",
"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"
}'
响应:
{ "status": "queued", "error_id": "uuid-here" }
获取已上报错误对应的 AI 生成修复方案。返回内容包括问题解释、根本原因、置信度分数,以及一段可直接粘贴至 AI 编程工具的修复提示语(fix prompt)。
curl -s "https://codemend.ai/api/errors/{ERROR_ID}/fix"
-H "x-api-key: $CODEMEND_API_KEY"
响应:
{
"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": "In src/components/List.tsx, add an early return if data is undefined...",
"pr_url": "https://github.com/user/repo/pull/42"
},
"dashboard_url": "https://codemend.ai/errors/uuid"
}
若错误仍在分析中,fix 字段将为 null。请先使用 check_status 查询状态。
检查某条错误是否已完成分析。
curl -s "https://codemend.ai/api/errors/{ERROR_ID}/status"
-H "x-api-key: $CODEMEND_API_KEY"
响应:
{
"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
列出当前项目最近发生的错误。
curl -s "https://codemend.ai/api/errors?limit=10&status=analyzed" -H "x-api-key: $CODEMEND_API_KEY"
响应:
{
"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 的 中:
如您正在使用 AI 编程工具(Lovable、Replit、Bolt 等),可直接粘贴如下提示语:
请将此错误监控脚本添加至我的应用,并将其置于 index.html 的
区域中:
npm install codemend
const codemend = require('codemend');
codemend.init({ apiKey: process.env.CODEMEND_API_KEY });
codemend.setupProcessHandlers();
const codemend = require('codemend');
codemend.init({ apiKey: process.env.CODEMEND_API_KEY });
app.use(codemend.expressErrorHandler());
import codemend from 'codemend/react-native';
codemend.init({ apiKey: 'YOUR_API_KEY' });
codemend.setupErrorHandler();
list_errors 查看最近的错误列表get_fix 获取 AI 生成的修复方案fix_prompt 粘贴至您的 AI 工具中,或在 GitHub 上审阅对应 PR相关专题
热门下载
相关下载
精品课程
共6课时 | 54.7万人学习
共89课时 | 134.1万人学习
共49课时 | 82.5万人学习
最新文章