paperclip-github-plugin 0.10.2 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,11 +70,11 @@ GitHub Sync exposes a dedicated KPI dashboard widget alongside the operational s
70
70
 
71
71
  Because GitHub alone cannot tell which pull requests came from a Paperclip company, the plugin uses explicit Paperclip attribution for delivery activity. `create_pull_request` automatically records a Paperclip-created PR event, and agents that use `gh` or another non-plugin GitHub client can post pull-request-created events to the plugin API route so the KPI history stays specific to Paperclip work. When either path includes the Paperclip issue id, GitHub Sync also records the pull request link so later sync runs can move that issue based on PR CI, merge state, and review activity.
72
72
 
73
- That API route path matters on authenticated Paperclip deployments today because a current host bug blocks agents from calling plugin tools unless the instance runs in `local_trusted` mode. Those agents can still use `gh` with the propagated `GITHUB_TOKEN`, then call the agent-authenticated plugin API route from the shell after they create a PR. The Paperclip host authenticates `Authorization: Bearer <PAPERCLIP_API_KEY>`, scopes the request to the calling agent's company, and rejects anonymous or non-agent calls before dispatching to the worker.
73
+ That API route remains intentionally separate from the plugin tool surface because it records PRs created outside the plugin, for example when an agent uses `gh` with the propagated `GITHUB_TOKEN`. The Paperclip host authenticates the bearer agent token, scopes the request to the calling agent's company, and rejects anonymous or non-agent calls before dispatching to the worker.
74
74
 
75
75
  ### Third-party issue links
76
76
 
77
- Sometimes a Paperclip issue is implemented through a GitHub issue or pull request in a repository that is not mapped to any Paperclip project. GitHub Sync can now track those targeted links without enrolling the whole repository in sync. The `link_github_item` agent tool records the durable link on local-trusted Paperclip instances, and authenticated agent runs can post the same link to `/api/plugins/paperclip-github-plugin/api/issue-link` with `PAPERCLIP_API_KEY` when plugin tools are blocked by host board-auth gates.
77
+ Sometimes a Paperclip issue is implemented through a GitHub issue or pull request in a repository that is not mapped to any Paperclip project. GitHub Sync can now track those targeted links without enrolling the whole repository in sync. Authenticated agent runs should use the `link_github_item` plugin tool to record the durable link.
78
78
 
79
79
  Third-party links are company-scoped and sync only the linked GitHub issue or pull request. Future manual or scheduled company sync runs refresh those external records and update the Paperclip issue status from the same CI, mergeability, review, thread, and issue-state rules used for mapped repositories.
80
80
 
@@ -96,7 +96,7 @@ Manual GitHub issue links are added to the same import registry and issue-link e
96
96
 
97
97
  When a Paperclip issue is linked to a GitHub issue and also has older direct pull request links, the GitHub issue remains the status source of truth. Direct pull request links only drive status for PR-only Paperclip issues, which prevents stale merged PR metadata from closing work while the GitHub issue and its current linked PR are still open.
98
98
 
99
- Operators can unlink a linked Paperclip issue from the GitHub detail surface when they intentionally want GitHub Sync to stop updating it. Agent-facing tools and native agent API routes can create durable issue and pull request links, but they do not expose an unlink operation; internal sync repair may still tombstone a link when GitHub transfers an issue to an unmapped repository.
99
+ Operators can unlink a linked Paperclip issue from the GitHub detail surface when they intentionally want GitHub Sync to stop updating it. Agent-facing tools can create durable issue and pull request links, but they do not expose an unlink operation; internal sync repair may still tombstone a link when GitHub transfers an issue to an unmapped repository.
100
100
 
101
101
  ### Agent workflows built in
102
102
 
@@ -106,7 +106,7 @@ They can also link a Paperclip issue to a GitHub issue or pull request in any ac
106
106
  ## Requirements
107
107
 
108
108
  - Node.js 20+
109
- - a Paperclip host with plugin installation enabled. GitHub Sync is built and tested against Paperclip `2026.529.0`; the manifest relies on explicit capabilities instead of a strict host-version gate because current latest/development hosts can report `0.0.0` during plugin upgrade.
109
+ - a Paperclip host with plugin installation enabled. GitHub Sync is built and tested against Paperclip `2026.618.0`; the manifest relies on explicit capabilities instead of a strict host-version gate because current latest/development hosts can report `0.0.0` during plugin upgrade.
110
110
  - a GitHub token with API access to the repositories you want to sync
