paperclip-github-plugin 0.3.5 → 0.3.6

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
@@ -43,6 +43,8 @@ The plugin adds a full in-host workflow instead of a one-off import script:
43
43
 
44
44
  During sync, the plugin imports one top-level Paperclip issue per GitHub issue, updates already imported issues instead of recreating them, maps GitHub labels into Paperclip labels, and keeps GitHub-specific metadata in dedicated Paperclip surfaces rather than stuffing everything into the issue description.
45
45
 
46
+ When the host exposes plugin issue creation, imported GitHub issues are created through the Paperclip plugin SDK path so they are not attributed to the connected board user. The worker still uses direct local Paperclip REST calls for label sync and for description or status repair paths when those routes are available.
47
+
46
48
  Long-running syncs continue in the background, so quick actions do not have to wait for the whole import to finish. Once a sync has started, the settings page, dashboard widget, and toolbar actions can request cancellation; the worker stops cooperatively after the current repository or issue step finishes.
47
49
 
48
50
  ## Highlights
package/dist/manifest.js CHANGED
@@ -503,7 +503,7 @@ var require2 = createRequire(import.meta.url);
503
503
  var packageJson = require2("../package.json");
504
504
  var DASHBOARD_WIDGET_CAPABILITY = "ui.dashboardWidget.register";
505
505
  var SCHEDULE_TICK_CRON = "* * * * *";
