Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pieces-raycast extension #16797

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
4 changes: 2 additions & 2 deletions extensions/pieces-raycast/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Pieces for Raycast Changelog

## [Update] - 2025-01-11
## [0.2.0] - 2025-02-03

- Fix addressing port migration that broke the extension
- Renames commands according to new branding guidelines

## [0.1.0] - 2025-01-06

Expand Down
10 changes: 5 additions & 5 deletions extensions/pieces-raycast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

Welcome to the Pieces for Developers Raycast Extension! This extension brings powerful features to your fingertips, allowing you to streamline your workflow and boost productivity.

In order to use the Pieces Raycast Extension, you must have <a target="blank" href="https://docs.pieces.app/installation-getting-started/what-am-i-installing">Pieces OS.</a> We recommend also using the Pieces for Developers desktop app.
In order to use the Pieces Raycast Extension, you must have <a target="blank" href="https://docs.pieces.app/installation-getting-started/what-am-i-installing">PiecesOS.</a> We recommend also using the Pieces for Developers desktop app.

Pieces for Developers is an AI powered productivity tool tailored for developers. We have many features that horizontally integrate across the developer toolchain including a streamlined snippet-saving experience that helps you organize your reusable code while automatically augmenting it with useful metadata, as well as our Copilot which is an AI chat that is highly tailored to your specific context as a developer. Here’s a breakdown of the features available in this extension:

## Features

### Search Saved Pieces
### Search Saved Materials

![Search Snippets](media/search%20snippets.gif)
![Search Materials](media/search%20snippets.gif)

Quickly search through your saved pieces to find and reuse exactly what you need.

- **Command:** `Search Saved Snippets`
- **Command:** `Search Saved Materials`

### Save Clipboard History to Pieces

Expand All @@ -30,7 +30,7 @@ View a list of your clipboard history, enriched with useful metadata like relate

![Browser History](media/save-browser-history.gif)

View a list of the code snippets discovered in your recent browsing history. Each code snippet is enriched with useful metadata. Select an item to save it to Pieces.
View a list of the saved materials discovered in your recent browsing history. Each saved material is enriched with useful metadata. Select an item to save it to Pieces.

- **Command:** `Save Browser History to Pieces`

Expand Down
13 changes: 13 additions & 0 deletions extensions/pieces-raycast/README_DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,16 @@
### Lifecycle of a Command

It's very important to await any asynchronous operation within a command. Without doing this, the command will be disposed without completing.

### Resolving command actions

- command `name` in package.json must match filename in `src`

### Publishing updates

