hooks: the edit gate counts a failed lookup and an unrun command as a check
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 72/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- node.js, typescript
研究方向
Start with .intent/hooks/intent-claude-gate.mjs, focusing on main() and the SessionStart and PreToolUse paths described in the issue. Trace createSessionCatalogContext, appendObservation, and parseIntentInvocation, then check the hook’s available PostToolUse handling. Done means failed or unrun lookups do not unlock edits, while a successful catalog shown at session start or a successful command run does.
由索引模型根據 Issue 內容生成。
描述
Which version
@tanstack/intent 0.5.6. The hook was written by pnpm exec intent hooks install --scope project --agents claude, and the file is .intent/hooks/intent-claude-gate.mjs.
What happens
The gate lets edit tools through once the session's state file holds a list or a load (hasIntentCheck). Two paths write that record without the skills ever having been looked up.
1. A failed lookup at session start still counts as a check.
In main(), on SessionStart:
const additionalContext = await createSessionCatalogContext(rootForEvent(event))
appendObservation(stateFile, { action: 'list', raw: CATALOG_COMMAND })
if (additionalContext) {
process.stdout.write(JSON.stringify(sessionStartOutput(additionalContext)))
}
createSessionCatalogContext catches every error and returns ''. So when the lookup fails (Intent not installed, the local CLI not found, the list command failing), no catalog is shown to the agent, but list is recorded anyway, and every edit is allowed from then on.
2. A proposed command is recorded before it has run.
The observation is taken in PreToolUse from the text of the Bash command (parseIntentInvocation), before the command runs and whatever it does. So these are recorded as a check, and unlock edits:
false && pnpm exec intent list(Intent never runs)pnpm exec intent listwhen it then exits non-zero- a Bash call the user declines at the permission prompt
What I expected
- On
SessionStart,listis recorded only when the catalog was produced and handed to the agent. - A
listorloadtyped by the agent is recorded once it has run and succeeded, for example fromPostToolUsewith the tool's result, not from the command text inPreToolUse.
Why it matters
The gate's promise is "the agent looked the skills up before its first edit". Both paths let a session edit with no skill list ever shown, and nothing tells the user that the lookup did not happen.
Happy to test a fix.
- 主要語言
- TypeScript
- 星號
- 360
- 分支
- 27
- 平均合併
- 23 小時 3 分鐘
- 30 天內合併 PR
- 15
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TanStack/intent 的其他 Issue
-
難度 5/5 一週以上 新手友好度 45/100
維護者通常 1 天內回覆
-
Avoid parsing skill metadata rejected by effective policy可能重新可做 @itsfaqih 於 32 天前認領,目前沒有進行中的 PR。 未關閉
難度 4/5 3-5 天 新手友好度 48/100
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 35/100
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 45/100
維護者通常 1 天內回覆
-
enhancement
難度 5/5 一週以上 新手友好度 35/100
維護者通常 1 天內回覆
相似的 Issue
-
inference/go type/feature
難度 1/5 1-3 小時 新手友好度 72/100
anomalyco/opencode#65148 · 1 則留言 ·
維護者通常 1 天內回覆
-
truapi-release
難度 2/5 1-3 小時 新手友好度 72/100
paritytech/product-sdk#529 ·
維護者通常 1 天內回覆
-
Add: Mansudae TV未關閉approved check:passed streams:add
難度 2/5 1-3 小時 新手友好度 64/100
維護者通常 1 天內回覆
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per node未關閉
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
devlikeapro/waha#2369 ·
維護者通常 5 天內回覆