506
- var MANIFEST_VERSION = "0.3.5"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
506
+ var MANIFEST_VERSION = "0.3.6"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
507
507
  var manifest = {
508
508
  id: "paperclip-github-plugin",
509
509
  apiVersion: 1,
package/dist/worker.js CHANGED
@@ -4933,9 +4933,6 @@ function selectPaperclipLabelForGitHubLabel(githubLabel, directory) {
4933
4933
  function getPaperclipLabelsEndpoint(baseUrl, companyId) {
4934
4934
  return new URL(`/api/companies/${companyId}/labels`, baseUrl).toString();
4935
4935
  }
4936
- function getPaperclipIssuesEndpoint(baseUrl, companyId) {
4937
- return new URL(`/api/companies/${companyId}/issues`, baseUrl).toString();
4938
- }
4939
4936
  function getPaperclipIssueEndpoint(baseUrl, issueId) {
4940
4937
  return new URL(`/api/issues/${issueId}`, baseUrl).toString();
4941
4938
  }
@@ -4986,17 +4983,6 @@ async function detectPaperclipBoardAccessRequirement(paperclipApiBaseUrl) {
4986
4983
  return false;
4987
4984
  }
4988
4985
  }
4989
- function parsePaperclipIssueId(value) {
4990
- if (!value || typeof value !== "object") {
4991
- return null;
4992
- }
4993
- const id = value.id;
4994
- if (typeof id !== "string") {
4995
- return null;
4996
- }
4997
- const trimmedId = id.trim();
4998
- return trimmedId || null;
4999
- }
5000
4986
  function parsePaperclipIssueDescription(value) {
5001
4987
  if (!value || typeof value !== "object") {
5002
4988
  return void 0;
@@ -5801,87 +5787,22 @@ function shouldIgnoreGitHubIssue(issue, advancedSettings) {
5801
5787
  (ignoredUsername) => buildGitHubUsernameAliases(ignoredUsername).some((alias) => issueAuthorAliases.has(alias))
5802
5788
  );
5803
5789
  }
5804
- async function applyDefaultAssigneeToPaperclipIssue(ctx, params) {
5805
- const { companyId, issueId, defaultAssigneeAgentId } = params;
5806
- if (!defaultAssigneeAgentId) {
5807
- return;
5808
- }
5809
- try {
5810
- await ctx.issues.update(issueId, { assigneeAgentId: defaultAssigneeAgentId }, companyId);
5811
- } catch (error) {
5812
- ctx.logger.warn("Unable to apply the default assignee to an imported GitHub issue.", {
5813
- companyId,
5814
- issueId,
5815
- assigneeAgentId: defaultAssigneeAgentId,
5816
- error: getErrorMessage(error)
5817
- });
5818
- }
5819
- }
5820
5790
  async function createPaperclipIssue(ctx, mapping, advancedSettings, issue, availableLabels, paperclipApiBaseUrl, syncFailureContext) {
5821
5791
  if (!mapping.companyId || !mapping.paperclipProjectId) {
5822
5792
  throw new Error(`Mapping ${mapping.id} is missing resolved Paperclip project identifiers.`);
5823
5793
  }
5824
5794
  const title = issue.title;
5825
5795
  const description = buildPaperclipIssueDescription(issue);
5826
- let createdIssueId = null;
5827
- let createdIssueDescription;
5828
- let createPath = "sdk";
5829
- if (paperclipApiBaseUrl) {
5830
- try {
5831
- const response = await fetchPaperclipApi(
5832
- getPaperclipIssuesEndpoint(paperclipApiBaseUrl, mapping.companyId),
5833
- {
5834
- method: "POST",
5835
- headers: {
5836
- accept: "application/json",
5837
- "content-type": "application/json"
5838
- },
5839
- body: JSON.stringify({
5840
- projectId: mapping.paperclipProjectId,
5841
- title,
5842
- ...description ? { description } : {}
5843
- })
5844
- },
5845
- {
5846
- companyId: mapping.companyId
5847
- }
5848
- );
5849
- const payloadResult = await readPaperclipApiJsonResponse(response, {
5850
- operationLabel: "issue create"
5851
- });
5852
- if (!payloadResult.failure) {
5853
- const createdIssue = payloadResult.data;
5854
- createdIssueId = parsePaperclipIssueId(createdIssue);
5855
- createdIssueDescription = parsePaperclipIssueDescription(createdIssue);
5856
- createPath = "local_api";
5857
- }
5858
- } catch {
5859
- }
5860
- }
5861
- if (!createdIssueId) {
5862
- const createdIssue = await ctx.issues.create({
5863
- companyId: mapping.companyId,
5864
- projectId: mapping.paperclipProjectId,
5865
- title,
5866
- ...description ? { description } : {},
5867
- ...advancedSettings.defaultAssigneeAgentId ? { assigneeAgentId: advancedSettings.defaultAssigneeAgentId } : {}
5868
- });
5869
- createdIssueId = createdIssue.id;
5870
- createdIssueDescription = createdIssue.description;
5871
- createPath = "sdk";
5872
- }
5873
- const ensuredCreatedIssueId = createdIssueId;
5874
- if (!ensuredCreatedIssueId) {
5875
- throw new Error("GitHub sync could not resolve the created Paperclip issue id.");
5876
- }
5877
- const normalizedCreatedIssueDescription = createdIssueDescription ?? void 0;
5878
- if (createPath !== "sdk") {
5879
- await applyDefaultAssigneeToPaperclipIssue(ctx, {
5880
- companyId: mapping.companyId,
5881
- issueId: ensuredCreatedIssueId,
5882
- defaultAssigneeAgentId: advancedSettings.defaultAssigneeAgentId
5883
- });
5884
- }
5796
+ const createdIssue = await ctx.issues.create({
5797
+ companyId: mapping.companyId,
5798
+ projectId: mapping.paperclipProjectId,
5799
+ title,
5800
+ ...description ? { description } : {},
5801
+ ...advancedSettings.defaultAssigneeAgentId ? { assigneeAgentId: advancedSettings.defaultAssigneeAgentId } : {}
5802
+ });
5803
+ const ensuredCreatedIssueId = createdIssue.id;
5804
+ const normalizedCreatedIssueDescription = createdIssue.description ?? void 0;
5805
+ const createPath = "sdk";
5885
5806
  if (normalizeIssueDescriptionValue(normalizedCreatedIssueDescription) !== description) {
5886
5807
  logIssueDescriptionDiagnostic(
5887
5808
  ctx,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Paperclip plugin for synchronizing GitHub issues into Paperclip projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",