debug

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Debug

调试

You are tasked with helping debug issues during manual testing or implementation. This command allows you to investigate problems by examining logs, database state, and git history without editing files. Think of this as a way to bootstrap a debugging session without using the primary window's context.
你的任务是在手动测试或实现过程中协助调试问题。该命令允许你通过检查日志、数据库状态和Git历史来排查问题,无需编辑文件。可以将其视为一种在不占用主窗口上下文的情况下启动调试会话的方式。

Initial Response

初始响应

When invoked WITH a plan/ticket file:
I'll help debug issues with [file name]. Let me understand the current state.

What specific problem are you encountering?
- What were you trying to test/implement?
- What went wrong?
- Any error messages?

I'll investigate the logs, database, and git state to help figure out what's happening.
When invoked WITHOUT parameters:
I'll help debug your current issue.

Please describe what's going wrong:
- What are you working on?
- What specific problem occurred?
- When did it last work?

I can investigate logs, database state, and recent changes to help identify the issue.
当调用时附带计划/工单文件:
我将协助调试[文件名]相关的问题。让我先了解当前状态。

你遇到了什么具体问题?
- 你当时在尝试测试/实现什么功能?
- 出现了什么错误?
- 有没有错误提示信息?

我会排查日志、数据库和Git状态,帮助找出问题所在。
当调用时参数:
我将协助调试你当前遇到的问题。

请描述具体问题:
- 你正在开发什么内容?
- 出现了什么具体问题?
- 上次正常运行是什么时候?

我可以排查日志、数据库状态和近期变更,帮助定位问题。

Environment Information

环境信息

You have access to these key locations and tools:
Logs:
  • Application logs (check project-specific locations)
  • Common locations:
    ./logs/
    ,
    ~/.local/share/{app}/
    ,
    /var/log/
Database (if applicable):
  • SQLite databases can be queried with
    sqlite3
  • Check project config for database locations
Git State:
  • Check current branch, recent commits, uncommitted changes
  • Similar to how
    commit
    and
    describe_pr
    commands work
Service Status:
  • Check running processes:
    ps aux | grep {service}
  • Check listening ports:
    lsof -i :{port}
你可以访问以下关键位置和工具:
日志
  • 应用日志(查看项目特定位置)
  • 常见位置:
    ./logs/
    ~/.local/share/{app}/
    /var/log/
数据库(如适用):
  • SQLite数据库可通过
    sqlite3
    查询
  • 查看项目配置获取数据库位置
Git状态
  • 检查当前分支、近期提交、未提交的变更
  • 工作方式与
    commit
    describe_pr
    命令类似
服务状态
  • 检查运行中的进程:
    ps aux | grep {service}
  • 检查监听端口:
    lsof -i :{port}

Process Steps

流程步骤

Step 1: Understand the Problem

步骤1:理解问题

After the user describes the issue:
  1. Read any provided context (plan or ticket file):
    • Understand what they're implementing/testing
    • Note which phase or step they're on
    • Identify expected vs actual behavior
  2. Quick state check:
    • Current git branch and recent commits
    • Any uncommitted changes
    • When the issue started occurring
在用户描述问题后:
  1. 阅读提供的上下文(计划或工单文件):
    • 理解他们正在实现/测试的内容
    • 记录他们所处的阶段或步骤
    • 明确预期行为与实际行为的差异
  2. 快速状态检查
    • 当前Git分支和近期提交
    • 任何未提交的变更
    • 问题开始出现的时间

Step 2: Investigate the Issue

步骤2:排查问题

