chore(migration): Cursor → Claude Code 反向迁移 + 单轨化(v2)
- 删除 5 个 AGENTS.md(根 + 4 子模块)与 .cursor/、.cursorignore,全部已备份 - 在 CLAUDE.md 末尾追加 5 节迁移必需内容(CLI/Shell 中文与编码、Claude Code 资产入口、Hook 与权限、不破坏原则、历史追溯),保留用户选定的 226 行项目规则全集 - 用户级 12 个 skills 从 ~/.cursor/skills/ 剥包装回迁到 ~/.claude/skills/(neozqyy-cursor-migration → neozqyy-claude-code-migration) - docs/ai-env-history/ 顶层 10 文件入仓(含 conversation_index.csv、file_impact_index.csv,已脱敏);sessions/ 原文继续本地保留 - 新增 tools/claude-code/migrate_ai_environment.py(--check 14/14 通过) - 新增 docs/claude_code_migration.md 与 docs/audit/changes/2026-05-02__claude_code_migration.md - .gitignore 调整:开放 2 个 CSV 索引入仓,保留 sessions/ 与 claude-history/ 排除 - 不混入 124 个业务变更(AI 模块重构、runtime_context、sandbox 等保持 unstaged) - 备份位置:~/.claude/backups/pre-claude-code-migration-2026-05-02/ 第二轮迁移(第一轮 commit 6facb2d 已被 git reset 回滚;本轮策略为追加而非重写 CLAUDE.md)
This commit is contained in:
53
CLAUDE.md
53
CLAUDE.md
@@ -17,6 +17,17 @@
|
||||
|
||||
禁止在回复中使用英文段落或英文标题(技术术语、代码片段、专有名词内嵌除外)。
|
||||
|
||||
## CLI / Shell 中文与编码(强制)
|
||||
|
||||
- Python:`encoding="utf-8"`;必要时设 `PYTHONUTF8=1`。
|
||||
- CSV 给 Excel 打开时用 `utf-8-sig`(带 BOM)。
|
||||
- PowerShell / Node / Shell:不依赖系统默认 ANSI 编码;输出中文时优先 UTF-8。
|
||||
- 终端中文乱码时**不要把乱码当作事实**:先调编码重跑,或明确说明"终端编码异常,结果需复核",转述可确认的信息。
|
||||
- Shell 路径含中文/空格/特殊字符必须正确加引号。
|
||||
- 复杂中文输出走脚本或结构化 API(JSON),避免手写脆弱 shell 转义。
|
||||
- PowerShell 不支持 Bash 风格 heredoc:复杂中文片段用 here-string 管道传给 Python。
|
||||
- Python 文档模板里的 Windows 路径(`C:\Users\...`)注意反斜杠转义,避免 Unicode 转义错误。
|
||||
|
||||
## 项目概览
|
||||
|
||||
NeoZQYY Monorepo — 面向台球门店业务的全栈数据平台。多门店隔离(`site_id` + RLS),领域语言中文,货币 CNY,金额 `numeric(2)`。
|
||||
@@ -208,7 +219,49 @@ cd apps/miniprogram && npm test # 小程序 Jest
|
||||
预扫描脚本支持 `--files` 参数:当 git status 包含大量历史未提交变更时,可只传入本次会话涉及的文件列表。
|
||||
|
||||
已废弃(不再使用):
|
||||
|
||||
- Prompt-ID 溯源、`docs/audit/prompt_logs/` — Claude Code 原生 session 日志已覆盖
|
||||
- AI_CHANGELOG 文件内标记 — git blame 替代
|
||||
- CHANGE 块级代码标记 — git blame 替代
|
||||
- Session 日志 (`docs/audit/session_logs/`) — Claude Code 原生 session 存储已覆盖
|
||||
|
||||
## Claude Code 资产入口
|
||||
|
||||
| 资产 | 位置 |
|
||||
|------|------|
|
||||
| 项目 slash 命令 | `.claude/commands/*.md`(5 个:`/audit` `/db-docs` `/doc-sync` `/pre-change` `/spec-close`) |
|
||||
| 项目 hooks | `.claude/hooks/*.py` + `.claude/settings.json` |
|
||||
| 项目设置 | `.claude/settings.json` / `.claude/settings.local.json`(PATH/虚拟环境) |
|
||||
| 项目 MCP | `.mcp.json`(**单一权威源**) |
|
||||
| 用户级 subagents(8 个) | `~/.claude/agents/`(planner / architect / code-reviewer / security-reviewer / database-reviewer / python-reviewer / tdd-guide / refactor-cleaner) |
|
||||
| 用户级 skills | `~/.claude/skills/<name>/SKILL.md` |
|
||||
| 用户级 rules(自动加载) | `~/.claude/rules/{python,typescript,web,zh}/` |
|
||||
| 自动记忆 | `~/.claude/projects/c--Project-NeoZQYY/memory/` |
|
||||
|
||||
## Hook 与权限
|
||||
|
||||
项目已注册的 hooks(见 `.claude/settings.json`):
|
||||
|
||||
| 时机 | Hook | 行为 |
|
||||
|------|------|------|
|
||||
| SessionStart | `session_start_context.py` | 注入项目状态摘要 |
|
||||
| PreToolUse (Read/Edit/Write/Glob) | `pre_read_archived_block.py` | 强阻断 `_archived/` 目录读取 |
|
||||
| PreToolUse (Bash/Edit/Write) | `pre_demo_protect.py` | 提醒 `demo-miniprogram` 保护 |
|
||||
| PostToolUse (Edit/Write) | `post_edit_audit_reminder.py` | 提醒审计 |
|
||||
| PostToolUse (Edit/Write) | `post_edit_db_doc_sync.py` | 提醒 DB 文档同步 |
|
||||
| PostToolUse (Edit/Write) | `post_edit_rls_dual_schema.py` | RLS 双 schema 检查 |
|
||||
| Stop | `stop_audit_check.py` / `stop_verify_check.py` | 收尾审计/验证检查 |
|
||||
|
||||
## 不破坏原则
|
||||
|
||||
- 不回滚用户已有改动,不使用破坏性 git 命令(`reset --hard` / `push --force` / `checkout .`),除非用户明确要求
|
||||
- 不修改 `apps/demo-miniprogram/`(MOCK 标杆,禁改)
|
||||
- 不写入 `_archived/` 目录
|
||||
- 不在测试库以外执行 DDL / TRUNCATE / DELETE
|
||||
|
||||
## 历史追溯
|
||||
|
||||
- 日常追溯先查精简索引:`docs/ai-env-history/README.md`、`docs/audit/changes/`、`docs/audit/audit_dashboard.md`
|
||||
- 历史摘要只解释来龙去脉,编码前以**当前文件、当前 diff、当前测试**为准
|
||||
- 原始 JSONL 可追查细节,但**不要把密钥、DSN、token 原文写入仓库文档**
|
||||
- 迁移路径:旧服务器 → 本机 → Claude Code → Codex → Cursor → **Claude Code(当前)**;详见 `docs/claude_code_migration.md`
|
||||
|
||||
Reference in New Issue
Block a user