@devflow-tools/cli 0.3.1 → 0.4.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 (45) hide show
  1. package/README.md +50 -0
  2. package/dist/commands/doctor.d.ts +25 -0
  3. package/dist/commands/doctor.d.ts.map +1 -1
  4. package/dist/commands/doctor.js +77 -1
  5. package/dist/commands/doctor.js.map +1 -1
  6. package/dist/commands/init.d.ts +6 -2
  7. package/dist/commands/init.d.ts.map +1 -1
  8. package/dist/commands/init.js +53 -2
  9. package/dist/commands/init.js.map +1 -1
  10. package/dist/commands/session.d.ts +7 -0
  11. package/dist/commands/session.d.ts.map +1 -0
  12. package/dist/commands/session.js +20 -0
  13. package/dist/commands/session.js.map +1 -0
  14. package/dist/index.js +67 -3
  15. package/dist/index.js.map +1 -1
  16. package/dist/lib/plugin-setup.d.ts +23 -0
  17. package/dist/lib/plugin-setup.d.ts.map +1 -0
  18. package/dist/lib/plugin-setup.js +141 -0
  19. package/dist/lib/plugin-setup.js.map +1 -0
  20. package/dist/plugin-files/.claude-plugin/plugin.json +20 -0
  21. package/dist/plugin-files/CLAUDE.md +34 -0
  22. package/dist/plugin-files/dist/command-registry.json +235 -0
  23. package/dist/plugin-files/dist/skills/devflow:context/SKILL.md +29 -0
  24. package/dist/plugin-files/dist/skills/devflow:docker/SKILL.md +49 -0
  25. package/dist/plugin-files/dist/skills/devflow:electron/SKILL.md +49 -0
  26. package/dist/plugin-files/dist/skills/devflow:graph/SKILL.md +24 -0
  27. package/dist/plugin-files/dist/skills/devflow:graphql/SKILL.md +48 -0
  28. package/dist/plugin-files/dist/skills/devflow:knowledge/SKILL.md +24 -0
  29. package/dist/plugin-files/dist/skills/devflow:memory/SKILL.md +23 -0
  30. package/dist/plugin-files/dist/skills/devflow:nest/SKILL.md +48 -0
  31. package/dist/plugin-files/dist/skills/devflow:nextjs/SKILL.md +45 -0
  32. package/dist/plugin-files/dist/skills/devflow:performance/SKILL.md +49 -0
  33. package/dist/plugin-files/dist/skills/devflow:react/SKILL.md +57 -0
  34. package/dist/plugin-files/dist/skills/devflow:tailwind/SKILL.md +45 -0
  35. package/dist/plugin-files/dist/skills/devflow:taro/SKILL.md +48 -0
  36. package/dist/plugin-files/dist/skills/devflow:vue/SKILL.md +52 -0
  37. package/dist/plugin-files/dist/skills/devflow:workflow/SKILL.md +24 -0
  38. package/dist/plugin-files/hooks/constitution.md +20 -0
  39. package/dist/plugin-files/hooks/post-tool-use +106 -0
  40. package/dist/plugin-files/hooks/pre-tool-use +147 -0
  41. package/dist/plugin-files/hooks/session-start +96 -0
  42. package/dist/plugin-files/hooks/stop +31 -0
  43. package/dist/plugin-files/hooks.json +40 -0
  44. package/dist/plugin-files/package.json +29 -0
  45. package/package.json +25 -23
