Skip to content

Update wp-bones extension#28316

Merged
raycastbot merged 8 commits into
raycast:mainfrom
gfazioli:ext/wp-bones
May 26, 2026
Merged

Update wp-bones extension#28316
raycastbot merged 8 commits into
raycast:mainfrom
gfazioli:ext/wp-bones

Conversation

@gfazioli
Copy link
Copy Markdown
Contributor

@gfazioli gfazioli commented May 25, 2026

Description

Hardens the WP Bones menu-bar command against filesystem failures when reading from / writing to LocalStorage.

The crash was reported via Raycast's Extension Issues dashboard — an ENOSPC: no space left on device error fired by Node's writeFileSync while Raycast was flushing its internal com.raycast.api.cache/.../journal during a LocalStorage.getItem call:

menu-bar | Error: ENOSPC: no space left on device, open
'.../com.raycast.api.cache/.../journal'
   at Object.writeFileSync (node:fs:2430:20)

Fix

  • Replaced useLocalStorage (from @raycast/utils) with direct LocalStorage.getItem/setItem calls (from @raycast/api), each wrapped in try/catch. On read failure the hook falls back to the initial version; on write failure the call is best-effort (a missed persistence won't crash the menu-bar).
  • Fixed a faulty migration path of the legacy version-storage format that could trigger a false "new version available" notification on every launch. Stale legacy values are now discarded silently.

Other minor robustness improvements applied in the same iteration (defensive guards on documentation API responses, explicit error state in Ask WP Bones AI when the docs lookup fails, encodeURIComponent for the embedded blueprint URL in the Playground action) — full list in the CHANGELOG.

Checklist

gfazioli and others added 4 commits April 9, 2026 15:53
- * 🖼️ chore(metadata): update and add extension screenshot assets
- 🚀 Add Ask WP Bones AI and Release Notes commands, enhance search and preview
- Merge branch \'contributions/merge-1775740194203\'
- Pull contributions
- Pull contributions
- fix(use-version): 🐛 harden storage reads/writes against filesystem failures
- Pull contributions
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: wp-bones Issues related to the wp-bones extension platform: macOS OP is author The OP of the PR is the author of the extension labels May 25, 2026
@raycastbot
Copy link
Copy Markdown
Collaborator

Thank you for the update! 🎉

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

@gfazioli gfazioli marked this pull request as ready for review May 25, 2026 12:07
Copilot AI review requested due to automatic review settings May 25, 2026 12:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the WP Bones Raycast extension with new commands and UX improvements, plus bug fixes around version checking, documentation search, and menu bar behavior.

Changes:

  • Added new commands: “Ask WP Bones AI” and “WP Bones Release Notes”
  • Improved boilerplate/template flow with README preview and extra actions (e.g., Copy URL)
  • Refactored version storage + comparison logic and hardened LocalStorage access against filesystem failures

Reviewed changes

Copilot reviewed 11 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
extensions/wp-bones/src/use-wp-bones-template.tsx Removed legacy templates search grid command (dead code cleanup).
extensions/wp-bones/src/templates.ts Removed hardcoded templates list (dead code cleanup).
extensions/wp-bones/src/search-documentation.tsx Switched to useFetch, added empty/error/no-results states, and “Copy URL” action.
extensions/wp-bones/src/release-notes.tsx New command to fetch and render latest GitHub release notes.
extensions/wp-bones/src/menu-bar.tsx Fixed state priority chain by using else if to avoid overwrites.
extensions/wp-bones/src/hooks/use-version.ts Hardened LocalStorage reads/writes; updated version parsing/comparison.
extensions/wp-bones/src/create-wp-bones-template.tsx Added README preview (⌘P) via GitHub repo + README fetch.
extensions/wp-bones/src/ask-ai.tsx New “Ask WP Bones AI” command that builds context from docs search + AI streaming.
extensions/wp-bones/package.json Registered new commands and added platforms metadata.
extensions/wp-bones/README.md Updated feature list to reflect new commands and preview actions.
extensions/wp-bones/CHANGELOG.md Added entries for the new features and fixes.

Comment thread extensions/wp-bones/src/hooks/use-version.ts Outdated
Comment thread extensions/wp-bones/src/search-documentation.tsx Outdated
Comment thread extensions/wp-bones/src/ask-ai.tsx Outdated
Comment thread extensions/wp-bones/src/ask-ai.tsx Outdated
Comment thread extensions/wp-bones/src/create-wp-bones-template.tsx Outdated
Comment thread extensions/wp-bones/CHANGELOG.md Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 25, 2026

Greptile Summary

This PR hardens several error-prone paths in the WP Bones extension: filesystem failures during LocalStorage reads/writes no longer crash the menu-bar command, a faulty version-storage migration that produced false "new version" banners on every launch is corrected, and both the search list and the AI prompt builder are guarded against malformed documentation API responses.

  • use-version.ts replaces useLocalStorage with direct LocalStorage.getItem/setItem calls wrapped in try/catch, and treats any stored value below 1_000_000 as stale to avoid the broken migration multiplier.
  • ask-ai.tsx and search-documentation.tsx add Array.isArray(d.items) guards before iteration and expose an explicit error state in the UI when the docs fetch fails.
  • create-wp-bones-template.tsx URL-encodes the blueprint parameter before embedding it in the Playground URL.

Confidence Score: 5/5

Safe to merge — all changes are defensive hardening around I/O failures and API response validation, with no new logic paths that could introduce regressions.

The core fixes are straightforward and well-scoped: error boundaries wrap LocalStorage calls, migration logic is simplified to a safe no-op for stale values, and the only structural change (dropping useLocalStorage in favour of direct API calls) is self-contained to use-version.ts. The one open item is the hardcoded date in the changelog, which has no runtime impact.

No files require special attention beyond the minor {PR_MERGE_DATE} placeholder fix in CHANGELOG.md.

Important Files Changed

Filename Overview
extensions/wp-bones/src/hooks/use-version.ts Replaces useLocalStorage with direct LocalStorage API calls wrapped in try/catch; fixes migration by treating any stored value below 1_000_000 as stale rather than applying a broken multiplier.
extensions/wp-bones/src/ask-ai.tsx Adds docsError handling from useFetch, explicit error UI state, and an Array.isArray guard on d.items before flatMap to prevent TypeErrors on malformed API responses.
extensions/wp-bones/src/search-documentation.tsx Strengthens the Document type guard to also check typeof, null, and Array.isArray(items) before accepting an entry from the API response.
extensions/wp-bones/src/create-wp-bones-template.tsx Extracts blueprint/playground URLs into named variables and wraps the blueprint URL with encodeURIComponent before embedding it as a query parameter.
extensions/wp-bones/CHANGELOG.md New [Fixes] entry added at the top; hardcoded date 2026-05-26 is used instead of the {PR_MERGE_DATE} placeholder.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
extensions/wp-bones/CHANGELOG.md:3
The new entry uses a hardcoded date instead of the required `{PR_MERGE_DATE}` placeholder. The placeholder is the standard Raycast convention and is automatically replaced with the actual merge date on publish.

```suggestion
## [Fixes] - {PR_MERGE_DATE}
```

Reviews (5): Last reviewed commit: "Update CHANGELOG.md" | Re-trigger Greptile

Comment thread extensions/wp-bones/src/hooks/use-version.ts Outdated
Comment thread extensions/wp-bones/CHANGELOG.md Outdated
Comment thread extensions/wp-bones/src/ask-ai.tsx
gfazioli added 2 commits May 25, 2026 14:40
Resolve conflicts in CHANGELOG.md, src/hooks/use-version.ts,
src/search-documentation.tsx, src/ask-ai.tsx,
src/create-wp-bones-template.tsx by keeping the PR head's content
(which is the April release + today's review fixes).
Mirror the Array.isArray(items) guard already applied to
search-documentation.tsx so a non-object/null/missing-items entry from
the docs API does not crash the AI prompt builder inside useEffect.
@0xdhrv 0xdhrv self-assigned this May 26, 2026
Copy link
Copy Markdown
Contributor

@0xdhrv 0xdhrv left a comment

Choose a reason for hiding this comment

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

Looks good to me, approved ✅

@raycastbot raycastbot merged commit 199cd45 into raycast:main May 26, 2026
3 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Published to the Raycast Store:
https://raycast.com/Undolog/wp-bones

@raycastbot
Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

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

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: wp-bones Issues related to the wp-bones extension OP is author The OP of the PR is the author of the extension platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants