@starlein/paperclip-plugin-company-wizard 0.4.13 → 0.4.16

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 (120) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/manifest.js +1 -1
  3. package/dist/manifest.js.map +1 -1
  4. package/dist/worker.js +57 -68
  5. package/dist/worker.js.map +2 -2
  6. package/package.json +1 -1
  7. package/templates/bootstrap-instructions.md +2 -1
  8. package/templates/modules/accessibility/agents/engineer/skills/accessibility-audit.fallback.md +2 -2
  9. package/templates/modules/accessibility/agents/ui-designer/skills/accessibility-audit.fallback.md +2 -2
  10. package/templates/modules/accessibility/module.meta.json +1 -1
  11. package/templates/modules/accessibility/skills/accessibility-audit.bar.md +1 -1
  12. package/templates/modules/accessibility/skills/accessibility-audit.md +1 -1
  13. package/templates/modules/architecture-plan/agents/ceo/skills/architecture-plan.bar.md +2 -2
  14. package/templates/modules/architecture-plan/agents/ceo/skills/architecture-plan.fallback.md +2 -2
  15. package/templates/modules/architecture-plan/agents/engineer/skills/design-system.fallback.md +2 -2
  16. package/templates/modules/architecture-plan/agents/ui-designer/skills/architecture-plan.md +2 -2
  17. package/templates/modules/architecture-plan/agents/ui-designer/skills/design-system.md +2 -2
  18. package/templates/modules/architecture-plan/module.meta.json +2 -2
  19. package/templates/modules/architecture-plan/skills/architecture-plan.bar.md +1 -1
  20. package/templates/modules/architecture-plan/skills/architecture-plan.md +2 -2
  21. package/templates/modules/architecture-plan/skills/design-system.md +5 -5
  22. package/templates/modules/backlog/docs/backlog-template.md +1 -1
  23. package/templates/modules/brand-identity/agents/ceo/skills/brand-identity.fallback.md +2 -2
  24. package/templates/modules/brand-identity/agents/cmo/skills/brand-identity.fallback.md +2 -2
  25. package/templates/modules/brand-identity/module.meta.json +1 -1
  26. package/templates/modules/brand-identity/skills/brand-identity.bar.md +1 -1
  27. package/templates/modules/brand-identity/skills/brand-identity.md +3 -3
  28. package/templates/modules/build-api/skills/api-design.bar.md +1 -1
  29. package/templates/modules/build-api/skills/api-design.md +1 -1
  30. package/templates/modules/ci-cd/agents/devops/skills/ci-cd.md +1 -1
  31. package/templates/modules/ci-cd/agents/engineer/skills/ci-cd.fallback.md +2 -2
  32. package/templates/modules/ci-cd/module.meta.json +1 -1
  33. package/templates/modules/ci-cd/skills/ci-cd.bar.md +1 -1
  34. package/templates/modules/ci-cd/skills/ci-cd.md +4 -4
  35. package/templates/modules/codebase-onboarding/agents/ceo/skills/codebase-audit.fallback.md +5 -5
  36. package/templates/modules/codebase-onboarding/module.meta.json +1 -1
  37. package/templates/modules/codebase-onboarding/skills/codebase-audit.bar.md +1 -1
  38. package/templates/modules/codebase-onboarding/skills/codebase-audit.md +2 -2
  39. package/templates/modules/competitive-intel/agents/ceo/skills/competitive-tracking.fallback.md +2 -2
  40. package/templates/modules/competitive-intel/agents/cmo/skills/competitive-tracking.fallback.md +2 -2
  41. package/templates/modules/competitive-intel/agents/customer-success/skills/competitive-tracking.md +2 -2
  42. package/templates/modules/competitive-intel/agents/product-owner/skills/competitive-tracking.fallback.md +2 -2
  43. package/templates/modules/competitive-intel/module.meta.json +1 -1
  44. package/templates/modules/competitive-intel/skills/competitive-tracking.bar.md +2 -2
  45. package/templates/modules/competitive-intel/skills/competitive-tracking.md +2 -2
  46. package/templates/modules/dependency-management/agents/engineer/skills/dependency-audit.fallback.md +2 -2
  47. package/templates/modules/dependency-management/skills/dependency-audit.md +2 -2
  48. package/templates/modules/game-design/agents/ceo/skills/game-design.fallback.md +1 -1
  49. package/templates/modules/game-design/agents/game-designer/skills/game-design.md +2 -2
  50. package/templates/modules/game-design/module.meta.json +1 -1
  51. package/templates/modules/game-design/skills/audio-design.fallback.md +2 -2
  52. package/templates/modules/game-design/skills/audio-design.md +3 -3
  53. package/templates/modules/game-design/skills/game-design.bar.md +1 -1
  54. package/templates/modules/game-design/skills/game-design.md +3 -3
  55. package/templates/modules/game-design/skills/level-design.fallback.md +2 -2
  56. package/templates/modules/game-design/skills/level-design.md +4 -4
  57. package/templates/modules/github-repo/agents/engineer/skills/git-workflow.md +51 -60
  58. package/templates/modules/github-repo/docs/git-workflow.md +14 -16
  59. package/templates/modules/github-repo/module.meta.json +1 -1
  60. package/templates/modules/market-analysis/agents/ceo/skills/market-analysis.fallback.md +2 -2
  61. package/templates/modules/market-analysis/agents/cmo/skills/market-analysis.fallback.md +2 -2
  62. package/templates/modules/market-analysis/agents/product-owner/skills/market-analysis.fallback.md +2 -2
  63. package/templates/modules/market-analysis/agents/ux-researcher/skills/market-analysis.md +1 -1
  64. package/templates/modules/market-analysis/module.meta.json +1 -1
  65. package/templates/modules/market-analysis/skills/market-analysis.bar.md +1 -1
  66. package/templates/modules/market-analysis/skills/market-analysis.md +1 -1
  67. package/templates/modules/monitoring/agents/devops/skills/monitoring.md +1 -1
  68. package/templates/modules/monitoring/agents/engineer/skills/monitoring.fallback.md +2 -2
  69. package/templates/modules/monitoring/module.meta.json +1 -1
  70. package/templates/modules/monitoring/skills/monitoring.bar.md +1 -1
  71. package/templates/modules/monitoring/skills/monitoring.md +3 -3
  72. package/templates/modules/pr-review/README.md +1 -1
  73. package/templates/modules/pr-review/agents/code-reviewer/skills/code-review.md +6 -6
  74. package/templates/modules/pr-review/agents/devops/skills/infra-review.md +1 -1
  75. package/templates/modules/pr-review/agents/engineer/skills/pr-workflow.md +7 -7
  76. package/templates/modules/pr-review/agents/product-owner/skills/product-review.md +1 -1
  77. package/templates/modules/pr-review/agents/qa/skills/qa-review.md +6 -9
  78. package/templates/modules/pr-review/agents/security-engineer/skills/pr-security-review.md +1 -1
  79. package/templates/modules/pr-review/agents/ui-designer/skills/design-review.md +3 -3
  80. package/templates/modules/pr-review/agents/ux-researcher/skills/ux-review.md +2 -2
  81. package/templates/modules/pr-review/docs/pr-conventions.md +6 -4
  82. package/templates/modules/release-management/agents/ceo/skills/release-process.fallback.md +2 -2
  83. package/templates/modules/release-management/agents/engineer/skills/release-process.fallback.md +2 -2
  84. package/templates/modules/release-management/module.meta.json +1 -1
  85. package/templates/modules/release-management/skills/release-process.md +2 -2
  86. package/templates/modules/security-audit/agents/devops/skills/security-review.fallback.md +2 -2
  87. package/templates/modules/security-audit/agents/devops/skills/threat-model.fallback.md +2 -2
  88. package/templates/modules/security-audit/agents/engineer/skills/security-review.fallback.md +2 -2
  89. package/templates/modules/security-audit/agents/engineer/skills/threat-model.fallback.md +2 -2
  90. package/templates/modules/security-audit/module.meta.json +2 -2
  91. package/templates/modules/security-audit/skills/security-review.bar.md +1 -1
  92. package/templates/modules/security-audit/skills/security-review.md +1 -1
  93. package/templates/modules/security-audit/skills/threat-model.bar.md +1 -1
  94. package/templates/modules/security-audit/skills/threat-model.md +2 -2
  95. package/templates/modules/stall-detection/agents/ceo/skills/stall-detection.md +14 -2
  96. package/templates/modules/tech-stack/agents/ceo/skills/tech-stack.fallback.md +2 -2
  97. package/templates/modules/tech-stack/module.meta.json +1 -1
  98. package/templates/modules/tech-stack/skills/tech-stack.bar.md +1 -1
  99. package/templates/modules/tech-stack/skills/tech-stack.md +1 -1
  100. package/templates/modules/user-testing/agents/ceo/skills/user-testing.fallback.md +2 -2
  101. package/templates/modules/user-testing/agents/product-owner/skills/user-testing.fallback.md +2 -2
  102. package/templates/modules/user-testing/agents/qa/skills/user-testing.md +1 -1
  103. package/templates/modules/user-testing/agents/ux-researcher/skills/user-testing.fallback.md +2 -2
  104. package/templates/modules/user-testing/module.meta.json +1 -1
  105. package/templates/modules/user-testing/skills/user-testing.md +1 -1
  106. package/templates/modules/vision-workshop/agents/ceo/skills/vision-workshop.md +1 -1
  107. package/templates/modules/vision-workshop/agents/ux-researcher/skills/vision-workshop.md +1 -1
  108. package/templates/modules/vision-workshop/module.meta.json +1 -1
  109. package/templates/modules/website-relaunch/agents/ui-designer/skills/site-audit.md +1 -1
  110. package/templates/modules/website-relaunch/module.meta.json +7 -7
  111. package/templates/modules/website-relaunch/skills/design-ingestion.md +1 -1
  112. package/templates/modules/website-relaunch/skills/site-audit.md +1 -1
  113. package/templates/presets/build-game/preset.meta.json +6 -6
  114. package/templates/presets/repo-maintenance/preset.meta.json +5 -5
  115. package/templates/roles/cmo/AGENTS.md +1 -1
  116. package/templates/roles/code-reviewer/AGENTS.md +1 -1
  117. package/templates/roles/cto/AGENTS.md +4 -4
  118. package/templates/roles/devops/AGENTS.md +1 -1
  119. package/templates/roles/engineer/HEARTBEAT.md +1 -1
  120. package/templates/roles/ux-researcher/AGENTS.md +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,56 @@ All notable changes to the Company Wizard plugin are documented here.
