@starlein/paperclip-plugin-company-wizard 0.3.15 → 0.3.19

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/dist/worker.js CHANGED
@@ -9373,6 +9373,17 @@ async function readJson(p) {
9373
9373
  function toPascalCase(name) {
9374
9374
  return name.replace(/[^a-zA-Z0-9\s\-_]/g, "").split(/[\s\-_]+/).filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
9375
9375
  }
9376
+ function normalizeExecutionBaseRef(ref, fallbackRef) {
9377
+ const candidates = [ref, fallbackRef].filter(
9378
+ (value) => typeof value === "string" && value.trim()
9379
+ );
9380
+ const selected = candidates.length > 0 ? String(candidates[0]).trim() : "";
9381
+ if (!selected) return "origin/main";
9382
+ if (selected.startsWith("origin/") || selected.startsWith("refs/")) {
9383
+ return selected;
9384
+ }
9385
+ return `origin/${selected}`;
9386
+ }
9376
9387
  async function assembleCompany({
9377
9388
  companyName,
9378
9389
  companyDescription = "",
@@ -10024,6 +10035,18 @@ Read: \`docs/${doc}\`
10024
10035
  if (!policy || typeof policy !== "object") return null;
10025
10036
  if (policy.defaultMode === "isolated_workspace") {
10026
10037
  if (!enableIsolatedWorktrees || isFreshLocalRepo(workspace)) return null;
10038
+ const strategy = policy.workspaceStrategy;
10039
+ if (!strategy || typeof strategy !== "object") return policy;
10040
+ if (strategy.type !== "git_worktree") return policy;
10041
+ const workspaceStrategy = { ...strategy };
10042
+ const normalizedBaseRef = normalizeExecutionBaseRef(
10043
+ workspaceStrategy.baseRef,
10044
+ workspace?.repoRef || workspace?.defaultRef
10045
+ );
10046
+ if (normalizedBaseRef) {
10047
+ workspaceStrategy.baseRef = normalizedBaseRef;
10048
+ }
10049
+ return { ...policy, workspaceStrategy };
10027
10050
  }
10028
10051
  return policy;
10029
10052
  };
@@ -10624,11 +10647,11 @@ var PaperclipClient = class {
10624
10647
  });
10625
10648
  }
10626
10649
  /**
10627
- * Resolve a clipper role name to a Paperclip API role enum.
10650
+ * Resolve a role name to a Paperclip API role enum.
10628
10651
  * Uses role.json's paperclipRole field, falls back to 'general'.
10629
10652
  */
10630
- static resolveRole(clipperRole, roleData) {
10631
- if (BASE_ROLE_MAP[clipperRole]) return BASE_ROLE_MAP[clipperRole];
10653
+ static resolveRole(roleName, roleData) {
10654
+ if (BASE_ROLE_MAP[roleName]) return BASE_ROLE_MAP[roleName];
10632
10655
  if (roleData?.paperclipRole) return roleData.paperclipRole;
10633
10656
  return "general";
10634
10657
  }
@@ -11098,7 +11121,7 @@ var plugin = definePlugin({
11098
11121
  const cfg = await ctx.config.get() ?? {};
11099
11122
  const companyName = typeof params.companyName === "string" && params.companyName.trim() ? params.companyName.trim() : "Preview";
11100
11123
  const templatesDir = await ensureTemplatesDir(cfg);
11101
- tmpDir = path2.join(os.tmpdir(), `clipper-preview-${Date.now()}`);
11124
+ tmpDir = path2.join(os.tmpdir(), `company-wizard-preview-${Date.now()}`);
11102
11125
  const companiesDir = resolveCompaniesDir(cfg);
11103
11126
  const [presets, allModules] = await Promise.all([
11104
11127
  loadPresets(templatesDir),