Skip to content

Add tauri-plugin-cli and print CLI matches#1752

Merged
yujonglee merged 1 commit intomainfrom
add-tauri-cli-plugin-handling
Nov 20, 2025
Merged

Add tauri-plugin-cli and print CLI matches#1752
yujonglee merged 1 commit intomainfrom
add-tauri-cli-plugin-handling

Conversation

@yujonglee
Copy link
Contributor

No description provided.

Add the tauri-plugin-cli dependency to the workspace and the desktop tauri app, register the plugin in lib.rs, and print CLI matches during setup. This is needed to follow the tauri v2 CLI plugin integration: the change wires the plugin into the app, calls app.cli().matches() to inspect CLI input (currently just prints the matches or an error), and adjusts some app handle usage so plugin and menu creation use a cloned app_handle. The edits ensure the CLI is handled purely in Rust and prepare for further CLI functionality.
v
@netlify
Copy link

netlify bot commented Nov 20, 2025

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit ac52a15
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/691efedcb7b2a2000808e7b4
😎 Deploy Preview https://deploy-preview-1752--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 20, 2025

📝 Walkthrough

Walkthrough

The pull request integrates the tauri-plugin-cli dependency (version 2.4) into the Tauri desktop application. The plugin is added to the workspace and application dependencies, initialized in the application setup, and CLI arguments are parsed and logged. The codebase is refactored to use a consistent app_handle reference throughout subsequent operations.

Changes

Cohort / File(s) Summary
Workspace & Application Dependencies
Cargo.toml, apps/desktop/src-tauri/Cargo.toml
Added tauri-plugin-cli version 2.4 to workspace and application-level dependencies.
CLI Plugin Integration
apps/desktop/src-tauri/src/lib.rs
Imported CliExt trait, initialized CLI plugin in plugin chain, added CLI argument parsing and logging in setup handler, refactored to use consistent app_handle reference for tray, app menu, and specta event operations.

Sequence Diagram

sequenceDiagram
    participant app as Tauri App
    participant cli as CLI Plugin
    participant setup as Setup Handler
    participant tray as Tray/Menu

    app->>cli: Initialize plugin
    activate cli
    cli-->>app: Plugin ready
    deactivate cli

    app->>setup: Run setup
    activate setup
    setup->>cli: Parse CLI arguments
    cli-->>setup: Return CLI matches
    setup->>setup: Log result or error
    setup->>tray: Configure with app_handle
    setup->>tray: Mount specta events
    deactivate setup
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • The changes follow a consistent pattern of plugin integration and refactoring
  • Dependency additions are straightforward
  • The app_handle refactoring across multiple operations is mechanical and repetitive
  • Primary focus: verify that CLI plugin initialization doesn't break existing setup flow and that app_handle usage is correct throughout

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a description explaining the purpose of adding tauri-plugin-cli, how it's used in the setup, and any relevant context for reviewers.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: adding the tauri-plugin-cli dependency and implementing CLI match printing functionality.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-tauri-cli-plugin-handling

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

Copy link
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: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 41ad161 and ac52a15.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • Cargo.toml (1 hunks)
  • apps/desktop/src-tauri/Cargo.toml (1 hunks)
  • apps/desktop/src-tauri/src/lib.rs (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/desktop/src-tauri/src/lib.rs (5)
plugins/local-llm/src/lib.rs (1)
  • init (64-112)
plugins/tracing/src/lib.rs (1)
  • init (30-64)
plugins/listener/src/lib.rs (1)
  • init (51-67)
plugins/webhook/src/lib.rs (1)
  • init (27-42)
plugins/windows/src/lib.rs (1)
  • init (62-83)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ci (macos, macos-14)
  • GitHub Check: fmt
🔇 Additional comments (6)
apps/desktop/src-tauri/Cargo.toml (1)

26-26: LGTM!

The dependency addition follows the existing pattern and is correctly placed in alphabetical order.

apps/desktop/src-tauri/src/lib.rs (5)

8-8: LGTM!

The import is necessary for the CLI plugin integration.


48-48: LGTM!

The plugin initialization is correctly placed in the plugin chain.


108-109: LGTM!

The tray and app menu initialization follows the established pattern. The use of unwrap() is acceptable here since failures during setup should halt application initialization.


123-123: LGTM!

The event mounting is consistent with the app_handle pattern used throughout the setup closure.


102-104: Disregard the review comment—the app_handle refactoring is necessary and correct.

The app_info_menu and app_new_menu functions require &AppHandle<R> parameters, and the code correctly:

  1. Clones app.handle() to obtain ownership (line 102)
  2. Clones again to move into the async closure while preserving app_handle for sync use (line 104)

This pattern is required because the code needs to use app_handle for the synchronous trait method calls (create_tray_menu(), create_app_menu(), mount_events()) while also moving a clone into the tokio::spawn closure. The refactoring is not unnecessary—it satisfies both Rust's move semantics and the trait's type requirements.

Likely an incorrect or invalid review comment.

@yujonglee yujonglee merged commit df75819 into main Nov 20, 2025
15 checks passed
@yujonglee yujonglee deleted the add-tauri-cli-plugin-handling branch November 20, 2025 11:50
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.

1 participant