Skip to content

feat/rust and swift lefthooks#232

Open
matheusfillipe wants to merge 5 commits into
mainfrom
feat/rust-and-swift-lefthooks
Open

feat/rust and swift lefthooks#232
matheusfillipe wants to merge 5 commits into
mainfrom
feat/rust-and-swift-lefthooks

Conversation

@matheusfillipe
Copy link
Copy Markdown
Contributor

@matheusfillipe matheusfillipe commented May 19, 2026

  • Add rust and swift lefthook tooling

Summary by CodeRabbit

  • Chores

    • Bumped package version to 0.3.1
    • Reworked CI into a consolidated "Lint and Tests" pipeline with docs, i18n, and Rust checks
    • Added pre-commit hooks and new docs/Rust formatting & lint scripts
    • Added editor/formatting configs and ignore rules for tooling
  • Refactor

    • Improved socket message parsing and connection handling
  • Style

    • Applied consistent formatting across Rust, Swift and plugin codebases

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

📝 Walkthrough

Walkthrough

Refactors 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.

Changes

Code Quality, Formatting, and Runtime Fixes

Layer / File(s) Summary
GitHub Actions workflow updates
.github/workflows/workflow.yaml, .github/workflows/cloudflare_pages.yaml, .github/workflows/docker.yaml, .github/workflows/publish.yaml
Refactors main workflow into lint-and-test jobs (biome/docs/i18n/rust), adjusts build job Node/npm caching, and applies small YAML quoting/branch trigger changes across workflow files.
Lefthook, Prettier, Markdownlint, and package scripts
lefthook.yml, .prettierrc.json, .prettierignore, .markdownlint.jsonc, .markdownlintignore, package.json
Adds lefthook pre-commit hooks for docs/Rust/Swift, creates Prettier and markdownlint configs/ignores, and adds scripts/devDependency entries for docs and Rust checks.
Rust: socket read_task refactor and Tauri wiring
src-tauri/src/socket.rs, src-tauri/src/lib.rs, src-tauri/.gitignore
Reorders imports and refactors read_task frame extraction to a draining loop; preserves EOF/error tcp-message emissions and connect shared-state insertion; reformats Tauri handler wiring and JNI write error handling.
iOS plugins: formatting changes
src-tauri/plugins/ios-keyboard/build.rs, src-tauri/plugins/ios-keyboard/ios/Sources/KeyboardPlugin.swift, src-tauri/plugins/share-sheet/ios/Sources/ShareSheet/ShareSheet.swift
Reformats builder invocation and Swift plugin implementations with multiline/consistent syntax and line breaks; no behavior changes.
Documentation and guides reformatting
ARCHITECTURE.md, AGENTS.md, README.md, BUILD.md, INSTALL.md, and others
Extensive reformatting and clarifications across architecture and contribution docs, plus added/renumbered i18n steps and stylistic adjustments.
Compose and Docker config formatting
compose.yaml, docker/ergo.yaml
Normalizes YAML quoting and array styles in compose and applies large indentation/formatting changes to docker/ergo.yaml without altering configuration semantics.

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ObsidianIRC/ObsidianIRC#61: Prior edits touching the same native TCP/SSL socket implementation; related to the socket read/frame logic changes.

Suggested reviewers

  • ValwareIRC

Poem

"A rabbit hops through CI and code,
Lint-lines shining on the road,
Frames drain neat, Swift lines align,
Docs refreshed and flows refine,
Hops of joy — the repo's rhyme!" 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding Rust and Swift lefthooks for code linting and formatting checks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rust-and-swift-lefthooks

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
lefthook.yml (1)

33-39: ⚡ Quick win

Make rust-fmt auto-fix for consistency.

The rust-fmt hook uses --check and fails if formatting is needed, requiring developers to manually run cargo fmt. This is inconsistent with the biome hook (line 6) and swift-format hook (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

📥 Commits

Reviewing files that changed from the base of the PR and between 2b362bd and f11338a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • .github/workflows/workflow.yaml
  • lefthook.yml
  • package.json
  • src-tauri/.gitignore
  • src-tauri/plugins/ios-keyboard/build.rs
  • src-tauri/plugins/ios-keyboard/ios/Sources/KeyboardPlugin.swift
  • src-tauri/plugins/share-sheet/ios/Sources/ShareSheet/ShareSheet.swift
  • src-tauri/src/lib.rs
  • src-tauri/src/socket.rs

@matheusfillipe matheusfillipe force-pushed the feat/rust-and-swift-lefthooks branch from f11338a to c0bfd56 Compare May 19, 2026 09:02
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f11338a and c08b417.

⛔ Files ignored due to path filters (3)
  • package-lock.json is excluded by !**/package-lock.json
  • src-tauri/plugins/ios-keyboard/Cargo.lock is excluded by !**/*.lock
  • src-tauri/plugins/share-sheet/Cargo.lock is 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.json
  • AGENTS.md
  • ARCHITECTURE.md
  • BUILD.md
  • INSTALL.md
  • README.md
  • compose.yaml
  • docker/ergo.yaml
  • lefthook.yml
  • package.json
  • src-tauri/.gitignore
  • src-tauri/plugins/ios-keyboard/build.rs
  • src-tauri/plugins/ios-keyboard/ios/Sources/KeyboardPlugin.swift
  • src-tauri/plugins/share-sheet/ios/Sources/ShareSheet/ShareSheet.swift
  • src-tauri/src/lib.rs
  • src-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

Comment thread ARCHITECTURE.md
Comment on lines 288 to 291
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants