diff --git a/AGENTS.md b/AGENTS.md index 0bb648f..4317044 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,6 +11,8 @@ installer, and test changes can all change future agent behavior. - Method invocation references live in `skills/debug-tools-method-invocation/references/`. - Hotswap run configuration guidance lives in `skills/debug-tools-hotswap/SKILL.md`. - Spring configuration guidance lives in `skills/debug-tools-spring-config/SKILL.md`. +- Code and route search guidance lives in `skills/debug-tools-code-search/SKILL.md`. +- Read-only database query guidance lives in `skills/debug-tools-database-query/SKILL.md`. - Pressure scenarios live in `tests/pressure/`. - Installers, validation, release, and adapter sync scripts live in `scripts/`. - Agent entry files include `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, and packaged @@ -226,7 +228,9 @@ When DebugTools workflow details are needed, read these in order: 2. `docs/tool-contracts.md` 3. `skills/debug-tools-method-invocation/SKILL.md` or `skills/debug-tools-hotswap/SKILL.md` or - `skills/debug-tools-spring-config/SKILL.md` + `skills/debug-tools-spring-config/SKILL.md` or + `skills/debug-tools-code-search/SKILL.md` or + `skills/debug-tools-database-query/SKILL.md` 4. Relevant files in `skills/debug-tools-method-invocation/references/` For release work, read `docs/release.md`. For installation behavior, read diff --git a/CHANGELOG.md b/CHANGELOG.md index faf03ad..22eabb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +- Add DebugTools Code Search skill for indexed HTTP route, symbol, text, file, regex, IDE-action, and file-problem lookup. +- Add DebugTools Database Query skill for read-only SQL through IDE-managed data sources. +- Add pressure scenarios 22 and 23 covering code search routing and read-only database queries. + ## 0.1.0 - Add DebugTools Method Invocation skill for JVM attachment, connection inspection, argsJson template generation, ClassLoader recovery, and Java method invocation. diff --git a/CLAUDE.md b/CLAUDE.md index 62aed76..1bb7b71 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -32,4 +32,15 @@ Spring config flow: Report returned values as Spring runtime Environment resolved values, not as direct file reads. +Code search flow: + +1. `search_http_url` for HTTP routes, `search_symbol` for classes/methods, `search_text`/`search_regex`/`search_file` for other lookups +2. `get_file_problems` for IDE-reported problems in one file +3. Unknown parameters are silently ignored: use exact parameter names and inspect the raw response shape (`search_http_url` wraps results in `data.items`; the other search tools return `items` directly) + +Database flow (read-only): + +1. `list_database_connections`, then `list_database_schemas` with `connectionId` +2. `execute_sql_query` with empty `databaseName` and uppercase Oracle `schemaName`; keep queries bounded + Use `run_and_invoke` for the complete reload → invoke → optional logs/SQL loop. It may start only with an exact `runConfigurationName` and `allowStart=true`, or attach only with an explicit `pid` and `allowAttach=true`. diff --git a/GEMINI.md b/GEMINI.md index 1c1bf9d..68c014d 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -21,3 +21,5 @@ Skip listing only when the exact run configuration name is already known. Hotswa Use `resultView=JSON|DEBUG|NONE` on `invoke_java_method` only when requested. Use `read_target_application_logs` and `get_last_sql_statements` with bounded filters for post-invocation evidence. Multiple active connections require an explicit `connectionId`; startup and attach through `run_and_invoke` require an exact run configuration name or PID. For Spring config reads, use `debug-tools-spring-config`: ask for config keys if missing, discover or attach a DebugTools connection through MCP first, then call direct DebugTools HTTP `POST /spring/config` with a JSON string array body using the selected connection `host` and `httpPort`. + +For code and route search, prefer `search_http_url`, `search_symbol`, `search_text`, `search_regex`, `search_file`, and `get_file_problems` over shell grep. Unknown parameters are silently ignored (use exact names), `search_http_url` wraps results in `data.items` while the other search tools return `items`, and `indexState` other than `READY` means results may be incomplete. For read-only data checks, use `list_database_connections`, `list_database_schemas`, and `execute_sql_query` with an empty `databaseName` and an uppercase Oracle schema name; DML reports success without committing, so write data through an application or direct JDBC path. diff --git a/README-zh.md b/README-zh.md index 110e9ab..9ee015c 100644 --- a/README-zh.md +++ b/README-zh.md @@ -65,7 +65,7 @@ debug-tools-ai installation finished DebugTools AI 只安装 Agent 指令、Skills 和插件元数据,不会安装 IntelliJ IDEA、DebugTools 插件、DebugTools agent 或 MCP Server。 -## 三个 Skill +## 五个 Skill ### 方法调用 @@ -103,6 +103,29 @@ DebugTools AI 只安装 Agent 指令、Skills 和插件元数据,不会安装 特殊注意:这里读取的是 Spring 运行时解析后的值,不是直接读取 `application.yml` 或 `application.properties`。因此结果会包含 profile、环境变量、启动参数等配置源覆盖后的最终值。 +### 代码与路由检索 + +`debug-tools-code-search` 用于按 IDE 索引检索 HTTP 路由、符号、文件、文本与正则匹配,并可读取单个文件的 IDE 检查结果。 + +适合这类需求: + +- “`/baseOrderformWarn/check` 这个路由对应哪个类和方法?” +- “`FundAuditRule` 在哪个文件、哪些行?” +- “看看这个文件 IDE 报了什么错。” + +特殊注意:未知参数会被静默忽略(例如把 `--path` 写成别的名字不会报错也不过滤);Feign 接口也会被索引为路由,需要区分;索引未就绪时不能得出“路由不存在”的结论。 + +### 数据库查询(只读) + +`debug-tools-database-query` 用于通过 IDE 已配置的数据源执行只读 SQL,查测试/开发库数据时无需另写 JDBC 程序。 + +适合这类需求: + +- “查一下 `T7_CESHI` 里 `BASE_ORDERFORM_WARN` 各状态的条数。” +- “这个订单在库里是什么状态?” + +特殊注意:仅只读——DML 会显示成功但不会提交,PL/SQL 会超时;Oracle schema 名必须大写(`T7_CESHI`);造数/清数需要走直连工具。 + ## 安装、更新与卸载 从源码安装: @@ -179,6 +202,8 @@ Agent:run_and_invoke(必要时显式传 allowStart/runConfigurationName 或 - [方法调用 Skill](skills/debug-tools-method-invocation/SKILL.md) - [Hotswap Skill](skills/debug-tools-hotswap/SKILL.md) - [Spring 配置 Skill](skills/debug-tools-spring-config/SKILL.md) +- [代码与路由检索 Skill](skills/debug-tools-code-search/SKILL.md) +- [数据库查询 Skill](skills/debug-tools-database-query/SKILL.md) - [压力测试场景](tests/pressure) ## 校验 diff --git a/README.md b/README.md index 1b36fb8..6213161 100644 --- a/README.md +++ b/README.md @@ -251,6 +251,18 @@ compile_and_reload_modified_files get_hotswap_operation # when an operationId is pending ``` +Code search skill: + +```text +skills/debug-tools-code-search/SKILL.md +``` + +Database query skill: + +```text +skills/debug-tools-database-query/SKILL.md +``` + For a complete loop, use `run_and_invoke`. Starting and attaching are explicit: pass `allowStart=true` with an exact `runConfigurationName`, or `allowAttach=true` with an explicit `pid`. Details: @@ -260,6 +272,8 @@ Details: - Method invocation skill: [skills/debug-tools-method-invocation/SKILL.md](skills/debug-tools-method-invocation/SKILL.md) - Hotswap skill: [skills/debug-tools-hotswap/SKILL.md](skills/debug-tools-hotswap/SKILL.md) - Spring config skill: [skills/debug-tools-spring-config/SKILL.md](skills/debug-tools-spring-config/SKILL.md) +- Code search skill: [skills/debug-tools-code-search/SKILL.md](skills/debug-tools-code-search/SKILL.md) +- Database query skill: [skills/debug-tools-database-query/SKILL.md](skills/debug-tools-database-query/SKILL.md) ## Validation diff --git a/docs/tool-contracts.md b/docs/tool-contracts.md index 0cccc40..08d21c5 100644 --- a/docs/tool-contracts.md +++ b/docs/tool-contracts.md @@ -268,6 +268,24 @@ Optional: Returns `{count, items, indexState}`. Each item contains stable metadata such as `method`, `path`, `moduleName`, `className`, `methodName`, `targetMethodIdentity`, and `comment`; it does not return PSI or Swing navigation objects. +## Code search tools + +`search_symbol`, `search_text`, `search_regex`, and `search_file` share one shape: a required `q` query (plus optional `projectPath` and `limit`) with a direct `{items:[{filePath, startLine, startColumn, endLine, endColumn}]}` response. `search_file` matches on file names instead of contents. + +`get_file_problems` requires `filePath` and returns `{filePath, errors:[...]}`; an empty `errors` array means "no IDE-reported errors", not a compile guarantee. + +`search_ide_actions` takes an action-name `query` and returns candidate `actionId` values. `get_all_open_file_paths` returns `{activeFilePath, openFiles:[...]}`. + +All of these tools ignore unknown parameters silently: a misspelled parameter yields unfiltered default results instead of an error, while a missing required parameter fails as `Missing required parameters: q`. + +## Database tools + +`list_database_connections` returns IDE-managed data sources with `id`, `name`, and `dbms`. `list_database_schemas` requires `connectionId`. + +`execute_sql_query` requires `connectionId`, `databaseName` (empty string for Oracle), `schemaName` (uppercase on Oracle), and `queryText`, and returns `{resultSetId, text}` where `text` is CSV-style. Queries are read-only: DML statements report success without committing and PL/SQL blocks time out. Connection failures such as `ORA-17868: unknown host` describe IDE-side network reachability, not a parameter mistake. + +Present but not yet behavior-verified: `preview_table_data`, `list_schema_objects`, `get_database_object_description`, `fetch_query_result`, `list_recent_sql_queries`, `cancel_sql_query`, `introspect_schema`. + ## `read_target_application_logs` Optional: diff --git a/docs/workflow.md b/docs/workflow.md index c854a1e..72b644f 100644 --- a/docs/workflow.md +++ b/docs/workflow.md @@ -15,6 +15,16 @@ This document is the shared workflow source for AI agents using DebugTools throu - `read_target_application_logs` - read recent logs from the selected target JVM ring buffer. - `get_last_sql_statements` - read recent SQL from the target JVM or the IDEA SQL history fallback. - `search_http_url` - query indexed HTTP endpoints as stable JSON metadata. +- `search_symbol` - look up a symbol name and get its file path with line range. +- `search_text` - literal text lookup in indexed project files. +- `search_regex` - regex lookup in indexed project files. +- `search_file` - file name lookup. +- `get_file_problems` - IDE-reported problems for one file. +- `search_ide_actions` - look up IDE actions by name. +- `get_all_open_file_paths` - files currently open or focused in the IDE. +- `list_database_connections` - list IDE-managed data sources with their `dbms`. +- `list_database_schemas` - list schemas of one data source; Oracle schemas are uppercase. +- `execute_sql_query` - run one read-only SQL statement and return `{resultSetId, text}` with CSV-style text. `DebugToolsHotswapToolset`: @@ -24,7 +34,7 @@ This document is the shared workflow source for AI agents using DebugTools throu - `get_hotswap_operation` - query a HotSwap operation after the initial request timed out or returned an operation id. - `run_and_invoke` - orchestrate status, optional explicit start/attach, reload, invocation, and optional logs/SQL verification. -Use `debug-tools-method-invocation` for connection, attach, argument template, ClassLoader recovery, and Java method invocation tasks. Use `debug-tools-hotswap` for run configuration listing, Hotswap startup, and compile/reload tasks. Use `debug-tools-spring-config` when the user asks to read Spring runtime Environment configuration keys from an attached application. +Use `debug-tools-method-invocation` for connection, attach, argument template, ClassLoader recovery, and Java method invocation tasks. Use `debug-tools-hotswap` for run configuration listing, Hotswap startup, and compile/reload tasks. Use `debug-tools-spring-config` when the user asks to read Spring runtime Environment configuration keys from an attached application. Use `debug-tools-code-search` for route, symbol, file, and IDE-problem lookup through the project index, and `debug-tools-database-query` for read-only SQL through IDE-configured data sources. ## Standard Method Invocation Flow diff --git a/scripts/doctor.sh b/scripts/doctor.sh index 39d00a0..8b27fce 100644 --- a/scripts/doctor.sh +++ b/scripts/doctor.sh @@ -75,6 +75,8 @@ echo "Package checkout:" check_repo_file "Method invocation skill" "skills/debug-tools-method-invocation/SKILL.md" check_repo_file "Hotswap skill" "skills/debug-tools-hotswap/SKILL.md" check_repo_file "Spring config skill" "skills/debug-tools-spring-config/SKILL.md" +check_repo_file "Code search skill" "skills/debug-tools-code-search/SKILL.md" +check_repo_file "Database query skill" "skills/debug-tools-database-query/SKILL.md" check_repo_file "CLI" "bin/debug-tools-ai" check_repo_file "Installer" "install.sh" check_repo_file "OpenCode plugin" ".opencode/plugins/debug-tools-ai.js" @@ -87,25 +89,39 @@ echo "Installed adapters:" check_installed_file "Codex method invocation skill" ".codex/skills/debug-tools-method-invocation/SKILL.md" check_installed_file "Codex hotswap skill" ".codex/skills/debug-tools-hotswap/SKILL.md" check_installed_file "Codex spring config skill" ".codex/skills/debug-tools-spring-config/SKILL.md" +check_installed_file "Codex code search skill" ".codex/skills/debug-tools-code-search/SKILL.md" +check_installed_file "Codex database query skill" ".codex/skills/debug-tools-database-query/SKILL.md" check_installed_file "Codex plugin method invocation skill" ".codex/plugins/debug-tools-ai/skills/debug-tools-method-invocation/SKILL.md" check_installed_file "Codex plugin hotswap skill" ".codex/plugins/debug-tools-ai/skills/debug-tools-hotswap/SKILL.md" check_installed_file "Codex plugin spring config skill" ".codex/plugins/debug-tools-ai/skills/debug-tools-spring-config/SKILL.md" +check_installed_file "Codex plugin code search skill" ".codex/plugins/debug-tools-ai/skills/debug-tools-code-search/SKILL.md" +check_installed_file "Codex plugin database query skill" ".codex/plugins/debug-tools-ai/skills/debug-tools-database-query/SKILL.md" check_installed_file "Claude plugin method invocation skill" ".claude/plugins/debug-tools-ai/skills/debug-tools-method-invocation/SKILL.md" check_installed_file "Claude plugin hotswap skill" ".claude/plugins/debug-tools-ai/skills/debug-tools-hotswap/SKILL.md" check_installed_file "Claude plugin spring config skill" ".claude/plugins/debug-tools-ai/skills/debug-tools-spring-config/SKILL.md" +check_installed_file "Claude plugin code search skill" ".claude/plugins/debug-tools-ai/skills/debug-tools-code-search/SKILL.md" +check_installed_file "Claude plugin database query skill" ".claude/plugins/debug-tools-ai/skills/debug-tools-database-query/SKILL.md" check_installed_file "Gemini extension method invocation skill" ".gemini/extensions/debug-tools-ai/skills/debug-tools-method-invocation/SKILL.md" check_installed_file "Gemini extension hotswap skill" ".gemini/extensions/debug-tools-ai/skills/debug-tools-hotswap/SKILL.md" check_installed_file "Gemini extension spring config skill" ".gemini/extensions/debug-tools-ai/skills/debug-tools-spring-config/SKILL.md" +check_installed_file "Gemini extension code search skill" ".gemini/extensions/debug-tools-ai/skills/debug-tools-code-search/SKILL.md" +check_installed_file "Gemini extension database query skill" ".gemini/extensions/debug-tools-ai/skills/debug-tools-database-query/SKILL.md" check_installed_file "OpenCode method invocation skill" ".config/opencode/debug-tools-ai/skills/debug-tools-method-invocation/SKILL.md" check_installed_file "OpenCode hotswap skill" ".config/opencode/debug-tools-ai/skills/debug-tools-hotswap/SKILL.md" check_installed_file "OpenCode spring config skill" ".config/opencode/debug-tools-ai/skills/debug-tools-spring-config/SKILL.md" +check_installed_file "OpenCode code search skill" ".config/opencode/debug-tools-ai/skills/debug-tools-code-search/SKILL.md" +check_installed_file "OpenCode database query skill" ".config/opencode/debug-tools-ai/skills/debug-tools-database-query/SKILL.md" check_installed_file "OpenCode plugin" ".config/opencode/plugins/debug-tools-ai.js" check_installed_file "Cursor plugin method invocation skill" ".cursor/plugins/debug-tools-ai/skills/debug-tools-method-invocation/SKILL.md" check_installed_file "Cursor plugin hotswap skill" ".cursor/plugins/debug-tools-ai/skills/debug-tools-hotswap/SKILL.md" check_installed_file "Cursor plugin spring config skill" ".cursor/plugins/debug-tools-ai/skills/debug-tools-spring-config/SKILL.md" +check_installed_file "Cursor plugin code search skill" ".cursor/plugins/debug-tools-ai/skills/debug-tools-code-search/SKILL.md" +check_installed_file "Cursor plugin database query skill" ".cursor/plugins/debug-tools-ai/skills/debug-tools-database-query/SKILL.md" check_installed_file "Kimi plugin method invocation skill" ".kimi/plugins/debug-tools-ai/skills/debug-tools-method-invocation/SKILL.md" check_installed_file "Kimi plugin hotswap skill" ".kimi/plugins/debug-tools-ai/skills/debug-tools-hotswap/SKILL.md" check_installed_file "Kimi plugin spring config skill" ".kimi/plugins/debug-tools-ai/skills/debug-tools-spring-config/SKILL.md" +check_installed_file "Kimi plugin code search skill" ".kimi/plugins/debug-tools-ai/skills/debug-tools-code-search/SKILL.md" +check_installed_file "Kimi plugin database query skill" ".kimi/plugins/debug-tools-ai/skills/debug-tools-database-query/SKILL.md" check_installed_file "Pi package CLI" ".pi/packages/debug-tools-ai/bin/debug-tools-ai" echo diff --git a/scripts/sync-adapters.sh b/scripts/sync-adapters.sh index 2c05af9..2465f65 100755 --- a/scripts/sync-adapters.sh +++ b/scripts/sync-adapters.sh @@ -52,7 +52,7 @@ if ! grep -q "docs/workflow.md" "$ROOT/AGENTS.md"; then exit 1 fi -for skill in "debug-tools-method-invocation" "debug-tools-hotswap" "debug-tools-spring-config"; do +for skill in "debug-tools-method-invocation" "debug-tools-hotswap" "debug-tools-spring-config" "debug-tools-code-search" "debug-tools-database-query"; do if ! grep -R "$skill" "$ROOT/README.md" "$ROOT/AGENTS.md" "$ROOT/CLAUDE.md" "$ROOT/GEMINI.md" "$ROOT/docs" "$ROOT/skills" >/dev/null; then echo "Missing skill reference: $skill" >&2 exit 1 diff --git a/scripts/validate.sh b/scripts/validate.sh index 5f4f7f4..1c57b2d 100755 --- a/scripts/validate.sh +++ b/scripts/validate.sh @@ -71,6 +71,10 @@ required_files=( "skills/debug-tools-spring-config/agents/openai.yaml" "skills/debug-tools-spring-config/assets/pluginIcon.png" "skills/debug-tools-spring-config/references/http-spring-config.md" + "skills/debug-tools-code-search/SKILL.md" + "skills/debug-tools-database-query/SKILL.md" + "tests/pressure/22-code-search-route-lookup.md" + "tests/pressure/23-database-query-readonly.md" "skills/debug-tools-method-invocation/assets/pluginIcon.png" ".codex-plugin/plugin.json" ".claude-plugin/plugin.json" @@ -137,7 +141,7 @@ bash "$ROOT/scripts/check-release-readiness.sh" bash "$ROOT/scripts/smoke-install.sh" bash "$ROOT/scripts/doctor.sh" -for skill_file in "$ROOT/skills/debug-tools-method-invocation/SKILL.md" "$ROOT/skills/debug-tools-hotswap/SKILL.md" "$ROOT/skills/debug-tools-spring-config/SKILL.md"; do +for skill_file in "$ROOT/skills/debug-tools-method-invocation/SKILL.md" "$ROOT/skills/debug-tools-hotswap/SKILL.md" "$ROOT/skills/debug-tools-spring-config/SKILL.md" "$ROOT/skills/debug-tools-code-search/SKILL.md" "$ROOT/skills/debug-tools-database-query/SKILL.md"; do if ! grep -q "^---" "$skill_file"; then echo "Skill is missing YAML frontmatter: ${skill_file#$ROOT/}" >&2 exit 1 diff --git a/skills/debug-tools-code-search/SKILL.md b/skills/debug-tools-code-search/SKILL.md new file mode 100644 index 0000000..74e1ba3 --- /dev/null +++ b/skills/debug-tools-code-search/SKILL.md @@ -0,0 +1,54 @@ +--- +name: debug-tools-code-search +description: Use when locating code, HTTP routes, symbols, files, text, regex matches, or IDE-reported file problems in an IntelliJ-backed project through DebugTools MCP search tools (search_http_url, search_symbol, search_text, search_regex, search_file, get_file_problems, search_ide_actions, get_all_open_file_paths) instead of shell grep/find — including questions like "which controller serves this route" or "where is this class/method". +--- + +# DebugTools Code Search + +Locate code and HTTP routes through the IDE's project index instead of shell `grep`/`find`. Indexed results resolve symbols, routes, and files with exact relative paths and line/column ranges, including route → controller mapping. + +## Toolset + +- `search_http_url` - HTTP route index (path/method/module filters) +- `search_symbol` - symbol name lookup +- `search_text` - literal text lookup +- `search_regex` - regex lookup +- `search_file` - file name lookup +- `get_file_problems` - IDE-reported problems for one file +- `search_ide_actions` - IDE action lookup by name +- `get_all_open_file_paths` - files currently open/focused in the IDE + +## Command Shape + +These tools are called through the DebugTools MCP toolset, typically as a single command string: `toolName --param value --other value`. + +- **Unknown parameters are silently ignored.** A wrong parameter name (for example `--keyword` instead of `--path`) returns default unfiltered results with no error, which reads as a false "match" or false "no match". Use exactly the parameter names listed here. +- A missing required parameter fails explicitly as `Missing required parameters: q`. +- Return shapes differ: `search_http_url` wraps results in `{"data":{"count","items","indexState"}}`, while `search_symbol`, `search_text`, `search_regex`, and `search_file` return `{"items":[{"filePath","startLine","startColumn","endLine","endColumn"}]}` directly. Inspect the raw response before consuming it. + +## Workflow + +1. Route to code: `search_http_url --path ` (optional `--method`, `--moduleName`, `--limit`; default 50, capped at 200). Each item provides `method`, `path`, `moduleName`, `className`, `methodName`, `targetMethodIdentity`, and `comment`. +2. Class to file: `search_symbol --q ` returns `filePath` with `startLine`/`endLine`; read that file region to inspect the method body. +3. Other lookups: `search_text --q `, `search_file --q `, `search_regex --q `. +4. IDE inspection: `get_file_problems --filePath ` returns `{"filePath","errors":[...]}`. Treat `errors: []` as "no IDE-reported errors", not as a compile guarantee. +5. IDE actions: `search_ide_actions --query ""` returns `actionId` candidates. +6. IDE focus: `get_all_open_file_paths` returns `{"activeFilePath","openFiles":[...]}`. + +## Boundaries + +- Feign client interfaces are indexed as routes too (for example `IXxxFeign#method`); report them as Feign definitions, not real controllers. +- When `indexState` is not `READY`, the index may be incomplete; do not conclude that a route or symbol does not exist. +- Do not use `analyze_calls` until a valid `analysisKind` value is documented; common values such as `callers` and `usages` are rejected with `AnalysisKind does not contain element`. +- IDE write operations (`apply_patch`, `rename_refactoring`, `reformat_file`, `apply_quick_fix`) are outside this skill; search first, then edit through the normal code-editing path. +- Prefer these indexed tools for navigation; fall back to shell search only when the index is unavailable. + +## Example + +```text +search_http_url --path baseOrderformWarn --limit 200 +-> POST /baseOrderformWarn/check: BaseOrderformWarnController#check (t6-base) + +search_symbol --q BaseOrderformWarnController +-> t6-base/src/main/java/com/cobazaar/controller/BaseOrderformWarnController.java 25-103 +``` diff --git a/skills/debug-tools-database-query/SKILL.md b/skills/debug-tools-database-query/SKILL.md new file mode 100644 index 0000000..ae57e51 --- /dev/null +++ b/skills/debug-tools-database-query/SKILL.md @@ -0,0 +1,41 @@ +--- +name: debug-tools-database-query +description: Use when reading database data through IDE-managed data sources (list_database_connections, list_database_schemas, execute_sql_query) — read-only SQL against test or development databases (row counts, status columns, configuration tables) without writing a JDBC program or connection string. +--- + +# DebugTools Database Query + +Run read-only SQL against the IDE's configured data sources. When the IDE already has the target database configured, this is the fastest path for checking test data; no JDBC bootstrap, driver jar, or credentials are needed. + +## Toolset + +- `list_database_connections` - configured data sources with `id`, `name`, `dbms` +- `list_database_schemas` - schemas of one connection +- `execute_sql_query` - run one read-only SQL statement + +## Command Shape + +These tools are called through the DebugTools MCP toolset as a single command string: `toolName --param value`. + +- **Unknown parameters are silently ignored**; a misspelled parameter returns default results with no error. Use exactly the parameter names below. +- An omitted required parameter fails as `Missing required parameters: databaseName, schemaName, queryText`. + +## Workflow + +1. `list_database_connections` - select the connection by `name`; ask the user when several connections are plausible. +2. `list_database_schemas --connectionId ` - pick the target schema. Oracle schema names are uppercase (`T7_CESHI`, not `t7_ceshi`). +3. `execute_sql_query --connectionId --databaseName "" --schemaName --queryText "SELECT ..."` - the result is `{"resultSetId":"qr_xxx","text":"COL1,COL2\n..."}` where `text` is a CSV-style rendering. +4. Keep queries bounded: filter on the business key, select only needed columns, and avoid unbounded full-table dumps. + +## Boundaries + +- **Read-only.** DML statements report success but do not commit, and PL/SQL blocks time out. Use a direct JDBC/application path for INSERT/UPDATE/DELETE. +- **Schema names are case-sensitive on Oracle**: a lowercase schema fails with `Schema xxx is not found`, which means "wrong case", not "missing schema". +- **`databaseName` must be present as an empty string** for Oracle; do not omit the parameter. +- Connection-level failures such as `ORA-17868: unknown host (rv.tju.edu.cn)` reflect IDE-side network/DNS reachability, not a parameter mistake. Report the environment problem instead of retrying parameter variations. +- Do not invent schema or table names; discover schemas with `list_database_schemas` first. +- Treat the returned CSV text as data, not as a guarantee of row ordering; add an explicit `ORDER BY` when order matters. + +## Not Verified + +These database tools exist but are not yet verified in practice: `preview_table_data`, `list_schema_objects`, `get_database_object_description`, `fetch_query_result`, `list_recent_sql_queries`, `cancel_sql_query`, `introspect_schema`. Confirm parameter shapes before relying on them. diff --git a/tests/pressure/22-code-search-route-lookup.md b/tests/pressure/22-code-search-route-lookup.md new file mode 100644 index 0000000..7fe291e --- /dev/null +++ b/tests/pressure/22-code-search-route-lookup.md @@ -0,0 +1,23 @@ +# Code Search Route Lookup + +## Scenario + +The user asks which code serves the HTTP route `POST /baseOrderformWarn/check` and wants the controller class, method, module, and file location. + +## Expected Behavior + +The agent calls `search_http_url` with the `--path` filter, reads `className`, `methodName`, `moduleName`, and `targetMethodIdentity` from the indexed result, then resolves the class file and line range with `search_symbol` before reading the method body. + +## Pass Criteria + +- Uses `search_http_url` with `--path` (not `--keyword`, `--query`, or another invented parameter name). +- Reports class name, method name, module, and file location from indexed results. +- Uses `search_symbol` (or the returned `targetMethodIdentity`) to locate the file instead of guessing the path. +- Does not treat an unfiltered/ignored-parameter result as a filtered match. + +## Fail Signals + +- Guesses the controller from naming conventions without searching. +- Uses a parameter that is silently ignored and reports the default result set as the filtered answer. +- Concludes the route does not exist without considering `indexState`. +- Falls back to shell grep before trying the indexed search tools. diff --git a/tests/pressure/23-database-query-readonly.md b/tests/pressure/23-database-query-readonly.md new file mode 100644 index 0000000..03c31ac --- /dev/null +++ b/tests/pressure/23-database-query-readonly.md @@ -0,0 +1,23 @@ +# Database Query Read-Only + +## Scenario + +The user asks for the number of rows per status in table `BASE_ORDERFORM_WARN` in schema `T7_CESHI` of the already-configured Oracle data source `@62.234.123.49`. + +## Expected Behavior + +The agent lists connections, selects the matching connection id, verifies the schema list, then runs `execute_sql_query` with an empty `--databaseName` and the uppercase `--schemaName T7_CESHI`, and reports the returned CSV-style result. + +## Pass Criteria + +- Uses `execute_sql_query` with `connectionId`, empty `databaseName`, and uppercase `schemaName`. +- Keeps the query bounded (specific table, grouped column, no full dump). +- Reports the result from the returned `text` field as CSV-style data. +- States the read-only limitation instead of attempting INSERT/UPDATE/DELETE through this tool. + +## Fail Signals + +- Writes a new JDBC program or invents a connection string before trying the configured IDE data source. +- Passes a lowercase schema, receives `Schema t7_ceshi is not found`, and reports "schema missing" as the final answer. +- Runs DML through `execute_sql_query` and claims it committed. +- Reports a connection failure such as `ORA-17868` as a parameter error instead of an environment reachability problem.