最后更新:2026-06-28
这是 Aligner 自维护的轻量工程地图,用来减少后续任务的代码定位成本和上下文重建 token。它不是完整架构文档,也不是自动生成的调用图;它只记录稳定入口、影响面、QA 入口和已保护行为。
Aligner2 同时维护两类代码地图:
codegraph:人工维护的本文件,记录模块边界、关键入口、受保护行为、QA 入口和最后验证基线。codebase-memory:codebase-memory-mcp 生成的自动代码知识图谱,保存到 ../.codebase-memory/graph.db.zst,用于查询调用链、影响面、死代码候选和架构概览。两者不互相替代。自动图谱结果必须回读源码、测试和 QA 证据。
使用规则:
当前基线:
0.1.xv0.1.12-build20260625.23200.1.12 / 20260625.2320swift build、swift test、round015-entitlement-fixture-qa.sh、round1-main-ui-qa.sh 通过;主 UI QA 日志目录 /tmp/aligner-round01-main-ui-qa-20260628_210821。0.1.12 是本地 QA 候选代码冻结 / rollback baseline;不是正式官网 release,Developer ID、notarization、staple、Gatekeeper、macOS 14 Phase C、下载源和正式发布 manifest 仍未闭环。/Users/ar/Projects/Aligner2/03-O/Users/ar/Projects/Aligner2/03-O/C1.source/Users/ar/Projects/Aligner2/03-O/.codebase-memory/graph.db.zstUsers-ar-Projects-Aligner2-03-OC1.source、C3.tools3988 nodes / 12382 edges以下情况必须更新 CODEGRAPH:
| Node | 负责范围 | 优先读取 |
|---|---|---|
QuickSwitch.Session |
overlay 生命周期、回调 wiring、提交窗口、Space 点击、关闭请求 | Sources/Aligner/QuickSwitchSessionController.swift |
QuickSwitch.View |
三栏 UI、App Shelf、Waterfall、主题、键盘和鼠标交互 | Sources/Aligner/QuickSwitchRootView.swift |
QuickSwitch.Waterfall |
纵栏 / 横栏瀑布、卡片、缩略图、对齐和过滤态动画 | Sources/Aligner/QuickSwitchRootView.swift |
QuickSwitch.Snapshot |
窗口候选集、App 分组、窗口排序、Space 主归属 | Sources/AlignerCore/Windows/QuickSwitchSnapshot.swift |
QuickSwitch.ViewModel |
Space Lane / App Shelf / Waterfall 的展示模型和 Space 过滤投影 | Sources/AlignerCore/Windows/QuickSwitchViewModel.swift |
QuickSwitch.Focus |
初始选择、方向键移动、视觉优先级 | Sources/AlignerCore/Windows/QuickSwitchFocusPolicy.swift |
QuickSwitch.Windows |
CG/AX 窗口枚举、激活、关闭、Finder 多页签 | Sources/Aligner/Infrastructure/Windows/CGWindowAXWindowService.swift |
QuickSwitch.Spaces |
Space 枚举、窗口 Space 归属、Space 激活 | Sources/Aligner/Infrastructure/PrivateAPI/SkyLightSpaceEnumerator.swift |
QuickSwitch.ThemeAndSettings |
视图模式、主题、设置持久化、Settings 入口 | Sources/AlignerCore/Preferences/AlignerPreferences.swift |
QuickSwitch.TriggerAndPermissions |
快捷键、权限、Force Quit 放行、权限窗口 | Sources/Aligner/AlignerApplicationDelegate.swift |
QuickSwitch.Screenshots |
真实截图、ScreenCaptureKit、骨架 fallback | Sources/AlignerCore/Screenshots/ScreenCaptureKitScreenshotProvider.swift |
Commerce.Entitlement |
Round01.5 试用、授权、Pro feature gate 模型 | Sources/AlignerCore/Commerce/ |
职责:
核心文件:
Sources/Aligner/QuickSwitchSessionController.swiftSources/Aligner/QuickSwitchOverlayHost.swiftSources/Aligner/OverlayWindowController.swiftSources/Aligner/WindowCoordinator.swiftSources/Aligner/AlignerApplicationDelegate.swift关键入口:
QuickSwitchSessionController.show(...)QuickSwitchSessionController.hide(reason:)QuickSwitchSessionController.commitSelection(_:source:)QuickSwitchSessionController.handleSpaceLaneClick(_:clickCount:)QuickSwitchSessionController.requestClose(_:)AlignerApplicationDelegate.applicationShouldHandleReopen(_:hasVisibleWindows:)已保护行为:
Option+Tab 打开后 view 必须成为 first responder,键盘立即可用。Option+Tab 的打开路径;不得改主题、视图模式或布局选择。Command+Option+Esc 不得被 Aligner 阻挡。.requested 时不做乐观删除;必须刷新验证目标是否真的消失。windowNotFound 时允许从当前展示中移除,避免用户继续点残留卡片。QA 入口:
../C3.tools/round1-quick-switch-entry-qa.sh../C3.tools/round1-trigger-session-qa.sh../C3.tools/round1-dock-reopen-fixture-qa.sh../C3.tools/round1-overlay-qa.sh../C3.tools/round1-main-ui-qa.sh../C3.tools/round1-close-fixture-qa.sh../C2.builds/Z-研发中间产物/qa-reports/round01-trigger-session-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-dock-reopen-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-overlay-qa-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-close-card-confirmation-report.json职责:
核心文件:
Sources/AlignerCore/Windows/QuickSwitchSnapshot.swiftSources/AlignerCore/Windows/WindowEnumerationPolicy.swiftSources/AlignerCore/Windows/FinderTabSpaceAttributionPolicy.swiftSources/AlignerCore/Spaces/WindowSpaceMappingPolicy.swiftSources/AlignerCore/Spaces/SpaceEnumerationPolicy.swiftSources/Aligner/QuickSwitchSnapshotLoader.swiftSources/Aligner/Infrastructure/Windows/CGWindowAXWindowService.swift关键入口:
QuickSwitchSnapshotBuilder.snapshot(displays:windows:)WindowEnumerationPolicy.window(from:)FinderTabSpaceAttributionPolicy.attributedRecords(_:)WindowSpaceMappingPolicy.mergedSpaceIDsByWindowID(...)LiveQuickSwitchSnapshotLoader.load()已保护行为:
QA 入口:
Tests/AlignerCoreTests/AlignerCoreTests.swift../C3.tools/round1-candidate-filter-fixture-qa.sh../C3.tools/round1-finder-tabs-live-qa.sh../C3.tools/round1-minimized-window-qa.sh../C3.tools/round1-session-snapshot-qa.sh../C2.builds/Z-研发中间产物/qa-reports/round01-multi-page-activation-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-multi-page-close-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-minimized-window-qa-snapshot.json职责:
核心文件:
Sources/AlignerCore/Windows/QuickSwitchViewModel.swiftSources/AlignerCore/Windows/QuickSwitchFocusPolicy.swift关键入口:
QuickSwitchViewModelBuilder.viewModel(from:currentSpaceIDs:)QuickSwitchSpaceFilterPolicy.projectedViewModel(from:lockedSpaceID:preferredSelection:)QuickSwitchSpaceFilterPolicy.singleFullscreenSelection(inSpaceID:viewModel:)QuickSwitchFocusPolicy.initialSelection(in:)QuickSwitchFocusPolicy.nextSelection(from:in:direction:columnHistory:)已保护行为:
QA 入口:
Tests/AlignerCoreTests/AlignerCoreTests.swift../C3.tools/round1-space-filter-fixture-qa.sh../C3.tools/round1-space-lane-split-view-fixture-qa.sh../C2.builds/Z-研发中间产物/qa-reports/round01-space-filter-switch-a2-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-space-filter-fullscreen-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-space-lane-split-view-fixture-report.json职责:
核心文件:
Sources/Aligner/QuickSwitchRootView.swift关键入口:
QuickSwitchRootView.keyDown(with:)QuickSwitchRootView.performKeyboardCommand(_:)QuickSwitchRootView.handleAppShelfIndexKey(_:)QuickSwitchRootView.handleWindowIndexKey(symbol:)QuickSwitchRootView.focusAppShelfItemForKeyboard(...)QuickSwitchRootView.moveKeyboardAppFocus(cycleForward:)QuickSwitchRootView.moveVerticalSelectionWithinFocusedColumn(_:)QuickSwitchRootView.moveSelection(_:)QuickSwitchRootView.commitCurrentSelection()QuickSwitchRootView.makeDebugReport()已保护行为:
1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ,最多 36 个一键入口。magneticNeighbor,也不触发 hover 语义、不显示 close button、不联动 Waterfall。QA 入口:
../C3.tools/round1-keyboard-navigation-fixture-qa.sh../C3.tools/round1-vertical-keyboard-app-focus-fixture-qa.sh../C3.tools/round1-mouse-interaction-fixture-qa.sh../C3.tools/round1-app-shelf-fixture-qa.sh../C3.tools/round1-horizontal-waterfall-fixture-qa.sh../C3.tools/round1-window-index-progressive-filter-fixture-qa.sh../C2.builds/Z-研发中间产物/qa-reports/round01-keyboard-navigation-fixture-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-horizontal-waterfall-keyboard-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-app-shelf-fixture-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-app-shelf-horizontal-fixture-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-app-shelf-narrow-fixture-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-app-shelf-dark-fixture-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-app-shelf-hover-persist-vertical-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-app-shelf-hover-persist-horizontal-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-vertical-keyboard-window-shortcut-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-horizontal-waterfall-window-shortcut-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-window-index-progressive-filter-commit-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-window-index-progressive-filter-single-window-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-window-index-progressive-filter-horizontal-light-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-window-index-progressive-filter-horizontal-dark-report.json职责:
核心文件:
Sources/Aligner/QuickSwitchRootView.swiftSources/AlignerCore/Preferences/AlignerPreferences.swift关键入口:
QuickSwitchRootView.setWaterfallViewMode(_:)QuickSwitchRootView.rebuildWaterfallColumns()QuickSwitchRootView.layoutLayers()QuickSwitchRootView.ensureCurrentSelectionVisible(...)QuickSwitchRootView.waterfallColumnVisualStates(for:)QuickSwitchRootView.waterfallCardVisualStates(for:)已保护行为:
QA 入口:
../C3.tools/round1-waterfall-fixture-qa.sh../C3.tools/round1-horizontal-waterfall-fixture-qa.sh../C3.tools/round1-app-column-alignment-fixture-qa.sh../C3.tools/round1-app-shelf-fixture-qa.sh../C3.tools/round1-view-mode-entry-qa.sh../C2.builds/Z-研发中间产物/qa-reports/round01-waterfall-fixture-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-horizontal-waterfall-layout-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-horizontal-waterfall-filter-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-app-column-alignment-regular-hover-middle-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-view-mode-entry-horizontal-report.json职责:
核心文件:
Sources/Aligner/Infrastructure/PrivateAPI/SkyLightSpaceEnumerator.swiftSources/Aligner/Infrastructure/PrivateAPI/SkyLightOverlayScreenSpaceStateProvider.swiftSources/Aligner/Infrastructure/PrivateAPI/PrivateSpaceActivationBridge.swiftSources/Aligner/SpaceActivationService.swiftSources/AlignerCore/Spaces/SpaceEnumerationPolicy.swiftSources/AlignerCore/Spaces/WindowSpaceMappingPolicy.swiftSources/Aligner/QuickSwitchSessionController.swiftSources/Aligner/QuickSwitchRootView.swift关键入口:
SpaceEnumerationPolicy.normalizedDisplays(from:knownPhysicalDisplayUUIDs:)WindowSpaceMappingPolicy.mergedSpaceIDsByWindowID(...)QuickSwitchSessionController.handleSpaceLaneClick(_:clickCount:)QuickSwitchSessionController.activateLockedSpace(_:)QuickSwitchRootView.visualStates(for:)QuickSwitchRootView.spaceLaneDebugReports()已保护行为:
QA 入口:
../C3.tools/round1-space-filter-fixture-qa.sh../C3.tools/round1-space-lane-dark-hover-fixture-qa.sh../C3.tools/round1-space-lane-split-view-fixture-qa.sh../C3.tools/round1-three-zone-linkage-fixture-qa.sh../C3.tools/round1-obsidian-space-activation-qa.sh../C2.builds/Z-研发中间产物/qa-reports/round01-space-dark-hover-light-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-space-dark-hover-split-base-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-three-zone-linkage-space-click-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-space-filter-lock-then-fullscreen-report.json职责:
核心文件:
Sources/Aligner/Infrastructure/Windows/CGWindowAXWindowService.swiftSources/Aligner/Infrastructure/PrivateAPI/PrivateWindowActivationBridge.swiftSources/Aligner/DebugWindowActivationService.swiftSources/Aligner/DebugWindowCloseService.swiftSources/Aligner/QuickSwitchCloseRequest.swiftSources/AlignerCore/Protocols/ServiceProtocols.swift关键入口:
CGWindowAXWindowService.visibleWindows(for:)CGWindowAXWindowService.activate(window:)CGWindowAXWindowService.close(window:)CGWindowAXWindowService.close(app:)PrivateWindowActivationBridge.activate(windowID:processIdentifier:)PrivateAXWindowIDReader.windowID(for:)已保护行为:
lastActivationDurationMilliseconds,用于 QA 判断窗口提交耗时。.appActivatedOnly 当成成功;该结果只表示 App 激活诊断,不证明目标窗口已前置。AXFocusedWindow、AXMain、AXRaise,AX 短暂缺失或首次动作失败时允许一次短重读重试。QA 入口:
../C3.tools/round1-window-activation-fixture-qa.sh../C3.tools/round1-finder-tabs-live-qa.sh../C3.tools/round1-multi-page-identity-fixture-qa.sh../C3.tools/round1-mouse-interaction-fixture-qa.sh../C3.tools/round1-horizontal-waterfall-fixture-qa.sh../C3.tools/round1-obsidian-space-activation-qa.sh../C3.tools/round1-close-fixture-qa.sh../C3.tools/round1-main-ui-qa.sh../C2.builds/Z-研发中间产物/qa-reports/round01-window-activation-normal-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-window-activation-failure-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-mouse-app-only-fixture-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-mouse-interaction-fixture-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-multi-page-activation-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-multi-page-close-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-close-card-optout-toggle-report.json职责:
核心文件:
Sources/AlignerCore/Preferences/AlignerPreferences.swiftSources/Aligner/AlignerApplicationDelegate.swiftSources/Aligner/SettingsWindowController.swiftSources/Aligner/QuickSwitchRootView.swift关键入口:
PreferenceKey.quickSwitchWaterfallViewModePreferenceKey.themeUserDefaultsPreferenceStore.read()UserDefaultsPreferenceStore.write(_:)AlignerApplicationDelegate.setQuickSwitchWaterfallViewMode(_:)AlignerApplicationDelegate.toggleQuickSwitchThemePreference()QuickSwitchRootView.setTheme(_:)QuickSwitchRootView.setWaterfallViewMode(_:)已保护行为:
QA 入口:
../C3.tools/round1-theme-toggle-fixture-qa.sh../C3.tools/round1-view-mode-entry-qa.sh../C2.builds/Z-研发中间产物/qa-reports/round01-theme-toggle-light-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-theme-toggle-dark-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-view-mode-entry-settings-report.json../C2.builds/Z-研发中间产物/qa-reports/round01-view-mode-entry-toggle-to-horizontal-report.json职责:
windowShortcutActivation 的纯函数授权判定。核心文件:
Sources/AlignerCore/Commerce/EntitlementState.swiftSources/Aligner/Diagnostics/Round015EntitlementLaunchOptions.swiftSources/Aligner/QuickSwitchRootView.swiftSources/Aligner/QuickSwitchSessionController.swift关键入口:
EntitlementPolicy.evaluate(snapshot:feature:now:)EntitlementPolicy.offlineGrace(lastAttemptAt:)FixtureEntitlementProvider.entitlement(for:at:)Round015EntitlementLaunchOptions.parse(arguments:)QuickSwitchRootView.handleAppShelfIndexKey(_:)QuickSwitchRootView.handleWindowIndexKey(symbol:)已保护行为:
windowShortcutActivation:两键窗口码直达,以及单窗口 App 的 App 序号自动激活。Enter、Space filter、窗口枚举和截图不受 Pro gate 影响。trialActive、proUnlocked、offlineGrace 允许窗口码;trialExpired、无有效试用下的 verifyFailed 拦截窗口码。QA 入口:
Tests/AlignerCoreTests/EntitlementPolicyTests.swift../C3.tools/round015-entitlement-fixture-qa.sh../C2.builds/Z-研发中间产物/qa-reports/round015-entitlement-fixture-qa.json从 SwiftPM 根目录执行:
swift build
swift test
如需限制终端输出,使用执行工具的输出上限或写入日志文件;不要在标准验证命令后接 head -c,避免 SIGPIPE 141 被误判为 build / test 失败。
macOS 14 兼容验证入口:
../C3.tools/round015-macos14-compatibility-qa.sh
打包入口:
../C3.tools/package-app.sh
主要 QA 脚本目录:
../C3.tools/主要 QA 报告目录:
../C2.builds/Z-研发中间产物/qa-reports/用户要求“冻结版本”时,Agent 必须自动更新本文件,并在打 tag 前完成:
最后更新、当前基线、相关节点 QA 入口 与 已保护行为 更新。如果用户只说 更新codegraph,只更新本文件,不改源码、不打包、不 tag;除非用户明确说 更新codegraph并提交。