Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0391c23
release: v0.5.5 — 菜单栏应用窗口生命周期重构
Aug 26, 2026
726bbb6
release: v0.5.6 — 修复截图编辑器 3 秒后消失、矩形线框默认与 OCR 选择增强
Aug 28, 2026
4f1575b
feat: 新增取色器工具(区域截图与编辑器)
Sep 1, 2026
ad99913
fix: 更新检查改用 GitHub Release 静态清单并增强校验
Sep 1, 2026
7ab25aa
chore: bump version to 0.6.0
Sep 1, 2026
815e94b
feat: 新增取色历史存储与 toast 通知位置配置
Sep 2, 2026
7a0714c
chore: 更新 SwiftLint 配置显式排除各包 .build 目录并同步文档
Sep 3, 2026
23c9228
refactor: 清理 SharedKit SwiftLint 债务并拆分更新清单结构
Sep 3, 2026
d640bf7
refactor: 清理 CaptureCore SwiftLint 债务并拆分捕获辅助方法
Sep 3, 2026
0d1ed05
refactor: 清理 OCRCore SwiftLint 债务并拆分语言支持与诊断扩展
Sep 3, 2026
c232764
refactor: 清理 BarcodeCore SwiftLint 债务
Sep 3, 2026
b2f7024
refactor: 清理 AnnotationCore SwiftLint 债务
Sep 3, 2026
4e4cdb7
refactor: 清理 ScrollCore SwiftLint 债务并拆分窗口扩展
Sep 3, 2026
b90b782
refactor: 清理 HistoryCore SwiftLint 债务并拆分 HistoryActor
Sep 3, 2026
0e5f729
refactor: 清理 AutomationCore SwiftLint 债务
Sep 3, 2026
a25362d
refactor: 清理编辑器 SwiftLint 债务并拆分画布与视图模型扩展
Sep 3, 2026
0187c06
refactor: 清理菜单栏 SwiftLint 债务并拆分 CaptureViewModel 扩展
Sep 3, 2026
2ca426f
refactor: 清理覆盖层 SwiftLint 债务并拆分选区跟踪与窗口选择
Sep 3, 2026
587a800
refactor: 清理窗口 SwiftLint 债务并拆分历史与偏好视图
Sep 3, 2026
629d719
refactor: 清理权限引导、路由与 CLI SwiftLint 债务
Sep 3, 2026
1f2d863
ci: 修复 unit-test 卡住,加超时并跳过 CI 上 Vision 集成测试
Sep 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@ jobs:

unit-test:
runs-on: macos-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- run: |
for pkg in SharedKit CaptureCore OCRCore BarcodeCore AnnotationCore ScrollCore HistoryCore; do
swift test --package-path "Packages/$pkg" || exit 1
for pkg in SharedKit CaptureCore OCRCore BarcodeCore AnnotationCore ScrollCore HistoryCore AutomationCore; do
echo "=== $pkg ==="
if [ "$pkg" = "OCRCore" ]; then
# 跳过依赖真实 Vision OCR 的集成测试:无头 CI runner 上 Vision 首次初始化可能挂起。
# 本地仍完整运行这些测试(见 scripts/test.sh)。详见 Docs/CI.md。
swift test --package-path "Packages/$pkg" \
--skip VisionIntegrationTests \
--skip pipelineFallsBackToVisionWhenTesseractDataIsMissing || exit 1
else
swift test --package-path "Packages/$pkg" || exit 1
fi
done

ui-smoke:
runs-on: self-hosted
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- run: brew install xcodegen
- run: xcodegen generate
- run: xcodebuild -project SnapGlass.xcodeproj -scheme SnapGlassUITests test
timeout-minutes: 10
31 changes: 28 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:

echo "DMG_PATH=$DMG_NAME" >> "$GITHUB_ENV"
echo "SHA_PATH=$DMG_NAME.sha256" >> "$GITHUB_ENV"
echo "UPDATE_MANIFEST_PATH=SnapGlass-update.json" >> "$GITHUB_ENV"

- name: Generate release notes
id: notes
Expand Down Expand Up @@ -146,6 +147,16 @@ jobs:

echo "notes_file=$NOTES_FILE" >> "$GITHUB_OUTPUT"

- name: Generate update manifest
run: |
python3 scripts/generate-update-manifest.py \
--version "${{ steps.version.outputs.version }}" \
--notes-file "${{ steps.notes.outputs.notes_file }}" \
--checksum-file "$SHA_PATH" \
--output "$UPDATE_MANIFEST_PATH"

python3 -m json.tool "$UPDATE_MANIFEST_PATH" >/dev/null

- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -155,6 +166,20 @@ jobs:

gh release create "$TAG" \
--title "$TAG" \
--notes-file "${{ steps.notes.outputs.notes_file }}" \
"$DMG_PATH" \
"$SHA_PATH"
--notes-file "${{ steps.notes.outputs.notes_file }}" \
"$DMG_PATH" \
"$SHA_PATH" \
"$UPDATE_MANIFEST_PATH"

- name: Verify release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.version.outputs.tag }}"
ASSETS="$(gh release view "$TAG" --json assets --jq '.assets[].name')"
for expected in "$DMG_PATH" "$SHA_PATH" "$UPDATE_MANIFEST_PATH"; do
if ! grep -Fxq "$expected" <<< "$ASSETS"; then
echo "Missing release asset: $expected" >&2
exit 1
fi
done
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ release/*/*.app/
release/*/.DS_Store
release/.DS_Store
release/manual-*/

