agents-inc 0.162.0 → 0.163.0
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/CHANGELOG.md +15 -0
- package/dist/{chunk-53XPSAJ4.js → chunk-3CSK5CQN.js} +17 -16
- package/dist/chunk-3CSK5CQN.js.map +1 -0
- package/dist/{chunk-VFZF7LVY.js → chunk-3WVH2CTK.js} +3 -3
- package/dist/{chunk-5J6DO4VW.js → chunk-4VL3CEOS.js} +3 -3
- package/dist/{chunk-QM3ZNOWJ.js → chunk-6MV4JOCL.js} +2 -2
- package/dist/{chunk-WIJM6BX6.js → chunk-7ANJQLPJ.js} +2 -2
- package/dist/{chunk-3JDVBHWO.js → chunk-7REKOTKG.js} +2 -2
- package/dist/{chunk-MI7LKLD7.js → chunk-ABAZMMG4.js} +2 -2
- package/dist/{chunk-XSM3IBMG.js → chunk-AOTCIUGX.js} +2 -2
- package/dist/{chunk-L65XGQKR.js → chunk-ARYNOWKF.js} +8 -8
- package/dist/{chunk-3QBOVV6A.js → chunk-AVK2HEKB.js} +5 -5
- package/dist/{chunk-3QBOVV6A.js.map → chunk-AVK2HEKB.js.map} +1 -1
- package/dist/{chunk-AQSMNUKJ.js → chunk-B3Y3QMWI.js} +4 -4
- package/dist/{chunk-S6GX7IJ2.js → chunk-DSL66I4N.js} +6 -6
- package/dist/{chunk-IMTWWA3N.js → chunk-ECURHW3T.js} +12 -12
- package/dist/{chunk-VEONZFTL.js → chunk-FLW25ORT.js} +3 -3
- package/dist/{chunk-HRVPZMKK.js → chunk-IAVEMTN4.js} +35 -14
- package/dist/chunk-IAVEMTN4.js.map +1 -0
- package/dist/{chunk-H2MDPOLG.js → chunk-JIERYE6B.js} +5 -5
- package/dist/{chunk-K26SBQLO.js → chunk-K5ITEA3I.js} +4 -4
- package/dist/{chunk-4KVJJJG2.js → chunk-LT5GXEB2.js} +6 -6
- package/dist/{chunk-2IMHZEIK.js → chunk-NKGYKOB7.js} +3 -3
- package/dist/{chunk-X6KXPRKI.js → chunk-NQXO4LR3.js} +4 -4
- package/dist/{chunk-ZFPQM63K.js → chunk-NTF4UXGK.js} +5 -5
- package/dist/{chunk-GFO55TMY.js → chunk-O664ITBD.js} +102 -24
- package/dist/chunk-O664ITBD.js.map +1 -0
- package/dist/{chunk-77YZFVQD.js → chunk-PHCPUQVR.js} +2 -2
- package/dist/{chunk-C53RJ7AA.js → chunk-PM3374E7.js} +43 -41
- package/dist/chunk-PM3374E7.js.map +1 -0
- package/dist/{chunk-T2RPUNYP.js → chunk-Q4IRRVXK.js} +3 -3
- package/dist/{chunk-EN5MEPAS.js → chunk-QGUP3QJF.js} +5 -5
- package/dist/{chunk-MSUTHS2V.js → chunk-QZX7SYKU.js} +2 -2
- package/dist/{chunk-BR3TNSO3.js → chunk-RGYDFBCT.js} +4 -4
- package/dist/{chunk-4NAWM4OQ.js → chunk-S63LXWMC.js} +2 -2
- package/dist/{chunk-ES7WGE32.js → chunk-SMSB6YZW.js} +3 -3
- package/dist/{chunk-IV42Z63R.js → chunk-UITEKY2R.js} +19 -9
- package/dist/chunk-UITEKY2R.js.map +1 -0
- package/dist/{chunk-RMMEYCEA.js → chunk-URXIQE7I.js} +2 -2
- package/dist/{chunk-57YWAMNT.js → chunk-V5GLL2JB.js} +7 -7
- package/dist/{chunk-J2YG7P7L.js → chunk-X4SSJZLY.js} +49 -6
- package/dist/chunk-X4SSJZLY.js.map +1 -0
- package/dist/{chunk-VEBEGZUV.js → chunk-XATLUKXK.js} +5 -5
- package/dist/{chunk-33ZKIYJM.js → chunk-XHPWTL4I.js} +3 -3
- package/dist/{chunk-UNASGGW2.js → chunk-XPDVAJDH.js} +69 -8
- package/dist/chunk-XPDVAJDH.js.map +1 -0
- package/dist/{chunk-FL2CJ5T5.js → chunk-YRS3QZP2.js} +3 -3
- package/dist/{chunk-FXL63LDL.js → chunk-ZVXGW2IC.js} +2 -2
- package/dist/commands/build/marketplace.js +7 -7
- package/dist/commands/build/plugins.js +7 -7
- package/dist/commands/compile.js +82 -30
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.js +10 -10
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +40 -38
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +10 -10
- package/dist/commands/init.js +36 -36
- package/dist/commands/list.js +8 -8
- package/dist/commands/new/marketplace.js +7 -7
- package/dist/commands/search.js +10 -10
- package/dist/commands/share.js +8 -8
- package/dist/commands/uninstall.js +11 -11
- package/dist/commands/update.js +6 -6
- package/dist/components/common/removal-plan-confirm.js +2 -2
- package/dist/components/common/select-list.js +2 -2
- package/dist/components/wizard/category-grid.js +4 -4
- package/dist/components/wizard/checkbox-grid.js +4 -4
- package/dist/components/wizard/domain-selection.js +9 -9
- package/dist/components/wizard/run-wizard-session.js +26 -26
- package/dist/components/wizard/scroll-affordance.js +2 -2
- package/dist/components/wizard/skill-agent-summary.js +5 -5
- package/dist/components/wizard/source-grid.js +5 -5
- package/dist/components/wizard/stack-selection.js +7 -7
- package/dist/components/wizard/step-agents.js +8 -8
- package/dist/components/wizard/step-build.js +7 -7
- package/dist/components/wizard/step-confirm.js +9 -9
- package/dist/components/wizard/step-sources.js +8 -8
- package/dist/components/wizard/step-stack.js +8 -8
- package/dist/components/wizard/summary-panel.js +8 -8
- package/dist/components/wizard/toast.js +2 -2
- package/dist/components/wizard/wizard-layout.js +12 -12
- package/dist/components/wizard/wizard-tabs.js +2 -2
- package/dist/components/wizard/wizard.js +25 -25
- package/dist/hooks/init.js +36 -36
- package/dist/load-agent-defs-5J2MZLAA.js +13 -0
- package/dist/recompile-project-agents-FCJLHAE3.js +17 -0
- package/dist/{source-loader-KAWB76OH.js → source-loader-GRBVNRAW.js} +4 -4
- package/dist/src/agents/_templates/agent.liquid +30 -122
- package/dist/src/agents/_templates/methodologies/operating-principles.liquid +27 -0
- package/dist/src/agents/developer/ai-developer/critical-reminders.md +9 -48
- package/dist/src/agents/developer/ai-developer/critical-requirements.md +29 -47
- package/dist/src/agents/developer/ai-developer/identity.md +31 -40
- package/dist/src/agents/developer/ai-developer/output.md +92 -245
- package/dist/src/agents/developer/ai-developer/playbook.md +116 -270
- package/dist/src/agents/developer/api-developer/critical-reminders.md +9 -40
- package/dist/src/agents/developer/api-developer/critical-requirements.md +19 -34
- package/dist/src/agents/developer/api-developer/identity.md +18 -33
- package/dist/src/agents/developer/api-developer/output.md +118 -255
- package/dist/src/agents/developer/api-developer/playbook.md +103 -284
- package/dist/src/agents/developer/cli-developer/critical-reminders.md +9 -45
- package/dist/src/agents/developer/cli-developer/critical-requirements.md +21 -39
- package/dist/src/agents/developer/cli-developer/identity.md +22 -36
- package/dist/src/agents/developer/cli-developer/output.md +72 -185
- package/dist/src/agents/developer/cli-developer/playbook.md +107 -307
- package/dist/src/agents/developer/web-developer/critical-reminders.md +9 -34
- package/dist/src/agents/developer/web-developer/critical-requirements.md +11 -30
- package/dist/src/agents/developer/web-developer/identity.md +15 -15
- package/dist/src/agents/developer/web-developer/output.md +67 -220
- package/dist/src/agents/developer/web-developer/playbook.md +93 -283
- package/dist/src/agents/meta/agent-summoner/critical-reminders.md +6 -39
- package/dist/src/agents/meta/agent-summoner/critical-requirements.md +6 -44
- package/dist/src/agents/meta/agent-summoner/identity.md +20 -23
- package/dist/src/agents/meta/agent-summoner/metadata.yaml +1 -1
- package/dist/src/agents/meta/agent-summoner/output.md +85 -261
- package/dist/src/agents/meta/agent-summoner/playbook.md +220 -1398
- package/dist/src/agents/meta/codex-keeper/critical-reminders.md +11 -32
- package/dist/src/agents/meta/codex-keeper/critical-requirements.md +32 -22
- package/dist/src/agents/meta/codex-keeper/identity.md +31 -32
- package/dist/src/agents/meta/codex-keeper/output.md +49 -335
- package/dist/src/agents/meta/codex-keeper/playbook.md +151 -1112
- package/dist/src/agents/meta/convention-keeper/critical-reminders.md +11 -26
- package/dist/src/agents/meta/convention-keeper/critical-requirements.md +36 -25
- package/dist/src/agents/meta/convention-keeper/identity.md +35 -21
- package/dist/src/agents/meta/convention-keeper/metadata.yaml +1 -1
- package/dist/src/agents/meta/convention-keeper/output.md +33 -123
- package/dist/src/agents/meta/convention-keeper/playbook.md +64 -144
- package/dist/src/agents/meta/skill-summoner/critical-reminders.md +8 -71
- package/dist/src/agents/meta/skill-summoner/critical-requirements.md +9 -73
- package/dist/src/agents/meta/skill-summoner/identity.md +18 -22
- package/dist/src/agents/meta/skill-summoner/metadata.yaml +1 -1
- package/dist/src/agents/meta/skill-summoner/output.md +164 -270
- package/dist/src/agents/meta/skill-summoner/playbook.md +150 -1398
- package/dist/src/agents/planning/pm/critical-requirements.md +23 -25
- package/dist/src/agents/planning/pm/identity.md +24 -23
- package/dist/src/agents/planning/pm/output.md +5 -9
- package/dist/src/agents/planning/pm/playbook.md +50 -140
- package/dist/src/agents/researcher/ai-researcher/critical-reminders.md +8 -53
- package/dist/src/agents/researcher/ai-researcher/critical-requirements.md +31 -26
- package/dist/src/agents/researcher/ai-researcher/identity.md +36 -77
- package/dist/src/agents/researcher/ai-researcher/output.md +44 -151
- package/dist/src/agents/researcher/ai-researcher/playbook.md +130 -394
- package/dist/src/agents/researcher/api-researcher/critical-reminders.md +6 -38
- package/dist/src/agents/researcher/api-researcher/critical-requirements.md +15 -17
- package/dist/src/agents/researcher/api-researcher/identity.md +29 -63
- package/dist/src/agents/researcher/api-researcher/output.md +61 -153
- package/dist/src/agents/researcher/api-researcher/playbook.md +63 -140
- package/dist/src/agents/researcher/cli-researcher/critical-reminders.md +8 -45
- package/dist/src/agents/researcher/cli-researcher/critical-requirements.md +29 -24
- package/dist/src/agents/researcher/cli-researcher/identity.md +36 -78
- package/dist/src/agents/researcher/cli-researcher/output.md +22 -128
- package/dist/src/agents/researcher/cli-researcher/playbook.md +108 -263
- package/dist/src/agents/researcher/web-researcher/critical-reminders.md +5 -34
- package/dist/src/agents/researcher/web-researcher/critical-requirements.md +11 -16
- package/dist/src/agents/researcher/web-researcher/identity.md +28 -60
- package/dist/src/agents/researcher/web-researcher/output.md +41 -134
- package/dist/src/agents/researcher/web-researcher/playbook.md +48 -162
- package/dist/src/agents/reviewer/reviewer/critical-reminders.md +9 -22
- package/dist/src/agents/reviewer/reviewer/critical-requirements.md +24 -19
- package/dist/src/agents/reviewer/reviewer/identity.md +23 -20
- package/dist/src/agents/reviewer/reviewer/metadata.yaml +7 -2
- package/dist/src/agents/reviewer/reviewer/output.md +8 -26
- package/dist/src/agents/reviewer/reviewer/playbook.md +50 -91
- package/dist/src/agents/tester/ai-tester/critical-reminders.md +7 -40
- package/dist/src/agents/tester/ai-tester/critical-requirements.md +39 -31
- package/dist/src/agents/tester/ai-tester/identity.md +25 -40
- package/dist/src/agents/tester/ai-tester/output.md +8 -144
- package/dist/src/agents/tester/ai-tester/playbook.md +28 -40
- package/dist/src/agents/tester/api-tester/critical-reminders.md +8 -35
- package/dist/src/agents/tester/api-tester/critical-requirements.md +36 -25
- package/dist/src/agents/tester/api-tester/identity.md +18 -29
- package/dist/src/agents/tester/api-tester/metadata.yaml +1 -1
- package/dist/src/agents/tester/api-tester/output.md +3 -86
- package/dist/src/agents/tester/api-tester/playbook.md +10 -2
- package/dist/src/agents/tester/cli-tester/critical-reminders.md +7 -30
- package/dist/src/agents/tester/cli-tester/critical-requirements.md +29 -21
- package/dist/src/agents/tester/cli-tester/identity.md +25 -33
- package/dist/src/agents/tester/cli-tester/output.md +13 -105
- package/dist/src/agents/tester/cli-tester/playbook.md +8 -5
- package/dist/src/agents/tester/web-tester/critical-reminders.md +7 -25
- package/dist/src/agents/tester/web-tester/critical-requirements.md +25 -16
- package/dist/src/agents/tester/web-tester/identity.md +24 -30
- package/dist/src/agents/tester/web-tester/output.md +11 -116
- package/dist/src/agents/tester/web-tester/playbook.md +58 -221
- package/dist/stores/wizard-store.js +4 -4
- package/package.json +1 -1
- package/src/agents/_templates/agent.liquid +30 -122
- package/src/agents/_templates/methodologies/operating-principles.liquid +27 -0
- package/src/agents/developer/ai-developer/critical-reminders.md +9 -48
- package/src/agents/developer/ai-developer/critical-requirements.md +29 -47
- package/src/agents/developer/ai-developer/identity.md +31 -40
- package/src/agents/developer/ai-developer/output.md +92 -245
- package/src/agents/developer/ai-developer/playbook.md +116 -270
- package/src/agents/developer/api-developer/critical-reminders.md +9 -40
- package/src/agents/developer/api-developer/critical-requirements.md +19 -34
- package/src/agents/developer/api-developer/identity.md +18 -33
- package/src/agents/developer/api-developer/output.md +118 -255
- package/src/agents/developer/api-developer/playbook.md +103 -284
- package/src/agents/developer/cli-developer/critical-reminders.md +9 -45
- package/src/agents/developer/cli-developer/critical-requirements.md +21 -39
- package/src/agents/developer/cli-developer/identity.md +22 -36
- package/src/agents/developer/cli-developer/output.md +72 -185
- package/src/agents/developer/cli-developer/playbook.md +107 -307
- package/src/agents/developer/web-developer/critical-reminders.md +9 -34
- package/src/agents/developer/web-developer/critical-requirements.md +11 -30
- package/src/agents/developer/web-developer/identity.md +15 -15
- package/src/agents/developer/web-developer/output.md +67 -220
- package/src/agents/developer/web-developer/playbook.md +93 -283
- package/src/agents/meta/agent-summoner/critical-reminders.md +6 -39
- package/src/agents/meta/agent-summoner/critical-requirements.md +6 -44
- package/src/agents/meta/agent-summoner/identity.md +20 -23
- package/src/agents/meta/agent-summoner/metadata.yaml +1 -1
- package/src/agents/meta/agent-summoner/output.md +85 -261
- package/src/agents/meta/agent-summoner/playbook.md +220 -1398
- package/src/agents/meta/codex-keeper/critical-reminders.md +11 -32
- package/src/agents/meta/codex-keeper/critical-requirements.md +32 -22
- package/src/agents/meta/codex-keeper/identity.md +31 -32
- package/src/agents/meta/codex-keeper/output.md +49 -335
- package/src/agents/meta/codex-keeper/playbook.md +151 -1112
- package/src/agents/meta/convention-keeper/critical-reminders.md +11 -26
- package/src/agents/meta/convention-keeper/critical-requirements.md +36 -25
- package/src/agents/meta/convention-keeper/identity.md +35 -21
- package/src/agents/meta/convention-keeper/metadata.yaml +1 -1
- package/src/agents/meta/convention-keeper/output.md +33 -123
- package/src/agents/meta/convention-keeper/playbook.md +64 -144
- package/src/agents/meta/skill-summoner/critical-reminders.md +8 -71
- package/src/agents/meta/skill-summoner/critical-requirements.md +9 -73
- package/src/agents/meta/skill-summoner/identity.md +18 -22
- package/src/agents/meta/skill-summoner/metadata.yaml +1 -1
- package/src/agents/meta/skill-summoner/output.md +164 -270
- package/src/agents/meta/skill-summoner/playbook.md +150 -1398
- package/src/agents/planning/pm/critical-requirements.md +23 -25
- package/src/agents/planning/pm/identity.md +24 -23
- package/src/agents/planning/pm/output.md +5 -9
- package/src/agents/planning/pm/playbook.md +50 -140
- package/src/agents/researcher/ai-researcher/critical-reminders.md +8 -53
- package/src/agents/researcher/ai-researcher/critical-requirements.md +31 -26
- package/src/agents/researcher/ai-researcher/identity.md +36 -77
- package/src/agents/researcher/ai-researcher/output.md +44 -151
- package/src/agents/researcher/ai-researcher/playbook.md +130 -394
- package/src/agents/researcher/api-researcher/critical-reminders.md +6 -38
- package/src/agents/researcher/api-researcher/critical-requirements.md +15 -17
- package/src/agents/researcher/api-researcher/identity.md +29 -63
- package/src/agents/researcher/api-researcher/output.md +61 -153
- package/src/agents/researcher/api-researcher/playbook.md +63 -140
- package/src/agents/researcher/cli-researcher/critical-reminders.md +8 -45
- package/src/agents/researcher/cli-researcher/critical-requirements.md +29 -24
- package/src/agents/researcher/cli-researcher/identity.md +36 -78
- package/src/agents/researcher/cli-researcher/output.md +22 -128
- package/src/agents/researcher/cli-researcher/playbook.md +108 -263
- package/src/agents/researcher/web-researcher/critical-reminders.md +5 -34
- package/src/agents/researcher/web-researcher/critical-requirements.md +11 -16
- package/src/agents/researcher/web-researcher/identity.md +28 -60
- package/src/agents/researcher/web-researcher/output.md +41 -134
- package/src/agents/researcher/web-researcher/playbook.md +48 -162
- package/src/agents/reviewer/reviewer/critical-reminders.md +9 -22
- package/src/agents/reviewer/reviewer/critical-requirements.md +24 -19
- package/src/agents/reviewer/reviewer/identity.md +23 -20
- package/src/agents/reviewer/reviewer/metadata.yaml +7 -2
- package/src/agents/reviewer/reviewer/output.md +8 -26
- package/src/agents/reviewer/reviewer/playbook.md +50 -91
- package/src/agents/tester/ai-tester/critical-reminders.md +7 -40
- package/src/agents/tester/ai-tester/critical-requirements.md +39 -31
- package/src/agents/tester/ai-tester/identity.md +25 -40
- package/src/agents/tester/ai-tester/output.md +8 -144
- package/src/agents/tester/ai-tester/playbook.md +28 -40
- package/src/agents/tester/api-tester/critical-reminders.md +8 -35
- package/src/agents/tester/api-tester/critical-requirements.md +36 -25
- package/src/agents/tester/api-tester/identity.md +18 -29
- package/src/agents/tester/api-tester/metadata.yaml +1 -1
- package/src/agents/tester/api-tester/output.md +3 -86
- package/src/agents/tester/api-tester/playbook.md +10 -2
- package/src/agents/tester/cli-tester/critical-reminders.md +7 -30
- package/src/agents/tester/cli-tester/critical-requirements.md +29 -21
- package/src/agents/tester/cli-tester/identity.md +25 -33
- package/src/agents/tester/cli-tester/output.md +13 -105
- package/src/agents/tester/cli-tester/playbook.md +8 -5
- package/src/agents/tester/web-tester/critical-reminders.md +7 -25
- package/src/agents/tester/web-tester/critical-requirements.md +25 -16
- package/src/agents/tester/web-tester/identity.md +24 -30
- package/src/agents/tester/web-tester/output.md +11 -116
- package/src/agents/tester/web-tester/playbook.md +58 -221
- package/src/schemas/agent-frontmatter.schema.json +14 -0
- package/src/schemas/agent.schema.json +14 -0
- package/dist/chunk-53XPSAJ4.js.map +0 -1
- package/dist/chunk-C53RJ7AA.js.map +0 -1
- package/dist/chunk-GFO55TMY.js.map +0 -1
- package/dist/chunk-HRVPZMKK.js.map +0 -1
- package/dist/chunk-IV42Z63R.js.map +0 -1
- package/dist/chunk-J2YG7P7L.js.map +0 -1
- package/dist/chunk-UNASGGW2.js.map +0 -1
- package/dist/load-agent-defs-57YKPVQW.js +0 -13
- package/dist/recompile-project-agents-IQD3HRRS.js +0 -17
- package/dist/src/agents/_templates/methodologies/anti-over-engineering.liquid +0 -135
- package/dist/src/agents/_templates/methodologies/context-management.liquid +0 -15
- package/dist/src/agents/_templates/methodologies/improvement-protocol.liquid +0 -150
- package/dist/src/agents/_templates/methodologies/investigation-requirements.liquid +0 -61
- package/dist/src/agents/_templates/methodologies/success-criteria.liquid +0 -121
- package/dist/src/agents/_templates/methodologies/write-verification.liquid +0 -43
- package/dist/src/agents/planning/pm/critical-reminders.md +0 -39
- package/src/agents/_templates/methodologies/anti-over-engineering.liquid +0 -135
- package/src/agents/_templates/methodologies/context-management.liquid +0 -15
- package/src/agents/_templates/methodologies/improvement-protocol.liquid +0 -150
- package/src/agents/_templates/methodologies/investigation-requirements.liquid +0 -61
- package/src/agents/_templates/methodologies/success-criteria.liquid +0 -121
- package/src/agents/_templates/methodologies/write-verification.liquid +0 -43
- package/src/agents/planning/pm/critical-reminders.md +0 -39
- /package/dist/{chunk-VFZF7LVY.js.map → chunk-3WVH2CTK.js.map} +0 -0
- /package/dist/{chunk-5J6DO4VW.js.map → chunk-4VL3CEOS.js.map} +0 -0
- /package/dist/{chunk-QM3ZNOWJ.js.map → chunk-6MV4JOCL.js.map} +0 -0
- /package/dist/{chunk-WIJM6BX6.js.map → chunk-7ANJQLPJ.js.map} +0 -0
- /package/dist/{chunk-3JDVBHWO.js.map → chunk-7REKOTKG.js.map} +0 -0
- /package/dist/{chunk-MI7LKLD7.js.map → chunk-ABAZMMG4.js.map} +0 -0
- /package/dist/{chunk-XSM3IBMG.js.map → chunk-AOTCIUGX.js.map} +0 -0
- /package/dist/{chunk-L65XGQKR.js.map → chunk-ARYNOWKF.js.map} +0 -0
- /package/dist/{chunk-AQSMNUKJ.js.map → chunk-B3Y3QMWI.js.map} +0 -0
- /package/dist/{chunk-S6GX7IJ2.js.map → chunk-DSL66I4N.js.map} +0 -0
- /package/dist/{chunk-IMTWWA3N.js.map → chunk-ECURHW3T.js.map} +0 -0
- /package/dist/{chunk-VEONZFTL.js.map → chunk-FLW25ORT.js.map} +0 -0
- /package/dist/{chunk-H2MDPOLG.js.map → chunk-JIERYE6B.js.map} +0 -0
- /package/dist/{chunk-K26SBQLO.js.map → chunk-K5ITEA3I.js.map} +0 -0
- /package/dist/{chunk-4KVJJJG2.js.map → chunk-LT5GXEB2.js.map} +0 -0
- /package/dist/{chunk-2IMHZEIK.js.map → chunk-NKGYKOB7.js.map} +0 -0
- /package/dist/{chunk-X6KXPRKI.js.map → chunk-NQXO4LR3.js.map} +0 -0
- /package/dist/{chunk-ZFPQM63K.js.map → chunk-NTF4UXGK.js.map} +0 -0
- /package/dist/{chunk-77YZFVQD.js.map → chunk-PHCPUQVR.js.map} +0 -0
- /package/dist/{chunk-T2RPUNYP.js.map → chunk-Q4IRRVXK.js.map} +0 -0
- /package/dist/{chunk-EN5MEPAS.js.map → chunk-QGUP3QJF.js.map} +0 -0
- /package/dist/{chunk-MSUTHS2V.js.map → chunk-QZX7SYKU.js.map} +0 -0
- /package/dist/{chunk-BR3TNSO3.js.map → chunk-RGYDFBCT.js.map} +0 -0
- /package/dist/{chunk-4NAWM4OQ.js.map → chunk-S63LXWMC.js.map} +0 -0
- /package/dist/{chunk-ES7WGE32.js.map → chunk-SMSB6YZW.js.map} +0 -0
- /package/dist/{chunk-RMMEYCEA.js.map → chunk-URXIQE7I.js.map} +0 -0
- /package/dist/{chunk-57YWAMNT.js.map → chunk-V5GLL2JB.js.map} +0 -0
- /package/dist/{chunk-VEBEGZUV.js.map → chunk-XATLUKXK.js.map} +0 -0
- /package/dist/{chunk-33ZKIYJM.js.map → chunk-XHPWTL4I.js.map} +0 -0
- /package/dist/{chunk-FL2CJ5T5.js.map → chunk-YRS3QZP2.js.map} +0 -0
- /package/dist/{chunk-FXL63LDL.js.map → chunk-ZVXGW2IC.js.map} +0 -0
- /package/dist/{load-agent-defs-57YKPVQW.js.map → load-agent-defs-5J2MZLAA.js.map} +0 -0
- /package/dist/{recompile-project-agents-IQD3HRRS.js.map → recompile-project-agents-FCJLHAE3.js.map} +0 -0
- /package/dist/{source-loader-KAWB76OH.js.map → source-loader-GRBVNRAW.js.map} +0 -0
|
@@ -33,12 +33,12 @@ import {
|
|
|
33
33
|
writeContentHash,
|
|
34
34
|
writeFile,
|
|
35
35
|
writePluginManifest
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-XPDVAJDH.js";
|
|
37
37
|
import {
|
|
38
38
|
typedEntries,
|
|
39
39
|
typedFromEntries,
|
|
40
40
|
typedKeys
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-AVK2HEKB.js";
|
|
42
42
|
import {
|
|
43
43
|
CLAUDE_DIR,
|
|
44
44
|
CLAUDE_SRC_DIR,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
STANDARD_FILES,
|
|
51
51
|
diagnostics,
|
|
52
52
|
effectivelyExcludedSkillIds
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-UITEKY2R.js";
|
|
54
54
|
|
|
55
55
|
// src/cli/lib/agents/list-compiled-agents.ts
|
|
56
56
|
import path2 from "path";
|
|
@@ -74,6 +74,45 @@ function sanitizeLiquidSyntax(value, fieldName) {
|
|
|
74
74
|
function sanitizeStringArray(values, fieldName) {
|
|
75
75
|
return values.map((v) => sanitizeLiquidSyntax(v, fieldName));
|
|
76
76
|
}
|
|
77
|
+
function sanitizeHooks(hooks) {
|
|
78
|
+
return Object.fromEntries(
|
|
79
|
+
Object.entries(hooks).map(([event, definitions]) => [
|
|
80
|
+
sanitizeLiquidSyntax(event, "hook.event"),
|
|
81
|
+
definitions.map((definition) => ({
|
|
82
|
+
...definition,
|
|
83
|
+
...definition.matcher !== void 0 && {
|
|
84
|
+
matcher: sanitizeLiquidSyntax(definition.matcher, "hook.matcher")
|
|
85
|
+
},
|
|
86
|
+
...definition.hooks !== void 0 && {
|
|
87
|
+
hooks: definition.hooks.map((action) => ({
|
|
88
|
+
...action,
|
|
89
|
+
type: sanitizeLiquidSyntax(action.type, "hook.type"),
|
|
90
|
+
...action.command !== void 0 && {
|
|
91
|
+
command: sanitizeLiquidSyntax(action.command, "hook.command")
|
|
92
|
+
},
|
|
93
|
+
...action.script !== void 0 && {
|
|
94
|
+
script: sanitizeLiquidSyntax(action.script, "hook.script")
|
|
95
|
+
},
|
|
96
|
+
...action.prompt !== void 0 && {
|
|
97
|
+
prompt: sanitizeLiquidSyntax(action.prompt, "hook.prompt")
|
|
98
|
+
}
|
|
99
|
+
}))
|
|
100
|
+
}
|
|
101
|
+
}))
|
|
102
|
+
])
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
function sanitizeExperimental(experimental) {
|
|
106
|
+
return {
|
|
107
|
+
...experimental,
|
|
108
|
+
...experimental.cacheTtl !== void 0 && {
|
|
109
|
+
cacheTtl: sanitizeLiquidSyntax(
|
|
110
|
+
experimental.cacheTtl,
|
|
111
|
+
"agent.experimental.cacheTtl"
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
77
116
|
function sanitizeSkills(skills) {
|
|
78
117
|
return skills.map((s) => ({
|
|
79
118
|
...s,
|
|
@@ -112,6 +151,15 @@ function sanitizeCompiledAgentData(data) {
|
|
|
112
151
|
data.agent.permissionMode,
|
|
113
152
|
"agent.permissionMode"
|
|
114
153
|
)
|
|
154
|
+
},
|
|
155
|
+
...data.agent.isolation !== void 0 && {
|
|
156
|
+
isolation: sanitizeLiquidSyntax(data.agent.isolation, "agent.isolation")
|
|
157
|
+
},
|
|
158
|
+
...data.agent.experimental !== void 0 && {
|
|
159
|
+
experimental: sanitizeExperimental(data.agent.experimental)
|
|
160
|
+
},
|
|
161
|
+
...data.agent.hooks !== void 0 && {
|
|
162
|
+
hooks: sanitizeHooks(data.agent.hooks)
|
|
115
163
|
}
|
|
116
164
|
};
|
|
117
165
|
const sanitizedSkills = sanitizeSkills(data.skills);
|
|
@@ -159,12 +207,12 @@ function pluginRefFor(skill) {
|
|
|
159
207
|
if (skill.source === void 0 || skill.source === EJECT_SOURCE) return {};
|
|
160
208
|
return { pluginRef: `${skill.id}:${skill.id}` };
|
|
161
209
|
}
|
|
162
|
-
var MARKER_OPEN = `<!-- Generated by ${DEFAULT_PLUGIN_NAME}
|
|
210
|
+
var MARKER_OPEN = `<!-- Generated by ${DEFAULT_PLUGIN_NAME}`;
|
|
163
211
|
var MARKER_NOTICE = " \u2014 do not edit; compile rewrites this file";
|
|
164
212
|
var MARKER_CLOSE = " -->";
|
|
165
213
|
var FRONTMATTER_FENCE = "---";
|
|
166
|
-
function provenanceMarker(
|
|
167
|
-
return `${MARKER_OPEN}${
|
|
214
|
+
function provenanceMarker() {
|
|
215
|
+
return `${MARKER_OPEN}${MARKER_NOTICE}${MARKER_CLOSE}`;
|
|
168
216
|
}
|
|
169
217
|
function isProvenanceMarker(line) {
|
|
170
218
|
return line.startsWith(MARKER_OPEN) && line.endsWith(MARKER_CLOSE);
|
|
@@ -180,23 +228,50 @@ function hasProvenanceMarker(content) {
|
|
|
180
228
|
const firstBodyLine = lines[bodyStartIndex(lines)];
|
|
181
229
|
return firstBodyLine !== void 0 && isProvenanceMarker(firstBodyLine);
|
|
182
230
|
}
|
|
183
|
-
function stampProvenanceMarker(content
|
|
231
|
+
function stampProvenanceMarker(content) {
|
|
184
232
|
const lines = content.split("\n");
|
|
185
233
|
const bodyStart = bodyStartIndex(lines);
|
|
186
234
|
const replacedLines = hasProvenanceMarker(content) ? 1 : 0;
|
|
187
235
|
return [
|
|
188
236
|
...lines.slice(0, bodyStart),
|
|
189
|
-
provenanceMarker(
|
|
237
|
+
provenanceMarker(),
|
|
190
238
|
...lines.slice(bodyStart + replacedLines)
|
|
191
239
|
].join("\n");
|
|
192
240
|
}
|
|
193
241
|
var AGENT_TEMPLATE = "agent";
|
|
242
|
+
var COMPLETION_GATE_COMMAND = `command -v npm >/dev/null 2>&1 && [ -f package.json ] || exit 0; out=$(npm run --if-present --silent typecheck 2>&1) || { printf '%s\\n' "$out" >&2; exit 2; }`;
|
|
243
|
+
var WRITING_TOOLS = ["Write", "Edit"];
|
|
244
|
+
var GATE_EVENT = "Stop";
|
|
245
|
+
var CONVERTED_GATE_EVENT = "SubagentStop";
|
|
246
|
+
function completionGateHooks() {
|
|
247
|
+
return {
|
|
248
|
+
[GATE_EVENT]: [
|
|
249
|
+
{ hooks: [{ type: "command", command: COMPLETION_GATE_COMMAND }] }
|
|
250
|
+
]
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function declaresOwnGate(hooks) {
|
|
254
|
+
if (hooks === void 0) return false;
|
|
255
|
+
const stated = [GATE_EVENT, CONVERTED_GATE_EVENT];
|
|
256
|
+
return stated.some((event) => (hooks[event]?.length ?? 0) > 0);
|
|
257
|
+
}
|
|
258
|
+
function withCompletionGate(agent) {
|
|
259
|
+
const writes = WRITING_TOOLS.some((tool) => agent.tools.includes(tool));
|
|
260
|
+
if (!writes || declaresOwnGate(agent.hooks)) return agent;
|
|
261
|
+
return { ...agent, hooks: { ...agent.hooks, ...completionGateHooks() } };
|
|
262
|
+
}
|
|
263
|
+
function prepareForRender(data) {
|
|
264
|
+
return sanitizeCompiledAgentData({
|
|
265
|
+
...data,
|
|
266
|
+
agent: withCompletionGate(data.agent)
|
|
267
|
+
});
|
|
268
|
+
}
|
|
194
269
|
async function renderAgent(engine, data, version) {
|
|
195
|
-
const rendered = await engine.renderFile(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
);
|
|
199
|
-
return stampProvenanceMarker(rendered
|
|
270
|
+
const rendered = await engine.renderFile(AGENT_TEMPLATE, {
|
|
271
|
+
...prepareForRender(data),
|
|
272
|
+
generatorVersion: sanitizeLiquidSyntax(version, "generatorVersion")
|
|
273
|
+
});
|
|
274
|
+
return stampProvenanceMarker(rendered);
|
|
200
275
|
}
|
|
201
276
|
|
|
202
277
|
// src/cli/lib/agents/agent-provenance.ts
|
|
@@ -502,29 +577,32 @@ async function recompileAgents(options) {
|
|
|
502
577
|
|
|
503
578
|
// src/cli/lib/agents/agent-plugin-compiler.ts
|
|
504
579
|
import path7 from "path";
|
|
505
|
-
|
|
580
|
+
var NO_FRONTMATTER_REASON = "no YAML frontmatter block";
|
|
581
|
+
function parseAgentFrontmatter(content) {
|
|
506
582
|
const raw = extractFrontmatter(content);
|
|
507
583
|
if (!raw) {
|
|
508
|
-
return
|
|
584
|
+
return { ok: false, reason: NO_FRONTMATTER_REASON };
|
|
509
585
|
}
|
|
510
586
|
const result = agentFrontmatterValidationSchema.safeParse(raw);
|
|
511
587
|
if (!result.success) {
|
|
512
|
-
|
|
513
|
-
return null;
|
|
588
|
+
return { ok: false, reason: formatZodIssues(result.error.issues) };
|
|
514
589
|
}
|
|
515
|
-
return {
|
|
590
|
+
return {
|
|
591
|
+
ok: true,
|
|
592
|
+
frontmatter: { name: result.data.name, description: result.data.description }
|
|
593
|
+
};
|
|
516
594
|
}
|
|
517
595
|
async function compileAgentPlugin(options) {
|
|
518
596
|
const { agentPath, outputDir } = options;
|
|
519
597
|
const fileName = path7.basename(agentPath);
|
|
520
598
|
const content = await readFile(agentPath);
|
|
521
|
-
const
|
|
522
|
-
if (!
|
|
599
|
+
const parsed = parseAgentFrontmatter(content);
|
|
600
|
+
if (!parsed.ok) {
|
|
523
601
|
throw new Error(
|
|
524
|
-
`Agent '${fileName}' has invalid or missing YAML frontmatter
|
|
602
|
+
`Agent '${fileName}' has invalid or missing YAML frontmatter: ${parsed.reason}. File: ${agentPath}`
|
|
525
603
|
);
|
|
526
604
|
}
|
|
527
|
-
const agentName2 = frontmatter.name;
|
|
605
|
+
const agentName2 = parsed.frontmatter.name;
|
|
528
606
|
verbose(`Compiling agent plugin: ${agentName2} from ${agentPath}`);
|
|
529
607
|
const pluginDir = path7.join(outputDir, `agent-${agentName2}`);
|
|
530
608
|
const agentsDir = path7.join(pluginDir, "agents");
|
|
@@ -538,7 +616,7 @@ async function compileAgentPlugin(options) {
|
|
|
538
616
|
);
|
|
539
617
|
const manifest = generateAgentPluginManifest({
|
|
540
618
|
agentName: agentName2,
|
|
541
|
-
description: frontmatter.description,
|
|
619
|
+
description: parsed.frontmatter.description,
|
|
542
620
|
version
|
|
543
621
|
});
|
|
544
622
|
await writePluginManifest(pluginDir, manifest);
|
|
@@ -589,4 +667,4 @@ export {
|
|
|
589
667
|
compileAllAgentPlugins,
|
|
590
668
|
printAgentCompilationSummary
|
|
591
669
|
};
|
|
592
|
-
//# sourceMappingURL=chunk-
|
|
670
|
+
//# sourceMappingURL=chunk-O664ITBD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/lib/agents/list-compiled-agents.ts","../src/cli/lib/agents/agent-provenance.ts","../../compile/src/agent-source.ts","../src/cli/lib/agents/agent-fetcher.ts","../src/cli/lib/agents/agent-recompiler.ts","../src/cli/lib/agents/write-compiled-agents.ts","../src/cli/lib/compiler.ts","../src/cli/lib/agents/agent-plugin-compiler.ts"],"sourcesContent":["import path from \"path\";\nimport { partition } from \"remeda\";\nimport { glob, readFileOptional, remove } from \"../../utils/fs\";\nimport { isAgentName } from \"../../utils/type-guards\";\nimport { hasProvenanceMarker } from \"./agent-provenance\";\nimport type { AgentName } from \"../../types\";\n\n/** Compiled-agent basenames in a directory, split by whether this CLI compiled them. */\nexport type AgentProvenanceSplit = {\n /** Files carrying the provenance marker — provably written by this CLI. */\n marked: string[];\n /** Everything else in the directory, the user's own agents among them. */\n unmarked: string[];\n};\n\n/** Lists compiled-agent markdown filenames (e.g. \"web-developer.md\") in a directory. */\nexport async function listAgentMdFiles(agentsDir: string): Promise<string[]> {\n return glob(\"*.md\", agentsDir);\n}\n\n/**\n * Splits the agent files in a directory by the provenance marker each compiled agent carries.\n *\n * This is the only thing that identifies this CLI's own output once the configuration naming\n * it is gone, so the split errs one way by construction: a file that cannot be read yields no\n * marker and lands in `unmarked`, because \"cannot prove it is ours\" and \"is not ours\" call for\n * the same answer — leave it alone.\n */\nexport async function splitAgentsByProvenance(agentsDir: string): Promise<AgentProvenanceSplit> {\n const files = await listAgentMdFiles(agentsDir);\n const classified = await Promise.all(files.map((file) => readAgentProvenance(agentsDir, file)));\n const [marked, unmarked] = partition(classified, (agent) => agent.compiledHere);\n\n return { marked: marked.map(agentName), unmarked: unmarked.map(agentName) };\n}\n\ntype ClassifiedAgent = { name: string; compiledHere: boolean };\n\nasync function readAgentProvenance(agentsDir: string, file: string): Promise<ClassifiedAgent> {\n const content = await readFileOptional(path.join(agentsDir, file));\n return { name: path.basename(file, \".md\"), compiledHere: hasProvenanceMarker(content) };\n}\n\nfunction agentName(agent: ClassifiedAgent): string {\n return agent.name;\n}\n\n/** Lists compiled-agent names (filenames without the `.md` extension) in a directory. */\nexport async function listCompiledAgentNames(agentsDir: string): Promise<AgentName[]> {\n const files = await listAgentMdFiles(agentsDir);\n // Boundary cast: compiled .md filenames are agent names by convention; custom\n // agents from marketplace stacks may not be members of the AgentName union.\n return files.map((f) => path.basename(f, \".md\") as AgentName);\n}\n\n/**\n * Removes stale CLI-compiled agent files from `agentsDir`: deletes any `.md`\n * whose basename is a built-in CLI agent name (`isAgentName`) that is NOT in\n * `keep`. The built-in-name check protects hand-authored agents (whose basename\n * is not a built-in name) — it is never the removal criterion. Only call this\n * when `keep` is the COMPLETE set of agents that should live in `agentsDir`.\n */\nexport async function pruneStaleCompiledAgents(\n agentsDir: string,\n keep: ReadonlySet<AgentName>,\n): Promise<void> {\n // A non-built-in basename is a hand-authored agent — always preserved.\n const isStaleCompiledAgent = (file: string): boolean => {\n const name = path.basename(file, \".md\");\n return isAgentName(name) && !keep.has(name);\n };\n\n const files = await listAgentMdFiles(agentsDir);\n await Promise.all(\n files.filter(isStaleCompiledAgent).map((file) => remove(path.join(agentsDir, file))),\n );\n}\n","import path from \"path\";\nimport { z } from \"zod\";\n\nimport { PROJECT_ROOT, STANDARD_FILES } from \"../../consts\";\nimport { readFile } from \"../../utils/fs\";\n\n/** The one field the marker needs from this CLI's own manifest. */\nconst ownPackageJsonSchema = z.object({ version: z.string().min(1) });\n\n/**\n * The provenance marker every compiled agent carries lives in `@workspace/compile/agent-source`,\n * beside the renderer that stamps it — the editor's output preview draws the same first body line\n * and must not compute it a second way. What stays here is the half that reads this CLI's own\n * manifest, which a browser has no equivalent of.\n */\nexport {\n hasProvenanceMarker,\n provenanceMarker,\n stampProvenanceMarker,\n} from \"@workspace/compile/agent-source\";\n\nlet ownVersion: Promise<string> | undefined;\n\n/**\n * This CLI's own published version, read once per process from the package manifest beside\n * the code — the same `PROJECT_ROOT` the bundled agent partials and templates resolve from.\n *\n * It reaches a compiled agent as the `version` argument of `renderAgent`, which hands it to the\n * template as `generatorVersion`; `agent.liquid` renders it in the trailing `<system-reminder>`\n * block. Deliberately not the provenance marker above it — that line's bytes are constant across\n * releases, so a version bump no longer rewrites the first cacheable byte of every compiled agent.\n */\nexport function cliVersion(): Promise<string> {\n ownVersion ??= readOwnVersion();\n return ownVersion;\n}\n\nasync function readOwnVersion(): Promise<string> {\n const manifestPath = path.join(PROJECT_ROOT, STANDARD_FILES.PACKAGE_JSON);\n const raw: unknown = JSON.parse(await readFile(manifestPath));\n\n const parsed = ownPackageJsonSchema.safeParse(raw);\n if (!parsed.success) {\n throw new Error(`Could not read this CLI's own version from ${manifestPath}`);\n }\n return parsed.data.version;\n}\n","import type { Liquid } from \"liquidjs\"\n\nimport { diagnostics } from \"./diagnostics.js\"\nimport { DEFAULT_PLUGIN_NAME, EJECT_SOURCE } from \"./paths.js\"\nimport type {\n AgentConfig,\n CompiledAgentData,\n PluginSkillRef,\n Skill,\n} from \"./types.js\"\n\n/**\n * Everything that turns a resolved sub-agent into the markdown an install writes,\n * with two things left behind in the CLI because they read the machine: the five\n * `readFile`s that fetch an agent's partials off disk, and `cliVersion()`, which\n * reads the CLI's own manifest. Both arrive here as data — {@link AgentFiles} and\n * the `version` argument of {@link renderAgent} — which is what lets a browser\n * render the same bytes from the vendored corpus.\n */\n\n/** Pattern matching Liquid template delimiters that could enable template injection */\nconst LIQUID_SYNTAX_PATTERN = /\\{\\{|\\}\\}|\\{%|%\\}/g\n\n/**\n * Strips Liquid template syntax (`{{`, `}}`, `{%`, `%}`) from a string value.\n * Prevents template injection when user-controlled data is passed to the Liquid engine.\n *\n * @param value - Input string that may contain Liquid syntax\n * @param fieldName - Name of the field (for warning messages)\n * @returns Sanitized string with Liquid delimiters removed\n */\nexport function sanitizeLiquidSyntax<T extends string>(\n value: T,\n fieldName: string\n): T {\n if (!LIQUID_SYNTAX_PATTERN.test(value)) return value\n LIQUID_SYNTAX_PATTERN.lastIndex = 0\n const sanitized = value.replace(LIQUID_SYNTAX_PATTERN, \"\")\n diagnostics().warn(\n `Stripped Liquid template syntax from '${fieldName}' — possible template injection attempt`\n )\n // Boundary cast: .replace() widens the branded string T; stripping characters keeps it in T's domain\n return sanitized as T\n}\n\nfunction sanitizeStringArray(values: string[], fieldName: string): string[] {\n return values.map((v) => sanitizeLiquidSyntax(v, fieldName))\n}\n\n/**\n * Hook definitions with every author-supplied string stripped of Liquid syntax.\n *\n * These are the only fields on an agent that render as an EXECUTABLE: a `SubagentStop` hook's\n * `command` is a shell line Claude Code runs when the sub-agent finishes. An agent definition\n * can arrive from a marketplace, so the strings here are as author-controlled as `agent.name`\n * beside them — and they were the one part of the definition the sanitiser did not cover,\n * because until this release nothing rendered them.\n *\n * Sanitising is not a substitute for trusting the source: a marketplace whose agents you compile\n * can name any command it likes, and that is a property of installing an agent rather than of\n * this function. What this closes is the narrower hole of a hook string carrying template syntax\n * into a render.\n */\nfunction sanitizeHooks(\n hooks: NonNullable<AgentConfig[\"hooks\"]>\n): NonNullable<AgentConfig[\"hooks\"]> {\n return Object.fromEntries(\n Object.entries(hooks).map(([event, definitions]) => [\n sanitizeLiquidSyntax(event, \"hook.event\"),\n definitions.map((definition) => ({\n ...definition,\n ...(definition.matcher !== undefined && {\n matcher: sanitizeLiquidSyntax(definition.matcher, \"hook.matcher\"),\n }),\n ...(definition.hooks !== undefined && {\n hooks: definition.hooks.map((action) => ({\n ...action,\n type: sanitizeLiquidSyntax(action.type, \"hook.type\"),\n ...(action.command !== undefined && {\n command: sanitizeLiquidSyntax(action.command, \"hook.command\"),\n }),\n ...(action.script !== undefined && {\n script: sanitizeLiquidSyntax(action.script, \"hook.script\"),\n }),\n ...(action.prompt !== undefined && {\n prompt: sanitizeLiquidSyntax(action.prompt, \"hook.prompt\"),\n }),\n })),\n }),\n })),\n ])\n )\n}\n\n/**\n * Experimental frontmatter options with their author-supplied value stripped of\n * Liquid syntax.\n *\n * Here for the same reason {@link sanitizeHooks} is: the template renders the\n * field, and being rendered is what puts a field in this enumeration. That\n * `cacheTtl` is a closed vocabulary does not exempt it — `model`, `effort`,\n * `permissionMode` and `isolation` are closed vocabularies too and are all\n * sanitised, because a type says nothing about what reached the renderer.\n * {@link renderAgent} is also the editor's preview path, which arrives from a\n * browser without the CLI's Zod loader having parsed anything.\n */\nfunction sanitizeExperimental(\n experimental: NonNullable<AgentConfig[\"experimental\"]>\n): NonNullable<AgentConfig[\"experimental\"]> {\n return {\n ...experimental,\n ...(experimental.cacheTtl !== undefined && {\n cacheTtl: sanitizeLiquidSyntax(\n experimental.cacheTtl,\n \"agent.experimental.cacheTtl\"\n ),\n }),\n }\n}\n\nfunction sanitizeSkills(skills: Skill[]): Skill[] {\n return skills.map((s) => ({\n ...s,\n id: sanitizeLiquidSyntax(s.id, \"skill.id\"),\n description: sanitizeLiquidSyntax(s.description, \"skill.description\"),\n usage: sanitizeLiquidSyntax(s.usage, \"skill.usage\"),\n ...(s.pluginRef !== undefined && {\n pluginRef: sanitizeLiquidSyntax(s.pluginRef, \"skill.pluginRef\"),\n }),\n }))\n}\n\n/**\n * Sanitizes user-controlled metadata fields in compiled agent data to prevent\n * Liquid template injection. Strips `{{`, `}}`, `{%`, `%}` from agent\n * metadata and skill metadata before template rendering.\n *\n * Content fields (identity, playbook, output, criticalRequirementsTop,\n * criticalReminders) are passed through unchanged — LiquidJS does not\n * re-evaluate template syntax inside variable values, so double-curlies\n * in content (e.g. GitHub Actions `${{ secrets.X }}`) are safe.\n */\nexport function sanitizeCompiledAgentData(\n data: CompiledAgentData\n): CompiledAgentData {\n const sanitizedAgent: AgentConfig = {\n ...data.agent,\n name: sanitizeLiquidSyntax(data.agent.name, \"agent.name\"),\n title: sanitizeLiquidSyntax(data.agent.title, \"agent.title\"),\n description: sanitizeLiquidSyntax(\n data.agent.description,\n \"agent.description\"\n ),\n tools: sanitizeStringArray(data.agent.tools, \"agent.tools\"),\n ...(data.agent.disallowedTools !== undefined && {\n disallowedTools: sanitizeStringArray(\n data.agent.disallowedTools,\n \"agent.disallowedTools\"\n ),\n }),\n ...(data.agent.model !== undefined && {\n model: sanitizeLiquidSyntax(data.agent.model, \"agent.model\"),\n }),\n ...(data.agent.effort !== undefined && {\n effort: sanitizeLiquidSyntax(data.agent.effort, \"agent.effort\"),\n }),\n ...(data.agent.permissionMode !== undefined && {\n permissionMode: sanitizeLiquidSyntax(\n data.agent.permissionMode,\n \"agent.permissionMode\"\n ),\n }),\n ...(data.agent.isolation !== undefined && {\n isolation: sanitizeLiquidSyntax(data.agent.isolation, \"agent.isolation\"),\n }),\n ...(data.agent.experimental !== undefined && {\n experimental: sanitizeExperimental(data.agent.experimental),\n }),\n ...(data.agent.hooks !== undefined && {\n hooks: sanitizeHooks(data.agent.hooks),\n }),\n }\n\n const sanitizedSkills = sanitizeSkills(data.skills)\n const sanitizedPreloaded = sanitizeSkills(data.preloadedSkills)\n const sanitizedDynamic = sanitizeSkills(data.dynamicSkills)\n const sanitizedPreloadedIds = data.preloadedSkillIds.map((id) =>\n sanitizeLiquidSyntax(id, \"preloadedSkillId\")\n )\n\n return {\n agent: sanitizedAgent,\n identity: data.identity,\n playbook: data.playbook,\n output: data.output,\n criticalRequirementsTop: data.criticalRequirementsTop,\n criticalReminders: data.criticalReminders,\n skills: sanitizedSkills,\n preloadedSkills: sanitizedPreloaded,\n dynamicSkills: sanitizedDynamic,\n preloadedSkillIds: sanitizedPreloadedIds,\n }\n}\n\n/**\n * The tool that loads a skill.\n *\n * A sub-agent's `tools:` frontmatter is an ALLOWLIST: an agent that declares one\n * gets exactly what it names, where an agent that omits the key inherits every\n * tool the session has. Every agent compiled here declares one, and no\n * `metadata.yaml` names this — so every agent this product had ever written was\n * unable to invoke a skill, while being instructed in the strongest terms the\n * template can manage to do exactly that.\n *\n * The `skills:` key does not close that gap, which is the non-obvious half and\n * the reason the defect survived: it preloads skill content into the agent's\n * startup context and grants no tool, so a compiled agent can list skills, carry\n * the activation protocol, and still have no way to load one.\n *\n * Granted to every agent rather than only to those with dynamic skills. Skills\n * are this product's atom: an agent has to be able to reach one a user adds\n * after it was compiled, and one its own playbook names in prose. It is a\n * read-only capability — it loads instructions and grants no write access — so\n * the deliberately read-only researchers take it on the same terms.\n */\nconst SKILL_TOOL = \"Skill\"\n\n/**\n * The same definition with {@link SKILL_TOOL} among its tools exactly once.\n *\n * Idempotent and order-stable: a definition already naming it is returned\n * unchanged, by identity, and everything else keeps its declared order with the\n * grant appended. Both halves are about the next compile — a second entry, or a\n * reordered list, would diff the frontmatter of every agent on disk.\n */\nfunction withSkillTool(agent: AgentConfig): AgentConfig {\n if (agent.tools.includes(SKILL_TOOL)) return agent\n return { ...agent, tools: [...agent.tools, SKILL_TOOL] }\n}\n\n/** The five markdown partials a sub-agent is assembled from, however they were fetched. */\nexport type AgentFiles = Pick<\n CompiledAgentData,\n | \"identity\"\n | \"playbook\"\n | \"output\"\n | \"criticalRequirementsTop\"\n | \"criticalReminders\"\n>\n\n/**\n * The template context for one sub-agent.\n *\n * The single assembly point for both front doors — the CLI's write path and the\n * editor's output preview — which is why {@link withSkillTool} is applied here\n * rather than in the eighteen `metadata.yaml` files: a user-authored agent gets\n * the grant on the same terms as a shipped one.\n *\n * The preloaded/dynamic split PRESERVES the order `agent.skills` arrives in, and\n * that order is `config.ts`'s stack key order — so the emitted rows of the\n * sub-agent's skill-activation table are decided by the config writer's\n * canonicalisation rather than by anything here.\n */\nexport function buildAgentTemplateContext(\n name: string,\n agent: AgentConfig,\n files: AgentFiles,\n mapSkill: (skill: Skill) => Skill = (skill) => skill\n): CompiledAgentData {\n const skills = agent.skills.map(mapSkill)\n const preloadedSkills = skills.filter((s) => s.preloaded)\n const dynamicSkills = skills.filter((s) => !s.preloaded)\n const preloadedSkillIds = preloadedSkills.map((s) => s.pluginRef ?? s.id)\n\n diagnostics().verbose(\n `Skills for ${name}: ${preloadedSkills.length} preloaded, ${dynamicSkills.length} dynamic`\n )\n\n return {\n agent: withSkillTool(agent),\n ...files,\n skills,\n preloadedSkills,\n dynamicSkills,\n preloadedSkillIds,\n }\n}\n\n/**\n * The per-skill pluginRef decision. A skill renders as `${id}:${id}` only\n * when it has an explicit non-eject source on its SkillReference — i.e. it was\n * installed from a marketplace. `undefined` source (user-authored local skills\n * with no SkillConfig entry) and `\"eject\"` both fall through to bare id.\n */\nexport function pluginRefFor(skill: Skill): { pluginRef?: PluginSkillRef } {\n if (skill.source === undefined || skill.source === EJECT_SOURCE) return {}\n return { pluginRef: `${skill.id}:${skill.id}` as const }\n}\n\n/**\n * The provenance marker every compiled agent carries: an HTML comment on the first line\n * after the frontmatter, naming the generator and the fact that the file is rewritten\n * rather than edited.\n *\n * **A body comment, deliberately not a frontmatter field.** Claude Code documents its\n * supported frontmatter keys and says nothing about how it treats an unknown one, so a\n * stricter release could reject every agent this CLI has ever written. The body is free-form\n * by contract, which makes a marker there safe, greppable, and the do-not-edit notice at the\n * same time.\n *\n * **Its bytes are constant across releases, and that is the point.** A compiled agent IS a\n * sub-agent's system prompt, so this line is the first cacheable byte of every invocation of\n * it — and while it carried the CLI's version it moved on every release, invalidating the\n * whole prompt prefix of all eighteen agents for a string nothing reads back. The version\n * still travels, in the trailing volatile block where a change to it costs nothing.\n *\n * {@link hasProvenanceMarker} matched on SHAPE while the text varied and still does, so an\n * agent compiled by any release — before this change or after it — is recognised by any other.\n */\nconst MARKER_OPEN = `<!-- Generated by ${DEFAULT_PLUGIN_NAME}`\nconst MARKER_NOTICE = \" — do not edit; compile rewrites this file\"\nconst MARKER_CLOSE = \" -->\"\n\nconst FRONTMATTER_FENCE = \"---\"\n\nexport function provenanceMarker(): string {\n return `${MARKER_OPEN}${MARKER_NOTICE}${MARKER_CLOSE}`\n}\n\n/** Whether a line is a marker this CLI wrote, at any version and under any wording. */\nfunction isProvenanceMarker(line: string): boolean {\n return line.startsWith(MARKER_OPEN) && line.endsWith(MARKER_CLOSE)\n}\n\n/**\n * The index of the first body line: past the closing frontmatter fence when there is one,\n * and the top of the file when there is not — a template override may render no frontmatter,\n * and the marker still needs a defined home.\n */\nfunction bodyStartIndex(lines: readonly string[]): number {\n if (lines[0] !== FRONTMATTER_FENCE) return 0\n const closingFence = lines.indexOf(FRONTMATTER_FENCE, 1)\n if (closingFence === -1) return 0\n return closingFence + 1\n}\n\n/**\n * Whether this CLI compiled the agent file this content came from.\n *\n * The marker's POSITION is part of the claim: an agent that merely quotes the line further\n * down (a prompt about this very feature, say) is the user's, and a sweep reading that as\n * provenance would delete a file nothing here wrote.\n */\nexport function hasProvenanceMarker(content: string): boolean {\n const lines = content.split(\"\\n\")\n const firstBodyLine = lines[bodyStartIndex(lines)]\n return firstBodyLine !== undefined && isProvenanceMarker(firstBodyLine)\n}\n\n/**\n * The same content carrying exactly one provenance marker, on the first line after the\n * frontmatter.\n *\n * Idempotent by replacement rather than by insertion: content that already carries a marker\n * has that line rewritten rather than a second one stacked beside it. Since the marker's text\n * became constant that replacement is a no-op on anything this release wrote — but it is what\n * upgrades an agent stamped by a release that still spelled the version into the line.\n */\nexport function stampProvenanceMarker(content: string): string {\n const lines = content.split(\"\\n\")\n const bodyStart = bodyStartIndex(lines)\n const replacedLines = hasProvenanceMarker(content) ? 1 : 0\n\n return [\n ...lines.slice(0, bodyStart),\n provenanceMarker(),\n ...lines.slice(bodyStart + replacedLines),\n ].join(\"\\n\")\n}\n\n/** The template every compiled sub-agent is rendered from, by name rather than by path. */\nconst AGENT_TEMPLATE = \"agent\"\n\n/**\n * The deterministic completion gate every writing sub-agent stops against.\n *\n * A `SubagentStop` hook rather than a sentence in the prompt, because the two are different\n * kinds of claim: \"check your work before stopping\" is advice a model may decline to take, and\n * this is a process that runs whether it does or not. Exit 2 is the documented way to BLOCK the\n * stop, and the command's captured output goes to stderr, which is what Claude Code returns to\n * the sub-agent — so a failing typecheck comes back as the compiler's own output and the\n * agent iterates rather than reporting done.\n *\n * **Inert where it cannot be right.** A compiled agent is installed into someone else's\n * repository, and a gate that hard-blocks in a project with no npm — or no `typecheck` script —\n * would make every sub-agent unstoppable. So the first clause exits 0 unless there is both an\n * npm and a `package.json`, and `--if-present` exits 0 for a script the project does not\n * define. What is left is exactly the case the gate is for: a project that declares these\n * checks, failing one of them.\n *\n * **Typecheck only.** The gate runs the project's typecheck script; lint and test are\n * deliberately not in it. A type error means the work does not compile, which is the one\n * failure a stopping agent must not report as done. A lint finding or a failing test is the\n * project's own judgement to gate on, and a project that wants either declares its own `Stop`\n * hook — see {@link declaresOwnGate} — which replaces this one entirely rather than running\n * beside it.\n *\n * Composed for agents holding `Write` or `Edit` by {@link withCompletionGate}, which merges it\n * with whatever the agent declared rather than losing to it.\n */\nconst COMPLETION_GATE_COMMAND =\n \"command -v npm >/dev/null 2>&1 && [ -f package.json ] || exit 0; \" +\n \"out=$(npm run --if-present --silent typecheck 2>&1) \" +\n \"|| { printf '%s\\\\n' \\\"$out\\\" >&2; exit 2; }\"\n\n/** The tools whose presence makes an agent one the gate is for. */\nconst WRITING_TOOLS = [\"Write\", \"Edit\"]\n\n/**\n * The frontmatter spelling of the completion event, which is not the spelling that fires.\n *\n * Claude Code registers a sub-agent's frontmatter hooks through a function that walks its\n * event vocabulary and rewrites exactly one key — `Stop` becomes `SubagentStop`, logged as\n * \"Converting Stop hook to SubagentStop for agent X (subagents trigger SubagentStop)\". The\n * vocabulary contains `SubagentStop` verbatim, so EITHER spelling works when the agent is\n * invoked as a sub-agent.\n *\n * They diverge on the other path. An agent run as the main session through `--agent` has its\n * frontmatter hooks stored raw, with no such rewrite, and every dispatch looks the record up\n * by the event's own name — so a `SubagentStop` key is consulted only for an event a main\n * session never fires, while `Stop` fires natively. `Stop` is therefore correct in both modes\n * and `SubagentStop` in one, which is why this emits `Stop`.\n *\n * Read from the shipped binary at version 2.1.259 on 2026-09-03 rather than from published\n * documentation. Compiled agents written before that release carry `SubagentStop`; both are\n * live, and a reader seeing `Stop:` in frontmatter and `SubagentStop` in a log is seeing the\n * conversion rather than a mismatch.\n */\nconst GATE_EVENT = \"Stop\"\n\n/** The runtime spelling of {@link GATE_EVENT} — what a sub-agent's registration is rewritten to. */\nconst CONVERTED_GATE_EVENT = \"SubagentStop\"\n\n/**\n * The gate as its own hooks record — a fresh one per call.\n *\n * A factory rather than a const because the record is spread into an agent's own\n * hooks and the arrays inside it would otherwise be shared, by identity, with every\n * agent ever compiled in the process; `validResult()` in the CLI's\n * `lib/validation-result.ts` is the same shape for the same reason.\n */\nfunction completionGateHooks(): NonNullable<AgentConfig[\"hooks\"]> {\n return {\n [GATE_EVENT]: [\n { hooks: [{ type: \"command\", command: COMPLETION_GATE_COMMAND }] },\n ],\n }\n}\n\n/**\n * Whether the definition states a completion gate of its own, under either spelling.\n *\n * Both count, because the two ARE one event on the path a compiled agent is normally\n * invoked on — see {@link GATE_EVENT}. Keying only on `Stop` would emit this gate beside a\n * project's `SubagentStop`, and a sub-agent would then run both, which is the opposite of\n * the rule that a project's completion gate is its own to state. `SubagentStop` is also the\n * spelling every agent compiled before 2026-09-03 carries, so it is what a project that\n * copied its gate out of a compiled agent will have written.\n */\nfunction declaresOwnGate(hooks: AgentConfig[\"hooks\"]): boolean {\n if (hooks === undefined) return false\n const stated = [GATE_EVENT, CONVERTED_GATE_EVENT]\n return stated.some((event) => (hooks[event]?.length ?? 0) > 0)\n}\n\n/**\n * The same definition carrying the completion gate alongside whatever it declared.\n *\n * **Composition, not exclusion.** The template used to decide this with an\n * `{% if agent.hooks %}` / `{% elsif tools contains Write %}` pair, so an agent\n * declaring any hook at all — a `PostToolUse` formatter, say — silently lost the\n * completion gate, with nothing reporting it.\n *\n * Merged per EVENT: a declared completion gate replaces this one, because a project stating\n * its own is the rule this product has always documented; every other event is added beside\n * it. An agent holding neither `Write` nor `Edit` is returned unchanged, so the gate is still\n * emitted only where it can mean something.\n *\n * The gate is spread LAST rather than first, which matters only for the degenerate declaration\n * `Stop: []`. {@link declaresOwnGate} reads that as stating no gate, correctly — and spreading\n * the declared record over the gate would then let an empty array clobber it, emitting\n * `hooks: {\"Stop\":[]}` and losing the gate to a key that says nothing. Gate-last cannot lose to\n * a declaration this function has already established is not one.\n *\n * **Composed before the sanitiser, for a narrower reason than that ordering used to claim.** The\n * only value whose sanitisation depends on it is {@link COMPLETION_GATE_COMMAND}, a constant this\n * product authors. An author's own hooks are stripped under either order, because\n * {@link sanitizeCompiledAgentData} walks `agent.hooks` whether or not the gate has been composed\n * into them — measured by rendering a writing agent whose declared hook was poisoned in every\n * field, under both orders: one line of the two renders differed, and the marker in it was the\n * gate's own.\n *\n * Which is a rule nothing can hold, since no fixture can reach that constant. So it is structural\n * instead of remembered: this function is private, {@link prepareForRender} is the one expression\n * that composes with the sanitiser, and {@link renderAgent} has no order left to state.\n */\nfunction withCompletionGate(agent: AgentConfig): AgentConfig {\n const writes = WRITING_TOOLS.some((tool) => agent.tools.includes(tool))\n if (!writes || declaresOwnGate(agent.hooks)) return agent\n return { ...agent, hooks: { ...agent.hooks, ...completionGateHooks() } }\n}\n\n/**\n * The whole of what a render is handed: the completion gate composed into the\n * definition's own hooks, and every author-supplied string stripped of Liquid\n * syntax.\n *\n * The two steps have an order and this is the only expression allowed to state\n * it — written as one nested call rather than two statements, so getting it\n * wrong takes rewriting the expression rather than moving a line. That is worth\n * the indirection because the ordering is unfalsifiable: {@link withCompletionGate}\n * is the reason, and it explains which single value the order decides.\n */\nfunction prepareForRender(data: CompiledAgentData): CompiledAgentData {\n return sanitizeCompiledAgentData({\n ...data,\n agent: withCompletionGate(data.agent),\n })\n}\n\n/**\n * Renders the agent template and stamps the result with the provenance marker.\n *\n * Every compile entry point renders through here, so there is no path that writes a compiled\n * agent this CLI cannot later recognise as its own — which is what `uninstall` reads back\n * when the configuration naming the agents is gone. The stamp replaces rather than inserts,\n * so a template that emits the marker itself still produces exactly one.\n *\n * `version` is an argument because the CLI reads it from its own `package.json` and a browser\n * has no manifest to read; the editor passes `CORPUS_CLI_VERSION`, the release the corpus was\n * vendored at. It reaches the template as `generatorVersion` and renders inside the trailing\n * volatile block rather than into the provenance marker, so a release bump no longer rewrites\n * the first cacheable byte of every compiled agent.\n *\n * The completion gate is composed into the agent's own hooks before the render rather than\n * branched on in the template — see {@link prepareForRender} — so the template holds one\n * unconditional `hooks:` emission and the gate reaches `sanitizeHooks` like any other hook.\n */\nexport async function renderAgent(\n engine: Liquid,\n data: CompiledAgentData,\n version: string\n): Promise<string> {\n // Boundary cast: liquidjs types renderFile as `Promise<any>` because a template\n // can render to any value. The agent template renders a markdown file, and both\n // callers have declared `Promise<string>` since they were written.\n const rendered = (await engine.renderFile(AGENT_TEMPLATE, {\n ...prepareForRender(data),\n generatorVersion: sanitizeLiquidSyntax(version, \"generatorVersion\"),\n })) as string\n return stampProvenanceMarker(rendered)\n}\n","import path from \"path\";\nimport { directoryExists } from \"../../utils/fs\";\nimport { verbose } from \"../../utils/logger\";\nimport { PROJECT_ROOT, DIRS } from \"../../consts\";\nimport { fetchFromSource, type FetchOptions } from \"../loading\";\nimport { loadProjectSourceConfig } from \"../configuration\";\nimport type { AgentSourcePaths } from \"../../types\";\n\nexport async function getAgentDefinitions(remoteSource?: string): Promise<AgentSourcePaths> {\n if (remoteSource) {\n return fetchAgentDefinitionsFromRemote(remoteSource);\n }\n return getLocalAgentDefinitions();\n}\n\nexport async function getLocalAgentDefinitions(): Promise<AgentSourcePaths> {\n const agentsDir = path.join(PROJECT_ROOT, DIRS.agents);\n\n if (!(await directoryExists(agentsDir))) {\n throw new Error(\n `Agent partials not found at '${agentsDir}'. Ensure the CLI is properly installed.`,\n );\n }\n\n verbose(`Agent partials loaded from CLI: ${agentsDir}`);\n\n return {\n agentsDir,\n sourcePath: PROJECT_ROOT,\n };\n}\n\nexport async function fetchAgentDefinitionsFromRemote(\n source: string,\n options: FetchOptions & { agentsDir?: string } = {},\n): Promise<AgentSourcePaths> {\n verbose(`Fetching agent partials from remote: ${source}`);\n\n const result = await fetchFromSource(source, { subdir: \"\" });\n\n // ABORT on an unreadable config. It names the directory the fetched repository keeps its agent\n // partials in; defaulting past it compiles agents from whatever happens to sit at `DIRS.agents`,\n // or reports partials missing from a repository that has them.\n const sourceProjectConfig = options.agentsDir\n ? undefined\n : await loadProjectSourceConfig(result.path);\n if (sourceProjectConfig?.agentsDir) {\n verbose(`Using agentsDir from source config: ${sourceProjectConfig.agentsDir}`);\n }\n const agentsDirRelPath = options.agentsDir ?? sourceProjectConfig?.agentsDir ?? DIRS.agents;\n\n const agentsDir = path.join(result.path, agentsDirRelPath);\n\n if (!(await directoryExists(agentsDir))) {\n throw new Error(`Agent partials not found at '${agentsDir}'`);\n }\n\n verbose(`Agent partials fetched from: ${result.path}`);\n\n return {\n agentsDir,\n sourcePath: result.path,\n };\n}\n","import { partition } from \"remeda\";\nimport { writeCompiledAgentsByScope, type AgentWriteOutcome } from \"./write-compiled-agents\";\nimport { listCompiledAgentNames } from \"./list-compiled-agents\";\nimport path from \"path\";\n\nimport { getErrorMessage } from \"../../utils/errors\";\nimport type {\n AgentDefinition,\n AgentName,\n CompileAgentConfig,\n CompileConfig,\n ProjectConfig,\n SkillDefinitionMap,\n SkillScope,\n} from \"../../types\";\n\nimport { buildCompileAgents } from \"../installation/local-installer\";\nimport { ensureDir } from \"../../utils/fs\";\nimport { verbose } from \"../../utils/logger\";\nimport { typedEntries, typedFromEntries, typedKeys } from \"../../utils/typed-object\";\nimport { createLiquidEngine } from \"../compiler\";\nimport { loadProjectConfig, effectivelyExcludedSkillIds } from \"../configuration\";\nimport { loadAllAgents, loadProjectAgents } from \"../loading\";\nimport { getPluginAgentsDir } from \"../plugins\";\nimport { discoverAllPluginSkills } from \"../plugins/plugin-discovery\";\nimport { resolveAgents } from \"../resolver\";\n\nexport type RecompileAgentsOptions = {\n pluginDir: string;\n sourcePath: string;\n agents?: AgentName[];\n skills?: SkillDefinitionMap;\n projectDir?: string;\n outputDir?: string;\n /** When provided, routes agents by scope: global agents to ~/.claude/agents/, project agents to outputDir */\n agentScopeMap?: Map<AgentName, SkillScope>;\n};\n\nexport type RecompileAgentsResult = {\n compiled: AgentName[];\n /**\n * The subset of `compiled` whose file this pass actually wrote. `compiled` is\n * every agent that came through the pass with a correct file at the end of it;\n * `rewritten` is the ones whose content moved, so `compiled minus rewritten` is\n * the count a summary reports as unchanged.\n */\n rewritten: AgentName[];\n failed: AgentName[];\n warnings: string[];\n};\n\nasync function getExistingAgentNames(pluginDir: string): Promise<AgentName[]> {\n return listCompiledAgentNames(getPluginAgentsDir(pluginDir));\n}\n\ntype ResolveAgentNamesParams = {\n specifiedAgents?: AgentName[];\n projectConfig: ProjectConfig | null;\n allAgents: Partial<Record<AgentName, AgentDefinition>>;\n outputDir?: string;\n pluginDir: string;\n};\n\nasync function resolveAgentNames(params: ResolveAgentNamesParams): Promise<AgentName[]> {\n const { specifiedAgents, projectConfig, allAgents, outputDir, pluginDir } = params;\n\n if (specifiedAgents) {\n return specifiedAgents;\n }\n\n // A present config is authoritative over its agent roster — even when empty.\n // `agents: []` means \"no agents\", so it must NOT fall through to the\n // all-agents branch below; that branch exists only for the config-LESS case.\n if (projectConfig) {\n const agentNames = projectConfig.agents.map((a) => a.name);\n verbose(`Using agents from config: ${agentNames.join(\", \")}`);\n return agentNames;\n }\n\n if (outputDir) {\n const names = typedKeys<AgentName>(allAgents);\n verbose(`Using all available agents from source: ${names.join(\", \")}`);\n return names;\n }\n\n return getExistingAgentNames(pluginDir);\n}\n\n/** Splits write outcomes into the recompile result; logs each success at verbose level. */\nfunction buildRecompileResult(\n outcomes: AgentWriteOutcome[],\n priorWarnings: string[],\n): RecompileAgentsResult {\n const [succeeded, failedOutcomes] = partition(\n outcomes,\n (outcome): outcome is Extract<AgentWriteOutcome, { ok: true }> => outcome.ok,\n );\n succeeded.forEach((outcome) =>\n verbose(\n ` ${outcome.rewritten ? \"Rewrote\" : \"Unchanged\"}: ${outcome.name} (${outcome.scope} -> ${outcome.targetDir})`,\n ),\n );\n return {\n compiled: succeeded.map((outcome) => outcome.name),\n rewritten: succeeded.filter((outcome) => outcome.rewritten).map((outcome) => outcome.name),\n failed: failedOutcomes.map((outcome) => outcome.name),\n warnings: [\n ...priorWarnings,\n ...failedOutcomes.map(\n (outcome) => `Failed to compile ${outcome.name}: ${getErrorMessage(outcome.error)}`,\n ),\n ],\n };\n}\n\nexport function filterExcludedEntries(config: ProjectConfig): ProjectConfig {\n const excludedIds = effectivelyExcludedSkillIds(config.skills);\n const activeSkills = config.skills.filter((s) => !s.excluded);\n const activeAgents = config.agents.filter((a) => !a.excluded);\n\n // Also remove excluded skill refs from stack assignments. A config with no stack keeps\n // none — the key stays absent rather than becoming an explicit `undefined`.\n const filteredStack =\n config.stack === undefined\n ? {}\n : {\n stack: Object.fromEntries(\n typedEntries(config.stack).map(([agentName, agentStack]) => [\n agentName,\n Object.fromEntries(\n typedEntries(agentStack).map(([category, assignments]) => [\n category,\n assignments.filter((a) => !excludedIds.has(a.id)),\n ]),\n ),\n ]),\n ),\n };\n\n return { ...config, skills: activeSkills, agents: activeAgents, ...filteredStack };\n}\n\nexport async function recompileAgents(\n options: RecompileAgentsOptions,\n): Promise<RecompileAgentsResult> {\n const { pluginDir, sourcePath, skills: providedSkills, projectDir, outputDir } = options;\n\n const configDir = projectDir ?? pluginDir;\n const loadedConfig = await loadProjectConfig(configDir);\n const projectConfig = loadedConfig?.config ?? null;\n\n // Filter excluded entries once at the entry point — callees receive clean data\n const filteredConfig = projectConfig ? filterExcludedEntries(projectConfig) : null;\n\n const builtinAgents = await loadAllAgents(sourcePath);\n const projectAgents = projectDir ? await loadProjectAgents(projectDir) : {};\n\n // Priority: project agents > built-in agents\n const allAgents: Partial<Record<AgentName, AgentDefinition>> = {\n ...builtinAgents,\n ...projectAgents,\n };\n\n const agentNames = await resolveAgentNames({\n ...(options.agents !== undefined && { specifiedAgents: options.agents }),\n projectConfig: filteredConfig,\n allAgents,\n ...(outputDir !== undefined && { outputDir }),\n pluginDir,\n });\n\n if (agentNames.length === 0) {\n return { compiled: [], rewritten: [], failed: [], warnings: [\"No agents found to recompile\"] };\n }\n\n verbose(`Recompiling ${agentNames.length} agents in ${outputDir ?? pluginDir}`);\n\n // When skills are not provided, discover from all plugin directories.\n const pluginSkills: SkillDefinitionMap =\n providedSkills ?? (await discoverAllPluginSkills(projectDir ?? pluginDir));\n\n const allConfigAgents = filteredConfig ? buildCompileAgents(filteredConfig, allAgents) : {};\n\n // Restrict to only the agents we're compiling (agentNames).\n // buildCompileAgents returns entries for ALL agents in the config, but when\n // scopeFilter is active, we only want the agents matching that scope.\n // Without this filter, a project pass would compile global agents without\n // their stack (since the project config omits global agent stack entries)\n // and overwrite correctly compiled global agent files.\n const [knownAgents, missingAgents] = partition(agentNames, (name) =>\n Boolean(allConfigAgents[name] || allAgents[name]),\n );\n const missingWarnings = missingAgents.map(\n (name) => `Agent \"${name}\" not found in source definitions`,\n );\n const configAgents = typedFromEntries<AgentName, CompileAgentConfig>(\n knownAgents.map((name) => [name, allConfigAgents[name] ?? {}]),\n );\n\n const compileConfig: CompileConfig = {\n name: filteredConfig?.name || path.basename(pluginDir),\n description: filteredConfig?.description || \"Recompiled plugin\",\n agents: configAgents,\n };\n\n const engine = await createLiquidEngine(projectDir);\n const resolvedAgents = await resolveAgents(allAgents, pluginSkills, compileConfig, sourcePath);\n\n const agentsDir = outputDir ?? getPluginAgentsDir(pluginDir);\n await ensureDir(agentsDir);\n\n const outcomes = await writeCompiledAgentsByScope({\n resolvedAgents,\n sourcePath,\n engine,\n projectAgentsDir: agentsDir,\n ...(options.agentScopeMap !== undefined && { agentScopeMap: options.agentScopeMap }),\n });\n return buildRecompileResult(outcomes, missingWarnings);\n}\n","import os from \"os\";\nimport path from \"path\";\nimport type { Liquid } from \"liquidjs\";\nimport { compileAgentForPlugin } from \"../compiler.js\";\nimport { resolveInstallPaths } from \"../installation/install-base-dir.js\";\nimport { writeFile, fileExists, readFile } from \"../../utils/fs.js\";\nimport { typedEntries } from \"../../utils/typed-object.js\";\nimport type { AgentConfig, AgentName, SkillScope } from \"../../types/index.js\";\n\nexport type AgentWriteOutcome =\n | {\n name: AgentName;\n ok: true;\n scope: SkillScope;\n targetDir: string;\n /**\n * Whether this pass actually wrote the file. False means the compiled output\n * matched what was already on disk, so nothing was written — which is what\n * lets a recompile summary tell a real one from a no-op instead of counting\n * the roster it walked.\n */\n rewritten: boolean;\n }\n | { name: AgentName; ok: false; error: unknown };\n\n/**\n * Whether the target already holds exactly this content, making a write a no-op.\n *\n * Skipping that write is what gives \"unchanged\" a meaning a caller can check: an\n * agent reported unchanged keeps its mtime, and an mtime is the only trace a\n * rewrite-with-identical-bytes leaves anywhere.\n */\nasync function holdsExactly(filePath: string, content: string): Promise<boolean> {\n return (await fileExists(filePath)) && (await readFile(filePath)) === content;\n}\n\n/**\n * Where an agent goes when `agentScopeMap` has nothing to say about it — either because the caller\n * passed no map at all (`agents-inc update` recompiles that way) or because this agent is not in\n * the one it passed (a hand-authored agent under `.claude/agents/` has no config row).\n *\n * This is a ROUTING answer, not a selection default: `\"project\"` here means \"the directory the\n * caller named in `projectAgentsDir`\", which for an unrouted write is the only defensible target.\n * It is deliberately NOT `DEFAULT_SELECTION_OPTIONS.scope` from `@workspace/matrix` — that constant\n * says what an untouched *pick* installs as, and adopting it here would relocate the agents of every\n * caller that never asked for global routing into the user's `~/.claude/agents`.\n */\nconst UNROUTED_AGENT_SCOPE: SkillScope = \"project\";\n\n/**\n * Compiles each resolved agent and writes it to its scope's agents directory:\n * global agents to `~/.claude/agents/`, project agents to `projectAgentsDir`.\n * Per-agent failures are collected as outcomes — callers own the policy\n * (recompile reports and continues; install hard-errors).\n *\n * Neither directory is created up front. `writeFile` makes a target's parent on\n * the way past, so a directory appears exactly when an agent routes into it —\n * which is what keeps a wholly project-scoped pass from leaving an empty\n * `~/.claude/agents/` behind in a home that has no global install.\n */\nexport async function writeCompiledAgentsByScope(params: {\n resolvedAgents: Partial<Record<AgentName, AgentConfig>>;\n sourcePath: string;\n engine: Liquid;\n projectAgentsDir: string;\n agentScopeMap?: Map<AgentName, SkillScope>;\n}): Promise<AgentWriteOutcome[]> {\n const globalAgentsDir = resolveInstallPaths(os.homedir(), \"global\").agentsDir;\n\n const outcomes: AgentWriteOutcome[] = [];\n for (const [name, agent] of typedEntries<AgentName, AgentConfig>(params.resolvedAgents)) {\n try {\n const output = await compileAgentForPlugin(name, agent, params.sourcePath, params.engine);\n const scope = params.agentScopeMap?.get(name) ?? UNROUTED_AGENT_SCOPE;\n const targetDir = scope === \"global\" ? globalAgentsDir : params.projectAgentsDir;\n const targetPath = path.join(targetDir, `${name}.md`);\n const rewritten = !(await holdsExactly(targetPath, output));\n if (rewritten) await writeFile(targetPath, output);\n outcomes.push({ name, ok: true, scope, targetDir, rewritten });\n } catch (error) {\n outcomes.push({ name, ok: false, error });\n }\n }\n return outcomes;\n}\n","import { Liquid } from \"liquidjs\";\nimport path from \"path\";\nimport {\n buildAgentTemplateContext,\n pluginRefFor,\n renderAgent,\n type AgentFiles,\n} from \"@workspace/compile/agent-source\";\nimport { readFile, readFileOptional, directoryExists } from \"../utils/fs\";\nimport { verbose } from \"../utils/logger\";\nimport {\n CLAUDE_DIR,\n CLAUDE_SRC_DIR,\n DIRS,\n PROJECT_ROOT,\n STANDARD_FILES,\n STANDARD_DIRS,\n} from \"../consts\";\nimport { cliVersion } from \"./agents/agent-provenance\";\nimport \"./compile-seat.js\";\nimport type { AgentConfig, AgentName } from \"../types\";\n\n/**\n * What survives here is the half of a compile that reads the machine: the five `readFile`s that\n * fetch an agent's partials off disk, and the layered template roots a project can override. The\n * rendering itself — the template context, the injection sanitiser and the provenance stamp — is\n * `@workspace/compile/agent-source`, so the editor's output preview draws the bytes this writes\n * rather than a second implementation of them.\n */\nexport {\n buildAgentTemplateContext,\n sanitizeCompiledAgentData,\n sanitizeLiquidSyntax,\n} from \"@workspace/compile/agent-source\";\n\nasync function readAgentFiles(\n name: AgentName,\n agent: AgentConfig,\n projectRoot: string,\n): Promise<AgentFiles> {\n const agentSourceRoot = agent.sourceRoot || projectRoot;\n const agentBaseDir = agent.agentBaseDir || DIRS.agents;\n const agentDir = path.join(agentSourceRoot, agentBaseDir, agent.path || name);\n\n const identity = await readFile(path.join(agentDir, STANDARD_FILES.IDENTITY_MD));\n const playbook = await readFile(path.join(agentDir, STANDARD_FILES.PLAYBOOK_MD));\n const criticalRequirementsTop = await readFileOptional(\n path.join(agentDir, STANDARD_FILES.CRITICAL_REQUIREMENTS_MD),\n \"\",\n );\n const criticalReminders = await readFileOptional(\n path.join(agentDir, STANDARD_FILES.CRITICAL_REMINDERS_MD),\n \"\",\n );\n\n const agentPath = agent.path || name;\n const parts = agentPath.split(\"/\");\n const category = parts[0] || name;\n const categoryDir = path.join(agentSourceRoot, agentBaseDir, category);\n\n let output = await readFileOptional(path.join(agentDir, STANDARD_FILES.OUTPUT_MD), \"\");\n if (!output) {\n output = await readFileOptional(path.join(categoryDir, STANDARD_FILES.OUTPUT_MD), \"\");\n }\n\n return { identity, playbook, output, criticalRequirementsTop, criticalReminders };\n}\n\n/**\n * Creates a Liquid template engine with a layered template root hierarchy.\n *\n * Template resolution order (first match wins):\n * 1. Project-local templates: `{projectDir}/.claude-src/agents/_templates/`\n * 2. Legacy templates: `{projectDir}/.claude/templates/`\n * 3. Built-in templates: `{PROJECT_ROOT}/src/agents/_templates/`\n *\n * The browser-side twin is `createEngineFromTemplates` in `@workspace/compile/engine`, which\n * builds the same engine over the vendored corpus instead of over directories. Every option\n * below is duplicated there, because a render that resolved filters or variables differently\n * would produce a different file from the same data.\n *\n * @param projectDir - Optional project directory for local template overrides\n * @returns Configured Liquid engine with `.liquid` extension and strict filters\n */\nexport async function createLiquidEngine(projectDir?: string): Promise<Liquid> {\n const roots: string[] = [];\n\n if (projectDir) {\n const srcTemplatesDir = path.join(\n projectDir,\n CLAUDE_SRC_DIR,\n STANDARD_DIRS.AGENTS,\n path.basename(DIRS.templates),\n );\n if (await directoryExists(srcTemplatesDir)) {\n roots.push(srcTemplatesDir);\n verbose(`Using local templates from: ${srcTemplatesDir}`);\n }\n\n const legacyTemplatesDir = path.join(projectDir, CLAUDE_DIR, STANDARD_DIRS.TEMPLATES);\n if (await directoryExists(legacyTemplatesDir)) {\n roots.push(legacyTemplatesDir);\n verbose(`Using legacy templates from: ${legacyTemplatesDir}`);\n }\n }\n\n roots.push(path.join(PROJECT_ROOT, DIRS.templates));\n\n return new Liquid({\n root: roots,\n extname: \".liquid\",\n strictVariables: false,\n strictFilters: true,\n });\n}\n\nexport async function compileAgentForPlugin(\n name: AgentName,\n agent: AgentConfig,\n fallbackRoot: string,\n engine: Liquid,\n): Promise<string> {\n verbose(`Compiling agent: ${name}`);\n\n const files = await readAgentFiles(name, agent, fallbackRoot);\n\n // Per-skill pluginRef attachment. Each skill's own `source` decides\n // whether it renders as `${id}:${id}` (plugin-installed) or bare id (ejected).\n // This correctly handles mixed-mode agents where some skills are plugin and\n // others are ejected. Missing `source` (user-authored local skills with no\n // SkillConfig entry) falls through to bare id — the expected case, not a\n // silent fallback.\n const data = buildAgentTemplateContext(name, agent, files, (skill) => ({\n ...skill,\n ...pluginRefFor(skill),\n }));\n\n return renderAgent(engine, data, await cliVersion());\n}\n","import path from \"path\";\nimport { getErrorMessage } from \"../../utils/errors\";\nimport { readFile, ensureDir, copy } from \"../../utils/fs\";\nimport { log, verbose, warn } from \"../../utils/logger\";\nimport {\n generateAgentPluginManifest,\n writePluginManifest,\n getPluginManifestPath,\n} from \"../plugins\";\nimport { listAgentMdFiles } from \"./list-compiled-agents\";\nimport { computeStringHash, determinePluginVersion, writeContentHash } from \"../versioning\";\nimport { extractFrontmatter } from \"../../utils/frontmatter\";\nimport type { AgentFrontmatter, PluginManifest } from \"../../types\";\nimport { agentFrontmatterValidationSchema, formatZodIssues } from \"../schemas\";\n\nexport type AgentPluginOptions = {\n agentPath: string;\n outputDir: string;\n};\n\nexport type CompiledAgentPlugin = {\n pluginPath: string;\n manifest: PluginManifest;\n agentName: string;\n};\n\n/**\n * The frontmatter a plugin build needs, or the reason it could not be had.\n *\n * The reason is carried out rather than discarded because the throw in\n * {@link compileAgentPlugin} is the only thing a `build` run surfaces for a failed agent, and it\n * used to name `name` and `description` whatever had actually gone wrong — so an agent rejected\n * for an unknown key or a bad enum value was reported as missing two fields it declared correctly.\n *\n * Nothing is warned here, deliberately. This function is private and has one caller, which throws\n * on every failure, and {@link compileAllAgentPlugins} catches that throw and warns the message —\n * so a warning here would print the same cause twice. The shared `parseFrontmatter` on the skill\n * side keeps its own warn for the opposite reason: most of its callers skip rather than throw.\n */\ntype AgentFrontmatterParse =\n | { ok: true; frontmatter: Pick<AgentFrontmatter, \"name\" | \"description\"> }\n | { ok: false; reason: string };\n\n/** The reason when there is no frontmatter block at all, as opposed to one the schema refused. */\nconst NO_FRONTMATTER_REASON = \"no YAML frontmatter block\";\n\nfunction parseAgentFrontmatter(content: string): AgentFrontmatterParse {\n const raw = extractFrontmatter(content);\n if (!raw) {\n return { ok: false, reason: NO_FRONTMATTER_REASON };\n }\n\n const result = agentFrontmatterValidationSchema.safeParse(raw);\n if (!result.success) {\n return { ok: false, reason: formatZodIssues(result.error.issues) };\n }\n\n return {\n ok: true,\n frontmatter: { name: result.data.name, description: result.data.description },\n };\n}\n\nexport async function compileAgentPlugin(\n options: AgentPluginOptions,\n): Promise<CompiledAgentPlugin> {\n const { agentPath, outputDir } = options;\n const fileName = path.basename(agentPath);\n\n const content = await readFile(agentPath);\n const parsed = parseAgentFrontmatter(content);\n\n if (!parsed.ok) {\n throw new Error(\n `Agent '${fileName}' has invalid or missing YAML frontmatter: ${parsed.reason}. ` +\n `File: ${agentPath}`,\n );\n }\n\n const agentName = parsed.frontmatter.name;\n\n verbose(`Compiling agent plugin: ${agentName} from ${agentPath}`);\n\n const pluginDir = path.join(outputDir, `agent-${agentName}`);\n const agentsDir = path.join(pluginDir, \"agents\");\n\n await ensureDir(pluginDir);\n await ensureDir(agentsDir);\n\n const newHash = computeStringHash(content);\n const { version, contentHash } = await determinePluginVersion(\n newHash,\n pluginDir,\n getPluginManifestPath,\n );\n\n const manifest = generateAgentPluginManifest({\n agentName,\n description: parsed.frontmatter.description,\n version,\n });\n\n await writePluginManifest(pluginDir, manifest);\n\n await writeContentHash(pluginDir, contentHash, getPluginManifestPath);\n\n verbose(` Wrote plugin.json for ${agentName} (v${version})`);\n\n await copy(agentPath, path.join(agentsDir, `${agentName}.md`));\n verbose(` Copied agent ${fileName} -> agents/${agentName}.md`);\n\n return {\n pluginPath: pluginDir,\n manifest,\n agentName,\n };\n}\n\nexport async function compileAllAgentPlugins(\n agentsDir: string,\n outputDir: string,\n): Promise<CompiledAgentPlugin[]> {\n const results: CompiledAgentPlugin[] = [];\n\n const agentMdFiles = await listAgentMdFiles(agentsDir);\n\n for (const agentFile of agentMdFiles) {\n const agentPath = path.join(agentsDir, agentFile);\n\n try {\n const result = await compileAgentPlugin({\n agentPath,\n outputDir,\n });\n results.push(result);\n log(` [OK] agent-${result.agentName}`);\n } catch (error) {\n const errorMessage = getErrorMessage(error);\n warn(`Failed to compile agent from '${agentFile}': ${errorMessage}`);\n }\n }\n\n return results;\n}\n\nexport function printAgentCompilationSummary(results: CompiledAgentPlugin[]): void {\n log(`\\nCompiled ${results.length} agent plugins:`);\n for (const result of results) {\n log(` - agent-${result.agentName} (v${result.manifest.version})`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,WAAU;AACjB,SAAS,iBAAiB;;;ACD1B,OAAO,UAAU;AACjB,SAAS,SAAS;;;ACoBlB,IAAM,wBAAwB;AAUvB,SAAS,qBACd,OACA,WACG;AACH,MAAI,CAAC,sBAAsB,KAAK,KAAK,EAAG,QAAO;AAC/C,wBAAsB,YAAY;AACl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ChC;AAAA,EACF,CAAC;AAED,QAAM,oBAAoB,WAAW,QAAQ;AAE7C,QAAM,iBAAiB,WAAW,aAAa,qBAAqB;AAEpE,UAAQ,2BAA2BA,UAAS,MAAM,OAAO,GAAG;AAE5D,QAAM,KAAK,WAAWD,MAAK,KAAK,WAAW,GAAGC,UAAS,KAAK,CAAC;AAC7D,UAAQ,kBAAkB,QAAQ,cAAcA,UAAS,KAAK;AAE9D,SAAO;AAAA,IACL,YAAY;AAAA,IACZ;AAAA,IACA,WAAAA;AAAA,EACF;AACF;AAEA,eAAsB,uBACpB,WACA,WACgC;AAChC,QAAM,UAAiC,CAAC;AAExC,QAAM,eAAe,MAAM,iBAAiB,SAAS;AAErD,aAAW,aAAa,cAAc;AACpC,UAAM,YAAYD,MAAK,KAAK,WAAW,SAAS;AAEhD,QAAI;AACF,YAAM,SAAS,MAAM,mBAAmB;AAAA,QACtC;AAAA,QACA;AAAA,MACF,CAAC;AACD,cAAQ,KAAK,MAAM;AACnB,UAAI,gBAAgB,OAAO,SAAS,EAAE;AAAA,IACxC,SAAS,OAAO;AACd,YAAM,eAAe,gBAAgB,KAAK;AAC1C,WAAK,iCAAiC,SAAS,MAAM,YAAY,EAAE;AAAA,IACrE;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,6BAA6B,SAAsC;AACjF,MAAI;AAAA,WAAc,QAAQ,MAAM,iBAAiB;AACjD,aAAW,UAAU,SAAS;AAC5B,QAAI,aAAa,OAAO,SAAS,MAAM,OAAO,SAAS,OAAO,GAAG;AAAA,EACnE;AACF;","names":["path","path","path","path","partition","path","path","path","path","path","partition","agentName","path","path","path","agentName"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
MIN_TERMINAL_SIZE
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UITEKY2R.js";
|
|
5
5
|
|
|
6
6
|
// src/cli/utils/terminal.ts
|
|
7
7
|
function clearTerminalScreen() {
|
|
@@ -20,4 +20,4 @@ export {
|
|
|
20
20
|
isTerminalLargeEnough,
|
|
21
21
|
formatTerminalTooSmallMessage
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-PHCPUQVR.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
compileAgents
|
|
4
|
-
|
|
3
|
+
compileAgents,
|
|
4
|
+
withCatalogueSeatedFor
|
|
5
|
+
} from "./chunk-IAVEMTN4.js";
|
|
5
6
|
import {
|
|
6
7
|
loadAgentDefs
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SMSB6YZW.js";
|
|
8
9
|
import {
|
|
9
10
|
ConfigLoadError,
|
|
10
11
|
GlobalPairWriteViolation,
|
|
@@ -48,12 +49,12 @@ import {
|
|
|
48
49
|
verbose,
|
|
49
50
|
withGateToken,
|
|
50
51
|
writeFile
|
|
51
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-XPDVAJDH.js";
|
|
52
53
|
import {
|
|
53
54
|
matrix,
|
|
54
55
|
typedEntries,
|
|
55
56
|
typedKeys
|
|
56
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-AVK2HEKB.js";
|
|
57
58
|
import {
|
|
58
59
|
CLAUDE_SRC_DIR,
|
|
59
60
|
CLI_INVOKE_COMMAND,
|
|
@@ -66,7 +67,7 @@ import {
|
|
|
66
67
|
isActiveAt,
|
|
67
68
|
isExclusiveCategory,
|
|
68
69
|
isGlobalTombstone
|
|
69
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-UITEKY2R.js";
|
|
70
71
|
|
|
71
72
|
// src/cli/lib/operations/source/load-source.ts
|
|
72
73
|
async function loadSource(options) {
|
|
@@ -800,7 +801,32 @@ function inlinedProjectView(reconciledSplit, effectiveGlobal) {
|
|
|
800
801
|
stack: { ...effectiveGlobal.stack ?? {}, ...reconciledSplit.stack ?? {} }
|
|
801
802
|
};
|
|
802
803
|
}
|
|
803
|
-
|
|
804
|
+
function reconcileAgainstGlobal(onDisk, globalConfig, matrix2) {
|
|
805
|
+
const removedGlobalSkillIds = computeRemovedGlobalSkillIds(onDisk.skills, globalConfig);
|
|
806
|
+
const reconciledStack = retainReconciledStack(onDisk.stack, removedGlobalSkillIds);
|
|
807
|
+
return reconcileProjectSplitAgainstGlobal(
|
|
808
|
+
{
|
|
809
|
+
...onDisk,
|
|
810
|
+
skills: retainProjectOwnedSkills(onDisk.skills, globalConfig),
|
|
811
|
+
agents: retainProjectOwnedAgents(onDisk.agents, globalConfig),
|
|
812
|
+
...reconciledStack !== void 0 && { stack: reconciledStack }
|
|
813
|
+
},
|
|
814
|
+
globalConfig,
|
|
815
|
+
matrix2
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
async function propagateToProject(projectPath, globalConfig, agents, options) {
|
|
819
|
+
return withCatalogueSeatedFor(projectPath, async (catalogue) => {
|
|
820
|
+
const existingProject = await loadProjectConfigFromDir(projectPath);
|
|
821
|
+
if (!existingProject?.config) return false;
|
|
822
|
+
const projectSplit = reconcileAgainstGlobal(existingProject.config, globalConfig, catalogue);
|
|
823
|
+
await writeProjectConfigPair(projectPath, projectSplit, globalConfig, catalogue, agents, {
|
|
824
|
+
regenerateTypes: options.regenerateTypes ?? true
|
|
825
|
+
});
|
|
826
|
+
return true;
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
async function propagateGlobalChangesToProjects(globalConfig, agents, currentProjectDir, options = {}) {
|
|
804
830
|
const projects = globalConfig.projects ?? [];
|
|
805
831
|
if (projects.length === 0) return { updated: [], skipped: [] };
|
|
806
832
|
const currentNormalized = currentProjectDir ? normalizeProjectPath(currentProjectDir) : null;
|
|
@@ -815,33 +841,12 @@ async function propagateGlobalChangesToProjects(globalConfig, matrix2, agents, c
|
|
|
815
841
|
continue;
|
|
816
842
|
}
|
|
817
843
|
try {
|
|
818
|
-
|
|
819
|
-
|
|
844
|
+
if (await propagateToProject(projectPath, globalConfig, agents, options)) {
|
|
845
|
+
updated.push(projectPath);
|
|
846
|
+
verbose(`Propagated global changes to ${projectPath}`);
|
|
847
|
+
} else {
|
|
820
848
|
skipped.push(projectPath);
|
|
821
|
-
continue;
|
|
822
849
|
}
|
|
823
|
-
const projectConfig = existingProject.config;
|
|
824
|
-
const removedGlobalSkillIds = computeRemovedGlobalSkillIds(
|
|
825
|
-
projectConfig.skills,
|
|
826
|
-
globalConfig
|
|
827
|
-
);
|
|
828
|
-
const retained = retainReconciledStack(projectConfig.stack, removedGlobalSkillIds);
|
|
829
|
-
const reconciledStack = retained === void 0 ? {} : { stack: retained };
|
|
830
|
-
const projectSplit = reconcileProjectSplitAgainstGlobal(
|
|
831
|
-
{
|
|
832
|
-
...projectConfig,
|
|
833
|
-
skills: retainProjectOwnedSkills(projectConfig.skills, globalConfig),
|
|
834
|
-
agents: retainProjectOwnedAgents(projectConfig.agents, globalConfig),
|
|
835
|
-
...reconciledStack
|
|
836
|
-
},
|
|
837
|
-
globalConfig,
|
|
838
|
-
matrix2
|
|
839
|
-
);
|
|
840
|
-
await writeProjectConfigPair(projectPath, projectSplit, globalConfig, matrix2, agents, {
|
|
841
|
-
regenerateTypes: options.regenerateTypes ?? true
|
|
842
|
-
});
|
|
843
|
-
updated.push(projectPath);
|
|
844
|
-
verbose(`Propagated global changes to ${projectPath}`);
|
|
845
850
|
} catch (error) {
|
|
846
851
|
skipped.push(projectPath);
|
|
847
852
|
verbose(`Failed to propagate to ${projectPath}: ${getErrorMessage(error)}`);
|
|
@@ -849,13 +854,13 @@ async function propagateGlobalChangesToProjects(globalConfig, matrix2, agents, c
|
|
|
849
854
|
}
|
|
850
855
|
return { updated, skipped };
|
|
851
856
|
}
|
|
852
|
-
async function pruneGlobalEntriesFromRegisteredProjects(globalConfig,
|
|
857
|
+
async function pruneGlobalEntriesFromRegisteredProjects(globalConfig, agents) {
|
|
853
858
|
const emptiedGlobal = {
|
|
854
859
|
...globalConfig,
|
|
855
860
|
skills: [],
|
|
856
861
|
agents: []
|
|
857
862
|
};
|
|
858
|
-
return propagateGlobalChangesToProjects(emptiedGlobal,
|
|
863
|
+
return propagateGlobalChangesToProjects(emptiedGlobal, agents);
|
|
859
864
|
}
|
|
860
865
|
async function resolveEffectiveGlobalConfig(globalSplit, existingGlobalConfig, projectDir, authority) {
|
|
861
866
|
const merged = authority === "all" ? matchGlobalToSession(globalSplit, existingGlobalConfig) : addSessionToGlobal(globalSplit, existingGlobalConfig);
|
|
@@ -1089,7 +1094,7 @@ var NOTHING_RECOMPILED = {
|
|
|
1089
1094
|
};
|
|
1090
1095
|
async function recompilePropagated(projectDirs) {
|
|
1091
1096
|
if (projectDirs.length === 0) return NOTHING_RECOMPILED;
|
|
1092
|
-
const { recompilePropagatedProjectAgents: recompilePropagatedProjectAgents2 } = await import("./recompile-project-agents-
|
|
1097
|
+
const { recompilePropagatedProjectAgents: recompilePropagatedProjectAgents2 } = await import("./recompile-project-agents-FCJLHAE3.js");
|
|
1093
1098
|
return recompilePropagatedProjectAgents2(projectDirs);
|
|
1094
1099
|
}
|
|
1095
1100
|
|
|
@@ -1105,7 +1110,6 @@ async function applyConsequences(globalConfig, changes, deps, currentProjectDir)
|
|
|
1105
1110
|
}
|
|
1106
1111
|
const propagated = await propagateGlobalChangesToProjects(
|
|
1107
1112
|
globalConfig,
|
|
1108
|
-
deps.matrix,
|
|
1109
1113
|
deps.agents,
|
|
1110
1114
|
currentProjectDir,
|
|
1111
1115
|
{ regenerateTypes: tierRegeneratesTypes(tier) }
|
|
@@ -1119,7 +1123,7 @@ async function applyConsequences(globalConfig, changes, deps, currentProjectDir)
|
|
|
1119
1123
|
function lazyGateDeps(projectDir) {
|
|
1120
1124
|
return {
|
|
1121
1125
|
loadMatrix: async () => {
|
|
1122
|
-
const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-
|
|
1126
|
+
const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-GRBVNRAW.js");
|
|
1123
1127
|
const { matrix: matrix2 } = await loadSkillsMatrixFromSource2({
|
|
1124
1128
|
projectDir,
|
|
1125
1129
|
skipExtraSources: true,
|
|
@@ -1128,7 +1132,7 @@ function lazyGateDeps(projectDir) {
|
|
|
1128
1132
|
return matrix2;
|
|
1129
1133
|
},
|
|
1130
1134
|
loadAgents: async () => {
|
|
1131
|
-
const { loadAgentDefs: loadAgentDefs2 } = await import("./load-agent-defs-
|
|
1135
|
+
const { loadAgentDefs: loadAgentDefs2 } = await import("./load-agent-defs-5J2MZLAA.js");
|
|
1132
1136
|
return (await loadAgentDefs2()).agents;
|
|
1133
1137
|
}
|
|
1134
1138
|
};
|
|
@@ -1225,7 +1229,6 @@ async function reconcileTypesFromDisk(projectDir, config, deps, options) {
|
|
|
1225
1229
|
if (!config.projects?.length) return report(globalWritten, changes);
|
|
1226
1230
|
const propagated = await propagateGlobalChangesToProjects(
|
|
1227
1231
|
config,
|
|
1228
|
-
deps.matrix,
|
|
1229
1232
|
deps.agents,
|
|
1230
1233
|
options?.currentProjectDir
|
|
1231
1234
|
);
|
|
@@ -1310,7 +1313,6 @@ async function propagateGlobalRemoval(preRemovalGlobalConfig, deps) {
|
|
|
1310
1313
|
});
|
|
1311
1314
|
const propagated = await pruneGlobalEntriesFromRegisteredProjects(
|
|
1312
1315
|
preRemovalGlobalConfig,
|
|
1313
|
-
deps.matrix,
|
|
1314
1316
|
deps.agents
|
|
1315
1317
|
);
|
|
1316
1318
|
const recompile = await recompilePropagated(propagated.updated);
|
|
@@ -1434,4 +1436,4 @@ export {
|
|
|
1434
1436
|
writeProjectConfig,
|
|
1435
1437
|
compileAgentsAllScopes
|
|
1436
1438
|
};
|
|
1437
|
-
//# sourceMappingURL=chunk-
|
|
1439
|
+
//# sourceMappingURL=chunk-PM3374E7.js.map
|