Skip to content

Commit 67cb86f

Browse files
committed
feat: add README.md with plugin architecture, API endpoints, and CI/CD details
1 parent 248dd4b commit 67cb86f

1 file changed

Lines changed: 177 additions & 0 deletions

File tree

README.md

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# com.paca.github
2+
3+
First-party Paca plugin that integrates GitHub repositories, pull requests, and branches with projects and tasks.
4+
5+
This plugin lets a project connect a GitHub token, link repositories, attach pull requests to tasks, create task branches, and receive GitHub webhooks for automatic sync.
6+
7+
---
8+
9+
## Architecture
10+
11+
The plugin follows the standard three-part structure:
12+
13+
```
14+
paca-plugin-github/
15+
├── backend/ — Go WASM plugin (API host runtime)
16+
├── frontend/ — React micro-frontend (Module Federation remote)
17+
└── mcp/ — MCP tools (plugin-sdk-mcp)
18+
```
19+
20+
### Backend (`backend/`)
21+
22+
- Written in Go and compiled to `wasip1/wasm` for production.
23+
- Registered as `com.paca.github`.
24+
- Stores integration/repository/task-link data in plugin-owned tables (see migration `backend/migrations/0001_create_github_tables.sql`).
25+
- Encrypts GitHub token and webhook secret using plugin config (`ENCRYPTION_KEY`).
26+
- Creates/deletes GitHub webhooks for linked repositories.
27+
- Subscribes to events:
28+
- `task.deleted` to clean up task branch and PR links.
29+
- `project.deleted` to clean up integration data.
30+
31+
### Frontend (`frontend/`)
32+
33+
- Vite + React + TanStack Query.
34+
- Exposes task/project GitHub UI through extension points declared in `plugin.json`.
35+
- Communicates with backend through plugin API routes under:
36+
- `/api/v1/plugins/com.paca.github/projects/:projectId/...`
37+
38+
### MCP (`mcp/`)
39+
40+
- Built with `@paca-ai/plugin-sdk-mcp`.
41+
- Exposes GitHub integration tools for agents and automation workflows.
42+
43+
---
44+
45+
## Backend API Endpoints
46+
47+
All routes are project-scoped by the host unless marked as public.
48+
49+
| Method | Path | Description |
50+
|--------|------|-------------|
51+
| `GET` | `/github` | Get current GitHub integration status |
52+
| `POST` | `/github/token` | Set or replace GitHub personal access token |
53+
| `DELETE` | `/github/token` | Remove token and integration |
54+
| `GET` | `/github/repositories` | List GitHub repositories accessible by token |
55+
| `GET` | `/github/linked-repositories` | List repositories linked to this project |
56+
| `POST` | `/github/linked-repositories` | Link a repository and create webhook |
57+
| `DELETE` | `/github/linked-repositories/:repoId` | Unlink repository and delete webhook |
58+
| `GET` | `/tasks/:taskId/github/pull-requests` | List pull requests linked to a task |
59+
| `POST` | `/tasks/:taskId/github/pull-requests` | Link a pull request to a task |
60+
| `DELETE` | `/tasks/:taskId/github/pull-requests/:prId` | Unlink a pull request from a task |
61+
| `POST` | `/tasks/:taskId/github/branches` | Create and link a branch for a task |
62+
| `GET` | `/tasks/:taskId/github/branches` | List branches linked to a task |
63+
| `POST` | `/webhook` | Public GitHub webhook endpoint |
64+
65+
Webhook behavior:
66+
- `pull_request` updates PR cache and can auto-link PRs when branch-task links exist.
67+
- `push` can auto-link branches to tasks when branch names include task references like `PROJ-42`.
68+
69+
---
70+
71+
## Frontend Extension Points
72+
73+
| Extension Point | Component | Label | Order |
74+
|-----------------|-----------|-------|-------|
75+
| `project.settings.tab` | `GitHubSettingsTab` | `GitHub` | `100` |
76+
| `task.detail.section` | `GitHubTaskSection` | - | `5` |
77+
78+
Remote entry URL:
79+
80+
`/plugins/com.paca.github/assets/remoteEntry.js`
81+
82+
---
83+
84+
## MCP Tools
85+
86+
The MCP package provides the following tools:
87+
88+
- `github_get_integration`
89+
- `github_set_token`
90+
- `github_delete_token`
91+
- `github_list_repositories`
92+
- `github_list_linked_repos`
93+
- `github_link_repository`
94+
- `github_unlink_repository`
95+
- `github_list_task_prs`
96+
- `github_link_pr_to_task`
97+
- `github_unlink_pr_from_task`
98+
- `github_create_branch`
99+
- `github_list_task_branches`
100+
101+
---
102+
103+
## Development
104+
105+
### Backend
106+
107+
```bash
108+
cd backend
109+
110+
# Run tests
111+
go test ./...
112+
113+
# Build WASM (requires Go 1.24+)
114+
GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o github.wasm .
115+
```
116+
117+
### Frontend
118+
119+
```bash
120+
cd frontend
121+
122+
# Install dependencies
123+
bun install
124+
125+
# Typecheck
126+
bun run typecheck
127+
128+
# Development build (watch)
129+
bun run dev
130+
131+
# Production build
132+
bun run build
133+
```
134+
135+
### MCP
136+
137+
```bash
138+
cd mcp
139+
140+
# Install dependencies
141+
bun install
142+
143+
# Typecheck
144+
bun run typecheck
145+
146+
# Production build
147+
bun run build
148+
```
149+
150+
---
151+
152+
## CI/CD
153+
154+
This repository includes GitHub Actions workflows under `.github/workflows`:
155+
156+
- `backend-pr-ci.yml`: runs backend lint, build, and tests on backend-related PR changes.
157+
- `frontend-pr-ci.yml`: runs frontend typecheck and build on frontend-related PR changes.
158+
- `mcp-pr-ci.yml`: runs MCP typecheck and build on MCP-related PR changes.
159+
- `release.yml`: builds backend/frontend/mcp artifacts on tag pushes (`v*`) and publishes release assets.
160+
161+
Release artifacts include:
162+
163+
- `github-backend-wasm.tar.gz`
164+
- `github-frontend-dist.tar.gz`
165+
- `github-mcp-dist.tar.gz`
166+
- `github-migrations.tar.gz`
167+
- `github-plugin-manifest.tar.gz`
168+
- `checksums.txt`
169+
170+
---
171+
172+
## Required Backend Config
173+
174+
The backend uses the following allowed config keys defined in `plugin.json`:
175+
176+
- `ENCRYPTION_KEY` for token/secret encryption.
177+
- `PUBLIC_URL` for generating public webhook callback URLs.

0 commit comments

Comments
 (0)