Skip to content

feat(desktop): improve Mermaid CLI setup screen with one-click install, check-again, and collapsible source - #580

Open
AnayGarodia wants to merge 1 commit into
askimo-ai:mainfrom
AnayGarodia:feat/mermaid-setup-one-click-install
Open

feat(desktop): improve Mermaid CLI setup screen with one-click install, check-again, and collapsible source#580
AnayGarodia wants to merge 1 commit into
askimo-ai:mainfrom
AnayGarodia:feat/mermaid-setup-one-click-install

Conversation

@AnayGarodia

Copy link
Copy Markdown
Contributor

What changed

When Mermaid CLI is not detected, the setup screen previously only showed static instructions and required installing externally plus an app restart. This PR makes that flow self-service:

  • One-click install — an "Install Mermaid CLI" button (shown when npm is detected) runs npm install -g @mermaid-js/mermaid-cli in the background via ProcessBuilderExt, with a progress spinner and a scrollable, auto-following installer output area. On success the CLI availability check re-runs automatically and the diagram proceeds to render. On failure the npm output stays visible so the user can see what went wrong.
  • Check Again — a button that resets the cached availability (MermaidSvgService.resetAvailabilityCache()), sets isMermaidCliAvailable back to null, and re-triggers the existing LaunchedEffect, so users who installed the CLI externally no longer need to restart the app.
  • Node.js detection — the screen checks npm availability up front (MermaidSvgService.isNpmAvailable()). If npm is missing, the install button is replaced by a "Download Node.js" button plus a hint, so the primary CTA is always actionable.
  • Collapsible diagram source — the raw diagram code is now behind a Show/Hide Diagram Source toggle, hidden by default, so the setup screen is less noisy.

Service changes live in MermaidSvgService (isNpmAvailable(), installMermaidCli() with a 10-minute timeout and threaded output reader matching the existing isMermaidCliAvailable() pattern, and resetAvailabilityCache()). New UI strings were added to messages.properties and all nine locale files; the now-unused mermaid.diagram.source.label key was removed.

How to test

  1. Ensure mmdc is not installed (npm uninstall -g @mermaid-js/mermaid-cli) and ask Askimo for a Mermaid diagram — the setup screen appears with the install and Check Again buttons.
  2. Click "Install Mermaid CLI" — installer output streams into the log area; when it finishes the availability check re-runs and the diagram renders without a restart.
  3. Alternatively install the CLI in a terminal, then click "Check Again" — the diagram renders without a restart.
  4. With Node/npm absent from PATH, the screen shows the "install Node.js first" hint and a "Download Node.js" button instead of the install button.
  5. "Show Diagram Source" toggles the raw diagram code, which is hidden by default.

Verification

Using Temurin JDK 25, as required by the Gradle toolchain:

  • ./gradlew :desktop-shared:build (includes tests)
  • ./gradlew :desktop-shared:spotlessCheck
  • ./gradlew detekt (aggregate gate: 0 errors)

All tasks completed successfully.

Closes #562

…urce to Mermaid setup screen

When Mermaid CLI is not detected, the setup screen now offers:
- an Install Mermaid CLI button (shown when npm is available) that runs
  npm install -g @mermaid-js/mermaid-cli in the background with a progress
  spinner and a scrollable installer output area; on success the CLI check
  re-runs automatically and the diagram renders
- a Check Again button that resets the cached availability and re-runs the
  existing availability check without restarting the app
- a Download Node.js button with a hint when neither node nor npm is found
- a collapsible diagram source section, hidden by default

Closes askimo-ai#562

Signed-off-by: anay <agarodia98@gmail.com>
Copilot AI review requested due to automatic review settings July 29, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Improve Mermaid CLI setup screen: one-click install, check-again, and collapsible diagram source

2 participants