mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-09-05 20:03:43 +08:00
fix(code-intelligence): 强制 Lsp 优先并要求降级显式声明 (#101)
## 背景 / Background desirecore/desirecore#2248:真机测试中 code-intelligence 技能被绕过——模型未加载技能、未解锁 `Lsp`,直接用 Glob/Grep 文本检索回答语义导航问题,用户无从知道拿到的不是语义结果。 In real-device testing the skill was bypassed entirely: the model answered semantic-navigation questions from Glob/Grep text matching without loading the skill or unlocking `Lsp`, with no disclosure to the user. ## 变更 / Changes - **description(根级 + i18n 双语)改为命令式**:语义导航请求必须先加载本技能解锁隐藏的 `Lsp` 工具,禁止未尝试 `Lsp` 就用文本检索作答(配合主仓库的技能目录 provides.tools 附注,模型在决策点即可看到该指令) - **L1 新增「硬性规则」**(双语):`Lsp` 优先;限定允许回退的三种情形;任何回退到文本检索的回答必须向用户显式声明「结果来自文本匹配而非语义分析」及原因 - **L2 降级策略**同步引用硬性规则 - version 1.0.0 → 1.1.0;重算 i18n `source_hash`(`translated_by: human` 保持锁定) ## 校验 / Validation - `uv run scripts/i18n/validate-i18n.py` → OK - `uv run scripts/i18n/translate.py --check` → code-intelligence 两 locale 均无 stale
This commit is contained in:
@@ -4,13 +4,15 @@ description: >-
|
||||
Use this skill when the user needs semantic code navigation backed by a
|
||||
Language Server: jump to definitions or implementations, find references,
|
||||
inspect hover/type information, list document or workspace symbols, or trace
|
||||
incoming and outgoing calls. Activate it for requests such as "where is this
|
||||
incoming and outgoing calls. For such requests you MUST load this skill first
|
||||
to unlock the hidden `Lsp` tool; do NOT answer them from `Grep`/`Glob` text
|
||||
matching without trying `Lsp`. Activate it for requests such as "where is this
|
||||
symbol defined", "find usages", "who calls this function", "show the file
|
||||
outline", or "search symbols in the workspace". A compatible Language Server
|
||||
must already be installed; this skill never installs one automatically. Use
|
||||
when 用户提到 跳转定义、查找引用、查找实现、类型信息、悬停信息、符号大纲、
|
||||
工作区符号、调用关系、谁调用了这个函数、这个函数调用了谁、语义代码导航。
|
||||
version: 1.0.0
|
||||
version: 1.1.0
|
||||
type: procedural
|
||||
risk_level: low
|
||||
status: enabled
|
||||
@@ -26,7 +28,7 @@ provides:
|
||||
- Lsp
|
||||
metadata:
|
||||
author: desirecore
|
||||
updated_at: '2026-07-22'
|
||||
updated_at: '2026-08-31'
|
||||
i18n:
|
||||
default_locale: en-US
|
||||
source_locale: zh-CN
|
||||
@@ -37,17 +39,17 @@ metadata:
|
||||
name: 代码智能
|
||||
short_desc: 基于 Language Server 的定义、引用、符号与调用关系导航
|
||||
description: >-
|
||||
使用已安装的 Language Server 执行语义代码导航,包括定义、引用、实现、悬停类型、符号大纲和调用层级。
|
||||
使用已安装的 Language Server 执行语义代码导航,包括定义、引用、实现、悬停类型、符号大纲和调用层级。此类请求必须先加载本技能解锁隐藏的 `Lsp` 工具,禁止未尝试 `Lsp` 就用文本检索作答。
|
||||
body: ./SKILL.zh-CN.md
|
||||
source_hash: sha256:cf613ab2572810e5
|
||||
source_hash: sha256:ebfecf4d2982632d
|
||||
translated_by: human
|
||||
en-US:
|
||||
name: Code Intelligence
|
||||
short_desc: Language Server powered definitions, references, symbols, and call navigation
|
||||
description: >-
|
||||
Use an installed Language Server for semantic code navigation, including definitions, references, implementations, hover types, symbols, and call hierarchies.
|
||||
Use an installed Language Server for semantic code navigation, including definitions, references, implementations, hover types, symbols, and call hierarchies. Load this skill first to unlock the hidden `Lsp` tool for such requests; never answer them from text search alone without trying `Lsp`.
|
||||
body: ./SKILL.md
|
||||
source_hash: sha256:cf613ab2572810e5
|
||||
source_hash: sha256:ebfecf4d2982632d
|
||||
translated_by: human
|
||||
market:
|
||||
icon: >-
|
||||
@@ -84,7 +86,12 @@ Activate this skill when the task depends on symbol meaning rather than text mat
|
||||
- List the symbols in one file or search symbols across the workspace.
|
||||
- Find callers and callees through the LSP call hierarchy.
|
||||
|
||||
Use `Grep` or `Glob` instead when the task is purely textual or no compatible Language Server is installed.
|
||||
### Hard rules
|
||||
|
||||
- Semantic-navigation requests (definitions, references, implementations, call relations, symbols) **MUST try `Lsp` first**; never answer them from `Grep`/`Glob` text matching without trying `Lsp`.
|
||||
- Falling back to text search is allowed only when: the `Lsp` call errors, the target language is not in the supported mappings, or the Language Server is missing and the user has not asked to install it.
|
||||
- Every answer that falls back to text search **MUST explicitly tell the user** that the result comes from text matching, not semantic analysis, and why (for example "typescript-language-server is not installed"). In large repositories, or with same-named symbols, overloads, or inheritance, text matching can be wrong — never let the user mistake it for semantic navigation.
|
||||
- Purely textual searches (string literals, log copy) are out of scope for this skill; use `Grep`/`Glob` directly.
|
||||
|
||||
## L2: Operating Procedure
|
||||
|
||||
@@ -128,6 +135,6 @@ Supported built-in mappings:
|
||||
|
||||
### 5. Fallbacks
|
||||
|
||||
- Unsupported file type or missing server: use `Grep`, `Glob`, and `Read` for text-level investigation.
|
||||
- Unsupported file type or missing server: use `Grep`, `Glob`, and `Read` for text-level investigation, and explicitly tell the user — per the hard rules — that the result comes from text matching, not semantic analysis, and why.
|
||||
- Server does not advertise an operation: report that capability mismatch instead of guessing.
|
||||
- Empty semantic result: explain that the symbol may be unresolved, excluded, or filtered by access rules; do not claim the symbol has no usages without qualification.
|
||||
|
||||
@@ -16,7 +16,12 @@
|
||||
- 列出单个文件的符号大纲,或在工作区内搜索符号。
|
||||
- 通过 LSP 调用层级查找调用者与被调用者。
|
||||
|
||||
如果需求只是文本搜索,或者没有兼容的 Language Server,改用 `Grep` 或 `Glob`。
|
||||
### 硬性规则
|
||||
|
||||
- 语义导航类请求(定义、引用、实现、调用关系、符号)**必须先尝试 `Lsp`**;禁止在未尝试 `Lsp` 的情况下,直接用 `Grep`/`Glob` 的文本匹配结果作答。
|
||||
- 只有以下情形才允许回退到文本检索:`Lsp` 调用报错、目标语言不在支持映射中、或 Language Server 未安装且用户未要求安装。
|
||||
- 任何回退到文本检索的回答,**必须向用户显式声明**结果来自文本匹配而非语义分析,并说明原因(如「typescript-language-server 未安装」)。大型仓库、同名符号、重载/继承场景下文本匹配可能给出错误答案,不得让用户误以为拿到的是语义导航结果。
|
||||
- 需求只是纯文本搜索(如查找字符串字面量、日志文案)时不适用本技能,直接用 `Grep`/`Glob`。
|
||||
|
||||
## L2:操作流程
|
||||
|
||||
@@ -60,7 +65,7 @@ DesireCore 只探测用户已经安装的二进制,缺失时返回安装提示
|
||||
|
||||
### 5. 降级策略
|
||||
|
||||
- 文件类型不支持或 Server 未安装:使用 `Grep`、`Glob`、`Read` 做文本级调查。
|
||||
- 文件类型不支持或 Server 未安装:使用 `Grep`、`Glob`、`Read` 做文本级调查,并在回答中按「硬性规则」显式声明结果来自文本匹配而非语义分析及原因。
|
||||
- Server 未声明某项能力:如实报告 capability 不匹配,不得猜测结果。
|
||||
- 语义结果为空:说明符号可能未解析、被排除或被访问规则过滤;不能直接断言“没有引用”。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user