Skip to content

Commit 9faae72

Browse files
author
SqlRush
committed
Load GitHub marketplace plugin catalogs
1 parent 409f710 commit 9faae72

5 files changed

Lines changed: 82 additions & 6 deletions

File tree

docs/cc-100-roadmap.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ M7 补充:prompt history `LogEntry` 读取现在接受 `sessionID`/`session`/`
733733
本轮补充:`cmd/claude --help` 现在沿用 Go flag usage 输出并成功退出;`cmd/claude --cwd` 现在会设置 bootstrap working directory,影响 scaffold 输出、project settings、tool cwd 和 transcript path;`cmd/claude --print/-p` 现在接入真实 `conversation.Runner.RunTurn` 单轮 headless 路径,可从参数或 stdin 读取 prompt,读取 `ANTHROPIC_API_KEY`/`ANTHROPIC_BASE_URL`/`ANTHROPIC_MODEL`/`CLAUDE_MODEL`/settings model,解析模型别名,装配 builtin tools、settings-derived permission engine、settings-derived MCP config,并把最终 assistant text 写到 stdout;`--mcp-config`/`--mcpConfig` 现在会把指定 JSON 文件中的 `mcpServers` 合入 headless MCP local settings;`--input-format`/`--inputFormat` text/json/stream-json 现在有基础输入解析,支持 JSON prompt/user message 和 NDJSON user event;`--max-turns`/`--maxTurns` 现在会限制 headless tool-use loop 轮数,`--max-tokens`/`--maxTokens` 和 `--max-turns`/`--maxTurns` 都会拒绝负值;`--output-format`/`--outputFormat` json 现在会输出基础 result envelope,`stream-json` 会先输出基础 `system/init` 事件,再输出 NDJSON event stream 并以 result 行收尾,包含 result text、session id、assistant message、stop reason、model、usage 和 tool results;headless setup/resume/RunTurn 错误现在会在 JSON 模式输出 `subtype:error` result,在 stream-json 模式输出 `type:error` event;`--permission-mode`/`--permissionMode`、`--dangerously-skip-permissions`/`--dangerouslySkipPermissions`、`--system-prompt`/`--systemPrompt` 和 `--append-system-prompt`/`--appendSystemPrompt` 现在也有 CLI 接线或 camelCase alias;`--stream --output-format stream-json` 现在还会透出 raw Anthropic streaming events,包括 text delta;headless `--resume <session-id-or-jsonl>` 和 `--continue` 现在会加载当前项目 transcript chain 作为 history,并把新回合追加回同一个 transcript;`--allowedTools`/`--allowed-tools` 和 `--disallowedTools`/`--disallowed-tools` 现在会作为 CLI permission rules 合入 headless permission engine;`--add-dir`/`--addDir` 现在会作为 CLI additional working directory 合入 headless permission context。
734734
本轮补充:settings 文件读取现在有 path-keyed cache,按 size/mode/mtime 指纹复用内容并提供 cache reset;新增 settings change detector,可对 settings 文件快照区分 created/modified/deleted,并在检测到变化时清空 settings 文件缓存。
735735

736-
当前状态:bootstrap/config/auth/model 基础已完成;settings 已有 merge、managed policy(含本地 file/drop-in、MDM/registry、可选 remote GET source、turn-start remote refresh/app-state propagation 和 daemon heartbeat remote refresh)、settings file cache/change detector、turn-start local settings reload/app-state propagation、JSON Schema generation、marketplace source union 基础 validation、marketplace policy resolver/visibility/local+settings/directory/file manifest load enforcement、URL marketplace catalog 下载/cache 回退加载、git marketplace clone/fetch/pull cache 加载和 `strictPluginOnlyCustomization` 基础 enforcement;CLI 已有 `--version`、`--help` 成功退出、`--cwd` working directory override、scaffold settings 校验、基础 `--print` headless 单轮执行路径、基础 `--mcp-config`、基础 input-format text/json/stream-json、`--max-turns` tool loop 限制、基础 JSON result/error 输出、基础 stream-json init/event/error 输出、raw streaming event 透传、headless resume/continue transcript 接线、system prompt flags、dangerously-skip-permissions、常见 camelCase flag aliases、CLI allow/deny tool rules 和 CLI add-dir additional working directory context,但完整参数矩阵、交互 TUI 主循环、resume picker/UI、官方 SDK NDJSON/control protocol、settings background watcher/continuous app-state sync、remote managed 非 daemon 后台 refresh 和官方 stdout/stderr/exit-code parity 仍未完整兼容 CC。
736+
当前状态:bootstrap/config/auth/model 基础已完成;settings 已有 merge、managed policy(含本地 file/drop-in、MDM/registry、可选 remote GET source、turn-start remote refresh/app-state propagation 和 daemon heartbeat remote refresh)、settings file cache/change detector、turn-start local settings reload/app-state propagation、JSON Schema generation、marketplace source union 基础 validation、marketplace policy resolver/visibility/local+settings/directory/file manifest load enforcement、URL marketplace catalog 下载/cache 回退加载、git/github marketplace clone/fetch/pull cache 加载和 `strictPluginOnlyCustomization` 基础 enforcement;CLI 已有 `--version`、`--help` 成功退出、`--cwd` working directory override、scaffold settings 校验、基础 `--print` headless 单轮执行路径、基础 `--mcp-config`、基础 input-format text/json/stream-json、`--max-turns` tool loop 限制、基础 JSON result/error 输出、基础 stream-json init/event/error 输出、raw streaming event 透传、headless resume/continue transcript 接线、system prompt flags、dangerously-skip-permissions、常见 camelCase flag aliases、CLI allow/deny tool rules 和 CLI add-dir additional working directory context,但完整参数矩阵、交互 TUI 主循环、resume picker/UI、官方 SDK NDJSON/control protocol、settings background watcher/continuous app-state sync、remote managed 非 daemon 后台 refresh 和官方 stdout/stderr/exit-code parity 仍未完整兼容 CC。
737737

738738
### M3: API Client And Conversation Loop
739739

@@ -1435,10 +1435,10 @@ M7 补充:terminal input parser 和 configurable keybinding name parser 现在
14351435
- `/help``/config``/mcp``/plugin``/skills``/memory``/resume` 等命令。
14361436
- local commands、local-jsx command abstraction。
14371437
- bundled/user/plugin/MCP skills discovery。
1438-
- plugin manifest、marketplace、local install、URL catalog cache、git clone/update cache、remote github/npm download/update。
1438+
- plugin manifest、marketplace、local install、URL catalog cache、git/github clone/update cache、remote npm download/update。
14391439
- plugin hooks/agents/MCP,其中本地 plugin 同步工具 hook 已接入,剩余完整 plugin agent/MCP 与 hook UI/policy parity。
14401440

1441-
当前状态:已完成项目 skill discovery、目录式 `SKILL.md` prompt metadata loading、project legacy `.claude/commands` prompt command loading、command registry metadata/lookup/filter、agent-metadata strict plugin-only policy filtering、部分内置 slash command aliases/metadata、prompt expansion、基础 `Skill` tool inline 调用、本地项目 prompt skill 的基础 slash 调用接入、本地 prompt skill 的 command permissions attachment/current-turn 权限继承,本地 plugin command/skill/agent/MCP server/output style/hook 的 manifest discovery,本地 plugin 同步工具 hook 执行,headless `/plugin install <name>` 可从 settings/directory/file/URL catalog/git cache 配置的 marketplace 来源复制插件到项目 `.claude/plugins` 并刷新 plugin MCP server app-state,headless `/help`/`/skills` 列表与单项详情,output style 系统提示注入,以及 `/clear` 基础 local command no-query 路径;仍缺 bundled/MCP/remote skills、forked skill/agent 执行、完整 local/local-jsx 实际执行、TUI `/help`/`/skills` 面板、权限 UI/SDK 展示、github/npm plugin marketplace download/update、skill prompt shell injection 和完整 agents/MCP/output-style UI 接线。
1441+
当前状态:已完成项目 skill discovery、目录式 `SKILL.md` prompt metadata loading、project legacy `.claude/commands` prompt command loading、command registry metadata/lookup/filter、agent-metadata strict plugin-only policy filtering、部分内置 slash command aliases/metadata、prompt expansion、基础 `Skill` tool inline 调用、本地项目 prompt skill 的基础 slash 调用接入、本地 prompt skill 的 command permissions attachment/current-turn 权限继承,本地 plugin command/skill/agent/MCP server/output style/hook 的 manifest discovery,本地 plugin 同步工具 hook 执行,headless `/plugin install <name>` 可从 settings/directory/file/URL catalog/git/github cache 配置的 marketplace 来源复制插件到项目 `.claude/plugins` 并刷新 plugin MCP server app-state,headless `/help`/`/skills` 列表与单项详情,output style 系统提示注入,以及 `/clear` 基础 local command no-query 路径;仍缺 bundled/MCP/remote skills、forked skill/agent 执行、完整 local/local-jsx 实际执行、TUI `/help`/`/skills` 面板、权限 UI/SDK 展示、npm plugin marketplace download/update、skill prompt shell injection 和完整 agents/MCP/output-style UI 接线。
14421442

14431443
### M9: MCP Platform
14441444

docs/claude-code-go-rewrite-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ test/parity/ # golden tests against TS/official behavior
143143
- 本轮补充:`strictPluginOnlyCustomization` 已开始按 policy settings 生效,当前覆盖已实现的 `skills``mcp``hooks` 和 agent-metadata surfaces:锁定后 user/project/local skills 与 legacy commands 不加载,manual MCP server sources 不加载但 plugin/admin policy 仍保留,settings hooks 只保留 policy hooks 且 plugin hooks 继续运行;`agents` 锁定时非 plugin/bundled/admin prompt command 的 `agent``context: fork``effort` frontmatter metadata 会被清除。完整 forked agent runtime/UI edge cases 仍按缺口追踪。
144144
- 本轮补充:settings 文件读取现在有 path-keyed cache,按 size/mode/mtime 指纹复用内容并提供 `ResetSettingsCache`;新增 settings change detector,可对 settings 文件快照区分 created/modified/deleted,并在检测到变化时清空 settings 文件缓存;Runner turn-start 会在检测到 user/project/local settings 文件变化时重载 merged settings 并同步刷新 plugin MCP server app-state。完整后台 watcher 和 remote managed 非 daemon 后台 refresh 生命周期仍按缺口追踪。
145145
- 本轮补充:新增 settings JSON Schema generation,`SettingsJSONSchema()` 会从 `contracts.Settings` 反射生成 draft 2020-12 schema,补强 `$schema` const、permission mode enum、`strictPluginOnlyCustomization` union 和 login method enum;`/config show schema` 现在可展示 schema ID、draft、字段数和生成大小,完整 Zod message parity 仍按缺口追踪。
146-
- 本轮补充:settings validation 现在覆盖官方 marketplace source union 的基础语义,适用于 `extraKnownMarketplaces[].source`、`strictKnownMarketplaces[]` 和 `blockedMarketplaces[]`:校验 source discriminator、各 source 类型必填字段、URL source 绝对 URL、headers string record、github/git sparsePaths string array、settings-source plugins array/item path shape、settings-source name 安全/保留名,并继续覆盖 inline marketplace key/name 一致性;`internal/plugins` 新增 marketplace policy resolver,blocked settings 优先、strict allowlist 非空时拒绝未列入来源,`/plugin marketplaces` 会展示 allow/block decision;本地 plugin manifest 可声明 `marketplace`/`marketplaceName`/`marketplace_name`/`source.name`,带 settings 的 plugin loader 会对这些来源执行 marketplace policy,`extraKnownMarketplaces.<name>.source.source=settings` 的 `plugins` 本地 root、`source=directory` 的本地 marketplace 目录、`source=file` catalog、`source=url` 远端 JSON catalog 以及 `source=git` clone cache 的 plugin roots 都会进入 plugin load path 并继承 marketplace 名称;URL catalog 支持配置 headers、大小限制、JSON 校验、写入 `marketplace-cache/catalogs` 并在后续请求失败时缓存回退;git source 会按 URL clone 到 `marketplace-cache/git`,后续加载 fetch/pull,支持 `ref` checkout 和 repo 内 `path` 指向单插件、插件目录或 catalog JSON;`/plugin show/search` 会标注 blocked reason;headless `/plugin install <name>` 会从这些已配置 marketplace 来源复制插件到项目 `.claude/plugins/<safe-name>`,不覆盖冲突路径,并刷新 plugin MCP server app-state。github/npm marketplace download 和完整 update lifecycle 仍按缺口追踪。
146+
- 本轮补充:settings validation 现在覆盖官方 marketplace source union 的基础语义,适用于 `extraKnownMarketplaces[].source`、`strictKnownMarketplaces[]` 和 `blockedMarketplaces[]`:校验 source discriminator、各 source 类型必填字段、URL source 绝对 URL、headers string record、github/git sparsePaths string array、settings-source plugins array/item path shape、settings-source name 安全/保留名,并继续覆盖 inline marketplace key/name 一致性;`internal/plugins` 新增 marketplace policy resolver,blocked settings 优先、strict allowlist 非空时拒绝未列入来源,`/plugin marketplaces` 会展示 allow/block decision;本地 plugin manifest 可声明 `marketplace`/`marketplaceName`/`marketplace_name`/`source.name`,带 settings 的 plugin loader 会对这些来源执行 marketplace policy,`extraKnownMarketplaces.<name>.source.source=settings` 的 `plugins` 本地 root、`source=directory` 的本地 marketplace 目录、`source=file` catalog、`source=url` 远端 JSON catalog、`source=git` clone cache 以及 `source=github` repo clone cache 的 plugin roots 都会进入 plugin load path 并继承 marketplace 名称;URL catalog 支持配置 headers、大小限制、JSON 校验、写入 `marketplace-cache/catalogs` 并在后续请求失败时缓存回退;git/github source 会按 URL clone 到 `marketplace-cache/git`,后续加载 fetch/pull,支持 `ref` checkout 和 repo 内 `path` 指向单插件、插件目录或 catalog JSON,github `repo: owner/name` 会规范化为 GitHub clone URL;`/plugin show/search` 会标注 blocked reason;headless `/plugin install <name>` 会从这些已配置 marketplace 来源复制插件到项目 `.claude/plugins/<safe-name>`,不覆盖冲突路径,并刷新 plugin MCP server app-state。npm marketplace download 和完整 update lifecycle 仍按缺口追踪。
147147

148148
### M4: Tool framework、permissions、sandbox
149149

docs/first-second-parity-audit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The following items remain incomplete and must not be treated as done:
108108
- Full tool execution parity gaps that remain: complete hook runtime policy beyond the current settings command hook path, MCP elicitation, complete SDK control event surface beyond current progress NDJSON, mid-call cancellation for concrete tools, background task behavior, telemetry, schema-not-sent hints, and concrete tool-specific semantics.
109109
- Complete Anthropic API parity gaps that remain: dynamic beta-header latching for any remaining provider-specific feature gates beyond prompt-cache/cache-editing/strict-output/1M-context requests, ant-only dump gating and remote `/issue` submission integration beyond the current local context summary, full official cost tracker/session restore lifecycle beyond current transcript usage restore, post-handshake streaming failure semantics, deeper gateway/proxy auth and routing behavior beyond static custom headers, first-party/Bedrock/Vertex/Foundry client setup, deeper OAuth account/profile lifecycle beyond request-time refresh retry, fast-mode retry/cooldown semantics, persistent unattended retry heartbeats, full prompt-cache editing lifecycle, and provider-specific cache behavior.
110110
- Full conversation/query loop: stop hooks, compact/auto-compact, token budget escalation, resume, SDK JSON/NDJSON control events, status updates, rate-limit handling, model switch breadcrumbs, side questions.
111-
- Full settings parity gaps that remain: complete Zod-equivalent validation messages, full remote managed-settings watcher/non-daemon background refresh lifecycle beyond current turn-start and daemon-heartbeat refresh, remaining forked agent/frontmatter execution and UI edge cases beyond current policy metadata filtering, github/npm marketplace download/update enforcement beyond current local/settings/directory/file/URL catalog/git cache manifest load, URL catalog cache fallback, git fetch/pull cache refresh, and local install enforcement, and background watcher/continuous app-state sync beyond current turn-start local settings reload.
111+
- Full settings parity gaps that remain: complete Zod-equivalent validation messages, full remote managed-settings watcher/non-daemon background refresh lifecycle beyond current turn-start and daemon-heartbeat refresh, remaining forked agent/frontmatter execution and UI edge cases beyond current policy metadata filtering, npm marketplace download/update enforcement beyond current local/settings/directory/file/URL catalog/git/github cache manifest load, URL catalog cache fallback, git/github fetch/pull cache refresh, and local install enforcement, and background watcher/continuous app-state sync beyond current turn-start local settings reload.
112112
- Full session/history parity gaps that remain: large-file optimized transcript loading, preserved-segment edge cases beyond current relink/prune support, content-replacement feature-flag/runtime override and inherited subagent gap-fill details, complete async prompt-history lifecycle parity beyond current lock/buffer/undo paths, full pasted-image processing/runtime integration beyond current prompt image-cache/image-block/metadata path, remaining remote-history edge cases, sidechain/subagent transcript layout, and all session metadata entry types.
113113

114114
## Current Verification

internal/plugins/loader.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ func marketplacePluginRootEntries(settings contracts.Settings) []pluginRootEntry
363363
for _, root := range pluginRootsFromMarketplaceGit(source) {
364364
entries = append(entries, pluginRootEntry{Root: root, Marketplace: marketplace})
365365
}
366+
case "github":
367+
for _, root := range pluginRootsFromMarketplaceGitHub(source) {
368+
entries = append(entries, pluginRootEntry{Root: root, Marketplace: marketplace})
369+
}
366370
}
367371
}
368372
return entries
@@ -401,7 +405,14 @@ func pluginRootsFromMarketplaceURL(source map[string]any, marketplace string) []
401405
}
402406

403407
func pluginRootsFromMarketplaceGit(source map[string]any) []string {
404-
gitURL := stringFromAnyMap(source, "url")
408+
return pluginRootsFromMarketplaceGitURL(stringFromAnyMap(source, "url"), source)
409+
}
410+
411+
func pluginRootsFromMarketplaceGitHub(source map[string]any) []string {
412+
return pluginRootsFromMarketplaceGitURL(githubMarketplaceGitURL(stringFromAnyMap(source, "repo")), source)
413+
}
414+
415+
func pluginRootsFromMarketplaceGitURL(gitURL string, source map[string]any) []string {
405416
if gitURL == "" {
406417
return nil
407418
}
@@ -416,6 +427,20 @@ func pluginRootsFromMarketplaceGit(source map[string]any) []string {
416427
return pluginRootsFromMarketplacePath(safeJoin(repoPath, marketplacePath))
417428
}
418429

430+
func githubMarketplaceGitURL(repo string) string {
431+
repo = strings.TrimSpace(repo)
432+
if repo == "" {
433+
return ""
434+
}
435+
if strings.Contains(repo, "://") || strings.HasPrefix(repo, "git@") || filepath.IsAbs(repo) || strings.HasPrefix(repo, ".") {
436+
return repo
437+
}
438+
repo = strings.TrimPrefix(repo, "github.com/")
439+
repo = strings.TrimPrefix(repo, "www.github.com/")
440+
repo = strings.TrimSuffix(repo, ".git")
441+
return "https://github.com/" + repo + ".git"
442+
}
443+
419444
func pluginRootsFromMarketplacePath(path string) []string {
420445
info, err := os.Stat(path)
421446
if err != nil {

0 commit comments

Comments
 (0)