@@ -0,0 +1,141 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, cpSync, readdirSync, statSync, rmSync, } from "node:fs";
2
+ import { join, dirname } from "node:path";
3
+ const PLUGIN_KEY = "@devflow-tools/claude-code-plugin@devflow-local";
4
+ const MARKETPLACE = "devflow-local";
5
+ const PLUGIN_NAME = "@devflow-tools/claude-code-plugin";
6
+ /**
7
+ * Locate plugin files directory.
8
+ * Priority: bundled dist/plugin-files (npm) -> monorepo plugins/claude-code (dev)
9
+ */
10
+ export function getPluginFilesDir() {
11
+ // npm user: files are at dist/plugin-files relative to compiled JS
12
+ const bundled = join(dirname(new URL(import.meta.url).pathname), "../../plugin-files");
13
+ if (existsSync(bundled))
14
+ return bundled;
15
+ // monorepo dev: files are at plugins/claude-code relative to repo root
16
+ const monorepo = join(dirname(new URL(import.meta.url).pathname), "../../../../plugins/claude-code");
17
+ if (existsSync(monorepo))
18
+ return monorepo;
19
+ throw new Error("Plugin files not found. Run `npm run build` first.");
20
+ }
21
+ /**
22
+ * Ensure the devflow plugin is enabled in ~/.claude/settings.json.
23
+ * Idempotent: skips if already present.
24
+ */
25
+ export function ensurePluginEnabled(settingsPath) {
26
+ let settings = {};
27
+ if (existsSync(settingsPath)) {
28
+ try {
29
+ settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
30
+ }
31
+ catch {
32
+ console.warn("Warning: Could not parse settings.json, skipping plugin enablement");
33
+ return;
34
+ }
35
+ }
36
+ else {
37
+ mkdirSync(dirname(settingsPath), { recursive: true });
38
+ }
39
+ const enabledPlugins = settings.enabledPlugins ?? {};
40
+ if (enabledPlugins[PLUGIN_KEY] === true)
41
+ return;
42
+ enabledPlugins[PLUGIN_KEY] = true;
43
+ settings.enabledPlugins = enabledPlugins;
44
+ writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
45
+ }
46
+ /**
47
+ * Write .claude/mcp.json for the project.
48
+ * Merges with existing config; does not overwrite user's custom servers.
49
+ * Skips if devflow server already configured.
50
+ */
51
+ export function writeMcpConfig(projectRoot, mcpCommand) {
52
+ const claudeDir = join(projectRoot, ".claude");
53
+ const mcpPath = join(claudeDir, "mcp.json");
54
+ let existing = {};
55
+ if (existsSync(mcpPath)) {
56
+ try {
57
+ existing = JSON.parse(readFileSync(mcpPath, "utf-8"));
58
+ }
59
+ catch {
60
+ console.warn("Warning: Could not parse existing mcp.json, skipping MCP config");
61
+ return;
62
+ }
63
+ }
64
+ else {
65
+ mkdirSync(claudeDir, { recursive: true });
66
+ }
67
+ const mcpServers = existing.mcpServers ?? {};
68
+ if (mcpServers.devflow)
69
+ return; // already configured, don't overwrite
70
+ mcpServers.devflow = { command: mcpCommand, args: [], env: {} };
71
+ existing.mcpServers = mcpServers;
72
+ writeFileSync(mcpPath, JSON.stringify(existing, null, 2));
73
+ }
74
+ /**
75
+ * Deploy plugin files to cache directory.
76
+ * Copies hooks, hooks.json, CLAUDE.md, package.json, dist/ to cache.
77
+ * Also copies dist/skills/ to ~/.claude/skills/ (Claude Code's actual skill load location).
78
+ */
79
+ export function deployPlugin(pluginFilesDir, cacheBaseDir, version, globalSkillsDir) {
80
+ const target = join(cacheBaseDir, MARKETPLACE, PLUGIN_NAME, version);
81
+ mkdirSync(target, { recursive: true });
82
+ // Copy hooks/
83
+ const hooksSrc = join(pluginFilesDir, "hooks");
84
+ if (existsSync(hooksSrc)) {
85
+ copyDirSync(hooksSrc, join(target, "hooks"));
86
+ }
87
+ // Copy static files
88
+ for (const file of ["hooks.json", "CLAUDE.md", "package.json"]) {
89
+ const src = join(pluginFilesDir, file);
90
+ if (existsSync(src))
91
+ cpSync(src, join(target, file), { force: true });
92
+ }
93
+ // Copy .claude-plugin/plugin.json
94
+ const pluginJsonSrc = join(pluginFilesDir, ".claude-plugin", "plugin.json");
95
+ if (existsSync(pluginJsonSrc)) {
96
+ mkdirSync(join(target, ".claude-plugin"), { recursive: true });
97
+ cpSync(pluginJsonSrc, join(target, ".claude-plugin", "plugin.json"), { force: true });
98
+ }
99
+ // Copy dist/ (command-registry.json + skills/)
100
+ const distSrc = join(pluginFilesDir, "dist");
101
+ if (existsSync(distSrc)) {
102
+ copyDirSync(distSrc, join(target, "dist"));
103
+ }
104
+ // Copy injected skills to ~/.claude/skills/
105
+ if (globalSkillsDir) {
106
+ const skillsSrc = join(pluginFilesDir, "dist", "skills");
107
+ if (existsSync(skillsSrc)) {
108
+ copyDirSync(skillsSrc, globalSkillsDir);
109
+ }
110
+ }
111
+ // Clean old versions
112
+ cleanOldVersions(target);
113
+ }
114
+ function copyDirSync(src, dest) {
115
+ mkdirSync(dest, { recursive: true });
116
+ for (const entry of readdirSync(src)) {
117
+ const srcPath = join(src, entry);
118
+ const destPath = join(dest, entry);
119
+ if (statSync(srcPath).isDirectory()) {
120
+ copyDirSync(srcPath, destPath);
121
+ }
122
+ else {
123
+ cpSync(srcPath, destPath, { force: true });
124
+ }
125
+ }
126
+ }
127
+ function cleanOldVersions(currentTarget) {
128
+ const parentDir = join(currentTarget, "..");
129
+ if (!existsSync(parentDir))
130
+ return;
131
+ const currentVersion = currentTarget.split("/").pop() ?? "";
132
+ for (const entry of readdirSync(parentDir)) {
133
+ if (entry !== currentVersion) {
134
+ const entryPath = join(parentDir, entry);
135
+ if (statSync(entryPath).isDirectory()) {
136
+ rmSync(entryPath, { recursive: true, force: true });
137
+ }
138
+ }
139
+ }
140
+ }
141
+ //# sourceMappingURL=plugin-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-setup.js","sourceRoot":"","sources":["../../src/lib/plugin-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,QAAQ,EACR,MAAM,GACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,UAAU,GAAG,iDAAiD,CAAC;AACrE,MAAM,WAAW,GAAG,eAAe,CAAC;AACpC,MAAM,WAAW,GAAG,mCAAmC,CAAC;AAExD;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,mEAAmE;IACnE,MAAM,OAAO,GAAG,IAAI,CAClB,OAAO,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAC1C,oBAAoB,CACrB,CAAC;IACF,IAAI,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAExC,uEAAuE;IACvE,MAAM,QAAQ,GAAG,IAAI,CACnB,OAAO,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAC1C,iCAAiC,CAClC,CAAC;IACF,IAAI,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAE1C,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;AACxE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAAoB;IACtD,IAAI,QAAQ,GAA4B,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7B,IAAI,CAAC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QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YACpC,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,aAAqB;IAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAC5C,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO;IACnC,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IAC5D,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3C,IAAI,KAAK,KAAK,cAAc,EAAE,CAAC;YAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YACzC,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;gBACtC,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@devflow-tools/claude-code-plugin",
3
+ "description": "DevFlow — Developer Intelligence Platform: project context, code graph, knowledge base, memory engine, and workflow automation with 14 domain plugins",
4
+ "version": "0.3.2",
5
+ "author": {
6
+ "name": "DevFlow"
7
+ },
8
+ "homepage": "https://github.com/shilongfeicool/dev-flow",
9
+ "repository": "https://github.com/shilongfeicool/dev-flow",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "devflow",
13
+ "context",
14
+ "knowledge-base",
15
+ "code-graph",
16
+ "memory",
17
+ "workflow",
18
+ "development"
19
+ ]
20
+ }
@@ -0,0 +1,34 @@
1
+ # DevFlow Plugin for Claude Code
2
+
3
+ This plugin provides the DevFlow developer intelligence platform inside Claude Code.
4
+
5
+ ## What You Get
6
+
7
+ - **Context Engine** — Search code by natural language query. Use `/devflow:context` before making any code change.
8
+ - **Graph Engine** — View architecture layers, file groups, and dependency graphs. Use `/devflow:graph` to understand module structure.
9
+ - **Memory Engine** — Access project conventions, tech stack, and past decisions. Use `/devflow:memory` at the start of every task.
10
+ - **Knowledge Engine** — Search official docs for React, Vue, NestJS, TypeScript, and more. Use `/devflow:knowledge` when unsure about API usage.
11
+ - **Workflow Engine** — Run standardized development workflows (bug fixes, features, reviews). Use `/devflow:workflow` for complex multi-step tasks.
12
+ - **Domain Plugins** — Specialized expertise for 14 frameworks/tools via `/devflow:react`, `/devflow:git`, `/devflow:nextjs`, etc.
13
+
14
+ ## How to Use
15
+
16
+ 1. **Before any code change:** `/devflow:context` to understand the current implementation
17
+ 2. **Before writing new code:** `/devflow:memory` to check conventions
18
+ 3. **When stuck on API:** `/devflow:knowledge` to search docs
19
+ 4. **When debugging:** `/devflow:graph` to trace dependencies
20
+ 5. **For complex workflows:** `/devflow:workflow` or domain-specific commands like `/devflow:react`
21
+
22
+ ## Architecture
23
+
24
+ This plugin is a thin skill layer. The real work happens in:
25
+ - `devflow-mcp` — MCP stdio server (auto-started by this plugin)
26
+ - `devflow` CLI — Command-line interface for direct usage
27
+
28
+ ## Project Setup
29
+
30
+ If DevFlow hasn't been initialized in the current project yet, run:
31
+ ```
32
+ devflow init
33
+ devflow index
34
+ ```
@@ -0,0 +1,235 @@
1
+ {
2
+ "version": 1,
3
+ "commands": {
4
+ "devflow:context": {
5
+ "mcpTools": [
6
+ "get_project_context",
7
+ "search_symbol"
8
+ ],
9
+ "blockedNative": [
10
+ "grep",
11
+ "find",
12
+ "rg",
13
+ "ag",
14
+ "Grep",
15
+ "Glob",
16
+ "Explore",
17
+ "WebSearch",
18
+ "WebFetch"
19
+ ]
20
+ },
21
+ "devflow:graph": {
22
+ "mcpTools": [
23
+ "get_dependency_graph"
24
+ ],
25
+ "blockedNative": [
26
+ "grep",
27
+ "find",
28
+ "rg",
29
+ "ag",
30
+ "Grep",
31
+ "Glob",
32
+ "Explore"
33
+ ]
34
+ },
35
+ "devflow:knowledge": {
36
+ "mcpTools": [
37
+ "get_knowledge"
38
+ ],
39
+ "blockedNative": [
40
+ "WebSearch",
41
+ "WebFetch"
42
+ ]
43
+ },
44
+ "devflow:memory": {
45
+ "mcpTools": [
46
+ "get_memory"
47
+ ],
48
+ "blockedNative": [
49
+ "grep",
50
+ "find",
51
+ "rg",
52
+ "ag",
53
+ "Grep",
54
+ "Glob",
55
+ "Explore"
56
+ ]
57
+ },
58
+ "devflow:workflow": {
59
+ "mcpTools": [
60
+ "run_workflow"
61
+ ],
62
+ "blockedNative": []
63
+ },
64
+ "devflow:react": {
65
+ "mcpTools": [
66
+ "react_diagnose_bug",
67
+ "react_new_feature",
68
+ "react_audit_performance",
69
+ "react_review_hooks",
70
+ "react_refactor_component",
71
+ "react_new_component"
72
+ ],
73
+ "blockedNative": [
74
+ "grep",
75
+ "find",
76
+ "rg",
77
+ "ag",
78
+ "Grep",
79
+ "Glob",
80
+ "Explore",
81
+ "WebSearch",
82
+ "WebFetch"
83
+ ]
84
+ },
85
+ "devflow:vue": {
86
+ "mcpTools": [
87
+ "vue_diagnose_bug",
88
+ "vue_new_component",
89
+ "vue_debug_reactivity"
90
+ ],
91
+ "blockedNative": [
92
+ "grep",
93
+ "find",
94
+ "rg",
95
+ "ag",
96
+ "Grep",
97
+ "Glob",
98
+ "Explore",
99
+ "WebSearch",
100
+ "WebFetch"
101
+ ]
102
+ },
103
+ "devflow:tailwind": {
104
+ "mcpTools": [
105
+ "tailwind_new_component"
106
+ ],
107
+ "blockedNative": [
108
+ "grep",
109
+ "find",
110
+ "rg",
111
+ "ag",
112
+ "Grep",
113
+ "Glob",
114
+ "Explore",
115
+ "WebSearch",
116
+ "WebFetch"
117
+ ]
118
+ },
119
+ "devflow:taro": {
120
+ "mcpTools": [
121
+ "taro_new_page"
122
+ ],
123
+ "blockedNative": [
124
+ "grep",
125
+ "find",
126
+ "rg",
127
+ "ag",
128
+ "Grep",
129
+ "Glob",
130
+ "Explore",
131
+ "WebSearch",
132
+ "WebFetch"
133
+ ]
134
+ },
135
+ "devflow:nest": {
136
+ "mcpTools": [
137
+ "nest_new_module",
138
+ "nest_diagnose_bug"
139
+ ],
140
+ "blockedNative": [
141
+ "grep",
142
+ "find",
143
+ "rg",
144
+ "ag",
145
+ "Grep",
146
+ "Glob",
147
+ "Explore",
148
+ "WebSearch",
149
+ "WebFetch"
150
+ ]
151
+ },
152
+ "devflow:graphql": {
153
+ "mcpTools": [
154
+ "graphql_new_graphql_type",
155
+ "graphql_diagnose_bug"
156
+ ],
157
+ "blockedNative": [
158
+ "grep",
159
+ "find",
160
+ "rg",
161
+ "ag",
162
+ "Grep",
163
+ "Glob",
164
+ "Explore",
165
+ "WebSearch",
166
+ "WebFetch"
167
+ ]
168
+ },
169
+ "devflow:docker": {
170
+ "mcpTools": [
171
+ "docker_dockerize_project"
172
+ ],
173
+ "blockedNative": [
174
+ "grep",
175
+ "find",
176
+ "rg",
177
+ "ag",
178
+ "Grep",
179
+ "Glob",
180
+ "Explore",
181
+ "WebSearch",
182
+ "WebFetch"
183
+ ]
184
+ },
185
+ "devflow:performance": {
186
+ "mcpTools": [
187
+ "performance_audit_performance"
188
+ ],
189
+ "blockedNative": [
190
+ "grep",
191
+ "find",
192
+ "rg",
193
+ "ag",
194
+ "Grep",
195
+ "Glob",
196
+ "Explore",
197
+ "WebSearch",
198
+ "WebFetch"
199
+ ]
200
+ },
201
+ "devflow:nextjs": {
202
+ "mcpTools": [
203
+ "nextjs_new_page",
204
+ "nextjs_diagnose_bug"
205
+ ],
206
+ "blockedNative": [
207
+ "grep",
208
+ "find",
209
+ "rg",
210
+ "ag",
211
+ "Grep",
212
+ "Glob",
213
+ "Explore",
214
+ "WebSearch",
215
+ "WebFetch"
216
+ ]
217
+ },
218
+ "devflow:electron": {
219
+ "mcpTools": [
220
+ "electron_diagnose_bug"
221
+ ],
222
+ "blockedNative": [
223
+ "grep",
224
+ "find",
225
+ "rg",
226
+ "ag",
227
+ "Grep",
228
+ "Glob",
229
+ "Explore",
230
+ "WebSearch",
231
+ "WebFetch"
232
+ ]
233
+ }
234
+ }
235
+ }
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: devflow:context
3
+ description: 检索项目上下文 — 自然语言查询相关代码、符号、依赖关系
4
+ ---
5
+
6
+ <HARD-GATE>
7
+ 收到 devflow:context 时,必须先调用以下 MCP 工具之一:
8
+ get_project_context / search_symbol
9
+ </HARD-GATE>
10
+
11
+
12
+
13
+ # /devflow:context
14
+
15
+ ## 执行
16
+
17
+ 1. 如果用户的查询包含中文,先将其中的中文关键词翻译为英文代码术语(空格分隔)
18
+ 2. 调用 `get_project_context` MCP 工具:
19
+
20
+ ```
21
+ query = 用户的原始查询内容(包含中文)
22
+ expandedTerms = 你翻译的英文关键词(如 "code review audit module")
23
+ mode = "fast" (首次调用;如需更深入结果,再改用 "deep")
24
+ ```
25
+
26
+ 示例:
27
+ - 用户查询 "代码审核模块的流程" → expandedTerms = "code review audit module workflow pipeline process"
28
+ - 用户查询 "用户登录认证逻辑" → expandedTerms = "user login authentication auth logic service handler"
29
+ - 用户查询 "数据库缓存策略" → expandedTerms = "database db cache memo redis storage strategy"
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: devflow:docker
3
+ description: Docker 专家 — 镜像优化、Compose 编排、安全扫描、多阶段构建
4
+ ---
5
+
6
+ <HARD-GATE>
7
+ 收到 devflow:docker 时,必须先调用以下 MCP 工具之一:
8
+ docker_dockerize_project
9
+ </HARD-GATE>
10
+
11
+
12
+
13
+ # 🐳 DOCKER
14
+
15
+ 你是一个 Docker 专家。使用多阶段构建优化镜像,遵循安全和性能最佳实践。遇到问题先查官方文档。
16
+
17
+ ## 适用场景
18
+
19
+ **项目 Docker 化:分析项目 → 多阶段 Dockerfile → Compose → 构建验证**
20
+
21
+ **镜像优化:体积分析 → 层优化 → 多阶段重构**
22
+
23
+ **安全扫描:漏洞检测 → 配置审查 → 修复建议**
24
+
25
+ **多服务 Compose 编排:依赖分析 → 网络设计 → 环境管理**
26
+
27
+ ## 核心规则
28
+
29
+ - 使用多阶段构建减小镜像体积
30
+ - 基础镜像固定版本标签(不使用 latest)
31
+ - 利用层缓存优化构建顺序
32
+ - 使用非 root 用户运行应用
33
+ - 使用 .dockerignore 排除无用文件
34
+ - 添加 HEALTHCHECK 监控容器健康状态
35
+ - 不在镜像层中写入敏感信息
36
+ - 修复安全问题时先查 Docker 官方文档确认方案
37
+
38
+ ## 当前版本
39
+
40
+ - docker-docs: 26.0.0 — https://docs.docker.com/reference/
41
+
42
+ ## 工作流
43
+
44
+ | 场景 | 触发方式 |
45
+ |------|----------|
46
+ | 项目 Docker 化:分析项目 → 多阶段 Dockerfile → Compose → 构建验证 | 调用 MCP 工具 `docker_dockerize_project` |
47
+ | 镜像优化:体积分析 → 层优化 → 多阶段重构 | 调用 MCP 工具 `docker_optimize:image` |
48
+ | 安全扫描:漏洞检测 → 配置审查 → 修复建议 | 调用 MCP 工具 `docker_scan:security` |
49
+ | 多服务 Compose 编排:依赖分析 → 网络设计 → 环境管理 | 调用 MCP 工具 `docker_setup:compose` |
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: devflow:electron
3
+ description: Electron 专家 — IPC 通信、窗口管理、原生模块、自动更新、安全配置
4
+ ---
5
+
6
+ <HARD-GATE>
7
+ 收到 devflow:electron 时,必须先调用以下 MCP 工具之一:
8
+ electron_diagnose_bug
9
+ </HARD-GATE>
10
+
11
+
12
+
13
+ # ⚛️ ELECTRON
14
+
15
+ 你是一个 Electron 专家。使用 contextBridge + IPC 安全通信模式。严格遵循 Electron 安全最佳实践。
16
+
17
+ ## 适用场景
18
+
19
+ **新建 IPC 通道:定义 API → Preload 暴露 → 主进程处理**
20
+
21
+ **安全审计:配置检查 → IPC 暴露面 → CSP → 第三方依赖**
22
+
23
+ **自动更新配置:electron-updater → 发布渠道 → 更新 UI**
24
+
25
+ **Electron Bug 诊断:进程分类 → IPC 追踪 → 原生调试**
26
+
27
+ ## 核心规则
28
+
29
+ - 使用 contextBridge + ipcRenderer/ipcMain 通信
30
+ - 必须启用 contextIsolation,禁用 nodeIntegration
31
+ - 主进程负责系统操作,渲染进程只做 UI
32
+ - Preload 脚本只暴露最小必要的安全 API
33
+ - 使用 electron-updater 实现自动更新
34
+ - 启用 sandbox 和 CSP 安全策略
35
+ - 避免使用 remote 模块(已废弃)
36
+ - 构建使用 electron-builder 并配置代码签名
37
+
38
+ ## 当前版本
39
+
40
+ - electron-docs: 30.0.0 — https://www.electronjs.org/docs/latest/
41
+
42
+ ## 工作流
43
+
44
+ | 场景 | 触发方式 |
45
+ |------|----------|
46
+ | 新建 IPC 通道:定义 API → Preload 暴露 → 主进程处理 | 调用 MCP 工具 `electron_new:ipc` |
47
+ | 安全审计:配置检查 → IPC 暴露面 → CSP → 第三方依赖 | 调用 MCP 工具 `electron_audit:security` |
48
+ | 自动更新配置:electron-updater → 发布渠道 → 更新 UI | 调用 MCP 工具 `electron_setup:auto-update` |
49
+ | Electron Bug 诊断:进程分类 → IPC 追踪 → 原生调试 | 调用 MCP 工具 `electron_diagnose_bug` |
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: devflow:graph
3
+ description: 查看项目模块图谱 — 架构分层、文件分组、依赖可视化
4
+ ---
5
+
6
+ <HARD-GATE>
7
+ 收到 devflow:graph 时,必须先调用以下 MCP 工具之一:
8
+ get_dependency_graph
9
+ </HARD-GATE>
10
+
11
+
12
+
13
+ # /devflow:graph
14
+
15
+ ## 执行
16
+
17
+ 调用 `get_dependency_graph` MCP 工具:
18
+
19
+ ```
20
+ target = "all" (默认,拉取完整图谱)
21
+ depth = 2 (默认,可调整 1-5)
22
+ ```
23
+
24
+ DevFlow 的依赖图谱是预索引的结构化数据(节点类型、边的方向、架构分层),原生工具无法提供同等质量的架构分析。
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: devflow:graphql
3
+ description: GraphQL 专家 — Schema 设计、N+1 检测、Resolver 优化、安全审计
4
+ ---
5
+
6
+ <HARD-GATE>
7
+ 收到 devflow:graphql 时,必须先调用以下 MCP 工具之一:
8
+ graphql_new_graphql_type / graphql_diagnose_bug
9
+ </HARD-GATE>
10
+
11
+
12
+
13
+ # ◈ GRAPHQL
14
+
15
+ 你是一个 GraphQL 专家。使用 Schema-First 设计,Apollo Server 实现。遇到问题先查文档,不凭空猜测。
16
+
17
+ ## 适用场景
18
+
19
+ **新建 GraphQL Type + Resolver + DataLoader**
20
+
21
+ **N+1 检测与修复:扫描 Resolver → 识别批量模式 → 加 DataLoader**
22
+
23
+ **Schema 设计审查:类型设计 → 分页模式 → 安全风险评估**
24
+
25
+ **GraphQL Bug 诊断:查询分析 → Resolver 链追踪 → 修复**
26
+
27
+ ## 核心规则
28
+
29
+ - 使用 Schema-First 设计(SDL)定义类型和操作
30
+ - Resolver 保持简洁,业务逻辑在 Service 层
31
+ - 使用 DataLoader 解决 N+1 查询问题
32
+ - Mutation 命名使用动词(create/update/delete)
33
+ - 使用 Connection 模式实现分页
34
+ - 限制查询深度和复杂度防止滥用
35
+ - 遇到不确定的 Schema 设计时先查 GraphQL 官方规范
36
+
37
+ ## 当前版本
38
+
39
+ - graphql-docs: 2024 — https://graphql.org/learn/
40
+
41
+ ## 工作流
42
+
43
+ | 场景 | 触发方式 |
44
+ |------|----------|
45
+ | 新建 GraphQL Type + Resolver + DataLoader | 调用 MCP 工具 `graphql_new_graphql_type` |
46
+ | N+1 检测与修复:扫描 Resolver → 识别批量模式 → 加 DataLoader | 调用 MCP 工具 `graphql_fix:n+1` |
47
+ | Schema 设计审查:类型设计 → 分页模式 → 安全风险评估 | 调用 MCP 工具 `graphql_review:schema` |
48
+ | GraphQL Bug 诊断:查询分析 → Resolver 链追踪 → 修复 | 调用 MCP 工具 `graphql_diagnose_bug` |
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: devflow:knowledge
3
+ description: 搜索技术文档知识库 — React、Vue、Nest、TypeScript 等官方文档
4
+ ---
5
+
6
+ <HARD-GATE>
7
+ 收到 devflow:knowledge 时,必须先调用以下 MCP 工具之一:
8
+ get_knowledge
9
+ </HARD-GATE>
10
+
11
+
12
+
13
+ # /devflow:knowledge
14
+
15
+ ## 执行
16
+
17
+ 调用 `get_knowledge` MCP 工具:
18
+
19
+ ```
20
+ query = 用户的查询内容
21
+ scope = "all" (默认;可选 react/vue/nest)
22
+ ```
23
+
24
+ DevFlow 知识库预索引了 React、Vue、NestJS、TypeScript 官方文档(带版本标签和代码示例),比 WebSearch/WebFetch 更快更准。