# 本地实验打包产物(--experimental 模式,release/exp-*/),不入库
release/exp-*/
70 changes: 70 additions & 0 deletions .sisyphus/evidence/baseline-0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 批次 0 基线(可复现)

## 工具版本
- SwiftLint: 0.65.1
- Swift: 6.3.3 (Xcode 16 toolchain)
- swift-format: 6.3.0 (xcrun, XcodeDefault toolchain)
- 部署目标: macOS 13.0, Swift 6.0

## 配置决策(批次 0)
1. `.swiftlint.yml` 新增 `excluded`,显式列出所有嵌套 `.build` 目录。
- **关键事实**: SwiftLint 的 `excluded` 不支持 glob 通配(`**/.build`、`Packages/*/.build` 均无效),必须逐目录显式列出。
- 效果: 本地 1739 → 220 violations,`.build` 不再产生违规。
2. `.swiftlint.yml` 新增 `trailing_comma: mandatory_comma: true`。
- 与 swift-format 的 `multiElementCollectionTrailingCommas: true`(实测确认)对齐。
- 效果: trailing_comma 从 81 → 6(仅剩真正缺尾逗号的,swift-format 也会要求补)。

## 基线(配置后,机器生成)
- 全量: **220 violations, 3 serious in 138 files**

### 3 个 serious (error)
| 文件 | 行 | 规则 |
|------|-----|------|
| App/SnapGlass/Sources/Overlays/AreaSelectionPanel.swift | 1206 | file_length (error: 1200) |
| App/SnapGlass/Sources/Editor/EditableAnnotationCanvasView.swift | 1283 | file_length (error: 1200) |
| Packages/OCRCore/Sources/TesseractOCREngine.swift | 542 | large_tuple |

### 按规则分布
| 规则 | 数量 |
|------|------|
| identifier_name | 93 |
| line_length | 48 |
| function_body_length | 19 |
| multiple_closures_with_trailing_closure | 12 |
| file_length | 11 (2 error + 9 warning) |
| type_body_length | 6 |
| cyclomatic_complexity | 6 |
| trailing_comma (缺逗号) | 6 |
| trailing_newline | 2 |
| private_over_fileprivate | 2 |
| large_tuple | 2 (1 error + 1 warning) |
| implicit_optional_initialization | 2 |
| function_parameter_count | 2 |
| closure_parameter_position | 2 |
| opening_brace | 1 |
| non_optional_string_data_conversion | 1 |
| legacy_swiftui_aspect_ratio | 1 |
| inclusive_language | 1 |
| implicitly_unwrapped_optional | 1 |
| force_unwrapping | 1 |
| for_where | 1 |

### 11 个超 500 行文件(实测 wc -l)
| 文件 | 行数 | 状态 |
|------|------|------|
| EditableAnnotationCanvasView.swift | 1283 | error |
| AreaSelectionPanel.swift | 1206 | error |
| CaptureViewModel.swift | 1017 | warning |
| HistoryActor.swift | 951 | warning |
| EditorViewModel.swift | 797 | warning |
| PreferencesView.swift | 772 | warning |
| SCKAdapter.swift | 668 | warning |
| HistoryView.swift | 664 | warning |
| TesseractOCREngine.swift | 636 | warning |
| ScrollStitchEngine.swift | 512 | warning |
| SharedKitTests.swift | 504 | warning |

## 验证命令
```bash
swiftlint lint --config .swiftlint.yml
```
23 changes: 23 additions & 0 deletions .sisyphus/evidence/final-0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SwiftLint Debt Cleanup — Final Evidence

## Result
- **Lint**: `swiftlint lint --strict --config .swiftlint.yml` → **0 violations, 0 serious in 170 files** (baseline: 295 violations, 3 serious in 138 files).
- **App syntax**: all `App/SnapGlass/Sources/**/*.swift` pass `swiftc -parse` (exit 0).
- **Package tests**: all 8 packages pass `swift test`:
- SharedKit 32, CaptureCore 24, OCRCore 37, BarcodeCore 5, AnnotationCore 18, ScrollCore 4, HistoryCore 54, AutomationCore 54.
- **xcodegen generate**: exit 0 (project regenerated with new split files).

## Final Split (this session)
- `EditableAnnotationCanvasView.swift` (482 → 270 lines): moved selection/resize methods out.
- `EditableAnnotationCanvasView+Selection.swift` (505 → 293 lines): kept selection drawing/hit-testing; moved interaction methods out.
- `EditableAnnotationCanvasView+Resize.swift` (new, 221 lines): `beginSelectionInteraction`, `updateCreationPreview`, `updateMove`, `updateResize`, `resizedTextNode`, `proportionalBounds`, `createNode`.
- Resolved the last `type_body_length` (class body 440 → under 400) and the resulting `file_length` on the Selection extension.

## Docs
- `CHANGELOG.md`: added `[Unreleased]` → `### Changed` entry for the lint cleanup.
- `Docs/CONTRIBUTING.md`: synced `identifier_name excluded` to `[id, URL, key, tag, qr]` (added `qr`), matching `.swiftlint.yml`.

## Notes
- swift-format warnings are **pre-existing and repo-wide** (untouched files like `App.swift` have 108, `AppearanceMode.swift` 9, root `Package.swift` 101). They are a separate tool/rule set from the SwiftLint debt this task targeted; not introduced by this work.
- Pre-existing build blocker (present in HEAD, not caused by this work): `project.yml` SwiftLint pre-build script uses invalid `--path` option for SwiftLint 0.65.1. App files verified via `swiftc -parse` only.
- Version stays `0.6.1`; CHANGELOG records under `[Unreleased]`.
Loading
Loading