111
111
 
112
112
  ## Install from npm
@@ -279,9 +279,7 @@ curl -X POST "${PAPERCLIP_API_URL%/}/api/plugins/paperclip-github-plugin/api/com
279
279
 
280
280
  The worker deduplicates repeated PR events by preferring the pull request URL, then `repository + pullRequestNumber`, before falling back to the explicit `eventKey`. When `paperclipIssueId` is present, the worker verifies the live pull request and persists the same PR-link metadata used by scheduled/manual status syncs.
281
281
 
282
- Current host caveat: on authenticated Paperclip deployments, the Paperclip host currently guards `GET /api/plugins/tools` and `POST /api/plugins/tools/execute` with board authentication before dispatching to any plugin worker. If an agent run does not have board access for the target company, GitHub Sync tool discovery and execution fail with `403 {"error":"Board access required"}` before this plugin's worker code runs.
283
-
284
- Because the KPI attribution endpoint is a native plugin JSON route rather than a plugin tool, authenticated agent runs can still call it directly with `PAPERCLIP_API_KEY` even while that host bug blocks the GitHub Sync tool surface.
282
+ Paperclip `2026.618.0` accepts agent authentication for plugin tool discovery and execution, so agents should use the declared GitHub Sync tools for first-class workflow operations. The KPI attribution endpoint remains a native plugin JSON route for PRs created outside the plugin tool path.
285
283
 
286
284
  ### Pull request asset upload
287
285
 
@@ -289,31 +287,24 @@ For PRs that need durable assets in the description, agents can call the `upload
289
287
 
290
288
  The plugin writes the asset to a non-merge artifact branch named `paperclip-artifacts-pr-<number>` by default, stores it under `assets/pr-<number>/<head-sha>/`, and returns immutable raw GitHub URLs plus Markdown suitable for a PR description. Images return image Markdown; PDFs and other files return normal Markdown links.
291
289
 
292
- Authenticated agent runs that cannot call plugin tools can post the same JSON payload to `/api/plugins/paperclip-github-plugin/api/pull-request-assets` with `Authorization: Bearer ${PAPERCLIP_API_KEY}`. The native plugin route is agent-authenticated by the Paperclip host before worker dispatch.
293
-
294
- Example:
290
+ Example tool payload:
295
291
 
296
- ```bash
297
- contentBase64="$(base64 -w0 /tmp/review-report.pdf)"
298
- payload="$(jq -n \
299
- --arg repository paperclipai/example-repo \
300
- --argjson pullRequestNumber 21 \
301
- --arg fileName review-report.pdf \
302
- --arg label 'Review report PDF' \
303
- --arg contentBase64 "$contentBase64" \
304
- '{repository:$repository,pullRequestNumber:$pullRequestNumber,fileName:$fileName,label:$label,contentBase64:$contentBase64,mimeType:"application/pdf"}')"
305
-
306
- curl -X POST "${PAPERCLIP_API_URL%/}/api/plugins/paperclip-github-plugin/api/pull-request-assets" \
307
- -H "content-type: application/json" \
308
- -H "authorization: Bearer ${PAPERCLIP_API_KEY}" \
309
- -d "${payload}"
292
+ ```json
293
+ {
294
+ "repository": "paperclipai/example-repo",
295
+ "pullRequestNumber": 21,
296
+ "fileName": "review-report.pdf",
297
+ "label": "Review report PDF",
298
+ "contentBase64": "<base64 PDF bytes>",
299
+ "mimeType": "application/pdf"
300
+ }
310
301
  ```
311
302
 
312
- The response body contains `asset.markdown`, `asset.rawUrl`, `asset.artifactBranch`, `asset.path`, and `asset.commitSha`.
303
+ The tool result contains `asset.markdown`, `asset.rawUrl`, `asset.artifactBranch`, `asset.path`, and `asset.commitSha`.
313
304
 
314
- ### Issue link API route
305
+ ### Issue link tool
315
306
 
