paperclip-github-plugin 0.3.1 → 0.3.3

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.1"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
438
+ var MANIFEST_VERSION = "0.3.3"?.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
@@ -551,7 +551,7 @@ var SYNC_PROGRESS_PERSIST_INTERVAL_MS = 250;
551
551
  var MAX_SYNC_FAILURE_LOG_ENTRIES = 25;
552
552
  var GITHUB_SECONDARY_RATE_LIMIT_FALLBACK_MS = 6e4;
553
553
  var MISSING_GITHUB_TOKEN_SYNC_MESSAGE = "Configure a GitHub token before running sync.";
554
- 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.';
555
555
  var MISSING_MAPPING_SYNC_MESSAGE = "Save at least one mapping with a created Paperclip project before running sync.";
556
556
  var MISSING_MAPPING_SYNC_ACTION = "Open settings, add a repository mapping, let Paperclip create the target project, and then retry sync.";
557
557
  var MISSING_BOARD_ACCESS_SYNC_MESSAGE = "Connect Paperclip board access before running sync on this authenticated deployment.";
@@ -559,7 +559,6 @@ var MISSING_BOARD_ACCESS_SYNC_ACTION = "Open plugin settings for each mapped com
559
559
  var ISSUE_LINK_ENTITY_TYPE = "paperclip-github-plugin.issue-link";
560
560
  var PULL_REQUEST_LINK_ENTITY_TYPE = "paperclip-github-plugin.pull-request-link";
561
561
  var COMMENT_ANNOTATION_ENTITY_TYPE = "paperclip-github-plugin.comment-annotation";
562
- var EXTERNAL_CONFIG_FILE_PATH_SEGMENTS = [".paperclip", "plugins", "github-sync", "config.json"];
563
562
  var AI_AUTHORED_COMMENT_FOOTER_PREFIX = "Created by a Paperclip AI agent using ";
