Skip to content

feat: Add API endpoint to register/remove projects#16194

Closed
qdddddd wants to merge 4 commits intoanomalyco:devfrom
qdddddd:feature/add-project-api
Closed

feat: Add API endpoint to register/remove projects#16194
qdddddd wants to merge 4 commits intoanomalyco:devfrom
qdddddd:feature/add-project-api

Conversation

@qdddddd
Copy link

@qdddddd qdddddd commented Mar 5, 2026

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR adds project lifecycle endpoints so integrations can manage projects programmatically:

  • POST /project to register a project from a directory path
  • DELETE /project/:projectID to remove a project by ID

Before this change, API users could list/update projects but could not add or remove them. The new routes reuse existing project internals:

  • add uses Project.fromDirectory()
  • delete uses Project.remove() (new helper), which removes the project row by ID and returns success

This keeps behavior aligned with OpenCode's project model while making bot/integration workflows possible.

How did you verify your code works?

  • Added route test coverage in packages/opencode/test/server/project-routes.test.ts:
    • success case for POST /project
    • validation failure case for POST /project (400)
    • success case for DELETE /project/:projectID, including verification that the deleted project no longer appears in GET /project
  • Ran locally:
    • bun test --timeout 30000 test/server/project-routes.test.ts (from packages/opencode)
  • Manual API verification on local patched server:
    • POST /project returns project JSON for real directories
    • DELETE /project/:projectID returns true and the project no longer appears in GET /project

Screenshots / recordings

N/A (no UI change)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

- 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
@github-actions github-actions bot added needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Hey! Your PR title Add API endpoint to register projects doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@qdddddd qdddddd changed the title Add API endpoint to register projects feat: Add API endpoint to register projects Mar 5, 2026
@github-actions github-actions bot removed needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

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
@qdddddd qdddddd changed the title feat: Add API endpoint to register projects feat: Add API endpoint to register/remove projects Mar 5, 2026
@qdddddd
Copy link
Author

qdddddd commented Mar 5, 2026

Closing and resubmitting as requested.

@qdddddd qdddddd closed this Mar 5, 2026
@qdddddd qdddddd deleted the feature/add-project-api branch March 5, 2026 16:44
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.

1 participant