fix(cosh): add skill_context to PreToolUse hook input for resolved skill path#409
Merged
kongche-jbw merged 1 commit intoalibaba:mainfrom Apr 28, 2026
Conversation
|
Important Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services. |
Collaborator
Author
|
Manually tested the PreToolUse hook by:
#!/bin/bash
cat > /tmp/pretooluse-hook-dump.json
"hooks": {
"PreToolUse": [{
"matcher": "Skill",
"hooks": [{
"type": "command",
"command": "bash ~/.copilot-shell/hooks/dump-pretooluse.sh",
"name": "dump-pretooluse"
}]
}]
}
> cat /tmp/pretooluse-hook-dump.json | jq
{
"session_id": "b9d9c537-aca1-4b6d-a380-c64abe36b7e6",
"transcript_path": "xxx/b9d9c537-aca1-4b6d-a380-c64abe36b7e6.jsonl",
"cwd": "xxx/copilot-shell",
"hook_event_name": "PreToolUse",
"timestamp": "2026-04-28T11:23:15.485Z",
"tool_name": "skill",
"tool_input": { "skill": "uv-package-manager" },
"skill_context": {
"skill_name": "uv-package-manager",
"file_path": "xxx/skills/uv-package-manager/SKILL.md"
}
} |
Collaborator
|
LGTM. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
skill_context(withskill_nameandfile_path) toPreToolUseInput, symmetric with existingmcp_contextfor MCP toolsSkillManagerand attaches the resolved path to the hook inputnamediffers from the directory nameType of Change
Related Issue
Closes #381
Testing
Changed Files
hooks/types.tsSkillToolContextinterface andskill_context?field toPreToolUseInputhooks/hookEventHandler.tsskillContextparameterhooks/hookSystem.tsskillContextparameter in facadecore/coreToolScheduler.tstools/skill.tsresolveSkillConfig()method toSkillToolhooks/hookEventHandler.test.ts