@bonesofspring/ai-rules 0.2.57 → 0.2.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/README.md +41 -3
- package/bin/cli.js +399 -27
- package/bin/lib/engine-scripts.js +3 -0
- package/bin/lib/mcp/catalog.js +97 -0
- package/bin/lib/mcp/clients.js +35 -2
- package/bin/lib/mcp/credentials.js +85 -1
- package/bin/lib/mcp/doctor.js +93 -17
- package/bin/lib/mcp/registry.js +10 -4
- package/bin/lib/seed-ai-local-team.js +8 -5
- package/docs/MCP-CATALOG.md +56 -0
- package/docs/MCP-SETUP.md +38 -6
- package/docs/PRESET-CONTRIBUTION.md +1 -0
- package/mcp/github-proxy.mjs +133 -0
- package/mcp/lib/github.mjs +187 -0
- package/mcp/lib/streamable-http.mjs +185 -0
- package/mcp/lib/yandex.mjs +16 -137
- package/package.json +3 -1
- package/presets/_shared/ai-local/scripts/check-write-scope.mjs +212 -0
- package/presets/_shared/ai-local/scripts/rule-improver.mjs +343 -50
- package/presets/_shared/ai-local/scripts/run.mjs +122 -3
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +12 -0
- package/presets/_shared/core/review/code-review-mr.md +10 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +143 -1
- package/presets/claude/android-kotlin/commands/update.md +1 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/go/commands/update.md +1 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/go/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/ios-swift/commands/update.md +1 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/java/commands/update.md +1 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/java/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/mcp-ts/commands/update.md +1 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/mol/commands/update.md +1 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/mol/rules/tooling-and-review/code-review-mr.md +10 -0
- package/presets/claude/next/agents/build-verifier.md +2 -0
- package/presets/claude/next/agents/code-reviewer.md +8 -0
- package/presets/claude/next/commands/task-continue.md +3 -1
- package/presets/claude/next/commands/update.md +1 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +10 -0
- package/presets/claude/nuxt/commands/update.md +1 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/nuxt/rules/tooling-and-review/code-review-mr.md +10 -0
- package/presets/claude/php-hexagonal/commands/update.md +1 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/php-laravel/commands/update.md +1 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/code-review.md +10 -0
- package/presets/claude/svelte/commands/update.md +1 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +143 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
- package/presets/claude/svelte/rules/tooling-and-review/code-review-mr.md +10 -0
- package/presets/cursor/android-kotlin/commands/update.md +1 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/android-kotlin/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/go/commands/update.md +1 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/go/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/ios-swift/commands/update.md +1 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/ios-swift/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/java/commands/update.md +1 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/java/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/mcp-ts/commands/update.md +1 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/mol/MCP.md +4 -3
- package/presets/cursor/mol/commands/update.md +1 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/mol/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/next/MCP.md +4 -3
- package/presets/cursor/next/agents/build-verifier.md +2 -0
- package/presets/cursor/next/agents/code-reviewer.md +8 -0
- package/presets/cursor/next/commands/task-continue.md +3 -1
- package/presets/cursor/next/commands/update.md +1 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/next/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/nuxt/commands/update.md +1 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/nuxt/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/php-hexagonal/commands/update.md +1 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/php-hexagonal/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/php-laravel/commands/update.md +1 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/php-laravel/rules/code-review-mr.mdc +10 -0
- package/presets/cursor/svelte/commands/update.md +1 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +143 -1
- package/presets/cursor/svelte/rules/code-review-mr.mdc +10 -0
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/commands/update.md +1 -0
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/android-kotlin/rules/code-review-mr.md +10 -0
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/commands/update.md +1 -0
- package/presets/mavis/go/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/go/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/go/rules/code-review-mr.md +10 -0
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/commands/update.md +1 -0
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/ios-swift/rules/code-review-mr.md +10 -0
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/commands/update.md +1 -0
- package/presets/mavis/java/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/java/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/java/rules/code-review-mr.md +10 -0
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/commands/update.md +1 -0
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/mcp-ts/rules/code-review-mr.md +10 -0
- package/presets/mavis/mol/MCP.md +4 -3
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/commands/update.md +1 -0
- package/presets/mavis/mol/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/mol/rules/code-review-mr.md +10 -0
- package/presets/mavis/next/MCP.md +4 -3
- package/presets/mavis/next/adapter-map.json +1 -1
- package/presets/mavis/next/agents/build-verifier.md +2 -0
- package/presets/mavis/next/agents/code-reviewer.md +8 -0
- package/presets/mavis/next/commands/task-continue.md +3 -1
- package/presets/mavis/next/commands/update.md +1 -0
- package/presets/mavis/next/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/next/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/next/rules/code-review-mr.md +10 -0
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/commands/update.md +1 -0
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/nuxt/rules/code-review-mr.md +10 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/commands/update.md +1 -0
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/php-hexagonal/rules/code-review-mr.md +10 -0
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/commands/update.md +1 -0
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/php-laravel/rules/code-review-mr.md +10 -0
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/commands/update.md +1 -0
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +143 -1
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +12 -0
- package/presets/mavis/svelte/rules/code-review-mr.md +10 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/commands/update.md +1 -0
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/android-kotlin/rules/code-review-mr.md +10 -0
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/commands/update.md +1 -0
- package/presets/opencode/go/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/go/rules/code-review-mr.md +10 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/commands/update.md +1 -0
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/ios-swift/rules/code-review-mr.md +10 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/commands/update.md +1 -0
- package/presets/opencode/java/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/java/rules/code-review-mr.md +10 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/commands/update.md +1 -0
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/mcp-ts/rules/code-review-mr.md +10 -0
- package/presets/opencode/mol/MCP.md +4 -3
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/commands/update.md +1 -0
- package/presets/opencode/mol/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/mol/rules/code-review-mr.md +10 -0
- package/presets/opencode/next/MCP.md +4 -3
- package/presets/opencode/next/adapter-map.json +1 -1
- package/presets/opencode/next/agents/build-verifier.md +2 -0
- package/presets/opencode/next/agents/code-reviewer.md +8 -0
- package/presets/opencode/next/commands/task-continue.md +3 -1
- package/presets/opencode/next/commands/update.md +1 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/next/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/next/rules/code-review-mr.md +10 -0
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/commands/update.md +1 -0
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/nuxt/rules/code-review-mr.md +10 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/commands/update.md +1 -0
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/php-hexagonal/rules/code-review-mr.md +10 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/commands/update.md +1 -0
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/php-laravel/rules/code-review-mr.md +10 -0
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/commands/update.md +1 -0
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +143 -1
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +12 -0
- package/presets/opencode/svelte/rules/code-review-mr.md +10 -0
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/commands/update.md +1 -0
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/android-kotlin/rules/code-review-mr.md +10 -0
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/commands/update.md +1 -0
- package/presets/zcode/go/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/go/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/go/rules/code-review-mr.md +10 -0
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/commands/update.md +1 -0
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/ios-swift/rules/code-review-mr.md +10 -0
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/commands/update.md +1 -0
- package/presets/zcode/java/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/java/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/java/rules/code-review-mr.md +10 -0
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/commands/update.md +1 -0
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/mcp-ts/rules/code-review-mr.md +10 -0
- package/presets/zcode/mol/MCP.md +4 -3
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/commands/update.md +1 -0
- package/presets/zcode/mol/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/mol/rules/code-review-mr.md +10 -0
- package/presets/zcode/next/MCP.md +4 -3
- package/presets/zcode/next/adapter-map.json +1 -1
- package/presets/zcode/next/agents/build-verifier.md +2 -0
- package/presets/zcode/next/agents/code-reviewer.md +8 -0
- package/presets/zcode/next/commands/task-continue.md +3 -1
- package/presets/zcode/next/commands/update.md +1 -0
- package/presets/zcode/next/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/next/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/next/rules/code-review-mr.md +10 -0
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/commands/update.md +1 -0
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/nuxt/rules/code-review-mr.md +10 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/commands/update.md +1 -0
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/php-hexagonal/rules/code-review-mr.md +10 -0
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/commands/update.md +1 -0
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/php-laravel/rules/code-review-mr.md +10 -0
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/commands/update.md +1 -0
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +143 -1
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +12 -0
- package/presets/zcode/svelte/rules/code-review-mr.md +10 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Third-party MCP catalog written by `init mcp`.
|
|
3
|
+
*
|
|
4
|
+
* The entries mirror the servers this repository ships in its own client
|
|
5
|
+
* configs (`.mcp.json`, `.cursor/mcp.json`, `opencode.json`, ...). One
|
|
6
|
+
* canonical spec renders into each client's native shape, so the catalog is
|
|
7
|
+
* the single place to bump a pin or add a server.
|
|
8
|
+
*
|
|
9
|
+
* Pins also live in `presets/<tool>/next/mcp.json`; bump them together —
|
|
10
|
+
* `scripts/test-cli-mcp-catalog.mjs` fails when the two drift.
|
|
11
|
+
*/
|
|
12
|
+
const CATALOG = [
|
|
13
|
+
{
|
|
14
|
+
slug: 'context7',
|
|
15
|
+
title: 'Context7',
|
|
16
|
+
command: 'npx',
|
|
17
|
+
args: ['-y', '@upstash/context7-mcp@4.5.0'],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
slug: 'playwright',
|
|
21
|
+
title: 'Playwright',
|
|
22
|
+
command: 'npx',
|
|
23
|
+
args: ['-y', '@playwright/mcp@0.0.84'],
|
|
24
|
+
/** Claude Code uses this id in its own project config. */
|
|
25
|
+
ids: { claude: 'playwright-test' },
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
slug: 'chrome-devtools',
|
|
29
|
+
title: 'Chrome DevTools',
|
|
30
|
+
command: 'npx',
|
|
31
|
+
args: ['-y', 'chrome-devtools-mcp@1.12.0'],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
slug: 'figma-desktop',
|
|
35
|
+
title: 'Figma Desktop',
|
|
36
|
+
/** The shipped preset id for the desktop server. */
|
|
37
|
+
defaultId: 'figma',
|
|
38
|
+
aliases: ['figma'],
|
|
39
|
+
url: 'http://127.0.0.1:3845/mcp',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
slug: 'figma-cloud',
|
|
43
|
+
title: 'Figma Cloud',
|
|
44
|
+
url: 'https://mcp.figma.com/mcp',
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const BY_NAME = new Map();
|
|
49
|
+
for (const server of CATALOG) {
|
|
50
|
+
BY_NAME.set(server.slug, server);
|
|
51
|
+
for (const alias of server.aliases || []) {
|
|
52
|
+
BY_NAME.set(alias, server);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function catalogNames() {
|
|
57
|
+
return CATALOG.map((server) => server.slug);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Catalog entry for a CLI name or alias; null for anything else. */
|
|
61
|
+
function resolveCatalogName(name) {
|
|
62
|
+
return BY_NAME.get(name) || null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Key a server occupies in a client config (Claude renames Playwright). */
|
|
66
|
+
function entryId(client, server) {
|
|
67
|
+
return (server.ids && server.ids[client.id]) || server.defaultId || server.slug;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Native rendering for one client. Cursor, Mavis and ZCode take a flat
|
|
72
|
+
* `{ command, args }` / `{ url }`; Claude Code marks a remote entry `http`;
|
|
73
|
+
* OpenCode wants `{ type: 'local', command: [...] }` / `{ type: 'remote', url }`.
|
|
74
|
+
*/
|
|
75
|
+
function renderEntry(client, server) {
|
|
76
|
+
if (server.url) {
|
|
77
|
+
if (client.shape === 'local') {
|
|
78
|
+
return { type: 'remote', url: server.url };
|
|
79
|
+
}
|
|
80
|
+
if (client.id === 'claude') {
|
|
81
|
+
return { type: 'http', url: server.url };
|
|
82
|
+
}
|
|
83
|
+
return { url: server.url };
|
|
84
|
+
}
|
|
85
|
+
if (client.shape === 'local') {
|
|
86
|
+
return { type: 'local', command: [server.command, ...server.args] };
|
|
87
|
+
}
|
|
88
|
+
return { command: server.command, args: [...server.args] };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = {
|
|
92
|
+
CATALOG,
|
|
93
|
+
catalogNames,
|
|
94
|
+
resolveCatalogName,
|
|
95
|
+
entryId,
|
|
96
|
+
renderEntry,
|
|
97
|
+
};
|
package/bin/lib/mcp/clients.js
CHANGED
|
@@ -10,6 +10,7 @@ const fs = require('fs');
|
|
|
10
10
|
const path = require('path');
|
|
11
11
|
const { assertSafeDest } = require('../safe-path');
|
|
12
12
|
const { createInstallTransaction, isPlainObject, readMergeableJson, runStamp } = require('../fs-utils');
|
|
13
|
+
const { mergeServerEntry } = require('../merged-config');
|
|
13
14
|
const {
|
|
14
15
|
CLIENT_IDS,
|
|
15
16
|
clientById,
|
|
@@ -18,6 +19,7 @@ const {
|
|
|
18
19
|
ownsEntry,
|
|
19
20
|
renderEntry,
|
|
20
21
|
} = require('./registry');
|
|
22
|
+
const { entryId: catalogEntryId, renderEntry: renderCatalogEntry } = require('./catalog');
|
|
21
23
|
|
|
22
24
|
function detectClientIds(cwd, markers) {
|
|
23
25
|
return CLIENT_IDS.filter((id) => clientPresent(cwd, clientById(id), markers));
|
|
@@ -121,8 +123,7 @@ function planClient({ cwd, client, servers, version, replace }) {
|
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
/** Validate every target, then write only the files whose text changed. */
|
|
124
|
-
function
|
|
125
|
-
const plans = clients.map((client) => planClient({ cwd, client, servers, version, replace }));
|
|
126
|
+
function writePlans(cwd, plans) {
|
|
126
127
|
const changed = [];
|
|
127
128
|
if (plans.some((plan) => plan.changed)) {
|
|
128
129
|
const tx = createInstallTransaction(cwd, path.join(cwd, '.ai-rules', '.rollback', runStamp()));
|
|
@@ -134,9 +135,39 @@ function registerServers({ cwd, clients, servers, version, replace = false }) {
|
|
|
134
135
|
}
|
|
135
136
|
tx.commit();
|
|
136
137
|
}
|
|
138
|
+
return changed;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Validate every target, then write only the files whose text changed. */
|
|
142
|
+
function registerServers({ cwd, clients, servers, version, replace = false }) {
|
|
143
|
+
const plans = clients.map((client) => planClient({ cwd, client, servers, version, replace }));
|
|
144
|
+
const changed = writePlans(cwd, plans);
|
|
137
145
|
return { changed, warnings: plans.flatMap((plan) => plan.warnings) };
|
|
138
146
|
}
|
|
139
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Merge catalog entries into each client the preset way: shipped scalar fields
|
|
150
|
+
* win, extra servers and consumer `env` / `headers` stay. Catalog entries carry
|
|
151
|
+
* no ownership marker — the command is an explicit install, so the id is the
|
|
152
|
+
* contract, not a prior private record.
|
|
153
|
+
*/
|
|
154
|
+
function planCatalogClient({ cwd, client, servers }) {
|
|
155
|
+
const { rel, abs, existing, text } = readClientConfig(cwd, client);
|
|
156
|
+
const doc = existing === null ? seedDocument(client) : structuredClone(existing);
|
|
157
|
+
const container = ensureContainer(doc, client.key);
|
|
158
|
+
for (const server of servers) {
|
|
159
|
+
const id = catalogEntryId(client, server);
|
|
160
|
+
container[id] = mergeServerEntry(container[id], renderCatalogEntry(client, server));
|
|
161
|
+
}
|
|
162
|
+
const nextText = `${JSON.stringify(doc, null, 2)}\n`;
|
|
163
|
+
return { client, rel, abs, text, nextText, changed: nextText !== text };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function registerCatalogServers({ cwd, clients, servers }) {
|
|
167
|
+
const plans = clients.map((client) => planCatalogClient({ cwd, client, servers }));
|
|
168
|
+
return { changed: writePlans(cwd, plans) };
|
|
169
|
+
}
|
|
170
|
+
|
|
140
171
|
function planRemoval({ cwd, client, servers }) {
|
|
141
172
|
const { rel, abs, existing, text } = readClientConfig(cwd, client);
|
|
142
173
|
if (existing === null) {
|
|
@@ -197,9 +228,11 @@ function removeServers({ cwd, clients, servers }) {
|
|
|
197
228
|
}
|
|
198
229
|
|
|
199
230
|
module.exports = {
|
|
231
|
+
containerAt,
|
|
200
232
|
detectClientIds,
|
|
201
233
|
selectClients,
|
|
202
234
|
readClientConfig,
|
|
203
235
|
registerServers,
|
|
236
|
+
registerCatalogServers,
|
|
204
237
|
removeServers,
|
|
205
238
|
};
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
* stored in `.ai-rules/mcp/credentials.env` (0600) inside a self-ignoring dir.
|
|
6
6
|
* Yandex: `yc` detection and one `yc iam create-token` proof; only non-secret
|
|
7
7
|
* settings are written to `.ai-rules/mcp/config.env`. No token is ever stored.
|
|
8
|
+
* GitHub: the token is read from the shell or from `.env.github` in the project
|
|
9
|
+
* root and validated against the GitHub API. Nothing is written — the file and
|
|
10
|
+
* the token belong to the consumer.
|
|
8
11
|
*
|
|
9
|
-
*
|
|
12
|
+
* The commands never write the legacy root `.env.gitlab` / `.env.yandex`.
|
|
10
13
|
*/
|
|
11
14
|
const fs = require('fs');
|
|
12
15
|
const path = require('path');
|
|
@@ -14,9 +17,11 @@ const { spawnSync } = require('child_process');
|
|
|
14
17
|
const { assertSafeDest, resolveManagedPath } = require('../safe-path');
|
|
15
18
|
const { createInstallTransaction, runStamp } = require('../fs-utils');
|
|
16
19
|
const { readSecret, ask } = require('./prompt');
|
|
20
|
+
const { resolveProjectRootDetailed } = require('./run');
|
|
17
21
|
|
|
18
22
|
const CREDENTIALS_REL = '.ai-rules/mcp/credentials.env';
|
|
19
23
|
const CONFIG_REL = '.ai-rules/mcp/config.env';
|
|
24
|
+
const GITHUB_CREDENTIALS_REL = '.env.github';
|
|
20
25
|
const IGNORE_REL = '.ai-rules/.gitignore';
|
|
21
26
|
const IGNORE_TEXT = [
|
|
22
27
|
'# Local ai-rules state (MCP credentials, install snapshots).',
|
|
@@ -217,6 +222,82 @@ async function setupGitlab({ cwd, options = {}, io = {}, envfile }) {
|
|
|
217
222
|
};
|
|
218
223
|
}
|
|
219
224
|
|
|
225
|
+
/**
|
|
226
|
+
* The project root that holds `.env.github` — the same root the runtime
|
|
227
|
+
* resolves when the client starts the server.
|
|
228
|
+
*/
|
|
229
|
+
function githubProjectRoot(cwd) {
|
|
230
|
+
try {
|
|
231
|
+
return resolveProjectRootDetailed({ cwd }).root;
|
|
232
|
+
} catch {
|
|
233
|
+
return path.resolve(cwd);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* GitHub: validate the token the consumer already holds.
|
|
239
|
+
*
|
|
240
|
+
* The token comes from the shell or from `.env.github` in the project root; the
|
|
241
|
+
* package never writes it, so this command only proves the token and the
|
|
242
|
+
* ignore rule, then lets the caller register the client entries.
|
|
243
|
+
*
|
|
244
|
+
* @returns {Promise<object>} `{ ok, detail, next?, warnings }`
|
|
245
|
+
*/
|
|
246
|
+
async function setupGithub({ cwd, options = {}, github }) {
|
|
247
|
+
const warnings = [];
|
|
248
|
+
const root = githubProjectRoot(cwd);
|
|
249
|
+
const config = github.resolveGithubConfig({ root });
|
|
250
|
+
|
|
251
|
+
if (!config.token) {
|
|
252
|
+
return {
|
|
253
|
+
ok: false,
|
|
254
|
+
detail: `GITHUB_TOKEN is not set in ${GITHUB_CREDENTIALS_REL} or the environment`,
|
|
255
|
+
next: `add GITHUB_TOKEN to ${GITHUB_CREDENTIALS_REL} in the project root, then rerun ai-rules mcp setup github`,
|
|
256
|
+
warnings,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (config.fileHasToken) {
|
|
261
|
+
const ignored = checkIgnored(root, GITHUB_CREDENTIALS_REL);
|
|
262
|
+
if (ignored.status === 'fail') {
|
|
263
|
+
return {
|
|
264
|
+
ok: false,
|
|
265
|
+
detail: `${GITHUB_CREDENTIALS_REL} is not ignored`,
|
|
266
|
+
next: `add ${GITHUB_CREDENTIALS_REL} to .gitignore, then rerun ai-rules mcp setup github`,
|
|
267
|
+
warnings,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
if (ignored.status === 'warn') {
|
|
271
|
+
warnings.push(`${GITHUB_CREDENTIALS_REL} ignore rule is not provable here (not a git repository)`);
|
|
272
|
+
}
|
|
273
|
+
} else if (config.hasCredentialsFile) {
|
|
274
|
+
warnings.push(`${GITHUB_CREDENTIALS_REL} holds no token; the token comes from the environment`);
|
|
275
|
+
} else {
|
|
276
|
+
warnings.push('the token comes from the environment; the MCP client must start the server with GITHUB_TOKEN set');
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const validation = await github.verifyGithubToken({ token: config.token, apiUrl: config.apiUrl });
|
|
280
|
+
if (!validation.ok) {
|
|
281
|
+
const unreachable = validation.status === 0;
|
|
282
|
+
return {
|
|
283
|
+
ok: false,
|
|
284
|
+
kind: unreachable ? 'runtime' : undefined,
|
|
285
|
+
detail: validation.detail,
|
|
286
|
+
next: unreachable
|
|
287
|
+
? 'check network access to api.github.com'
|
|
288
|
+
: `replace GITHUB_TOKEN in ${GITHUB_CREDENTIALS_REL} with a valid token, then rerun ai-rules mcp setup github`,
|
|
289
|
+
warnings,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const origin = config.tokenOrigin === GITHUB_CREDENTIALS_REL ? GITHUB_CREDENTIALS_REL : 'the environment';
|
|
294
|
+
return {
|
|
295
|
+
ok: true,
|
|
296
|
+
detail: `${validation.detail} — read from ${origin}, nothing is written`,
|
|
297
|
+
warnings,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
220
301
|
async function setupYandex({ cwd, options = {}, io = {}, yandex, envfile }) {
|
|
221
302
|
const existingAbs = resolveManagedPath(cwd, CONFIG_REL);
|
|
222
303
|
const existing = existingAbs ? envfile.readEnvFile(existingAbs) : {};
|
|
@@ -299,12 +380,15 @@ function purgeCredentials(cwd) {
|
|
|
299
380
|
module.exports = {
|
|
300
381
|
CREDENTIALS_REL,
|
|
301
382
|
CONFIG_REL,
|
|
383
|
+
GITHUB_CREDENTIALS_REL,
|
|
302
384
|
IGNORE_REL,
|
|
303
385
|
ensureAiRulesIgnored,
|
|
304
386
|
checkIgnored,
|
|
305
387
|
normalizeGitlabUrl,
|
|
306
388
|
readCredentials,
|
|
389
|
+
githubProjectRoot,
|
|
307
390
|
setupGitlab,
|
|
391
|
+
setupGithub,
|
|
308
392
|
setupYandex,
|
|
309
393
|
purgeCredentials,
|
|
310
394
|
};
|
package/bin/lib/mcp/doctor.js
CHANGED
|
@@ -10,9 +10,15 @@ const { resolveManagedPath } = require('../safe-path');
|
|
|
10
10
|
const { isPlainObject } = require('../fs-utils');
|
|
11
11
|
const { TOOL_INSTALL_MARKERS } = require('../tool-installs');
|
|
12
12
|
const { assertNodeFloor, resolveProjectRootDetailed } = require('./run');
|
|
13
|
-
const { detectClientIds, readClientConfig } = require('./clients');
|
|
14
|
-
const {
|
|
15
|
-
|
|
13
|
+
const { detectClientIds, readClientConfig, containerAt } = require('./clients');
|
|
14
|
+
const {
|
|
15
|
+
checkIgnored,
|
|
16
|
+
CREDENTIALS_REL,
|
|
17
|
+
CONFIG_REL,
|
|
18
|
+
GITHUB_CREDENTIALS_REL,
|
|
19
|
+
githubProjectRoot,
|
|
20
|
+
} = require('./credentials');
|
|
21
|
+
const { ownsEntry, registeredPin, tokenFinding, clientById } = require('./registry');
|
|
16
22
|
|
|
17
23
|
const AREAS = ['runtime', 'registration', 'credentials', 'upstream'];
|
|
18
24
|
|
|
@@ -109,6 +115,67 @@ async function checkGitlabUpstream(url, token) {
|
|
|
109
115
|
}
|
|
110
116
|
}
|
|
111
117
|
|
|
118
|
+
function checkGithubCredentials(root, config) {
|
|
119
|
+
if (!config.token) {
|
|
120
|
+
return {
|
|
121
|
+
status: 'fail',
|
|
122
|
+
detail: `GITHUB_TOKEN is not set in ${GITHUB_CREDENTIALS_REL} or the environment`,
|
|
123
|
+
next: `add GITHUB_TOKEN to ${GITHUB_CREDENTIALS_REL} in the project root, then rerun ai-rules mcp setup github`,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const origin = config.tokenOrigin === GITHUB_CREDENTIALS_REL ? GITHUB_CREDENTIALS_REL : 'the environment';
|
|
128
|
+
const details = [`token from ${origin}`];
|
|
129
|
+
|
|
130
|
+
if (config.fileHasToken) {
|
|
131
|
+
const ignored = checkIgnored(root, GITHUB_CREDENTIALS_REL);
|
|
132
|
+
if (ignored.status === 'fail') {
|
|
133
|
+
return {
|
|
134
|
+
status: 'fail',
|
|
135
|
+
detail: `${GITHUB_CREDENTIALS_REL} is not ignored`,
|
|
136
|
+
next: `add ${GITHUB_CREDENTIALS_REL} to .gitignore, then rerun ai-rules mcp setup github`,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
details.push(ignored.status === 'warn' ? 'ignore rule not provable (not a git repository)' : 'ignored');
|
|
140
|
+
if (process.platform !== 'win32') {
|
|
141
|
+
const mode = fs.statSync(config.credentialsPath).mode & 0o777;
|
|
142
|
+
if (mode !== 0o600) {
|
|
143
|
+
details.push(`mode 0${mode.toString(8)} (0600 is safer)`);
|
|
144
|
+
return { status: 'warn', detail: details.join(', ') };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} else if (config.hasCredentialsFile) {
|
|
148
|
+
details.push(`${GITHUB_CREDENTIALS_REL} holds no token`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return { status: 'ok', detail: details.join(', ') };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async function checkGithubUpstream(config, github) {
|
|
155
|
+
const probe = await github.probeGithubUpstream({ token: config.token, mcpUrl: config.mcpUrl });
|
|
156
|
+
|
|
157
|
+
if (probe.ok) {
|
|
158
|
+
return { status: 'ok', detail: probe.detail };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (probe.status === 401 || probe.status === 403) {
|
|
162
|
+
return {
|
|
163
|
+
status: 'fail',
|
|
164
|
+
detail: probe.detail,
|
|
165
|
+
next: `replace GITHUB_TOKEN in ${GITHUB_CREDENTIALS_REL} with a valid token, then rerun ai-rules mcp setup github`,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
let host = config.mcpUrl;
|
|
170
|
+
try {
|
|
171
|
+
host = new URL(config.mcpUrl).host;
|
|
172
|
+
} catch {
|
|
173
|
+
// keep the raw value
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return { status: 'fail', detail: probe.detail, next: `check network access to ${host}` };
|
|
177
|
+
}
|
|
178
|
+
|
|
112
179
|
async function checkRegistration(server, cwd, version) {
|
|
113
180
|
const clients = detectClientIds(cwd, TOOL_INSTALL_MARKERS);
|
|
114
181
|
if (clients.length === 0) {
|
|
@@ -117,19 +184,13 @@ async function checkRegistration(server, cwd, version) {
|
|
|
117
184
|
const statuses = [];
|
|
118
185
|
|
|
119
186
|
for (const id of clients) {
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
claude: '.mcp.json',
|
|
123
|
-
mavis: '.mavis/mcp.json',
|
|
124
|
-
opencode: 'opencode.json',
|
|
125
|
-
}[id];
|
|
126
|
-
const key = id === 'opencode' ? 'mcp' : 'mcpServers';
|
|
127
|
-
const shape = id === 'opencode' ? 'local' : 'object';
|
|
187
|
+
const client = clientById(id);
|
|
188
|
+
const { file, key } = client;
|
|
128
189
|
const addNext = `ai-rules mcp add ${server.provider} --tools ${id}`;
|
|
129
190
|
const replaceNext = `${addNext} --replace`;
|
|
130
191
|
let config;
|
|
131
192
|
try {
|
|
132
|
-
config = readClientConfig(cwd,
|
|
193
|
+
config = readClientConfig(cwd, client);
|
|
133
194
|
} catch (error) {
|
|
134
195
|
statuses.push({
|
|
135
196
|
status: 'fail',
|
|
@@ -142,7 +203,8 @@ async function checkRegistration(server, cwd, version) {
|
|
|
142
203
|
statuses.push({ status: 'fail', detail: `${id}: ${file} is missing`, next: addNext });
|
|
143
204
|
continue;
|
|
144
205
|
}
|
|
145
|
-
const
|
|
206
|
+
const container = containerAt(config.existing, key);
|
|
207
|
+
const entry = isPlainObject(container) ? container[server.id] : undefined;
|
|
146
208
|
if (entry === undefined) {
|
|
147
209
|
statuses.push({ status: 'fail', detail: `${id}: no "${server.id}" entry`, next: addNext });
|
|
148
210
|
continue;
|
|
@@ -314,16 +376,23 @@ function checkRuntime(server, cwd, packageRoot, version) {
|
|
|
314
376
|
/**
|
|
315
377
|
* @returns {Promise<{ servers: object[], exitCode: 0|1|2 }>}
|
|
316
378
|
*/
|
|
317
|
-
async function runDoctor({ cwd, provider, packageRoot, version, envfile, yandex, options = {} }) {
|
|
379
|
+
async function runDoctor({ cwd, provider, packageRoot, version, envfile, yandex, github, options = {} }) {
|
|
318
380
|
const { serversFor } = require('./registry');
|
|
319
381
|
const servers = [];
|
|
320
382
|
const failures = [];
|
|
321
383
|
|
|
384
|
+
const providers = new Set(serversFor(provider).map((server) => server.provider));
|
|
385
|
+
|
|
322
386
|
const gitlabAbs = resolveManagedPath(cwd, CREDENTIALS_REL);
|
|
323
387
|
const gitlabValues = gitlabAbs && fs.existsSync(gitlabAbs) ? envfile.readEnvFile(gitlabAbs) : {};
|
|
324
|
-
const yandexState =
|
|
325
|
-
|
|
326
|
-
|
|
388
|
+
const yandexState = providers.has('yandex') ? await checkYandexCredentials(cwd, options, yandex) : null;
|
|
389
|
+
const githubState = providers.has('github')
|
|
390
|
+
? (() => {
|
|
391
|
+
const root = githubProjectRoot(cwd);
|
|
392
|
+
const config = github.resolveGithubConfig({ root });
|
|
393
|
+
return { check: checkGithubCredentials(root, config), config };
|
|
394
|
+
})()
|
|
395
|
+
: null;
|
|
327
396
|
|
|
328
397
|
for (const server of serversFor(provider)) {
|
|
329
398
|
const checks = {};
|
|
@@ -365,6 +434,13 @@ async function runDoctor({ cwd, provider, packageRoot, version, envfile, yandex,
|
|
|
365
434
|
} else {
|
|
366
435
|
put('upstream', await checkGitlabUpstream(gitlabValues.GITLAB_URL, gitlabValues.GITLAB_TOKEN));
|
|
367
436
|
}
|
|
437
|
+
} else if (server.provider === 'github') {
|
|
438
|
+
put('credentials', githubState.check);
|
|
439
|
+
if (githubState.check.status === 'fail' || !githubState.config.token) {
|
|
440
|
+
checks.upstream = { status: 'skipped', detail: 'credentials not ready' };
|
|
441
|
+
} else {
|
|
442
|
+
put('upstream', await checkGithubUpstream(githubState.config, github));
|
|
443
|
+
}
|
|
368
444
|
} else {
|
|
369
445
|
put('credentials', yandexState.check);
|
|
370
446
|
if (yandexState.check.status === 'fail' || !yandexState.token) {
|
package/bin/lib/mcp/registry.js
CHANGED
|
@@ -14,6 +14,7 @@ const PIN_RE = /^@bonesofspring\/ai-rules@(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;
|
|
|
14
14
|
|
|
15
15
|
const SERVERS = [
|
|
16
16
|
{ id: 'gitlab', slug: 'gitlab', provider: 'gitlab', entry: 'mcp/gitlab.mjs', argv: [] },
|
|
17
|
+
{ id: 'github', slug: 'github', provider: 'github', entry: 'mcp/github-proxy.mjs', argv: [] },
|
|
17
18
|
{
|
|
18
19
|
id: 'yandex tracker',
|
|
19
20
|
slug: 'yandex-tracker',
|
|
@@ -112,14 +113,19 @@ function isLegacyEntry(entry, server) {
|
|
|
112
113
|
return false;
|
|
113
114
|
}
|
|
114
115
|
const joined = argv.join(' ');
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
const markers = {
|
|
117
|
+
gitlab: 'gitlab-mcp.mjs',
|
|
118
|
+
yandex: 'yandex-mcp-proxy.mjs',
|
|
119
|
+
};
|
|
120
|
+
const marker = markers[server.provider];
|
|
121
|
+
if (!marker) {
|
|
122
|
+
return false;
|
|
117
123
|
}
|
|
118
|
-
return joined.includes(
|
|
124
|
+
return joined.includes(marker);
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
const SECRET_KEY_RE = /(TOKEN|SECRET|PASSWORD|PRIVATE|AUTH)/i;
|
|
122
|
-
const SECRET_VALUE_RE = /(glpat-|PRIVATE KEY|Bearer\s+\S)/;
|
|
128
|
+
const SECRET_VALUE_RE = /(glpat-|gh[pousr]_|github_pat_|PRIVATE KEY|Bearer\s+\S)/;
|
|
123
129
|
|
|
124
130
|
/** Name of a token-looking key under our id, or null. Never returns the value. */
|
|
125
131
|
function tokenFinding(entry) {
|
|
@@ -23,6 +23,9 @@ const AI_LOCAL_GITIGNORE = [
|
|
|
23
23
|
'.rollback/',
|
|
24
24
|
'.template-base.json',
|
|
25
25
|
'*.intent',
|
|
26
|
+
'# Operator pause sentinels; local runtime state, never commit.',
|
|
27
|
+
'STOP',
|
|
28
|
+
'ESTOP',
|
|
26
29
|
'# Rebuildable SQLite projection of .ai.local/team; never commit a database.',
|
|
27
30
|
'team.db',
|
|
28
31
|
'team.db-wal',
|
|
@@ -236,11 +239,11 @@ function ensureRollbackIgnored(rollbackRoot) {
|
|
|
236
239
|
|
|
237
240
|
/**
|
|
238
241
|
* Make `.ai.local/` cover the files the self-learning engine writes beside its
|
|
239
|
-
* scripts (`*.lock`, `*.tmp`)
|
|
240
|
-
* `.gitignore` inside `.ai.local/`
|
|
241
|
-
* consumer's root `.gitignore`: the CLI never
|
|
242
|
-
* even in a repo that has no `.gitignore` at
|
|
243
|
-
* own lines; missing required lines are appended.
|
|
242
|
+
* scripts (`*.lock`, `*.tmp`), the operator pause sentinels (`STOP`, `ESTOP`),
|
|
243
|
+
* and the migration backups (`.rollback/`). A `.gitignore` inside `.ai.local/`
|
|
244
|
+
* is used instead of appending to the consumer's root `.gitignore`: the CLI never
|
|
245
|
+
* edits that file, and this works even in a repo that has no `.gitignore` at
|
|
246
|
+
* all. An existing file keeps its own lines; missing required lines are appended.
|
|
244
247
|
*/
|
|
245
248
|
function ensureAiLocalIgnored(aiLocalRoot) {
|
|
246
249
|
const ignoreFile = path.join(aiLocalRoot, '.gitignore');
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Project MCP catalog: `init mcp`
|
|
2
|
+
|
|
3
|
+
`init mcp` writes the third-party MCP servers this package ships in its own client configs. It is the no-credentials command: every entry is a pinned `npx` package or a URL. The credential-bearing pack (GitLab, GitHub, Yandex Tracker, Yandex Wiki) is the separate `mcp setup|add|remove|doctor|refresh|run` namespace — see [`MCP-SETUP.md`](MCP-SETUP.md).
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx @bonesofspring/ai-rules@latest init mcp context7
|
|
7
|
+
npx @bonesofspring/ai-rules@latest init mcp figma-desktop figma-cloud
|
|
8
|
+
npx @bonesofspring/ai-rules@latest init mcp --all
|
|
9
|
+
npx @bonesofspring/ai-rules@latest init mcp --all --tools cursor,claude
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Names
|
|
13
|
+
|
|
14
|
+
| Name | Entry | Notes |
|
|
15
|
+
|------|-------|-------|
|
|
16
|
+
| `context7` | `npx -y @upstash/context7-mcp@4.5.0` | |
|
|
17
|
+
| `playwright` | `npx -y @playwright/mcp@0.0.84` | Claude Code stores it as `playwright-test` |
|
|
18
|
+
| `chrome-devtools` | `npx -y chrome-devtools-mcp@1.12.0` | |
|
|
19
|
+
| `figma-desktop` | `http://127.0.0.1:3845/mcp` | Alias `figma`; needs the Figma desktop app and a Dev/Full seat |
|
|
20
|
+
| `figma-cloud` | `https://mcp.figma.com/mcp` | Remote Figma server; the client handles OAuth |
|
|
21
|
+
|
|
22
|
+
`--all` selects every row. `figma` and `figma-desktop` resolve to the same entry.
|
|
23
|
+
|
|
24
|
+
Pins mirror the shipped `next` presets; bump the catalog and `presets/<tool>/next/mcp.json` together — `scripts/test-cli-mcp-catalog.mjs` fails when the two drift.
|
|
25
|
+
|
|
26
|
+
## What it writes
|
|
27
|
+
|
|
28
|
+
| Client | File | Shape |
|
|
29
|
+
|--------|------|-------|
|
|
30
|
+
| Cursor | `.cursor/mcp.json` | `mcpServers` |
|
|
31
|
+
| Claude Code | `.mcp.json` (project root) | `mcpServers`; remote entries carry `type: "http"` |
|
|
32
|
+
| Mavis | `.mavis/mcp.json` | `mcpServers` |
|
|
33
|
+
| OpenCode | `opencode.json` | `mcp`; `type: "local"` with an argv array, `type: "remote"` for a URL |
|
|
34
|
+
| ZCode | `.zcode/config.json` | nested `mcp.servers` |
|
|
35
|
+
|
|
36
|
+
Only clients detected in the project are written (`mcp.json` exists, or the install marker does). `--tools <list>` narrows the set and warns when a named client is not installed.
|
|
37
|
+
|
|
38
|
+
## Merge rules
|
|
39
|
+
|
|
40
|
+
`init mcp` merges like `init`:
|
|
41
|
+
|
|
42
|
+
- a server id in the catalog is written or refreshed; its scalar fields (`command`, `args`, `url`, `type`) win;
|
|
43
|
+
- another server id in the same file is kept untouched;
|
|
44
|
+
- consumer `env` / `headers` on a catalog id survive unless the catalog entry defines the same nested key (the catalog defines none, so tokens stay);
|
|
45
|
+
- other top-level keys in the file stay;
|
|
46
|
+
- a second run is byte-identical and does not move the file mtime;
|
|
47
|
+
- a file that is not valid JSON, or whose `mcp` / `mcpServers` key is not an object, fails with exit 1 and is left untouched.
|
|
48
|
+
|
|
49
|
+
## Reconnect
|
|
50
|
+
|
|
51
|
+
After the first install, restart the server in the client:
|
|
52
|
+
|
|
53
|
+
- OpenCode: `opencode reload`
|
|
54
|
+
- Cursor: Settings → MCP → restart the server
|
|
55
|
+
- Claude Code: `/mcp`, then approve the server
|
|
56
|
+
- Mavis / ZCode: reconnect the server
|
package/docs/MCP-SETUP.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
# MCP setup: GitLab, Yandex Tracker, Yandex Wiki
|
|
1
|
+
# MCP setup: GitLab, GitHub, Yandex Tracker, Yandex Wiki
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Three sequences. Nothing here stores a token in a client config.
|
|
4
4
|
`mcp setup` writes the exact installed version pin into the client config; the runtime is pinned even though setup runs `@latest`.
|
|
5
5
|
It registers only the clients already installed in the repository.
|
|
6
|
-
GitLab credentials live in `.ai-rules/mcp/credentials.env`; Yandex keeps only non-secret settings in `.ai-rules/mcp/config.env`.
|
|
7
|
-
|
|
6
|
+
GitLab credentials live in `.ai-rules/mcp/credentials.env`; Yandex keeps only non-secret settings in `.ai-rules/mcp/config.env`; the GitHub token is read from the shell or from `.env.github` in the project root and is never written by the package.
|
|
7
|
+
All sequences are idempotent: rerun a step instead of editing a client config by hand.
|
|
8
8
|
Run the `mcp` commands below from the repository root.
|
|
9
9
|
Behind a corporate proxy, set `HTTPS_PROXY` and `NO_PROXY` for `yc` before `yc init`.
|
|
10
|
-
Prerequisites: Node 20+, an MCP client, network to your GitLab instance and to Yandex.
|
|
10
|
+
Prerequisites: Node 20+, an MCP client, network to your GitLab instance, to GitHub and to Yandex.
|
|
11
11
|
If no MCP client is installed yet, run `npx @bonesofspring/ai-rules@latest init cursor --preset next` (or your client/stack) first; `mcp setup` registers only installed clients.
|
|
12
12
|
|
|
13
|
+
Third-party servers that need no credentials — Context7, Playwright, Chrome DevTools, Figma Desktop, Figma Cloud — are installed with `init mcp`; see [`MCP-CATALOG.md`](MCP-CATALOG.md).
|
|
14
|
+
|
|
13
15
|
## 1. GitLab
|
|
14
16
|
|
|
15
17
|
1. **Create a personal access token.**
|
|
@@ -36,7 +38,33 @@ If no MCP client is installed yet, run `npx @bonesofspring/ai-rules@latest init
|
|
|
36
38
|
`npx @bonesofspring/ai-rules@latest mcp setup gitlab`
|
|
37
39
|
→ expected: the new token is validated and saved; the server reconnects with it.
|
|
38
40
|
|
|
39
|
-
## 2.
|
|
41
|
+
## 2. GitHub
|
|
42
|
+
|
|
43
|
+
1. **Create a personal access token.**
|
|
44
|
+
Add a fine-grained token with the repository permissions the agent needs, or a classic token with `repo` (add `read:org` for organization data).
|
|
45
|
+
[GitHub: personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
|
|
46
|
+
→ expected: the token is shown once; keep it for the next step.
|
|
47
|
+
|
|
48
|
+
2. **Put the token in `.env.github` in the project root.**
|
|
49
|
+
`GITHUB_TOKEN=<the token>` — `GITHUB_PERSONAL_ACCESS_TOKEN` is accepted as an alias, and an exported `GITHUB_TOKEN` in the shell wins over the file.
|
|
50
|
+
Keep the file out of git: add `.env.github` to `.gitignore` (the package never edits your `.gitignore`, and it refuses to register the server while the file is not ignored).
|
|
51
|
+
→ expected: the file exists with the token and is ignored by git.
|
|
52
|
+
|
|
53
|
+
3. **Register the server and run the doctor.**
|
|
54
|
+
`npx @bonesofspring/ai-rules@latest mcp setup github`
|
|
55
|
+
→ expected: `ok credentials` with the token validated against the GitHub API, `ok registration` per client, then `ok` doctor lines.
|
|
56
|
+
|
|
57
|
+
4. **Reconnect the client** with the client action from GitLab step 3 (`opencode reload` in OpenCode).
|
|
58
|
+
→ expected: `github` is connected and lists tools.
|
|
59
|
+
|
|
60
|
+
5. **Rotate the token.** Create a new token with the same scopes and replace the value in `.env.github`.
|
|
61
|
+
Rerun the setup; nothing is written until the new token validates.
|
|
62
|
+
`npx @bonesofspring/ai-rules@latest mcp setup github`
|
|
63
|
+
→ expected: the new token is validated; the server reconnects with it.
|
|
64
|
+
|
|
65
|
+
Optional overrides in `.env.github` (or the shell): `GITHUB_MCP_URL` for a GitHub Enterprise or a local relay, `GITHUB_API_URL` for the REST API base.
|
|
66
|
+
|
|
67
|
+
## 3. Yandex (Tracker + Wiki)
|
|
40
68
|
|
|
41
69
|
1. **Install the Yandex Cloud CLI.**
|
|
42
70
|
[Yandex Cloud CLI: installation](https://yandex.cloud/en/docs/cli/operations/install-cli)
|
|
@@ -60,3 +88,7 @@ If no MCP client is installed yet, run `npx @bonesofspring/ai-rules@latest init
|
|
|
60
88
|
`yc` reissues the IAM token on demand; `.ai-rules/mcp/` holds no token.
|
|
61
89
|
`npx @bonesofspring/ai-rules@latest mcp refresh yandex`
|
|
62
90
|
→ expected: `Yandex IAM token refreshed` and exit 0; no token is stored.
|
|
91
|
+
|
|
92
|
+
## Diagnostics
|
|
93
|
+
|
|
94
|
+
`mcp doctor` without a provider covers **every** managed-pack provider (GitLab, GitHub, Yandex Tracker, Yandex Wiki) and exits non-zero while any of them is not ready — a provider you registered but never configured fails the report with one actionable next step. Scope it with `mcp doctor <gitlab|github|yandex>` when you want one provider only.
|
|
@@ -420,6 +420,7 @@ Load these when editing files under `packages/ai-rules/presets/**`, `.cursor/**`
|
|
|
420
420
|
| `scripts/check-preset-language-policy.sh` / `yarn check:preset-structure` | **FAIL** if the native-language policy is absent: the core `_shared/core/agent-team/language-policy.md` tokens, the `language-policy` consumer + `<!-- shared-core -->` marker, the Cursor `globs:`/`alwaysApply: false` + Claude `paths:` shape, the `## Language` setting home (with a BCP-47 marker) in `ai-local/conventions.md`, the always-on anchors (`ai-local-overlay` + `<app-core>` + `REPO_AGENTS.md` must contain `native language` and `every user message`), or the `language:` persistence token in `commands/task.md`; **refuses vacuous PASS** when the iteration set is empty. Wired into `check-preset-structure.sh` next to `goal-contract` / `prompt-persistence`; fixture `test-preset-language-policy-fixtures.mjs`. |
|
|
421
421
|
| `scripts/check-preset-self-review-contract.sh` / `yarn check:preset-structure` | **FAIL** if the producer-side self-review / context-hygiene contract is absent: the core `_shared/core/quality/self-review-and-context-hygiene.md` tokens (G0 non-vacuous guard), the `<!-- shared-core: quality/self-review-and-context-hygiene.md -->` marker on `task-analyst` / `feature-developer` / `build-verifier` (×10) and on `debugger` / `code-reviewer` where present (skip-if-absent → `mcp-ts`), the `Self-review` + `re-anchor` tokens on every orchestrator rule, `Self-review` in `team/README.md` + `commands/task.md`, and leakage-free core + docs; **refuses vacuous PASS** when the iteration set is empty. Also holds two prose contracts: the canonical self-learning-loop sentence must not be followed by unsanctioned prose (an allowlist of sanctioned clauses; the tail is bounded by the carrier's **section**, not by a blank line, so prose moved one paragraph down still fails — a tail in a later `## ` section is out of scope), and every retro carrier (command, skill, rule) must state `finding_category`. Wired into `check-preset-structure.sh` next to `goal-contract`; fixture `test-preset-self-review-contract-fixtures.mjs`. |
|
|
422
422
|
| `scripts/check-anti-hallucination-coverage.mjs` | **FAIL** when the shared contract, a Cursor load-line embed, a writer stack floor, or a generated Rules-to-load stem is missing. Writer roles are `implementer`, `unit-test`, `e2e`, `qa`, and `reviewer` (`code-reviewer` loads `STACK_FLOOR_STEMS` plus the contract). `/task` and the orchestrator must not name a floor stem. Does not scan consumer `app/**` and does not call Context7. Fixture `test-anti-hallucination-coverage.mjs` deletes `anti-hallucination-contract` from `next.reviewer` in memory and expects FAIL mentioning `next` and `reviewer`. Wired into `check-preset-structure.sh` immediately after `check-claude-agent-blocks.mjs`. |
|
|
423
|
+
| `presets/_shared/ai-local/scripts/check-write-scope.mjs` | Read-only post-step audit: compares the actual changed paths with the current `pipeline.json` step's `writeScopes` and labels each path `declared`, `derived` (task folder, engine mirror, generated platform tree/golden/hook, dogfood tree, adapter map), or `out-of-scope`, with the source named. Shipped to consumers as `.ai.local/scripts/check-write-scope.mjs` (`ENGINE_SCRIPTS`). `--slug <slug> [--step <id>] [--base <ref>] [--root <project>] [--paths a,b] [--json]`. The baseline defaults to `HEAD` (uncommitted change-set, untracked included); pass `--base` for a committed change-set. Exit `1` for an out-of-scope path on an implementation step, `0` for a reviewer/verifier step (advisory), `2` on a usage/config error. Fixture `test-write-scope.mjs`; wired into the build-verifier and code-reviewer prompts, never a hook. |
|
|
423
424
|
| `scripts/check-preset-structure.sh` / `yarn check:preset-structure` | Orchestrator: twin-map + token-budget + leakage + shared-core drift + anti-hallucination coverage + rule-eval (**all hard**; drift via `AI_RULES_DRIFT_FAIL=1`). |
|
|
424
425
|
| `scripts/check-product-specs.sh` / `yarn check:product-specs` | Opt-in consumer tree check: frontmatter v1 keys + required body headings on `docs/specs/**` (bash; does **not** run JSON Schema). Ships in the npm package `files` (`scripts/`). **WARN** by default; **`--strict`** exits non-zero. |
|
|
425
426
|
| `yarn check:product-specs:dogfood` | Same script against monorepo `dogfood/mcp-ts-sample`. Soft WARN inside `check:preset-structure` + CI step (`continue-on-error`); not a hard consumer CI gate. |
|