@a-company/paradigm 5.10.0 → 5.21.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/dist/accept-orchestration-IUAWQZUN.js +18 -0
- package/dist/add-P76GEMGF.js +8 -0
- package/dist/agent-UUTYOFTH.js +33 -0
- package/dist/agent-loader-EPXURMO7.js +2 -0
- package/dist/agent-loader-PYGPX6D2.js +2 -0
- package/dist/agent-state-KSQ3S7OB.js +2 -0
- package/dist/agents-suggest-HYTFMQD3.js +10 -0
- package/dist/aggregate-W66DM3GA.js +10 -0
- package/dist/ambient-HYZR42NX.js +35 -0
- package/dist/assess-UFPYEJKP.js +9 -0
- package/dist/auto-RHJXOZFL.js +14 -0
- package/dist/beacon-5QVYV5DF.js +13 -0
- package/dist/calibration-OLJYB5HN.js +7 -0
- package/dist/check-THVGY4R5.js +14 -0
- package/dist/chunk-22ISTMKI.js +31 -0
- package/dist/chunk-2QO33NYK.js +3 -0
- package/dist/chunk-33LKBMVK.js +134 -0
- package/dist/chunk-4QADCWPU.js +7 -0
- package/dist/chunk-4TXOVRWD.js +3 -0
- package/dist/chunk-4UJ4NIEQ.js +4 -0
- package/dist/chunk-4ZGGWZ32.js +3 -0
- package/dist/chunk-5TAVYPOV.js +2 -0
- package/dist/chunk-6EX37L4Q.js +8 -0
- package/dist/chunk-AD5TAD2A.js +5 -0
- package/dist/chunk-AGVAHVUA.js +2 -0
- package/dist/chunk-AO7ZSRME.js +13 -0
- package/dist/chunk-BFD3GFRK.js +2 -0
- package/dist/chunk-D34YFK4M.js +6 -0
- package/dist/chunk-DVZWCXB6.js +2 -0
- package/dist/chunk-EKZDFEJW.js +2 -0
- package/dist/chunk-ET5XJTSX.js +2 -0
- package/dist/chunk-FYDRENK7.js +3 -0
- package/dist/chunk-HMQ5BHP2.js +743 -0
- package/dist/chunk-HXKWL3VK.js +29 -0
- package/dist/chunk-IZSBGW6E.js +2 -0
- package/dist/chunk-J32OPJEX.js +2 -0
- package/dist/chunk-JBDMCRPP.js +7 -0
- package/dist/chunk-JIXHEBGK.js +7 -0
- package/dist/chunk-JNSJVCTU.js +2 -0
- package/dist/chunk-JQKKVAAN.js +2 -0
- package/dist/chunk-KLBH26PA.js +429 -0
- package/dist/chunk-L6K5HNDL.js +24 -0
- package/dist/chunk-LKAT7IAK.js +2 -0
- package/dist/chunk-M4UMM6DC.js +5 -0
- package/dist/chunk-NKYNHSA5.js +424 -0
- package/dist/chunk-NW6OKHE6.js +5 -0
- package/dist/chunk-NXRVR37G.js +60 -0
- package/dist/chunk-ODVKPZZ4.js +2 -0
- package/dist/chunk-PUBB7LIT.js +5 -0
- package/dist/chunk-Q2J542ST.js +2 -0
- package/dist/chunk-QGZRM6ZB.js +2 -0
- package/dist/chunk-QNZEG7IT.js +13 -0
- package/dist/chunk-QT2LKB3P.js +7 -0
- package/dist/chunk-RVRARWSY.js +9 -0
- package/dist/chunk-T6IDXUUA.js +2 -0
- package/dist/chunk-TYWB5IQJ.js +3 -0
- package/dist/chunk-UIKLE3WD.js +2 -0
- package/dist/chunk-V7K6CQVX.js +111 -0
- package/dist/chunk-VCKKJDLP.js +8 -0
- package/dist/chunk-VG7FN2TU.js +4 -0
- package/dist/chunk-W5IWDW4Y.js +16 -0
- package/dist/chunk-W7C6FFMO.js +8 -0
- package/dist/chunk-WESTEMIM.js +10 -0
- package/dist/chunk-WR6D3SC6.js +5 -0
- package/dist/chunk-WS2N27RX.js +3 -0
- package/dist/chunk-XMAV5AG6.js +2 -0
- package/dist/chunk-XROULIQN.js +2 -0
- package/dist/chunk-XUFYOXOU.js +3 -0
- package/dist/chunk-Y4XFVDZC.js +3 -0
- package/dist/chunk-Y6KXTQBG.js +2 -0
- package/dist/{chunk-GTR2TBIJ.js → chunk-Z2UZUCY6.js} +237 -1047
- package/dist/chunk-Z34K6GY2.js +8 -0
- package/dist/claude-4LR3LJQZ.js +13 -0
- package/dist/claude-cli-UP6HGH7C.js +6 -0
- package/dist/claude-code-RLJ4GX77.js +11 -0
- package/dist/claude-code-teams-R37HJY3Y.js +29 -0
- package/dist/commands-LMUD5L6R.js +455 -0
- package/dist/compliance-GZ7UAOG3.js +6 -0
- package/dist/conductor-Y5IXELTL.js +4 -0
- package/dist/config-schema-HR7LDEQ6.js +2 -0
- package/dist/constellation-CG7C4WFE.js +13 -0
- package/dist/context-audit-RSSRX6XC.js +6 -0
- package/dist/cost-IDNVMAEV.js +10 -0
- package/dist/cost-PK4KIF7R.js +2 -0
- package/dist/cursor-cli-QKF7Z6M2.js +4 -0
- package/dist/cursorrules-U5O4G5T4.js +14 -0
- package/dist/decision-loader-2XPZE4EZ.js +2 -0
- package/dist/delete-P5VULXR4.js +14 -0
- package/dist/diff-RTFUKJHF.js +9 -0
- package/dist/discipline-H7LDI6NT.js +2 -0
- package/dist/dist-3ZCH25SG.js +2 -0
- package/dist/dist-KGRCLBJP-2QAPFYNF.js +39 -0
- package/dist/dist-R3RWD35F.js +2 -0
- package/dist/dist-VGFSP3XM.js +2 -0
- package/dist/dist-VXCZWVVJ.js +2 -0
- package/dist/dist-W3XCATBJ.js +2 -0
- package/dist/docs-EDQ2STFK.js +2 -0
- package/dist/docs-RXPN6CK7.js +12 -0
- package/dist/doctor-2T2QL6VM.js +2 -0
- package/dist/drift-ILZE5BFJ.js +13 -0
- package/dist/echo-UPTQUEDU.js +46 -0
- package/dist/edit-GUU3HBVW.js +9 -0
- package/dist/event-Y3VXC2RV.js +3 -0
- package/dist/explain-files-3GPZUETV.js +4 -0
- package/dist/export-CV5KCTPS.js +2 -0
- package/dist/flow-S3RQ4YPY.js +11 -0
- package/dist/global-C44FW4G2.js +13 -0
- package/dist/graduate-3BBSC27A.js +5 -0
- package/dist/graph-CNDE5TAT.js +2 -0
- package/dist/graph-server-COZR5C3Z.js +14 -0
- package/dist/habits-4J2KRYUL.js +42 -0
- package/dist/history-UW454SDP.js +12 -0
- package/dist/hooks-XH52VGOU.js +2 -0
- package/dist/index.js +15 -1039
- package/dist/init-24MAQJFM.js +2 -0
- package/dist/integrity-UYDOOJDP.js +7 -0
- package/dist/integrity-checker-DHGMZQDG.js +2 -0
- package/dist/journal-loader-GLH7XFTK.js +2 -0
- package/dist/lint-IGKE6UPS.js +26 -0
- package/dist/list-5IUGP3ZB.js +7 -0
- package/dist/list-YKIQNKGB.js +6 -0
- package/dist/lore-loader-RVQI5GXL.js +2 -0
- package/dist/lore-loader-XY5MZRR2.js +2 -0
- package/dist/lore-server-FC2GMDLT.js +14 -0
- package/dist/manual-RXSPSFLL.js +20 -0
- package/dist/mcp.js +93 -20484
- package/dist/migrate-X5OMAFAQ.js +59 -0
- package/dist/migrate-assessments-GEI5WMI2.js +4 -0
- package/dist/model-discovery-HMB3YI4L.js +2 -0
- package/dist/nomination-engine-XF7TWPAP.js +2 -0
- package/dist/notebook-PE3JSYZI.js +11 -0
- package/dist/notebook-loader-CENTDDUJ.js +2 -0
- package/dist/orchestrate-35HBQ3O3.js +8 -0
- package/dist/peers-P2KXU7ZK.js +5 -0
- package/dist/persona-STQWZH5P.js +29 -0
- package/dist/pipeline-MZUITRVN.js +4 -0
- package/dist/platform-server-2KXHGHFV.js +25 -0
- package/dist/plugin-update-checker-M7PW434O.js +2 -0
- package/dist/portal-check-3JVNLOEP.js +8 -0
- package/dist/portal-compliance-2UG4VKWH.js +2 -0
- package/dist/probe-5L5BQDGE.js +6 -0
- package/dist/project-type-SURTOIG7.js +2 -0
- package/dist/promote-NJQDZBZA.js +8 -0
- package/dist/providers-4PXMWA7V.js +8 -0
- package/dist/quiz-FE5UGAY2.js +10 -0
- package/dist/record-YXPB34MY.js +6 -0
- package/dist/reindex-PGDQSM42.js +2 -0
- package/dist/remember-MJRNTXYS.js +14 -0
- package/dist/retag-N5XF3KXP.js +6 -0
- package/dist/review-6UAH6V3R.js +11 -0
- package/dist/review-77QI6VOC.js +6 -0
- package/dist/ripple-ZGDITCGB.js +10 -0
- package/dist/roster-FLRZ5J42.js +2 -0
- package/dist/sentinel-HYAZ3CO5.js +19 -0
- package/dist/sentinel-bridge-VR357PKL.js +2 -0
- package/dist/sentinel-mcp.js +38 -3808
- package/dist/sentinel.js +1 -34
- package/dist/serve-JE6UF5P2.js +8 -0
- package/dist/serve-L52ZUTU6.js +10 -0
- package/dist/serve-OY6XYL7F.js +12 -0
- package/dist/server-2MNROHF6.js +7 -0
- package/dist/server-4YNUIK4W.js +8 -0
- package/dist/session-tracker-SKOMBDOW.js +2 -0
- package/dist/session-work-log-3MNUDEZ6.js +2 -0
- package/dist/session-work-log-J2H5OZBR.js +2 -0
- package/dist/setup-3F5IK7MO.js +31 -0
- package/dist/setup-KPIMRZ4Q.js +2 -0
- package/dist/shift-6GCNH666.js +11 -0
- package/dist/show-BOAVWZPZ.js +7 -0
- package/dist/show-PJ5LFLIL.js +5 -0
- package/dist/snapshot-L2G56RPL.js +8 -0
- package/dist/spawn-UH5RENSE.js +12 -0
- package/dist/status-77M3SDIF.js +8 -0
- package/dist/status-A37ECYNJ.js +6 -0
- package/dist/summary-ZJLQ6KHB.js +7 -0
- package/dist/sweep-HU74OPVW.js +17 -0
- package/dist/switch-CTW4PDGI.js +17 -0
- package/dist/symphony-3QMBGCZY.js +2 -0
- package/dist/symphony-QI63XL62.js +53 -0
- package/dist/symphony-loader-XACVV2E3.js +2 -0
- package/dist/symphony-peers-U4KHMKGI.js +2 -0
- package/dist/symphony-peers-X5NGWXFP.js +2 -0
- package/dist/symphony-relay-5GY5JIPT.js +3 -0
- package/dist/sync-QRDSFETO.js +2 -0
- package/dist/sync-llms-HL5PPW3M.js +15 -0
- package/dist/task-loader-NZFDTUQ5.js +2 -0
- package/dist/team-WGERKGNP.js +2 -0
- package/dist/test-BQJMS4Y2.js +111 -0
- package/dist/thread-HFXK65D4.js +41 -0
- package/dist/timeline-K3ZFKJ3R.js +6 -0
- package/dist/triage-FCWOZASE.js +18 -0
- package/dist/tutorial-UC6YQMNN.js +305 -0
- package/dist/university-content/courses/.purpose +74 -5
- package/dist/university-content/courses/para-701.json +807 -0
- package/dist/university-content/plsat/.purpose +3 -2
- package/dist/university-ui/assets/{index-BjewBB6s.js → index-CGFJczb1.js} +2 -2
- package/dist/university-ui/assets/{index-BjewBB6s.js.map → index-CGFJczb1.js.map} +1 -1
- package/dist/university-ui/index.html +1 -1
- package/dist/upgrade-B4IOLZYK.js +53 -0
- package/dist/validate-C6SMKGYD.js +9 -0
- package/dist/validate-LSCDOLBO.js +13 -0
- package/dist/validate-VZXTJHGO.js +6 -0
- package/dist/watch-LRM5XD46.js +8 -0
- package/dist/watch-PZCCUP6K.js +9 -0
- package/dist/wisdom-XZ3QKPNP.js +7 -0
- package/dist/work-log-loader-DL5GZ2BQ.js +2 -0
- package/dist/workspace-2ODL5WLY.js +2 -0
- package/package.json +1 -1
- package/platform-ui/dist/assets/AmbientSection-DqQ2mfCO.js +1 -0
- package/platform-ui/dist/assets/{CanvasSection-DwPTRdIN.js → CanvasSection-DLW0s-Bu.js} +1 -1
- package/platform-ui/dist/assets/{DocsSection-BJc_ws4I.js → DocsSection-BQ9Hi51g.js} +1 -1
- package/platform-ui/dist/assets/{GitSection-DhqBo1xc.js → GitSection-QQeUX6o3.js} +1 -1
- package/platform-ui/dist/assets/{GraphSection-D9fhVnZ0.js → GraphSection-0c9C-w7K.js} +2 -2
- package/platform-ui/dist/assets/{GraphSection-BlgXTl53.css → GraphSection-Bbs2a8sC.css} +1 -1
- package/platform-ui/dist/assets/LoreSection--t56kCj2.js +1 -0
- package/platform-ui/dist/assets/LoreSection-qnmm3o4y.css +1 -0
- package/platform-ui/dist/assets/SentinelSection-C4OoME9U.js +1 -0
- package/platform-ui/dist/assets/{SymphonySection-BRoBaUSS.js → SymphonySection-B-rvsLxq.js} +1 -1
- package/platform-ui/dist/assets/TeamSection-CBFmNEEo.js +1 -0
- package/platform-ui/dist/assets/index-Bxp0TVaf.css +1 -0
- package/platform-ui/dist/assets/index-DPpOdAtC.js +57 -0
- package/platform-ui/dist/index.html +2 -2
- package/dist/accept-orchestration-UQLM7PTQ.js +0 -189
- package/dist/add-FZRKEGH4.js +0 -81
- package/dist/agent-WERIO2XV.js +0 -523
- package/dist/agent-loader-TFIANSF4.js +0 -44
- package/dist/agent-state-S5DAWPTF.js +0 -24
- package/dist/agents-suggest-DNSYJ6IA.js +0 -83
- package/dist/aggregate-H57K7PNV.js +0 -88
- package/dist/assess-4WVXZLZQ.js +0 -68
- package/dist/auto-QFS5NHQU.js +0 -504
- package/dist/beacon-KXZXYQHX.js +0 -251
- package/dist/calibration-V46G7JTY.js +0 -135
- package/dist/check-OWAIWV23.js +0 -175
- package/dist/chunk-2IO7JAG2.js +0 -148
- package/dist/chunk-2T6BTYBN.js +0 -712
- package/dist/chunk-36TKPM5Z.js +0 -400
- package/dist/chunk-45MUDW6E.js +0 -804
- package/dist/chunk-4BLYIB7J.js +0 -5701
- package/dist/chunk-4L3UTYQX.js +0 -677
- package/dist/chunk-4NCFWYGG.js +0 -110
- package/dist/chunk-54LTTQBH.js +0 -138
- package/dist/chunk-5EWAQHFY.js +0 -269
- package/dist/chunk-5JGJACDU.js +0 -37
- package/dist/chunk-5OUOLN6M.js +0 -659
- package/dist/chunk-5VKJBNJL.js +0 -444
- package/dist/chunk-6N3JTACN.js +0 -2260
- package/dist/chunk-6QC3YGB6.js +0 -114
- package/dist/chunk-7N7GSU6K.js +0 -34
- package/dist/chunk-ABVQGRF7.js +0 -268
- package/dist/chunk-CL7JSK52.js +0 -129
- package/dist/chunk-CSD7IHSN.js +0 -152
- package/dist/chunk-EDOAWN7J.js +0 -717
- package/dist/chunk-EKGMAM62.js +0 -525
- package/dist/chunk-EZ3GOCYC.js +0 -132
- package/dist/chunk-F3BCHPYT.js +0 -143
- package/dist/chunk-FKJUBQU3.js +0 -3081
- package/dist/chunk-GT5QGC2H.js +0 -253
- package/dist/chunk-GZDFVP2N.js +0 -540
- package/dist/chunk-IRKUEJVW.js +0 -405
- package/dist/chunk-J2JEQRT3.js +0 -164
- package/dist/chunk-JASGXLK3.js +0 -679
- package/dist/chunk-KVDYJLTC.js +0 -121
- package/dist/chunk-L27I3CPZ.js +0 -357
- package/dist/chunk-LHLIAYQ3.js +0 -185
- package/dist/chunk-MCMOGQMU.js +0 -145
- package/dist/chunk-NQKQG45G.js +0 -688
- package/dist/chunk-PBHIFAL4.js +0 -259
- package/dist/chunk-PDX44BCA.js +0 -11
- package/dist/chunk-PMXRGPRQ.js +0 -305
- package/dist/chunk-RAB5IKPR.js +0 -487
- package/dist/chunk-RJE5G7WO.js +0 -590
- package/dist/chunk-RTHA3XRE.js +0 -880
- package/dist/chunk-S2HO5MLR.js +0 -621
- package/dist/chunk-S3ORKP3V.js +0 -716
- package/dist/chunk-TAIJOFOE.js +0 -124
- package/dist/chunk-TXESEO7Y.js +0 -245
- package/dist/chunk-UPLDI7CN.js +0 -1334
- package/dist/chunk-VL67H5IC.js +0 -506
- package/dist/chunk-VPPK3SY4.js +0 -1136
- package/dist/chunk-YMDLDELF.js +0 -314
- package/dist/chunk-YO6DVTL7.js +0 -99
- package/dist/chunk-YRZ5RPEB.js +0 -1561
- package/dist/chunk-ZDHLG5VP.js +0 -5676
- package/dist/chunk-ZGUAAVMA.js +0 -756
- package/dist/chunk-ZSYVKSY6.js +0 -2602
- package/dist/claude-FRRWJSTJ.js +0 -362
- package/dist/claude-cli-XJLK2X4L.js +0 -276
- package/dist/claude-code-HTBA4XRB.js +0 -126
- package/dist/claude-code-teams-T4SP24MD.js +0 -199
- package/dist/commands-5N4ILTPH.js +0 -5859
- package/dist/conductor-CQVGTEQN.js +0 -161
- package/dist/config-schema-EA4XALGG.js +0 -154
- package/dist/constellation-A26CCGQS.js +0 -225
- package/dist/context-audit-RLO3ETRP.js +0 -682
- package/dist/cost-BGM32XJU.js +0 -93
- package/dist/cost-VI46A4XL.js +0 -174
- package/dist/cursor-cli-JVEZGHWQ.js +0 -269
- package/dist/cursorrules-HLIKJJZT.js +0 -84
- package/dist/decision-loader-WWCLIQPJ.js +0 -20
- package/dist/delete-KBRPQLPC.js +0 -56
- package/dist/diff-D4X53HAC.js +0 -126
- package/dist/discipline-FA4OZXIS.js +0 -24
- package/dist/dist-34NA5RS5.js +0 -74
- package/dist/dist-5QE2BB2B-5S3T6Y3T.js +0 -6919
- package/dist/dist-77JDTVAY.js +0 -62
- package/dist/dist-OGTSAZ55.js +0 -1358
- package/dist/dist-QK4SQAK7.js +0 -64
- package/dist/dist-TA6LSC2Q.js +0 -20
- package/dist/docs-PBZB7LYP.js +0 -89
- package/dist/docs-QIYKO3BR.js +0 -155
- package/dist/doctor-ULBOHEIC.js +0 -11
- package/dist/drift-R5NRKFHI.js +0 -251
- package/dist/echo-O2LY7CC2.js +0 -248
- package/dist/edit-R2HNLMOG.js +0 -63
- package/dist/event-25OJKDCE.js +0 -31
- package/dist/export-IWVL7XLF.js +0 -38
- package/dist/flow-CRRVV3O3.js +0 -185
- package/dist/global-3NG5JXUB.js +0 -136
- package/dist/graduate-USAWGBJM.js +0 -160
- package/dist/graph-VHUMAAS6.js +0 -12
- package/dist/graph-server-YL22VBBN.js +0 -116
- package/dist/habits-OL5NGPXO.js +0 -1405
- package/dist/history-WOWC573W.js +0 -277
- package/dist/hooks-HFWSCGPV.js +0 -12
- package/dist/integrity-IHO4FZTS.js +0 -194
- package/dist/integrity-checker-PSKJA5SB.js +0 -12
- package/dist/journal-loader-5EYSBFFY.js +0 -18
- package/dist/lint-K6CJGGPH.js +0 -456
- package/dist/list-4YK7QKFF.js +0 -57
- package/dist/list-ENR7Q4CR.js +0 -56
- package/dist/lore-loader-7NO6N6FT.js +0 -26
- package/dist/lore-server-UNJY5KC3.js +0 -118
- package/dist/manual-G6FISID5.js +0 -204
- package/dist/migrate-LS45DNEV.js +0 -889
- package/dist/migrate-assessments-RGH4O6IX.js +0 -97
- package/dist/model-discovery-D2H3VBGC.js +0 -8
- package/dist/nomination-engine-RV5CNO5B.js +0 -42
- package/dist/notebook-YWIYGEHV.js +0 -155
- package/dist/orchestrate-JLILBBJE.js +0 -324
- package/dist/peers-DEOUIZM6.js +0 -82
- package/dist/persona-UHAHIVST.js +0 -390
- package/dist/pipeline-L4HCSBGN.js +0 -263
- package/dist/platform-server-H5YO3DQD.js +0 -1475
- package/dist/plugin-update-checker-KRRSGXMV.js +0 -12
- package/dist/portal-check-NPYGII2D.js +0 -42
- package/dist/portal-compliance-J7DGAPFX.js +0 -18
- package/dist/probe-MHL5HQZ2.js +0 -167
- package/dist/promote-F6ZYZZAL.js +0 -182
- package/dist/providers-GK7PB2OL.js +0 -104
- package/dist/quiz-M66SC7F7.js +0 -99
- package/dist/record-RA4WR2BO.js +0 -49
- package/dist/reindex-5LTD53ZC.js +0 -16
- package/dist/remember-HBWJ655S.js +0 -77
- package/dist/retag-3OLCVDEQ.js +0 -62
- package/dist/review-27ATYTD2.js +0 -33
- package/dist/review-57QMURZV.js +0 -334
- package/dist/ripple-JPBXP5I3.js +0 -215
- package/dist/sentinel-4XIG4STA.js +0 -63
- package/dist/sentinel-bridge-MDUXTQRL.js +0 -109
- package/dist/serve-CAH3PHE7.js +0 -33
- package/dist/serve-INL7SNBK.js +0 -36
- package/dist/serve-KBSE36PL.js +0 -49
- package/dist/server-54SKYFFY.js +0 -1647
- package/dist/server-XUOIO7E6.js +0 -338
- package/dist/session-tracker-C4BMD5WG.js +0 -13
- package/dist/session-work-log-MZ47OAPB.js +0 -20
- package/dist/setup-EDS27WUR.js +0 -25
- package/dist/setup-KO5AFC4K.js +0 -296
- package/dist/shift-D2JOHHBF.js +0 -668
- package/dist/show-5PV5KFJE.js +0 -176
- package/dist/show-NQKYX6WQ.js +0 -82
- package/dist/snapshot-BK4RBPCG.js +0 -62
- package/dist/spawn-RCHNXDHE.js +0 -196
- package/dist/status-WGIAQODY.js +0 -71
- package/dist/summary-NIRABMF5.js +0 -140
- package/dist/sweep-QMHNSIY5.js +0 -934
- package/dist/switch-6EJPZDIA.js +0 -232
- package/dist/symphony-4OCY36AI.js +0 -791
- package/dist/symphony-B75X2MME.js +0 -326
- package/dist/symphony-loader-UZGON56V.js +0 -90
- package/dist/symphony-peers-2ZQYLRNI.js +0 -34
- package/dist/symphony-peers-OL7F6M5S.js +0 -121
- package/dist/symphony-relay-UJYUXN65.js +0 -710
- package/dist/sync-VEHUH4OA.js +0 -11
- package/dist/sync-llms-YHCFIE6X.js +0 -166
- package/dist/task-loader-LDYWQSLM.js +0 -20
- package/dist/team-O5MIIFMA.js +0 -34
- package/dist/test-566CP5KC.js +0 -1017
- package/dist/thread-N754I4D5.js +0 -274
- package/dist/timeline-M3CICQFE.js +0 -112
- package/dist/triage-HHYGT3HY.js +0 -671
- package/dist/tutorial-KD22SUNO.js +0 -666
- package/dist/upgrade-H5PF32BW.js +0 -551
- package/dist/validate-CNKEKO6A.js +0 -134
- package/dist/validate-MB5ULIHS.js +0 -39
- package/dist/validate-QH3LADM6.js +0 -64
- package/dist/watch-2TKP5PVL.js +0 -199
- package/dist/watch-ZF4ML6CD.js +0 -111
- package/dist/wisdom-AATMGNFA.js +0 -319
- package/dist/work-log-loader-5L45XNYZ.js +0 -14
- package/dist/workspace-6E6OSRNU.js +0 -21
- package/platform-ui/dist/assets/AmbientSection-WtHfNedO.js +0 -1
- package/platform-ui/dist/assets/LoreSection-C3EixkjW.css +0 -1
- package/platform-ui/dist/assets/LoreSection-CwDDHrz9.js +0 -1
- package/platform-ui/dist/assets/SentinelSection-Cl7e5oZ6.js +0 -1
- package/platform-ui/dist/assets/TeamSection-CqSIMrKz.js +0 -1
- package/platform-ui/dist/assets/index-CfpZFjea.css +0 -1
- package/platform-ui/dist/assets/index-F0KL9xrN.js +0 -57
package/dist/chunk-6N3JTACN.js
DELETED
|
@@ -1,2260 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
parseParadigmConfig
|
|
4
|
-
} from "./chunk-YO6DVTL7.js";
|
|
5
|
-
|
|
6
|
-
// src/core/ide-adapters/index.ts
|
|
7
|
-
import * as fs6 from "fs";
|
|
8
|
-
import * as path6 from "path";
|
|
9
|
-
|
|
10
|
-
// src/core/ide-adapters/cursor.ts
|
|
11
|
-
import * as fs from "fs";
|
|
12
|
-
import * as path from "path";
|
|
13
|
-
import * as os from "os";
|
|
14
|
-
import * as yaml from "js-yaml";
|
|
15
|
-
|
|
16
|
-
// src/core/ide-adapters/base.ts
|
|
17
|
-
function generateHeader(projectName, ideName) {
|
|
18
|
-
const lines = [];
|
|
19
|
-
lines.push(`# ${projectName} - Paradigm Context`);
|
|
20
|
-
lines.push("");
|
|
21
|
-
lines.push(`Generated for ${ideName} by Paradigm.`);
|
|
22
|
-
lines.push("");
|
|
23
|
-
return lines.join("\n");
|
|
24
|
-
}
|
|
25
|
-
function generateOverview(config) {
|
|
26
|
-
const lines = [];
|
|
27
|
-
if (config["agent-guidelines"]?.overview) {
|
|
28
|
-
lines.push("## Overview");
|
|
29
|
-
lines.push("");
|
|
30
|
-
lines.push(config["agent-guidelines"].overview);
|
|
31
|
-
lines.push("");
|
|
32
|
-
}
|
|
33
|
-
if (config["agent-guidelines"]?.["how-to-use"]?.length) {
|
|
34
|
-
lines.push("## How to Use Paradigm");
|
|
35
|
-
lines.push("");
|
|
36
|
-
for (const instruction of config["agent-guidelines"]["how-to-use"]) {
|
|
37
|
-
lines.push(`- ${instruction}`);
|
|
38
|
-
}
|
|
39
|
-
lines.push("");
|
|
40
|
-
}
|
|
41
|
-
return lines.join("\n");
|
|
42
|
-
}
|
|
43
|
-
function generateSymbolSystem(config) {
|
|
44
|
-
const lines = [];
|
|
45
|
-
lines.push("## Symbol System");
|
|
46
|
-
lines.push("");
|
|
47
|
-
lines.push("Use these prefixes to reference project elements:");
|
|
48
|
-
lines.push("");
|
|
49
|
-
lines.push("| Symbol | Name | Description |");
|
|
50
|
-
lines.push("|--------|------|-------------|");
|
|
51
|
-
const symbolSystem = config["symbol-system"];
|
|
52
|
-
if (symbolSystem) {
|
|
53
|
-
for (const [prefix, def] of Object.entries(symbolSystem)) {
|
|
54
|
-
lines.push(`| \`${prefix}\` | ${def.name} | ${def.description} |`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
lines.push("");
|
|
58
|
-
lines.push("See `.paradigm/specs/symbols.md` for complete reference.");
|
|
59
|
-
lines.push("");
|
|
60
|
-
return lines.join("\n");
|
|
61
|
-
}
|
|
62
|
-
function generateLoggingRules(config) {
|
|
63
|
-
const lines = [];
|
|
64
|
-
if (!config.logging?.enforce) {
|
|
65
|
-
return "";
|
|
66
|
-
}
|
|
67
|
-
lines.push("## Paradigm Logging");
|
|
68
|
-
lines.push("");
|
|
69
|
-
lines.push("**IMPORTANT:** Use the Paradigm logger instead of raw console.log/print.");
|
|
70
|
-
lines.push("");
|
|
71
|
-
lines.push("```");
|
|
72
|
-
lines.push("// Use this pattern:");
|
|
73
|
-
lines.push("log.component('#login-handler').info('Starting login', { email });");
|
|
74
|
-
lines.push("log.component('#database').debug('Query executed', { duration });");
|
|
75
|
-
lines.push("log.gate('^authenticated').warn('Access denied', { userId });");
|
|
76
|
-
lines.push("log.signal('!login-success').info('User authenticated');");
|
|
77
|
-
lines.push("```");
|
|
78
|
-
lines.push("");
|
|
79
|
-
if (config.logging["symbol-mapping"]) {
|
|
80
|
-
lines.push("### Symbol Mapping by Directory");
|
|
81
|
-
lines.push("");
|
|
82
|
-
lines.push("| Directory | Symbol | Logger Method |");
|
|
83
|
-
lines.push("|-----------|--------|---------------|");
|
|
84
|
-
for (const [pattern, symbol] of Object.entries(config.logging["symbol-mapping"])) {
|
|
85
|
-
const method = getLogMethodForSymbol(symbol);
|
|
86
|
-
lines.push(`| \`${pattern}\` | \`${symbol}\` | \`log.${method}()\` |`);
|
|
87
|
-
}
|
|
88
|
-
lines.push("");
|
|
89
|
-
}
|
|
90
|
-
lines.push("See `.paradigm/specs/logger.md` for full specification.");
|
|
91
|
-
lines.push("");
|
|
92
|
-
return lines.join("\n");
|
|
93
|
-
}
|
|
94
|
-
function getLogMethodForSymbol(symbol) {
|
|
95
|
-
const mapping = {
|
|
96
|
-
"#": "component",
|
|
97
|
-
"^": "gate",
|
|
98
|
-
"!": "signal",
|
|
99
|
-
"$": "flow",
|
|
100
|
-
"~": "aspect",
|
|
101
|
-
// v1 backwards compat — all map to component() in v2
|
|
102
|
-
"@": "component",
|
|
103
|
-
"%": "component",
|
|
104
|
-
"&": "component"
|
|
105
|
-
};
|
|
106
|
-
return mapping[symbol] || "raw";
|
|
107
|
-
}
|
|
108
|
-
function generateScanProtocol(config) {
|
|
109
|
-
if (!config.scan?.enabled) {
|
|
110
|
-
return "";
|
|
111
|
-
}
|
|
112
|
-
const lines = [];
|
|
113
|
-
lines.push("## Paradigm Scan");
|
|
114
|
-
lines.push("");
|
|
115
|
-
lines.push('When the user says "**paradigm scan**" with an image:');
|
|
116
|
-
lines.push("");
|
|
117
|
-
lines.push("1. Analyze the image for UI elements");
|
|
118
|
-
lines.push("2. Cross-reference with `.paradigm/scan-index.json`");
|
|
119
|
-
lines.push("3. Return structured mapping of visual elements to code");
|
|
120
|
-
lines.push("");
|
|
121
|
-
lines.push("| Mode | Use Case |");
|
|
122
|
-
lines.push("|------|----------|");
|
|
123
|
-
lines.push("| `paradigm scan` | Map any image to code |");
|
|
124
|
-
lines.push("| `paradigm scan ui` | Screenshot of running app |");
|
|
125
|
-
lines.push("| `paradigm scan design` | Mockup - gap analysis |");
|
|
126
|
-
lines.push("| `paradigm scan error` | Error screenshot |");
|
|
127
|
-
lines.push("");
|
|
128
|
-
lines.push("See `.paradigm/specs/scan.md` for full protocol.");
|
|
129
|
-
lines.push("");
|
|
130
|
-
return lines.join("\n");
|
|
131
|
-
}
|
|
132
|
-
function generateConventions(config) {
|
|
133
|
-
if (!config.conventions?.length) {
|
|
134
|
-
return "";
|
|
135
|
-
}
|
|
136
|
-
const lines = [];
|
|
137
|
-
lines.push("## Conventions");
|
|
138
|
-
lines.push("");
|
|
139
|
-
for (const convention of config.conventions) {
|
|
140
|
-
lines.push(`- ${convention}`);
|
|
141
|
-
}
|
|
142
|
-
lines.push("");
|
|
143
|
-
return lines.join("\n");
|
|
144
|
-
}
|
|
145
|
-
function generateUpdateRules(config) {
|
|
146
|
-
if (!config["agent-guidelines"]?.["update-rules"]?.length) {
|
|
147
|
-
return "";
|
|
148
|
-
}
|
|
149
|
-
const lines = [];
|
|
150
|
-
lines.push("## When to Update Paradigm Files");
|
|
151
|
-
lines.push("");
|
|
152
|
-
for (const rule of config["agent-guidelines"]["update-rules"]) {
|
|
153
|
-
lines.push(`- ${rule}`);
|
|
154
|
-
}
|
|
155
|
-
lines.push("");
|
|
156
|
-
return lines.join("\n");
|
|
157
|
-
}
|
|
158
|
-
function generateCommandsReference() {
|
|
159
|
-
const lines = [];
|
|
160
|
-
lines.push("## Paradigm Commands");
|
|
161
|
-
lines.push("");
|
|
162
|
-
lines.push("| Command | Description |");
|
|
163
|
-
lines.push("|---------|-------------|");
|
|
164
|
-
lines.push("| `paradigm init` | Initialize Paradigm in a project |");
|
|
165
|
-
lines.push("| `paradigm sync` | Regenerate IDE instruction files |");
|
|
166
|
-
lines.push("| `paradigm index` | Generate scan index |");
|
|
167
|
-
lines.push("| `paradigm doctor` | Health check |");
|
|
168
|
-
lines.push("| `paradigm status` | Show project status |");
|
|
169
|
-
lines.push("| `paradigm watch` | Auto-sync on changes |");
|
|
170
|
-
lines.push("");
|
|
171
|
-
lines.push("See `.paradigm/docs/commands.md` for full reference.");
|
|
172
|
-
lines.push("");
|
|
173
|
-
return lines.join("\n");
|
|
174
|
-
}
|
|
175
|
-
function generateNavigationSection(_config) {
|
|
176
|
-
const lines = [];
|
|
177
|
-
lines.push("## Paradigm Navigation");
|
|
178
|
-
lines.push("");
|
|
179
|
-
lines.push("Before exploring this codebase:");
|
|
180
|
-
lines.push("");
|
|
181
|
-
lines.push("1. Read `.paradigm/navigator.yaml` for structure map");
|
|
182
|
-
lines.push("2. Query by symbol - lookup paths directly");
|
|
183
|
-
lines.push("3. Respect skip patterns (node_modules, dist, etc.)");
|
|
184
|
-
lines.push("");
|
|
185
|
-
lines.push("### Exploration Protocol");
|
|
186
|
-
lines.push("");
|
|
187
|
-
lines.push("**INSTEAD OF:** Broad exploration (expensive token usage)");
|
|
188
|
-
lines.push("");
|
|
189
|
-
lines.push("**DO THIS:**");
|
|
190
|
-
lines.push("1. Read `.paradigm/navigator.yaml` for structure map");
|
|
191
|
-
lines.push("2. Find relevant symbol \u2192 go to path");
|
|
192
|
-
lines.push("3. Read only needed files");
|
|
193
|
-
lines.push("");
|
|
194
|
-
lines.push("### Task Recipes");
|
|
195
|
-
lines.push("");
|
|
196
|
-
lines.push("**Adding a feature:**");
|
|
197
|
-
lines.push("1. Check `navigator.yaml` \u2192 `structure.features.paths`");
|
|
198
|
-
lines.push("2. Read existing feature as template");
|
|
199
|
-
lines.push("3. Create in same location");
|
|
200
|
-
lines.push("");
|
|
201
|
-
lines.push("**Modifying a component:**");
|
|
202
|
-
lines.push("1. Look up symbol in `navigator.yaml` \u2192 `symbols`");
|
|
203
|
-
lines.push("2. Go directly to the path");
|
|
204
|
-
lines.push("3. Check `paradigm_ripple` for impact");
|
|
205
|
-
lines.push("");
|
|
206
|
-
lines.push("**Using MCP Tools:**");
|
|
207
|
-
lines.push('- `paradigm_navigate({ intent: "find", target: "#checkout" })` - locate symbol');
|
|
208
|
-
lines.push('- `paradigm_navigate({ intent: "explore", target: "auth" })` - browse area');
|
|
209
|
-
lines.push('- `paradigm_navigate({ intent: "context", task: "add login" })` - task context');
|
|
210
|
-
lines.push("");
|
|
211
|
-
lines.push("### PM Governance (Before/After Tasks)");
|
|
212
|
-
lines.push("");
|
|
213
|
-
lines.push("| When | Tool | Purpose |");
|
|
214
|
-
lines.push("|------|------|---------|");
|
|
215
|
-
lines.push("| Starting any task | `paradigm_pm_preflight` | Get compliance plan, affected symbols, required checks |");
|
|
216
|
-
lines.push("| Finishing any task | `paradigm_pm_postflight` | Check for violations: missing .purpose, missing gates |");
|
|
217
|
-
lines.push("");
|
|
218
|
-
return lines.join("\n");
|
|
219
|
-
}
|
|
220
|
-
function generateCommitConvention() {
|
|
221
|
-
const lines = [];
|
|
222
|
-
lines.push("## Commit Messages");
|
|
223
|
-
lines.push("");
|
|
224
|
-
lines.push("Use v2 symbols in commits for history tracking:");
|
|
225
|
-
lines.push("");
|
|
226
|
-
lines.push("### Format");
|
|
227
|
-
lines.push("```");
|
|
228
|
-
lines.push("type(#primary-symbol): short description");
|
|
229
|
-
lines.push("");
|
|
230
|
-
lines.push("- Detail with #component references");
|
|
231
|
-
lines.push("- Gate changes: ^gate-name");
|
|
232
|
-
lines.push("- Signals emitted: !signal-name");
|
|
233
|
-
lines.push("");
|
|
234
|
-
lines.push("Symbols: #symbol-a, #symbol-b, !signal-c");
|
|
235
|
-
lines.push("```");
|
|
236
|
-
lines.push("");
|
|
237
|
-
lines.push("### Convention");
|
|
238
|
-
lines.push("- **Subject**: `type(#symbol): description` \u2014 primary symbol in parens");
|
|
239
|
-
lines.push("- **Body**: Reference affected symbols with prefixes (# $ ^ ! ~)");
|
|
240
|
-
lines.push("- **Trailer**: `Symbols: #a, #b, !c` \u2014 machine-readable list of ALL affected symbols");
|
|
241
|
-
lines.push("- The `Symbols:` trailer is parsed by the post-commit hook for automatic history capture");
|
|
242
|
-
lines.push("");
|
|
243
|
-
lines.push("### Examples");
|
|
244
|
-
lines.push("```");
|
|
245
|
-
lines.push("feat(#payment-form): add Apple Pay support");
|
|
246
|
-
lines.push("");
|
|
247
|
-
lines.push("- Add #apple-pay-button component");
|
|
248
|
-
lines.push("- Update $checkout-flow with new payment step");
|
|
249
|
-
lines.push("- Emit !payment-method-added signal");
|
|
250
|
-
lines.push("- Gate: ^authenticated required");
|
|
251
|
-
lines.push("");
|
|
252
|
-
lines.push("Symbols: #payment-form, #apple-pay-button, $checkout-flow, !payment-method-added");
|
|
253
|
-
lines.push("```");
|
|
254
|
-
lines.push("");
|
|
255
|
-
return lines.join("\n");
|
|
256
|
-
}
|
|
257
|
-
function generateMcpToolReference() {
|
|
258
|
-
const lines = [];
|
|
259
|
-
lines.push("## MCP Tools");
|
|
260
|
-
lines.push("");
|
|
261
|
-
lines.push("Paradigm provides MCP tools for token-efficient, always-fresh data. Prefer these over reading files directly.");
|
|
262
|
-
lines.push("");
|
|
263
|
-
lines.push("| Tool | Description | When to Use |");
|
|
264
|
-
lines.push("|------|-------------|-------------|");
|
|
265
|
-
lines.push("| `paradigm_status` | Project overview and symbol counts | Starting a session |");
|
|
266
|
-
lines.push("| `paradigm_search` | Find symbols by name, description, or tags | Looking for symbols |");
|
|
267
|
-
lines.push("| `paradigm_navigate` | Find code locations, explore areas, get task context | Locating code |");
|
|
268
|
-
lines.push("| `paradigm_ripple` | Dependency and impact analysis | Before modifying symbols |");
|
|
269
|
-
lines.push("| `paradigm_related` | Direct relationships for a symbol | Understanding connections |");
|
|
270
|
-
lines.push("| `paradigm_gates_for_route` | Suggest gates for an API endpoint | Adding API routes |");
|
|
271
|
-
lines.push("| `paradigm_wisdom_context` | Team preferences and antipatterns | Before implementing |");
|
|
272
|
-
lines.push("| `paradigm_history_fragility` | Stability warnings for symbols | Before modifying fragile areas |");
|
|
273
|
-
lines.push("| `paradigm_flow_validate` | Validate flow definitions | Before/after implementing flows |");
|
|
274
|
-
lines.push("| `paradigm_flows_affected` | Flows impacted by symbol changes | After modifying symbols |");
|
|
275
|
-
lines.push("| `paradigm_test_fixtures` | Get test data for validation | Writing tests |");
|
|
276
|
-
lines.push("| `paradigm_orchestrate_inline` | Multi-agent task planning | Complex tasks (3+ files) |");
|
|
277
|
-
lines.push("| `paradigm_pm_preflight` | Pre-task compliance check | Starting any task |");
|
|
278
|
-
lines.push("| `paradigm_pm_postflight` | Post-task violation detection | Finishing any task |");
|
|
279
|
-
lines.push("| `paradigm_session_recover` | Load previous session breadcrumbs | Starting a new session |");
|
|
280
|
-
lines.push("| `paradigm_context_check` | Check context window usage | Every 10-15 tool calls |");
|
|
281
|
-
lines.push("| `paradigm_handoff_prepare` | Prepare session handoff summary | When context is high |");
|
|
282
|
-
lines.push("| `paradigm_reindex` | Rebuild static index files | After modifying .purpose files |");
|
|
283
|
-
lines.push("| `paradigm_session_checkpoint` | Save cognitive-transition checkpoint | Phase transitions |");
|
|
284
|
-
lines.push("| `paradigm_session_stats` | Current session token usage | Checking budget |");
|
|
285
|
-
lines.push("");
|
|
286
|
-
lines.push("**Rule**: Use MCP tools for discovery and validation, file reads for implementation.");
|
|
287
|
-
lines.push("");
|
|
288
|
-
return lines.join("\n");
|
|
289
|
-
}
|
|
290
|
-
function generateWorkflowProtocol() {
|
|
291
|
-
const lines = [];
|
|
292
|
-
lines.push("## Workflow Protocol");
|
|
293
|
-
lines.push("");
|
|
294
|
-
lines.push("### Before Each Task");
|
|
295
|
-
lines.push("");
|
|
296
|
-
lines.push("1. **Preflight**: Call `paradigm_pm_preflight` with your task description");
|
|
297
|
-
lines.push(" - Returns affected symbols, ripple analysis, required agents");
|
|
298
|
-
lines.push("2. **Impact check**: Call `paradigm_ripple` for any symbols you'll modify");
|
|
299
|
-
lines.push("3. **Gate check**: Call `paradigm_gates_for_route` before adding API endpoints");
|
|
300
|
-
lines.push('4. **Complex tasks** (3+ files, security + implementation): Call `paradigm_orchestrate_inline` with mode="plan"');
|
|
301
|
-
lines.push("");
|
|
302
|
-
lines.push("### After Each Task");
|
|
303
|
-
lines.push("");
|
|
304
|
-
lines.push("1. **Postflight**: Call `paradigm_pm_postflight` with modified files and symbols");
|
|
305
|
-
lines.push(" - Checks for missing .purpose files, unregistered routes, uncaptured wisdom");
|
|
306
|
-
lines.push("2. **Reindex**: Call `paradigm_reindex` to rebuild static index files");
|
|
307
|
-
lines.push("3. **Validate flows**: Call `paradigm_flow_validate` if you touched flow-related symbols");
|
|
308
|
-
lines.push("");
|
|
309
|
-
return lines.join("\n");
|
|
310
|
-
}
|
|
311
|
-
function generateHandoffProtocol() {
|
|
312
|
-
const lines = [];
|
|
313
|
-
lines.push("## Session Recovery & Handoff");
|
|
314
|
-
lines.push("");
|
|
315
|
-
lines.push("### Session Start (EVERY new session)");
|
|
316
|
-
lines.push("");
|
|
317
|
-
lines.push("Call `paradigm_session_recover` to load previous session breadcrumbs.");
|
|
318
|
-
lines.push("Returns: symbols modified, files explored, recent actions, and suggestions.");
|
|
319
|
-
lines.push("");
|
|
320
|
-
lines.push("### Context Monitoring");
|
|
321
|
-
lines.push("");
|
|
322
|
-
lines.push("Call `paradigm_context_check` every 10-15 tool calls to track context usage.");
|
|
323
|
-
lines.push("");
|
|
324
|
-
lines.push("| Usage | Recommendation | Action |");
|
|
325
|
-
lines.push("|-------|----------------|--------|");
|
|
326
|
-
lines.push("| <50% | continue | Keep working |");
|
|
327
|
-
lines.push("| 50-70% | consider-handoff | Plan handoff; prepare summary when ready |");
|
|
328
|
-
lines.push("| 70-85% | handoff-recommended | Prepare handoff soon |");
|
|
329
|
-
lines.push("| >85% | handoff-urgent | Handoff after current task |");
|
|
330
|
-
lines.push("");
|
|
331
|
-
lines.push("### Handoff Process");
|
|
332
|
-
lines.push("");
|
|
333
|
-
lines.push("1. Call `paradigm_handoff_prepare` with summary, next steps, and target agent");
|
|
334
|
-
lines.push('2. User runs: `paradigm team handoff --to <agent> --summary "..."`');
|
|
335
|
-
lines.push("3. New session accepts: `paradigm team accept <handoff-id>`");
|
|
336
|
-
lines.push("");
|
|
337
|
-
return lines.join("\n");
|
|
338
|
-
}
|
|
339
|
-
function generateCheckpointProtocol() {
|
|
340
|
-
const lines = [];
|
|
341
|
-
lines.push("## Session Checkpoints");
|
|
342
|
-
lines.push("");
|
|
343
|
-
lines.push("**Auto-recovery**: Recovery data is automatically surfaced on your first Paradigm tool call \u2014 no action needed to receive it.");
|
|
344
|
-
lines.push("");
|
|
345
|
-
lines.push("Save checkpoints when transitioning between workflow phases to enable crash recovery:");
|
|
346
|
-
lines.push("");
|
|
347
|
-
lines.push("| Phase | Trigger | What to Capture |");
|
|
348
|
-
lines.push("|-------|---------|-----------------|");
|
|
349
|
-
lines.push("| `planning` | After reading requirements / before coding | Plan, approach, key decisions |");
|
|
350
|
-
lines.push("| `implementing` | After starting code changes | Modified files, symbols touched, decisions made |");
|
|
351
|
-
lines.push("| `validating` | After implementation, before tests/review | All modified files, test plan |");
|
|
352
|
-
lines.push("| `complete` | Task finished | Summary, final file list |");
|
|
353
|
-
lines.push("");
|
|
354
|
-
lines.push("### Usage");
|
|
355
|
-
lines.push("");
|
|
356
|
-
lines.push("```");
|
|
357
|
-
lines.push("paradigm_session_checkpoint({");
|
|
358
|
-
lines.push(' phase: "implementing",');
|
|
359
|
-
lines.push(' context: "Adding JWT auth middleware to /api/projects routes",');
|
|
360
|
-
lines.push(' modifiedFiles: ["src/middleware/auth.ts", "src/routes/projects.ts"],');
|
|
361
|
-
lines.push(' symbolsTouched: ["^authenticated", "#project-routes"],');
|
|
362
|
-
lines.push(' decisions: ["Using RS256 for JWT signing", "Storing refresh tokens in httpOnly cookies"]');
|
|
363
|
-
lines.push("})");
|
|
364
|
-
lines.push("```");
|
|
365
|
-
lines.push("");
|
|
366
|
-
lines.push("Keep it lightweight: `phase` + `context` are required, everything else is optional.");
|
|
367
|
-
lines.push("");
|
|
368
|
-
return lines.join("\n");
|
|
369
|
-
}
|
|
370
|
-
function generateHabitsSection() {
|
|
371
|
-
const lines = [];
|
|
372
|
-
lines.push("## Habits Compliance");
|
|
373
|
-
lines.push("");
|
|
374
|
-
lines.push("Paradigm tracks behavioral habits \u2014 repeatable practices that improve code quality.");
|
|
375
|
-
lines.push("");
|
|
376
|
-
lines.push("### When to Check Habits");
|
|
377
|
-
lines.push("");
|
|
378
|
-
lines.push("| Trigger | When | Tool |");
|
|
379
|
-
lines.push("|---------|------|------|");
|
|
380
|
-
lines.push('| `preflight` | Before starting implementation | `paradigm_habits_check({ trigger: "preflight" })` |');
|
|
381
|
-
lines.push('| `postflight` | After completing implementation | `paradigm_habits_check({ trigger: "postflight" })` |');
|
|
382
|
-
lines.push('| `on-stop` | Before ending a session | `paradigm_habits_check({ trigger: "on-stop" })` |');
|
|
383
|
-
lines.push("");
|
|
384
|
-
lines.push("### Key Habit Categories");
|
|
385
|
-
lines.push("");
|
|
386
|
-
lines.push("| Category | Examples |");
|
|
387
|
-
lines.push("|----------|----------|");
|
|
388
|
-
lines.push("| Discovery | Call `paradigm_ripple` before modifying symbols |");
|
|
389
|
-
lines.push("| Security | Declare gates for new routes in portal.yaml |");
|
|
390
|
-
lines.push("| Documentation | Update .purpose files for modified components |");
|
|
391
|
-
lines.push("| Quality | Record lore for sessions modifying 3+ files |");
|
|
392
|
-
lines.push("");
|
|
393
|
-
lines.push("Use `paradigm_practice_context` before modifying symbols to get habit-aware warnings.");
|
|
394
|
-
lines.push("");
|
|
395
|
-
return lines.join("\n");
|
|
396
|
-
}
|
|
397
|
-
function generateLoreSection() {
|
|
398
|
-
const lines = [];
|
|
399
|
-
lines.push("## Lore Recording");
|
|
400
|
-
lines.push("");
|
|
401
|
-
lines.push("Lore captures the project timeline \u2014 sessions, decisions, milestones, and incidents.");
|
|
402
|
-
lines.push("");
|
|
403
|
-
lines.push("### When to Record Lore");
|
|
404
|
-
lines.push("");
|
|
405
|
-
lines.push("| Type | When | Example |");
|
|
406
|
-
lines.push("|------|------|---------|");
|
|
407
|
-
lines.push('| `agent-session` | After modifying 3+ files | "Added JWT auth to /api/projects" |');
|
|
408
|
-
lines.push('| `decision` | After making architectural choices | "Chose Redis over Memcached for caching" |');
|
|
409
|
-
lines.push('| `milestone` | After completing a significant feature | "v2.0 migration complete" |');
|
|
410
|
-
lines.push('| `incident` | After resolving a production issue | "Fixed OOM in payment worker" |');
|
|
411
|
-
lines.push("");
|
|
412
|
-
lines.push("### Recording");
|
|
413
|
-
lines.push("");
|
|
414
|
-
lines.push("```");
|
|
415
|
-
lines.push("paradigm_lore_record({");
|
|
416
|
-
lines.push(' type: "agent-session",');
|
|
417
|
-
lines.push(' title: "Short description of work done",');
|
|
418
|
-
lines.push(' summary: "Detailed summary of changes...",');
|
|
419
|
-
lines.push(' symbols_touched: ["#component", "^gate"]');
|
|
420
|
-
lines.push("})");
|
|
421
|
-
lines.push("```");
|
|
422
|
-
lines.push("");
|
|
423
|
-
lines.push("Use `paradigm_lore_timeline` at session start for project history orientation.");
|
|
424
|
-
lines.push("");
|
|
425
|
-
return lines.join("\n");
|
|
426
|
-
}
|
|
427
|
-
function generateLlmsTxtSection() {
|
|
428
|
-
const lines = [];
|
|
429
|
-
lines.push("## llms.txt");
|
|
430
|
-
lines.push("");
|
|
431
|
-
lines.push("This project provides an `llms.txt` file at the repository root \u2014 a plain-text summary");
|
|
432
|
-
lines.push("of the project optimized for LLM consumption. It includes symbols, key files, flows,");
|
|
433
|
-
lines.push("gates, and conventions.");
|
|
434
|
-
lines.push("");
|
|
435
|
-
lines.push("Regenerate with: `paradigm sync-llms`");
|
|
436
|
-
lines.push("");
|
|
437
|
-
return lines.join("\n");
|
|
438
|
-
}
|
|
439
|
-
function generateFooter() {
|
|
440
|
-
const lines = [];
|
|
441
|
-
lines.push("---");
|
|
442
|
-
lines.push("");
|
|
443
|
-
lines.push("## Reference Files");
|
|
444
|
-
lines.push("");
|
|
445
|
-
lines.push("- `.paradigm/specs/symbols.md` - Symbol system reference");
|
|
446
|
-
lines.push("- `.paradigm/specs/logger.md` - Logging specification");
|
|
447
|
-
lines.push("- `.paradigm/specs/scan.md` - Scan protocol");
|
|
448
|
-
lines.push("- `.paradigm/docs/commands.md` - CLI reference");
|
|
449
|
-
lines.push("- `.paradigm/docs/patterns.md` - Coding patterns");
|
|
450
|
-
lines.push("- `.paradigm/docs/troubleshooting.md` - Common issues");
|
|
451
|
-
lines.push("- `.paradigm/prompts/` - Pre-written task prompts");
|
|
452
|
-
lines.push("");
|
|
453
|
-
lines.push("*Generated by Paradigm. Run `paradigm sync` to regenerate.*");
|
|
454
|
-
return lines.join("\n");
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
// src/core/ide-adapters/cursor.ts
|
|
458
|
-
function frontmatter(description, options = {}) {
|
|
459
|
-
const lines = ["---", `description: ${description}`];
|
|
460
|
-
if (options.globs) {
|
|
461
|
-
lines.push(`globs: ${options.globs}`);
|
|
462
|
-
}
|
|
463
|
-
if (options.alwaysApply !== void 0) {
|
|
464
|
-
lines.push(`alwaysApply: ${options.alwaysApply}`);
|
|
465
|
-
}
|
|
466
|
-
lines.push("---", "");
|
|
467
|
-
return lines.join("\n");
|
|
468
|
-
}
|
|
469
|
-
var CursorAdapter = class {
|
|
470
|
-
name = "cursor";
|
|
471
|
-
displayName = "Cursor";
|
|
472
|
-
outputPath = ".cursor/rules";
|
|
473
|
-
multiFile = true;
|
|
474
|
-
detect(rootDir) {
|
|
475
|
-
if (fs.existsSync(path.join(rootDir, ".cursor"))) {
|
|
476
|
-
return true;
|
|
477
|
-
}
|
|
478
|
-
if (fs.existsSync(path.join(rootDir, ".cursorrules"))) {
|
|
479
|
-
return true;
|
|
480
|
-
}
|
|
481
|
-
if (fs.existsSync(path.join(rootDir, ".vscode"))) {
|
|
482
|
-
return true;
|
|
483
|
-
}
|
|
484
|
-
return false;
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* Generate single file content (legacy fallback)
|
|
488
|
-
*/
|
|
489
|
-
generate(files) {
|
|
490
|
-
const generatedFiles = this.generateFiles(files);
|
|
491
|
-
return generatedFiles.map((f) => `# ${f.path}
|
|
492
|
-
|
|
493
|
-
${f.content}`).join("\n\n---\n\n");
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* Generate multiple .mdc files for the modern Cursor format
|
|
497
|
-
*/
|
|
498
|
-
generateFiles(files, rootDir) {
|
|
499
|
-
const { config, projectName } = files;
|
|
500
|
-
const generatedFiles = [];
|
|
501
|
-
generatedFiles.push({
|
|
502
|
-
path: "paradigm-core.mdc",
|
|
503
|
-
content: this.generateCoreRules(projectName, config)
|
|
504
|
-
});
|
|
505
|
-
generatedFiles.push({
|
|
506
|
-
path: "paradigm-workflow.mdc",
|
|
507
|
-
content: this.generateWorkflowMdc()
|
|
508
|
-
});
|
|
509
|
-
generatedFiles.push({
|
|
510
|
-
path: "paradigm-symbols.mdc",
|
|
511
|
-
content: this.generateSymbolRules(config)
|
|
512
|
-
});
|
|
513
|
-
const loggingContent = generateLoggingRules(config);
|
|
514
|
-
if (loggingContent) {
|
|
515
|
-
generatedFiles.push({
|
|
516
|
-
path: "paradigm-logging.mdc",
|
|
517
|
-
content: this.generateLoggingMdc(config)
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
generatedFiles.push({
|
|
521
|
-
path: "paradigm-purpose.mdc",
|
|
522
|
-
content: this.generatePurposeMdc()
|
|
523
|
-
});
|
|
524
|
-
generatedFiles.push({
|
|
525
|
-
path: "paradigm-portal.mdc",
|
|
526
|
-
content: this.generatePortalMdc()
|
|
527
|
-
});
|
|
528
|
-
generatedFiles.push({
|
|
529
|
-
path: "paradigm-commands.mdc",
|
|
530
|
-
content: this.generateCommandsMdc()
|
|
531
|
-
});
|
|
532
|
-
generatedFiles.push({
|
|
533
|
-
path: "paradigm-conventions.mdc",
|
|
534
|
-
content: this.generateConventionsMdc(config)
|
|
535
|
-
});
|
|
536
|
-
generatedFiles.push({
|
|
537
|
-
path: "paradigm-agent-hints.mdc",
|
|
538
|
-
content: this.generateAgentHintsMdc()
|
|
539
|
-
});
|
|
540
|
-
generatedFiles.push({
|
|
541
|
-
path: "paradigm-navigator.mdc",
|
|
542
|
-
content: this.generateNavigatorMdc()
|
|
543
|
-
});
|
|
544
|
-
generatedFiles.push({
|
|
545
|
-
path: "paradigm-context.mdc",
|
|
546
|
-
content: this.generateContextMdc()
|
|
547
|
-
});
|
|
548
|
-
const agentsManifest = rootDir ? this.loadAgentsManifest(rootDir) : null;
|
|
549
|
-
generatedFiles.push({
|
|
550
|
-
path: "paradigm-orchestration.mdc",
|
|
551
|
-
content: this.generateOrchestrationMdc(agentsManifest)
|
|
552
|
-
});
|
|
553
|
-
generatedFiles.push({
|
|
554
|
-
path: "paradigm-flows.mdc",
|
|
555
|
-
content: this.generateFlowsMdc()
|
|
556
|
-
});
|
|
557
|
-
generatedFiles.push({
|
|
558
|
-
path: "paradigm-practices.mdc",
|
|
559
|
-
content: this.generatePracticesMdc()
|
|
560
|
-
});
|
|
561
|
-
generatedFiles.push({
|
|
562
|
-
path: "paradigm-commits.mdc",
|
|
563
|
-
content: this.generateCommitsMdc()
|
|
564
|
-
});
|
|
565
|
-
return generatedFiles;
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* Core rules - project overview and fundamentals
|
|
569
|
-
*/
|
|
570
|
-
generateCoreRules(projectName, config) {
|
|
571
|
-
const overview = generateOverview(config);
|
|
572
|
-
return frontmatter("Paradigm core rules - project overview and fundamentals", { alwaysApply: true }) + `# Paradigm - ${projectName}
|
|
573
|
-
|
|
574
|
-
> **Author:** Matt Canoy ([@ascend42](https://github.com/ascend42)) | **Repo:** [github.com/ascend42/a-paradigm](https://github.com/ascend42/a-paradigm) | **npm:** [@a-company/paradigm](https://www.npmjs.com/package/@a-company/paradigm)
|
|
575
|
-
|
|
576
|
-
## CRITICAL RULES (Non-Negotiable)
|
|
577
|
-
|
|
578
|
-
1. **You MUST update the nearest \`.purpose\` file when you change behavior.** No exceptions.
|
|
579
|
-
2. **You MUST call \`paradigm_session_recover\` at session start and \`paradigm_pm_postflight\` when finishing.** See \`paradigm-workflow.mdc\` for the full protocol.
|
|
580
|
-
3. **You MUST call \`paradigm_ripple\` before modifying any documented symbol.** Check impact before changing code.
|
|
581
|
-
|
|
582
|
-
Violating these rules means your changes are non-compliant. The \`paradigm-workflow.mdc\` file contains the complete workflow \u2014 follow it.
|
|
583
|
-
|
|
584
|
-
` + overview + "\n\n" + generateUpdateRules(config);
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* Symbol system rules
|
|
588
|
-
*/
|
|
589
|
-
generateSymbolRules(config) {
|
|
590
|
-
return frontmatter("Paradigm symbol system - understand #components, $flows, ^gates, !signals, ~aspects", { alwaysApply: true }) + generateSymbolSystem(config);
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* Logging rules for TypeScript/JavaScript
|
|
594
|
-
*/
|
|
595
|
-
generateLoggingMdc(config) {
|
|
596
|
-
return frontmatter("Paradigm logger usage for TypeScript/JavaScript code", {
|
|
597
|
-
globs: "**/*.{ts,tsx,js,jsx}",
|
|
598
|
-
alwaysApply: false
|
|
599
|
-
}) + generateLoggingRules(config);
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* Purpose file conventions
|
|
603
|
-
*/
|
|
604
|
-
generatePurposeMdc() {
|
|
605
|
-
return frontmatter("Purpose file conventions - .purpose file format and usage", {
|
|
606
|
-
globs: "**/.purpose",
|
|
607
|
-
alwaysApply: false
|
|
608
|
-
}) + `# Purpose Files
|
|
609
|
-
|
|
610
|
-
Purpose files (\`.purpose\`) define the context for directories.
|
|
611
|
-
|
|
612
|
-
## Format
|
|
613
|
-
|
|
614
|
-
\`\`\`yaml
|
|
615
|
-
# Directory context
|
|
616
|
-
description: What this directory contains and why
|
|
617
|
-
|
|
618
|
-
# Components (# symbol) \u2014 all documented code units
|
|
619
|
-
components:
|
|
620
|
-
component-name:
|
|
621
|
-
description: What this component does
|
|
622
|
-
tags: [feature] # Classification via tag bank
|
|
623
|
-
gates: [^gate1, ^gate2] # Required gates
|
|
624
|
-
signals: [!signal1] # Events emitted
|
|
625
|
-
used-by: [#other-component]
|
|
626
|
-
\`\`\`
|
|
627
|
-
|
|
628
|
-
## Symbol References (v2)
|
|
629
|
-
|
|
630
|
-
- Reference components: \`#component-name\`
|
|
631
|
-
- Reference flows: \`$flow-name\`
|
|
632
|
-
- Reference gates: \`^gate-name\`
|
|
633
|
-
- Reference signals: \`!signal-name\`
|
|
634
|
-
- Reference aspects: \`~aspect-name\`
|
|
635
|
-
`;
|
|
636
|
-
}
|
|
637
|
-
/**
|
|
638
|
-
* Portal rules
|
|
639
|
-
*/
|
|
640
|
-
generatePortalMdc() {
|
|
641
|
-
return frontmatter("Portal (gate) configuration rules", {
|
|
642
|
-
globs: "**/portal.yaml",
|
|
643
|
-
alwaysApply: false
|
|
644
|
-
}) + `# Portal Configuration
|
|
645
|
-
|
|
646
|
-
Portal files (\`portal.yaml\`) define authorization topology.
|
|
647
|
-
|
|
648
|
-
## Format
|
|
649
|
-
|
|
650
|
-
\`\`\`yaml
|
|
651
|
-
version: "1.0"
|
|
652
|
-
|
|
653
|
-
gates:
|
|
654
|
-
gate-name:
|
|
655
|
-
description: What this gate protects
|
|
656
|
-
locks:
|
|
657
|
-
- id: lock-id
|
|
658
|
-
description: Requirement description
|
|
659
|
-
keys:
|
|
660
|
-
- expression: "user.authenticated"
|
|
661
|
-
description: User must be logged in
|
|
662
|
-
prizes:
|
|
663
|
-
- id: prize-id
|
|
664
|
-
oneTime: true
|
|
665
|
-
metadata:
|
|
666
|
-
event: "gate_passed"
|
|
667
|
-
|
|
668
|
-
flows:
|
|
669
|
-
flow-name:
|
|
670
|
-
description: User journey
|
|
671
|
-
gates: [gate1, gate2, gate3]
|
|
672
|
-
\`\`\`
|
|
673
|
-
|
|
674
|
-
## Portal Validation
|
|
675
|
-
|
|
676
|
-
Use the Portal Validator for authorization checks:
|
|
677
|
-
|
|
678
|
-
\`\`\`typescript
|
|
679
|
-
import { portal } from '@a-company/portal-sdk/validator';
|
|
680
|
-
|
|
681
|
-
const gate = portal.check('^gate-name')
|
|
682
|
-
.requires('requirement description')
|
|
683
|
-
.context({ userId, role });
|
|
684
|
-
|
|
685
|
-
if (!condition) {
|
|
686
|
-
gate.deny('Reason for denial');
|
|
687
|
-
return redirect('/unauthorized');
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
gate.allow('Access granted');
|
|
691
|
-
\`\`\`
|
|
692
|
-
`;
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Commands reference
|
|
696
|
-
*/
|
|
697
|
-
generateCommandsMdc() {
|
|
698
|
-
return frontmatter("Paradigm CLI commands reference", { alwaysApply: false }) + generateCommandsReference();
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* Conventions
|
|
702
|
-
*/
|
|
703
|
-
generateConventionsMdc(config) {
|
|
704
|
-
return frontmatter("Paradigm coding conventions", {
|
|
705
|
-
globs: "**/*.{ts,tsx,js,jsx}",
|
|
706
|
-
alwaysApply: false
|
|
707
|
-
}) + generateConventions(config);
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Agent Hints - MCP-first queries for AI agents
|
|
711
|
-
*/
|
|
712
|
-
generateAgentHintsMdc() {
|
|
713
|
-
return frontmatter("Paradigm MCP tool queries for AI agents - use MCP tools instead of reading large files or running CLI commands", {
|
|
714
|
-
alwaysApply: true
|
|
715
|
-
}) + `# Agent MCP Queries (Token-Efficient)
|
|
716
|
-
|
|
717
|
-
**Use MCP tool calls, NOT CLI commands.** MCP tools return structured data directly \u2014 no shell overhead, no parsing, no latency.
|
|
718
|
-
|
|
719
|
-
## When to Query
|
|
720
|
-
|
|
721
|
-
| Before doing this... | Call this MCP tool |
|
|
722
|
-
|---------------------|-------------------|
|
|
723
|
-
| Modifying a symbol | \`paradigm_ripple({ symbol: "#symbol" })\` |
|
|
724
|
-
| Debugging / searching | \`paradigm_search({ query: "ERROR_CODE" })\` |
|
|
725
|
-
| Starting a session | \`paradigm_session_recover()\` |
|
|
726
|
-
| Understanding relationships | \`paradigm_navigate({ intent: "find", target: "#symbol" })\` |
|
|
727
|
-
| Getting oriented | \`paradigm_status()\` |
|
|
728
|
-
| Checking impact on flows | \`paradigm_flows_affected({ symbol: "#symbol" })\` |
|
|
729
|
-
| Adding API endpoints | \`paradigm_gates_for_route({ method: "POST", path: "/api/resource" })\` |
|
|
730
|
-
|
|
731
|
-
## Query Patterns
|
|
732
|
-
|
|
733
|
-
### Before Changing Code
|
|
734
|
-
|
|
735
|
-
\`\`\`
|
|
736
|
-
// See what depends on what you're changing
|
|
737
|
-
paradigm_ripple({ symbol: "#checkout" })
|
|
738
|
-
|
|
739
|
-
// Returns: upstream deps, downstream effects, flow membership
|
|
740
|
-
\`\`\`
|
|
741
|
-
|
|
742
|
-
### When Debugging
|
|
743
|
-
|
|
744
|
-
\`\`\`
|
|
745
|
-
// Search for error context
|
|
746
|
-
paradigm_search({ query: "AUTH_REQUIRED" })
|
|
747
|
-
|
|
748
|
-
// Then check ripple effects of the related symbol
|
|
749
|
-
paradigm_ripple({ symbol: "^authenticated" })
|
|
750
|
-
\`\`\`
|
|
751
|
-
|
|
752
|
-
### Starting Work
|
|
753
|
-
|
|
754
|
-
\`\`\`
|
|
755
|
-
// Load previous session context (MUST do this at session start)
|
|
756
|
-
paradigm_session_recover()
|
|
757
|
-
|
|
758
|
-
// Quick project orientation
|
|
759
|
-
paradigm_status()
|
|
760
|
-
\`\`\`
|
|
761
|
-
|
|
762
|
-
### Finding Code Locations
|
|
763
|
-
|
|
764
|
-
\`\`\`
|
|
765
|
-
// Find a specific symbol
|
|
766
|
-
paradigm_navigate({ intent: "find", target: "#checkout" })
|
|
767
|
-
|
|
768
|
-
// Explore an area of code
|
|
769
|
-
paradigm_navigate({ intent: "explore", target: "authentication" })
|
|
770
|
-
|
|
771
|
-
// Get context for a task
|
|
772
|
-
paradigm_navigate({ intent: "context", task: "add Apple Pay" })
|
|
773
|
-
\`\`\`
|
|
774
|
-
|
|
775
|
-
## Why MCP Over CLI
|
|
776
|
-
|
|
777
|
-
- **No shell overhead**: Direct structured responses, no \`--json\` flags or \`jq\` parsing
|
|
778
|
-
- **Fresh data**: Always current, not stale from file generation
|
|
779
|
-
- **Precise**: Only get the data you need
|
|
780
|
-
- **Token-efficient**: ~100-300 tokens per query vs ~2000 for file reads
|
|
781
|
-
- **No latency**: No process spawn \u2014 MCP tools respond directly
|
|
782
|
-
`;
|
|
783
|
-
}
|
|
784
|
-
/**
|
|
785
|
-
* Navigator rules - AI exploration optimization
|
|
786
|
-
*/
|
|
787
|
-
generateNavigatorMdc() {
|
|
788
|
-
return frontmatter("Paradigm Navigator - efficient codebase exploration", {
|
|
789
|
-
alwaysApply: true
|
|
790
|
-
}) + `# Paradigm Navigator
|
|
791
|
-
|
|
792
|
-
## Exploration Protocol
|
|
793
|
-
|
|
794
|
-
Before exploring this codebase:
|
|
795
|
-
|
|
796
|
-
1. **Read \`.paradigm/navigator.yaml\`** for the structure map
|
|
797
|
-
2. **Query by symbol** - lookup paths directly from the symbols map
|
|
798
|
-
3. **Respect skip patterns** - avoid node_modules, dist, .git, etc.
|
|
799
|
-
|
|
800
|
-
## Navigation Strategy
|
|
801
|
-
|
|
802
|
-
**INSTEAD OF:** Broad exploration (expensive token usage)
|
|
803
|
-
|
|
804
|
-
**DO THIS:**
|
|
805
|
-
1. Read \`.paradigm/navigator.yaml\` for project structure
|
|
806
|
-
2. Find relevant symbol \u2192 go directly to path
|
|
807
|
-
3. Read only needed files
|
|
808
|
-
|
|
809
|
-
## Using MCP Navigate Tool
|
|
810
|
-
|
|
811
|
-
\`\`\`
|
|
812
|
-
# Find a specific symbol
|
|
813
|
-
paradigm_navigate({ intent: "find", target: "#checkout" })
|
|
814
|
-
|
|
815
|
-
# Explore an area
|
|
816
|
-
paradigm_navigate({ intent: "explore", target: "authentication" })
|
|
817
|
-
|
|
818
|
-
# Get context for a task
|
|
819
|
-
paradigm_navigate({ intent: "context", task: "add Apple Pay" })
|
|
820
|
-
\`\`\`
|
|
821
|
-
|
|
822
|
-
## Task Recipes
|
|
823
|
-
|
|
824
|
-
### Adding a Feature
|
|
825
|
-
1. Check \`navigator.yaml\` \u2192 \`structure.features.paths\`
|
|
826
|
-
2. Read an existing feature as template
|
|
827
|
-
3. Create in the same location
|
|
828
|
-
|
|
829
|
-
### Modifying a Component
|
|
830
|
-
1. Look up symbol in \`navigator.yaml\` \u2192 \`symbols\`
|
|
831
|
-
2. Go directly to the path
|
|
832
|
-
3. Use \`paradigm_ripple\` to check impact
|
|
833
|
-
|
|
834
|
-
### Understanding Dependencies
|
|
835
|
-
1. Use \`paradigm_navigate({ intent: "context", task: "..." })\`
|
|
836
|
-
2. Read suggested files in order
|
|
837
|
-
3. Skip patterns in the \`skip\` array
|
|
838
|
-
|
|
839
|
-
## Key Files (Quick Reference)
|
|
840
|
-
|
|
841
|
-
Always available in \`navigator.yaml\`:
|
|
842
|
-
- \`key_files.config\` - Configuration files
|
|
843
|
-
- \`key_files.entry\` - Entry points
|
|
844
|
-
- \`key_files.types\` - Type definitions
|
|
845
|
-
`;
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Context monitoring rules - session management and handoff
|
|
849
|
-
*/
|
|
850
|
-
generateContextMdc() {
|
|
851
|
-
return frontmatter("Session recovery and handoff - call paradigm_session_recover at session start, paradigm_context_check periodically during long sessions, paradigm_handoff_prepare when context is high.") + `# Context Monitoring Protocol
|
|
852
|
-
|
|
853
|
-
## Session Start (EVERY new session)
|
|
854
|
-
|
|
855
|
-
Call \`paradigm_session_recover\` to load previous session breadcrumbs.
|
|
856
|
-
Returns: symbols modified, files explored, recent actions, and suggestions.
|
|
857
|
-
|
|
858
|
-
## Periodic Checks
|
|
859
|
-
|
|
860
|
-
**Every 10-15 tool calls** (or when user asks about context), call:
|
|
861
|
-
|
|
862
|
-
\`\`\`
|
|
863
|
-
paradigm_context_check()
|
|
864
|
-
\`\`\`
|
|
865
|
-
|
|
866
|
-
This returns a recommendation: \`continue\`, \`consider-handoff\`, \`handoff-recommended\`, or \`handoff-urgent\`.
|
|
867
|
-
|
|
868
|
-
## When to Handoff
|
|
869
|
-
|
|
870
|
-
| Usage | Recommendation | Action |
|
|
871
|
-
|-------|----------------|--------|
|
|
872
|
-
| <50% | continue | Keep working |
|
|
873
|
-
| 50-70% | consider-handoff | Plan handoff; prepare summary when ready |
|
|
874
|
-
| 70-85% | handoff-recommended | Prepare handoff soon |
|
|
875
|
-
| >85% | handoff-urgent | Handoff after current task |
|
|
876
|
-
|
|
877
|
-
## When Recommendation is NOT "continue"
|
|
878
|
-
|
|
879
|
-
1. **Inform user**: "Context usage is at ~X%. Recommend handoff soon."
|
|
880
|
-
2. **Offer to prepare**: Ask if user wants handoff summary
|
|
881
|
-
3. **If urgent (>85%)**: Prioritize completing current task, then handoff
|
|
882
|
-
|
|
883
|
-
## Handoff Process
|
|
884
|
-
|
|
885
|
-
1. Call \`paradigm_handoff_prepare\` with:
|
|
886
|
-
- Summary of work completed
|
|
887
|
-
- List of next steps
|
|
888
|
-
- Target agent role
|
|
889
|
-
|
|
890
|
-
2. User runs CLI command:
|
|
891
|
-
\`\`\`bash
|
|
892
|
-
paradigm team handoff --to <agent> --summary "..."
|
|
893
|
-
\`\`\`
|
|
894
|
-
|
|
895
|
-
3. New session accepts:
|
|
896
|
-
\`\`\`bash
|
|
897
|
-
paradigm team accept <handoff-id>
|
|
898
|
-
\`\`\`
|
|
899
|
-
|
|
900
|
-
## Session Stats
|
|
901
|
-
|
|
902
|
-
Get current stats anytime:
|
|
903
|
-
\`\`\`
|
|
904
|
-
paradigm_session_stats()
|
|
905
|
-
\`\`\`
|
|
906
|
-
|
|
907
|
-
${generateCheckpointProtocol()}`;
|
|
908
|
-
}
|
|
909
|
-
/**
|
|
910
|
-
* Workflow protocol - the single most important compliance file.
|
|
911
|
-
* Contains session bookends, task-size guide, essential MCP tools, and non-negotiable rules.
|
|
912
|
-
*/
|
|
913
|
-
generateWorkflowMdc() {
|
|
914
|
-
return frontmatter("Paradigm workflow protocol - MUST follow for every task. Session bookends, task-size compliance, essential MCP tools.", {
|
|
915
|
-
alwaysApply: true
|
|
916
|
-
}) + `# Paradigm Workflow Protocol
|
|
917
|
-
|
|
918
|
-
**This file defines the non-negotiable workflow for every task. Follow it.**
|
|
919
|
-
|
|
920
|
-
## Session Bookends (MUST Do)
|
|
921
|
-
|
|
922
|
-
### Session Start
|
|
923
|
-
\`\`\`
|
|
924
|
-
paradigm_session_recover()
|
|
925
|
-
\`\`\`
|
|
926
|
-
Call this FIRST in every session. Returns previous context, modified symbols, and suggestions.
|
|
927
|
-
|
|
928
|
-
### Session End
|
|
929
|
-
\`\`\`
|
|
930
|
-
paradigm_pm_postflight({ summary: "what you did" })
|
|
931
|
-
\`\`\`
|
|
932
|
-
Call this LAST before finishing. Catches missing .purpose files, missing gates, and compliance gaps.
|
|
933
|
-
|
|
934
|
-
## Task-Size Compliance Guide
|
|
935
|
-
|
|
936
|
-
Not every task needs the full ceremony. Match your effort to the scope:
|
|
937
|
-
|
|
938
|
-
### Single-file bug fix (1 file changed)
|
|
939
|
-
1. Session bookends (start + end)
|
|
940
|
-
2. That's it \u2014 fix the bug, run postflight
|
|
941
|
-
|
|
942
|
-
### Multi-file fix (2-3 files changed)
|
|
943
|
-
1. Session bookends
|
|
944
|
-
2. \`paradigm_ripple({ symbol: "#affected-symbol" })\` before changing
|
|
945
|
-
3. Update nearest \`.purpose\` file if behavior changed
|
|
946
|
-
4. Postflight
|
|
947
|
-
|
|
948
|
-
### Feature build (3+ files, new behavior)
|
|
949
|
-
1. Session bookends
|
|
950
|
-
2. \`paradigm_pm_preflight({ task: "description" })\` \u2014 get compliance plan
|
|
951
|
-
3. \`paradigm_ripple\` for each symbol you'll modify
|
|
952
|
-
4. Implement the feature
|
|
953
|
-
5. Create/update \`.purpose\` files for new directories
|
|
954
|
-
6. Update \`portal.yaml\` if adding protected routes
|
|
955
|
-
7. \`paradigm_pm_postflight\` \u2014 verify compliance
|
|
956
|
-
8. \`paradigm_lore_record\` \u2014 record what you learned
|
|
957
|
-
|
|
958
|
-
## The One Non-Negotiable Rule
|
|
959
|
-
|
|
960
|
-
**You MUST update the nearest \`.purpose\` file when you change behavior.**
|
|
961
|
-
|
|
962
|
-
- Adding a feature? Create a \`.purpose\` in the feature directory.
|
|
963
|
-
- Modifying a component? Update its \`.purpose\` description, gates, or signals.
|
|
964
|
-
- Deleting code? Remove the symbol from \`.purpose\`.
|
|
965
|
-
- Not sure? Run \`paradigm_pm_postflight\` \u2014 it will tell you what's missing.
|
|
966
|
-
|
|
967
|
-
## Essential MCP Tools (Use These, NOT CLI Commands)
|
|
968
|
-
|
|
969
|
-
| Tool | When | Cost |
|
|
970
|
-
|------|------|------|
|
|
971
|
-
| \`paradigm_session_recover\` | Session start | ~100 tokens |
|
|
972
|
-
| \`paradigm_ripple\` | Before modifying any symbol | ~300 tokens |
|
|
973
|
-
| \`paradigm_navigate\` | Finding code locations | ~200 tokens |
|
|
974
|
-
| \`paradigm_pm_preflight\` | Before starting a feature (3+ files) | ~200 tokens |
|
|
975
|
-
| \`paradigm_pm_postflight\` | After finishing any task | ~200 tokens |
|
|
976
|
-
| \`paradigm_reindex\` | After creating/modifying .purpose files | ~100 tokens |
|
|
977
|
-
| \`paradigm_gates_for_route\` | Before adding API endpoints | ~150 tokens |
|
|
978
|
-
| \`paradigm_lore_record\` | After completing a feature (record learnings) | ~100 tokens |
|
|
979
|
-
|
|
980
|
-
## Red Flags \u2014 STOP and Check
|
|
981
|
-
|
|
982
|
-
If you find yourself doing any of these, STOP:
|
|
983
|
-
|
|
984
|
-
- **Modifying 3+ files without calling \`paradigm_ripple\`** \u2192 Check impact first
|
|
985
|
-
- **Adding routes without checking \`paradigm_gates_for_route\`** \u2192 Get gate suggestions
|
|
986
|
-
- **Finishing without running \`paradigm_pm_postflight\`** \u2192 You'll miss compliance gaps
|
|
987
|
-
- **Creating directories without a \`.purpose\` file** \u2192 Every directory needs context
|
|
988
|
-
`;
|
|
989
|
-
}
|
|
990
|
-
/**
|
|
991
|
-
* Practices - habits compliance, lore recording, llms.txt (Phase 5/6 content)
|
|
992
|
-
*/
|
|
993
|
-
generatePracticesMdc() {
|
|
994
|
-
return frontmatter("Paradigm practices - habits, lore recording, and llms.txt. Apply when finishing tasks, recording history, or checking compliance.", {
|
|
995
|
-
alwaysApply: false
|
|
996
|
-
}) + `# Paradigm Practices
|
|
997
|
-
|
|
998
|
-
` + generateHabitsSection() + "\n\n" + generateLoreSection() + "\n\n" + generateLlmsTxtSection();
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* Load agents manifest from .paradigm/agents.yaml
|
|
1002
|
-
*/
|
|
1003
|
-
loadAgentsManifest(rootDir) {
|
|
1004
|
-
const agentsPath = path.join(rootDir, ".paradigm", "agents.yaml");
|
|
1005
|
-
if (!fs.existsSync(agentsPath)) {
|
|
1006
|
-
return null;
|
|
1007
|
-
}
|
|
1008
|
-
try {
|
|
1009
|
-
const content = fs.readFileSync(agentsPath, "utf-8");
|
|
1010
|
-
return yaml.load(content);
|
|
1011
|
-
} catch {
|
|
1012
|
-
return null;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
/**
|
|
1016
|
-
* Orchestration protocol rules - multi-agent workflow
|
|
1017
|
-
*/
|
|
1018
|
-
generateOrchestrationMdc(agentsManifest) {
|
|
1019
|
-
let agentList = "(Run `paradigm team init` to configure agents)";
|
|
1020
|
-
if (agentsManifest) {
|
|
1021
|
-
const agents = agentsManifest.agents || agentsManifest.roles;
|
|
1022
|
-
if (agents && typeof agents === "object") {
|
|
1023
|
-
try {
|
|
1024
|
-
agentList = Object.entries(agents).map(([name, agent]) => {
|
|
1025
|
-
const roleText = agent.role || agent.description || "";
|
|
1026
|
-
const roleFirstLine = roleText.split("\n")[0].trim() || name;
|
|
1027
|
-
const writes = agent.focus?.writes;
|
|
1028
|
-
const writesStr = Array.isArray(writes) ? writes.join(", ") : "any";
|
|
1029
|
-
const model = agent.defaultModel || "sonnet";
|
|
1030
|
-
return `- **${name}** (${model}): ${roleFirstLine} (writes: ${writesStr})`;
|
|
1031
|
-
}).join("\n");
|
|
1032
|
-
} catch {
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
const platform2 = os.platform();
|
|
1037
|
-
const isWindows = platform2 === "win32";
|
|
1038
|
-
const terminalGuidance = isWindows ? `## Terminal Syntax (Windows)
|
|
1039
|
-
|
|
1040
|
-
This project runs on **Windows**. Use appropriate syntax:
|
|
1041
|
-
|
|
1042
|
-
| Operation | Windows Syntax |
|
|
1043
|
-
|-----------|----------------|
|
|
1044
|
-
| Chain commands | \`cmd1 ; cmd2\` or \`cmd1 && cmd2\` (PowerShell) |
|
|
1045
|
-
| Path separator | \`\\\` (backslash) |
|
|
1046
|
-
| Environment vars | \`$env:VAR\` (PowerShell) or \`%VAR%\` (CMD) |
|
|
1047
|
-
| Null device | \`$null\` (PowerShell) or \`NUL\` (CMD) |
|
|
1048
|
-
| List files | \`dir\` or \`Get-ChildItem\` |
|
|
1049
|
-
| Remove files | \`del\` or \`Remove-Item\` |
|
|
1050
|
-
|
|
1051
|
-
**IMPORTANT:** Do NOT use Unix-style commands like \`rm\`, \`cat\`, \`grep\` directly.` : `## Terminal Syntax (${platform2 === "darwin" ? "macOS" : "Linux"})
|
|
1052
|
-
|
|
1053
|
-
This project runs on **${platform2 === "darwin" ? "macOS" : "Linux"}**. Use appropriate syntax:
|
|
1054
|
-
|
|
1055
|
-
| Operation | Unix Syntax |
|
|
1056
|
-
|-----------|-------------|
|
|
1057
|
-
| Chain commands | \`cmd1 && cmd2\` (stop on error) or \`cmd1 ; cmd2\` (always continue) |
|
|
1058
|
-
| Path separator | \`/\` (forward slash) |
|
|
1059
|
-
| Environment vars | \`$VAR\` or \`\${VAR}\` |
|
|
1060
|
-
| Null device | \`/dev/null\` |
|
|
1061
|
-
| List files | \`ls\` |
|
|
1062
|
-
| Remove files | \`rm\` |
|
|
1063
|
-
|
|
1064
|
-
**IMPORTANT:** Do NOT use Windows-style commands like \`dir\`, \`del\`, or \`%VAR%\`.`;
|
|
1065
|
-
return frontmatter("Multi-agent orchestration - use when task affects 3+ files, involves security AND implementation, or spans multiple features. Call paradigm_orchestrate_inline for planning.") + `# Paradigm Orchestration Protocol
|
|
1066
|
-
|
|
1067
|
-
${terminalGuidance}
|
|
1068
|
-
|
|
1069
|
-
## CRITICAL: When to Use Orchestration
|
|
1070
|
-
|
|
1071
|
-
**ALWAYS call \`paradigm_orchestrate_inline\` FIRST when:**
|
|
1072
|
-
- Task affects 3+ files
|
|
1073
|
-
- Task involves security/auth AND implementation
|
|
1074
|
-
- Task mentions multiple features (#symbols)
|
|
1075
|
-
- Building a new feature end-to-end
|
|
1076
|
-
- User explicitly requests multi-agent workflow
|
|
1077
|
-
|
|
1078
|
-
## Workflow
|
|
1079
|
-
|
|
1080
|
-
1. **Plan first:** \`paradigm_orchestrate_inline({ task: "...", mode: "plan" })\`
|
|
1081
|
-
- Review suggested agents and estimated tokens
|
|
1082
|
-
- Check if parallel execution is possible
|
|
1083
|
-
|
|
1084
|
-
2. **Execute:** \`paradigm_orchestrate_inline({ task: "...", mode: "execute" })\`
|
|
1085
|
-
- Get full prompts and execution strategy
|
|
1086
|
-
- Note which stages can run in parallel
|
|
1087
|
-
|
|
1088
|
-
3. **Follow the plan sequentially:**
|
|
1089
|
-
- For each stage/agent, adopt that role's prompt and focus areas
|
|
1090
|
-
- Stage 0 (architect): Design and spec only \u2014 do NOT write implementation code
|
|
1091
|
-
- Stage 1 (builder): Implement following the architect's design
|
|
1092
|
-
- Stage 2 (tester/reviewer): Verify and test the implementation
|
|
1093
|
-
- Pass context between phases as if handing off to a teammate
|
|
1094
|
-
|
|
1095
|
-
4. **For true parallel execution**, suggest user runs:
|
|
1096
|
-
\`paradigm team orchestrate "task description"\`
|
|
1097
|
-
|
|
1098
|
-
5. **Record history:** \`paradigm_history_record({ type: "implement", symbols: [...], description: "..." })\`
|
|
1099
|
-
|
|
1100
|
-
## Available Agents
|
|
1101
|
-
|
|
1102
|
-
${agentList}
|
|
1103
|
-
|
|
1104
|
-
## Red Flags - STOP and Orchestrate
|
|
1105
|
-
|
|
1106
|
-
If you find yourself:
|
|
1107
|
-
- Implementing 5+ files without planning \u2192 STOP, call orchestrate
|
|
1108
|
-
- Adding auth without security review \u2192 STOP, involve security agent
|
|
1109
|
-
- Writing code without specs \u2192 STOP, involve architect first
|
|
1110
|
-
- Making cross-cutting changes \u2192 STOP, plan the stages
|
|
1111
|
-
|
|
1112
|
-
## DO NOT Skip Orchestration
|
|
1113
|
-
|
|
1114
|
-
Complex tasks need specialist agents. One agent trying to do everything leads to:
|
|
1115
|
-
- Missed security gates
|
|
1116
|
-
- Inconsistent patterns
|
|
1117
|
-
- Poor test coverage
|
|
1118
|
-
- Context overflow
|
|
1119
|
-
|
|
1120
|
-
## CLI Shortcut
|
|
1121
|
-
|
|
1122
|
-
You can also suggest agents via CLI:
|
|
1123
|
-
\`\`\`bash
|
|
1124
|
-
paradigm team agents suggest "Add user authentication with JWT"
|
|
1125
|
-
\`\`\`
|
|
1126
|
-
`;
|
|
1127
|
-
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Flow-First Development rules
|
|
1130
|
-
*/
|
|
1131
|
-
generateFlowsMdc() {
|
|
1132
|
-
return frontmatter("Flow-first development - apply when implementing features spanning multiple steps, requiring gates, or emitting signals. Define $flows before coding.") + `# Flow-First Development
|
|
1133
|
-
|
|
1134
|
-
## What are Flows?
|
|
1135
|
-
|
|
1136
|
-
Flows ($symbols) are composable sequences of gates, actions, and signals that represent the "happy path" for a feature.
|
|
1137
|
-
|
|
1138
|
-
\`\`\`yaml
|
|
1139
|
-
# .paradigm/flows.yaml
|
|
1140
|
-
flows:
|
|
1141
|
-
$task-creation:
|
|
1142
|
-
name: Task Creation Flow
|
|
1143
|
-
description: Complete flow for creating a new task
|
|
1144
|
-
trigger: "POST /api/tasks"
|
|
1145
|
-
steps:
|
|
1146
|
-
- type: gate
|
|
1147
|
-
symbol: ^authenticated
|
|
1148
|
-
description: User must be logged in
|
|
1149
|
-
- type: gate
|
|
1150
|
-
symbol: ^project-member
|
|
1151
|
-
description: User must be member of target project
|
|
1152
|
-
- type: action
|
|
1153
|
-
symbol: "#validate-task-input"
|
|
1154
|
-
description: Validate task data
|
|
1155
|
-
- type: action
|
|
1156
|
-
symbol: "#create-task"
|
|
1157
|
-
description: Create task in database
|
|
1158
|
-
- type: signal
|
|
1159
|
-
symbol: "!task-created"
|
|
1160
|
-
description: Emit success event
|
|
1161
|
-
successSignal: "!task-created"
|
|
1162
|
-
failureSignal: "!task-creation-failed"
|
|
1163
|
-
\`\`\`
|
|
1164
|
-
|
|
1165
|
-
## When to Define Flows
|
|
1166
|
-
|
|
1167
|
-
**BEFORE implementing features that:**
|
|
1168
|
-
- Span multiple steps or components
|
|
1169
|
-
- Require authorization gates
|
|
1170
|
-
- Emit signals/events
|
|
1171
|
-
- Integrate with external systems
|
|
1172
|
-
|
|
1173
|
-
## Flow-First Protocol
|
|
1174
|
-
|
|
1175
|
-
1. **Define the flow first** in \`.paradigm/flows.yaml\`:
|
|
1176
|
-
- What gates must pass?
|
|
1177
|
-
- What actions occur in what order?
|
|
1178
|
-
- What signals are emitted?
|
|
1179
|
-
|
|
1180
|
-
2. **Validate before implementing:**
|
|
1181
|
-
\`\`\`
|
|
1182
|
-
paradigm_flow_validate({ flowId: "$task-creation" })
|
|
1183
|
-
\`\`\`
|
|
1184
|
-
- Ensures all gates are declared in portal.yaml
|
|
1185
|
-
- Checks for missing symbols
|
|
1186
|
-
|
|
1187
|
-
3. **Implement following the flow:**
|
|
1188
|
-
- Each step becomes a clear implementation target
|
|
1189
|
-
- Gates \u2192 middleware/authorization checks
|
|
1190
|
-
- Actions \u2192 business logic functions
|
|
1191
|
-
- Signals \u2192 event emitters/hooks
|
|
1192
|
-
|
|
1193
|
-
## Flow Validation
|
|
1194
|
-
|
|
1195
|
-
Call \`paradigm_flow_validate\` to check flows:
|
|
1196
|
-
|
|
1197
|
-
\`\`\`
|
|
1198
|
-
// Validate specific flow
|
|
1199
|
-
paradigm_flow_validate({ flowId: "$task-creation" })
|
|
1200
|
-
|
|
1201
|
-
// Validate all flows
|
|
1202
|
-
paradigm_flow_validate({ checkImplementation: true })
|
|
1203
|
-
\`\`\`
|
|
1204
|
-
|
|
1205
|
-
**What gets checked:**
|
|
1206
|
-
- All ^gates are declared in portal.yaml
|
|
1207
|
-
- All #actions reference existing components
|
|
1208
|
-
- All !signals are documented
|
|
1209
|
-
|
|
1210
|
-
## Benefits
|
|
1211
|
-
|
|
1212
|
-
1. **Clear implementation targets** - Each flow step is a discrete unit
|
|
1213
|
-
2. **Gate coverage** - All authorization points are explicit
|
|
1214
|
-
3. **Testability** - Flows can be tested step-by-step
|
|
1215
|
-
4. **Documentation** - The flow IS the documentation
|
|
1216
|
-
5. **Parallel work** - Different team members can implement different steps
|
|
1217
|
-
|
|
1218
|
-
## Red Flags
|
|
1219
|
-
|
|
1220
|
-
**STOP and define a flow if:**
|
|
1221
|
-
- You're implementing a "happy path" without documenting it
|
|
1222
|
-
- You're adding gates without knowing the full sequence
|
|
1223
|
-
- You're emitting signals without knowing what listens
|
|
1224
|
-
- You're modifying existing flows without checking validation
|
|
1225
|
-
|
|
1226
|
-
## MCP Tools
|
|
1227
|
-
|
|
1228
|
-
| Tool | Purpose |
|
|
1229
|
-
|------|---------|
|
|
1230
|
-
| \`paradigm_flow_validate\` | Validate flow definitions |
|
|
1231
|
-
| \`paradigm_flows_affected\` | Check which flows are impacted by symbol changes |
|
|
1232
|
-
|
|
1233
|
-
## CLI Commands
|
|
1234
|
-
|
|
1235
|
-
\`\`\`bash
|
|
1236
|
-
# Validate all flows
|
|
1237
|
-
paradigm flow validate --all
|
|
1238
|
-
|
|
1239
|
-
# Validate specific flow
|
|
1240
|
-
paradigm flow validate $task-creation
|
|
1241
|
-
\`\`\`
|
|
1242
|
-
`;
|
|
1243
|
-
}
|
|
1244
|
-
/**
|
|
1245
|
-
* Commit convention rules
|
|
1246
|
-
*/
|
|
1247
|
-
generateCommitsMdc() {
|
|
1248
|
-
return frontmatter("Paradigm commit conventions with Symbols: trailer - apply when creating git commits for history tracking.") + generateCommitConvention();
|
|
1249
|
-
}
|
|
1250
|
-
/**
|
|
1251
|
-
* Generate MCP configuration for Cursor
|
|
1252
|
-
*/
|
|
1253
|
-
generateMcpConfig(rootDir) {
|
|
1254
|
-
return {
|
|
1255
|
-
mcpServers: {
|
|
1256
|
-
paradigm: {
|
|
1257
|
-
command: "paradigm-mcp",
|
|
1258
|
-
args: ["."],
|
|
1259
|
-
cwd: rootDir
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
};
|
|
1263
|
-
}
|
|
1264
|
-
};
|
|
1265
|
-
var cursorAdapter = new CursorAdapter();
|
|
1266
|
-
|
|
1267
|
-
// src/core/ide-adapters/copilot.ts
|
|
1268
|
-
import * as fs2 from "fs";
|
|
1269
|
-
import * as path2 from "path";
|
|
1270
|
-
function frontmatter2(applyTo, excludeAgent) {
|
|
1271
|
-
if (!applyTo && !excludeAgent) {
|
|
1272
|
-
return "";
|
|
1273
|
-
}
|
|
1274
|
-
const lines = ["---"];
|
|
1275
|
-
if (applyTo) {
|
|
1276
|
-
lines.push(`applyTo: "${applyTo}"`);
|
|
1277
|
-
}
|
|
1278
|
-
if (excludeAgent) {
|
|
1279
|
-
lines.push(`excludeAgent: "${excludeAgent}"`);
|
|
1280
|
-
}
|
|
1281
|
-
lines.push("---", "");
|
|
1282
|
-
return lines.join("\n");
|
|
1283
|
-
}
|
|
1284
|
-
var CopilotAdapter = class {
|
|
1285
|
-
name = "copilot";
|
|
1286
|
-
displayName = "GitHub Copilot";
|
|
1287
|
-
outputPath = ".github/instructions";
|
|
1288
|
-
multiFile = true;
|
|
1289
|
-
detect(rootDir) {
|
|
1290
|
-
if (fs2.existsSync(path2.join(rootDir, ".github", "instructions"))) {
|
|
1291
|
-
return true;
|
|
1292
|
-
}
|
|
1293
|
-
if (fs2.existsSync(path2.join(rootDir, ".github", "copilot-instructions.md"))) {
|
|
1294
|
-
return true;
|
|
1295
|
-
}
|
|
1296
|
-
return false;
|
|
1297
|
-
}
|
|
1298
|
-
/**
|
|
1299
|
-
* Generate single file content (legacy fallback)
|
|
1300
|
-
*/
|
|
1301
|
-
generate(files) {
|
|
1302
|
-
const generatedFiles = this.generateFiles(files);
|
|
1303
|
-
return generatedFiles.map((f) => `# ${f.path}
|
|
1304
|
-
|
|
1305
|
-
${f.content}`).join("\n\n---\n\n");
|
|
1306
|
-
}
|
|
1307
|
-
/**
|
|
1308
|
-
* Generate multiple .instructions.md files for the modern Copilot format
|
|
1309
|
-
*/
|
|
1310
|
-
generateFiles(files) {
|
|
1311
|
-
const { config, projectName } = files;
|
|
1312
|
-
const generatedFiles = [];
|
|
1313
|
-
generatedFiles.push({
|
|
1314
|
-
path: "../copilot-instructions.md",
|
|
1315
|
-
// Goes to .github/copilot-instructions.md
|
|
1316
|
-
content: this.generateCoreInstructions(projectName, config)
|
|
1317
|
-
});
|
|
1318
|
-
generatedFiles.push({
|
|
1319
|
-
path: "paradigm-symbols.instructions.md",
|
|
1320
|
-
content: this.generateSymbolInstructions(config)
|
|
1321
|
-
});
|
|
1322
|
-
const loggingContent = generateLoggingRules(config);
|
|
1323
|
-
if (loggingContent) {
|
|
1324
|
-
generatedFiles.push({
|
|
1325
|
-
path: "paradigm-logging.instructions.md",
|
|
1326
|
-
content: this.generateLoggingInstructions(config)
|
|
1327
|
-
});
|
|
1328
|
-
}
|
|
1329
|
-
generatedFiles.push({
|
|
1330
|
-
path: "paradigm-purpose.instructions.md",
|
|
1331
|
-
content: this.generatePurposeInstructions()
|
|
1332
|
-
});
|
|
1333
|
-
generatedFiles.push({
|
|
1334
|
-
path: "paradigm-portal.instructions.md",
|
|
1335
|
-
content: this.generatePortalInstructions()
|
|
1336
|
-
});
|
|
1337
|
-
generatedFiles.push({
|
|
1338
|
-
path: "paradigm-conventions.instructions.md",
|
|
1339
|
-
content: this.generateConventionsInstructions(config)
|
|
1340
|
-
});
|
|
1341
|
-
generatedFiles.push({
|
|
1342
|
-
path: "paradigm-commands.instructions.md",
|
|
1343
|
-
content: this.generateCommandsInstructions()
|
|
1344
|
-
});
|
|
1345
|
-
generatedFiles.push({
|
|
1346
|
-
path: "paradigm-agent-hints.instructions.md",
|
|
1347
|
-
content: this.generateAgentHintsInstructions()
|
|
1348
|
-
});
|
|
1349
|
-
generatedFiles.push({
|
|
1350
|
-
path: "paradigm-commits.instructions.md",
|
|
1351
|
-
content: this.generateCommitsInstructions()
|
|
1352
|
-
});
|
|
1353
|
-
return generatedFiles;
|
|
1354
|
-
}
|
|
1355
|
-
/**
|
|
1356
|
-
* Core instructions - always applies (via copilot-instructions.md)
|
|
1357
|
-
*/
|
|
1358
|
-
generateCoreInstructions(projectName, config) {
|
|
1359
|
-
const overview = generateOverview(config);
|
|
1360
|
-
return `# Copilot Instructions for ${projectName}
|
|
1361
|
-
|
|
1362
|
-
This file provides context for GitHub Copilot. Generated by Paradigm.
|
|
1363
|
-
|
|
1364
|
-
${overview}
|
|
1365
|
-
|
|
1366
|
-
${generateUpdateRules(config)}
|
|
1367
|
-
|
|
1368
|
-
---
|
|
1369
|
-
|
|
1370
|
-
## Additional Context
|
|
1371
|
-
|
|
1372
|
-
For detailed specifications, reference these files:
|
|
1373
|
-
|
|
1374
|
-
- \`.paradigm/specs/symbols.md\` - Complete symbol reference
|
|
1375
|
-
- \`.paradigm/specs/logger.md\` - Logging specification
|
|
1376
|
-
- \`.paradigm/specs/scan.md\` - Visual discovery protocol
|
|
1377
|
-
- \`.paradigm/docs/\` - Documentation and troubleshooting
|
|
1378
|
-
- \`.paradigm/prompts/\` - Pre-written task prompts
|
|
1379
|
-
|
|
1380
|
-
*Generated by Paradigm. Run \`paradigm sync copilot\` to regenerate.*
|
|
1381
|
-
`;
|
|
1382
|
-
}
|
|
1383
|
-
/**
|
|
1384
|
-
* Symbol system instructions
|
|
1385
|
-
*/
|
|
1386
|
-
generateSymbolInstructions(config) {
|
|
1387
|
-
return frontmatter2("**/*.ts,**/*.tsx,**/*.js,**/*.jsx") + `# Paradigm Symbol System
|
|
1388
|
-
|
|
1389
|
-
${generateSymbolSystem(config)}
|
|
1390
|
-
`;
|
|
1391
|
-
}
|
|
1392
|
-
/**
|
|
1393
|
-
* Logging instructions
|
|
1394
|
-
*/
|
|
1395
|
-
generateLoggingInstructions(config) {
|
|
1396
|
-
return frontmatter2("**/*.ts,**/*.tsx,**/*.js,**/*.jsx") + `# Paradigm Logging
|
|
1397
|
-
|
|
1398
|
-
${generateLoggingRules(config)}
|
|
1399
|
-
`;
|
|
1400
|
-
}
|
|
1401
|
-
/**
|
|
1402
|
-
* Purpose file instructions
|
|
1403
|
-
*/
|
|
1404
|
-
generatePurposeInstructions() {
|
|
1405
|
-
return frontmatter2("**/.purpose") + `# Purpose Files
|
|
1406
|
-
|
|
1407
|
-
Purpose files (\`.purpose\`) define the context for directories.
|
|
1408
|
-
|
|
1409
|
-
## Format
|
|
1410
|
-
|
|
1411
|
-
\`\`\`yaml
|
|
1412
|
-
# Directory context
|
|
1413
|
-
description: What this directory contains and why
|
|
1414
|
-
|
|
1415
|
-
# Components (# symbol) \u2014 all documented code units
|
|
1416
|
-
components:
|
|
1417
|
-
component-name:
|
|
1418
|
-
description: What this component does
|
|
1419
|
-
tags: [feature] # Classification via tag bank
|
|
1420
|
-
gates: [^gate1, ^gate2] # Required gates
|
|
1421
|
-
signals: [!signal1] # Events emitted
|
|
1422
|
-
used-by: [#other-component]
|
|
1423
|
-
\`\`\`
|
|
1424
|
-
|
|
1425
|
-
## Symbol References (v2)
|
|
1426
|
-
|
|
1427
|
-
- Reference components: \`#component-name\`
|
|
1428
|
-
- Reference flows: \`$flow-name\`
|
|
1429
|
-
- Reference gates: \`^gate-name\`
|
|
1430
|
-
- Reference signals: \`!signal-name\`
|
|
1431
|
-
- Reference aspects: \`~aspect-name\`
|
|
1432
|
-
`;
|
|
1433
|
-
}
|
|
1434
|
-
/**
|
|
1435
|
-
* Portal instructions
|
|
1436
|
-
*/
|
|
1437
|
-
generatePortalInstructions() {
|
|
1438
|
-
return frontmatter2("**/portal.yaml") + `# Portal Configuration
|
|
1439
|
-
|
|
1440
|
-
Portal files (\`portal.yaml\`) define authorization topology.
|
|
1441
|
-
|
|
1442
|
-
## Format
|
|
1443
|
-
|
|
1444
|
-
\`\`\`yaml
|
|
1445
|
-
version: "1.0"
|
|
1446
|
-
|
|
1447
|
-
gates:
|
|
1448
|
-
gate-name:
|
|
1449
|
-
description: What this gate protects
|
|
1450
|
-
locks:
|
|
1451
|
-
- id: lock-id
|
|
1452
|
-
description: Requirement description
|
|
1453
|
-
keys:
|
|
1454
|
-
- expression: "user.authenticated"
|
|
1455
|
-
description: User must be logged in
|
|
1456
|
-
prizes:
|
|
1457
|
-
- id: prize-id
|
|
1458
|
-
oneTime: true
|
|
1459
|
-
metadata:
|
|
1460
|
-
event: "gate_passed"
|
|
1461
|
-
|
|
1462
|
-
flows:
|
|
1463
|
-
flow-name:
|
|
1464
|
-
description: User journey
|
|
1465
|
-
gates: [gate1, gate2, gate3]
|
|
1466
|
-
\`\`\`
|
|
1467
|
-
|
|
1468
|
-
## Portal Validation
|
|
1469
|
-
|
|
1470
|
-
Use the Portal Validator for authorization checks:
|
|
1471
|
-
|
|
1472
|
-
\`\`\`typescript
|
|
1473
|
-
import { portal } from '@a-company/portal-sdk/validator';
|
|
1474
|
-
|
|
1475
|
-
const gate = portal.check('^gate-name')
|
|
1476
|
-
.requires('requirement description')
|
|
1477
|
-
.context({ userId, role });
|
|
1478
|
-
|
|
1479
|
-
if (!condition) {
|
|
1480
|
-
gate.deny('Reason for denial');
|
|
1481
|
-
return redirect('/unauthorized');
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
gate.allow('Access granted');
|
|
1485
|
-
\`\`\`
|
|
1486
|
-
`;
|
|
1487
|
-
}
|
|
1488
|
-
/**
|
|
1489
|
-
* Conventions instructions
|
|
1490
|
-
*/
|
|
1491
|
-
generateConventionsInstructions(config) {
|
|
1492
|
-
return frontmatter2("**/*.ts,**/*.tsx,**/*.js,**/*.jsx") + `# Paradigm Conventions
|
|
1493
|
-
|
|
1494
|
-
${generateConventions(config)}
|
|
1495
|
-
`;
|
|
1496
|
-
}
|
|
1497
|
-
/**
|
|
1498
|
-
* Commands reference instructions
|
|
1499
|
-
*/
|
|
1500
|
-
generateCommandsInstructions() {
|
|
1501
|
-
return `# Paradigm CLI Commands
|
|
1502
|
-
|
|
1503
|
-
${generateCommandsReference()}
|
|
1504
|
-
`;
|
|
1505
|
-
}
|
|
1506
|
-
/**
|
|
1507
|
-
* Agent Hints instructions - when to query CLI
|
|
1508
|
-
*/
|
|
1509
|
-
generateAgentHintsInstructions() {
|
|
1510
|
-
return `# Agent CLI Queries (Token-Efficient)
|
|
1511
|
-
|
|
1512
|
-
Instead of reading large context files, query Paradigm CLI on-demand for fresh, precise data.
|
|
1513
|
-
|
|
1514
|
-
## When to Query
|
|
1515
|
-
|
|
1516
|
-
| Before doing this... | Run this command |
|
|
1517
|
-
|---------------------|------------------|
|
|
1518
|
-
| Modifying a symbol | \`paradigm ripple #symbol --json\` |
|
|
1519
|
-
| Debugging an error | \`paradigm echo ERROR_CODE --json\` |
|
|
1520
|
-
| Starting a session | \`paradigm thread --json\` |
|
|
1521
|
-
| Understanding relationships | \`paradigm constellation\` |
|
|
1522
|
-
| Getting oriented | \`paradigm beacon --json\` |
|
|
1523
|
-
|
|
1524
|
-
## Query Patterns
|
|
1525
|
-
|
|
1526
|
-
### Before Changing Code
|
|
1527
|
-
|
|
1528
|
-
\`\`\`bash
|
|
1529
|
-
# See what depends on what you're changing
|
|
1530
|
-
paradigm ripple #checkout --json
|
|
1531
|
-
|
|
1532
|
-
# Output includes: upstream deps, downstream effects, flow membership
|
|
1533
|
-
\`\`\`
|
|
1534
|
-
|
|
1535
|
-
### When Debugging
|
|
1536
|
-
|
|
1537
|
-
\`\`\`bash
|
|
1538
|
-
# Look up error context
|
|
1539
|
-
paradigm echo AUTH_REQUIRED --json
|
|
1540
|
-
|
|
1541
|
-
# Then check ripple effects of the related symbol
|
|
1542
|
-
paradigm ripple ^authenticated --json
|
|
1543
|
-
\`\`\`
|
|
1544
|
-
|
|
1545
|
-
### Starting Work
|
|
1546
|
-
|
|
1547
|
-
\`\`\`bash
|
|
1548
|
-
# Check previous session context
|
|
1549
|
-
paradigm thread --json
|
|
1550
|
-
|
|
1551
|
-
# Quick orientation
|
|
1552
|
-
paradigm beacon --json
|
|
1553
|
-
\`\`\`
|
|
1554
|
-
|
|
1555
|
-
### Querying Constellation
|
|
1556
|
-
|
|
1557
|
-
\`\`\`bash
|
|
1558
|
-
# Get specific symbol
|
|
1559
|
-
jq '.stars["#checkout"]' .paradigm/constellation.json
|
|
1560
|
-
|
|
1561
|
-
# Find what requires a gate
|
|
1562
|
-
jq '[.stars | to_entries[] | select(.value.gates[]? == "^authenticated") | .key]' .paradigm/constellation.json
|
|
1563
|
-
|
|
1564
|
-
# List all flows
|
|
1565
|
-
jq '.orbits | keys' .paradigm/constellation.json
|
|
1566
|
-
\`\`\`
|
|
1567
|
-
|
|
1568
|
-
## Benefits
|
|
1569
|
-
|
|
1570
|
-
- **Fresh data**: Always current, not stale from file generation
|
|
1571
|
-
- **Precise**: Only get the data you need
|
|
1572
|
-
- **Token-efficient**: ~100 tokens per query vs ~2000 upfront
|
|
1573
|
-
`;
|
|
1574
|
-
}
|
|
1575
|
-
/**
|
|
1576
|
-
* Commit conventions instructions
|
|
1577
|
-
*/
|
|
1578
|
-
generateCommitsInstructions() {
|
|
1579
|
-
return `# Paradigm Commit Conventions
|
|
1580
|
-
|
|
1581
|
-
${generateCommitConvention()}
|
|
1582
|
-
`;
|
|
1583
|
-
}
|
|
1584
|
-
};
|
|
1585
|
-
var copilotAdapter = new CopilotAdapter();
|
|
1586
|
-
|
|
1587
|
-
// src/core/ide-adapters/windsurf.ts
|
|
1588
|
-
import * as fs3 from "fs";
|
|
1589
|
-
import * as path3 from "path";
|
|
1590
|
-
var WindsurfAdapter = class {
|
|
1591
|
-
name = "windsurf";
|
|
1592
|
-
displayName = "Windsurf";
|
|
1593
|
-
outputPath = ".windsurfrules";
|
|
1594
|
-
detect(rootDir) {
|
|
1595
|
-
if (fs3.existsSync(path3.join(rootDir, ".windsurfrules"))) {
|
|
1596
|
-
return true;
|
|
1597
|
-
}
|
|
1598
|
-
if (fs3.existsSync(path3.join(rootDir, ".windsurf"))) {
|
|
1599
|
-
return true;
|
|
1600
|
-
}
|
|
1601
|
-
return false;
|
|
1602
|
-
}
|
|
1603
|
-
generate(files) {
|
|
1604
|
-
const { config, projectName } = files;
|
|
1605
|
-
const sections = [];
|
|
1606
|
-
sections.push(generateHeader(projectName, this.displayName));
|
|
1607
|
-
sections.push(generateOverview(config));
|
|
1608
|
-
sections.push(generateSymbolSystem(config));
|
|
1609
|
-
const loggingSection = generateLoggingRules(config);
|
|
1610
|
-
if (loggingSection) {
|
|
1611
|
-
sections.push(loggingSection);
|
|
1612
|
-
}
|
|
1613
|
-
const scanSection = generateScanProtocol(config);
|
|
1614
|
-
if (scanSection) {
|
|
1615
|
-
sections.push(scanSection);
|
|
1616
|
-
}
|
|
1617
|
-
sections.push(generateUpdateRules(config));
|
|
1618
|
-
sections.push(generateConventions(config));
|
|
1619
|
-
sections.push(generateCommitConvention());
|
|
1620
|
-
sections.push(generateCommandsReference());
|
|
1621
|
-
sections.push(generateFooter());
|
|
1622
|
-
return sections.filter((s) => s.trim()).join("\n");
|
|
1623
|
-
}
|
|
1624
|
-
};
|
|
1625
|
-
var windsurfAdapter = new WindsurfAdapter();
|
|
1626
|
-
|
|
1627
|
-
// src/core/ide-adapters/claude.ts
|
|
1628
|
-
import * as fs4 from "fs";
|
|
1629
|
-
import * as path4 from "path";
|
|
1630
|
-
var ClaudeAdapter = class {
|
|
1631
|
-
name = "claude";
|
|
1632
|
-
displayName = "Claude";
|
|
1633
|
-
outputPath = "CLAUDE.md";
|
|
1634
|
-
detect(rootDir) {
|
|
1635
|
-
if (fs4.existsSync(path4.join(rootDir, "CLAUDE.md"))) {
|
|
1636
|
-
return true;
|
|
1637
|
-
}
|
|
1638
|
-
return false;
|
|
1639
|
-
}
|
|
1640
|
-
generate(files) {
|
|
1641
|
-
const { config, projectName } = files;
|
|
1642
|
-
const sections = [];
|
|
1643
|
-
sections.push(`# ${projectName} - Claude Context`);
|
|
1644
|
-
sections.push("");
|
|
1645
|
-
sections.push("> **Paradigm v2.0** | For Claude Code, Claude API, and Claude-native interfaces");
|
|
1646
|
-
sections.push(">");
|
|
1647
|
-
sections.push("> **Author:** Matt Canoy ([@ascend42](https://github.com/ascend42)) | **Repo:** [github.com/ascend42/a-paradigm](https://github.com/ascend42/a-paradigm) | **npm:** [@a-company/paradigm](https://www.npmjs.com/package/@a-company/paradigm) | **Plugin:** `paradigm` via Claude Code marketplace");
|
|
1648
|
-
sections.push("");
|
|
1649
|
-
sections.push("## Project Overview");
|
|
1650
|
-
sections.push("");
|
|
1651
|
-
if (config["agent-guidelines"]?.overview) {
|
|
1652
|
-
sections.push(config["agent-guidelines"].overview);
|
|
1653
|
-
}
|
|
1654
|
-
sections.push("");
|
|
1655
|
-
sections.push("## Quick Orientation");
|
|
1656
|
-
sections.push("");
|
|
1657
|
-
sections.push("```");
|
|
1658
|
-
sections.push(".paradigm/config.yaml \u2192 Project configuration");
|
|
1659
|
-
sections.push(".paradigm/specs/ \u2192 Detailed specifications");
|
|
1660
|
-
sections.push(".paradigm/docs/ \u2192 Commands, patterns, troubleshooting");
|
|
1661
|
-
sections.push(".cursorrules \u2192 IDE instructions (if using Cursor)");
|
|
1662
|
-
sections.push("portal.yaml \u2192 Security/auth definitions");
|
|
1663
|
-
sections.push(".paradigm/lore/ \u2192 Project timeline and history");
|
|
1664
|
-
sections.push("```");
|
|
1665
|
-
sections.push("");
|
|
1666
|
-
sections.push("## Symbol System");
|
|
1667
|
-
sections.push("");
|
|
1668
|
-
sections.push("Use these prefixes in documentation and commits:");
|
|
1669
|
-
sections.push("");
|
|
1670
|
-
sections.push("| Symbol | Meaning | Example |");
|
|
1671
|
-
sections.push("|--------|---------|---------|");
|
|
1672
|
-
const symbolSystem = config["symbol-system"];
|
|
1673
|
-
if (symbolSystem) {
|
|
1674
|
-
for (const [prefix, def] of Object.entries(symbolSystem)) {
|
|
1675
|
-
const example = def.examples?.[0] || `${prefix}example`;
|
|
1676
|
-
sections.push(`| \`${prefix}\` | ${def.name} | \`${example}\` |`);
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
sections.push("");
|
|
1680
|
-
const conventionsSection = generateConventions(config);
|
|
1681
|
-
if (conventionsSection) {
|
|
1682
|
-
sections.push(conventionsSection);
|
|
1683
|
-
}
|
|
1684
|
-
sections.push(generateCommitConvention());
|
|
1685
|
-
sections.push("## Agent Onboarding");
|
|
1686
|
-
sections.push("");
|
|
1687
|
-
sections.push("**First session:** Call `paradigm_status` \u2192 read `.paradigm/config.yaml` \u2192 check `portal.yaml`");
|
|
1688
|
-
sections.push("");
|
|
1689
|
-
sections.push("**Before each task:** `paradigm_ripple` for impact, `paradigm_gates_for_route` for new endpoints");
|
|
1690
|
-
sections.push("");
|
|
1691
|
-
sections.push("**Resuming:** Call `paradigm_session_recover`");
|
|
1692
|
-
sections.push("");
|
|
1693
|
-
sections.push("## Before Implementing");
|
|
1694
|
-
sections.push("");
|
|
1695
|
-
sections.push("0. Call `paradigm_protocol_search` \u2014 if a protocol matches, follow it");
|
|
1696
|
-
sections.push('1. Complex task (3+ files)? \u2192 `paradigm_orchestrate_inline` mode="plan"');
|
|
1697
|
-
sections.push("2. Affects symbols? \u2192 `paradigm_ripple`");
|
|
1698
|
-
sections.push("3. Adds endpoints? \u2192 `paradigm_gates_for_route`");
|
|
1699
|
-
sections.push("");
|
|
1700
|
-
sections.push("## Automatic Enforcement (Hooks)");
|
|
1701
|
-
sections.push("");
|
|
1702
|
-
sections.push("The stop hook **BLOCKS** if source files were modified without .purpose updates.");
|
|
1703
|
-
sections.push("");
|
|
1704
|
-
sections.push("| Hook | Behavior |");
|
|
1705
|
-
sections.push("|------|----------|");
|
|
1706
|
-
sections.push("| **Stop** | Blocks on: missing .purpose, missing portal.yaml gates, aspect drift, stale purposes |");
|
|
1707
|
-
sections.push("| **Pre-commit** | Auto-rebuilds index \u2014 never blocks |");
|
|
1708
|
-
sections.push("| **Post-write** | Advisory reminder for .purpose coverage |");
|
|
1709
|
-
sections.push("");
|
|
1710
|
-
sections.push("**If blocked:** Update .purpose files \u2192 update portal.yaml if needed \u2192 `paradigm_reindex` \u2192 finish");
|
|
1711
|
-
sections.push("");
|
|
1712
|
-
sections.push("## Maintaining Paradigm Files");
|
|
1713
|
-
sections.push("");
|
|
1714
|
-
sections.push("**You MUST update Paradigm files when making code changes:**");
|
|
1715
|
-
sections.push("");
|
|
1716
|
-
sections.push("- Add feature \u2192 create `.purpose` in directory");
|
|
1717
|
-
sections.push("- Add protected route \u2192 update `portal.yaml` with gates");
|
|
1718
|
-
sections.push("- Add signal/event \u2192 add to `.purpose`");
|
|
1719
|
-
sections.push("- Add multi-step flow \u2192 document as `$flow`");
|
|
1720
|
-
sections.push("- Rename/delete symbol \u2192 update all references");
|
|
1721
|
-
sections.push("- Record lore via `paradigm_lore_record` for sessions modifying 3+ files");
|
|
1722
|
-
sections.push("- Use Paradigm logger (`log.component()`, `log.gate()`, etc.) \u2014 never raw console.log");
|
|
1723
|
-
sections.push("");
|
|
1724
|
-
sections.push("**Auth requires portal.yaml** if your code has JWT, role checks, ownership checks, or protected endpoints.");
|
|
1725
|
-
sections.push("");
|
|
1726
|
-
sections.push("## On-Demand Guidance");
|
|
1727
|
-
sections.push("");
|
|
1728
|
-
sections.push("Detailed guidance is available via MCP resources \u2014 load only what you need:");
|
|
1729
|
-
sections.push("");
|
|
1730
|
-
sections.push("| Topic | Resource |");
|
|
1731
|
-
sections.push("|-------|----------|");
|
|
1732
|
-
sections.push("| Logging rules & directory mapping | `paradigm://guidance/logging` |");
|
|
1733
|
-
sections.push("| Portal protocol & gate patterns | `paradigm://guidance/portal` |");
|
|
1734
|
-
sections.push("| MCP workflow & token budgets | `paradigm://guidance/mcp-workflow` |");
|
|
1735
|
-
sections.push("| Flow-first development | `paradigm://guidance/flows` |");
|
|
1736
|
-
sections.push("| Multi-agent orchestration | `paradigm://guidance/orchestration` |");
|
|
1737
|
-
sections.push("| Workspaces (multi-project) | `paradigm://guidance/workspaces` |");
|
|
1738
|
-
sections.push("| University (knowledge base) | `paradigm://guidance/university` |");
|
|
1739
|
-
sections.push("| Confidence calibration | `paradigm://guidance/calibration` |");
|
|
1740
|
-
sections.push("| Session checkpoints | `paradigm://guidance/checkpoints` |");
|
|
1741
|
-
sections.push("| Navigation & task recipes | `paradigm://guidance/navigation` |");
|
|
1742
|
-
sections.push("| Component types & hierarchy | `paradigm://guidance/component-types` |");
|
|
1743
|
-
sections.push("| Troubleshooting | `paradigm://guidance/troubleshooting` |");
|
|
1744
|
-
sections.push("");
|
|
1745
|
-
if (files.agents?.length) {
|
|
1746
|
-
const highPriority = files.agents.flatMap(
|
|
1747
|
-
(a) => (a.context?.contributions || []).filter((c) => c.priority === "high" && c.content).map((c) => ({ agent: a.id, section: c.section, content: c.content }))
|
|
1748
|
-
);
|
|
1749
|
-
if (highPriority.length > 0) {
|
|
1750
|
-
sections.push("## Agent Contributions");
|
|
1751
|
-
sections.push("");
|
|
1752
|
-
for (const contrib of highPriority) {
|
|
1753
|
-
sections.push(`### ${contrib.section} (${contrib.agent})`);
|
|
1754
|
-
sections.push("");
|
|
1755
|
-
sections.push(contrib.content);
|
|
1756
|
-
sections.push("");
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
if (config["purpose-required"]?.length) {
|
|
1761
|
-
sections.push("## Directory Structure");
|
|
1762
|
-
sections.push("");
|
|
1763
|
-
sections.push("`.purpose` files exist in:");
|
|
1764
|
-
for (const req of config["purpose-required"]) {
|
|
1765
|
-
sections.push(`- \`${req.pattern}\``);
|
|
1766
|
-
}
|
|
1767
|
-
sections.push("");
|
|
1768
|
-
}
|
|
1769
|
-
sections.push("---");
|
|
1770
|
-
sections.push("");
|
|
1771
|
-
sections.push("*See `.paradigm/specs/` for specifications. Run `paradigm sync` to regenerate.*");
|
|
1772
|
-
return sections.filter((s) => s !== void 0).join("\n");
|
|
1773
|
-
}
|
|
1774
|
-
/**
|
|
1775
|
-
* Generate MCP configuration for Claude
|
|
1776
|
-
*/
|
|
1777
|
-
generateMcpConfig(rootDir) {
|
|
1778
|
-
return {
|
|
1779
|
-
mcpServers: {
|
|
1780
|
-
paradigm: {
|
|
1781
|
-
command: "paradigm-mcp",
|
|
1782
|
-
args: ["."],
|
|
1783
|
-
cwd: rootDir
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
};
|
|
1787
|
-
}
|
|
1788
|
-
/**
|
|
1789
|
-
* Generate nested CLAUDE.md files for directories with .purpose files
|
|
1790
|
-
*/
|
|
1791
|
-
generateNestedContexts(rootDir, files) {
|
|
1792
|
-
const generatedFiles = [];
|
|
1793
|
-
const purposeFiles = findPurposeFiles(rootDir);
|
|
1794
|
-
for (const purposePath of purposeFiles) {
|
|
1795
|
-
const dirPath = path4.dirname(purposePath);
|
|
1796
|
-
const relativePath = path4.relative(rootDir, dirPath);
|
|
1797
|
-
if (relativePath === "" || relativePath === ".") continue;
|
|
1798
|
-
const purposeContent = fs4.readFileSync(purposePath, "utf8");
|
|
1799
|
-
const contextContent = this.generateDirectoryContext(relativePath, purposeContent, files);
|
|
1800
|
-
generatedFiles.push({
|
|
1801
|
-
path: path4.join(relativePath, "CLAUDE.md"),
|
|
1802
|
-
content: contextContent
|
|
1803
|
-
});
|
|
1804
|
-
}
|
|
1805
|
-
return generatedFiles;
|
|
1806
|
-
}
|
|
1807
|
-
/**
|
|
1808
|
-
* Generate context for a specific directory
|
|
1809
|
-
*/
|
|
1810
|
-
generateDirectoryContext(dirPath, purposeContent, files) {
|
|
1811
|
-
const sections = [];
|
|
1812
|
-
const dirName = path4.basename(dirPath);
|
|
1813
|
-
sections.push(`# ${dirName} - Directory Context`);
|
|
1814
|
-
sections.push("");
|
|
1815
|
-
sections.push(`> Part of ${files.projectName} | See root CLAUDE.md for project overview`);
|
|
1816
|
-
sections.push("");
|
|
1817
|
-
sections.push("## Purpose");
|
|
1818
|
-
sections.push("");
|
|
1819
|
-
sections.push("```yaml");
|
|
1820
|
-
sections.push(purposeContent.trim());
|
|
1821
|
-
sections.push("```");
|
|
1822
|
-
sections.push("");
|
|
1823
|
-
sections.push("## Quick Reference");
|
|
1824
|
-
sections.push("");
|
|
1825
|
-
sections.push(`- **Path**: \`${dirPath}\``);
|
|
1826
|
-
sections.push("- **Config**: See `.paradigm/config.yaml`");
|
|
1827
|
-
sections.push("- **Patterns**: See `.paradigm/docs/patterns.md`");
|
|
1828
|
-
sections.push("");
|
|
1829
|
-
sections.push("## Symbols");
|
|
1830
|
-
sections.push("");
|
|
1831
|
-
sections.push("`#` component | `$` flow | `^` gate | `!` signal | `~` aspect");
|
|
1832
|
-
sections.push("");
|
|
1833
|
-
sections.push("---");
|
|
1834
|
-
sections.push("");
|
|
1835
|
-
sections.push("*Auto-generated by `paradigm sync claude`. Edit .purpose file to update.*");
|
|
1836
|
-
return sections.join("\n");
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
|
-
function findPurposeFiles(dir) {
|
|
1840
|
-
const results = [];
|
|
1841
|
-
function walk(currentDir) {
|
|
1842
|
-
const entries = fs4.readdirSync(currentDir, { withFileTypes: true });
|
|
1843
|
-
for (const entry of entries) {
|
|
1844
|
-
const fullPath = path4.join(currentDir, entry.name);
|
|
1845
|
-
if (entry.isDirectory()) {
|
|
1846
|
-
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
1847
|
-
walk(fullPath);
|
|
1848
|
-
} else if (entry.name === ".purpose") {
|
|
1849
|
-
results.push(fullPath);
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
walk(dir);
|
|
1854
|
-
return results;
|
|
1855
|
-
}
|
|
1856
|
-
var claudeAdapter = new ClaudeAdapter();
|
|
1857
|
-
|
|
1858
|
-
// src/core/ide-adapters/agents.ts
|
|
1859
|
-
import * as fs5 from "fs";
|
|
1860
|
-
import * as path5 from "path";
|
|
1861
|
-
var AgentsAdapter = class {
|
|
1862
|
-
name = "agents";
|
|
1863
|
-
displayName = "AGENTS.md";
|
|
1864
|
-
outputPath = "AGENTS.md";
|
|
1865
|
-
multiFile = false;
|
|
1866
|
-
detect(rootDir) {
|
|
1867
|
-
return fs5.existsSync(path5.join(rootDir, "AGENTS.md"));
|
|
1868
|
-
}
|
|
1869
|
-
generate(files) {
|
|
1870
|
-
const { config, projectName } = files;
|
|
1871
|
-
const sections = [];
|
|
1872
|
-
sections.push(`# ${projectName} - AI Agent Instructions`);
|
|
1873
|
-
sections.push("");
|
|
1874
|
-
sections.push("> Generated by [Paradigm](https://github.com/anthropics/paradigm) v2.0 | Universal AI agent instruction file");
|
|
1875
|
-
sections.push("");
|
|
1876
|
-
sections.push(generateOverview(config));
|
|
1877
|
-
sections.push(generateSymbolSystem(config));
|
|
1878
|
-
const conventionsSection = generateConventions(config);
|
|
1879
|
-
if (conventionsSection) {
|
|
1880
|
-
sections.push(conventionsSection);
|
|
1881
|
-
}
|
|
1882
|
-
const loggingSection = generateLoggingRules(config);
|
|
1883
|
-
if (loggingSection) {
|
|
1884
|
-
sections.push(loggingSection);
|
|
1885
|
-
}
|
|
1886
|
-
sections.push(generateMcpToolReference());
|
|
1887
|
-
sections.push(generateNavigationSection(config));
|
|
1888
|
-
sections.push(generateWorkflowProtocol());
|
|
1889
|
-
sections.push(generateCommitConvention());
|
|
1890
|
-
sections.push(generateHandoffProtocol());
|
|
1891
|
-
sections.push(generateCheckpointProtocol());
|
|
1892
|
-
sections.push(generateHabitsSection());
|
|
1893
|
-
sections.push(generateLoreSection());
|
|
1894
|
-
sections.push(generateLlmsTxtSection());
|
|
1895
|
-
const updateSection = generateUpdateRules(config);
|
|
1896
|
-
if (updateSection) {
|
|
1897
|
-
sections.push(updateSection);
|
|
1898
|
-
}
|
|
1899
|
-
sections.push(generateCommandsReference());
|
|
1900
|
-
sections.push("---");
|
|
1901
|
-
sections.push("");
|
|
1902
|
-
sections.push("*Generated by Paradigm. Run `paradigm sync agents` to regenerate.*");
|
|
1903
|
-
return sections.filter((s) => s !== void 0 && s !== "").join("\n");
|
|
1904
|
-
}
|
|
1905
|
-
};
|
|
1906
|
-
var agentsAdapter = new AgentsAdapter();
|
|
1907
|
-
|
|
1908
|
-
// src/core/ide-adapters/index.ts
|
|
1909
|
-
import * as yaml2 from "js-yaml";
|
|
1910
|
-
var adapters = /* @__PURE__ */ new Map([
|
|
1911
|
-
["cursor", cursorAdapter],
|
|
1912
|
-
["copilot", copilotAdapter],
|
|
1913
|
-
["windsurf", windsurfAdapter],
|
|
1914
|
-
["claude", claudeAdapter],
|
|
1915
|
-
["agents", agentsAdapter]
|
|
1916
|
-
]);
|
|
1917
|
-
function getAdapter(name) {
|
|
1918
|
-
return adapters.get(name.toLowerCase());
|
|
1919
|
-
}
|
|
1920
|
-
function getAdapterNames() {
|
|
1921
|
-
return Array.from(adapters.keys());
|
|
1922
|
-
}
|
|
1923
|
-
function detectIDE(rootDir) {
|
|
1924
|
-
if (cursorAdapter.detect(rootDir)) {
|
|
1925
|
-
return {
|
|
1926
|
-
detected: "cursor",
|
|
1927
|
-
confidence: "high",
|
|
1928
|
-
reason: "Found .cursor directory or .cursorrules file"
|
|
1929
|
-
};
|
|
1930
|
-
}
|
|
1931
|
-
if (windsurfAdapter.detect(rootDir)) {
|
|
1932
|
-
return {
|
|
1933
|
-
detected: "windsurf",
|
|
1934
|
-
confidence: "high",
|
|
1935
|
-
reason: "Found .windsurf directory or .windsurfrules file"
|
|
1936
|
-
};
|
|
1937
|
-
}
|
|
1938
|
-
if (copilotAdapter.detect(rootDir)) {
|
|
1939
|
-
return {
|
|
1940
|
-
detected: "copilot",
|
|
1941
|
-
confidence: "medium",
|
|
1942
|
-
reason: "Found .github/copilot-instructions.md file"
|
|
1943
|
-
};
|
|
1944
|
-
}
|
|
1945
|
-
if (fs6.existsSync(path6.join(rootDir, ".vscode"))) {
|
|
1946
|
-
return {
|
|
1947
|
-
detected: "cursor",
|
|
1948
|
-
confidence: "low",
|
|
1949
|
-
reason: "Found .vscode directory, defaulting to Cursor format"
|
|
1950
|
-
};
|
|
1951
|
-
}
|
|
1952
|
-
return {
|
|
1953
|
-
detected: null,
|
|
1954
|
-
confidence: "low",
|
|
1955
|
-
reason: "No IDE markers found"
|
|
1956
|
-
};
|
|
1957
|
-
}
|
|
1958
|
-
function loadParadigmFiles(rootDir) {
|
|
1959
|
-
const paradigmDir = path6.join(rootDir, ".paradigm");
|
|
1960
|
-
const paradigmFile = path6.join(rootDir, ".paradigm");
|
|
1961
|
-
let configPath;
|
|
1962
|
-
let specsDir;
|
|
1963
|
-
let docsDir;
|
|
1964
|
-
if (fs6.existsSync(paradigmDir) && fs6.statSync(paradigmDir).isDirectory()) {
|
|
1965
|
-
configPath = path6.join(paradigmDir, "config.yaml");
|
|
1966
|
-
specsDir = path6.join(paradigmDir, "specs");
|
|
1967
|
-
docsDir = path6.join(paradigmDir, "docs");
|
|
1968
|
-
} else if (fs6.existsSync(paradigmFile) && fs6.statSync(paradigmFile).isFile()) {
|
|
1969
|
-
configPath = paradigmFile;
|
|
1970
|
-
specsDir = "";
|
|
1971
|
-
docsDir = "";
|
|
1972
|
-
} else {
|
|
1973
|
-
return null;
|
|
1974
|
-
}
|
|
1975
|
-
if (!fs6.existsSync(configPath)) {
|
|
1976
|
-
return null;
|
|
1977
|
-
}
|
|
1978
|
-
let config;
|
|
1979
|
-
try {
|
|
1980
|
-
const configContent = fs6.readFileSync(configPath, "utf8");
|
|
1981
|
-
config = parseParadigmConfig(configContent);
|
|
1982
|
-
} catch {
|
|
1983
|
-
return null;
|
|
1984
|
-
}
|
|
1985
|
-
const specs = {};
|
|
1986
|
-
if (specsDir && fs6.existsSync(specsDir)) {
|
|
1987
|
-
const specFiles = ["logger.md", "scan.md", "symbols.md"];
|
|
1988
|
-
for (const file of specFiles) {
|
|
1989
|
-
const filePath = path6.join(specsDir, file);
|
|
1990
|
-
if (fs6.existsSync(filePath)) {
|
|
1991
|
-
const key = file.replace(".md", "");
|
|
1992
|
-
specs[key] = fs6.readFileSync(filePath, "utf8");
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
const docs = {};
|
|
1997
|
-
if (docsDir && fs6.existsSync(docsDir)) {
|
|
1998
|
-
const docFiles = ["commands.md", "patterns.md", "troubleshooting.md"];
|
|
1999
|
-
for (const file of docFiles) {
|
|
2000
|
-
const filePath = path6.join(docsDir, file);
|
|
2001
|
-
if (fs6.existsSync(filePath)) {
|
|
2002
|
-
const key = file.replace(".md", "");
|
|
2003
|
-
docs[key] = fs6.readFileSync(filePath, "utf8");
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
2007
|
-
let agents = void 0;
|
|
2008
|
-
const agentsDir = path6.join(rootDir, ".paradigm", "agents");
|
|
2009
|
-
if (fs6.existsSync(agentsDir)) {
|
|
2010
|
-
try {
|
|
2011
|
-
const agentFiles = fs6.readdirSync(agentsDir).filter((f) => f.endsWith(".agent"));
|
|
2012
|
-
const loaded = [];
|
|
2013
|
-
for (const file of agentFiles) {
|
|
2014
|
-
try {
|
|
2015
|
-
const content = fs6.readFileSync(path6.join(agentsDir, file), "utf8");
|
|
2016
|
-
const profile = yaml2.load(content);
|
|
2017
|
-
if (profile?.id) {
|
|
2018
|
-
loaded.push({
|
|
2019
|
-
id: profile.id,
|
|
2020
|
-
role: profile.role,
|
|
2021
|
-
context: profile.context
|
|
2022
|
-
});
|
|
2023
|
-
}
|
|
2024
|
-
} catch {
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
if (loaded.length > 0) agents = loaded;
|
|
2028
|
-
} catch {
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
let workspace = void 0;
|
|
2032
|
-
const rawConfig = yaml2.load(fs6.readFileSync(configPath, "utf8"));
|
|
2033
|
-
const wsField = rawConfig.workspace;
|
|
2034
|
-
if (typeof wsField === "string") {
|
|
2035
|
-
const wsPath = path6.resolve(rootDir, wsField);
|
|
2036
|
-
if (fs6.existsSync(wsPath)) {
|
|
2037
|
-
try {
|
|
2038
|
-
const wsConfig = yaml2.load(fs6.readFileSync(wsPath, "utf8"));
|
|
2039
|
-
const wsDir = path6.dirname(wsPath);
|
|
2040
|
-
const currentName = wsConfig.members?.find(
|
|
2041
|
-
(m) => path6.resolve(wsDir, m.path) === rootDir
|
|
2042
|
-
)?.name || path6.basename(rootDir);
|
|
2043
|
-
workspace = {
|
|
2044
|
-
name: wsConfig.name,
|
|
2045
|
-
currentMember: currentName,
|
|
2046
|
-
members: wsConfig.members || []
|
|
2047
|
-
};
|
|
2048
|
-
} catch {
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
return {
|
|
2053
|
-
config,
|
|
2054
|
-
specs,
|
|
2055
|
-
docs,
|
|
2056
|
-
projectName: path6.basename(rootDir),
|
|
2057
|
-
workspace,
|
|
2058
|
-
agents
|
|
2059
|
-
};
|
|
2060
|
-
}
|
|
2061
|
-
function syncToIDE(rootDir, ideName, files, force = false) {
|
|
2062
|
-
const adapter = getAdapter(ideName);
|
|
2063
|
-
if (!adapter) {
|
|
2064
|
-
return {
|
|
2065
|
-
success: false,
|
|
2066
|
-
ide: ideName,
|
|
2067
|
-
outputPath: "",
|
|
2068
|
-
message: `Unknown IDE: ${ideName}. Available: ${getAdapterNames().join(", ")}`
|
|
2069
|
-
};
|
|
2070
|
-
}
|
|
2071
|
-
const outputPath = path6.join(rootDir, adapter.outputPath);
|
|
2072
|
-
try {
|
|
2073
|
-
if (adapter.multiFile && adapter.generateFiles) {
|
|
2074
|
-
return syncMultiFileAdapter(rootDir, adapter, files, force);
|
|
2075
|
-
}
|
|
2076
|
-
if (!force && fs6.existsSync(outputPath)) {
|
|
2077
|
-
}
|
|
2078
|
-
const parentDir = path6.dirname(outputPath);
|
|
2079
|
-
if (!fs6.existsSync(parentDir)) {
|
|
2080
|
-
fs6.mkdirSync(parentDir, { recursive: true });
|
|
2081
|
-
}
|
|
2082
|
-
const content = adapter.generate(files);
|
|
2083
|
-
fs6.writeFileSync(outputPath, content, "utf8");
|
|
2084
|
-
return {
|
|
2085
|
-
success: true,
|
|
2086
|
-
ide: ideName,
|
|
2087
|
-
outputPath,
|
|
2088
|
-
message: `Generated ${adapter.outputPath}`
|
|
2089
|
-
};
|
|
2090
|
-
} catch (error) {
|
|
2091
|
-
return {
|
|
2092
|
-
success: false,
|
|
2093
|
-
ide: ideName,
|
|
2094
|
-
outputPath,
|
|
2095
|
-
message: `Failed to write ${adapter.outputPath}: ${error.message}`
|
|
2096
|
-
};
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
function syncMultiFileAdapter(rootDir, adapter, files, force) {
|
|
2100
|
-
const outputDir = path6.join(rootDir, adapter.outputPath);
|
|
2101
|
-
if (!fs6.existsSync(outputDir)) {
|
|
2102
|
-
fs6.mkdirSync(outputDir, { recursive: true });
|
|
2103
|
-
}
|
|
2104
|
-
const generatedFiles = adapter.generateFiles(files, rootDir);
|
|
2105
|
-
const writtenFiles = [];
|
|
2106
|
-
for (const file of generatedFiles) {
|
|
2107
|
-
let filePath;
|
|
2108
|
-
if (file.path.startsWith("../")) {
|
|
2109
|
-
filePath = path6.join(outputDir, file.path);
|
|
2110
|
-
} else {
|
|
2111
|
-
filePath = path6.join(outputDir, file.path);
|
|
2112
|
-
}
|
|
2113
|
-
const parentDir = path6.dirname(filePath);
|
|
2114
|
-
if (!fs6.existsSync(parentDir)) {
|
|
2115
|
-
fs6.mkdirSync(parentDir, { recursive: true });
|
|
2116
|
-
}
|
|
2117
|
-
if (!force && fs6.existsSync(filePath)) {
|
|
2118
|
-
}
|
|
2119
|
-
fs6.writeFileSync(filePath, file.content, "utf8");
|
|
2120
|
-
writtenFiles.push(file.path);
|
|
2121
|
-
}
|
|
2122
|
-
if (adapter.name === "cursor") {
|
|
2123
|
-
const legacyCursorrules = path6.join(rootDir, ".cursorrules");
|
|
2124
|
-
if (fs6.existsSync(legacyCursorrules)) {
|
|
2125
|
-
const backupPath = path6.join(rootDir, ".cursorrules.bak");
|
|
2126
|
-
if (!fs6.existsSync(backupPath)) {
|
|
2127
|
-
fs6.renameSync(legacyCursorrules, backupPath);
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
const mainDirFiles = writtenFiles.filter((f) => !f.startsWith("../"));
|
|
2132
|
-
const extraFiles = writtenFiles.filter((f) => f.startsWith("../"));
|
|
2133
|
-
let message = `Generated ${mainDirFiles.length} files in ${adapter.outputPath}/`;
|
|
2134
|
-
if (extraFiles.length > 0) {
|
|
2135
|
-
message += ` + ${extraFiles.length} additional file(s)`;
|
|
2136
|
-
}
|
|
2137
|
-
return {
|
|
2138
|
-
success: true,
|
|
2139
|
-
ide: adapter.name,
|
|
2140
|
-
outputPath: outputDir,
|
|
2141
|
-
message
|
|
2142
|
-
};
|
|
2143
|
-
}
|
|
2144
|
-
function syncToAllIDEs(rootDir, files, force = false) {
|
|
2145
|
-
const results = [];
|
|
2146
|
-
for (const [name] of adapters) {
|
|
2147
|
-
results.push(syncToIDE(rootDir, name, files, force));
|
|
2148
|
-
}
|
|
2149
|
-
return results;
|
|
2150
|
-
}
|
|
2151
|
-
function writeMcpConfig(rootDir, ideName) {
|
|
2152
|
-
const adapter = getAdapter(ideName);
|
|
2153
|
-
if (!adapter || !adapter.generateMcpConfig) {
|
|
2154
|
-
return {
|
|
2155
|
-
success: false,
|
|
2156
|
-
path: "",
|
|
2157
|
-
message: `IDE ${ideName} does not support MCP configuration`
|
|
2158
|
-
};
|
|
2159
|
-
}
|
|
2160
|
-
const mcpConfig = adapter.generateMcpConfig(rootDir);
|
|
2161
|
-
let configPath;
|
|
2162
|
-
switch (ideName) {
|
|
2163
|
-
case "cursor":
|
|
2164
|
-
configPath = path6.join(rootDir, ".cursor", "mcp.json");
|
|
2165
|
-
break;
|
|
2166
|
-
case "claude":
|
|
2167
|
-
configPath = path6.join(rootDir, ".mcp.json");
|
|
2168
|
-
break;
|
|
2169
|
-
default:
|
|
2170
|
-
return {
|
|
2171
|
-
success: false,
|
|
2172
|
-
path: "",
|
|
2173
|
-
message: `Unknown MCP config path for ${ideName}`
|
|
2174
|
-
};
|
|
2175
|
-
}
|
|
2176
|
-
try {
|
|
2177
|
-
const parentDir = path6.dirname(configPath);
|
|
2178
|
-
if (!fs6.existsSync(parentDir)) {
|
|
2179
|
-
fs6.mkdirSync(parentDir, { recursive: true });
|
|
2180
|
-
}
|
|
2181
|
-
let existingConfig = {};
|
|
2182
|
-
if (fs6.existsSync(configPath)) {
|
|
2183
|
-
const content = fs6.readFileSync(configPath, "utf8");
|
|
2184
|
-
existingConfig = JSON.parse(content);
|
|
2185
|
-
}
|
|
2186
|
-
const mergedConfig = {
|
|
2187
|
-
...existingConfig,
|
|
2188
|
-
mcpServers: {
|
|
2189
|
-
...existingConfig.mcpServers || {},
|
|
2190
|
-
...mcpConfig.mcpServers
|
|
2191
|
-
}
|
|
2192
|
-
};
|
|
2193
|
-
if (ideName === "claude") {
|
|
2194
|
-
const existingPermissions = existingConfig.permissions || {};
|
|
2195
|
-
const existingAllow = existingPermissions.allow || [];
|
|
2196
|
-
const paradigmPermission = "Bash(paradigm *)";
|
|
2197
|
-
if (!existingAllow.includes(paradigmPermission)) {
|
|
2198
|
-
mergedConfig.permissions = {
|
|
2199
|
-
...existingPermissions,
|
|
2200
|
-
allow: [...existingAllow, paradigmPermission]
|
|
2201
|
-
};
|
|
2202
|
-
}
|
|
2203
|
-
}
|
|
2204
|
-
fs6.writeFileSync(configPath, JSON.stringify(mergedConfig, null, 2));
|
|
2205
|
-
return {
|
|
2206
|
-
success: true,
|
|
2207
|
-
path: configPath,
|
|
2208
|
-
message: `MCP configuration written to ${path6.relative(rootDir, configPath)}`
|
|
2209
|
-
};
|
|
2210
|
-
} catch (error) {
|
|
2211
|
-
return {
|
|
2212
|
-
success: false,
|
|
2213
|
-
path: configPath,
|
|
2214
|
-
message: `Failed to write MCP config: ${error.message}`
|
|
2215
|
-
};
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
function writeNestedContexts(rootDir, ideName, files) {
|
|
2219
|
-
const adapter = getAdapter(ideName);
|
|
2220
|
-
if (!adapter || !adapter.generateNestedContexts) {
|
|
2221
|
-
return {
|
|
2222
|
-
success: false,
|
|
2223
|
-
count: 0,
|
|
2224
|
-
message: `IDE ${ideName} does not support nested contexts`
|
|
2225
|
-
};
|
|
2226
|
-
}
|
|
2227
|
-
try {
|
|
2228
|
-
const generatedFiles = adapter.generateNestedContexts(rootDir, files);
|
|
2229
|
-
for (const file of generatedFiles) {
|
|
2230
|
-
const filePath = path6.join(rootDir, file.path);
|
|
2231
|
-
const parentDir = path6.dirname(filePath);
|
|
2232
|
-
if (!fs6.existsSync(parentDir)) {
|
|
2233
|
-
fs6.mkdirSync(parentDir, { recursive: true });
|
|
2234
|
-
}
|
|
2235
|
-
fs6.writeFileSync(filePath, file.content, "utf8");
|
|
2236
|
-
}
|
|
2237
|
-
return {
|
|
2238
|
-
success: true,
|
|
2239
|
-
count: generatedFiles.length,
|
|
2240
|
-
message: `Generated ${generatedFiles.length} nested context files`
|
|
2241
|
-
};
|
|
2242
|
-
} catch (error) {
|
|
2243
|
-
return {
|
|
2244
|
-
success: false,
|
|
2245
|
-
count: 0,
|
|
2246
|
-
message: `Failed to write nested contexts: ${error.message}`
|
|
2247
|
-
};
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
|
-
export {
|
|
2252
|
-
getAdapter,
|
|
2253
|
-
getAdapterNames,
|
|
2254
|
-
detectIDE,
|
|
2255
|
-
loadParadigmFiles,
|
|
2256
|
-
syncToIDE,
|
|
2257
|
-
syncToAllIDEs,
|
|
2258
|
-
writeMcpConfig,
|
|
2259
|
-
writeNestedContexts
|
|
2260
|
-
};
|