Skip to content

Add motion extension #17756

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

owendavidprice
Copy link

@owendavidprice owendavidprice commented Mar 11, 2025

Description

Screencast

Checklist

- Fix code style issues
- Remove edit task functionality and rename extension to Motion
- Adding new features to the list task function
- Remove old screenshots
- Remove unused imports to fix ESLint errors
- Add correctly sized screenshots for Raycast store
- Fix unterminated string literal in debug-workspaces.tsx
- Add missing showFailureToast imports
- Rename screenshots for better clarity
- Add screenshots for Raycast store
- Fix code formatting with Prettier
- Address PR feedback: Update error handling, clean up .gitignore, add metadata folder for screenshots
- Fix AI evals configuration to match Raycast requirements
- Update debug-workspaces.tsx
- Update extension per Raycast store guidelines: Add AI evals, create metadata folder, remove hardcoded workspace ID, enhance Prettier config, fix README title
@raycastbot raycastbot added the new extension Label for PRs with new extensions label Mar 11, 2025
@raycastbot
Copy link
Collaborator

Congratulations on your new Raycast extension! 🚀

Due to our current reduced availability, the initial review may take up to 10-15 business days

Once the PR is approved and merged, the extension will be available on our Store.

@owendavidprice
Copy link
Author

@pernielsentikaer here's the new pull request as discussed! thanks.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR adds a new Motion task management extension for Raycast, enabling users to manage tasks, projects, and workspaces through Motion's API.

  • The metadata folder lacks required screenshots for view commands (add-task, list-tasks, delete-task, debug-workspaces) which are needed for the Raycast Store listing
  • The ask-motion AI tool in package.json has evals but should include more diverse test cases for better coverage
  • The list-tasks.tsx component has duplicate state updates in setFilteredTasks(tasks) that should be removed
  • Consider using showFailureToast from @raycast/utils in delete-task.tsx and list-tasks.tsx to simplify error handling
  • The debug-workspaces.tsx component could benefit from a loading indicator during API calls for better UX

💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!

14 file(s) reviewed, 21 comment(s)
Edit PR Review Bot Settings | Greptile

"lint": "ray lint",
"prepublishOnly": "echo \"\\n\\nIt seems like you are trying to publish the Raycast extension to npm.\\n\\nIf you did intend to publish it to npm, remove the \\`prepublishOnly\\` script and rerun \\`npm publish\\` again.\\nIf you wanted to publish it to the Raycast Store instead, use \\`npm run publish\\` instead.\\n\\n\" && exit 1",
"publish": "npx @raycast/api@latest publish",
"save": "git add . && git commit -m 'Save changes' && git push"
Copy link
Contributor

Choose a reason for hiding this comment

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

style: The save script is not a standard Raycast extension script and could be removed

Comment on lines +5 to +9
1. `add-task.tsx` - Screenshot of the Add Task form
2. `list-tasks.tsx` - Screenshot showing a list of tasks
3. `edit-task.tsx` - Screenshot of the Edit Task form
4. `delete-task.tsx` - Screenshot of the Delete Task view
5. `debug-workspaces.tsx` - Screenshot of the Workspace Details view
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The file mentions edit-task.tsx but this command is not defined in package.json. Either remove this line or add the command to package.json

## Features

- **Add Task**: Quickly create new tasks with title, description, due date, priority, project, and label
- **Edit Task**: View and edit your existing tasks, including updating priorities, deadlines, and project assignments
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The 'Edit Task' feature is listed in the README but there is no corresponding command in package.json or implementation file

Comment on lines +71 to +77
```bash
# Install dependencies
npm install

# Start development server
npm run dev
```
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Code block should be removed since these commands are already documented in the Installation section

Comment on lines +67 to +71
await showToast({
style: Toast.Style.Failure,
title: "Failed to initialize Motion client",
message: String(error),
});
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Could be simplified using showFailureToast from @raycast/utils

Suggested change
await showToast({
style: Toast.Style.Failure,
title: "Failed to initialize Motion client",
message: String(error),
});
await showFailureToast("Failed to initialize Motion client", String(error));