4
4
 
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [0.4.16] - 2026-06-28
8
+
9
+ ### Changed
10
+
11
+ **Agents and projects use external paths under `companies/<Company>/…` with relative instruction references**
12
+
13
+ Agents were provisioned with a **managed** instructions bundle (materialized by the host under `companies/<companyId>/agents/<agentId>/instructions/`), and the assembled instruction files hard-coded **absolute** `$AGENT_HOME/...` paths that pointed at the human-readable `companies/<CompanyName>/agents/<role>/` dir — a mismatch that made references fragile and unportable.
14
+
15
+ - **External instructions bundle (all agents, incl. CEO):** provisioning now points each agent at its assembled on-disk dir via `updateInstructionsBundle({ mode: 'external', rootPath: '…/companies/<Company>/agents/<role>', entryFile: 'AGENTS.md' })`. That call also sets `adapterConfig.instructionsFilePath`, which every local adapter (codex/claude/acpx) loads — instructing the model to *"resolve relative file references from the instructions directory"*. Existing managed agents are migrated to external on the next update.
16
+ - **Relative references** in assembled files: `$AGENT_HOME/HEARTBEAT.md` → `HEARTBEAT.md`, `$AGENT_HOME/skills/<x>.md` → `skills/<x>.md`. Bare `$AGENT_HOME` prose (the runtime home env var) is left intact. The old absolute-path rewrite is removed; no managed-bundle file upload happens anymore.
17
+ - **Company doc references unified to `../../docs/<y>.md`** across every agent-facing file (AGENTS.md, HEARTBEAT, skills, the shipped docs themselves like `git-workflow.md`/`pr-conventions.md`, heartbeat-sections, bootstrap-instructions, and module/preset issue descriptions) — 170+ refs. This path is **cwd-independent**: both the instructions dir (`agents/<role>/`) and the execution cwd (the project workspace `projects/<name>/`) sit at depth 2 under the company dir, so `../../docs/` resolves to `companies/<Company>/docs/` from either. A bare `docs/<y>.md` would have broken once the agent runs in a project workspace.
18
+ - **Project workspaces** are realized under `companies/<Company>/projects/<Project>` for external (`git_repo`) projects too — the repo is cloned into that dir via `workspace.cwd` instead of a separate host-managed clone path (local projects already used this path).
19
+
20
+ > Deploy + "Update templates" + update-company to migrate a live company's agents from managed to external instructions.
21
+
22
+ ## [0.4.15] - 2026-06-28
23
+
24
+ ### Fixed
25
+
26
+ **Template-cache refresh now hits the dir the worker reads (Docker) — fixes "fixed but never deployed"**
27
+
28
+ `refresh-templates` (the "Update templates" button) always deleted/re-downloaded `~/.paperclip/plugin-templates`, but on Docker instances the worker reads `~/plugin-templates` (`isDockerLayout()`). So refreshing never updated the dir the worker actually assembles from, and shipped template fixes (e.g. the v0.4.7 Code-Reviewer merge-ownership fix) silently never reached agents. A shared `resolveTemplatesCacheDir`/`refreshTemplatesCache` helper now targets the same Docker-aware dir, and `start-provision` refreshes the cache from the repo before assembling (best-effort; `params.refreshTemplates: false` opts out) so an update always provisions the latest published instructions.
29
+
30
+ ### Changed
31
+
32
+ **CI/CD is a merge gate only when the company owns it (`ci-cd` module)**
33
+
34
+ The merge gate enforced "CI must be green" whenever the repo had any CI checks — so a pre-existing/external CI on an imported repo (broken or flaky, never configured by the company) deadlocked the merge queue. Now the **authoritative gate is the merge-gate agent's executed local lint/test/build** (run it, paste the output); a green CI is required *in addition* only when the `ci-cd` module is active (the company runs its own pipeline). Without a CI/CD module, pre-existing repo checks are advisory — never block a merge solely on a check the company never set up. Reworded across `pr-conventions.md`, `code-review.md`, `qa-review.md`, the Code-Reviewer `AGENTS.md`, and the engineer `git-workflow.md`.
35
+
36
+ **Without the pr-review module, the engineer works direct-to-base instead of opening a PR**
37
+
38
+ The no-pr-review fallback was a "PR Self-Merge Flow" that still opened a PR per change — the source of the orphan/draft/conflict PR pile-up. With no reviewer, that PR adds no value, so the engineer now commits and pushes **directly to the base ref** after local verification, and opens a PR *only* as a fallback when branch protection rejects the direct push. Rewrote `github-repo` `git-workflow.md` (skill + `docs/git-workflow.md`) to the Direct-to-Base Flow, updated Branch-Protection guidance (do not require PRs for an unreviewed company), and scoped the engineer `HEARTBEAT.md` review-path rule to "pr-review active". The PR workflow remains gated to the `pr-review` module only.
39
+
40
+ ## [0.4.14] - 2026-06-25
41
+
42
+ ### Fixed
43
+
44
+ **Stranded-blocked merge issues — a CEO-routine safety net (templates)**
45
+
46
+ > The longstanding, CI-independent root cause of "agents open PRs but never merge them" was a **contradiction in the Code Reviewer's instructions** — the role's `AGENTS.md` said "Never merge PRs. That's the engineer's job." while its skill (and the engineer's pr-workflow) made the Code Reviewer the merge owner, so nobody merged. That was already fixed in **v0.4.7** (commit `3e065cf`); instances still piling up PRs are running pre-v0.4.7 instruction bundles and need a template-cache refresh + update-company to pick up the corrected instructions. This v0.4.14 entry addresses a **secondary, downstream** failure, not that root cause.
47
+
48
+ Observed on two live instances (LeadConversionOptimizer, Dial24Modern2): because the normal merge never fired, the CEO fanned a single PR out into separate per-role issues (QA/Security/Product) plus a standalone "Code review and merge PR #N" issue assigned to the Code Reviewer and `blockedBy` those reviews. When the reviews close `done`, Paperclip does not reliably re-wake the blocked merge issue (worker heartbeats are disabled, and the liveness watchdog skips a `blocked` issue whose blockers are all `done`), so even those explicit merge issues strand. Evidence: merge issues sitting `blocked` with `blockerAttention.needs_attention` and zero unresolved blockers.
49
+
50
+ Template fixes:
51
+
52
+ - `stall-detection.md` (CEO skill): new `## Stranded blocked` recovery — detect a `blocked` issue whose blockers are all `done`/`cancelled` (or `blockerAttention` with `unresolvedBlockerCount: 0`), flag `STRANDED-BLOCKED`, reactivate via `PATCH {"status":"in_progress"}`, re-assign to the merge owner to trigger a wake, and run the merge. Step 4's skip-rule now treats "blocked with all blockers done" as a stall, not validly blocked. PR-queue hygiene gains a step 7 that reconciles each open green/mergeable PR against its owning issue and merges/reactivates when the merge step was skipped.
53
+ - `bootstrap-instructions.md` + `pr-review/README.md`: explicit prohibition — one PR ⇒ one issue ⇒ its `executionPolicy` stages. Never fan a PR out into per-role `blocks`-linked issues, and never model the merge as a standalone `blockedBy` merge issue; the merge gate is the last stage on the same implementation issue, which advances in place.
54
+
55
+ > Note: the durable platform-level guarantee (auto-reactivate a `blocked` issue once it has no unresolved blockers, and/or a workspace-finalize-barrier timeout) lives in the Paperclip server, not this plugin. These template changes prevent the fan-out and add a CEO-routine safety net that recovers already-stranded merges.
56
+
7
57
  ## [0.4.13] - 2026-06-25
8
58
 
9
59
  ### Changed
package/dist/manifest.js CHANGED
@@ -2,7 +2,7 @@
2
2
  var manifest = {
3
3
  id: "starlein.paperclip-plugin-company-wizard",
4
4
  apiVersion: 1,
5
- version: "0.4.13",
5
+ version: "0.4.16",
6
6
  displayName: "Company Wizard",
7
7
  description: "AI-powered wizard to bootstrap agent companies from composable templates",
8
8
  author: "Sascha Pietrowski <sp@speednetwork.de>",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/manifest.ts"],
4
- "sourcesContent": ["import type { PaperclipPluginManifestV1 } from '@paperclipai/plugin-sdk';\n\nconst manifest: PaperclipPluginManifestV1 = {\n id: 'starlein.paperclip-plugin-company-wizard',\n apiVersion: 1,\n version: '0.4.13',\n displayName: 'Company Wizard',\n description: 'AI-powered wizard to bootstrap agent companies from composable templates',\n author: 'Sascha Pietrowski <sp@speednetwork.de>',\n categories: ['workspace', 'ui'],\n capabilities: [\n 'companies.read',\n 'issues.create',\n 'issues.read',\n 'issues.update',\n 'goals.create',\n 'goals.read',\n 'agents.read',\n 'projects.read',\n 'plugin.state.read',\n 'plugin.state.write',\n 'secrets.read-ref',\n 'events.subscribe',\n 'ui.page.register',\n 'ui.sidebar.register',\n ],\n instanceConfigSchema: {\n type: 'object',\n properties: {\n companiesDir: {\n type: 'string',\n description:\n 'Directory where assembled company workspaces are written. Auto-detected: ~/instances/default/companies in Docker setups, ~/.paperclip/instances/default/companies otherwise. Rarely needs manual override.',\n },\n templatesPath: {\n type: 'string',\n description:\n 'Path to the templates directory. Auto-detected: ~/plugin-templates in Docker setups, ~/.paperclip/plugin-templates otherwise. Rarely needs manual override.',\n },\n templatesRepoUrl: {\n type: 'string',\n default: 'https://github.com/starlein/paperclip-plugin-company-wizard/tree/main/templates',\n description:\n 'GitHub tree URL for template downloads. The default is correct for most setups \u2014 only change this if using a custom fork.',\n },\n anthropicApiKey: {\n type: 'string',\n description:\n 'Anthropic API key for the AI wizard (e.g. sk-ant-...). Required to use the AI-powered company setup path.',\n },\n paperclipUrl: {\n type: 'string',\n description:\n 'Paperclip instance URL. Defaults to http://localhost:3100 or the PAPERCLIP_PUBLIC_URL env var.',\n },\n paperclipEmail: {\n type: 'string',\n description: 'Board login email (for authenticated instances).',\n },\n paperclipPassword: {\n type: 'string',\n description: 'Board login password (for authenticated instances).',\n },\n },\n },\n entrypoints: {\n worker: './dist/worker.js',\n ui: './dist/ui',\n },\n ui: {\n slots: [\n {\n type: 'page',\n id: 'company-wizard',\n displayName: 'Company Wizard',\n exportName: 'WizardPage',\n routePath: 'company-creator',\n },\n {\n type: 'sidebar',\n id: 'company-wizard-link',\n displayName: 'Create Company',\n exportName: 'SidebarLink',\n },\n ],\n },\n};\n\nexport default manifest;\n"],
4
+ "sourcesContent": ["import type { PaperclipPluginManifestV1 } from '@paperclipai/plugin-sdk';\n\nconst manifest: PaperclipPluginManifestV1 = {\n id: 'starlein.paperclip-plugin-company-wizard',\n apiVersion: 1,\n version: '0.4.16',\n displayName: 'Company Wizard',\n description: 'AI-powered wizard to bootstrap agent companies from composable templates',\n author: 'Sascha Pietrowski <sp@speednetwork.de>',\n categories: ['workspace', 'ui'],\n capabilities: [\n 'companies.read',\n 'issues.create',\n 'issues.read',\n 'issues.update',\n 'goals.create',\n 'goals.read',\n 'agents.read',\n 'projects.read',\n 'plugin.state.read',\n 'plugin.state.write',\n 'secrets.read-ref',\n 'events.subscribe',\n 'ui.page.register',\n 'ui.sidebar.register',\n ],\n instanceConfigSchema: {\n type: 'object',\n properties: {\n companiesDir: {\n type: 'string',\n description:\n 'Directory where assembled company workspaces are written. Auto-detected: ~/instances/default/companies in Docker setups, ~/.paperclip/instances/default/companies otherwise. Rarely needs manual override.',\n },\n templatesPath: {\n type: 'string',\n description:\n 'Path to the templates directory. Auto-detected: ~/plugin-templates in Docker setups, ~/.paperclip/plugin-templates otherwise. Rarely needs manual override.',\n },\n templatesRepoUrl: {\n type: 'string',\n default: 'https://github.com/starlein/paperclip-plugin-company-wizard/tree/main/templates',\n description:\n 'GitHub tree URL for template downloads. The default is correct for most setups \u2014 only change this if using a custom fork.',\n },\n anthropicApiKey: {\n type: 'string',\n description:\n 'Anthropic API key for the AI wizard (e.g. sk-ant-...). Required to use the AI-powered company setup path.',\n },\n paperclipUrl: {\n type: 'string',\n description:\n 'Paperclip instance URL. Defaults to http://localhost:3100 or the PAPERCLIP_PUBLIC_URL env var.',\n },\n paperclipEmail: {\n type: 'string',\n description: 'Board login email (for authenticated instances).',\n },\n paperclipPassword: {\n type: 'string',\n description: 'Board login password (for authenticated instances).',\n },\n },\n },\n entrypoints: {\n worker: './dist/worker.js',\n ui: './dist/ui',\n },\n ui: {\n slots: [\n {\n type: 'page',\n id: 'company-wizard',\n displayName: 'Company Wizard',\n exportName: 'WizardPage',\n routePath: 'company-creator',\n },\n {\n type: 'sidebar',\n id: 'company-wizard-link',\n displayName: 'Create Company',\n exportName: 'SidebarLink',\n },\n ],\n },\n};\n\nexport default manifest;\n"],
5
5
  "mappings": ";AAEA,IAAM,WAAsC;AAAA,EAC1C,IAAI;AAAA,EACJ,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,YAAY,CAAC,aAAa,IAAI;AAAA,EAC9B,cAAc;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,sBAAsB;AAAA,IACpB,MAAM;AAAA,IACN,YAAY;AAAA,MACV,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,aACE;AAAA,MACJ;AAAA,MACA,eAAe;AAAA,QACb,MAAM;AAAA,QACN,aACE;AAAA,MACJ;AAAA,MACA,kBAAkB;AAAA,QAChB,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aACE;AAAA,MACJ;AAAA,MACA,iBAAiB;AAAA,QACf,MAAM;AAAA,QACN,aACE;AAAA,MACJ;AAAA,MACA,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,aACE;AAAA,MACJ;AAAA,MACA,gBAAgB;AAAA,QACd,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,mBAAmB;AAAA,QACjB,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,QAAQ;AAAA,IACR,IAAI;AAAA,EACN;AAAA,EACA,IAAI;AAAA,IACF,OAAO;AAAA,MACL;AAAA,QACE,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,aAAa;AAAA,QACb,YAAY;AAAA,QACZ,WAAW;AAAA,MACb;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,aAAa;AAAA,QACb,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,mBAAQ;",
6
6
  "names": []
7
7
  }
package/dist/worker.js CHANGED
@@ -9730,7 +9730,7 @@ ${stages.join("\n")}
9730
9730
  await appendToFile(
9731
9731
  join(companyDir, "agents", roleName, "AGENTS.md"),
9732
9732
  `
9733
- Read and follow: \`$AGENT_HOME/skills/${fileName}\`
9733
+ Read and follow: \`skills/${fileName}\`
9734
9734
  `
9735
9735
  );
9736
9736
  const sourceTag = resolved.source === "shared" ? ", shared" : "";
@@ -9769,7 +9769,7 @@ Read and follow: \`$AGENT_HOME/skills/${fileName}\`
9769
9769
  await appendToFile(
9770
9770
  join(companyDir, "agents", role.name, "AGENTS.md"),
9771
9771
  `
9772
- Read and follow: \`$AGENT_HOME/skills/${skillFile}\`
9772
+ Read and follow: \`skills/${skillFile}\`
9773
9773
  `
9774
9774
  );
