stella-coder 3.9.1 → 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.
Files changed (235) hide show
  1. package/.mcp.json +11 -0
  2. package/.opencode/skills/banner-design/SKILL.md +196 -0
  3. package/.opencode/skills/banner-design/references/banner-sizes-and-styles.md +118 -0
  4. package/.opencode/skills/brand/SKILL.md +97 -0
  5. package/.opencode/skills/brand/references/approval-checklist.md +169 -0
  6. package/.opencode/skills/brand/references/asset-organization.md +157 -0
  7. package/.opencode/skills/brand/references/brand-guideline-template.md +140 -0
  8. package/.opencode/skills/brand/references/color-palette-management.md +186 -0
  9. package/.opencode/skills/brand/references/consistency-checklist.md +94 -0
  10. package/.opencode/skills/brand/references/logo-usage-rules.md +185 -0
  11. package/.opencode/skills/brand/references/messaging-framework.md +85 -0
  12. package/.opencode/skills/brand/references/typography-specifications.md +214 -0
  13. package/.opencode/skills/brand/references/update.md +118 -0
  14. package/.opencode/skills/brand/references/visual-identity.md +96 -0
  15. package/.opencode/skills/brand/references/voice-framework.md +88 -0
  16. package/.opencode/skills/brand/scripts/extract-colors.cjs +341 -0
  17. package/.opencode/skills/brand/scripts/inject-brand-context.cjs +349 -0
  18. package/.opencode/skills/brand/scripts/sync-brand-to-tokens.cjs +248 -0
  19. package/.opencode/skills/brand/scripts/tests/test_sync_brand_to_tokens.py +52 -0
  20. package/.opencode/skills/brand/scripts/validate-asset.cjs +387 -0
  21. package/.opencode/skills/brand/templates/brand-guidelines-starter.md +275 -0
  22. package/.opencode/skills/design/SKILL.md +313 -0
  23. package/.opencode/skills/design/data/cip/deliverables.csv +51 -0
  24. package/.opencode/skills/design/data/cip/industries.csv +21 -0
  25. package/.opencode/skills/design/data/cip/mockup-contexts.csv +21 -0
  26. package/.opencode/skills/design/data/cip/styles.csv +21 -0
  27. package/.opencode/skills/design/data/icon/styles.csv +16 -0
  28. package/.opencode/skills/design/data/logo/colors.csv +56 -0
  29. package/.opencode/skills/design/data/logo/industries.csv +56 -0
  30. package/.opencode/skills/design/data/logo/styles.csv +56 -0
  31. package/.opencode/skills/design/references/banner-sizes-and-styles.md +118 -0
  32. package/.opencode/skills/design/references/cip-deliverable-guide.md +95 -0
  33. package/.opencode/skills/design/references/cip-design.md +121 -0
  34. package/.opencode/skills/design/references/cip-prompt-engineering.md +84 -0
  35. package/.opencode/skills/design/references/cip-style-guide.md +68 -0
  36. package/.opencode/skills/design/references/design-routing.md +207 -0
  37. package/.opencode/skills/design/references/icon-design.md +122 -0
  38. package/.opencode/skills/design/references/logo-color-psychology.md +101 -0
  39. package/.opencode/skills/design/references/logo-design.md +92 -0
  40. package/.opencode/skills/design/references/logo-prompt-engineering.md +158 -0
  41. package/.opencode/skills/design/references/logo-style-guide.md +109 -0
  42. package/.opencode/skills/design/references/slides-copywriting-formulas.md +84 -0
  43. package/.opencode/skills/design/references/slides-create.md +4 -0
  44. package/.opencode/skills/design/references/slides-html-template.md +295 -0
  45. package/.opencode/skills/design/references/slides-layout-patterns.md +137 -0
  46. package/.opencode/skills/design/references/slides-strategies.md +94 -0
  47. package/.opencode/skills/design/references/slides.md +42 -0
  48. package/.opencode/skills/design/references/social-photos-design.md +329 -0
  49. package/.opencode/skills/design/scripts/cip/core.py +215 -0
  50. package/.opencode/skills/design/scripts/cip/generate.py +484 -0
  51. package/.opencode/skills/design/scripts/cip/render-html.py +424 -0
  52. package/.opencode/skills/design/scripts/cip/search.py +127 -0
  53. package/.opencode/skills/design/scripts/icon/generate.py +487 -0
  54. package/.opencode/skills/design/scripts/logo/core.py +175 -0
  55. package/.opencode/skills/design/scripts/logo/generate.py +362 -0
  56. package/.opencode/skills/design/scripts/logo/search.py +114 -0
  57. package/.opencode/skills/design-system/SKILL.md +244 -0
  58. package/.opencode/skills/design-system/data/slide-backgrounds.csv +11 -0
  59. package/.opencode/skills/design-system/data/slide-charts.csv +26 -0
  60. package/.opencode/skills/design-system/data/slide-color-logic.csv +14 -0
  61. package/.opencode/skills/design-system/data/slide-copy.csv +26 -0
  62. package/.opencode/skills/design-system/data/slide-layout-logic.csv +16 -0
  63. package/.opencode/skills/design-system/data/slide-layouts.csv +26 -0
  64. package/.opencode/skills/design-system/data/slide-strategies.csv +16 -0
  65. package/.opencode/skills/design-system/data/slide-typography.csv +15 -0
  66. package/.opencode/skills/design-system/references/component-specs.md +236 -0
  67. package/.opencode/skills/design-system/references/component-tokens.md +214 -0
  68. package/.opencode/skills/design-system/references/primitive-tokens.md +203 -0
  69. package/.opencode/skills/design-system/references/semantic-tokens.md +215 -0
  70. package/.opencode/skills/design-system/references/states-and-variants.md +241 -0
  71. package/.opencode/skills/design-system/references/tailwind-integration.md +251 -0
  72. package/.opencode/skills/design-system/references/token-architecture.md +224 -0
  73. package/.opencode/skills/design-system/scripts/embed-tokens.cjs +99 -0
  74. package/.opencode/skills/design-system/scripts/fetch-background.py +317 -0
  75. package/.opencode/skills/design-system/scripts/generate-slide.py +770 -0
  76. package/.opencode/skills/design-system/scripts/generate-tokens.cjs +205 -0
  77. package/.opencode/skills/design-system/scripts/html-token-validator.py +327 -0
  78. package/.opencode/skills/design-system/scripts/search-slides.py +218 -0
  79. package/.opencode/skills/design-system/scripts/slide-token-validator.py +35 -0
  80. package/.opencode/skills/design-system/scripts/slide_search_core.py +453 -0
  81. package/.opencode/skills/design-system/scripts/tests/test_validate_tokens.py +48 -0
  82. package/.opencode/skills/design-system/scripts/validate-tokens.cjs +246 -0
  83. package/.opencode/skills/design-system/templates/design-tokens-starter.json +143 -0
  84. package/.opencode/skills/slides/SKILL.md +40 -0
  85. package/.opencode/skills/slides/references/copywriting-formulas.md +84 -0
  86. package/.opencode/skills/slides/references/create.md +4 -0
  87. package/.opencode/skills/slides/references/html-template.md +295 -0
  88. package/.opencode/skills/slides/references/layout-patterns.md +137 -0
  89. package/.opencode/skills/slides/references/slide-strategies.md +94 -0
  90. package/.opencode/skills/ui-styling/LICENSE.txt +202 -0
  91. package/.opencode/skills/ui-styling/SKILL.md +324 -0
  92. package/.opencode/skills/ui-styling/references/canvas-design-system.md +320 -0
  93. package/.opencode/skills/ui-styling/references/shadcn-accessibility.md +471 -0
  94. package/.opencode/skills/ui-styling/references/shadcn-components.md +424 -0
  95. package/.opencode/skills/ui-styling/references/shadcn-theming.md +373 -0
  96. package/.opencode/skills/ui-styling/references/tailwind-customization.md +483 -0
  97. package/.opencode/skills/ui-styling/references/tailwind-responsive.md +382 -0
  98. package/.opencode/skills/ui-styling/references/tailwind-utilities.md +455 -0
  99. package/.opencode/skills/ui-styling/scripts/requirements.txt +17 -0
  100. package/.opencode/skills/ui-styling/scripts/shadcn_add.py +308 -0
  101. package/.opencode/skills/ui-styling/scripts/tailwind_config_gen.py +473 -0
  102. package/.opencode/skills/ui-styling/scripts/tests/coverage-ui.json +1 -0
  103. package/.opencode/skills/ui-styling/scripts/tests/requirements.txt +3 -0
  104. package/.opencode/skills/ui-styling/scripts/tests/test_shadcn_add.py +266 -0
  105. package/.opencode/skills/ui-styling/scripts/tests/test_tailwind_config_gen.py +394 -0
  106. package/.opencode/skills/ui-ux-pro-max/SKILL.md +396 -0
  107. package/.opencode/skills/ui-ux-pro-max/data/_sync_all.py +414 -0
  108. package/.opencode/skills/ui-ux-pro-max/data/app-interface.csv +31 -0
  109. package/.opencode/skills/ui-ux-pro-max/data/charts.csv +26 -0
  110. package/.opencode/skills/ui-ux-pro-max/data/colors.csv +193 -0
  111. package/.opencode/skills/ui-ux-pro-max/data/design.csv +1776 -0
  112. package/.opencode/skills/ui-ux-pro-max/data/draft.csv +1779 -0
  113. package/.opencode/skills/ui-ux-pro-max/data/google-fonts.csv +1924 -0
  114. package/.opencode/skills/ui-ux-pro-max/data/icons.csv +106 -0
  115. package/.opencode/skills/ui-ux-pro-max/data/landing.csv +35 -0
  116. package/.opencode/skills/ui-ux-pro-max/data/motion.csv +17 -0
  117. package/.opencode/skills/ui-ux-pro-max/data/products.csv +193 -0
  118. package/.opencode/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  119. package/.opencode/skills/ui-ux-pro-max/data/stacks/angular.csv +51 -0
  120. package/.opencode/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  121. package/.opencode/skills/ui-ux-pro-max/data/stacks/avalonia.csv +57 -0
  122. package/.opencode/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  123. package/.opencode/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  124. package/.opencode/skills/ui-ux-pro-max/data/stacks/javafx.csv +76 -0
  125. package/.opencode/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  126. package/.opencode/skills/ui-ux-pro-max/data/stacks/laravel.csv +51 -0
  127. package/.opencode/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  128. package/.opencode/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +71 -0
  129. package/.opencode/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  130. package/.opencode/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  131. package/.opencode/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  132. package/.opencode/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  133. package/.opencode/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  134. package/.opencode/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  135. package/.opencode/skills/ui-ux-pro-max/data/stacks/threejs.csv +54 -0
  136. package/.opencode/skills/ui-ux-pro-max/data/stacks/uno.csv +60 -0
  137. package/.opencode/skills/ui-ux-pro-max/data/stacks/uwp.csv +56 -0
  138. package/.opencode/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  139. package/.opencode/skills/ui-ux-pro-max/data/stacks/winui.csv +60 -0
  140. package/.opencode/skills/ui-ux-pro-max/data/stacks/wpf.csv +57 -0
  141. package/.opencode/skills/ui-ux-pro-max/data/styles.csv +85 -0
  142. package/.opencode/skills/ui-ux-pro-max/data/typography.csv +75 -0
  143. package/.opencode/skills/ui-ux-pro-max/data/ui-reasoning.csv +162 -0
  144. package/.opencode/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  145. package/.opencode/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
  146. package/.opencode/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
  147. package/.opencode/skills/ui-ux-pro-max/scripts/core.py +274 -0
  148. package/.opencode/skills/ui-ux-pro-max/scripts/design_system.py +1329 -0
  149. package/.opencode/skills/ui-ux-pro-max/scripts/search.py +127 -0
  150. package/README.md +5 -0
  151. package/STELLA.md +1 -1
  152. package/dist/antimalware/database.mjs +871 -0
  153. package/dist/antimalware/index.mjs +8 -0
  154. package/dist/antimalware/scanner.mjs +591 -0
  155. package/dist/antimalware/ui.mjs +570 -0
  156. package/dist/banner.mjs +46 -0
  157. package/dist/index.mjs +3073 -0
  158. package/dist/markdown.mjs +100 -0
  159. package/dist/sea-config.json +4 -0
  160. package/dist/security.mjs +237 -0
  161. package/dist/theme.mjs +89 -0
  162. package/dist/tools.mjs +3145 -0
  163. package/install-stella.bat +44 -0
  164. package/package.json +12 -3
  165. package/presentation-advanced-features-demo/README.md +27 -0
  166. package/presentation-advanced-features-demo/index.html +371 -0
  167. package/presentation-advanced-features-demo/print.html +81 -0
  168. package/presentation-advanced-features-demo/slide-01.html +98 -0
  169. package/presentation-advanced-features-demo/slide-02.html +101 -0
  170. package/presentation-advanced-features-demo/slide-03.html +100 -0
  171. package/presentation-advanced-features-demo/slide-04.html +100 -0
  172. package/presentation-advanced-features-demo/slide-05.html +100 -0
  173. package/presentation-advanced-features-demo/slide-06.html +64 -0
  174. package/presentation-advanced-features-demo/slide-07.html +101 -0
  175. package/presentation-advanced-features-demo/slide-08.html +91 -0
  176. package/presentation-stella-coder---ai-coding-agent/README.md +27 -0
  177. package/presentation-stella-coder---ai-coding-agent/index.html +168 -0
  178. package/presentation-stella-coder---ai-coding-agent/slide-01.html +98 -0
  179. package/presentation-stella-coder---ai-coding-agent/slide-02.html +101 -0
  180. package/presentation-stella-coder---ai-coding-agent/slide-03.html +100 -0
  181. package/presentation-stella-coder---ai-coding-agent/slide-04.html +100 -0
  182. package/presentation-stella-coder---ai-coding-agent/slide-05.html +100 -0
  183. package/presentation-stella-coder---ai-coding-agent/slide-06.html +100 -0
  184. package/presentation-stella-coder---ai-coding-agent/slide-07.html +100 -0
  185. package/presentation-stella-coder---ai-coding-agent/slide-08.html +64 -0
  186. package/presentation-stella-coder---ai-coding-agent/slide-09.html +101 -0
  187. package/presentation-stella-coder---ai-coding-agent/slide-10.html +91 -0
  188. package/presentation-stella-coder-demo/README.md +27 -0
  189. package/presentation-stella-coder-demo/index.html +371 -0
  190. package/presentation-stella-coder-demo/slide-01.html +98 -0
  191. package/presentation-stella-coder-demo/slide-02.html +101 -0
  192. package/presentation-stella-coder-demo/slide-03.html +100 -0
  193. package/presentation-stella-coder-demo/slide-04.html +100 -0
  194. package/presentation-stella-coder-demo/slide-05.html +100 -0
  195. package/presentation-stella-coder-demo/slide-06.html +64 -0
  196. package/presentation-stella-coder-demo/slide-07.html +101 -0
  197. package/presentation-stella-coder-demo/slide-08.html +91 -0
  198. package/presentation-stella-coder-features/README.md +27 -0
  199. package/presentation-stella-coder-features/index.html +364 -0
  200. package/presentation-stella-coder-features/print.html +77 -0
  201. package/presentation-stella-coder-features/slide-01.html +98 -0
  202. package/presentation-stella-coder-features/slide-02.html +101 -0
  203. package/presentation-stella-coder-features/slide-03.html +100 -0
  204. package/presentation-stella-coder-features/slide-04.html +100 -0
  205. package/presentation-stella-coder-features/slide-05.html +64 -0
  206. package/presentation-stella-coder-features/slide-06.html +101 -0
  207. package/presentation-stella-coder-features/slide-07.html +91 -0
  208. package/presentation-test-presentation/README.md +27 -0
  209. package/presentation-test-presentation/index.html +350 -0
  210. package/presentation-test-presentation/print.html +69 -0
  211. package/presentation-test-presentation/slide-01.html +98 -0
  212. package/presentation-test-presentation/slide-02.html +101 -0
  213. package/presentation-test-presentation/slide-03.html +64 -0
  214. package/presentation-test-presentation/slide-04.html +101 -0
  215. package/presentation-test-presentation/slide-05.html +91 -0
  216. 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
  217. 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
  218. 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
  219. 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
  220. 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
  221. 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
  222. 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
  223. 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
  224. 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
  225. package/stella-cli/coding-brain.mjs +753 -0
  226. package/stella-cli/index.mjs +931 -15
  227. package/stella-cli/mcp.mjs +296 -0
  228. package/stella-cli/presentations.mjs +1106 -0
  229. package/stella-cli/subagents.mjs +142 -0
  230. package/stella-cli/telegram-bot.mjs +824 -0
  231. package/stella-cli/tg-bg.bat +13 -0
  232. package/stella-cli/tg-server.bat +15 -0
  233. package/stella-cli/tg-server.mjs +116 -0
  234. package/stella-cli/theme.mjs +6 -4
  235. 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
+ }