Spawn parallel Task agents for efficient investigation:
Task 1 - Check Recent Logs:
Find and analyze the most recent logs for errors:
1. Find latest logs: ls -t ./logs/*.log | head -1 (or project-specific location)
2. Search for errors, warnings, or issues around the problem timeframe
3. Note the working directory if shown
4. Look for stack traces or repeated errors
Return: Key errors/warnings with timestamps
Task 2 - Database State (if applicable):
Check the current database state:
1. Locate database file (check project config)
2. Connect: sqlite3 {database_path}
3. Check schema: .tables and .schema for relevant tables
4. Query recent data based on the issue
5. Look for stuck states or anomalies
Return: Relevant database findings
Task 3 - Git and File State:
Understand what changed recently:
1. Check git status and current branch
2. Look at recent commits: git log --oneline -10
3. Check uncommitted changes: git diff
4. Verify expected files exist
5. Look for any file permission issues
Return: Git state and any file issues
启动并行任务代理以高效排查:
任务1 - 检查近期日志:
查找并分析最新的错误日志:
1. 查找最新日志:ls -t ./logs/*.log | head -1(或项目特定位置)
2. 搜索问题发生时间段内的错误、警告或异常
3. 记录显示的工作目录
4. 查找堆栈跟踪或重复出现的错误
返回:带时间戳的关键错误/警告信息
任务2 - 数据库状态(如适用):
检查当前数据库状态:
1. 定位数据库文件(查看项目配置)
2. 连接:sqlite3 {database_path}
3. 检查架构:.tables 和 .schema 查看相关表
4. 根据问题查询近期数据
5. 查找停滞状态或异常情况
返回:相关数据库排查结果
任务3 - Git与文件状态:
了解近期变更:
1. 检查Git状态和当前分支
2. 查看近期提交:git log --oneline -10
3. 检查未提交的变更:git diff
4. 验证预期文件是否存在
5. 查找任何文件权限问题
返回:Git状态和文件相关问题

Step 3: Present Findings

步骤3:呈现排查结果

Based on the investigation, present a focused debug report:
markdown
undefined
基于排查结果,提交一份聚焦的调试报告:
markdown
undefined

Debug Report

调试报告

What's Wrong

问题描述

[Clear statement of the issue based on evidence]
[基于证据的清晰问题陈述]

Evidence Found

排查到的证据

From Logs:
  • [Error/warning with timestamp]
  • [Pattern or repeated issue]
From Database (if applicable):
sql
-- Relevant query and result
[Finding from database]
From Git/Files:
  • [Recent changes that might be related]
  • [File state issues]
来自日志
  • [带时间戳的错误/警告信息]
  • [模式或重复出现的问题]
来自数据库(如适用):
sql
-- 相关查询及结果
[数据库排查发现]
来自Git/文件
  • [可能相关的近期变更]
  • [文件状态问题]

Root Cause

根本原因

[Most likely explanation based on evidence]
[基于证据的最可能解释]

Next Steps

下一步建议

  1. Try This First:
    bash
    [Specific command or action]
  2. If That Doesn't Work:
    • Restart relevant services
    • Check browser console for frontend errors
    • Run with debug flags enabled
  1. 首先尝试
    bash
    [具体命令或操作]
  2. 如果上述方法无效
    • 重启相关服务
    • 检查浏览器控制台的前端错误
    • 启用调试标志运行

Can't Access?

无法访问的内容?

Some issues might be outside my reach:
  • Browser console errors (F12 in browser)
  • MCP server internal state
  • System-level issues
Would you like me to investigate something specific further?
undefined
部分问题可能超出我的处理范围:
  • 浏览器控制台错误(浏览器中按F12)
  • MCP服务器内部状态
  • 系统级问题
你需要我进一步排查特定内容吗?
undefined

Important Notes

重要注意事项

  • Focus on manual testing scenarios - This is for debugging during implementation
  • Always require problem description - Can't debug without knowing what's wrong
  • Read files completely - No limit/offset when reading context
  • Think like
    commit
    or
    describe_pr
    - Understand git state and changes
  • Guide back to user - Some issues (browser console, MCP internals) are outside reach
  • No file editing - Pure investigation only
  • 聚焦手动测试场景 - 此工具用于实现过程中的调试
  • 始终需要问题描述 - 不知道问题所在无法进行调试
  • 完整读取文件 - 读取上下文时无限制/偏移
  • 参考
    commit
    describe_pr
    的工作方式
    - 理解Git状态和变更
  • 引导用户自行检查 - 部分问题(浏览器控制台、MCP内部)超出处理范围
  • 不允许编辑文件 - 仅进行纯排查操作

Quick Reference

快速参考

Find Latest Logs:
bash
ls -t ./logs/*.log | head -1
查找最新日志
bash
ls -t ./logs/*.log | head -1

Or check project-specific log locations

或查看项目特定的日志位置


**Database Queries** (SQLite):
```bash
sqlite3 {database_path} ".tables"
sqlite3 {database_path} ".schema {table}"
sqlite3 {database_path} "SELECT * FROM {table} ORDER BY created_at DESC LIMIT 5;"
Service Check:
bash
ps aux | grep {service_name}
lsof -i :{port}
Git State:
bash
git status
git log --oneline -10
git diff
Remember: This command helps you investigate without burning the primary window's context. Perfect for when you hit an issue during manual testing and need to dig into logs, database, or git state.

**数据库查询**(SQLite):
```bash
sqlite3 {database_path} ".tables"
sqlite3 {database_path} ".schema {table}"
sqlite3 {database_path} "SELECT * FROM {table} ORDER BY created_at DESC LIMIT 5;"
服务检查
bash
ps aux | grep {service_name}
lsof -i :{port}
Git状态
bash
git status
git log --oneline -10
git diff
请记住:此命令可帮助你在不占用主窗口上下文的情况下进行排查。非常适合在手动测试过程中遇到问题时,深入查看日志、数据库或Git状态。