9775
9775
  onProgress(`+ agents/${role.name}/skills/${skillFile} (${moduleName})`);
@@ -9837,10 +9837,10 @@ Read and follow: \`$AGENT_HOME/skills/${skillFile}\`
9837
9837
  return !roles || roles.has("*") || roles.has(role.name);
9838
9838
  });
9839
9839
  if (relevantDocs.length === 0) continue;
9840
- let docRefs = "\n## Shared Documentation\n\nReference docs relevant to your role (paths are relative to your workspace home):\n";
9840
+ let docRefs = "\n## Shared Documentation\n\nReference docs relevant to your role (paths are relative to this AGENTS.md, in the shared company docs dir):\n";
9841
9841
  for (const doc of relevantDocs) {
9842
9842
  docRefs += `
9843
- Read: \`docs/${doc}\`
9843
+ Read: \`../../docs/${doc}\`
9844
9844
  `;
9845
9845
  }
9846
9846
  await appendToFile(agentsMd, docRefs);
@@ -9852,7 +9852,6 @@ Read: \`docs/${doc}\`
9852
9852
  const agentRoleDirs = await readdir(agentsBaseDirForSubst, { withFileTypes: true });
9853
9853
  for (const roleDir of agentRoleDirs) {
9854
9854
  if (!roleDir.isDirectory()) continue;
9855
- const absoluteAgentHome = join(agentsBaseDirForSubst, roleDir.name);
9856
9855
  const subst = async (dir) => {
9857
9856
  const entries = await readdir(dir, { withFileTypes: true });
9858
9857
  for (const entry of entries) {
@@ -9861,8 +9860,8 @@ Read: \`docs/${doc}\`
9861
9860
  await subst(full);
9862
9861
  } else if (entry.name.endsWith(".md")) {
9863
9862
  const content = await readFile(full, "utf-8");
9864
- if (content.includes("$AGENT_HOME")) {
9865
- await writeFile(full, content.split("$AGENT_HOME").join(absoluteAgentHome));
9863
+ if (content.includes("$AGENT_HOME/")) {
9864
+ await writeFile(full, content.split("$AGENT_HOME/").join(""));
9866
9865
  }
9867
9866
  }
9868
9867
  }
@@ -10079,7 +10078,7 @@ Read: \`docs/${doc}\`
10079
10078
  if (repoUrl) workspace.repoUrl = repoUrl;
10080
10079
  if (repoRef) workspace.repoRef = repoRef;
10081
10080
  if (defaultRef) workspace.defaultRef = defaultRef;
10082
- delete workspace.cwd;
10081
+ if (!workspace.cwd) workspace.cwd = localCwd;
10083
10082
  } else {
10084
10083
  if (!workspace.cwd) workspace.cwd = localCwd;
10085
10084
  const trimmedSetup = typeof workspace.setupCommand === "string" ? workspace.setupCommand.trim() : "";
@@ -11023,7 +11022,7 @@ var __dirname = path2.dirname(fileURLToPath2(import.meta.url));
11023
11022
  var DEFAULT_TEMPLATES_REPO_URL = "https://github.com/starlein/paperclip-plugin-company-wizard/tree/main/templates";
11024
11023
  var BUNDLED_TEMPLATES_DIR = path2.resolve(__dirname, "..", "templates");
11025
11024
  var PLUGIN_PACKAGE_NAME = "@starlein/paperclip-plugin-company-wizard";
11026
- var CURRENT_PLUGIN_VERSION = "0.4.13";
11025
+ var CURRENT_PLUGIN_VERSION = "0.4.16";
11027
11026
  var NPM_LATEST_URL = "https://registry.npmjs.org/@starlein%2Fpaperclip-plugin-company-wizard/latest";
11028
11027
  function copyDirSync(src, dest) {
11029
11028
  fs2.mkdirSync(dest, { recursive: true });
@@ -11102,6 +11101,21 @@ async function ensureTemplatesDir(cfg) {
11102
11101
  );
11103
11102
  }
11104
11103
  }
11104
+ function resolveTemplatesCacheDir(cfg) {
11105
+ if (cfg.templatesPath) return cfg.templatesPath;
11106
+ if (isDockerLayout()) return path2.join(os.homedir(), "plugin-templates");
11107
+ return path2.join(os.homedir(), ".paperclip", "plugin-templates");
11108
+ }
11109
+ function refreshTemplatesCache(cfg, log) {
11110
+ const repoUrl = cfg.templatesRepoUrl || DEFAULT_TEMPLATES_REPO_URL;
11111
+ const targetDir = resolveTemplatesCacheDir(cfg);
11112
+ if (fs2.existsSync(targetDir)) {
11113
+ fs2.rmSync(targetDir, { recursive: true, force: true });
11114
+ }
11115
+ downloadTemplatesFromGithub(targetDir, repoUrl);
11116
+ log?.(`\u2713 Refreshed templates cache from ${repoUrl} \u2192 ${targetDir}`);
11117
+ return targetDir;
11118
+ }
11105
11119
  function isLikelyAnthropicApiKey(value) {
11106
11120
  return value.startsWith("sk-ant-");
11107
11121
  }
@@ -11344,57 +11358,24 @@ function prepareLocalProjectWorkspace(mainProject, companyDir, log, gitIdentity)
11344
11358
  function formatRoleName(role) {
11345
11359
  return role.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
11346
11360
  }
11347
- function collectInstructionFiles(rootDir) {
11348
- const out = {};
11349
- if (!fs2.existsSync(rootDir)) return out;
11350
- const walk = (dir) => {
11351
- for (const entry of fs2.readdirSync(dir, { withFileTypes: true })) {
11352
- const abs = path2.join(dir, entry.name);
11353
- if (entry.isDirectory()) {
11354
- walk(abs);
11355
- continue;
11356
- }
11357
- if (!entry.isFile()) continue;
11358
- const rel = path2.relative(rootDir, abs).split(path2.sep).join("/");
11359
- out[rel] = fs2.readFileSync(abs, "utf-8");
11360
- }
11361
- };
11362
- walk(rootDir);
11363
- return out;
11364
- }
11365
- async function syncAgentInstructionsIntoManagedBundle({
11361
+ async function setExternalInstructionsBundle({
11366
11362
  client,
11367
11363
  agentId,
11368
11364
  sourceDir,
11369
11365
  entryFile,
11370
- fallbackEntryContent,
11371
11366
  log
11372
11367
  }) {
11373
11368
  try {
11374
11369
  await client.updateInstructionsBundle(agentId, {
11375
- mode: "managed",
11370
+ mode: "external",
11371
+ rootPath: sourceDir,
11376
11372
  entryFile,
11377
11373
  clearLegacyPromptTemplate: true
11378
11374
  });
11379
- const files = collectInstructionFiles(sourceDir);
11380
- if (!files[entryFile] && typeof fallbackEntryContent === "string" && fallbackEntryContent.trim()) {
11381
- files[entryFile] = fallbackEntryContent;
11382
- }
11383
- const entries = Object.entries(files).sort(([a], [b]) => a.localeCompare(b));
11384
- if (entries.length === 0) {
11385
- log("\u26A0 No instruction files found to sync into managed bundle.");
11386
- return;
11387
- }
11388
- for (const [relativePath, content] of entries) {
11389
- await client.upsertInstructionsBundleFile(agentId, {
11390
- path: relativePath,
11391
- content
11392
- });
11393
- }
11394
- log(`\u2713 Synced ${entries.length} instruction file(s) into managed bundle`);
11375
+ log(`\u2713 Pointed instructions at external dir ${sourceDir} (entry ${entryFile})`);
11395
11376
  } catch (err) {
11396
11377
  log(
11397
- `\u26A0 Could not sync managed instructions bundle: ${err instanceof Error ? err.message : String(err)}`
11378
+ `\u26A0 Could not set external instructions bundle: ${err instanceof Error ? err.message : String(err)}`
11398
11379
  );
11399
11380
  }
11400
11381
  }
@@ -11627,13 +11608,8 @@ var plugin = definePlugin({
11627
11608
  ctx.actions.register("refresh-templates", async () => {
11628
11609
  try {
11629
11610
  const cfg = await ctx.config.get() ?? {};
11630
- const repoUrl = cfg.templatesRepoUrl || DEFAULT_TEMPLATES_REPO_URL;
11631
- const targetDir = cfg.templatesPath || path2.join(os.homedir(), ".paperclip", "plugin-templates");
11632
- if (fs2.existsSync(targetDir)) {
11633
- fs2.rmSync(targetDir, { recursive: true, force: true });
11634
- }
11635
- downloadTemplatesFromGithub(targetDir, repoUrl);
11636
- return { ok: true };
11611
+ const targetDir = refreshTemplatesCache(cfg);
11612
+ return { ok: true, targetDir };
11637
11613
  } catch (err) {
11638
11614
  return { ok: false, error: err instanceof Error ? err.message : String(err) };
11639
11615
  }
@@ -12035,6 +12011,17 @@ var plugin = definePlugin({
12035
12011
  const companyName = typeof params.companyName === "string" ? params.companyName.trim() : "";
12036
12012
  const existingCompanyId = typeof params.existingCompanyId === "string" && params.existingCompanyId.trim() ? params.existingCompanyId.trim() : "";
12037
12013
  if (!companyName) return { error: "companyName is required", logs };
12014
+ if (params.refreshTemplates !== false && !cfg.templatesPath) {
12015
+ try {
12016
+ refreshTemplatesCache(cfg, log);
12017
+ } catch (err) {
12018
+ log(
12019
+ `\u26A0 Could not refresh templates cache (${err instanceof Error ? err.message : String(err)}); using existing cache.`
12020
+ );
12021
+ }
12022
+ } else if (cfg.templatesPath) {
12023
+ log(`Using configured templatesPath (${cfg.templatesPath}); skipping auto-refresh.`);
12024
+ }
12038
12025
  const templatesDir = await ensureTemplatesDir(cfg);
12039
12026
  const [presets, allModules, roleTemplates] = await Promise.all([
12040
12027
  loadPresets(templatesDir),
@@ -12102,7 +12089,11 @@ var plugin = definePlugin({
12102
12089
  const ceoInstructionsDir = path2.join(companyDir, "agents", "ceo");
12103
12090
  const ceoEntryFile = "AGENTS.md";
12104
12091
  const ceoEntryPath = path2.join(ceoInstructionsDir, ceoEntryFile);
12105
- const ceoPromptTemplate = fs2.existsSync(ceoEntryPath) ? fs2.readFileSync(ceoEntryPath, "utf-8") : "";
12092
+ if (!fs2.existsSync(ceoEntryPath)) {
12093
+ log(
12094
+ `\u26A0 Assembled CEO entry file missing at ${ceoEntryPath}; external bundle may be empty.`
12095
+ );
12096
+ }
12106
12097
  log("");
12107
12098
  log(`\u2713 Generated files: ${companyDir}`);
12108
12099
  let company;
@@ -12216,11 +12207,7 @@ var plugin = definePlugin({
12216
12207
  companyDir,
12217
12208
  roleAdapterOverrides: assembleResult.roleAdapterOverrides?.get("ceo") ?? {}
12218
12209
  });
12219
- const ceoInstructionFiles = collectInstructionFiles(ceoInstructionsDir);
12220
- if (!ceoInstructionFiles[ceoEntryFile] && typeof ceoPromptTemplate === "string" && ceoPromptTemplate.trim()) {
12221
- ceoInstructionFiles[ceoEntryFile] = ceoPromptTemplate;
12222
- }
12223
- const ceoInstructionsBundle = Object.keys(ceoInstructionFiles).length > 0 ? { entryFile: ceoEntryFile, files: ceoInstructionFiles } : void 0;
12210
+ adapterConfig.instructionsFilePath = ceoEntryPath;
12224
12211
  const logPendingApproval = (agent) => {
12225
12212
  if (!agent?._pendingApprovalId) return;
12226
12213
  log(
@@ -12268,7 +12255,6 @@ var plugin = definePlugin({
12268
12255
  reportsTo: null,
12269
12256
  adapterType,
12270
12257
  adapterConfig,
12271
- instructionsBundle: ceoInstructionsBundle,
12272
12258
  runtimeConfig: ceoRuntimeConfig,
12273
12259
  permissions: { canCreateAgents: true },
12274
12260
  ...boardOperationsIssue?.id ? { sourceIssueId: boardOperationsIssue.id } : {}
@@ -12288,7 +12274,6 @@ var plugin = definePlugin({
12288
12274
  reportsTo: null,
12289
12275
  adapterType,
12290
12276
  adapterConfig,
12291
- instructionsBundle: ceoInstructionsBundle,
12292
12277
  runtimeConfig: ceoRuntimeConfig,
12293
12278
  permissions: { canCreateAgents: true },
12294
12279
  ...boardOperationsIssue?.id ? { sourceIssueId: boardOperationsIssue.id } : {}
@@ -12297,12 +12282,11 @@ var plugin = definePlugin({
12297
12282
  log(`\u2713 CEO agent created (${ceoAgentId})`);
12298
12283
  logPendingApproval(ceoAgent);
12299
12284
  }
12300
- await syncAgentInstructionsIntoManagedBundle({
12285
+ await setExternalInstructionsBundle({
12301
12286
  client,
12302
12287
  agentId: ceoAgentId,
12303
12288
  sourceDir: ceoInstructionsDir,
12304
12289
  entryFile: ceoEntryFile,
12305
- fallbackEntryContent: ceoPromptTemplate,
12306
12290
  log
12307
12291
  });
12308
12292
  for (const govIssue of [
@@ -12350,8 +12334,7 @@ var plugin = definePlugin({
12350
12334
  roleAdapterOverrides: assembleResult.roleAdapterOverrides?.get(roleName) ?? {}
12351
12335
  });
12352
12336
  const roleInstructionsDir = path2.join(companyDir, "agents", roleName);
12353
- const roleInstructionFiles = collectInstructionFiles(roleInstructionsDir);
12354
- const roleInstructionsBundle = Object.keys(roleInstructionFiles).length > 0 ? { entryFile: "AGENTS.md", files: roleInstructionFiles } : void 0;
12337
+ roleAdapterConfig.instructionsFilePath = path2.join(roleInstructionsDir, "AGENTS.md");
12355
12338
  const existingAgent = existingByTemplateRole.get(roleName);
12356
12339
  if (existingAgent?.id) {
12357
12340
  try {
@@ -12370,7 +12353,7 @@ var plugin = definePlugin({
12370
12353
  );
12371
12354
  }
12372
12355
  teamAgentIds[roleName] = existingAgent.id;
12373
- await syncAgentInstructionsIntoManagedBundle({
12356
+ await setExternalInstructionsBundle({
12374
12357
  client,
12375
12358
  agentId: existingAgent.id,
12376
12359
  sourceDir: roleInstructionsDir,
@@ -12389,11 +12372,17 @@ var plugin = definePlugin({
12389
12372
  reportsTo: ceoAgentId,
12390
12373
  adapterType,
12391
12374
  adapterConfig: roleAdapterConfig,
12392
- instructionsBundle: roleInstructionsBundle,
12393
12375
  runtimeConfig: roleRuntimeConfig,
12394
12376
  ...hiringPlanIssue?.id ? { sourceIssueId: hiringPlanIssue.id } : {}
12395
12377
  });
12396
12378
  teamAgentIds[roleName] = roleAgent.id;
12379
+ await setExternalInstructionsBundle({
12380
+ client,
12381
+ agentId: roleAgent.id,
12382
+ sourceDir: roleInstructionsDir,
12383
+ entryFile: "AGENTS.md",
12384
+ log
12385
+ });
12397
12386
  log(`\u2713 ${roleTitle} created (${roleAgent.id})`);
12398
12387
  if (roleAgent?._pendingApprovalId) {
12399
12388
  log(