fix: 支持读取 ~/.claude/skills/ 目录下的已安装技能 - #36
Merged
Conversation
问题:CodePilot 只扫描 ~/.agents/skills/,缺失了 ~/.claude/skills/ 路径, 导致用户通过 CLI 安装到该目录的技能无法在 CodePilot 中显示和使用。 修改内容: 后端: - 列表接口 (GET /api/skills) 同时扫描 ~/.agents/skills/ 和 ~/.claude/skills/ - 通过 SHA1 内容哈希去重:同名同内容只保留一条,同名不同内容保留两条 - 详情接口 (GET/PUT/DELETE /api/skills/:name) 新增 ?source= 参数精确定位来源 - 详情接口使用 YAML front matter 的 name 字段匹配,修复列表能看到但点开 404 的问题 - 同名不同内容时返回 409,要求前端传 source 消歧 前端: - SkillItem 类型新增 installedSource 字段 - Badge 显示 installed:claude 或 installed:agents 明确来源 - 保存/删除时携带 ?source= 防止误操作同名技能 - 聊天补全项描述追加来源提示 - 技能展开时精准请求对应来源 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
op7418 added a commit
that referenced
this pull request
Jun 1, 2026
Codex review (2026-06-01) 指出本轮代码外的环境层残留:findCodexBinary() PATH 优先、.app fallback 兜底;用户若装回旧 /opt/homebrew/bin/codex(只认四档 effort、 未知配置致命),CodePilot 仍会优先用它。本轮 P0 已让它不再卡 30s,但会快速显示 "应用服务启动失败"且 reason 不够明确。 记为低优先级技术债 #36,附三个修法候选(版本探测明确提示 / PATH 失败回退 .app / reason 带 binary 路径+版本)。当前用户 homebrew codex 已卸载、.app 0.133 正常, 不破坏主路径,故 defer。
op7418 added a commit
that referenced
this pull request
Jun 28, 2026
…pactThreshold - v0.56.x 决策日志加 2026-06-20 条目:P1(env/legacy effective base URL gate,1e143d7) + item 1(存量第三方会话渲染 gate,f5d4f15)落地经过、根因、反例 smoke 与测试; item 2 前提(provider-catalog.ts:62 配置窗口可信)被源码核实推翻;item 3 已定位 SDK autoCompactThreshold 真实源但需独立接线。 - tech-debt-tracker 新增 #36:item 2 配置窗口最高优先源不成立 —— ProviderModelGroup 的 contextWindow 唯一来源是静态 catalog(route.ts:117/294/306 由 getContextWindow 填), provider_models 无 context_window 列、presets 未填值;升级为 trusted 会重引假数据。 记录三条待真实源修法,明确禁止把静态 catalog 当配置源。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
op7418 added a commit
that referenced
this pull request
Jun 28, 2026
…ed (#632) Signal — Codex 复审 #632 P1+item1 后给三点: - [P2] resolveEffectiveAnthropicBaseUrl 在 provider 存在但 hasCredentials=false 时仍优先返回 provider.base_url,与 toClaudeCodeEnv 不一致(该状态两分支都不跑、SDK 只继承 ambient ANTHROPIC_BASE_URL)。若用户选了无 key 的 DB provider + 环境有第三方 ANTHROPIC_BASE_URL, gate 可能按错地址误信窗口(同 GLM 同类漏口)。 - [P3] 存量第三方会话首屏可能在 provider models 加载前(undefined→trusted)短暂闪历史 200K。 - [P3] tech-debt 新条目用了 #36,与既有 #36 撞车。 Triage — - P2:helper 只镜像了 toClaudeCodeEnv 两态(有凭据 provider / 无 provider),漏第三态(有 provider 无凭据):该态 provider 分支 gated on hasCredentials、env 分支 gated on !provider, 两者都不跑 → env 保持 ambient process.env.ANTHROPIC_BASE_URL,provider.base_url 不注入、 settings 不读。 - P3 闪回:undefined 同时表示"加载中"与"非 anthropic 组未标注",前者应 fail-closed。 - P3 编号:tracker 非严格连续,实际最大 42 → 下一个可用 43。 Fix — - provider-resolver:helper 改三态镜像。`provider && !hasCredentials` → 返回 process.env.ANTHROPIC_BASE_URL(忠实镜像 SDK 继承的 ambient env,不读 provider.base_url / settings)。doc 写明三态对应关系。 - ChatView:fail-closed —— providerFetchState !== 'loaded' 传 false;loaded 时用 group flag (found 必有标注;not-found stale provider → ?? true 向后兼容)。第一方代价 = 首屏短暂只显 已用、百分比后补的渐进式诚实显示,绝不闪错数。 - tech-debt #36 → #43(plan doc / memory 引用同步)。 Verify — npm run test 3387/3387(typecheck clean)。新增 P2 回归 2 例:无凭据 provider 背后 第三方 env → untrust;无凭据 provider + clean env → 不误 untrust。 Guardrail — provider-resolver.test.ts 加 P2 三态行为测试;context-window-trusted.test.ts 的 ChatView pin 更新为锁定 fail-closed 语义(providerFetchState === 'loaded' ? (… ?? true) : false)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
youcho2 pushed a commit
to youcho2/CodePilot
that referenced
this pull request
Aug 11, 2026
fix: 支持读取 ~/.claude/skills/ 目录下的已安装技能
youcho2 pushed a commit
to youcho2/CodePilot
that referenced
this pull request
Aug 11, 2026
Codex review (2026-06-01) 指出本轮代码外的环境层残留:findCodexBinary() PATH 优先、.app fallback 兜底;用户若装回旧 /opt/homebrew/bin/codex(只认四档 effort、 未知配置致命),CodePilot 仍会优先用它。本轮 P0 已让它不再卡 30s,但会快速显示 "应用服务启动失败"且 reason 不够明确。 记为低优先级技术债 op7418#36,附三个修法候选(版本探测明确提示 / PATH 失败回退 .app / reason 带 binary 路径+版本)。当前用户 homebrew codex 已卸载、.app 0.133 正常, 不破坏主路径,故 defer。
youcho2 pushed a commit
to youcho2/CodePilot
that referenced
this pull request
Aug 11, 2026
…3 定位 autoCompactThreshold - v0.56.x 决策日志加 2026-06-20 条目:P1(env/legacy effective base URL gate,de7b5d4) + item 1(存量第三方会话渲染 gate,386b780)落地经过、根因、反例 smoke 与测试; item 2 前提(provider-catalog.ts:62 配置窗口可信)被源码核实推翻;item 3 已定位 SDK autoCompactThreshold 真实源但需独立接线。 - tech-debt-tracker 新增 op7418#36:item 2 配置窗口最高优先源不成立 —— ProviderModelGroup 的 contextWindow 唯一来源是静态 catalog(route.ts:117/294/306 由 getContextWindow 填), provider_models 无 context_window 列、presets 未填值;升级为 trusted 会重引假数据。 记录三条待真实源修法,明确禁止把静态 catalog 当配置源。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
youcho2 pushed a commit
to youcho2/CodePilot
that referenced
this pull request
Aug 11, 2026
…ed (op7418#632) Signal — Codex 复审 op7418#632 P1+item1 后给三点: - [P2] resolveEffectiveAnthropicBaseUrl 在 provider 存在但 hasCredentials=false 时仍优先返回 provider.base_url,与 toClaudeCodeEnv 不一致(该状态两分支都不跑、SDK 只继承 ambient ANTHROPIC_BASE_URL)。若用户选了无 key 的 DB provider + 环境有第三方 ANTHROPIC_BASE_URL, gate 可能按错地址误信窗口(同 GLM 同类漏口)。 - [P3] 存量第三方会话首屏可能在 provider models 加载前(undefined→trusted)短暂闪历史 200K。 - [P3] tech-debt 新条目用了 op7418#36,与既有 op7418#36 撞车。 Triage — - P2:helper 只镜像了 toClaudeCodeEnv 两态(有凭据 provider / 无 provider),漏第三态(有 provider 无凭据):该态 provider 分支 gated on hasCredentials、env 分支 gated on !provider, 两者都不跑 → env 保持 ambient process.env.ANTHROPIC_BASE_URL,provider.base_url 不注入、 settings 不读。 - P3 闪回:undefined 同时表示"加载中"与"非 anthropic 组未标注",前者应 fail-closed。 - P3 编号:tracker 非严格连续,实际最大 42 → 下一个可用 43。 Fix — - provider-resolver:helper 改三态镜像。`provider && !hasCredentials` → 返回 process.env.ANTHROPIC_BASE_URL(忠实镜像 SDK 继承的 ambient env,不读 provider.base_url / settings)。doc 写明三态对应关系。 - ChatView:fail-closed —— providerFetchState !== 'loaded' 传 false;loaded 时用 group flag (found 必有标注;not-found stale provider → ?? true 向后兼容)。第一方代价 = 首屏短暂只显 已用、百分比后补的渐进式诚实显示,绝不闪错数。 - tech-debt op7418#36 → op7418#43(plan doc / memory 引用同步)。 Verify — npm run test 3387/3387(typecheck clean)。新增 P2 回归 2 例:无凭据 provider 背后 第三方 env → untrust;无凭据 provider + clean env → 不误 untrust。 Guardrail — provider-resolver.test.ts 加 P2 三态行为测试;context-window-trusted.test.ts 的 ChatView pin 更新为锁定 fail-closed 语义(providerFetchState === 'loaded' ? (… ?? true) : false)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 freeto 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.
关联 Issue: #35
问题
CodePilot 只扫描
~/.agents/skills/,缺失了~/.claude/skills/路径,导致用户通过 CLI 安装到该目录的技能无法在 CodePilot 中显示和使用。此外,当两个目录存在同名技能时,之前没有冲突处理机制,可能导致误操作。
修改内容
后端
列表接口
GET /api/skills~/.agents/skills/和~/.claude/skills/installedSource?: "agents" | "claude"字段详情接口
GET/PUT/DELETE /api/skills/:name?source=agents|claude参数,精确定位到哪个路径的技能name字段匹配技能,修复"列表能看到但点开 404"的问题source时返回 409,附带可选sources列表?source=消歧前端
Skills 列表页
SkillItem类型新增installedSource字段installed:claude或installed:agents,明确来源?source=,防止误操作同名技能聊天补全与技能展开
(claude))GET /api/skills/:name?source=...,精准读取冲突处理策略
claude)installedSource区分sourcesource涉及文件
src/app/api/skills/route.tssrc/app/api/skills/[name]/route.tssrc/components/skills/SkillListItem.tsxsrc/components/skills/SkillsManager.tsxsrc/components/skills/SkillEditor.tsxsrc/components/chat/MessageInput.tsx