From 6b900e9e7a26d44dec161239ea7280a466b57b68 Mon Sep 17 00:00:00 2001 From: pikann Date: Mon, 18 May 2026 15:57:53 +0700 Subject: [PATCH] fix: update GitHub API paths to include project ID and upgrade plugin SDK version --- backend/go.mod | 2 +- backend/go.sum | 4 ++-- frontend/bun.lock | 4 ++-- frontend/package.json | 2 +- frontend/src/github-api.ts | 24 ++++++++++++------------ plugin.json | 24 ++++++++++++------------ 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/backend/go.mod b/backend/go.mod index 509c507..f6b48a2 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -3,6 +3,6 @@ module github.com/Paca-AI/first-party/github go 1.24 require ( - github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.6 + github.com/Paca-AI/plugin-sdk-go v0.2.0 github.com/google/uuid v1.6.0 ) diff --git a/backend/go.sum b/backend/go.sum index f81502b..bede9ea 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -1,4 +1,4 @@ -github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.6 h1:XN5rln12wkqfhiDg3Ds98WZhX1oiGqWDBRHWoE03wYY= -github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.6/go.mod h1:5WeC6cSEf2wM1ovICZbDaVky9oi5id/Qpdfc5LDAQnw= +github.com/Paca-AI/plugin-sdk-go v0.2.0 h1:Fur6p+OQoC5imq7qmvaQtJnZ3SRVRskx8KcT/rqFHj4= +github.com/Paca-AI/plugin-sdk-go v0.2.0/go.mod h1:5WeC6cSEf2wM1ovICZbDaVky9oi5id/Qpdfc5LDAQnw= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= diff --git a/frontend/bun.lock b/frontend/bun.lock index 76f5d5f..22b2484 100644 --- a/frontend/bun.lock +++ b/frontend/bun.lock @@ -12,7 +12,7 @@ }, "devDependencies": { "@originjs/vite-plugin-federation": "^1.3.6", - "@paca-ai/plugin-sdk-react": "^0.1.0", + "@paca-ai/plugin-sdk-react": "^0.2.0", "@types/react": "^19.2.0", "@types/react-dom": "^19.2.0", "@vitejs/plugin-react": "^4.3.0", @@ -124,7 +124,7 @@ "@originjs/vite-plugin-federation": ["@originjs/vite-plugin-federation@1.4.1", "", { "dependencies": { "estree-walker": "^3.0.2", "magic-string": "^0.27.0" } }, "sha512-Uo08jW5pj1t58OUKuZNkmzcfTN2pqeVuAWCCiKf/75/oll4Efq4cHOqSE1FXMlvwZNGDziNdDyBbQ5IANem3CQ=="], - "@paca-ai/plugin-sdk-react": ["@paca-ai/plugin-sdk-react@0.1.0", "", { "peerDependencies": { "@tanstack/react-query": ">=5.0.0", "react": ">=18.0.0", "react-dom": ">=18.0.0" } }, "sha512-btW6RWIbQGSRTAybL0Yd9TG3wO4zP6UU9KPg0js78VDWWnwUTZHfrmFu+0cf1VrsPZsuJ6WSZKGcnjTKe7Yxgw=="], + "@paca-ai/plugin-sdk-react": ["@paca-ai/plugin-sdk-react@0.2.0", "", { "peerDependencies": { "@tanstack/react-query": ">=5.0.0", "react": ">=18.0.0", "react-dom": ">=18.0.0" } }, "sha512-tiSM9DHx9zw+lqtsLyyMd9gww5nvpljTKm08me/Kg8NLjJSH7AH57zYfgL4QoQdpNxfPtZWylqeUh7ioZbbaVQ=="], "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-beta.27", "", {}, "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA=="], diff --git a/frontend/package.json b/frontend/package.json index a344d51..34db25c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -17,7 +17,7 @@ }, "devDependencies": { "@originjs/vite-plugin-federation": "^1.3.6", - "@paca-ai/plugin-sdk-react": "^0.1.0", + "@paca-ai/plugin-sdk-react": "^0.2.0", "@types/react": "^19.2.0", "@types/react-dom": "^19.2.0", "typescript": "^5.8.3", diff --git a/frontend/src/github-api.ts b/frontend/src/github-api.ts index 6ac3f1d..3278918 100644 --- a/frontend/src/github-api.ts +++ b/frontend/src/github-api.ts @@ -128,26 +128,26 @@ export const taskBranchesKey = (projectId: string, taskId: string) => export async function getGitHubIntegration( api: PluginApiClient, ): Promise { - return api.pluginGet(PLUGIN_ID, "/github"); + return api.pluginGet(PLUGIN_ID, `/projects/${api.projectId}/github`); } export async function setGitHubToken( api: PluginApiClient, token: string, ): Promise { - return api.pluginPost(PLUGIN_ID, "/github/token", { + return api.pluginPost(PLUGIN_ID, `/projects/${api.projectId}/github/token`, { token, }); } export async function deleteGitHubToken(api: PluginApiClient): Promise { - return api.pluginDelete(PLUGIN_ID, "/github/token"); + return api.pluginDelete(PLUGIN_ID, `/projects/${api.projectId}/github/token`); } export async function listAccessibleRepos( api: PluginApiClient, ): Promise { - return api.pluginGet(PLUGIN_ID, "/github/repositories"); + return api.pluginGet(PLUGIN_ID, `/projects/${api.projectId}/github/repositories`); } export async function linkRepository( @@ -157,7 +157,7 @@ export async function linkRepository( ): Promise { return api.pluginPost( PLUGIN_ID, - "/github/linked-repositories", + `/projects/${api.projectId}/github/linked-repositories`, { owner, repo_name: repoName }, ); } @@ -167,7 +167,7 @@ export async function listLinkedRepositories( ): Promise { return api.pluginGet( PLUGIN_ID, - "/github/linked-repositories", + `/projects/${api.projectId}/github/linked-repositories`, ); } @@ -177,7 +177,7 @@ export async function unlinkRepository( ): Promise { return api.pluginDelete( PLUGIN_ID, - `/github/linked-repositories/${repoId}`, + `/projects/${api.projectId}/github/linked-repositories/${repoId}`, ); } @@ -187,7 +187,7 @@ export async function listTaskPRs( ): Promise { return api.pluginGet( PLUGIN_ID, - `/tasks/${taskId}/github/pull-requests`, + `/projects/${api.projectId}/tasks/${taskId}/github/pull-requests`, ); } @@ -199,7 +199,7 @@ export async function linkPRToTask( ): Promise { return api.pluginPost( PLUGIN_ID, - `/tasks/${taskId}/github/pull-requests`, + `/projects/${api.projectId}/tasks/${taskId}/github/pull-requests`, { repo_id: repoId, pr_number: prNumber }, ); } @@ -211,7 +211,7 @@ export async function unlinkPRFromTask( ): Promise { return api.pluginDelete( PLUGIN_ID, - `/tasks/${taskId}/github/pull-requests/${prId}`, + `/projects/${api.projectId}/tasks/${taskId}/github/pull-requests/${prId}`, ); } @@ -221,7 +221,7 @@ export async function listTaskBranches( ): Promise { return api.pluginGet( PLUGIN_ID, - `/tasks/${taskId}/github/branches`, + `/projects/${api.projectId}/tasks/${taskId}/github/branches`, ); } @@ -234,7 +234,7 @@ export async function createBranch( ): Promise { return api.pluginPost( PLUGIN_ID, - `/tasks/${taskId}/github/branches`, + `/projects/${api.projectId}/tasks/${taskId}/github/branches`, { repo_id: repoId, branch_name: branchName, source_branch: sourceBranch }, ); } diff --git a/plugin.json b/plugin.json index e4c97e1..36a18bf 100644 --- a/plugin.json +++ b/plugin.json @@ -10,7 +10,7 @@ "routes": [ { "method": "GET", - "path": "/github", + "path": "/projects/:projectId/github", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -23,7 +23,7 @@ }, { "method": "POST", - "path": "/github/token", + "path": "/projects/:projectId/github/token", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -36,7 +36,7 @@ }, { "method": "DELETE", - "path": "/github/token", + "path": "/projects/:projectId/github/token", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -49,7 +49,7 @@ }, { "method": "GET", - "path": "/github/repositories", + "path": "/projects/:projectId/github/repositories", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -62,7 +62,7 @@ }, { "method": "GET", - "path": "/github/linked-repositories", + "path": "/projects/:projectId/github/linked-repositories", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -75,7 +75,7 @@ }, { "method": "POST", - "path": "/github/linked-repositories", + "path": "/projects/:projectId/github/linked-repositories", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -88,7 +88,7 @@ }, { "method": "DELETE", - "path": "/github/linked-repositories/:repoId", + "path": "/projects/:projectId/github/linked-repositories/:repoId", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -101,7 +101,7 @@ }, { "method": "GET", - "path": "/tasks/:taskId/github/pull-requests", + "path": "/projects/:projectId/tasks/:taskId/github/pull-requests", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -114,7 +114,7 @@ }, { "method": "POST", - "path": "/tasks/:taskId/github/pull-requests", + "path": "/projects/:projectId/tasks/:taskId/github/pull-requests", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -127,7 +127,7 @@ }, { "method": "DELETE", - "path": "/tasks/:taskId/github/pull-requests/:prId", + "path": "/projects/:projectId/tasks/:taskId/github/pull-requests/:prId", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -140,7 +140,7 @@ }, { "method": "POST", - "path": "/tasks/:taskId/github/branches", + "path": "/projects/:projectId/tasks/:taskId/github/branches", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" }, @@ -153,7 +153,7 @@ }, { "method": "GET", - "path": "/tasks/:taskId/github/branches", + "path": "/projects/:projectId/tasks/:taskId/github/branches", "middlewares": [ { "name": "optionalAuthn" }, { "name": "requireFreshPassword" },