paperclip-github-plugin 0.3.0 → 0.3.2

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
@@ -150,7 +150,7 @@ The plugin is designed to avoid persisting raw credentials in plugin state.
150
150
 
151
151
  ### Optional worker-local token file
152
152
 
153
- If Paperclip-managed secrets are not available, the worker can read a local fallback file at `~/.paperclip/plugins/github-sync/config.json`:
153
+ If Paperclip-managed secrets are not available, the worker can read a local fallback file at `${PAPERCLIP_HOME:-~/.paperclip}/plugins/github-sync/config.json`:
154
154
 
155
155
  ```json
156
156
  {
@@ -177,7 +177,7 @@ When an agent posts a GitHub comment or review-thread reply through the plugin,
177
177
 
178
178
  ## Troubleshooting
179
179
 
180
- - If setup is reported as incomplete, confirm that a GitHub token has been saved or that `~/.paperclip/plugins/github-sync/config.json` contains `githubToken`, and make sure at least one mapping has a created Paperclip project.
180
+ - 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.
181
181
  - If Paperclip says board access is required, open plugin settings inside the affected company and complete the Paperclip board access flow before retrying sync.
182
182
  - 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 `PAPERCLIP_API_URL` to a worker-accessible Paperclip API origin.
183
183
  - If a sync run finishes with partial failures, open the saved troubleshooting panel in GitHub Sync to inspect the repository, issue number, raw error, and suggested fix for each recorded failure.
package/dist/manifest.js CHANGED
@@ -435,7 +435,7 @@ var require2 = createRequire(import.meta.url);
435
435
  var packageJson = require2("../package.json");
436
436
  var DASHBOARD_WIDGET_CAPABILITY = "ui.dashboardWidget.register";
437
437
  var SCHEDULE_TICK_CRON = "* * * * *";
438
- var MANIFEST_VERSION = "0.3.0"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
438
+ var MANIFEST_VERSION = "0.3.2"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
439
439
  var manifest = {
440
440
  id: "paperclip-github-plugin",
441
441
  apiVersion: 1,
package/dist/worker.js CHANGED
@@ -1,11 +1,13 @@
1
1
  // src/worker.ts
2
+ import { realpathSync } from "node:fs";
2
3
  import { readFile } from "node:fs/promises";
3
4
  import { homedir } from "node:os";
4
- import { join } from "node:path";
5
+ import { join, resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
5
7
  import { Octokit } from "@octokit/rest";
6
8
  import {
7
9
  definePlugin,
8
- runWorker
10
+ startWorkerRpcHost
9
11
  } from "@paperclipai/plugin-sdk";
10
12
 
11
13
  // src/github-agent-tools.ts
@@ -549,7 +551,7 @@ var SYNC_PROGRESS_PERSIST_INTERVAL_MS = 250;
549
551
  var MAX_SYNC_FAILURE_LOG_ENTRIES = 25;
550
552
  var GITHUB_SECONDARY_RATE_LIMIT_FALLBACK_MS = 6e4;
551
553
  var MISSING_GITHUB_TOKEN_SYNC_MESSAGE = "Configure a GitHub token before running sync.";
552
- var MISSING_GITHUB_TOKEN_SYNC_ACTION = 'Open settings and save a GitHub token secret, or create ~/.paperclip/plugins/github-sync/config.json with a "githubToken" value, and then run sync again.';
554
+ var MISSING_GITHUB_TOKEN_SYNC_ACTION = 'Open settings and save a GitHub token secret, or create $PAPERCLIP_HOME/plugins/github-sync/config.json (or ~/.paperclip/plugins/github-sync/config.json when PAPERCLIP_HOME is unset) with a "githubToken" value, and then run sync again.';
553
555
  var MISSING_MAPPING_SYNC_MESSAGE = "Save at least one mapping with a created Paperclip project before running sync.";
554
556
  var MISSING_MAPPING_SYNC_ACTION = "Open settings, add a repository mapping, let Paperclip create the target project, and then retry sync.";
555
557
  var MISSING_BOARD_ACCESS_SYNC_MESSAGE = "Connect Paperclip board access before running sync on this authenticated deployment.";
@@ -557,7 +559,6 @@ var MISSING_BOARD_ACCESS_SYNC_ACTION = "Open plugin settings for each mapped com
557
559
  var ISSUE_LINK_ENTITY_TYPE = "paperclip-github-plugin.issue-link";
558
560
  var PULL_REQUEST_LINK_ENTITY_TYPE = "paperclip-github-plugin.pull-request-link";
559
561
  var COMMENT_ANNOTATION_ENTITY_TYPE = "paperclip-github-plugin.comment-annotation";
560
- var EXTERNAL_CONFIG_FILE_PATH_SEGMENTS = [".paperclip", "plugins", "github-sync", "config.json"];
561
562
  var AI_AUTHORED_COMMENT_FOOTER_PREFIX = "Created by a Paperclip AI agent using ";
562
563
  function normalizeCompanyId(value) {
563
564
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
@@ -2625,8 +2626,8 @@ async function waitForSyncResultWithinGracePeriod(promise, timeoutMs) {
2625
2626
  try {
2626
2627
  return await Promise.race([
2627
2628
  promise,
2628
- new Promise((resolve) => {
2629
- timer = globalThis.setTimeout(() => resolve(null), timeoutMs);
2629
+ new Promise((resolve2) => {
2630
+ timer = globalThis.setTimeout(() => resolve2(null), timeoutMs);
2630
2631
  })
2631
2632
  ]);
2632
2633
  } finally {
@@ -2701,13 +2702,17 @@ function normalizeGitHubToken(value) {
2701
2702
  return trimmed ? trimmed : void 0;
2702
2703
  }
2703
2704
  function getExternalConfigFilePath() {
2704
- const homeDirectory = getHomeDirectory();
2705
- return homeDirectory ? join(homeDirectory, ...EXTERNAL_CONFIG_FILE_PATH_SEGMENTS) : void 0;
2705
+ const paperclipHomeDirectory = getPaperclipHomeDirectory();
2706
+ return paperclipHomeDirectory ? join(paperclipHomeDirectory, "plugins", "github-sync", "config.json") : void 0;
2706
2707
  }
2707
- function getHomeDirectory() {
2708
+ function getPaperclipHomeDirectory() {
2709
+ const configuredPaperclipHome = process.env.PAPERCLIP_HOME?.trim();
2710
+ if (configuredPaperclipHome) {
2711
+ return resolve(configuredPaperclipHome);
2712
+ }
2708
2713
  try {
2709
2714
  const resolvedHomeDirectory = homedir();
2710
- return typeof resolvedHomeDirectory === "string" && resolvedHomeDirectory.trim() ? resolvedHomeDirectory : void 0;
2715
+ return typeof resolvedHomeDirectory === "string" && resolvedHomeDirectory.trim() ? join(resolvedHomeDirectory, ".paperclip") : void 0;
2711
2716
  } catch {
2712
2717
  return void 0;
2713
2718
  }
@@ -9917,6 +9922,17 @@ function registerGitHubAgentTools(ctx) {
9917
9922
  })
9918
9923
  );
9919
9924
  }
9925
+ function shouldStartWorkerHost(moduleUrl, entry = process.argv[1]) {
9926
+ if (typeof entry !== "string" || !entry.trim()) {
9927
+ return false;
9928
+ }
9929
+ const modulePath = fileURLToPath(moduleUrl);
9930
+ try {
9931
+ return realpathSync(entry) === realpathSync(modulePath);
9932
+ } catch {
9933
+ return resolve(entry) === resolve(modulePath);
9934
+ }
9935
+ }
9920
9936
  var plugin = definePlugin({
9921
9937
  async setup(ctx) {
9922
9938
  ctx.data.register("settings.registration", async (input) => {
@@ -10190,7 +10206,10 @@ var plugin = definePlugin({
10190
10206
  }
10191
10207
  });
10192
10208
  var worker_default = plugin;
10193
- runWorker(plugin, import.meta.url);
10209
+ if (shouldStartWorkerHost(import.meta.url)) {
10210
+ startWorkerRpcHost({ plugin });
10211
+ }
10194
10212
  export {
10195
- worker_default as default
10213
+ worker_default as default,
10214
+ shouldStartWorkerHost
10196
10215
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Paperclip plugin for synchronizing GitHub issues into Paperclip projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",