feat/rust and swift lefthooks#232
Conversation
📝 WalkthroughWalkthroughRefactors CI into a "Lint and Tests" pipeline with Node/lefthook-driven pre-commit jobs for docs/Rust/Swift, adds Prettier/markdownlint configs and scripts, reformats Swift/Tauri code, and refactors Rust socket read-frame extraction while keeping existing behaviors. ChangesCode Quality, Formatting, and Runtime Fixes
Sequence Diagram(s)Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lefthook.yml (1)
33-39: ⚡ Quick winMake rust-fmt auto-fix for consistency.
The
rust-fmthook uses--checkand fails if formatting is needed, requiring developers to manually runcargo fmt. This is inconsistent with thebiomehook (line 6) andswift-formathook (line 54), which both auto-fix and re-stage changes. For a consistent developer experience, consider updating this hook to match the pattern.♻️ Proposed fix to auto-fix and re-stage
rust-fmt: glob: "src-tauri/**/*.rs" run: | set -e - cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --check - cargo fmt --manifest-path src-tauri/plugins/share-sheet/Cargo.toml --all -- --check - cargo fmt --manifest-path src-tauri/plugins/ios-keyboard/Cargo.toml --all -- --check + cargo fmt --manifest-path src-tauri/Cargo.toml --all + cargo fmt --manifest-path src-tauri/plugins/share-sheet/Cargo.toml --all + cargo fmt --manifest-path src-tauri/plugins/ios-keyboard/Cargo.toml --all + if ! git diff --exit-code --quiet -- {staged_files} 2>/dev/null; then + git add -- {staged_files} + echo "" + echo "cargo fmt auto-formatted the staged files. Changes have been staged." + echo "Re-run git commit to proceed." + exit 1 + fi🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lefthook.yml` around lines 33 - 39, The rust-fmt pre-commit hook currently runs cargo fmt with --check, causing failures instead of auto-fixing; update the rust-fmt hook (the rust-fmt block that runs cargo fmt --manifest-path ... --all -- --check) to run cargo fmt without --check for each manifest, then add git add commands to re-stage changed files (mirroring the biome and swift-format hooks) so formatting is applied and staged automatically; ensure the run script still exits non-zero on errors but allows cargo fmt to modify files and re-add them.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@lefthook.yml`:
- Around line 33-39: The rust-fmt pre-commit hook currently runs cargo fmt with
--check, causing failures instead of auto-fixing; update the rust-fmt hook (the
rust-fmt block that runs cargo fmt --manifest-path ... --all -- --check) to run
cargo fmt without --check for each manifest, then add git add commands to
re-stage changed files (mirroring the biome and swift-format hooks) so
formatting is applied and staged automatically; ensure the run script still
exits non-zero on errors but allows cargo fmt to modify files and re-add them.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3106f51a-03ba-4346-a14f-31731fd56bfb
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (9)
.github/workflows/workflow.yamllefthook.ymlpackage.jsonsrc-tauri/.gitignoresrc-tauri/plugins/ios-keyboard/build.rssrc-tauri/plugins/ios-keyboard/ios/Sources/KeyboardPlugin.swiftsrc-tauri/plugins/share-sheet/ios/Sources/ShareSheet/ShareSheet.swiftsrc-tauri/src/lib.rssrc-tauri/src/socket.rs
f11338a to
c0bfd56
Compare
…o feat/rust-and-swift-lefthooks
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ARCHITECTURE.md`:
- Around line 288-291: Update the ARCHITECTURE.md list to reference the actual
CI workflow filename used in this PR: replace the "github_pages.yaml" entry with
"publish.yaml" (or rename it to match whichever workflow file is authoritative),
ensuring the line that currently reads "3. **github_pages.yaml** - Static site
deployment" becomes "3. **publish.yaml** - Static site deployment" so the doc
matches the repository's workflow names (also verify other entries like
workflow.yaml, docker.yaml, and cloudflare_pages.yaml remain accurate).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 38b33b44-6d21-43e3-9267-20bb0a3458e2
⛔ Files ignored due to path filters (3)
package-lock.jsonis excluded by!**/package-lock.jsonsrc-tauri/plugins/ios-keyboard/Cargo.lockis excluded by!**/*.locksrc-tauri/plugins/share-sheet/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (23)
.github/workflows/cloudflare_pages.yaml.github/workflows/docker.yaml.github/workflows/publish.yaml.github/workflows/workflow.yaml.markdownlint.jsonc.markdownlintignore.prettierignore.prettierrc.jsonAGENTS.mdARCHITECTURE.mdBUILD.mdINSTALL.mdREADME.mdcompose.yamldocker/ergo.yamllefthook.ymlpackage.jsonsrc-tauri/.gitignoresrc-tauri/plugins/ios-keyboard/build.rssrc-tauri/plugins/ios-keyboard/ios/Sources/KeyboardPlugin.swiftsrc-tauri/plugins/share-sheet/ios/Sources/ShareSheet/ShareSheet.swiftsrc-tauri/src/lib.rssrc-tauri/src/socket.rs
✅ Files skipped from review due to trivial changes (12)
- .markdownlintignore
- .prettierrc.json
- .markdownlint.jsonc
- .github/workflows/docker.yaml
- .github/workflows/publish.yaml
- .prettierignore
- BUILD.md
- src-tauri/src/lib.rs
- src-tauri/plugins/ios-keyboard/build.rs
- AGENTS.md
- compose.yaml
- INSTALL.md
🚧 Files skipped from review as they are similar to previous changes (2)
- src-tauri/plugins/share-sheet/ios/Sources/ShareSheet/ShareSheet.swift
- src-tauri/src/socket.rs
| 1. **workflow.yaml** - Lint (Biome) + Test (Vitest) | ||
| 2. **docker.yaml** - Multi-arch Docker build (amd64/arm64) | ||
| 3. **github_pages.yaml** - Static site deployment | ||
| 4. **cloudflare_pages.yaml** - Cloudflare Pages deployment |
There was a problem hiding this comment.
Fix workflow filename reference in CI/CD docs.
Line 290 documents github_pages.yaml, but the provided workflow set for this PR uses publish.yaml. This makes the architecture doc point to a non-existent/incorrect workflow file name.
Suggested doc fix
-3. **github_pages.yaml** - Static site deployment
+3. **publish.yaml** - Static site deployment🧰 Tools
🪛 LanguageTool
[uncategorized] ~290-~290: The official name of this software platform is spelled with a capital “H”.
Context: ...ti-arch Docker build (amd64/arm64) 3. github_pages.yaml - Static site deployment 4...
(GITHUB)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@ARCHITECTURE.md` around lines 288 - 291, Update the ARCHITECTURE.md list to
reference the actual CI workflow filename used in this PR: replace the
"github_pages.yaml" entry with "publish.yaml" (or rename it to match whichever
workflow file is authoritative), ensuring the line that currently reads "3.
**github_pages.yaml** - Static site deployment" becomes "3. **publish.yaml** -
Static site deployment" so the doc matches the repository's workflow names (also
verify other entries like workflow.yaml, docker.yaml, and cloudflare_pages.yaml
remain accurate).
…o feat/rust-and-swift-lefthooks
Summary by CodeRabbit
Chores
Refactor
Style