@starlein/paperclip-plugin-company-wizard 0.4.3 → 0.4.5-a

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/dist/manifest.js +1 -1
  4. package/dist/manifest.js.map +1 -1
  5. package/dist/ui/index.css +6 -3
  6. package/dist/ui/index.css.map +2 -2
  7. package/dist/ui/index.js +69 -74
  8. package/dist/ui/index.js.map +3 -3
  9. package/dist/worker.js +62 -5
  10. package/dist/worker.js.map +2 -2
  11. package/package.json +1 -1
  12. package/templates/bootstrap-instructions.md +1 -1
  13. package/templates/modules/ci-cd/agents/devops/skills/ci-cd.md +4 -4
  14. package/templates/modules/ci-cd/agents/engineer/skills/ci-cd.fallback.md +1 -1
  15. package/templates/modules/ci-cd/module.meta.json +3 -3
  16. package/templates/modules/ci-cd/skills/ci-cd.bar.md +2 -2
  17. package/templates/modules/ci-cd/skills/ci-cd.md +4 -4
  18. package/templates/modules/github-repo/README.md +2 -2
  19. package/templates/modules/github-repo/agents/engineer/skills/git-workflow.md +2 -2
  20. package/templates/modules/github-repo/docs/git-workflow.md +27 -2
  21. package/templates/modules/github-repo/module.meta.json +1 -1
  22. package/templates/modules/launch-mvp/module.meta.json +1 -1
  23. package/templates/modules/pr-review/README.md +7 -7
  24. package/templates/modules/pr-review/agents/code-reviewer/skills/code-review.md +32 -16
  25. package/templates/modules/pr-review/agents/engineer/skills/pr-workflow.md +12 -11
  26. package/templates/modules/pr-review/docs/pr-conventions.md +13 -13
  27. package/templates/modules/pr-review/module.meta.json +3 -3
  28. package/templates/presets/fast/preset.meta.json +2 -2
  29. package/templates/presets/repo-maintenance/preset.meta.json +1 -1
  30. package/templates/roles/engineer/SOUL.md +1 -1