564
563
  function normalizeCompanyId(value) {
565
564
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
@@ -1158,6 +1157,9 @@ function createMappingId(index) {
1158
1157
  function normalizeOptionalString2(value) {
1159
1158
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
1160
1159
  }
1160
+ function stripNullBytes(value) {
1161
+ return value.replace(/\u0000/g, "");
1162
+ }
1161
1163
  function getErrorStatus(error) {
1162
1164
  if (!error || typeof error !== "object" || !("status" in error)) {
1163
1165
  return void 0;
@@ -1420,7 +1422,11 @@ function normalizeSecretRef(value) {
1420
1422
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
1421
1423
  }
1422
1424
  function normalizeGitHubUserLogin(value) {
1423
- return typeof value === "string" && value.trim() ? value.trim().toLowerCase() : void 0;
1425
+ if (typeof value !== "string") {
1426
+ return void 0;
1427
+ }
1428
+ const trimmed = stripNullBytes(value).trim();
1429
+ return trimmed ? trimmed.toLowerCase() : void 0;
1424
1430
  }
1425
1431
  function normalizeGitHubTokenRef(value) {
1426
1432
  return normalizeSecretRef(value);
@@ -2703,13 +2709,17 @@ function normalizeGitHubToken(value) {
2703
2709
  return trimmed ? trimmed : void 0;
2704
2710
  }
2705
2711
  function getExternalConfigFilePath() {
2706
- const homeDirectory = getHomeDirectory();
2707
- return homeDirectory ? join(homeDirectory, ...EXTERNAL_CONFIG_FILE_PATH_SEGMENTS) : void 0;
2712
+ const paperclipHomeDirectory = getPaperclipHomeDirectory();
2713
+ return paperclipHomeDirectory ? join(paperclipHomeDirectory, "plugins", "github-sync", "config.json") : void 0;
2708
2714
  }
2709
- function getHomeDirectory() {
2715
+ function getPaperclipHomeDirectory() {
2716
+ const configuredPaperclipHome = process.env.PAPERCLIP_HOME?.trim();
2717
+ if (configuredPaperclipHome) {
2718
+ return resolve(configuredPaperclipHome);
2719
+ }
2710
2720
  try {
2711
2721
  const resolvedHomeDirectory = homedir();
2712
- return typeof resolvedHomeDirectory === "string" && resolvedHomeDirectory.trim() ? resolvedHomeDirectory : void 0;
2722
+ return typeof resolvedHomeDirectory === "string" && resolvedHomeDirectory.trim() ? join(resolvedHomeDirectory, ".paperclip") : void 0;
2713
2723
  } catch {
2714
2724
  return void 0;
2715
2725
  }
@@ -2836,7 +2846,7 @@ function normalizeGitHubUsername(value) {
2836
2846
  if (typeof value !== "string") {
2837
2847
  return void 0;
2838
2848
  }
2839
- const trimmed = value.trim().replace(/^@+/, "");
2849
+ const trimmed = stripNullBytes(value).trim().replace(/^@+/, "");
2840
2850
  return trimmed ? trimmed.toLowerCase() : void 0;
2841
2851
  }
2842
2852
  function buildGitHubUsernameAliases(value) {
@@ -3123,7 +3133,7 @@ function normalizeGitHubIssueLabels(value) {
3123
3133
  const seen = /* @__PURE__ */ new Set();
3124
3134
  const labels = [];
3125
3135
  for (const entry of value) {
3126
- const name = typeof entry === "string" ? entry.trim() : entry && typeof entry === "object" && typeof entry.name === "string" ? entry.name.trim() : "";
3136
+ const name = typeof entry === "string" ? stripNullBytes(entry).trim() : entry && typeof entry === "object" && typeof entry.name === "string" ? stripNullBytes(entry.name).trim() : "";
3127
3137
  if (!name) {
3128
3138
  continue;
3129
3139
  }
@@ -3143,8 +3153,8 @@ function normalizeGitHubIssueRecord(issue) {
3143
3153
  return {
3144
3154
  id: issue.id,
3145
3155
  number: issue.number,
3146
- title: issue.title,
3147
- body: issue.body ?? null,
3156
+ title: stripNullBytes(issue.title),
3157
+ body: typeof issue.body === "string" ? stripNullBytes(issue.body) : null,
3148
3158
  htmlUrl: issue.html_url,
3149
3159
  ...normalizeGitHubUsername(issue.user?.login) ? { authorLogin: normalizeGitHubUsername(issue.user?.login) } : {},
3150
3160
  labels: normalizeGitHubIssueLabels(issue.labels),
@@ -3975,7 +3985,7 @@ async function listNewGitHubIssueCommentsSinceCount(octokit, repository, issueNu
3975
3985
  for (const comment of response.data.slice(remainingOffset)) {
3976
3986
  comments.push({
3977
3987
  id: comment.id,
3978
- body: comment.body ?? "",
3988
+ body: typeof comment.body === "string" ? stripNullBytes(comment.body) : "",
3979
3989
  url: comment.html_url ?? void 0,
3980
3990
  authorLogin: normalizeGitHubUserLogin(comment.user?.login),
3981
3991
  createdAt: comment.created_at ?? void 0,
@@ -4176,7 +4186,7 @@ function normalizeGitHubIssueBodyForPaperclip(body) {
4176
4186
  if (typeof body !== "string") {
4177
4187
  return void 0;
4178
4188
  }
4179
- const trimmed = body.trim();
4189
+ const trimmed = stripNullBytes(body).trim();
4180
4190
  if (!trimmed) {
4181
4191
  return void 0;
4182
4192
  }
@@ -6402,7 +6412,7 @@ async function listAllGitHubIssueComments(octokit, repository, issueNumber) {
6402
6412
  for (const comment of response.data) {
6403
6413
  comments.push({
6404
6414
  id: comment.id,
6405
- body: comment.body ?? "",
6415
+ body: typeof comment.body === "string" ? stripNullBytes(comment.body) : "",
6406
6416
  url: comment.html_url ?? void 0,
6407
6417
  authorLogin: normalizeGitHubUserLogin(comment.user?.login),
6408
6418
  authorUrl: comment.user?.html_url ?? void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Paperclip plugin for synchronizing GitHub issues into Paperclip projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",