1. Update the version in `package.json`
2. Update CHANGELOG
3. run `npm run publish` <-- address any errors
4. This will automatically cut a PR to raycast/extensions and provide a link
5. Edit the PR description to explain changes
6. Wait for approval from Raycast team (can take up to 2 weeks)
Binary file modified extensions/pieces-raycast/assets/piecesVector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions extensions/pieces-raycast/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://www.raycast.com/schemas/extension.json",
"version": "0.1.0",
"version": "0.2.0",
"name": "pieces-raycast",
"title": "Pieces for Raycast",
"description": "Pieces for Developers Raycast Extension",
Expand All @@ -22,16 +22,16 @@
},
{
"name": "signin",
"title": "Sign into Pieces",
"title": "Sign In to Pieces",
"mode": "no-view",
"description": "Sign into Pieces",
"description": "Sign in to Pieces",
"icon": "piecesVector.png"
},
{
"name": "signout",
"title": "Signout of Pieces",
"title": "Sign Out of Pieces",
"mode": "no-view",
"description": "Signout of Pieces",
"description": "Sign out of Pieces",
"icon": "piecesVector.png"
},
{
Expand Down Expand Up @@ -71,18 +71,18 @@
"icon": "piecesVector.png"
},
{
"name": "search-snippets",
"title": "Search Saved Snippets",
"description": "Search for a Piece that is saved in your snippet database",
"name": "search-materials",
"title": "Search Saved Materials",
"description": "Search for a saved material in your Pieces Drive",
"mode": "view",
"icon": "piecesVector.png"
}
],
"preferences": [
{
"name": "snippetEnrichmentLevels",
"description": "Choose how much metadata should be automatically added to snippets when you save them.",
"title": "Snippet Enrichment Levels",
"name": "material-enrichment-levels",
"description": "Choose how much metadata should be automatically added to materials when you save them.",
"title": "Material Enrichment Levels",
"type": "dropdown",
"data": [
{
Expand Down
2 changes: 1 addition & 1 deletion extensions/pieces-raycast/src/actions/saveAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export async function saveFileToPieces(file: string): Promise<Asset | null> {
* Save some text to Pieces
* @param text the text to save
* @param file true if it's a file
* @param ext the classification of the snippet
* @param ext the classification of the material
* @returns
*/
export async function saveTextToPieces(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { CapabilitiesEnum } from "@pieces.app/pieces-os-client";
* - is pieces running
* - is pieces at least updated to the minimum required version
* - does the application need to be updated to represent the users's preferences
* - this will prompt the user to install pieces os if it's not installed, return false if they reject the installation
* - this will automatically update pieces os if it is not at least the minimum required version
* - this will prompt the user to install PiecesOs if it's not installed, return false if they reject the installation
* - this will automatically update PiecesOs if it is not at least the minimum required version
* @returns a boolean on whether or not the health check succeeded
*/
export default async function piecesHealthCheck(): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ import { exec } from "child_process";
import { pollForConnection } from "./piecesHealthCheck";

/**
* Checks the health of Pieces OS and attempts to install it if necessary.
* Checks the health of PiecesOS and attempts to install it if necessary.
*
* This function performs the following steps:
* 1. Shows a toast notification indicating that the health check is in progress.
* 2. Checks the health of Pieces OS using the well-known API.
* 3. If Pieces OS is healthy, hides the toast and returns true.
* 4. If Pieces OS is not healthy, attempts to launch Pieces OS.
* 2. Checks the health of PiecesOS using the well-known API.
* 3. If PiecesOS is healthy, hides the toast and returns true.
* 4. If PiecesOS is not healthy, attempts to launch PiecesOS.
* 5. If launching is successful, polls for a connection and hides the toast if connected.
* 6. If launching fails, prompts the user to install Pieces OS.
* 7. If the user agrees to install, downloads and installs Pieces OS.
* 6. If launching fails, prompts the user to install PiecesOS.
* 7. If the user agrees to install, downloads and installs PiecesOS.
* 8. Polls for a connection for up to 10 minutes.
* 9. Hides the toast and returns the result of the installation.
*
* @returns {Promise<boolean>} - A promise that resolves to true if Pieces OS is installed and connected successfully, otherwise false.
* @returns {Promise<boolean>} - A promise that resolves to true if PiecesOS is installed and connected successfully, otherwise false.
*/
export default async function piecesInstalledCheck() {
const toast = await showToast({
title: "Checking for Pieces OS health",
title: "Checking for PiecesOS health",
primaryAction: {
title: "Contact Support",
onAction() {
Expand All @@ -41,7 +41,7 @@ export default async function piecesInstalledCheck() {
return true;
}

toast.title = "Attempting to launch Pieces OS";
toast.title = "Attempting to launch PiecesOS";
await launchRuntime();
const connected = await pollForConnection();

Expand All @@ -56,14 +56,14 @@ export default async function piecesInstalledCheck() {

if (!shouldInstall) {
toast.style = Toast.Style.Failure;
toast.title = "Cannot perform this action without installing Pieces OS";
toast.title = "Cannot perform this action without installing PiecesOS";
return false;
}

toast.title = "Downloading Pieces OS";
toast.title = "Downloading PiecesOS";

performInstall().then(() => {
toast.title = "Installing Pieces OS";
toast.title = "Installing PiecesOS";
});

const successfulInstall = await pollForConnection(10 * 60 * 1000); // wait 10 minutes
Expand All @@ -74,7 +74,7 @@ export default async function piecesInstalledCheck() {
}

/**
* Prompts the user with an alert to confirm the installation of Pieces OS.
* Prompts the user with an alert to confirm the installation of PiecesOS.
*
* @param res - A callback function that resolves with a boolean value indicating the user's choice.
* - `true` if the user chooses to install.
Expand All @@ -83,7 +83,7 @@ export default async function piecesInstalledCheck() {
async function requestInstall(res: (val: boolean) => void) {
await confirmAlert({
title:
"In order to use the Pieces Raycast extension you must have Pieces OS installed, would you like to install it?",
"In order to use the Pieces Raycast extension you must have PiecesOS installed, would you like to install it?",
primaryAction: {
title: "Install",
onAction() {
Expand All @@ -101,9 +101,9 @@ async function requestInstall(res: (val: boolean) => void) {
}

/**
* Downloads and installs the Pieces OS package based on the system architecture.
* Downloads and installs the PiecesOS package based on the system architecture.
*
* This function constructs a download URL for the Pieces OS package, taking into account
* This function constructs a download URL for the PiecesOS package, taking into account
* whether the system architecture is ARM64 or not. It then downloads the package to a
* temporary path and attempts to open it for installation. If the download fails, an
* error message is printed.
Expand All @@ -118,7 +118,7 @@ curl -L "$PKG_URL" -o "$TMP_PKG_PATH"
if [ -f "$TMP_PKG_PATH" ]; then
open "$TMP_PKG_PATH"
else
echo "Failed to download and install Pieces OS."
echo "Failed to download and install PiecesOS."
fi`;
return new Promise<void>((res) => {
exec(script, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default async function piecesUpToDateCheck(): Promise<boolean> {

if (!canAutoUpdate) {
await Notifications.getInstance().errorToast(
"Please update your Pieces OS version to at least " + MIN_VERSION,
"Please update your PiecesOS version to at least " + MIN_VERSION,
);
return false;
} else {
Expand All @@ -47,14 +47,14 @@ export default async function piecesUpToDateCheck(): Promise<boolean> {
}

/**
* Asynchronously checks for Pieces OS updates and handles the update process.
* Asynchronously checks for PiecesOS updates and handles the update process.
* Displays a toast notification during the update check and handles different update statuses.
*
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating whether the update was successful.
*/
async function updatePieces(): Promise<boolean> {
const toast = await showToast({
title: "Checking for Pieces OS Update",
title: "Checking for PiecesOS Update",
style: Toast.Style.Animated,
});

Expand Down Expand Up @@ -112,11 +112,11 @@ function getStatusText(status: UpdatingStatusEnum | undefined) {
case UpdatingStatusEnum.ReadyToRestart:
return "Restarting to apply the update...";
case UpdatingStatusEnum.ReinstallRequired:
return "You need to reinstall Pieces OS for this feature to work!";
return "You need to reinstall PiecesOS for this feature to work!";
case UpdatingStatusEnum.Unknown:
return "Unknown status";
case UpdatingStatusEnum.UpToDate:
return "Pieces OS is up to date.";
return "PiecesOS is up to date.";
case undefined:
return "Failed to get update status, please contact support at https://docs.pieces.app/support";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ export default function Command() {
}

if (item.ext) {
return `${item.ext} Snippet`;
return `${item.ext} Material`;
}

return `Code snippet from ${item.browser.tab.title ?? item.browser.tab.url}`;
return `Saved from ${item.browser.tab.title ?? item.browser.tab.url}`;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default function Command() {
}

if (item.ext) {
return `${item.ext} Snippet`;
return `${item.ext} Material`;
}

return item.clipboard.text.slice(0, 30);
Expand Down
Loading
Loading