Comment on lines +302 to +319
async getTaskById(id: string): Promise<MotionTask> {
const url = `${BASE_URL}/tasks/${id}?workspaceId=${preferences.workspaceId}`;
logRequest("GET", url, headers);

const response = await fetch(url, {
method: "GET",
headers,
});

if (!response.ok) {
const responseText = await logResponse(response);
throw new Error(
`Failed to get task: ${response.statusText}${responseText ? ` - ${responseText}` : ""}`
);
}

return response.json() as Promise<MotionTask>;
},
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: getTaskById lacks try-catch block for error handling, unlike other API methods

Suggested change
async getTaskById(id: string): Promise<MotionTask> {
const url = `${BASE_URL}/tasks/${id}?workspaceId=${preferences.workspaceId}`;
logRequest("GET", url, headers);
const response = await fetch(url, {
method: "GET",
headers,
});
if (!response.ok) {
const responseText = await logResponse(response);
throw new Error(
`Failed to get task: ${response.statusText}${responseText ? ` - ${responseText}` : ""}`
);
}
return response.json() as Promise<MotionTask>;
},
async getTaskById(id: string): Promise<MotionTask> {
const url = `${BASE_URL}/tasks/${id}?workspaceId=${preferences.workspaceId}`;
logRequest("GET", url, headers);
try {
const response = await fetch(url, {
method: "GET",
headers,
});
if (!response.ok) {
const responseText = await logResponse(response);
throw new Error(
`Failed to get task: ${response.statusText}${responseText ? ` - ${responseText}` : ""}`
);
}
return response.json() as Promise<MotionTask>;
} catch (error) {
console.error("[DEBUG] Get task by ID error:", error);
throw error;
}
},

Comment on lines +513 to +528
async deleteTask(id: string): Promise<void> {
const url = `${BASE_URL}/tasks/${id}?workspaceId=${preferences.workspaceId}`;
logRequest("DELETE", url, headers);

const response = await fetch(url, {
method: "DELETE",
headers,
});

if (!response.ok) {
const responseText = await logResponse(response);
throw new Error(
`Failed to delete task: ${response.statusText}${responseText ? ` - ${responseText}` : ""}`
);
}
},
Copy link
Contributor

Choose a reason for hiding this comment

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

style: deleteTask should verify task exists before attempting deletion to prevent accidental removals

Comment on lines +48 to +53
// Sort tasks by due date (most recent first)
const sortedTasks = [...tasksData].sort((a, b) => {
if (!a.dueDate) return 1;
if (!b.dueDate) return -1;
return new Date(a.dueDate).getTime() - new Date(b.dueDate).getTime();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Tasks are sorted with most recent first, but the comparison is reversed - newer dates should return -1 for ascending order

Suggested change
// Sort tasks by due date (most recent first)
const sortedTasks = [...tasksData].sort((a, b) => {
if (!a.dueDate) return 1;
if (!b.dueDate) return -1;
return new Date(a.dueDate).getTime() - new Date(b.dueDate).getTime();
});
// Sort tasks by due date (most recent first)
const sortedTasks = [...tasksData].sort((a, b) => {
if (!a.dueDate) return 1;
if (!b.dueDate) return -1;
return new Date(b.dueDate).getTime() - new Date(a.dueDate).getTime();
});

Comment on lines +9 to +10
const motionClient = getMotionApiClient();
const tasks = await motionClient.getTasks();
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: getTasks() call should be wrapped in a try-catch block separate from the main try-catch to handle API initialization errors distinctly from task fetching errors

console.error("Error in Ask Motion tool:", error);

// Extract more useful information from the error
const errorDetails = String(error);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: consider using showFailureToast from @raycast/utils for error handling

@@ -0,0 +1,18 @@
# Screenshots for Motion Extension
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we have a markdown file in metadata? Let's remove it

@andreaselia
Copy link
Contributor

Hey @owendavidprice 👋

Would you mind taking a look at the feedback above when you get a chance, please? 🙏

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

Successfully merging this pull request may close these issues.

4 participants