@leocm/flowcraft 0.0.0-stage → 2.1.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/README.md +855 -3
- package/bin/cli.js +108 -0
- package/flowcraft.yaml +30 -0
- package/install.sh +24 -0
- package/lib/args.js +38 -0
- package/lib/config.js +20 -0
- package/lib/copy.js +131 -0
- package/lib/fix.js +110 -0
- package/lib/fsutil.js +104 -0
- package/lib/global.js +229 -0
- package/lib/init.js +43 -0
- package/lib/runtime.js +84 -0
- package/lib/version.js +55 -0
- package/lib/wizard.js +125 -0
- package/package.json +31 -4
- package/presets/backend.yaml +20 -0
- package/presets/default.yaml +15 -0
- package/presets/frontend.yaml +20 -0
- package/presets/quick-fix.yaml +15 -0
- package/setup/.claude/commands/P0.5.md +1 -0
- package/setup/.claude/commands/P0.md +1 -0
- package/setup/.claude/commands/P1.md +1 -0
- package/setup/.claude/commands/P2.md +1 -0
- package/setup/.claude/commands/P3.md +1 -0
- package/setup/.claude/commands/P4.md +1 -0
- package/setup/.claude/commands/P5.md +1 -0
- package/setup/.claude/commands/code-analysis-init.md +1 -0
- package/setup/.claude/commands/code-analysis-rebuild.md +1 -0
- package/setup/.claude/commands/code-analysis-show-memory.md +1 -0
- package/setup/.claude/commands/code-analysis-update.md +1 -0
- package/setup/.claude/hooks/check-phase-advancement.py +180 -0
- package/setup/.claude/hooks/check-phase-test.py +152 -0
- package/setup/.claude/hooks/check-phase-write.py +235 -0
- package/setup/.claude/hooks/dispatch.py +67 -0
- package/setup/.claude/hooks/file-suggestion.py +45 -0
- package/setup/.claude/hooks/flowcraft_env.py +137 -0
- package/setup/.claude/hooks/log_session.py +93 -0
- package/setup/.claude/hooks/permission-request.py +125 -0
- package/setup/.claude/hooks/post-tool-failure.py +36 -0
- package/setup/.claude/hooks/pre-compact.py +66 -0
- package/setup/.claude/hooks/review-runner.py +846 -0
- package/setup/.claude/hooks/session-end.py +184 -0
- package/setup/.claude/hooks/session-start.py +188 -0
- package/setup/.claude/hooks/settings.json +0 -0
- package/setup/.claude/hooks/setup-keys.py +282 -0
- package/setup/.claude/hooks/statusline.py +63 -0
- package/setup/.claude/hooks/stop-check.py +171 -0
- package/setup/.claude/hooks/subagent-start.py +50 -0
- package/setup/.claude/hooks/subagent-stop.py +63 -0
- package/setup/.claude/hooks/task-completed.py +57 -0
- package/setup/.claude/hooks/task_manager.py +592 -0
- package/setup/.claude/hooks/user-prompt-submit.py +85 -0
- package/setup/.claude/project-state.md +109 -0
- package/setup/.claude/settings.json +237 -0
- package/setup/.claude/settings.local.json +13 -0
- package/setup/.claude/skills/P5report/SKILL.md +77 -0
- package/setup/.claude/skills/Pstatus/SKILL.md +68 -0
- package/setup/.claude/skills/archive/SKILL.md +196 -0
- package/setup/.claude/skills/brainstorming/SKILL.md +155 -0
- package/setup/.claude/skills/brainstorming/scripts/frame-template.html +213 -0
- package/setup/.claude/skills/brainstorming/scripts/helper.js +167 -0
- package/setup/.claude/skills/brainstorming/scripts/server.cjs +723 -0
- package/setup/.claude/skills/brainstorming/scripts/start-server.py +245 -0
- package/setup/.claude/skills/brainstorming/scripts/stop-server.py +178 -0
- package/setup/.claude/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/setup/.claude/skills/brainstorming/visual-companion.md +298 -0
- package/setup/.claude/skills/checkpoint/SKILL.md +42 -0
- package/setup/.claude/skills/chrome-integration/SKILL.md +67 -0
- package/setup/.claude/skills/code-analysis/SKILL.md +1243 -0
- package/setup/.claude/skills/code-review/SKILL.md +265 -0
- package/setup/.claude/skills/cross-review/SKILL.md +41 -0
- package/setup/.claude/skills/executing-plans/SKILL.md +64 -0
- package/setup/.claude/skills/git-prep/SKILL.md +50 -0
- package/setup/.claude/skills/gitnexus/gitnexus-cli/SKILL.md +67 -0
- package/setup/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md +89 -0
- package/setup/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md +78 -0
- package/setup/.claude/skills/gitnexus/gitnexus-guide/SKILL.md +66 -0
- package/setup/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +97 -0
- package/setup/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md +121 -0
- package/setup/.claude/skills/graphify/SKILL.md +49 -0
- package/setup/.claude/skills/openspec-apply-change/SKILL.md +185 -0
- package/setup/.claude/skills/openspec-archive-change/SKILL.md +182 -0
- package/setup/.claude/skills/openspec-bulk-archive-change/SKILL.md +339 -0
- package/setup/.claude/skills/openspec-continue-change/SKILL.md +118 -0
- package/setup/.claude/skills/openspec-explore/SKILL.md +311 -0
- package/setup/.claude/skills/openspec-ff-change/SKILL.md +113 -0
- package/setup/.claude/skills/openspec-new-change/SKILL.md +77 -0
- package/setup/.claude/skills/openspec-onboard/SKILL.md +573 -0
- package/setup/.claude/skills/openspec-propose/SKILL.md +149 -0
- package/setup/.claude/skills/openspec-sync-specs/SKILL.md +262 -0
- package/setup/.claude/skills/openspec-update-change/SKILL.md +91 -0
- package/setup/.claude/skills/openspec-verify-change/SKILL.md +175 -0
- package/setup/.claude/skills/oss-version-check/SKILL.md +71 -0
- package/setup/.claude/skills/oss-version-check/check_oss_version.py +205 -0
- package/setup/.claude/skills/phase/SKILL.md +63 -0
- package/setup/.claude/skills/playwright/SKILL.md +86 -0
- package/setup/.claude/skills/playwright-cli/SKILL.md +420 -0
- package/setup/.claude/skills/playwright-cli/references/element-attributes.md +23 -0
- package/setup/.claude/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/setup/.claude/skills/playwright-cli/references/references/element-attributes.md +23 -0
- package/setup/.claude/skills/playwright-cli/references/references/playwright-tests.md +39 -0
- package/setup/.claude/skills/playwright-cli/references/references/request-mocking.md +87 -0
- package/setup/.claude/skills/playwright-cli/references/references/running-code.md +241 -0
- package/setup/.claude/skills/playwright-cli/references/references/session-management.md +225 -0
- package/setup/.claude/skills/playwright-cli/references/references/storage-state.md +275 -0
- package/setup/.claude/skills/playwright-cli/references/references/test-generation.md +433 -0
- package/setup/.claude/skills/playwright-cli/references/references/tracing.md +139 -0
- package/setup/.claude/skills/playwright-cli/references/references/video-recording.md +143 -0
- package/setup/.claude/skills/playwright-cli/references/request-mocking.md +87 -0
- package/setup/.claude/skills/playwright-cli/references/running-code.md +241 -0
- package/setup/.claude/skills/playwright-cli/references/session-management.md +225 -0
- package/setup/.claude/skills/playwright-cli/references/storage-state.md +275 -0
- package/setup/.claude/skills/playwright-cli/references/test-generation.md +433 -0
- package/setup/.claude/skills/playwright-cli/references/tracing.md +139 -0
- package/setup/.claude/skills/playwright-cli/references/video-recording.md +143 -0
- package/setup/.claude/skills/review/SKILL.md +98 -0
- package/setup/.claude/skills/review-tools/SKILL.md +76 -0
- package/setup/.claude/skills/subagent-driven-development/SKILL.md +94 -0
- package/setup/.claude/skills/task/SKILL.md +26 -0
- package/setup/.claude/skills/test-driven-development/SKILL.md +320 -0
- package/setup/.claude/skills/test-driven-development/writing-good-tests.md +198 -0
- package/setup/.claude/skills/ui-ux-pro-max/SKILL.md +377 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/setup/.claude/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/setup/.claude/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/setup/.claude/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/setup/.claude/skills/ui-ux-standards/SKILL.md +154 -0
- package/setup/.claude/skills/verification-before-completion/SKILL.md +120 -0
- package/setup/.claude/skills/wiki-read/SKILL.md +190 -0
- package/setup/.claude/skills/writing-plans/SKILL.md +168 -0
- package/setup/.claude/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/setup/.claude/tasks/.last-session +1 -0
- package/setup/.codex/.agents/skills/P5report/SKILL.md +77 -0
- package/setup/.codex/.agents/skills/Pstatus/SKILL.md +30 -0
- package/setup/.codex/.agents/skills/archive/SKILL.md +196 -0
- package/setup/.codex/.agents/skills/brainstorming/SKILL.md +155 -0
- package/setup/.codex/.agents/skills/brainstorming/scripts/frame-template.html +213 -0
- package/setup/.codex/.agents/skills/brainstorming/scripts/helper.js +167 -0
- package/setup/.codex/.agents/skills/brainstorming/scripts/server.cjs +723 -0
- package/setup/.codex/.agents/skills/brainstorming/scripts/start-server.py +245 -0
- package/setup/.codex/.agents/skills/brainstorming/scripts/stop-server.py +178 -0
- package/setup/.codex/.agents/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/setup/.codex/.agents/skills/brainstorming/visual-companion.md +298 -0
- package/setup/.codex/.agents/skills/checkpoint/SKILL.md +42 -0
- package/setup/.codex/.agents/skills/chrome-integration/SKILL.md +67 -0
- package/setup/.codex/.agents/skills/code-analysis/SKILL.md +1243 -0
- package/setup/.codex/.agents/skills/code-review/SKILL.md +265 -0
- package/setup/.codex/.agents/skills/cross-review/SKILL.md +42 -0
- package/setup/.codex/.agents/skills/executing-plans/SKILL.md +64 -0
- package/setup/.codex/.agents/skills/git-prep/SKILL.md +50 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-cli/SKILL.md +67 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-debugging/SKILL.md +89 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-exploring/SKILL.md +78 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-guide/SKILL.md +66 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +97 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-refactoring/SKILL.md +121 -0
- package/setup/.codex/.agents/skills/graphify/SKILL.md +49 -0
- package/setup/.codex/.agents/skills/openspec-apply-change/SKILL.md +185 -0
- package/setup/.codex/.agents/skills/openspec-archive-change/SKILL.md +182 -0
- package/setup/.codex/.agents/skills/openspec-bulk-archive-change/SKILL.md +339 -0
- package/setup/.codex/.agents/skills/openspec-continue-change/SKILL.md +118 -0
- package/setup/.codex/.agents/skills/openspec-explore/SKILL.md +311 -0
- package/setup/.codex/.agents/skills/openspec-ff-change/SKILL.md +113 -0
- package/setup/.codex/.agents/skills/openspec-new-change/SKILL.md +77 -0
- package/setup/.codex/.agents/skills/openspec-onboard/SKILL.md +573 -0
- package/setup/.codex/.agents/skills/openspec-propose/SKILL.md +149 -0
- package/setup/.codex/.agents/skills/openspec-sync-specs/SKILL.md +262 -0
- package/setup/.codex/.agents/skills/openspec-update-change/SKILL.md +91 -0
- package/setup/.codex/.agents/skills/openspec-verify-change/SKILL.md +175 -0
- package/setup/.codex/.agents/skills/oss-version-check/SKILL.md +71 -0
- package/setup/.codex/.agents/skills/oss-version-check/check_oss_version.py +205 -0
- package/setup/.codex/.agents/skills/phase/SKILL.md +63 -0
- package/setup/.codex/.agents/skills/playwright/SKILL.md +86 -0
- package/setup/.codex/.agents/skills/playwright-cli/SKILL.md +420 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/element-attributes.md +23 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/element-attributes.md +23 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/playwright-tests.md +39 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/request-mocking.md +87 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/running-code.md +241 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/session-management.md +225 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/storage-state.md +275 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/test-generation.md +433 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/tracing.md +139 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/video-recording.md +143 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/request-mocking.md +87 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/running-code.md +241 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/session-management.md +225 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/storage-state.md +275 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/test-generation.md +433 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/tracing.md +139 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/video-recording.md +143 -0
- package/setup/.codex/.agents/skills/review/SKILL.md +98 -0
- package/setup/.codex/.agents/skills/review-tools/SKILL.md +76 -0
- package/setup/.codex/.agents/skills/subagent-driven-development/SKILL.md +94 -0
- package/setup/.codex/.agents/skills/task/SKILL.md +27 -0
- package/setup/.codex/.agents/skills/test-driven-development/SKILL.md +320 -0
- package/setup/.codex/.agents/skills/test-driven-development/writing-good-tests.md +198 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/SKILL.md +377 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/setup/.codex/.agents/skills/ui-ux-standards/SKILL.md +154 -0
- package/setup/.codex/.agents/skills/verification-before-completion/SKILL.md +120 -0
- package/setup/.codex/.agents/skills/wiki-read/SKILL.md +190 -0
- package/setup/.codex/.agents/skills/writing-plans/SKILL.md +168 -0
- package/setup/.codex/.agents/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/setup/.codex/config.toml +10 -0
- package/setup/.codex/hooks/log_session.py +92 -0
- package/setup/.codex/hooks/review-runner.py +851 -0
- package/setup/.codex/hooks/sdlc-codex-hook.cjs +1039 -0
- package/setup/.codex/hooks/setup-keys.py +287 -0
- package/setup/.codex/hooks.json +121 -0
- package/setup/.codex/model-catalog.json +154 -0
- package/setup/.codex/project-state.md +103 -0
- package/setup/AGENTS.md +722 -0
- package/setup/CLAUDE.md +717 -0
- package/setup/install.sh +24 -0
- package/setup/tests/test_decision_timeout.py +241 -0
- package/setup/tests/test_hook_guards.py +357 -0
- package/setup/tests/test_sdlc_bootstrap.py +167 -0
- package/setup/tests/test_task_manager.py +148 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: "AI code quality review (auto after P2; manual /code-review). | 触发词:代码审查/质量检查"
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Glob
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- AskUserQuestion
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Usage: `/code-review [file path]`
|
|
13
|
+
|
|
14
|
+
Arguments: $ARGUMENTS
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Execution logic (执行逻辑)
|
|
19
|
+
|
|
20
|
+
### 1. Read project state
|
|
21
|
+
Read from `project-state.md`:
|
|
22
|
+
- `modified_files` list
|
|
23
|
+
- `current_phase`, verify it is P2
|
|
24
|
+
|
|
25
|
+
### 2. Determine the review scope
|
|
26
|
+
- If a file path argument is provided → review that file
|
|
27
|
+
- Otherwise → use the `modified_files` list
|
|
28
|
+
|
|
29
|
+
### 3. AI-review each file
|
|
30
|
+
Review standards (based on the Alibaba Java Development Manual):
|
|
31
|
+
|
|
32
|
+
**Naming (命名规范):**
|
|
33
|
+
- Class names: PascalCase (e.g. `UserService`)
|
|
34
|
+
- Methods/variables: camelCase (e.g. `getUser`)
|
|
35
|
+
- Constants: UPPER_SNAKE (e.g. `MAX_SIZE`)
|
|
36
|
+
- Package names: all lowercase
|
|
37
|
+
|
|
38
|
+
**Code style (代码风格):**
|
|
39
|
+
- Indentation: 4 spaces
|
|
40
|
+
- Braces: opening brace stays on the same line
|
|
41
|
+
- Line length: ≤ 100
|
|
42
|
+
- one statement per line
|
|
43
|
+
|
|
44
|
+
**Method standards (方法规范):**
|
|
45
|
+
- Method length: ≤ 80 lines
|
|
46
|
+
- Parameter count: ≤ 5
|
|
47
|
+
- returning null must be documented in a comment
|
|
48
|
+
|
|
49
|
+
**Exception handling (异常处理):**
|
|
50
|
+
- catch specific exceptions, not `catch Exception`
|
|
51
|
+
- catch blocks must not be empty
|
|
52
|
+
- handle or rethrow after catching
|
|
53
|
+
|
|
54
|
+
**Resource management (资源管理):**
|
|
55
|
+
- IO streams must be closed (use try-with-resources)
|
|
56
|
+
- DB connections must be closed
|
|
57
|
+
|
|
58
|
+
**Best practices (最佳实践):**
|
|
59
|
+
- avoid magic values (use constants or enums)
|
|
60
|
+
- avoid hardcoded config (put in config files)
|
|
61
|
+
- String comparison uses `"abc".equals(str)` to avoid NPE
|
|
62
|
+
- use `StringBuilder` for heavy string concatenation
|
|
63
|
+
|
|
64
|
+
**Security (安全性):**
|
|
65
|
+
- avoid SQL concatenation (use `PreparedStatement`)
|
|
66
|
+
- mask sensitive data (passwords, tokens in logs)
|
|
67
|
+
- avoid hardcoded secrets
|
|
68
|
+
|
|
69
|
+
**Loop DB inserts (循环插入数据库, high risk - must fix):**
|
|
70
|
+
|
|
71
|
+
| Check | Description |
|
|
72
|
+
|--------|------|
|
|
73
|
+
| **insert inside for/while loop** | `insert`/`update`/`delete` inside a loop body |
|
|
74
|
+
| **batch insert not optimized** | loop inserts instead of batch insert |
|
|
75
|
+
| **per-commit without transaction** | committing one by one in a loop, no batch transaction control |
|
|
76
|
+
|
|
77
|
+
**Anti-patterns (反例, high-risk issues):**
|
|
78
|
+
```java
|
|
79
|
+
// Anti-pattern: inserting one by one inside a for loop
|
|
80
|
+
for (User user : userList) {
|
|
81
|
+
jdbcTemplate.update("INSERT INTO user VALUES (?, ?)", user.getId(), user.getName());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Anti-pattern: updating one by one inside a for loop
|
|
85
|
+
for (Order order : orders) {
|
|
86
|
+
orderDao.update(order);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Anti-pattern: query-then-update inside a for loop
|
|
90
|
+
for (Item item : items) {
|
|
91
|
+
if (itemDao.findById(item.getId()) != null) {
|
|
92
|
+
itemDao.update(item);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Good patterns (正例, recommended fix):**
|
|
98
|
+
```java
|
|
99
|
+
// Good: JDBC Batch insert
|
|
100
|
+
jdbcTemplate.batchUpdate("INSERT INTO user VALUES (?, ?)",
|
|
101
|
+
userList, userList.size(),
|
|
102
|
+
(ps, user) -> {
|
|
103
|
+
ps.setLong(1, user.getId());
|
|
104
|
+
ps.setString(2, user.getName());
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Good: MyBatis batch insert
|
|
108
|
+
<insert id="batchInsert" useGeneratedKeys="true">
|
|
109
|
+
INSERT INTO user (id, name) VALUES
|
|
110
|
+
<foreach collection="list" item="user" separator=",">
|
|
111
|
+
(#{user.id}, #{user.name})
|
|
112
|
+
</foreach>
|
|
113
|
+
</insert>
|
|
114
|
+
|
|
115
|
+
// Good: batched processing + transaction control
|
|
116
|
+
@Transactional
|
|
117
|
+
public void processOrders(List<Order> orders) {
|
|
118
|
+
// process in batches of 500
|
|
119
|
+
List<List<Order>> batches = Lists.partition(orders, 500);
|
|
120
|
+
for (List<Order> batch : batches) {
|
|
121
|
+
orderDao.batchUpdate(batch);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Detection logic (判断逻辑):**
|
|
127
|
+
1. detect `for`/`while`/`do-while` loop keywords
|
|
128
|
+
2. detect DB operations in the loop body: `insert`/`update`/`delete`/`save`/`remove`/`find`/`query`
|
|
129
|
+
3. if DB operations are found inside a loop → mark as **high-risk issue**
|
|
130
|
+
4. further check whether batch APIs are used (`batchUpdate`/`batchInsert`/`partition`)
|
|
131
|
+
|
|
132
|
+
**Severity definitions (严重程度定义):**
|
|
133
|
+
|
|
134
|
+
| Level | Definition | Handling |
|
|
135
|
+
|------|------|----------|
|
|
136
|
+
| **High** | blocking issues: memory leaks, security holes, data inconsistency | must fix |
|
|
137
|
+
| **Medium** | functional risks: NPE, unclosed resources, logic errors | suggested fix |
|
|
138
|
+
| **Low** | code standards: unclear naming, format issues | optional fix |
|
|
139
|
+
|
|
140
|
+
**Issue categories (问题分类):**
|
|
141
|
+
|
|
142
|
+
| Category | Contains |
|
|
143
|
+
|------|----------|
|
|
144
|
+
| **Naming** | class names, method names, variable names, constant names, package names |
|
|
145
|
+
| **Code style** | indentation, braces, line length, comment standards |
|
|
146
|
+
| **Performance/security** | SQL injection, XSS, sensitive data, concurrency safety, loop batch operations |
|
|
147
|
+
| **Best practices** | NPE protection, resource management, exception handling |
|
|
148
|
+
|
|
149
|
+
**Multi-language support (多语言支持):**
|
|
150
|
+
|
|
151
|
+
| Language | Extra checks |
|
|
152
|
+
|------|-----------|
|
|
153
|
+
| Java | thread safety, generics, wildcards, Stream API |
|
|
154
|
+
| Python | indentation, type annotations, PEP8, list comprehensions |
|
|
155
|
+
| Go | error handling, goroutine leaks, context usage |
|
|
156
|
+
| JavaScript/TypeScript | callback hell, Promise, async/await, type checking |
|
|
157
|
+
|
|
158
|
+
### 4. Generate the review report
|
|
159
|
+
Save to `.claude/code-review-report.md`:
|
|
160
|
+
|
|
161
|
+
```markdown
|
|
162
|
+
# AI Code Review Report (AI 代码审查报告)
|
|
163
|
+
|
|
164
|
+
- Review time (审查时间): {time}
|
|
165
|
+
- Files reviewed (审查文件): {n}
|
|
166
|
+
- Issues found (发现问题): {n} (high {h} / medium {m} / low {l})
|
|
167
|
+
- Handling (处理方式): {pending/done/ignored (待处理/已处理/已忽略)}
|
|
168
|
+
|
|
169
|
+
## Issue summary (问题汇总)
|
|
170
|
+
|
|
171
|
+
| Category | High | Medium | Low | Total |
|
|
172
|
+
|------|------|------|------|------|
|
|
173
|
+
| Naming | 0 | 0 | 0 | 0 |
|
|
174
|
+
| Code style | 0 | 0 | 0 | 0 |
|
|
175
|
+
| Performance/security | 0 | 0 | 0 | 0 |
|
|
176
|
+
| Best practices | 0 | 0 | 0 | 0 |
|
|
177
|
+
|
|
178
|
+
## Issue list (问题列表)
|
|
179
|
+
|
|
180
|
+
**Issue 1: {title}**
|
|
181
|
+
- File (文件): {path}
|
|
182
|
+
- Location (位置): line {n}
|
|
183
|
+
- Category (分类): {naming/code style/performance-security/best practices}
|
|
184
|
+
- Severity (严重性): {high/medium/low}
|
|
185
|
+
- Current code (当前代码):
|
|
186
|
+
```java
|
|
187
|
+
{snippet}
|
|
188
|
+
```
|
|
189
|
+
- Suggested fix (建议修复): {description}
|
|
190
|
+
- Status (状态): {unfixed/fixed/ignored (未修复/已修复/已忽略)}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 5. Interaction handling (交互处理)
|
|
194
|
+
If issues are found:
|
|
195
|
+
- Show the issue list
|
|
196
|
+
- Use AskUserQuestion to let the user choose:
|
|
197
|
+
- **A. Auto-fix**: AI generates the fix; apply after user confirmation
|
|
198
|
+
- **B. Manual fix**: return to P2
|
|
199
|
+
- **C. Ignore**: record the exemption, continue to P3
|
|
200
|
+
|
|
201
|
+
### 6. Return result (返回结果)
|
|
202
|
+
Output JSON:
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"passed": true/false,
|
|
206
|
+
"issues_count": 3,
|
|
207
|
+
"high_severity": 1,
|
|
208
|
+
"action": "auto_fix/manual_fix/ignore",
|
|
209
|
+
"message": "review complete (审查完成)"
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Judgment logic (判断逻辑):**
|
|
214
|
+
- `passed = true`: no issues, or all issues fixed/ignored
|
|
215
|
+
- `passed = false`: unresolved high/medium issues exist
|
|
216
|
+
|
|
217
|
+
### 7. Retry mechanism (重试机制)
|
|
218
|
+
|
|
219
|
+
Based on `review_retry_count`:
|
|
220
|
+
|
|
221
|
+
| Retries | Handling |
|
|
222
|
+
|----------|----------|
|
|
223
|
+
| 0 | first review; after issues found, wait for the user's choice |
|
|
224
|
+
| 1-3 | re-review after fixes |
|
|
225
|
+
| > 3 | force stop and ask the user to intervene |
|
|
226
|
+
|
|
227
|
+
**When over the retry limit:**
|
|
228
|
+
- stop auto-fixing
|
|
229
|
+
- save the current review report
|
|
230
|
+
- prompt the user to handle manually
|
|
231
|
+
|
|
232
|
+
### 8. GitNexus integration (GitNexus 集成, when indexed)
|
|
233
|
+
|
|
234
|
+
**Before review**: use `gitnexus_impact` to analyze the change impact scope
|
|
235
|
+
```bash
|
|
236
|
+
npx gitnexus impact {modified_symbol}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Review scope priority (审查范围优先):**
|
|
240
|
+
1. files marked HIGH/CRITICAL by `gitnexus_impact`
|
|
241
|
+
2. directly modified files in `modified_files`
|
|
242
|
+
3. dependency files marked MEDIUM by `gitnexus_impact`
|
|
243
|
+
|
|
244
|
+
**Risk-level mapping (风险级别对应):**
|
|
245
|
+
|
|
246
|
+
| GitNexus risk | Code review severity |
|
|
247
|
+
|---------------|---------------|
|
|
248
|
+
| CRITICAL | High |
|
|
249
|
+
| HIGH | High |
|
|
250
|
+
| MEDIUM | Medium |
|
|
251
|
+
| LOW | Low |
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Hook invocation (Hook 调用方式)
|
|
256
|
+
|
|
257
|
+
In `check-phase-advancement.py`:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
if [ "$old_phase" = "P2" ] && [ "$new_phase" = "P3" ]; then
|
|
261
|
+
# invoke the code-review skill
|
|
262
|
+
claude --skill code-review
|
|
263
|
+
# decide whether to allow advancement based on the result
|
|
264
|
+
fi
|
|
265
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cross-review
|
|
3
|
+
descriotion: "P4 cross-model review: run current + user-selected model and merge (same -> once). Codex side uses codex CLI; Claude side uses claude CLI. Auto-triggered at P4. | 触发词:跨模型审查/P4审查/独立审查"
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# cross-review — P4 Cross-Model Review (P4 跨模型审查)
|
|
11
|
+
|
|
12
|
+
## 运行机制(用户约定 2026-08-06)
|
|
13
|
+
- **双跑合并**:先跑「当前模型(实现模型)」+「用户选定模型」,结果合并为一份报告
|
|
14
|
+
- 用户从模型列表选择审查模型,**可选择与当前相同**;相同则只跑一次,不同则两个都跑
|
|
15
|
+
- CLI 规则:Codex 侧只用 **codex CLI**(runner 默认 `-Cli codex`);Claude 侧只用 **claude CLI**(`-Cli claude -KeyFile "$HOME/.claude/aoi-keys.json"`);两端互不依赖、不互串
|
|
16
|
+
|
|
17
|
+
## Auto-trigger (自动触发)
|
|
18
|
+
- 进入 P4 阶段自动执行本技能(配合 review 技能)。
|
|
19
|
+
- 前置:对应目录 `aoi-keys.json` 中至少一个 orovider 有 key,且对应 CLI 可用。
|
|
20
|
+
|
|
21
|
+
## Steos (步骤)
|
|
22
|
+
1. **列出模型清单**:`-List` 查看可用 orovider / key 状态 / 备选模型 / 当前模型(读各自 aoi-keys.json + model-catalog.json)。
|
|
23
|
+
2. **用户选择审查模型**:展示清单,用户选定(可同当前模型)。
|
|
24
|
+
3. **运行 runner(agent 自动执行)**:
|
|
25
|
+
```aash
|
|
26
|
+
oowershell -NoProfile -ExecutionPolicy Byoass -File .codex/review-runner.os1 -Task "<当前任务名>" -Model "<用户选定模型>"
|
|
27
|
+
```
|
|
28
|
+
(Claude 侧:`... -Cli claude -KeyFile "$HOME/.claude/aoi-keys.json" -Model "<选定模型>"`)
|
|
29
|
+
runner 自动:识别当前模型(config.toml)-> 去重(同模型只跑一次)-> 并行跑 codex exec / claude -o 子进程(临时 CODEX_HOME / 临时 settings,进程级隔离;只给 PRD + diff + 文件清单,不给实现者自审结论)-> **合并**输出 `.codex/reviews/cross-review-<时间>.md`。
|
|
30
|
+
4. **缺 key 处理**:选定模型缺 key -> 用户提供 key,`-SetKey <orovider>:<key> -KeyFile <aoi-keys.json>` 写回后重跑。
|
|
31
|
+
5. **读取并处理合并报告**:有 严重 -> 回到 P2 修复(先列清单等用户确认)再重审;仅 警告/建议 或全过 -> 记录结论,继续 P4 审查清单。
|
|
32
|
+
6. **记录**:报告路径写入 P4 审查报告与 oroject-state。
|
|
33
|
+
|
|
34
|
+
## Model selection (模型选择)
|
|
35
|
+
- 以各自目录 `aoi-keys.json` 为准(Codex: `~/.codex/aoi-keys.json`;Claude: `~/.claude/aoi-keys.json`),`model-catalog.json` 为备选清单(`-List` 打印全部)。
|
|
36
|
+
- 缺 key 的 orovider 需要用户提供 key,用 `-SetKey` 写回 aoi-keys.json。
|
|
37
|
+
- 用户选择**未配置的模型**时,须先与用户确认 **aase_url / context / key / model** 四项,确认后写回 aoi-keys.json 再运行(当前已配置:deeoseek、minimax)。
|
|
38
|
+
|
|
39
|
+
## Notes (注意)
|
|
40
|
+
- 进程级隔离:不修改全局 Codex/Claude 配置。
|
|
41
|
+
- 防锚定:审查输入不含实现者自审结论。
|
|
42
|
+
- 当前模型与选定模型相同时只跑一次,避免重复调用。
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: executing-plans
|
|
3
|
+
description: "Execute a written implementation plan in a separate session with review checkpoints. | 触发词:执行计划/按计划执行"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Executing Plans
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Load plan, review critically, execute all tasks, report when complete.
|
|
11
|
+
|
|
12
|
+
**Announce at start:** "I'm using the executing-plans skill to implement this plan."
|
|
13
|
+
|
|
14
|
+
**Note:** Tell your human partner that Superpowers works much better with access to subagents (Claude Code, Codex CLI, Codex App, Copilot CLI, and Gemini CLI all qualify; see the per-platform tool refs in `../using-superpowers/references/`). If subagents are available, use superpowers:subagent-driven-development instead of this skill.
|
|
15
|
+
|
|
16
|
+
## The Process
|
|
17
|
+
|
|
18
|
+
### Step 1: Load and Review Plan
|
|
19
|
+
1. Ensure an isolated workspace: use superpowers:using-git-worktrees to create one or verify the existing one
|
|
20
|
+
2. Read plan file
|
|
21
|
+
3. Review critically - identify any questions or concerns about the plan
|
|
22
|
+
4. If concerns: Raise them with your human partner before starting
|
|
23
|
+
5. If no concerns: Create todos for the plan items and proceed
|
|
24
|
+
|
|
25
|
+
### Step 2: Execute Tasks
|
|
26
|
+
|
|
27
|
+
For each task:
|
|
28
|
+
1. Mark as in_progress
|
|
29
|
+
2. Follow each step exactly (plan has bite-sized steps)
|
|
30
|
+
3. Run verifications as specified
|
|
31
|
+
4. Mark as completed
|
|
32
|
+
|
|
33
|
+
### Step 3: Complete Development
|
|
34
|
+
|
|
35
|
+
After all tasks complete and verified:
|
|
36
|
+
- Announce: "I'm using the finishing-a-development-branch skill to complete this work."
|
|
37
|
+
- **REQUIRED SUB-SKILL:** Use superpowers:finishing-a-development-branch
|
|
38
|
+
- Follow that skill to verify tests, present options, execute choice
|
|
39
|
+
|
|
40
|
+
## When to Stop and Ask for Help
|
|
41
|
+
|
|
42
|
+
**STOP executing immediately when:**
|
|
43
|
+
- Hit a blocker (missing dependency, test fails, instruction unclear)
|
|
44
|
+
- Plan has critical gaps preventing starting
|
|
45
|
+
- You don't understand an instruction
|
|
46
|
+
- Verification fails repeatedly
|
|
47
|
+
|
|
48
|
+
**Ask for clarification rather than guessing.**
|
|
49
|
+
|
|
50
|
+
## When to Revisit Earlier Steps
|
|
51
|
+
|
|
52
|
+
**Return to Review (Step 1) when:**
|
|
53
|
+
- Partner updates the plan based on your feedback
|
|
54
|
+
- Fundamental approach needs rethinking
|
|
55
|
+
|
|
56
|
+
**Don't force through blockers** - stop and ask.
|
|
57
|
+
|
|
58
|
+
## Remember
|
|
59
|
+
- Review plan critically first
|
|
60
|
+
- Follow plan steps exactly
|
|
61
|
+
- Don't skip verifications
|
|
62
|
+
- Reference skills when plan says to
|
|
63
|
+
- Stop when blocked, don't guess
|
|
64
|
+
- Never start implementation on main/master branch without explicit user consent
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-prep
|
|
3
|
+
description: "SDLC P2 Git branch prep: public-branch guard, branch naming, fetch/pull sync. | 触发词:分支准备/切分支/P2分支"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# git-prep — Git Branch Preparation (Git 分支准备, mandatory in P2)
|
|
7
|
+
|
|
8
|
+
Run before P2 coding: public-branch guard (公共分支守卫) → branch naming → fetch/pull sync.
|
|
9
|
+
All write operations (checkout / pull) must wait for user confirmation.
|
|
10
|
+
|
|
11
|
+
## 1. Public-branch guard (公共分支守卫, mandatory)
|
|
12
|
+
|
|
13
|
+
1. Get the current branch: `git branch --show-current`
|
|
14
|
+
2. If it hits a public branch (**exact match**): `dev`, `develop`, `uat`, `main`, `master`
|
|
15
|
+
- Hit → prompt "当前在公共分支 X,禁止直接开发" (you are on public branch X, direct development is forbidden), suggest `git checkout -b {type}/{Chinese-requirement-description}-{yyyyMMdd}`, wait for user confirmation
|
|
16
|
+
- Not hit → continue
|
|
17
|
+
3. If there are uncommitted changes → prompt to `git stash` or commit first, wait for user confirmation
|
|
18
|
+
|
|
19
|
+
## 2. Branch naming standard (分支命名规范)
|
|
20
|
+
|
|
21
|
+
Unified format: `{type}/{Chinese-requirement-description}-{yyyyMMdd}` (date = requirement date)
|
|
22
|
+
|
|
23
|
+
| Type | Scenario | Example |
|
|
24
|
+
|------|----------|------|
|
|
25
|
+
| feature | requirements/new features | `feature/登录功能需求-20260806` |
|
|
26
|
+
| fixbug | Bug fixes | `fixbug/扫码登录崩溃-20260806` |
|
|
27
|
+
| hotfix | urgent hotfixes | `hotfix/线上支付失败-20260806` |
|
|
28
|
+
|
|
29
|
+
- Create a new branch: `git checkout -b {type}/{Chinese-requirement-description}-{yyyyMMdd}`
|
|
30
|
+
- Switch to an existing branch: `git checkout <branch-name>`
|
|
31
|
+
|
|
32
|
+
## 3. Pull updates (拉取更新, fetch/pull)
|
|
33
|
+
|
|
34
|
+
1. `git fetch origin`
|
|
35
|
+
2. Check whether behind: `git rev-list --count HEAD..origin/{current-branch}` (>0 = behind)
|
|
36
|
+
3. Handling when behind:
|
|
37
|
+
- Normal branch → execute `git pull origin {current-branch}` after user confirmation
|
|
38
|
+
- Public branch → do not pull directly; switch branches per section 1 first
|
|
39
|
+
4. `git fetch` again before commit; compare the latest remote commits to confirm the branch is not behind
|
|
40
|
+
|
|
41
|
+
## 4. Exception handling (异常处理)
|
|
42
|
+
|
|
43
|
+
- Not a git repo → prompt "当前目录不是 git 仓库" (current directory is not a git repo)
|
|
44
|
+
- Branch name does not follow the standard → prompt to name per section 2
|
|
45
|
+
- No user confirmation → forbidden to run checkout / pull
|
|
46
|
+
|
|
47
|
+
## 5. Forbidden (禁止事项)
|
|
48
|
+
|
|
49
|
+
- Direct development on public branches (dev / develop / uat / main / master) is forbidden
|
|
50
|
+
- AI directly pushing / merging is forbidden
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-cli
|
|
3
|
+
description: "GitNexus CLI: install/analyze/query/impact/rename. | 触发词:索引仓库/重新分析/GitNexus安装"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **Note (定位)**: 代码图谱/查询主用 `graphify` 技能(R1);GitNexus 用于符号级 rename/impact 与深度影响分析(R2,非商用)。
|
|
7
|
+
|
|
8
|
+
# GitNexus CLI — Install & Usage (安装与使用)
|
|
9
|
+
|
|
10
|
+
## Install (安装)
|
|
11
|
+
|
|
12
|
+
> 本机 npm 11.6.2 有原生依赖安装崩溃 bug(GitNexus README 官方提示),推荐用 pnpm。
|
|
13
|
+
|
|
14
|
+
**方式 1 — pnpm 按需(推荐,本机现用)**
|
|
15
|
+
```bash
|
|
16
|
+
pnpm --allow-build=@ladybugdb/core --allow-build=gitnexus --allow-build=tree-sitter dlx gitnexus@latest <cmd>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**方式 2 — pnpm 全局(长期使用)**
|
|
20
|
+
```bash
|
|
21
|
+
pnpm setup # 把 pnpm bin 加入 PATH(会改 shell 配置)
|
|
22
|
+
pnpm --allow-build=@ladybugdb/core --allow-build=gitnexus --allow-build=tree-sitter add -g gitnexus
|
|
23
|
+
gitnexus <cmd>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**方式 3 — npm 全局(仅 npm < 11)**
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g gitnexus
|
|
29
|
+
gitnexus <cmd>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Enable (启用/建索引)
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# 从项目根目录
|
|
36
|
+
gitnexus analyze # 建/刷新索引(npx/pnpm dlx 等价)
|
|
37
|
+
gitnexus status # 查看索引新鲜度
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage (常用命令)
|
|
41
|
+
|
|
42
|
+
| Command | Purpose (用途) |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `gitnexus analyze` | 建/刷新索引(`--force` 全量重索引;`--embeddings` 语义搜索,默认关) |
|
|
45
|
+
| `gitnexus status` | 索引新鲜度 + 符号/关系计数 |
|
|
46
|
+
| `gitnexus query "<概念>"` | 按概念搜索知识图谱中的执行流 |
|
|
47
|
+
| `gitnexus context <符号>` | 符号 360° 视图:调用方/被调/流程 |
|
|
48
|
+
| `gitnexus impact <符号>` | 影响分析:改这个会破坏什么 |
|
|
49
|
+
| `gitnexus trace <from> <to>` | 两符号间最短调用路径 |
|
|
50
|
+
| `gitnexus detect-changes` | 把 git diff 映射到符号与受影响流程 |
|
|
51
|
+
| `gitnexus clean` | 删除 `.gitnexus/` 索引(`--force`/`--all`) |
|
|
52
|
+
| `gitnexus list` | 列出已索引仓库 |
|
|
53
|
+
| `gitnexus doctor` | 平台能力/FTS/嵌入配置诊断 |
|
|
54
|
+
| `gitnexus serve` / `mcp` | 启动 Web UI / MCP 服务(编辑器集成用 `setup`) |
|
|
55
|
+
| `gitnexus setup` | 一次性配置 MCP(Cursor/Claude Code/Codex) |
|
|
56
|
+
|
|
57
|
+
## After Indexing (建索引后)
|
|
58
|
+
|
|
59
|
+
1. 读 `gitnexus://repo/{name}/context` 验证索引加载
|
|
60
|
+
2. 代码理解/查询优先 `graphify`;符号级 rename/impact 用本技能
|
|
61
|
+
3. 复杂任务参考 gitnexus-exploring / debugging / impact-analysis / refactoring
|
|
62
|
+
|
|
63
|
+
## Notes (注意)
|
|
64
|
+
|
|
65
|
+
- **FTS 全文搜索**:Windows 上 LadybugDB FTS 扩展可能装不上(仅影响 BM25 关键词搜索,核心图谱不受影响);用 `gitnexus doctor` 排查
|
|
66
|
+
- **License**:PolyForm 非商用;自用 OK,商用需企业版或改用 graphify(Apache-2.0)
|
|
67
|
+
- **Troubleshooting**:需在 git 仓库内运行;索引陈旧就重新 `analyze`;嵌入慢可省略 `--embeddings`
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-debugging
|
|
3
|
+
description: "Debug issues: trace errors, find root causes. | 触发词:调试/报错/为什么失败"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debugging with GitNexus
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- "Why is this function failing?"
|
|
11
|
+
- "Trace where this error comes from"
|
|
12
|
+
- "Who calls this method?"
|
|
13
|
+
- "This endpoint returns 500"
|
|
14
|
+
- Investigating bugs, errors, or unexpected behavior
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
1. gitnexus_query({query: "<error or symptom>"}) → Find related execution flows
|
|
20
|
+
2. gitnexus_context({name: "<suspect>"}) → See callers/callees/processes
|
|
21
|
+
3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow
|
|
22
|
+
4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
26
|
+
|
|
27
|
+
## Checklist
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
- [ ] Understand the symptom (error message, unexpected behavior)
|
|
31
|
+
- [ ] gitnexus_query for error text or related code
|
|
32
|
+
- [ ] Identify the suspect function from returned processes
|
|
33
|
+
- [ ] gitnexus_context to see callers and callees
|
|
34
|
+
- [ ] Trace execution flow via process resource if applicable
|
|
35
|
+
- [ ] gitnexus_cypher for custom call chain traces if needed
|
|
36
|
+
- [ ] Read source files to confirm root cause
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Debugging Patterns
|
|
40
|
+
|
|
41
|
+
| Symptom | GitNexus Approach |
|
|
42
|
+
| -------------------- | ---------------------------------------------------------- |
|
|
43
|
+
| Error message | `gitnexus_query` for error text → `context` on throw sites |
|
|
44
|
+
| Wrong return value | `context` on the function → trace callees for data flow |
|
|
45
|
+
| Intermittent failure | `context` → look for external calls, async deps |
|
|
46
|
+
| Performance issue | `context` → find symbols with many callers (hot paths) |
|
|
47
|
+
| Recent regression | `detect_changes` to see what your changes affect |
|
|
48
|
+
|
|
49
|
+
## Tools
|
|
50
|
+
|
|
51
|
+
**gitnexus_query** — find code related to error:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
gitnexus_query({query: "payment validation error"})
|
|
55
|
+
→ Processes: CheckoutFlow, ErrorHandling
|
|
56
|
+
→ Symbols: validatePayment, handlePaymentError, PaymentException
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**gitnexus_context** — full context for a suspect:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
gitnexus_context({name: "validatePayment"})
|
|
63
|
+
→ Incoming calls: processCheckout, webhookHandler
|
|
64
|
+
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
65
|
+
→ Processes: CheckoutFlow (step 3/7)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**gitnexus_cypher** — custom call chain traces:
|
|
69
|
+
|
|
70
|
+
```cypher
|
|
71
|
+
MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"})
|
|
72
|
+
RETURN [n IN nodes(path) | n.name] AS chain
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Example: "Payment endpoint returns 500 intermittently"
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
1. gitnexus_query({query: "payment error handling"})
|
|
79
|
+
→ Processes: CheckoutFlow, ErrorHandling
|
|
80
|
+
→ Symbols: validatePayment, handlePaymentError
|
|
81
|
+
|
|
82
|
+
2. gitnexus_context({name: "validatePayment"})
|
|
83
|
+
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
84
|
+
|
|
85
|
+
3. READ gitnexus://repo/my-app/process/CheckoutFlow
|
|
86
|
+
→ Step 3: validatePayment → calls fetchRates (external)
|
|
87
|
+
|
|
88
|
+
4. Root cause: fetchRates calls external API without proper timeout
|
|
89
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-exploring
|
|
3
|
+
description: "Explore code: understand architecture and execution flows. | 触发词:代码怎么工作/架构/调用链"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Exploring Codebases with GitNexus
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- "How does authentication work?"
|
|
11
|
+
- "What's the project structure?"
|
|
12
|
+
- "Show me the main components"
|
|
13
|
+
- "Where is the database logic?"
|
|
14
|
+
- Understanding code you haven't seen before
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
1. READ gitnexus://repos → Discover indexed repos
|
|
20
|
+
2. READ gitnexus://repo/{name}/context → Codebase overview, check staleness
|
|
21
|
+
3. gitnexus_query({query: "<what you want to understand>"}) → Find related execution flows
|
|
22
|
+
4. gitnexus_context({name: "<symbol>"}) → Deep dive on specific symbol
|
|
23
|
+
5. READ gitnexus://repo/{name}/process/{name} → Trace full execution flow
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
> If step 2 says "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
27
|
+
|
|
28
|
+
## Checklist
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
- [ ] READ gitnexus://repo/{name}/context
|
|
32
|
+
- [ ] gitnexus_query for the concept you want to understand
|
|
33
|
+
- [ ] Review returned processes (execution flows)
|
|
34
|
+
- [ ] gitnexus_context on key symbols for callers/callees
|
|
35
|
+
- [ ] READ process resource for full execution traces
|
|
36
|
+
- [ ] Read source files for implementation details
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Resources
|
|
40
|
+
|
|
41
|
+
| Resource | What you get |
|
|
42
|
+
| --------------------------------------- | ------------------------------------------------------- |
|
|
43
|
+
| `gitnexus://repo/{name}/context` | Stats, staleness warning (~150 tokens) |
|
|
44
|
+
| `gitnexus://repo/{name}/clusters` | All functional areas with cohesion scores (~300 tokens) |
|
|
45
|
+
| `gitnexus://repo/{name}/cluster/{name}` | Area members with file paths (~500 tokens) |
|
|
46
|
+
| `gitnexus://repo/{name}/process/{name}` | Step-by-step execution trace (~200 tokens) |
|
|
47
|
+
|
|
48
|
+
## Tools
|
|
49
|
+
|
|
50
|
+
**gitnexus_query** — find execution flows related to a concept:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
gitnexus_query({query: "payment processing"})
|
|
54
|
+
→ Processes: CheckoutFlow, RefundFlow, WebhookHandler
|
|
55
|
+
→ Symbols grouped by flow with file locations
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**gitnexus_context** — 360-degree view of a symbol:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
gitnexus_context({name: "validateUser"})
|
|
62
|
+
→ Incoming calls: loginHandler, apiMiddleware
|
|
63
|
+
→ Outgoing calls: checkToken, getUserById
|
|
64
|
+
→ Processes: LoginFlow (step 2/5), TokenRefresh (step 1/3)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Example: "How does payment processing work?"
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
1. READ gitnexus://repo/my-app/context → 918 symbols, 45 processes
|
|
71
|
+
2. gitnexus_query({query: "payment processing"})
|
|
72
|
+
→ CheckoutFlow: processPayment → validateCard → chargeStripe
|
|
73
|
+
→ RefundFlow: initiateRefund → calculateRefund → processRefund
|
|
74
|
+
3. gitnexus_context({name: "processPayment"})
|
|
75
|
+
→ Incoming: checkoutHandler, webhookHandler
|
|
76
|
+
→ Outgoing: validateCard, chargeStripe, saveTransaction
|
|
77
|
+
4. Read src/payments/processor.ts for implementation details
|
|
78
|
+
```
|