316
- Authenticated agent runs can link the current Paperclip issue to a GitHub issue or pull request by posting to `/api/plugins/paperclip-github-plugin/api/issue-link`. This is useful after creating a PR with `gh` in a repository that is not mapped to a Paperclip project.
307
+ Authenticated agent runs can link the current Paperclip issue to a GitHub issue or pull request by calling the `link_github_item` tool. This is useful after creating a PR with `gh` in a repository that is not mapped to a Paperclip project.
317
308
 
318
309
  Supported payload fields:
319
310
 
@@ -323,15 +314,13 @@ Supported payload fields:
323
314
  - `repository` optional: `owner/repo` or `https://github.com/owner/repo`, required for number-only references when the issue project is not mapped to that repository
324
315
  - `issueNumber`, `pullRequestNumber`, or `pullRequestUrl` optional alternatives to `reference`
325
316
 
326
- Example:
327
-
328
- ```bash
329
- payload='{"paperclipIssueId":"iss_123","pullRequestUrl":"https://github.com/third-party/external/pull/77"}'
317
+ Example tool payload:
330
318
 
331
- curl -X POST "${PAPERCLIP_API_URL%/}/api/plugins/paperclip-github-plugin/api/issue-link" \
332
- -H "content-type: application/json" \
333
- -H "authorization: Bearer ${PAPERCLIP_API_KEY}" \
334
- -d "${payload}"
319
+ ```json
320
+ {
321
+ "paperclipIssueId": "iss_123",
322
+ "pullRequestUrl": "https://github.com/third-party/external/pull/77"
323
+ }
335
324
  ```
336
325
 
337
326
  ## Troubleshooting
@@ -339,7 +328,7 @@ curl -X POST "${PAPERCLIP_API_URL%/}/api/plugins/paperclip-github-plugin/api/iss
339
328
  - If an older GitHub Sync build fails upgrade with `requires host version 2026.427.0 or newer, but this server is running 0.0.0`, upgrade to a build that removes the strict manifest host-version gate. The host is reporting a development-version sentinel, so the plugin now relies on declared capabilities and runtime fallbacks instead.
340
329
  - If setup is reported as incomplete, confirm that a GitHub token has been saved or that `${PAPERCLIP_HOME:-~/.paperclip}/plugins/github-sync/config.json` contains `githubToken`, and make sure at least one mapping has a created Paperclip project or at least one Paperclip issue has been linked to GitHub.
341
330
  - If Paperclip says board access is required, open plugin settings inside the affected company and complete the Paperclip board access flow before retrying sync.
342
- - If GitHub Sync agent tools fail with `403 {"error":"Board access required"}` on `/api/plugins/tools` or `/api/plugins/tools/execute`, the current Paperclip host rejected the request before the plugin worker ran. Re-run from a board-authenticated session or agent run that has board access to the target company.
331
+ - If GitHub Sync agent tools fail on `/api/plugins/tools` or `/api/plugins/tools/execute`, confirm the Paperclip host is `2026.618.0` or newer and that the tool request includes the agent run context required by Paperclip.
343
332
  - If a KPI API route call is rejected, make sure the request includes `Authorization: Bearer ${PAPERCLIP_API_KEY}`, that the token is still valid for the current run, and that any `companyId` in the payload matches the calling agent's company.
344
333
  - If the worker reaches an authenticated HTML page instead of the Paperclip API JSON responses it expects, connect Paperclip board access for that company or set **Worker Paperclip API URL** in GitHub Sync settings to a worker-accessible Paperclip API origin.
345
334
  - If a Paperclip API fetch fails before any HTTP response is returned, the saved diagnostics include the method, URL, primary error, nested cause, and cause code when Node exposes them.
@@ -365,8 +354,10 @@ Useful scripts:
365
354
 
366
355
  - `pnpm dev` watches the manifest, worker, and UI bundles and rebuilds them into `dist/`
367
356
  - `pnpm dev:ui` starts a local Paperclip plugin UI dev server from `dist/ui` on port `4177`
368
- - `pnpm test:e2e` builds the plugin, boots an isolated Paperclip `2026.529.0` instance, installs the plugin, and verifies the hosted settings page renders
369
- - `pnpm verify:manual` builds the plugin, boots a local-trusted Paperclip `2026.529.0` instance for manual inspection, seeds a `Dummy Company` with a mapped review project and a `CEO` agent on the Codex local adapter using model `gpt-5.4`, installs the plugin, and opens the company dashboard without seeding KPI history.
357
+ - `pnpm test:e2e` builds the plugin, boots an isolated Paperclip `2026.618.0` instance, installs the plugin, and verifies the hosted settings page renders
358
+ - `pnpm verify:manual` builds the plugin, boots a local-trusted Paperclip `2026.618.0` instance for manual inspection, seeds a `Dummy Company` with a mapped review project and a `CEO` agent on the Codex local adapter using model `gpt-5.4`, installs the plugin, and opens the company dashboard without seeding KPI history.
359
+
360
+ The disposable Paperclip harnesses run `paperclipai@2026.618.0` under `node@24`, matching the release's Docker baseline and avoiding Node 20's missing `node:sqlite` runtime module.
370
361
 
371
362
  For fast hosted UI iteration, run `pnpm dev` in one terminal and `pnpm dev:ui` in another.
372
363
 
package/dist/manifest.js CHANGED
@@ -631,18 +631,12 @@ var GITHUB_SYNC_PLUGIN_ID = "paperclip-github-plugin";
631
631
  var COMPANY_METRIC_API_ROUTE_KEY = "record-company-metric-event";
632
632
  var COMPANY_METRIC_API_ROUTE_PATH = "/company-metrics/events";
633
633
  var COMPANY_METRIC_API_ROUTE_URL_PATH = `/api/plugins/${GITHUB_SYNC_PLUGIN_ID}/api${COMPANY_METRIC_API_ROUTE_PATH}`;
634
- var ISSUE_LINK_API_ROUTE_KEY = "link-github-item";
635
- var ISSUE_LINK_API_ROUTE_PATH = "/issue-link";
636
- var ISSUE_LINK_API_ROUTE_URL_PATH = `/api/plugins/${GITHUB_SYNC_PLUGIN_ID}/api${ISSUE_LINK_API_ROUTE_PATH}`;
637
- var PULL_REQUEST_ASSET_API_ROUTE_KEY = "upload-pull-request-asset";
638
- var PULL_REQUEST_ASSET_API_ROUTE_PATH = "/pull-request-assets";
639
- var PULL_REQUEST_ASSET_API_ROUTE_URL_PATH = `/api/plugins/${GITHUB_SYNC_PLUGIN_ID}/api${PULL_REQUEST_ASSET_API_ROUTE_PATH}`;
640
634
 
641
635
  // src/manifest.ts
642
636
  var require2 = createRequire(import.meta.url);
643
637
  var packageJson = require2("../package.json");
644
638
  var SCHEDULE_TICK_CRON = "* * * * *";
645
- var MANIFEST_VERSION = "0.10.2"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
639
+ var MANIFEST_VERSION = "0.12.0"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
646
640
  var manifest = {
647
641
  id: GITHUB_SYNC_PLUGIN_ID,
648
642
  apiVersion: 1,
@@ -714,20 +708,6 @@ var manifest = {
714
708
  path: COMPANY_METRIC_API_ROUTE_PATH,
715
709
  auth: "agent",
716
710
  capability: "api.routes.register"
717
- },
718
- {
719
- routeKey: ISSUE_LINK_API_ROUTE_KEY,
720
- method: "POST",
721
- path: ISSUE_LINK_API_ROUTE_PATH,
722
- auth: "agent",
723
- capability: "api.routes.register"
724
- },
725
- {
726
- routeKey: PULL_REQUEST_ASSET_API_ROUTE_KEY,
727
- method: "POST",
728
- path: PULL_REQUEST_ASSET_API_ROUTE_PATH,
729
- auth: "agent",
730
- capability: "api.routes.register"
731
711
  }
732
712
  ],
733
713
  tools: GITHUB_AGENT_TOOLS,
package/dist/ui/index.js CHANGED
@@ -5,7 +5,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
8
+ try {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ } catch (e) {
11
+ throw mod = 0, e;
12
+ }
9
13
  };
10
14
  var __export = (target, all5) => {
11
15
  for (var name2 in all5)