stella-coder 3.9.2 → 4.0.0
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/.mcp.json +11 -0
- package/.opencode/skills/banner-design/SKILL.md +196 -0
- package/.opencode/skills/banner-design/references/banner-sizes-and-styles.md +118 -0
- package/.opencode/skills/brand/SKILL.md +97 -0
- package/.opencode/skills/brand/references/approval-checklist.md +169 -0
- package/.opencode/skills/brand/references/asset-organization.md +157 -0
- package/.opencode/skills/brand/references/brand-guideline-template.md +140 -0
- package/.opencode/skills/brand/references/color-palette-management.md +186 -0
- package/.opencode/skills/brand/references/consistency-checklist.md +94 -0
- package/.opencode/skills/brand/references/logo-usage-rules.md +185 -0
- package/.opencode/skills/brand/references/messaging-framework.md +85 -0
- package/.opencode/skills/brand/references/typography-specifications.md +214 -0
- package/.opencode/skills/brand/references/update.md +118 -0
- package/.opencode/skills/brand/references/visual-identity.md +96 -0
- package/.opencode/skills/brand/references/voice-framework.md +88 -0
- package/.opencode/skills/brand/scripts/extract-colors.cjs +341 -0
- package/.opencode/skills/brand/scripts/inject-brand-context.cjs +349 -0
- package/.opencode/skills/brand/scripts/sync-brand-to-tokens.cjs +248 -0
- package/.opencode/skills/brand/scripts/tests/test_sync_brand_to_tokens.py +52 -0
- package/.opencode/skills/brand/scripts/validate-asset.cjs +387 -0
- package/.opencode/skills/brand/templates/brand-guidelines-starter.md +275 -0
- package/.opencode/skills/design/SKILL.md +313 -0
- package/.opencode/skills/design/data/cip/deliverables.csv +51 -0
- package/.opencode/skills/design/data/cip/industries.csv +21 -0
- package/.opencode/skills/design/data/cip/mockup-contexts.csv +21 -0
- package/.opencode/skills/design/data/cip/styles.csv +21 -0
- package/.opencode/skills/design/data/icon/styles.csv +16 -0
- package/.opencode/skills/design/data/logo/colors.csv +56 -0
- package/.opencode/skills/design/data/logo/industries.csv +56 -0
- package/.opencode/skills/design/data/logo/styles.csv +56 -0
- package/.opencode/skills/design/references/banner-sizes-and-styles.md +118 -0
- package/.opencode/skills/design/references/cip-deliverable-guide.md +95 -0
- package/.opencode/skills/design/references/cip-design.md +121 -0
- package/.opencode/skills/design/references/cip-prompt-engineering.md +84 -0
- package/.opencode/skills/design/references/cip-style-guide.md +68 -0
- package/.opencode/skills/design/references/design-routing.md +207 -0
- package/.opencode/skills/design/references/icon-design.md +122 -0
- package/.opencode/skills/design/references/logo-color-psychology.md +101 -0
- package/.opencode/skills/design/references/logo-design.md +92 -0
- package/.opencode/skills/design/references/logo-prompt-engineering.md +158 -0
- package/.opencode/skills/design/references/logo-style-guide.md +109 -0
- package/.opencode/skills/design/references/slides-copywriting-formulas.md +84 -0
- package/.opencode/skills/design/references/slides-create.md +4 -0
- package/.opencode/skills/design/references/slides-html-template.md +295 -0
- package/.opencode/skills/design/references/slides-layout-patterns.md +137 -0
- package/.opencode/skills/design/references/slides-strategies.md +94 -0
- package/.opencode/skills/design/references/slides.md +42 -0
- package/.opencode/skills/design/references/social-photos-design.md +329 -0
- package/.opencode/skills/design/scripts/cip/core.py +215 -0
- package/.opencode/skills/design/scripts/cip/generate.py +484 -0
- package/.opencode/skills/design/scripts/cip/render-html.py +424 -0
- package/.opencode/skills/design/scripts/cip/search.py +127 -0
- package/.opencode/skills/design/scripts/icon/generate.py +487 -0
- package/.opencode/skills/design/scripts/logo/core.py +175 -0
- package/.opencode/skills/design/scripts/logo/generate.py +362 -0
- package/.opencode/skills/design/scripts/logo/search.py +114 -0
- package/.opencode/skills/design-system/SKILL.md +244 -0
- package/.opencode/skills/design-system/data/slide-backgrounds.csv +11 -0
- package/.opencode/skills/design-system/data/slide-charts.csv +26 -0
- package/.opencode/skills/design-system/data/slide-color-logic.csv +14 -0
- package/.opencode/skills/design-system/data/slide-copy.csv +26 -0
- package/.opencode/skills/design-system/data/slide-layout-logic.csv +16 -0
- package/.opencode/skills/design-system/data/slide-layouts.csv +26 -0
- package/.opencode/skills/design-system/data/slide-strategies.csv +16 -0
- package/.opencode/skills/design-system/data/slide-typography.csv +15 -0
- package/.opencode/skills/design-system/references/component-specs.md +236 -0
- package/.opencode/skills/design-system/references/component-tokens.md +214 -0
- package/.opencode/skills/design-system/references/primitive-tokens.md +203 -0
- package/.opencode/skills/design-system/references/semantic-tokens.md +215 -0
- package/.opencode/skills/design-system/references/states-and-variants.md +241 -0
- package/.opencode/skills/design-system/references/tailwind-integration.md +251 -0
- package/.opencode/skills/design-system/references/token-architecture.md +224 -0
- package/.opencode/skills/design-system/scripts/embed-tokens.cjs +99 -0
- package/.opencode/skills/design-system/scripts/fetch-background.py +317 -0
- package/.opencode/skills/design-system/scripts/generate-slide.py +770 -0
- package/.opencode/skills/design-system/scripts/generate-tokens.cjs +205 -0
- package/.opencode/skills/design-system/scripts/html-token-validator.py +327 -0
- package/.opencode/skills/design-system/scripts/search-slides.py +218 -0
- package/.opencode/skills/design-system/scripts/slide-token-validator.py +35 -0
- package/.opencode/skills/design-system/scripts/slide_search_core.py +453 -0
- package/.opencode/skills/design-system/scripts/tests/test_validate_tokens.py +48 -0
- package/.opencode/skills/design-system/scripts/validate-tokens.cjs +246 -0
- package/.opencode/skills/design-system/templates/design-tokens-starter.json +143 -0
- package/.opencode/skills/slides/SKILL.md +40 -0
- package/.opencode/skills/slides/references/copywriting-formulas.md +84 -0
- package/.opencode/skills/slides/references/create.md +4 -0
- package/.opencode/skills/slides/references/html-template.md +295 -0
- package/.opencode/skills/slides/references/layout-patterns.md +137 -0
- package/.opencode/skills/slides/references/slide-strategies.md +94 -0
- package/.opencode/skills/ui-styling/LICENSE.txt +202 -0
- package/.opencode/skills/ui-styling/SKILL.md +324 -0
- package/.opencode/skills/ui-styling/references/canvas-design-system.md +320 -0
- package/.opencode/skills/ui-styling/references/shadcn-accessibility.md +471 -0
- package/.opencode/skills/ui-styling/references/shadcn-components.md +424 -0
- package/.opencode/skills/ui-styling/references/shadcn-theming.md +373 -0
- package/.opencode/skills/ui-styling/references/tailwind-customization.md +483 -0
- package/.opencode/skills/ui-styling/references/tailwind-responsive.md +382 -0
- package/.opencode/skills/ui-styling/references/tailwind-utilities.md +455 -0
- package/.opencode/skills/ui-styling/scripts/requirements.txt +17 -0
- package/.opencode/skills/ui-styling/scripts/shadcn_add.py +308 -0
- package/.opencode/skills/ui-styling/scripts/tailwind_config_gen.py +473 -0
- package/.opencode/skills/ui-styling/scripts/tests/coverage-ui.json +1 -0
- package/.opencode/skills/ui-styling/scripts/tests/requirements.txt +3 -0
- package/.opencode/skills/ui-styling/scripts/tests/test_shadcn_add.py +266 -0
- package/.opencode/skills/ui-styling/scripts/tests/test_tailwind_config_gen.py +394 -0
- package/.opencode/skills/ui-ux-pro-max/SKILL.md +396 -0
- package/.opencode/skills/ui-ux-pro-max/data/_sync_all.py +414 -0
- package/.opencode/skills/ui-ux-pro-max/data/app-interface.csv +31 -0
- package/.opencode/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.opencode/skills/ui-ux-pro-max/data/colors.csv +193 -0
- package/.opencode/skills/ui-ux-pro-max/data/design.csv +1776 -0
- package/.opencode/skills/ui-ux-pro-max/data/draft.csv +1779 -0
- package/.opencode/skills/ui-ux-pro-max/data/google-fonts.csv +1924 -0
- package/.opencode/skills/ui-ux-pro-max/data/icons.csv +106 -0
- package/.opencode/skills/ui-ux-pro-max/data/landing.csv +35 -0
- package/.opencode/skills/ui-ux-pro-max/data/motion.csv +17 -0
- package/.opencode/skills/ui-ux-pro-max/data/products.csv +193 -0
- package/.opencode/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/angular.csv +51 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/avalonia.csv +57 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/javafx.csv +76 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/laravel.csv +51 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +71 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/threejs.csv +54 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/uno.csv +60 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/uwp.csv +56 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/winui.csv +60 -0
- package/.opencode/skills/ui-ux-pro-max/data/stacks/wpf.csv +57 -0
- package/.opencode/skills/ui-ux-pro-max/data/styles.csv +85 -0
- package/.opencode/skills/ui-ux-pro-max/data/typography.csv +75 -0
- package/.opencode/skills/ui-ux-pro-max/data/ui-reasoning.csv +162 -0
- package/.opencode/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.opencode/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
- package/.opencode/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
- package/.opencode/skills/ui-ux-pro-max/scripts/core.py +274 -0
- package/.opencode/skills/ui-ux-pro-max/scripts/design_system.py +1329 -0
- package/.opencode/skills/ui-ux-pro-max/scripts/search.py +127 -0
- package/README.md +5 -0
- package/STELLA.md +1 -1
- package/dist/antimalware/database.mjs +871 -0
- package/dist/antimalware/index.mjs +8 -0
- package/dist/antimalware/scanner.mjs +591 -0
- package/dist/antimalware/ui.mjs +570 -0
- package/dist/banner.mjs +46 -0
- package/dist/index.mjs +3073 -0
- package/dist/markdown.mjs +100 -0
- package/dist/sea-config.json +4 -0
- package/dist/security.mjs +237 -0
- package/dist/theme.mjs +89 -0
- package/dist/tools.mjs +3145 -0
- package/install-stella.bat +44 -0
- package/package.json +4 -2
- package/presentation-advanced-features-demo/README.md +27 -0
- package/presentation-advanced-features-demo/index.html +371 -0
- package/presentation-advanced-features-demo/print.html +81 -0
- package/presentation-advanced-features-demo/slide-01.html +98 -0
- package/presentation-advanced-features-demo/slide-02.html +101 -0
- package/presentation-advanced-features-demo/slide-03.html +100 -0
- package/presentation-advanced-features-demo/slide-04.html +100 -0
- package/presentation-advanced-features-demo/slide-05.html +100 -0
- package/presentation-advanced-features-demo/slide-06.html +64 -0
- package/presentation-advanced-features-demo/slide-07.html +101 -0
- package/presentation-advanced-features-demo/slide-08.html +91 -0
- package/presentation-stella-coder---ai-coding-agent/README.md +27 -0
- package/presentation-stella-coder---ai-coding-agent/index.html +168 -0
- package/presentation-stella-coder---ai-coding-agent/slide-01.html +98 -0
- package/presentation-stella-coder---ai-coding-agent/slide-02.html +101 -0
- package/presentation-stella-coder---ai-coding-agent/slide-03.html +100 -0
- package/presentation-stella-coder---ai-coding-agent/slide-04.html +100 -0
- package/presentation-stella-coder---ai-coding-agent/slide-05.html +100 -0
- package/presentation-stella-coder---ai-coding-agent/slide-06.html +100 -0
- package/presentation-stella-coder---ai-coding-agent/slide-07.html +100 -0
- package/presentation-stella-coder---ai-coding-agent/slide-08.html +64 -0
- package/presentation-stella-coder---ai-coding-agent/slide-09.html +101 -0
- package/presentation-stella-coder---ai-coding-agent/slide-10.html +91 -0
- package/presentation-stella-coder-demo/README.md +27 -0
- package/presentation-stella-coder-demo/index.html +371 -0
- package/presentation-stella-coder-demo/slide-01.html +98 -0
- package/presentation-stella-coder-demo/slide-02.html +101 -0
- package/presentation-stella-coder-demo/slide-03.html +100 -0
- package/presentation-stella-coder-demo/slide-04.html +100 -0
- package/presentation-stella-coder-demo/slide-05.html +100 -0
- package/presentation-stella-coder-demo/slide-06.html +64 -0
- package/presentation-stella-coder-demo/slide-07.html +101 -0
- package/presentation-stella-coder-demo/slide-08.html +91 -0
- package/presentation-stella-coder-features/README.md +27 -0
- package/presentation-stella-coder-features/index.html +364 -0
- package/presentation-stella-coder-features/print.html +77 -0
- package/presentation-stella-coder-features/slide-01.html +98 -0
- package/presentation-stella-coder-features/slide-02.html +101 -0
- package/presentation-stella-coder-features/slide-03.html +100 -0
- package/presentation-stella-coder-features/slide-04.html +100 -0
- package/presentation-stella-coder-features/slide-05.html +64 -0
- package/presentation-stella-coder-features/slide-06.html +101 -0
- package/presentation-stella-coder-features/slide-07.html +91 -0
- package/presentation-test-presentation/README.md +27 -0
- package/presentation-test-presentation/index.html +350 -0
- package/presentation-test-presentation/print.html +69 -0
- package/presentation-test-presentation/slide-01.html +98 -0
- package/presentation-test-presentation/slide-02.html +101 -0
- package/presentation-test-presentation/slide-03.html +64 -0
- package/presentation-test-presentation/slide-04.html +101 -0
- package/presentation-test-presentation/slide-05.html +91 -0
- package/presentation-/321/202/320/265/321/201/321/202/320/276/320/262/320/260/321/217-/320/277/321/200/320/265/320/267/320/265/320/275/321/202/320/260/321/206/320/270/321/217/README.md +27 -0
- package/presentation-/321/202/320/265/321/201/321/202/320/276/320/262/320/260/321/217-/320/277/321/200/320/265/320/267/320/265/320/275/321/202/320/260/321/206/320/270/321/217/index.html +159 -0
- package/presentation-/321/202/320/265/321/201/321/202/320/276/320/262/320/260/321/217-/320/277/321/200/320/265/320/267/320/265/320/275/321/202/320/260/321/206/320/270/321/217/slide-01.html +98 -0
- package/presentation-/321/202/320/265/321/201/321/202/320/276/320/262/320/260/321/217-/320/277/321/200/320/265/320/267/320/265/320/275/321/202/320/260/321/206/320/270/321/217/slide-02.html +101 -0
- package/presentation-/321/202/320/265/321/201/321/202/320/276/320/262/320/260/321/217-/320/277/321/200/320/265/320/267/320/265/320/275/321/202/320/260/321/206/320/270/321/217/slide-03.html +100 -0
- package/presentation-/321/202/320/265/321/201/321/202/320/276/320/262/320/260/321/217-/320/277/321/200/320/265/320/267/320/265/320/275/321/202/320/260/321/206/320/270/321/217/slide-04.html +100 -0
- package/presentation-/321/202/320/265/321/201/321/202/320/276/320/262/320/260/321/217-/320/277/321/200/320/265/320/267/320/265/320/275/321/202/320/260/321/206/320/270/321/217/slide-05.html +64 -0
- package/presentation-/321/202/320/265/321/201/321/202/320/276/320/262/320/260/321/217-/320/277/321/200/320/265/320/267/320/265/320/275/321/202/320/260/321/206/320/270/321/217/slide-06.html +101 -0
- package/presentation-/321/202/320/265/321/201/321/202/320/276/320/262/320/260/321/217-/320/277/321/200/320/265/320/267/320/265/320/275/321/202/320/260/321/206/320/270/321/217/slide-07.html +91 -0
- package/stella-cli/coding-brain.mjs +753 -0
- package/stella-cli/index.mjs +931 -15
- package/stella-cli/mcp.mjs +296 -0
- package/stella-cli/presentations.mjs +1106 -0
- package/stella-cli/subagents.mjs +142 -0
- package/stella-cli/telegram-bot.mjs +824 -0
- package/stella-cli/tg-bg.bat +13 -0
- package/stella-cli/tg-server.bat +15 -0
- package/stella-cli/tg-server.mjs +116 -0
- package/stella-cli/theme.mjs +6 -4
- package/stella-coder-3.9.2.tgz +0 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import fs from "node:fs"
|
|
2
|
+
import path from "node:path"
|
|
3
|
+
import os from "node:os"
|
|
4
|
+
import { execSync } from "node:child_process"
|
|
5
|
+
|
|
6
|
+
// Конфигурация MCP серверов
|
|
7
|
+
const MCP_CONFIG_PATH = path.join(os.homedir(), ".stella", "mcp.json")
|
|
8
|
+
|
|
9
|
+
// Дефолтные MCP серверы
|
|
10
|
+
const DEFAULT_SERVERS = {
|
|
11
|
+
"filesystem": {
|
|
12
|
+
command: "npx",
|
|
13
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", process.cwd()],
|
|
14
|
+
description: "Доступ к файловой системе",
|
|
15
|
+
icon: "📁",
|
|
16
|
+
},
|
|
17
|
+
"github": {
|
|
18
|
+
command: "npx",
|
|
19
|
+
args: ["-y", "@modelcontextprotocol/server-github"],
|
|
20
|
+
env: { GITHUB_TOKEN: process.env.GITHUB_TOKEN || "" },
|
|
21
|
+
description: "Интеграция с GitHub",
|
|
22
|
+
icon: "🐙",
|
|
23
|
+
},
|
|
24
|
+
"memory": {
|
|
25
|
+
command: "npx",
|
|
26
|
+
args: ["-y", "@modelcontextprotocol/server-memory"],
|
|
27
|
+
description: "Долгосрочная память",
|
|
28
|
+
icon: "🧠",
|
|
29
|
+
},
|
|
30
|
+
"brave-search": {
|
|
31
|
+
command: "npx",
|
|
32
|
+
args: ["-y", "@modelcontextprotocol/server-brave-search"],
|
|
33
|
+
env: { BRAVE_API_KEY: process.env.BRAVE_API_KEY || "" },
|
|
34
|
+
description: "Поиск в интернете (Brave)",
|
|
35
|
+
icon: "🔍",
|
|
36
|
+
},
|
|
37
|
+
"postgres": {
|
|
38
|
+
command: "npx",
|
|
39
|
+
args: ["-y", "@modelcontextprotocol/server-postgres", process.env.DATABASE_URL || ""],
|
|
40
|
+
description: "PostgreSQL база данных",
|
|
41
|
+
icon: "🐘",
|
|
42
|
+
},
|
|
43
|
+
"sqlite": {
|
|
44
|
+
command: "npx",
|
|
45
|
+
args: ["-y", "@modelcontextprotocol/server-sqlite", "--db-path", "database.db"],
|
|
46
|
+
description: "SQLite база данных",
|
|
47
|
+
icon: "💾",
|
|
48
|
+
},
|
|
49
|
+
"puppeteer": {
|
|
50
|
+
command: "npx",
|
|
51
|
+
args: ["-y", "@modelcontextprotocol/server-puppeteer"],
|
|
52
|
+
description: "Браузер automation (Puppeteer)",
|
|
53
|
+
icon: "🌐",
|
|
54
|
+
},
|
|
55
|
+
"fetch": {
|
|
56
|
+
command: "npx",
|
|
57
|
+
args: ["-y", "@modelcontextprotocol/server-fetch"],
|
|
58
|
+
description: "HTTP запросы",
|
|
59
|
+
icon: "📤",
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
class MCPManager {
|
|
64
|
+
constructor() {
|
|
65
|
+
this.servers = new Map()
|
|
66
|
+
this.tools = new Map()
|
|
67
|
+
this.config = this.loadConfig()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
loadConfig() {
|
|
71
|
+
try {
|
|
72
|
+
if (fs.existsSync(MCP_CONFIG_PATH)) {
|
|
73
|
+
return JSON.parse(fs.readFileSync(MCP_CONFIG_PATH, "utf8"))
|
|
74
|
+
}
|
|
75
|
+
} catch {}
|
|
76
|
+
return { servers: {} }
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
saveConfig() {
|
|
80
|
+
const dir = path.dirname(MCP_CONFIG_PATH)
|
|
81
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
|
|
82
|
+
fs.writeFileSync(MCP_CONFIG_PATH, JSON.stringify(this.config, null, 2), "utf8")
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Регистрация сервера
|
|
86
|
+
async addServer(name, serverConfig) {
|
|
87
|
+
this.config.servers[name] = {
|
|
88
|
+
command: serverConfig.command,
|
|
89
|
+
args: serverConfig.args || [],
|
|
90
|
+
env: serverConfig.env || {},
|
|
91
|
+
description: serverConfig.description || "",
|
|
92
|
+
icon: serverConfig.icon || "🔌",
|
|
93
|
+
}
|
|
94
|
+
this.saveConfig()
|
|
95
|
+
return { success: true, message: `Сервер "${name}" добавлен` }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Удаление сервера
|
|
99
|
+
async removeServer(name) {
|
|
100
|
+
if (this.config.servers[name]) {
|
|
101
|
+
delete this.config.servers[name]
|
|
102
|
+
this.saveConfig()
|
|
103
|
+
this.servers.delete(name)
|
|
104
|
+
return { success: true, message: `Сервер "${name}" удалён` }
|
|
105
|
+
}
|
|
106
|
+
return { error: `Сервер "${name}" не найден` }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Запуск сервера (симуляция для CLI)
|
|
110
|
+
async startServer(name) {
|
|
111
|
+
const server = this.config.servers[name] || DEFAULT_SERVERS[name]
|
|
112
|
+
if (!server) {
|
|
113
|
+
return { error: `Сервер "${name}" не найден` }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
console.log(`\n 🔌 Запуск MCP сервера: ${name}`)
|
|
117
|
+
console.log(` ${server.description}`)
|
|
118
|
+
|
|
119
|
+
// Проверяем доступность
|
|
120
|
+
try {
|
|
121
|
+
const cmd = `${server.command} ${server.args.join(" ")} --help`
|
|
122
|
+
execSync(cmd, { stdio: "pipe", timeout: 5000 })
|
|
123
|
+
this.servers.set(name, { status: "running", config: server })
|
|
124
|
+
console.log(` ✓ Сервер "${name}" запущен\n`)
|
|
125
|
+
return { success: true, status: "running" }
|
|
126
|
+
} catch (err) {
|
|
127
|
+
console.log(` ⚠ Сервер "${name}" требует установку зависимостей`)
|
|
128
|
+
console.log(` Выполните: ${server.command} ${server.args.join(" ")}\n`)
|
|
129
|
+
this.servers.set(name, { status: "installed", config: server })
|
|
130
|
+
return { success: true, status: "installed" }
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Остановка сервера
|
|
135
|
+
async stopServer(name) {
|
|
136
|
+
this.servers.delete(name)
|
|
137
|
+
return { success: true, message: `Сервер "${name}" остановлен` }
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Получение инструментов сервера
|
|
141
|
+
getServerTools(name) {
|
|
142
|
+
const serverTools = {
|
|
143
|
+
"filesystem": [
|
|
144
|
+
{ name: "fs_read_file", description: "Чтение файла через MCP" },
|
|
145
|
+
{ name: "fs_write_file", description: "Запись файла через MCP" },
|
|
146
|
+
{ name: "fs_list_directory", description: "Список файлов" },
|
|
147
|
+
{ name: "fs_search_files", description: "Поиск файлов" },
|
|
148
|
+
],
|
|
149
|
+
"github": [
|
|
150
|
+
{ name: "gh_create_repo", description: "Создать репозиторий" },
|
|
151
|
+
{ name: "gh_create_issue", description: "Создать issue" },
|
|
152
|
+
{ name: "gh_create_pr", description: "Создать pull request" },
|
|
153
|
+
{ name: "gh_list_issues", description: "Список issues" },
|
|
154
|
+
{ name: "gh_search_code", description: "Поиск кода" },
|
|
155
|
+
],
|
|
156
|
+
"memory": [
|
|
157
|
+
{ name: "mem_store", description: "Сохранить в память" },
|
|
158
|
+
{ name: "mem_retrieve", description: "Из памяти" },
|
|
159
|
+
{ name: "mem_search", description: "Поиск в памяти" },
|
|
160
|
+
],
|
|
161
|
+
"brave-search": [
|
|
162
|
+
{ name: "brave_web_search", description: "Поиск в интернете" },
|
|
163
|
+
{ name: "brave_local_search", description: "Локальный поиск" },
|
|
164
|
+
],
|
|
165
|
+
"puppeteer": [
|
|
166
|
+
{ name: "pup_navigate", description: "Открыть страницу" },
|
|
167
|
+
{ name: "pup_screenshot", description: "Скриншот страницы" },
|
|
168
|
+
{ name: "pup_click", description: "Клик по элементу" },
|
|
169
|
+
{ name: "pup_type", description: "Ввод текста" },
|
|
170
|
+
{ name: "pup_evaluate", description: "Выполнить JS в браузере" },
|
|
171
|
+
],
|
|
172
|
+
"fetch": [
|
|
173
|
+
{ name: "fetch_get", description: "GET запрос" },
|
|
174
|
+
{ name: "fetch_post", description: "POST запрос" },
|
|
175
|
+
],
|
|
176
|
+
}
|
|
177
|
+
return serverTools[name] || []
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Список серверов
|
|
181
|
+
listServers() {
|
|
182
|
+
const all = { ...DEFAULT_SERVERS, ...this.config.servers }
|
|
183
|
+
return Object.entries(all).map(([name, config]) => ({
|
|
184
|
+
name,
|
|
185
|
+
...config,
|
|
186
|
+
status: this.servers.get(name)?.status || "stopped",
|
|
187
|
+
}))
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Список всех доступных инструментов
|
|
191
|
+
getAllTools() {
|
|
192
|
+
const tools = []
|
|
193
|
+
for (const [serverName] of this.servers) {
|
|
194
|
+
const serverTools = this.getServerTools(serverName)
|
|
195
|
+
tools.push(...serverTools.map(t => ({ ...t, server: serverName })))
|
|
196
|
+
}
|
|
197
|
+
return tools
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Экспорт singleton
|
|
202
|
+
export const mcp = new MCPManager()
|
|
203
|
+
|
|
204
|
+
// Команды MCP для CLI
|
|
205
|
+
export const MCP_COMMANDS = {
|
|
206
|
+
"/mcp": {
|
|
207
|
+
description: "Управление MCP серверами",
|
|
208
|
+
handler: async (args) => {
|
|
209
|
+
const [subcommand, ...rest] = args.split(" ")
|
|
210
|
+
|
|
211
|
+
switch (subcommand) {
|
|
212
|
+
case "list":
|
|
213
|
+
case "ls": {
|
|
214
|
+
const servers = mcp.listServers()
|
|
215
|
+
console.log("\n MCP Серверы:\n")
|
|
216
|
+
for (const s of servers) {
|
|
217
|
+
const status = s.status === "running" ? "🟢" : s.status === "installed" ? "🟡" : "🔴"
|
|
218
|
+
console.log(` ${status} ${s.icon || "🔌"} ${s.name}`)
|
|
219
|
+
console.log(` ${s.description}`)
|
|
220
|
+
console.log(` ${s.command} ${s.args.join(" ")}\n`)
|
|
221
|
+
}
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
case "start": {
|
|
226
|
+
const name = rest[0]
|
|
227
|
+
if (!name) { console.log(" Использование: /mcp start <имя>"); return }
|
|
228
|
+
await mcp.startServer(name)
|
|
229
|
+
return
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
case "stop": {
|
|
233
|
+
const name = rest[0]
|
|
234
|
+
if (!name) { console.log(" Использование: /mcp stop <имя>"); return }
|
|
235
|
+
await mcp.stopServer(name)
|
|
236
|
+
console.log(` ✓ Сервер "${name}" остановлен`)
|
|
237
|
+
return
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
case "add": {
|
|
241
|
+
const [name, command, ...args] = rest
|
|
242
|
+
if (!name || !command) {
|
|
243
|
+
console.log(" Использование: /mcp add <имя> <команда> [аргументы...]")
|
|
244
|
+
return
|
|
245
|
+
}
|
|
246
|
+
await mcp.addServer(name, { command, args, description: `Custom server: ${name}` })
|
|
247
|
+
console.log(` ✓ Сервер "${name}" добавлен`)
|
|
248
|
+
return
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
case "remove":
|
|
252
|
+
case "rm": {
|
|
253
|
+
const name = rest[0]
|
|
254
|
+
if (!name) { console.log(" Использование: /mcp remove <имя>"); return }
|
|
255
|
+
await mcp.removeServer(name)
|
|
256
|
+
console.log(` ✓ Сервер "${name}" удалён`)
|
|
257
|
+
return
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
case "tools": {
|
|
261
|
+
const tools = mcp.getAllTools()
|
|
262
|
+
if (tools.length === 0) {
|
|
263
|
+
console.log("\n Нет подключённых серверов. Запустите: /mcp start <имя>\n")
|
|
264
|
+
return
|
|
265
|
+
}
|
|
266
|
+
console.log("\n Доступные MCP инструменты:\n")
|
|
267
|
+
for (const t of tools) {
|
|
268
|
+
console.log(` 🔧 ${t.name} (${t.server})`)
|
|
269
|
+
console.log(` ${t.description}\n`)
|
|
270
|
+
}
|
|
271
|
+
return
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
default:
|
|
275
|
+
console.log(`
|
|
276
|
+
MCP (Model Context Protocol) — подключение к внешним серверам
|
|
277
|
+
|
|
278
|
+
Команды:
|
|
279
|
+
/mcp list — список серверов
|
|
280
|
+
/mcp start <имя> — запустить сервер
|
|
281
|
+
/mcp stop <имя> — остановить сервер
|
|
282
|
+
/mcp add <имя> <команда> [args] — добавить сервер
|
|
283
|
+
/mcp remove <имя> — удалить сервер
|
|
284
|
+
/mcp tools — список инструментов
|
|
285
|
+
|
|
286
|
+
Популярные серверы:
|
|
287
|
+
filesystem — файловая система
|
|
288
|
+
github — GitHub API
|
|
289
|
+
memory — долгосрочная память
|
|
290
|
+
puppeteer — браузер automation
|
|
291
|
+
fetch — HTTP запросы
|
|
292
|
+
`)
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
}
|