diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c5e7642..c282ccb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,9 +4,11 @@ - 实现归属仓库与关联的跨仓提交或运行时版本(纯本仓改动可填无) - 旧版或缺失运行时下的兼容与降级表现(不涉及运行时可填不适用) -## 模型与 Agent 申报 +## 模型与编程工具申报 - + ## 验证记录 diff --git a/.github/scripts/pr-model.mjs b/.github/scripts/pr-model.mjs index 35f917d..b58b5cb 100644 --- a/.github/scripts/pr-model.mjs +++ b/.github/scripts/pr-model.mjs @@ -1,8 +1,11 @@ import { readFile } from "node:fs/promises"; import { pathToFileURL } from "node:url"; +const MODEL_LINE_RE = /^ {0,3}model:[ \t]+[\p{L}\p{N}][\p{L}\p{N}_.+() -]*\/[\p{L}\p{N}][\p{L}\p{N}_.+() -]*$/u; +const TOOL_LINE_RE = /^ {0,3}(?:tool|agent):[ \t]+[\p{L}\p{N}][\p{L}\p{N}_.+() /-]*$/u; + export function missingDeclarations(body) { - const missing = new Set(["model", "agent"]); + const missing = new Set(["model", "tool"]); if (typeof body !== "string") return [...missing]; let fence = null; for (const line of body.replace(/|$)/g, "").split(/\r?\n/)) { @@ -11,10 +14,13 @@ export function missingDeclarations(body) { if (delimiter && delimiter[1][0] === fence[0] && delimiter[1].length >= fence.length && !delimiter[2].trim()) fence = null; } else if (delimiter) { fence = delimiter[1]; - } else if (/^ {0,3}model:[ \t]+[\p{L}\p{N}_.-]+\/[\p{L}\p{N}_.-]+[ \t]*$/u.test(line)) { - missing.delete("model"); - } else if (/^ {0,3}agent:[ \t]+[\p{L}\p{N}][\p{L}\p{N}_.+() /-]*$/u.test(line.trimEnd())) { - missing.delete("agent"); + } else { + const trimmed = line.trimEnd(); + if (MODEL_LINE_RE.test(trimmed)) { + missing.delete("model"); + } else if (TOOL_LINE_RE.test(trimmed)) { + missing.delete("tool"); + } } if (missing.size === 0) break; } @@ -52,7 +58,7 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) token: process.env.GITHUB_TOKEN, }); if (result.status === "closed") { - console.error(`::error::PR closed because its description is missing ${result.missing.join(" and ")}. Declare the actual model and agent used (format examples: model: deepseek/deepseek-R1 and agent: WorkBuddy).`); + console.error(`::error::PR closed because its description is missing ${result.missing.join(" and ")}. Declare the actual model and coding tool used (format examples: model: deepseek/deepseek-R1 and tool: Cursor).`); process.exitCode = 1; } } diff --git a/.github/scripts/pr-model.test.mjs b/.github/scripts/pr-model.test.mjs index b086f4e..3d72c32 100644 --- a/.github/scripts/pr-model.test.mjs +++ b/.github/scripts/pr-model.test.mjs @@ -6,23 +6,29 @@ const declaration = "model: deepseek/deepseek-R1"; const opened = { action: "opened", pull_request: { number: 42, base: { ref: "main" } } }; const options = { apiUrl: "https://api.example.invalid", repository: "owner/repo", token: "test" }; -test("requires visible model and agent declarations", () => { - for (const agent of ["WorkBuddy", "豆包", "OpenAI Codex"]) { - assert.deepEqual(missingDeclarations(`${declaration}\r\nagent: ${agent}`), []); +test("requires visible model and coding tool declarations", () => { + for (const model of ["deepseek/deepseek-R1", "google/Gemini 4 Neon", "anthropic/Claude 4.5 Sonnet"]) { + for (const tool of ["tool: Cursor", "tool: WorkBuddy", "tool: 豆包", "tool: OpenAI Codex", "agent: WorkBuddy"]) { + assert.deepEqual(missingDeclarations(`model: ${model}\r\n${tool}`), []); + } } - assert.deepEqual(missingDeclarations(declaration), ["agent"]); - assert.deepEqual(missingDeclarations("agent: 豆包"), ["model"]); - assert.deepEqual(missingDeclarations(`${declaration}\nagent: `), ["agent"]); - assert.deepEqual(missingDeclarations(`${declaration}\n`), ["agent"]); - assert.deepEqual(missingDeclarations("```\n" + declaration + "\nagent: 豆包\n```"), ["model", "agent"]); - assert.deepEqual(missingDeclarations(null), ["model", "agent"]); + assert.deepEqual(missingDeclarations(declaration), ["tool"]); + assert.deepEqual(missingDeclarations("tool: 豆包"), ["model"]); + assert.deepEqual(missingDeclarations("model: google/\ntool: Cursor"), ["model"]); + assert.deepEqual(missingDeclarations("model: /gemini\ntool: Cursor"), ["model"]); + assert.deepEqual(missingDeclarations("model: gemini\ntool: Cursor"), ["model"]); + assert.deepEqual(missingDeclarations(`${declaration}\ntool: `), ["tool"]); + assert.deepEqual(missingDeclarations(`${declaration}\n`), ["tool"]); + assert.deepEqual(missingDeclarations("```\n" + declaration + "\ntool: 豆包\n```"), ["model", "tool"]); + assert.deepEqual(missingDeclarations(null), ["model", "tool"]); }); test("closes a new PR when either declaration is missing from its current description", async () => { const cases = [ - ["", ["model", "agent"]], - [declaration, ["agent"]], - ["agent: 豆包", ["model"]], + ["", ["model", "tool"]], + [declaration, ["tool"]], + ["tool: 豆包", ["model"]], + [`${declaration}\ntool: WorkBuddy`, []], [`${declaration}\nagent: WorkBuddy`, []], ]; for (const [body, missing] of cases) { diff --git a/.github/workflows/pr-model.yml b/.github/workflows/pr-model.yml index 8f2008e..9c27b3d 100644 --- a/.github/workflows/pr-model.yml +++ b/.github/workflows/pr-model.yml @@ -1,4 +1,4 @@ -name: PR Model and Agent Declaration +name: PR Model and Coding Tool Declaration on: pull_request_target: @@ -21,7 +21,7 @@ jobs: persist-credentials: false sparse-checkout-cone-mode: false sparse-checkout: /.github/scripts/pr-model.mjs - - name: Check the model and agent declarations + - name: Check the model and coding tool declarations env: GITHUB_TOKEN: ${{ github.token }} run: node .github/scripts/pr-model.mjs diff --git a/AGENTS.md b/AGENTS.md index 27f2fd8..cd040ec 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,11 +40,11 @@ Reims-Go 发布的便携运行时基于团队独立维护的 `reims-go/reims-vgp 7. 捕获异常后必须执行上报错误、记录诊断告警或回退状态等明确处理,前端测试会自动拦截空异常捕获块。 8. `docs/` 只存放当前生效且删掉会影响编码的文档,采用主谓清晰的简单句说明现状,不写本机路径、排期历史、内部变量函数名或「粗体标题加冒号」的口号句式。 -## PR 模型与 Agent 申报 +## PR 模型与编程工具申报 -提交新 PR 时,请在描述中逐行如实申报参与代码编写的模型和 Agent。模型使用 `model: 提供方/模型名称`,例如 `model: deepseek/deepseek-R1`。Agent 使用 `agent: 名称`,例如 `agent: WorkBuddy` 或 `agent: 豆包`。请填写实际使用的名称。 +提交新 PR 时,请在描述正文(不要放在代码块或 HTML 注释内)逐行如实申报参与代码编写的模型和编程工具。模型使用 `model: 提供方/模型名称`,例如 `model: deepseek/deepseek-R1` 或 `model: google/Gemini 4 Neon`。编程工具使用 `tool: 名称`,例如 `tool: Cursor`、`tool: Claude Code`、`tool: WorkBuddy` 或 `tool: 豆包`(校验脚本同时兼容旧的 `agent:` 写法)。请填写实际使用的名称。 -缺少模型或 Agent 申报的 PR 直接关闭。纯人工编写的提交不予合并。此规则仅适用于生效后新建的 PR,已创建的 PR 继续按原规则处理。 +缺少模型或编程工具申报的 PR 直接关闭。纯人工编写的提交不予合并。此规则仅适用于生效后新建的 PR,已创建的 PR 继续按原规则处理。 ## 版本变更与开源合规 diff --git a/changes/plugin-icons-market-polish.json b/changes/plugin-icons-market-polish.json new file mode 100644 index 0000000..bc73751 --- /dev/null +++ b/changes/plugin-icons-market-polish.json @@ -0,0 +1,7 @@ +{ + "group": "improvements", + "order": 0, + "authors": ["Nwflower"], + "zh": "插件支持在清单中声明颜色令牌与 SVG 前景图标并迁移全部内置插件,插件页新增「上架插件」入口,市场卡片展示 GitHub Star 数与下载量,语言包脚手架默认仅生成目标语言标题与精简描述。", + "en": "Support custom icon tone tokens and monochrome SVG foregrounds in plugin manifests (migrating all built-in plugins), add a Submit plugin button to the Plugins page, display GitHub star and download counts on market cards, and scaffold language packs with concise native-locale metadata." +} diff --git a/frontend/src/components/PluginAppIcon.tsx b/frontend/src/components/PluginAppIcon.tsx index aed39dc..0166b86 100644 --- a/frontend/src/components/PluginAppIcon.tsx +++ b/frontend/src/components/PluginAppIcon.tsx @@ -1,15 +1,15 @@ import { - Boxes, Clipboard, Compass, Cpu, Disc3, Globe, Keyboard, - Layers, Monitor, Palette, Puzzle, RotateCcw, + Boxes, Globe, Layers, Monitor, Palette, Puzzle, } from 'lucide-react' import React from 'react' -import { PermissionSpec } from '../types' +import { PermissionSpec, PluginIcon } from '../types' export interface PluginVisualSource { id?: string kind?: string system?: boolean tier?: string + icon?: PluginIcon locales?: string[] permissions?: Array } @@ -21,12 +21,25 @@ export interface PluginVisual { const ICON_SIZES = { sm: 16, md: 18, lg: 20 } as const -/** - * Single visual resolver for both installed plugins (PluginInfo) and market - * entries (MarketEntry), so a plugin keeps the same icon and colour across - * Market, Installed and first-run setup. - */ -export function resolvePluginVisual(src: PluginVisualSource, iconSize = 20): PluginVisual { +const PLUGIN_ICON_TONES = new Set([ + 'indigo', 'purple', 'sky', 'rose', 'emerald', 'amber', 'teal', 'slate', +]) + +function normalizeTone(tone?: string): string { + const t = (tone ?? '').trim().toLowerCase() + return PLUGIN_ICON_TONES.has(t) ? t : '' +} + +function toSafeSvgMaskUrl(raw?: string): string { + const s = (raw ?? '').trim() + if (!s) return '' + const lower = s.toLowerCase() + if (!lower.startsWith('')) return '' + if (/