Ariver
2026-07-13 2d1d4ad406228ef62ab078724cb7d1556e003d01
CODEGRAPH.md
@@ -1,61 +1,34 @@
# CODEGRAPH
# PrivateVoice-independent-developer CODEGRAPH
## Project
最后整理:2026-07-11
- Product: Wails v3 / Go desktop dictation app.
- Current branch purpose: Windows technical preview based on `v2.1.38-build20260629.2014-diagnostic`.
- Protected macOS behavior: existing macOS App Store / local DMG build lines are not changed by this branch.
## 工程范围
## Core Entrypoints
- 项目根:`/Users/ar/Projects/PrivateVoice`
- Git 根:`/Users/ar/Projects/PrivateVoice/03-O`
- 分支:`independent-developer`
- 源码冻结基线:`a075aec123e1f7118f138738f196c2995aa96f98`;项目初始化元数据提交见 `git log`。
- 基线标签:`v2.2.2-build20260703.0335-real-user-test`
- 源码根:`/Users/ar/Projects/PrivateVoice/03-O/C1.source/privatevoice.src`
- 自动图谱:`/Users/ar/Projects/PrivateVoice/03-O/.codebase-memory/`;只辅助定位。
- `privatevoice.src/main.go`: process startup, data migration, logger, single-instance guard.
- `privatevoice.src/app.go`: Wails app wiring, settings window, tray, recorder, hotkey loop, ASR init, paste orchestration.
- `privatevoice.src/embed.go`: embeds frontend assets and app/tray icons.
## 核心入口
## Platform Modules
- 启动与应用 wiring:`C1.source/privatevoice.src/main.go`、`app.go`。
- macOS 文字输出:`C1.source/privatevoice.src/internal/input/paste_darwin.go`。
- 音频:`C1.source/privatevoice.src/internal/audio/recorder.go`。
- macOS 热键:`C1.source/privatevoice.src/internal/hotkey/hotkey_darwin.go`。
- 本地 ASR:`C1.source/privatevoice.src/internal/engine/engine_darwin.go`。
- 本地 DMG:`C1.source/privatevoice.src/scripts/build-local-macos.sh`。
- Developer ID / notarization:`C1.source/privatevoice.src/scripts/build-release-macos.sh`。
- Audio: `privatevoice.src/internal/audio/recorder.go`
  - Uses `github.com/gen2brain/malgo`.
  - Cross-platform capture target: 16 kHz, 16-bit, mono.
- Hotkey:
  - macOS: `privatevoice.src/internal/hotkey/hotkey_darwin.go`
  - Windows: `privatevoice.src/internal/hotkey/hotkey_windows.go`
- Text input:
  - macOS: `privatevoice.src/internal/input/paste_darwin.go`
  - Windows: `privatevoice.src/internal/input/paste_windows.go`
- ASR engine:
  - macOS: `privatevoice.src/internal/engine/engine_darwin.go`
  - Windows: `privatevoice.src/internal/engine/engine_windows.go`
- Overlay:
  - macOS: `privatevoice.src/internal/overlay/overlay_darwin.go`
  - Windows: `privatevoice.src/internal/overlay/overlay_windows.go`
## 当前基线保护
## Windows Preview Scope
- 本项目当前只代表 2.2.2 / 20260703.0335 旧代码;不得把后续 MAS AX router、MAS sandbox 实验或 2.2.3 改造直接复制进来。
- 既有 macOS、Windows preview、模型下载安全、paste/clipboard 保护行为未经独立任务和 QA 计划不得改动。
- Developer ID 直接输入、签名、公证、安装、更新与回滚是后续独立任务,不得从历史文档直接宣称已完成。
- Windows preview supports `SenseVoice` only.
- Non-SenseVoice models remain visible in settings but are disabled through `model.IsModelSupportedInCurrentBuild`.
- Windows unsupported reason: `windows_preview_unsupported`.
- Build script: `privatevoice.src/scripts/build-windows-preview.sh`.
- Runtime package includes:
  - `PrivateVoice Dictation.exe`
  - `onnxruntime.dll`
  - `sherpa-onnx-c-api.dll`
  - `sherpa-onnx-cxx-api.dll`
  - `README-WINDOWS-PREVIEW.txt`
## 自动图谱与维护
## Standard Verification Commands
Run from `privatevoice.src`:
```bash
npm --prefix frontend run build
go test ./...
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go test -exec=/usr/bin/true ./...
./scripts/build-windows-preview.sh
```
## Known Gaps
- Windows runtime QA must still be performed on Windows 10/11 hardware.
- The Windows preview zip is unsigned and not an installer.
- SmartScreen / Defender prompts are expected for local testing.
- 生成命令:`codebase-memory-mcp cli index_repository '{"repo_path":"/Users/ar/Projects/PrivateVoice/03-O"}'`
- `CODEGRAPH.md` 是人工代码地图;每次源码冻结、版本冻结或发布候选前更新并记录 indexed commit。