package/dist/worker.js CHANGED
@@ -9557,7 +9557,18 @@ async function assembleCompany({
9557
9557
  reviewers.push(role);
9558
9558
  }
9559
9559
  const approver = typeof reviewGate.approver === "string" && allRoles.has(reviewGate.approver) ? reviewGate.approver : void 0;
9560
- const mergeGate = typeof reviewGate.mergeGate === "string" && allRoles.has(reviewGate.mergeGate) ? reviewGate.mergeGate : void 0;
9560
+ let mergeGate = typeof reviewGate.mergeGate === "string" && allRoles.has(reviewGate.mergeGate) ? reviewGate.mergeGate : void 0;
9561
+ if (!mergeGate) {
9562
+ const mergeGateFallbacks = [
9563
+ "code-reviewer",
9564
+ "devops",
9565
+ "ui-designer",
9566
+ "ux-researcher",
9567
+ "security-engineer",
9568
+ "qa"
9569
+ ];
9570
+ mergeGate = mergeGateFallbacks.find((role) => allRoles.has(role) && role !== approver);
9571
+ }
9561
9572
  if (approver) {
9562
9573
  const idx = reviewers.indexOf(approver);
9563
9574
  if (idx !== -1) reviewers.splice(idx, 1);
@@ -9579,11 +9590,12 @@ async function assembleCompany({
9579
9590
  if (gate.mergeGate) {
9580
9591
  const gatePrecondition = hasCi ? "CI must be green before merge" : "no CI configured \u2014 run the test suite/build and paste the output before merge";
9581
9592
  stages.push(
9582
- ` - stage ${stages.length + 1} (approval) \u2192 assign ${JSON.stringify(gate.mergeGate)} \u2014 merge gate: ${gatePrecondition}; merge the PR, then record approved to close`
9593
+ ` - stage ${stages.length + 1} (approval) \u2192 assign ${JSON.stringify(gate.mergeGate)} \u2014 merge gate (non-author): ${gatePrecondition}; merge the PR, then record approved to close`
9583
9594
  );
9584
9595
  }
9585
9596
  return `- **executionPolicy** (set when creating this issue; resolve each role to its agentId):
9586
9597
  ${stages.join("\n")}
9598
+ - never assign the issue's executor/author to any stage \u2014 Paperclip excludes the original executor, so a self-stage has no eligible participant and the issue stalls (422); the merge gate must be a non-author
9587
9599
  - every verdict must cite executed verification (commands + results); "looks good" without evidence is not a valid verdict
9588
9600
 
9589
9601
  `;
@@ -10317,8 +10329,8 @@ Read: \`docs/${doc}\`
10317
10329
  bootstrap += `- Do not reuse parent workspaces for subissues unless explicitly requested.
10318
10330
  `;
10319
10331
  if (moduleNames.includes("pr-review")) {
10320
- const ciClause = hasCi ? "CI (lint/test/build) must be green before the Engineer merges \u2014 this is the hard gate and cannot be skipped" : "no CI is configured, so the Engineer must run the test suite/build and paste the real output into the merge-gate verdict before merging \u2014 this is the hard gate";
10321
- bootstrap += `- Required PR reviews use the issue's \`executionPolicy\`. The substantive gate is execution, not opinion: ${ciClause}. Stages, in order: a \`review\` stage for QA when present (test adequacy / running the tests), a \`review\` stage for the Security Engineer **only when the change is security-relevant** (auth, secrets, input boundaries, crypto, dependencies, infra exposure), an \`approval\` stage for the Product Owner (intent/scope), then a final \`approval\` merge-gate stage for the Engineer (who satisfies the hard gate above, merges the PR, then records approval to close the issue). The merge gate must be last so the Product Owner's approval does not auto-close the issue with the PR still open. The Code Reviewer and other domain reviewers may add advisory, non-blocking comments but do not gate the merge. Every verdict must cite executed verification. Resolve each role to its agentId. Model review stages in executionPolicy rather than child issues or @-mentions.
10332
+ const ciClause = hasCi ? "CI (lint/test/build) must be green before the merge gate merges \u2014 this is the hard gate and cannot be skipped" : "no CI is configured, so the merge-gate agent must run the test suite/build and paste the real output into the merge-gate verdict before merging \u2014 this is the hard gate";
10333
+ bootstrap += `- Required PR reviews use the issue's \`executionPolicy\`. The substantive gate is execution, not opinion: ${ciClause}. Stages, in order: a \`review\` stage for QA when present (test adequacy / running the tests), a \`review\` stage for the Security Engineer **only when the change is security-relevant** (auth, secrets, input boundaries, crypto, dependencies, infra exposure), an \`approval\` stage for the Product Owner (intent/scope), then a final \`approval\` merge-gate stage for the **Code Reviewer** (a non-author who satisfies the hard gate above, merges the PR, then records approval to close the issue). **Never list the issue's executor/author as a participant in any stage** \u2014 Paperclip excludes the original executor from review/approval, so a stage whose only participant is the author has no eligible participant and the issue stalls in \`in_review\` (422 No eligible approval participant); this is why the merge gate is the Code Reviewer (or another present non-author), not the engineer who wrote the code. The merge gate must be last so the Product Owner's approval does not auto-close the issue with the PR still open. Other domain reviewers may add advisory, non-blocking comments but do not gate the merge. Every verdict must cite executed verification. Resolve each role to its agentId. Model review stages in executionPolicy rather than child issues or @-mentions.
10322
10334
  `;
10323
10335
  }
10324
10336
  bootstrap += `
@@ -10957,7 +10969,7 @@ var __dirname = path2.dirname(fileURLToPath2(import.meta.url));
10957
10969
  var DEFAULT_TEMPLATES_REPO_URL = "https://github.com/starlein/paperclip-plugin-company-wizard/tree/main/templates";
10958
10970
  var BUNDLED_TEMPLATES_DIR = path2.resolve(__dirname, "..", "templates");
10959
10971
  var PLUGIN_PACKAGE_NAME = "@starlein/paperclip-plugin-company-wizard";
10960
- var CURRENT_PLUGIN_VERSION = "0.4.2";
10972
+ var CURRENT_PLUGIN_VERSION = "0.4.5";
10961
10973
  var NPM_LATEST_URL = "https://registry.npmjs.org/@starlein%2Fpaperclip-plugin-company-wizard/latest";
10962
10974
  function copyDirSync(src, dest) {
10963
10975
  fs2.mkdirSync(dest, { recursive: true });
@@ -11195,6 +11207,49 @@ function resolveWritableCompaniesDir(cfg, log) {
11195
11207
  `Unable to prepare a writable companies directory. Last attempt failed at ${lastError}`
11196
11208
  );
11197
11209
  }
11210
+ function isPathInside(parent, child) {
11211
+ const relative = path2.relative(parent, child);
11212
+ return relative === "" || !!relative && !relative.startsWith("..") && !path2.isAbsolute(relative);
11213
+ }
11214
+ function normalizeGitBranch(value) {
11215
+ const branch = typeof value === "string" && value.trim() ? value.trim() : "main";
11216
+ return /^[A-Za-z0-9._/-]+$/.test(branch) ? branch.replace(/^origin\//, "") : "main";
11217
+ }
11218
+ function prepareLocalProjectWorkspace(mainProject, companyDir, log) {
11219
+ const workspace = mainProject?.workspace;
11220
+ if (!workspace || workspace.sourceType !== "local_path") return;
11221
+ const cwd = typeof workspace.cwd === "string" ? workspace.cwd.trim() : "";
11222
+ if (!cwd) return;
11223
+ const resolvedCompanyDir = path2.resolve(companyDir);
11224
+ const resolvedCwd = path2.resolve(cwd);
11225
+ if (!isPathInside(resolvedCompanyDir, resolvedCwd)) {
11226
+ log?.(`\u26A0 Skipped project workspace preparation outside company dir: ${resolvedCwd}`);
11227
+ return;
11228
+ }
11229
+ fs2.mkdirSync(resolvedCwd, { recursive: true });
11230
+ const gitDir = path2.join(resolvedCwd, ".git");
11231
+ if (fs2.existsSync(gitDir)) {
11232
+ log?.(`\u2713 Project workspace ready: ${resolvedCwd}`);
11233
+ return;
11234
+ }
11235
+ const branch = normalizeGitBranch(workspace.defaultRef);
11236
+ execFileSync("git", ["init", "-b", branch], { cwd: resolvedCwd, stdio: "pipe" });
11237
+ execFileSync(
11238
+ "git",
11239
+ [
11240
+ "-c",
11241
+ "user.email=bootstrap@paperclip.local",
11242
+ "-c",
11243
+ "user.name=Paperclip Bootstrap",
11244
+ "commit",
11245
+ "--allow-empty",
11246
+ "-m",
11247
+ "chore: initialize repository"
11248
+ ],
11249
+ { cwd: resolvedCwd, stdio: "pipe" }
11250
+ );
11251
+ log?.(`\u2713 Project workspace initialized: ${resolvedCwd}`);
11252
+ }
11198
11253
  function formatRoleName(role) {
11199
11254
  return role.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
11200
11255
  }
@@ -11598,6 +11653,7 @@ var plugin = definePlugin({
11598
11653
  log(`\u270E Override: ${relPath}`);
11599
11654
  }
11600
11655
  }
11656
+ prepareLocalProjectWorkspace(assembleResult.mainProject, companyDir, log);
11601
11657
  const ceoInstructionsDir = path2.join(companyDir, "agents", "ceo");
11602
11658
  const ceoEntryFile = "AGENTS.md";
11603
11659
  const ceoEntryPath = path2.join(ceoInstructionsDir, ceoEntryFile);
@@ -12027,6 +12083,7 @@ var worker_default = plugin;
12027
12083
  runWorker(plugin, import.meta.url);
12028
12084
  export {
12029
12085
  worker_default as default,
12086
+ prepareLocalProjectWorkspace,
12030
12087
  resolveWritableCompaniesDir
12031
12088
  };
12032
12089
  //# sourceMappingURL=worker.js.map