From eb9d7ee4b27cc745e27a6044d79078f13c20d89f Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 27 Jun 2026 10:04:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=89=80=E6=9C=89=20skill=20?= =?UTF-8?q?=E4=BD=9C=E7=94=A8=E5=9F=9F=E6=9B=B4=E6=94=B9=E4=B8=BA=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/BootstrapBlazor.LLMsDocs.Cli/CommandFactory.cs | 4 ++-- tools/BootstrapBlazor.LLMsDocs.Cli/Scaffolder.cs | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/BootstrapBlazor.LLMsDocs.Cli/CommandFactory.cs b/tools/BootstrapBlazor.LLMsDocs.Cli/CommandFactory.cs index b578d5c4..d5acf308 100644 --- a/tools/BootstrapBlazor.LLMsDocs.Cli/CommandFactory.cs +++ b/tools/BootstrapBlazor.LLMsDocs.Cli/CommandFactory.cs @@ -154,7 +154,7 @@ private static Command BuildInstructionsCommand() private static Command BuildInstallCommand() { var client = new Option("--client") { Description = "Target client: claude | cursor | trae | codex | all (default all)." }; - var scope = new Option("--scope") { Description = "Where to write: project (cwd, default) or user (home)." }; + var scope = new Option("--scope") { Description = "Where to write: user (home, default) or project (cwd)." }; var target = new Option("--target") { Description = "Override base directory to write into." }; var force = new Option("--force") { Description = "Overwrite existing files." }; var cmd = new Command("install", "Install agent discovery artifacts (Claude Code skill / Cursor rules / Trae skill / Codex AGENTS.md).") @@ -167,7 +167,7 @@ private static Command BuildInstallCommand() { return Task.FromResult(Scaffolder.Install( result.GetValue(client) ?? "all", - result.GetValue(scope) ?? "project", + result.GetValue(scope), result.GetValue(target), result.GetValue(force))); } diff --git a/tools/BootstrapBlazor.LLMsDocs.Cli/Scaffolder.cs b/tools/BootstrapBlazor.LLMsDocs.Cli/Scaffolder.cs index 5f36b29b..8fc037cb 100644 --- a/tools/BootstrapBlazor.LLMsDocs.Cli/Scaffolder.cs +++ b/tools/BootstrapBlazor.LLMsDocs.Cli/Scaffolder.cs @@ -38,7 +38,12 @@ public static int Instructions() } /// Write discovery artifacts for the requested client(s). - public static int Install(string client, string scope, string? target, bool force) + /// + /// user (home, the default) or project (cwd). Defaulting to the user + /// home keeps every client's discovery artifact alongside the globally-installed + /// tool, so it is auto-discovered in every project without re-running install per repo. + /// + public static int Install(string client, string? scope, string? target, bool force) { var clients = client.ToLowerInvariant() switch { @@ -50,7 +55,9 @@ public static int Install(string client, string scope, string? target, bool forc _ => throw new ArgumentException($"Unknown client: {client} (expected claude|cursor|trae|codex|all)") }; - var scopeKey = scope.ToLowerInvariant(); + // No explicit --scope defaults to the user home: the tool is installed globally, + // so its discovery artifacts live in the user home and work in every project. + var scopeKey = (scope ?? "user").ToLowerInvariant(); if (scopeKey is not ("project" or "user")) { throw new ArgumentException($"Unknown scope: {scope} (expected project|user)"); From fca2103dc8c4ef03605372df3e9dc2bb0e7a487f Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 27 Jun 2026 10:23:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=20readme=20?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/BootstrapBlazor.LLMsDocs.Cli/README.md | 37 ++++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/tools/BootstrapBlazor.LLMsDocs.Cli/README.md b/tools/BootstrapBlazor.LLMsDocs.Cli/README.md index 54ea7ae8..bef71b0b 100644 --- a/tools/BootstrapBlazor.LLMsDocs.Cli/README.md +++ b/tools/BootstrapBlazor.LLMsDocs.Cli/README.md @@ -130,10 +130,10 @@ bb-llms get Button --base-url ./wwwroot/llms ```bash bb-llms instructions # 打印可粘贴进 CLAUDE.md / AGENTS.md 的通用片段 -bb-llms install --client claude # 写 .claude/skills/bootstrapblazor/SKILL.md -bb-llms install --client cursor # 写 .cursor/rules/bootstrapblazor.mdc -bb-llms install --client trae # 写 .trae/skills/bootstrapblazor/SKILL.md -bb-llms install --client codex # 写 AGENTS.md(user scope 为 ~/.codex/AGENTS.md) +bb-llms install --client claude # 写 ~/.claude/skills/bootstrapblazor/SKILL.md +bb-llms install --client cursor # 写 ~/.cursor/rules/bootstrapblazor.mdc +bb-llms install --client trae # 写 ~/.trae/skills/bootstrapblazor/SKILL.md +bb-llms install --client codex # 写 ~/.codex/AGENTS.md bb-llms install --client all # 四者都写(默认) ``` @@ -141,32 +141,39 @@ bb-llms install --client all # 四者都写(默认) ``` --client claude|cursor|trae|codex|all 目标客户端(默认 all) ---scope project|user project=当前目录(默认),user=用户主目录 +--scope user|project user=用户主目录(默认),project=当前目录 --target 覆盖写入的根目录 --force 覆盖已存在的文件(默认存在则跳过) ``` +> 默认 scope 为 **user(用户主目录)**:四个客户端的发现文件都装到用户主目录 +> (`~/.claude/skills/`、`~/.cursor/rules/`、`~/.trae/skills/`、`~/.codex/AGENTS.md`), +> 配合全局安装的 `bb-llms`,在任意项目里都能被自动发现,装一次全局生效。 +> 需要只对当前项目生效时,用 `--scope project` 显式覆盖 +> (如 `bb-llms install --client codex --scope project` 写仓库根目录的 `AGENTS.md`)。 + 五套生态接入方式: -- **Claude Code**:`bb-llms install --client claude` 写入一个 skill,Claude Code 会根据其 - `description` 在任务涉及 BootstrapBlazor 组件时**自动加载**并调用 `bb-llms`, - 等效于 MCP server 的自动发现。 -- **Cursor**:`bb-llms install --client cursor` 写入项目规则(匹配 `*.razor` / `*.razor.cs`)。 -- **Trae**:`bb-llms install --client trae` 写入一个 skill(`.trae/skills/bootstrapblazor/SKILL.md`)。 +- **Claude Code**:`bb-llms install --client claude` 在**用户主目录** `~/.claude/skills/` + 写入一个 skill,Claude Code 会根据其 `description` 在任务涉及 BootstrapBlazor 组件时 + **自动加载**并调用 `bb-llms`,等效于 MCP server 的自动发现。装一次即对所有项目生效。 +- **Cursor**:`bb-llms install --client cursor` 在**用户主目录** `~/.cursor/rules/` + 写入规则(匹配 `*.razor` / `*.razor.cs`),全局生效。 +- **Trae**:`bb-llms install --client trae` 在**用户主目录** `~/.trae/skills/` 写入一个 skill。 Trae 的 skill 与 Claude 同构(同样的 `SKILL.md` + name/description frontmatter,按描述**自动匹配**), - 因此复用同一套模板。 -- **Codex**:`bb-llms install --client codex` 写入 `AGENTS.md`(project scope 为仓库根目录的 - `AGENTS.md`,user scope 为 `~/.codex/AGENTS.md`)。Codex 没有独立的 skill/规则机制,统一读 `AGENTS.md`, + 因此复用同一套模板,同样装一次全局生效。 +- **Codex**:`bb-llms install --client codex` 写入 `~/.codex/AGENTS.md`(用户主目录,默认; + `--scope project` 则写仓库根目录的 `AGENTS.md`)。Codex 没有独立的 skill/规则机制,统一读 `AGENTS.md`, 因此复用 `instructions` 的通用片段。 > ⚠️ `AGENTS.md` 是手工维护的共享文件,**默认存在则跳过**;`--force` 会整文件覆盖,原有内容会丢失。 > 已有 `AGENTS.md` 时,建议改用 `bb-llms instructions` 把片段手动粘进去。 - **通用 / 其他 agent**:把 `bb-llms instructions` 的输出粘进项目的 `CLAUDE.md` / `AGENTS.md`。 -典型流程(在你的 Blazor 项目根目录): +典型流程: ```bash dotnet tool install -g BootstrapBlazor.LLMsDocs.Cli # 1. 装工具 -bb-llms install --client claude # 2. 装发现层 +bb-llms install --client claude # 2. 装发现层(写入用户主目录,全局生效) # 之后在 Claude Code 中让它写/改组件代码时,会自动用 bb-llms 查权威 API ``` From c3480715e85195108b8b8271a8df469aa4ae289f Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 29 Aug 2026 13:54:44 +0800 Subject: [PATCH 3/3] chore: bump version 10.0.3 --- .../BootstrapBlazor.LLMsDocs.Cli.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/BootstrapBlazor.LLMsDocs.Cli/BootstrapBlazor.LLMsDocs.Cli.csproj b/tools/BootstrapBlazor.LLMsDocs.Cli/BootstrapBlazor.LLMsDocs.Cli.csproj index 2bd3ea16..35a7386e 100644 --- a/tools/BootstrapBlazor.LLMsDocs.Cli/BootstrapBlazor.LLMsDocs.Cli.csproj +++ b/tools/BootstrapBlazor.LLMsDocs.Cli/BootstrapBlazor.LLMsDocs.Cli.csproj @@ -1,7 +1,7 @@ - 10.0.2 + 10.0.3 Exe net10.0 false