feat: Add API endpoint to register/remove projects#16194
Closed
qdddddd wants to merge 4 commits intoanomalyco:devfrom
Closed
feat: Add API endpoint to register/remove projects#16194qdddddd wants to merge 4 commits intoanomalyco:devfrom
qdddddd wants to merge 4 commits intoanomalyco:devfrom
Conversation
- Add new POST endpoint that accepts a directory path - Uses existing Project.fromDirectory() to analyze and register the project - Returns the registered project information - Enables programmatic project registration for integrations and bots
Contributor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
- add Project.remove() to delete a project by projectID\n- expose DELETE /project/:projectID server route\n- return boolean success response for integrations
Author
|
Closing and resubmitting as requested. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #
Type of change
What does this PR do?
This PR adds project lifecycle endpoints so integrations can manage projects programmatically:
POST /projectto register a project from a directory pathDELETE /project/:projectIDto remove a project by IDBefore this change, API users could list/update projects but could not add or remove them. The new routes reuse existing project internals:
Project.fromDirectory()Project.remove()(new helper), which removes the project row by ID and returns successThis keeps behavior aligned with OpenCode's project model while making bot/integration workflows possible.
How did you verify your code works?
packages/opencode/test/server/project-routes.test.ts:POST /projectPOST /project(400)DELETE /project/:projectID, including verification that the deleted project no longer appears inGET /projectbun test --timeout 30000 test/server/project-routes.test.ts(frompackages/opencode)POST /projectreturns project JSON for real directoriesDELETE /project/:projectIDreturnstrueand the project no longer appears inGET /projectScreenshots / recordings
N/A (no UI change)
Checklist