Files
a-share-analysis/AGENTS.md
T

65 lines
4.1 KiB
Markdown

# A 股市场分析工具开发约束
本文件是仓库内所有开发代理和开发者必须遵守的入口规范。详细规则见:
- `docs/governance/code-development-standards.md`
- `docs/governance/development-workflow.md`
- `docs/governance/documentation-traceability.md`
- `docs/governance/version-control-and-gitea.md`
## 强制要求
1. 修改生产代码前必须执行 `npm run governance:start -- <功能编号> <短名称>`,刷新 GitNexus,并完成开发前影响分析。
2. 修改完成后必须执行测试、构建、视觉验证和 `npm run governance:finish -- <功能编号> <短名称>`,再次刷新 GitNexus并保存前后对比。
3. 任何功能必须先有 `docs/features/<功能编号>-<短名称>/` 功能档案;没有 PRD、需求、设计、计划和回退说明不得视为完成。
4. Git 提交必须使用中文 Conventional Commit,并带功能编号;禁止英文摘要和含糊提交信息。
5. 代码必须为关键业务逻辑、数据口径、异常恢复和架构取舍提供准确的中文注释;禁止无意义逐行注释。
6. 文件按稳定职责拆分,不以追求“原子化”为目的过度拆分。优先保证普通开发者能够连续阅读完整业务流程。
7. 不使用 GitHub。当前只使用本地 Git,远程仓库仅在用户安装 Gitea 后配置。
8. 禁止提交密钥、真实凭据、生产数据、`.env` 和 GitNexus 本地索引。
9. 开发完成后必须先通过代码 Review 和开发规范符合性 Review,再进入发布;Review 结论和问题处置必须写入功能档案。
<!-- gitnexus:start -->
# GitNexus — Code Intelligence
This project is indexed by GitNexus as **a-share-analysis** (300 symbols, 325 relationships, 0 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.
## Always Do
- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `gitnexus_impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user.
- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows.
- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`.
## Never Do
- NEVER edit a function, class, or method without first running `gitnexus_impact` on it.
- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph.
- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope.
## Resources
| Resource | Use for |
|----------|---------|
| `gitnexus://repo/a-share-analysis/context` | Codebase overview, check index freshness |
| `gitnexus://repo/a-share-analysis/clusters` | All functional areas |
| `gitnexus://repo/a-share-analysis/processes` | All execution flows |
| `gitnexus://repo/a-share-analysis/process/{name}` | Step-by-step execution trace |
## CLI
| Task | Read this skill file |
|------|---------------------|
| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` |
| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` |
| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` |
| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` |
| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` |
| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` |
<!-- gitnexus:end -->