@shareai-lab/kode 2.0.2 → 2.0.3
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/LICENSE +201 -0
- package/README.md +649 -25
- package/README.zh-CN.md +579 -0
- package/cli-acp.js +3 -17
- package/cli.js +5 -7
- package/dist/chunks/Doctor-M3J7GRTJ.js +12 -0
- package/dist/chunks/LogList-ISWZ6DDD.js +121 -0
- package/dist/chunks/LogList-ISWZ6DDD.js.map +7 -0
- package/dist/chunks/REPL-RQ6LO6S7.js +56 -0
- package/dist/chunks/ResumeConversation-6DMVBEGH.js +56 -0
- package/dist/chunks/agentLoader-FCRG3TFJ.js +31 -0
- package/dist/{agentsValidate-XP3CFN6F.js → chunks/agentsValidate-PEWMYN4Q.js} +97 -69
- package/dist/chunks/agentsValidate-PEWMYN4Q.js.map +7 -0
- package/dist/{ask-3G5H5KD5.js → chunks/ask-D7SOHJ6Z.js} +36 -44
- package/dist/chunks/ask-D7SOHJ6Z.js.map +7 -0
- package/dist/chunks/autoUpdater-CNESBOKO.js +19 -0
- package/dist/{chunk-EH34V7CY.js → chunks/chunk-2JN5MY67.js} +12 -14
- package/dist/chunks/chunk-2JN5MY67.js.map +7 -0
- package/dist/chunks/chunk-2QONJ5MG.js +14 -0
- package/dist/chunks/chunk-2QONJ5MG.js.map +7 -0
- package/dist/chunks/chunk-2WEXPKHH.js +903 -0
- package/dist/chunks/chunk-2WEXPKHH.js.map +7 -0
- package/dist/{chunk-K2MI4TPB.js → chunks/chunk-3BYE3ME6.js} +717 -792
- package/dist/chunks/chunk-3BYE3ME6.js.map +7 -0
- package/dist/chunks/chunk-3JDNWX7W.js +1264 -0
- package/dist/chunks/chunk-3JDNWX7W.js.map +7 -0
- package/dist/chunks/chunk-3OEJVB5A.js +906 -0
- package/dist/chunks/chunk-3OEJVB5A.js.map +7 -0
- package/dist/chunks/chunk-3TNIOEBO.js +369 -0
- package/dist/chunks/chunk-3TNIOEBO.js.map +7 -0
- package/dist/chunks/chunk-4A46ZXMJ.js +67 -0
- package/dist/chunks/chunk-4A46ZXMJ.js.map +7 -0
- package/dist/{chunk-4GAIJGRH.js → chunks/chunk-4ATBQOFO.js} +107 -55
- package/dist/chunks/chunk-4ATBQOFO.js.map +7 -0
- package/dist/chunks/chunk-4CRUCZR4.js +0 -0
- package/dist/{chunk-54DNHKOD.js → chunks/chunk-4EO6SIQY.js} +32 -75
- package/dist/chunks/chunk-4EO6SIQY.js.map +7 -0
- package/dist/chunks/chunk-53M46S5I.js +64 -0
- package/dist/chunks/chunk-53M46S5I.js.map +7 -0
- package/dist/{chunk-JC6NCUG5.js → chunks/chunk-54KOYG5C.js} +0 -2
- package/dist/{chunk-EZXMVTDU.js → chunks/chunk-6BAS4WY6.js} +29 -45
- package/dist/chunks/chunk-6BAS4WY6.js.map +7 -0
- package/dist/{chunk-BHGTA6JQ.js → chunks/chunk-6KRRFSDN.js} +4 -6
- package/dist/chunks/chunk-6KRRFSDN.js.map +7 -0
- package/dist/chunks/chunk-6LJNZK4K.js +39 -0
- package/dist/chunks/chunk-6LJNZK4K.js.map +7 -0
- package/dist/chunks/chunk-6ZWEOSEI.js +666 -0
- package/dist/chunks/chunk-6ZWEOSEI.js.map +7 -0
- package/dist/chunks/chunk-77XDJMBP.js +3326 -0
- package/dist/chunks/chunk-77XDJMBP.js.map +7 -0
- package/dist/chunks/chunk-7RRW4NTB.js +6454 -0
- package/dist/chunks/chunk-7RRW4NTB.js.map +7 -0
- package/dist/chunks/chunk-7X3TW4JB.js +4520 -0
- package/dist/chunks/chunk-7X3TW4JB.js.map +7 -0
- package/dist/chunks/chunk-B3MW3YGY.js +1409 -0
- package/dist/chunks/chunk-B3MW3YGY.js.map +7 -0
- package/dist/chunks/chunk-BBJFHTBC.js +28 -0
- package/dist/chunks/chunk-BBJFHTBC.js.map +7 -0
- package/dist/chunks/chunk-BHDHXOXB.js +24 -0
- package/dist/chunks/chunk-BHDHXOXB.js.map +7 -0
- package/dist/{chunk-OZNRLY3E.js → chunks/chunk-BTA7SZ26.js} +152 -223
- package/dist/chunks/chunk-BTA7SZ26.js.map +7 -0
- package/dist/chunks/chunk-CDGRYGPZ.js +103 -0
- package/dist/chunks/chunk-CDGRYGPZ.js.map +7 -0
- package/dist/{chunk-S6HRABTA.js → chunks/chunk-CP6E5UG6.js} +1 -4
- package/dist/chunks/chunk-CP6E5UG6.js.map +7 -0
- package/dist/{chunk-2PMO2FS2.js → chunks/chunk-DQ4JHXMT.js} +462 -424
- package/dist/chunks/chunk-DQ4JHXMT.js.map +7 -0
- package/dist/chunks/chunk-DXD76CMV.js +208 -0
- package/dist/chunks/chunk-DXD76CMV.js.map +7 -0
- package/dist/chunks/chunk-GCQCAXJZ.js +0 -0
- package/dist/chunks/chunk-GELCZWMB.js +42 -0
- package/dist/chunks/chunk-GELCZWMB.js.map +7 -0
- package/dist/{chunk-NQLEUHMS.js → chunks/chunk-HJYOH4HC.js} +23 -18
- package/dist/chunks/chunk-HJYOH4HC.js.map +7 -0
- package/dist/chunks/chunk-HPYNW6TT.js +744 -0
- package/dist/chunks/chunk-HPYNW6TT.js.map +7 -0
- package/dist/{chunk-2KWKUXLT.js → chunks/chunk-HRJ3ICQK.js} +59 -55
- package/dist/chunks/chunk-HRJ3ICQK.js.map +7 -0
- package/dist/{chunk-ZQU3TXLC.js → chunks/chunk-IFCIADS3.js} +571 -573
- package/dist/chunks/chunk-IFCIADS3.js.map +7 -0
- package/dist/chunks/chunk-IN7XZ7BC.js +27 -0
- package/dist/chunks/chunk-IN7XZ7BC.js.map +7 -0
- package/dist/chunks/chunk-L7P4M4KW.js +193 -0
- package/dist/chunks/chunk-L7P4M4KW.js.map +7 -0
- package/dist/chunks/chunk-LB6TCPDI.js +0 -0
- package/dist/{chunk-3RUXVV4S.js → chunks/chunk-LOCXPQNJ.js} +1 -4
- package/dist/{chunk-3RUXVV4S.js.map → chunks/chunk-LOCXPQNJ.js.map} +2 -2
- package/dist/{chunk-IE2CG2TV.js → chunks/chunk-LOD5ZHCI.js} +213 -208
- package/dist/chunks/chunk-LOD5ZHCI.js.map +7 -0
- package/dist/{chunk-S3J2TLV6.js → chunks/chunk-M7P3QNRU.js} +1 -4
- package/dist/{chunk-S3J2TLV6.js.map → chunks/chunk-M7P3QNRU.js.map} +2 -2
- package/dist/chunks/chunk-PPHLQVL7.js +4234 -0
- package/dist/chunks/chunk-PPHLQVL7.js.map +7 -0
- package/dist/{chunk-ABLVTESJ.js → chunks/chunk-QAXE37B5.js} +1 -4
- package/dist/chunks/chunk-QAXE37B5.js.map +7 -0
- package/dist/chunks/chunk-QHQOBUF6.js +60 -0
- package/dist/chunks/chunk-QHQOBUF6.js.map +7 -0
- package/dist/{chunk-SRZZFAS7.js → chunks/chunk-RPJXO7GG.js} +241 -214
- package/dist/chunks/chunk-RPJXO7GG.js.map +7 -0
- package/dist/{chunk-NPFOMITO.js → chunks/chunk-SWQV4KSY.js} +1 -4
- package/dist/{chunk-NPFOMITO.js.map → chunks/chunk-SWQV4KSY.js.map} +2 -2
- package/dist/chunks/chunk-SZLAPULP.js +28 -0
- package/dist/chunks/chunk-SZLAPULP.js.map +7 -0
- package/dist/{chunk-SDGKPKDK.js → chunks/chunk-T7RB5V5J.js} +23 -25
- package/dist/chunks/chunk-T7RB5V5J.js.map +7 -0
- package/dist/{chunk-HN4E4UUQ.js → chunks/chunk-TI2CTTMA.js} +25 -17
- package/dist/chunks/chunk-TI2CTTMA.js.map +7 -0
- package/dist/{chunk-G6I7XROM.js → chunks/chunk-TNGVRTO5.js} +45 -20
- package/dist/chunks/chunk-TNGVRTO5.js.map +7 -0
- package/dist/chunks/chunk-TNWB3U5Y.js +2077 -0
- package/dist/chunks/chunk-TNWB3U5Y.js.map +7 -0
- package/dist/chunks/chunk-U2IHWPCU.js +12 -0
- package/dist/chunks/chunk-U2IHWPCU.js.map +7 -0
- package/dist/{chunk-KAA5BGMQ.js → chunks/chunk-UNOY3VJ2.js} +1 -4
- package/dist/{chunk-KAA5BGMQ.js.map → chunks/chunk-UNOY3VJ2.js.map} +2 -2
- package/dist/{chunk-3TXNP6HH.js → chunks/chunk-UVDJL6ZZ.js} +97 -58
- package/dist/chunks/chunk-UVDJL6ZZ.js.map +7 -0
- package/dist/chunks/chunk-VNCW4C2Z.js +13452 -0
- package/dist/chunks/chunk-VNCW4C2Z.js.map +7 -0
- package/dist/chunks/chunk-W5EGGA44.js +15 -0
- package/dist/chunks/chunk-W5EGGA44.js.map +7 -0
- package/dist/chunks/chunk-XR2W3MAM.js +1533 -0
- package/dist/chunks/chunk-XR2W3MAM.js.map +7 -0
- package/dist/{chunk-QYFKRZQC.js → chunks/chunk-YIO5EBMQ.js} +423 -377
- package/dist/chunks/chunk-YIO5EBMQ.js.map +7 -0
- package/dist/chunks/chunk-ZBVLKZ5V.js +1062 -0
- package/dist/chunks/chunk-ZBVLKZ5V.js.map +7 -0
- package/dist/{chunk-E6YNABER.js → chunks/chunk-ZCLTZIVP.js} +1 -4
- package/dist/chunks/chunk-ZCLTZIVP.js.map +7 -0
- package/dist/chunks/client-SILZNM5N.js +42 -0
- package/dist/{config-6ZMBCL23.js → chunks/config-25HRTPSP.js} +48 -10
- package/dist/chunks/cost-tracker-Z2UZT2J5.js +28 -0
- package/dist/{customCommands-DNEJS3ZU.js → chunks/customCommands-TYMYZRG5.js} +11 -8
- package/dist/chunks/engine-MRVF6FK6.js +39 -0
- package/dist/{env-OFAXZ3XG.js → chunks/env-TJ5NOBEB.js} +7 -5
- package/dist/{kodeAgentSessionId-X6XWQW7B.js → chunks/kodeAgentSessionId-VTNISJ2L.js} +2 -4
- package/dist/chunks/kodeAgentSessionLoad-YB2RKBGJ.js +15 -0
- package/dist/chunks/kodeAgentSessionResume-DZSIVKVA.js +13 -0
- package/dist/chunks/kodeAgentStreamJson-X5PLS2S6.js +11 -0
- package/dist/{kodeAgentStreamJsonSession-GRWG3SPE.js → chunks/kodeAgentStreamJsonSession-RDXM4XYF.js} +38 -24
- package/dist/chunks/kodeAgentStreamJsonSession-RDXM4XYF.js.map +7 -0
- package/dist/{chunk-4RTX4AG4.js → chunks/kodeAgentStructuredStdio-SVGDSB4P.js} +14 -9
- package/dist/chunks/kodeAgentStructuredStdio-SVGDSB4P.js.map +7 -0
- package/dist/{kodeHooks-TDMXFWSO.js → chunks/kodeHooks-RVKYRJHG.js} +11 -9
- package/dist/{llm-XVXWYOHK.js → chunks/llm-62N6T5ZT.js} +1734 -1526
- package/dist/chunks/llm-62N6T5ZT.js.map +7 -0
- package/dist/chunks/llmLazy-ZUSSE3ZA.js +13 -0
- package/dist/{mentionProcessor-YD7YXYGF.js → chunks/mentionProcessor-RJW5UPJD.js} +46 -16
- package/dist/chunks/mentionProcessor-RJW5UPJD.js.map +7 -0
- package/dist/{messages-OFUJSPRV.js → chunks/messages-EEWWLPHN.js} +2 -6
- package/dist/chunks/model-5TIEKQPD.js +37 -0
- package/dist/{openai-5G5D5Q4B.js → chunks/openai-XXK3YZG4.js} +13 -10
- package/dist/{outputStyles-HLDXFQK3.js → chunks/outputStyles-FAJTXN2A.js} +6 -9
- package/dist/chunks/permissions-HO7INPWM.js +27 -0
- package/dist/{pluginRuntime-FPTKK6NY.js → chunks/pluginRuntime-C7K5ULK2.js} +31 -48
- package/dist/chunks/pluginRuntime-C7K5ULK2.js.map +7 -0
- package/dist/chunks/pluginValidation-DAM7WRTC.js +20 -0
- package/dist/chunks/registry-XYJXMOA5.js +60 -0
- package/dist/chunks/responsesStreaming-JNGE2P3D.js +8 -0
- package/dist/chunks/runNonTextPrintMode-SVBLCZQX.js +577 -0
- package/dist/chunks/runNonTextPrintMode-SVBLCZQX.js.map +7 -0
- package/dist/chunks/server-REXXF5IK.js +46 -0
- package/dist/{skillMarketplace-PSNKDINM.js → chunks/skillMarketplace-N4HVHNST.js} +8 -6
- package/dist/chunks/src-OROQIWP3.js +44 -0
- package/dist/chunks/src-QXLGGMUW.js +1647 -0
- package/dist/chunks/src-QXLGGMUW.js.map +7 -0
- package/dist/{cli-SRV2INSL.js → chunks/src-SSDT6MVP.js} +2659 -3384
- package/dist/chunks/src-SSDT6MVP.js.map +7 -0
- package/dist/chunks/theme-YBJUIMWK.js +10 -0
- package/dist/{toolPermissionContext-65L65VEZ.js → chunks/toolPermissionContext-MOCTRR7N.js} +2 -4
- package/dist/chunks/toolPermissionSettings-EV2EJAXL.js +18 -0
- package/dist/chunks/toolPermissionSettings-EV2EJAXL.js.map +7 -0
- package/dist/chunks/uuid-6577SO6X.js +7 -0
- package/dist/chunks/uuid-6577SO6X.js.map +7 -0
- package/dist/chunks/webOnlyMode-ALXX7UQY.js +66 -0
- package/dist/chunks/webOnlyMode-ALXX7UQY.js.map +7 -0
- package/dist/entrypoints/cli.js +10 -0
- package/dist/entrypoints/cli.js.map +7 -0
- package/dist/entrypoints/daemon.js +10 -0
- package/dist/entrypoints/daemon.js.map +7 -0
- package/dist/entrypoints/mcp.js +71 -0
- package/dist/entrypoints/mcp.js.map +7 -0
- package/dist/index.js +6 -7
- package/dist/index.js.map +3 -3
- package/dist/sdk/client.cjs +391 -0
- package/dist/sdk/client.cjs.map +7 -0
- package/dist/sdk/client.js +364 -0
- package/dist/sdk/client.js.map +7 -0
- package/dist/sdk/core.cjs +19932 -0
- package/dist/sdk/core.cjs.map +7 -0
- package/dist/sdk/core.js +19893 -0
- package/dist/sdk/core.js.map +7 -0
- package/dist/sdk/daemon-client.cjs +257 -0
- package/dist/sdk/daemon-client.cjs.map +7 -0
- package/dist/sdk/daemon-client.js +221 -0
- package/dist/sdk/daemon-client.js.map +7 -0
- package/dist/sdk/protocol.cjs +170 -0
- package/dist/sdk/protocol.cjs.map +7 -0
- package/dist/sdk/protocol.js +140 -0
- package/dist/sdk/protocol.js.map +7 -0
- package/dist/sdk/runtime-node.cjs +236 -0
- package/dist/sdk/runtime-node.cjs.map +7 -0
- package/dist/sdk/runtime-node.js +222 -0
- package/dist/sdk/runtime-node.js.map +7 -0
- package/dist/sdk/runtime.cjs +17 -0
- package/dist/sdk/runtime.cjs.map +7 -0
- package/dist/sdk/runtime.js +0 -0
- package/dist/sdk/runtime.js.map +7 -0
- package/dist/sdk/tools.cjs +30300 -0
- package/dist/sdk/tools.cjs.map +7 -0
- package/dist/sdk/tools.js +30282 -0
- package/dist/sdk/tools.js.map +7 -0
- package/dist/webui/assets/index-5hlfByVS.css +1 -0
- package/dist/webui/assets/index-BR9lm1lA.js +82 -0
- package/dist/webui/index.html +28 -0
- package/package.json +93 -22
- package/scripts/binary-utils.cjs +12 -4
- package/scripts/cli-acp-wrapper.cjs +3 -17
- package/scripts/cli-wrapper.cjs +5 -7
- package/scripts/postinstall.js +8 -4
- package/dist/REPL-GIU4ZIXM.js +0 -42
- package/dist/acp-H3VJ77YG.js +0 -1357
- package/dist/acp-H3VJ77YG.js.map +0 -7
- package/dist/agentsValidate-XP3CFN6F.js.map +0 -7
- package/dist/ask-3G5H5KD5.js.map +0 -7
- package/dist/autoUpdater-DNRMJWFQ.js +0 -17
- package/dist/chunk-2KWKUXLT.js.map +0 -7
- package/dist/chunk-2PMO2FS2.js.map +0 -7
- package/dist/chunk-3TXNP6HH.js.map +0 -7
- package/dist/chunk-4GAIJGRH.js.map +0 -7
- package/dist/chunk-4RTX4AG4.js.map +0 -7
- package/dist/chunk-54DNHKOD.js.map +0 -7
- package/dist/chunk-67PY5IX6.js +0 -34
- package/dist/chunk-67PY5IX6.js.map +0 -7
- package/dist/chunk-6DRDLOLP.js +0 -2613
- package/dist/chunk-6DRDLOLP.js.map +0 -7
- package/dist/chunk-7CQVZNQV.js +0 -1609
- package/dist/chunk-7CQVZNQV.js.map +0 -7
- package/dist/chunk-ABLVTESJ.js.map +0 -7
- package/dist/chunk-AIMIPK4B.js +0 -835
- package/dist/chunk-AIMIPK4B.js.map +0 -7
- package/dist/chunk-BHGTA6JQ.js.map +0 -7
- package/dist/chunk-CIG63V4E.js +0 -72
- package/dist/chunk-CIG63V4E.js.map +0 -7
- package/dist/chunk-E6YNABER.js.map +0 -7
- package/dist/chunk-EH34V7CY.js.map +0 -7
- package/dist/chunk-EZXMVTDU.js.map +0 -7
- package/dist/chunk-FH5CHM6L.js +0 -148
- package/dist/chunk-FH5CHM6L.js.map +0 -7
- package/dist/chunk-G6I7XROM.js.map +0 -7
- package/dist/chunk-HN4E4UUQ.js.map +0 -7
- package/dist/chunk-HSPVVDIW.js +0 -30198
- package/dist/chunk-HSPVVDIW.js.map +0 -7
- package/dist/chunk-IE2CG2TV.js.map +0 -7
- package/dist/chunk-K2MI4TPB.js.map +0 -7
- package/dist/chunk-MN77D2F7.js +0 -2931
- package/dist/chunk-MN77D2F7.js.map +0 -7
- package/dist/chunk-NQLEUHMS.js.map +0 -7
- package/dist/chunk-OIFQB3S4.js +0 -515
- package/dist/chunk-OIFQB3S4.js.map +0 -7
- package/dist/chunk-OWTG2W3A.js +0 -164
- package/dist/chunk-OWTG2W3A.js.map +0 -7
- package/dist/chunk-OZNRLY3E.js.map +0 -7
- package/dist/chunk-QYFKRZQC.js.map +0 -7
- package/dist/chunk-S6HRABTA.js.map +0 -7
- package/dist/chunk-SDGKPKDK.js.map +0 -7
- package/dist/chunk-SRZZFAS7.js.map +0 -7
- package/dist/chunk-UKHTVRJM.js +0 -47
- package/dist/chunk-UKHTVRJM.js.map +0 -7
- package/dist/chunk-UYXEDKOZ.js +0 -24
- package/dist/chunk-UYXEDKOZ.js.map +0 -7
- package/dist/chunk-VBXVYQYY.js +0 -145
- package/dist/chunk-VBXVYQYY.js.map +0 -7
- package/dist/chunk-WVHORZQ5.js +0 -17
- package/dist/chunk-WVHORZQ5.js.map +0 -7
- package/dist/chunk-WWUWDNWW.js +0 -49
- package/dist/chunk-WWUWDNWW.js.map +0 -7
- package/dist/chunk-Z33T5YN5.js +0 -654
- package/dist/chunk-Z33T5YN5.js.map +0 -7
- package/dist/chunk-ZQU3TXLC.js.map +0 -7
- package/dist/cli-SRV2INSL.js.map +0 -7
- package/dist/commands-TWH6PGVG.js +0 -46
- package/dist/context-JQIOOI4W.js +0 -30
- package/dist/costTracker-6SL26FDB.js +0 -19
- package/dist/kodeAgentSessionLoad-6N27AC5K.js +0 -18
- package/dist/kodeAgentSessionResume-HUSAEO24.js +0 -16
- package/dist/kodeAgentStreamJson-NXFN7TXH.js +0 -13
- package/dist/kodeAgentStreamJsonSession-GRWG3SPE.js.map +0 -7
- package/dist/kodeAgentStructuredStdio-HGWJT7CU.js +0 -10
- package/dist/llm-XVXWYOHK.js.map +0 -7
- package/dist/llmLazy-7TD5N7XP.js +0 -15
- package/dist/loader-AUXIJTY6.js +0 -28
- package/dist/mcp-BXJ3K7NZ.js +0 -49
- package/dist/mentionProcessor-YD7YXYGF.js.map +0 -7
- package/dist/model-KPYCXWBK.js +0 -30
- package/dist/pluginRuntime-FPTKK6NY.js.map +0 -7
- package/dist/pluginValidation-DSFXZ4GF.js +0 -17
- package/dist/prompts-LWLAJRS2.js +0 -48
- package/dist/query-HVPWL27C.js +0 -50
- package/dist/responsesStreaming-AW344PQO.js +0 -10
- package/dist/ripgrep-YOPCY2GO.js +0 -17
- package/dist/state-KNRWP3FO.js +0 -16
- package/dist/theme-7S2QN2FO.js +0 -14
- package/dist/toolPermissionSettings-GPOBH4IV.js +0 -18
- package/dist/tools-FZU2FZBD.js +0 -47
- package/dist/userInput-VHNBN2MW.js +0 -311
- package/dist/userInput-VHNBN2MW.js.map +0 -7
- package/dist/uuid-QN2CNKKN.js +0 -9
- /package/dist/{REPL-GIU4ZIXM.js.map → chunks/Doctor-M3J7GRTJ.js.map} +0 -0
- /package/dist/{autoUpdater-DNRMJWFQ.js.map → chunks/REPL-RQ6LO6S7.js.map} +0 -0
- /package/dist/{chunk-JC6NCUG5.js.map → chunks/ResumeConversation-6DMVBEGH.js.map} +0 -0
- /package/dist/{commands-TWH6PGVG.js.map → chunks/agentLoader-FCRG3TFJ.js.map} +0 -0
- /package/dist/{config-6ZMBCL23.js.map → chunks/autoUpdater-CNESBOKO.js.map} +0 -0
- /package/dist/{context-JQIOOI4W.js.map → chunks/chunk-4CRUCZR4.js.map} +0 -0
- /package/dist/{costTracker-6SL26FDB.js.map → chunks/chunk-54KOYG5C.js.map} +0 -0
- /package/dist/{customCommands-DNEJS3ZU.js.map → chunks/chunk-GCQCAXJZ.js.map} +0 -0
- /package/dist/{env-OFAXZ3XG.js.map → chunks/chunk-LB6TCPDI.js.map} +0 -0
- /package/dist/{kodeAgentSessionId-X6XWQW7B.js.map → chunks/client-SILZNM5N.js.map} +0 -0
- /package/dist/{kodeAgentSessionLoad-6N27AC5K.js.map → chunks/config-25HRTPSP.js.map} +0 -0
- /package/dist/{kodeAgentSessionResume-HUSAEO24.js.map → chunks/cost-tracker-Z2UZT2J5.js.map} +0 -0
- /package/dist/{kodeAgentStreamJson-NXFN7TXH.js.map → chunks/customCommands-TYMYZRG5.js.map} +0 -0
- /package/dist/{kodeAgentStructuredStdio-HGWJT7CU.js.map → chunks/engine-MRVF6FK6.js.map} +0 -0
- /package/dist/{kodeHooks-TDMXFWSO.js.map → chunks/env-TJ5NOBEB.js.map} +0 -0
- /package/dist/{llmLazy-7TD5N7XP.js.map → chunks/kodeAgentSessionId-VTNISJ2L.js.map} +0 -0
- /package/dist/{loader-AUXIJTY6.js.map → chunks/kodeAgentSessionLoad-YB2RKBGJ.js.map} +0 -0
- /package/dist/{mcp-BXJ3K7NZ.js.map → chunks/kodeAgentSessionResume-DZSIVKVA.js.map} +0 -0
- /package/dist/{messages-OFUJSPRV.js.map → chunks/kodeAgentStreamJson-X5PLS2S6.js.map} +0 -0
- /package/dist/{model-KPYCXWBK.js.map → chunks/kodeHooks-RVKYRJHG.js.map} +0 -0
- /package/dist/{openai-5G5D5Q4B.js.map → chunks/llmLazy-ZUSSE3ZA.js.map} +0 -0
- /package/dist/{outputStyles-HLDXFQK3.js.map → chunks/messages-EEWWLPHN.js.map} +0 -0
- /package/dist/{pluginValidation-DSFXZ4GF.js.map → chunks/model-5TIEKQPD.js.map} +0 -0
- /package/dist/{prompts-LWLAJRS2.js.map → chunks/openai-XXK3YZG4.js.map} +0 -0
- /package/dist/{query-HVPWL27C.js.map → chunks/outputStyles-FAJTXN2A.js.map} +0 -0
- /package/dist/{responsesStreaming-AW344PQO.js.map → chunks/permissions-HO7INPWM.js.map} +0 -0
- /package/dist/{ripgrep-YOPCY2GO.js.map → chunks/pluginValidation-DAM7WRTC.js.map} +0 -0
- /package/dist/{skillMarketplace-PSNKDINM.js.map → chunks/registry-XYJXMOA5.js.map} +0 -0
- /package/dist/{state-KNRWP3FO.js.map → chunks/responsesStreaming-JNGE2P3D.js.map} +0 -0
- /package/dist/{theme-7S2QN2FO.js.map → chunks/server-REXXF5IK.js.map} +0 -0
- /package/dist/{toolPermissionContext-65L65VEZ.js.map → chunks/skillMarketplace-N4HVHNST.js.map} +0 -0
- /package/dist/{toolPermissionSettings-GPOBH4IV.js.map → chunks/src-OROQIWP3.js.map} +0 -0
- /package/dist/{tools-FZU2FZBD.js.map → chunks/theme-YBJUIMWK.js.map} +0 -0
- /package/dist/{uuid-QN2CNKKN.js.map → chunks/toolPermissionContext-MOCTRR7N.js.map} +0 -0
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
import { createRequire as __kodeCreateRequire } from "node:module";
|
|
2
|
-
const require = __kodeCreateRequire(import.meta.url);
|
|
3
1
|
import {
|
|
4
2
|
getSessionPlugins
|
|
5
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-M7P3QNRU.js";
|
|
6
4
|
import {
|
|
7
5
|
debug
|
|
8
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YIO5EBMQ.js";
|
|
9
7
|
import {
|
|
10
|
-
getCwd,
|
|
11
8
|
getKodeBaseDir,
|
|
12
9
|
logError
|
|
13
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3OEJVB5A.js";
|
|
11
|
+
import {
|
|
12
|
+
getCwd
|
|
13
|
+
} from "./chunk-BBJFHTBC.js";
|
|
14
14
|
|
|
15
|
-
// src/services/
|
|
16
|
-
import { existsSync, readFileSync
|
|
17
|
-
import {
|
|
18
|
-
import { homedir } from "os";
|
|
19
|
-
import { memoize } from "lodash-es";
|
|
15
|
+
// apps/cli/src/services/customCommands/execution.ts
|
|
16
|
+
import { existsSync, readFileSync } from "fs";
|
|
17
|
+
import { join } from "path";
|
|
20
18
|
import { execFile } from "child_process";
|
|
21
19
|
import { promisify } from "util";
|
|
22
|
-
import matter from "gray-matter";
|
|
23
|
-
import yaml from "js-yaml";
|
|
24
20
|
var execFileAsync = promisify(execFile);
|
|
25
21
|
async function executeBashCommands(content) {
|
|
26
22
|
const bashCommandRegex = /!\`([^`]+)\`/g;
|
|
27
23
|
const matches = [...content.matchAll(bashCommandRegex)];
|
|
28
|
-
if (matches.length === 0)
|
|
29
|
-
return content;
|
|
30
|
-
}
|
|
24
|
+
if (matches.length === 0) return content;
|
|
31
25
|
let result = content;
|
|
32
26
|
for (const match of matches) {
|
|
33
27
|
const fullMatch = match[0];
|
|
@@ -57,16 +51,12 @@ async function executeBashCommands(content) {
|
|
|
57
51
|
async function resolveFileReferences(content) {
|
|
58
52
|
const fileRefRegex = /@([a-zA-Z0-9/._-]+(?:\.[a-zA-Z0-9]+)?)/g;
|
|
59
53
|
const matches = [...content.matchAll(fileRefRegex)];
|
|
60
|
-
if (matches.length === 0)
|
|
61
|
-
return content;
|
|
62
|
-
}
|
|
54
|
+
if (matches.length === 0) return content;
|
|
63
55
|
let result = content;
|
|
64
56
|
for (const match of matches) {
|
|
65
57
|
const fullMatch = match[0];
|
|
66
58
|
const filePath = match[1];
|
|
67
|
-
if (filePath.startsWith("agent-"))
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
59
|
+
if (filePath.startsWith("agent-")) continue;
|
|
70
60
|
try {
|
|
71
61
|
const fullPath = join(getCwd(), filePath);
|
|
72
62
|
if (existsSync(fullPath)) {
|
|
@@ -93,12 +83,22 @@ ${fileContent}
|
|
|
93
83
|
}
|
|
94
84
|
return result;
|
|
95
85
|
}
|
|
86
|
+
|
|
87
|
+
// apps/cli/src/services/customCommands/frontmatter.ts
|
|
88
|
+
import matter from "gray-matter";
|
|
89
|
+
import yaml from "js-yaml";
|
|
96
90
|
function parseFrontmatter(content) {
|
|
97
91
|
const yamlSchema = yaml.JSON_SCHEMA;
|
|
98
92
|
const parsed = matter(content, {
|
|
99
93
|
engines: {
|
|
100
94
|
yaml: {
|
|
101
|
-
parse: (input) =>
|
|
95
|
+
parse: (input) => {
|
|
96
|
+
const loaded = yaml.load(
|
|
97
|
+
input,
|
|
98
|
+
yamlSchema ? { schema: yamlSchema } : void 0
|
|
99
|
+
);
|
|
100
|
+
return typeof loaded === "object" && loaded !== null ? loaded : {};
|
|
101
|
+
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
});
|
|
@@ -107,12 +107,6 @@ function parseFrontmatter(content) {
|
|
|
107
107
|
content: parsed.content ?? ""
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function isSkillMarkdownFile(filePath) {
|
|
111
|
-
return /^skill\.md$/i.test(basename(filePath));
|
|
112
|
-
}
|
|
113
|
-
function getUserKodeBaseDir() {
|
|
114
|
-
return getKodeBaseDir();
|
|
115
|
-
}
|
|
116
110
|
function toBoolean(value) {
|
|
117
111
|
if (typeof value === "boolean") return value;
|
|
118
112
|
if (typeof value === "string") {
|
|
@@ -140,12 +134,6 @@ function parseMaxThinkingTokens(frontmatter) {
|
|
|
140
134
|
if (!Number.isFinite(value) || value < 0) return void 0;
|
|
141
135
|
return Math.floor(value);
|
|
142
136
|
}
|
|
143
|
-
function sourceLabel(source) {
|
|
144
|
-
if (source === "localSettings") return "project";
|
|
145
|
-
if (source === "userSettings") return "user";
|
|
146
|
-
if (source === "pluginDir") return "plugin";
|
|
147
|
-
return "unknown";
|
|
148
|
-
}
|
|
149
137
|
function extractDescriptionFromMarkdown(markdown, fallback) {
|
|
150
138
|
const lines = markdown.split(/\r?\n/);
|
|
151
139
|
for (const line of lines) {
|
|
@@ -157,6 +145,28 @@ function extractDescriptionFromMarkdown(markdown, fallback) {
|
|
|
157
145
|
}
|
|
158
146
|
return fallback;
|
|
159
147
|
}
|
|
148
|
+
|
|
149
|
+
// apps/cli/src/services/customCommands/loader.ts
|
|
150
|
+
import { existsSync as existsSync4 } from "fs";
|
|
151
|
+
import { homedir } from "os";
|
|
152
|
+
import { join as join4 } from "path";
|
|
153
|
+
import { memoize } from "lodash-es";
|
|
154
|
+
|
|
155
|
+
// apps/cli/src/services/customCommands/discovery.ts
|
|
156
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, readdirSync } from "fs";
|
|
157
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
158
|
+
|
|
159
|
+
// apps/cli/src/services/customCommands/naming.ts
|
|
160
|
+
import { basename, dirname, relative, sep } from "path";
|
|
161
|
+
function isSkillMarkdownFile(filePath) {
|
|
162
|
+
return /^skill\.md$/i.test(basename(filePath));
|
|
163
|
+
}
|
|
164
|
+
function sourceLabel(source) {
|
|
165
|
+
if (source === "localSettings") return "project";
|
|
166
|
+
if (source === "userSettings") return "user";
|
|
167
|
+
if (source === "pluginDir") return "plugin";
|
|
168
|
+
return "unknown";
|
|
169
|
+
}
|
|
160
170
|
function namespaceFromDirPath(dirPath, baseDir) {
|
|
161
171
|
const relPath = relative(baseDir, dirPath);
|
|
162
172
|
if (!relPath || relPath === "." || relPath.startsWith("..")) return "";
|
|
@@ -188,14 +198,76 @@ function nameForPluginCommandFile(filePath, commandsDir, pluginName) {
|
|
|
188
198
|
const localName = noExt.split(sep).filter(Boolean).join(":");
|
|
189
199
|
return buildPluginQualifiedName(pluginName, localName);
|
|
190
200
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
)
|
|
201
|
+
|
|
202
|
+
// apps/cli/src/services/customCommands/discovery.ts
|
|
203
|
+
function listMarkdownFilesRecursively(baseDir, signal) {
|
|
204
|
+
const results = [];
|
|
205
|
+
const queue = [baseDir];
|
|
206
|
+
while (queue.length > 0) {
|
|
207
|
+
if (signal.aborted) break;
|
|
208
|
+
const currentDir = queue.pop();
|
|
209
|
+
let entries;
|
|
210
|
+
try {
|
|
211
|
+
entries = readdirSync(currentDir, { withFileTypes: true });
|
|
212
|
+
} catch {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
for (const entry of entries) {
|
|
216
|
+
if (signal.aborted) break;
|
|
217
|
+
const fullPath = join2(currentDir, entry.name);
|
|
218
|
+
if (entry.isDirectory()) {
|
|
219
|
+
queue.push(fullPath);
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (entry.isFile() && entry.name.toLowerCase().endsWith(".md")) {
|
|
223
|
+
results.push(fullPath);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return results;
|
|
228
|
+
}
|
|
229
|
+
function loadCommandMarkdownFilesFromBaseDir(baseDir, source, scope, signal) {
|
|
230
|
+
if (!existsSync2(baseDir)) return [];
|
|
231
|
+
const files = listMarkdownFilesRecursively(baseDir, signal);
|
|
232
|
+
const records = [];
|
|
233
|
+
for (const filePath of files) {
|
|
234
|
+
if (signal.aborted) break;
|
|
235
|
+
try {
|
|
236
|
+
const raw = readFileSync2(filePath, "utf8");
|
|
237
|
+
const { frontmatter, content } = parseFrontmatter(raw);
|
|
238
|
+
records.push({ baseDir, filePath, frontmatter, content, source, scope });
|
|
239
|
+
} catch {
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return records;
|
|
243
|
+
}
|
|
244
|
+
function applySkillFilePreference(files) {
|
|
245
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
246
|
+
for (const file of files) {
|
|
247
|
+
const key = dirname2(file.filePath);
|
|
248
|
+
const existing = grouped.get(key) ?? [];
|
|
249
|
+
existing.push(file);
|
|
250
|
+
grouped.set(key, existing);
|
|
251
|
+
}
|
|
252
|
+
const result = [];
|
|
253
|
+
for (const group of grouped.values()) {
|
|
254
|
+
const skillFiles = group.filter((f) => isSkillMarkdownFile(f.filePath));
|
|
255
|
+
if (skillFiles.length > 0) {
|
|
256
|
+
result.push(skillFiles[0]);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
result.push(...group);
|
|
260
|
+
}
|
|
261
|
+
return result;
|
|
262
|
+
}
|
|
263
|
+
function createPromptCommandFromFile(record) {
|
|
264
|
+
const isSkill = isSkillMarkdownFile(record.filePath);
|
|
265
|
+
const name = nameForCommandFile(record.filePath, record.baseDir);
|
|
197
266
|
if (!name) return null;
|
|
198
|
-
const descriptionText = record.frontmatter.description ?? extractDescriptionFromMarkdown(
|
|
267
|
+
const descriptionText = record.frontmatter.description ?? extractDescriptionFromMarkdown(
|
|
268
|
+
record.content,
|
|
269
|
+
isSkill ? "Skill" : "Custom command"
|
|
270
|
+
);
|
|
199
271
|
const allowedTools = parseAllowedTools(record.frontmatter["allowed-tools"]);
|
|
200
272
|
const maxThinkingTokens = parseMaxThinkingTokens(record.frontmatter);
|
|
201
273
|
const argumentHint = record.frontmatter["argument-hint"];
|
|
@@ -205,31 +277,39 @@ function createPluginPromptCommandFromFile(record) {
|
|
|
205
277
|
record.frontmatter["disable-model-invocation"]
|
|
206
278
|
);
|
|
207
279
|
const model = record.frontmatter.model === "inherit" ? void 0 : record.frontmatter.model;
|
|
280
|
+
const description = `${descriptionText} (${sourceLabel(record.source)})`;
|
|
281
|
+
const progressMessage = isSkill ? "loading" : "running";
|
|
282
|
+
const skillBaseDir = isSkill ? dirname2(record.filePath) : void 0;
|
|
208
283
|
return {
|
|
209
284
|
type: "prompt",
|
|
210
285
|
name,
|
|
211
|
-
description
|
|
286
|
+
description,
|
|
212
287
|
isEnabled: true,
|
|
213
288
|
isHidden: false,
|
|
214
289
|
filePath: record.filePath,
|
|
215
290
|
aliases: [],
|
|
216
|
-
progressMessage
|
|
291
|
+
progressMessage,
|
|
217
292
|
allowedTools,
|
|
218
293
|
maxThinkingTokens,
|
|
219
294
|
argumentHint,
|
|
220
295
|
whenToUse,
|
|
221
296
|
version,
|
|
222
297
|
model,
|
|
223
|
-
isSkill
|
|
298
|
+
isSkill,
|
|
224
299
|
disableModelInvocation,
|
|
225
300
|
hasUserSpecifiedDescription: !!record.frontmatter.description,
|
|
226
|
-
source:
|
|
227
|
-
scope:
|
|
301
|
+
source: record.source,
|
|
302
|
+
scope: record.scope,
|
|
228
303
|
userFacingName() {
|
|
229
304
|
return name;
|
|
230
305
|
},
|
|
231
306
|
async getPromptForCommand(args) {
|
|
232
307
|
let prompt = record.content;
|
|
308
|
+
if (isSkill && skillBaseDir) {
|
|
309
|
+
prompt = `Base directory for this skill: ${skillBaseDir}
|
|
310
|
+
|
|
311
|
+
${prompt}`;
|
|
312
|
+
}
|
|
233
313
|
const trimmedArgs = args.trim();
|
|
234
314
|
if (trimmedArgs) {
|
|
235
315
|
if (prompt.includes("$ARGUMENTS")) {
|
|
@@ -244,48 +324,12 @@ ARGUMENTS: ${trimmedArgs}`;
|
|
|
244
324
|
}
|
|
245
325
|
};
|
|
246
326
|
}
|
|
247
|
-
function
|
|
248
|
-
|
|
249
|
-
let files = [];
|
|
250
|
-
try {
|
|
251
|
-
const st = statSync(args.commandsDir);
|
|
252
|
-
if (st.isFile()) {
|
|
253
|
-
if (!args.commandsDir.toLowerCase().endsWith(".md")) return [];
|
|
254
|
-
files = [args.commandsDir];
|
|
255
|
-
commandsBaseDir = dirname(args.commandsDir);
|
|
256
|
-
} else if (st.isDirectory()) {
|
|
257
|
-
files = listMarkdownFilesRecursively(args.commandsDir, args.signal);
|
|
258
|
-
} else {
|
|
259
|
-
return [];
|
|
260
|
-
}
|
|
261
|
-
} catch {
|
|
262
|
-
return [];
|
|
263
|
-
}
|
|
264
|
-
const out = [];
|
|
265
|
-
for (const filePath of files) {
|
|
266
|
-
if (args.signal.aborted) break;
|
|
267
|
-
try {
|
|
268
|
-
const raw = readFileSync(filePath, "utf8");
|
|
269
|
-
const { frontmatter, content } = parseFrontmatter(raw);
|
|
270
|
-
const cmd = createPluginPromptCommandFromFile({
|
|
271
|
-
pluginName: args.pluginName,
|
|
272
|
-
commandsDir: commandsBaseDir,
|
|
273
|
-
filePath,
|
|
274
|
-
frontmatter,
|
|
275
|
-
content
|
|
276
|
-
});
|
|
277
|
-
if (cmd) out.push(cmd);
|
|
278
|
-
} catch {
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
return out;
|
|
282
|
-
}
|
|
283
|
-
function loadPluginSkillDirectoryCommandsFromBaseDir(args) {
|
|
284
|
-
if (!existsSync(args.skillsDir)) return [];
|
|
327
|
+
function loadSkillDirectoryCommandsFromBaseDir(skillsDir, source, scope) {
|
|
328
|
+
if (!existsSync2(skillsDir)) return [];
|
|
285
329
|
const out = [];
|
|
286
330
|
let entries;
|
|
287
331
|
try {
|
|
288
|
-
entries = readdirSync(
|
|
332
|
+
entries = readdirSync(skillsDir, { withFileTypes: true });
|
|
289
333
|
} catch {
|
|
290
334
|
return [];
|
|
291
335
|
}
|
|
@@ -296,18 +340,18 @@ function loadPluginSkillDirectoryCommandsFromBaseDir(args) {
|
|
|
296
340
|
};
|
|
297
341
|
for (const entry of entries) {
|
|
298
342
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
|
|
299
|
-
const skillDir =
|
|
343
|
+
const skillDir = join2(skillsDir, entry.name);
|
|
300
344
|
const skillFileCandidates = [
|
|
301
|
-
|
|
302
|
-
|
|
345
|
+
join2(skillDir, "SKILL.md"),
|
|
346
|
+
join2(skillDir, "skill.md")
|
|
303
347
|
];
|
|
304
|
-
const skillFile = skillFileCandidates.find((p) =>
|
|
348
|
+
const skillFile = skillFileCandidates.find((p) => existsSync2(p));
|
|
305
349
|
if (!skillFile) continue;
|
|
306
350
|
try {
|
|
307
|
-
const raw =
|
|
351
|
+
const raw = readFileSync2(skillFile, "utf8");
|
|
308
352
|
const { frontmatter, content } = parseFrontmatter(raw);
|
|
309
353
|
const dirName = entry.name;
|
|
310
|
-
const declaredName = typeof frontmatter.name === "string" ?
|
|
354
|
+
const declaredName = typeof frontmatter.name === "string" ? frontmatter.name.trim() : "";
|
|
311
355
|
const effectiveDeclaredName = declaredName && declaredName === dirName ? declaredName : "";
|
|
312
356
|
if (declaredName && declaredName !== dirName) {
|
|
313
357
|
if (strictMode) continue;
|
|
@@ -317,10 +361,13 @@ function loadPluginSkillDirectoryCommandsFromBaseDir(args) {
|
|
|
317
361
|
skillFile
|
|
318
362
|
});
|
|
319
363
|
}
|
|
320
|
-
const name =
|
|
321
|
-
if (!validateName(
|
|
364
|
+
const name = dirName;
|
|
365
|
+
if (!validateName(name)) {
|
|
322
366
|
if (strictMode) continue;
|
|
323
|
-
debug.warn("CUSTOM_COMMAND_SKILL_DIR_INVALID", {
|
|
367
|
+
debug.warn("CUSTOM_COMMAND_SKILL_DIR_INVALID", {
|
|
368
|
+
name,
|
|
369
|
+
skillFile
|
|
370
|
+
});
|
|
324
371
|
}
|
|
325
372
|
const descriptionText = frontmatter.description ?? extractDescriptionFromMarkdown(content, "Skill");
|
|
326
373
|
if (strictMode) {
|
|
@@ -339,7 +386,7 @@ function loadPluginSkillDirectoryCommandsFromBaseDir(args) {
|
|
|
339
386
|
out.push({
|
|
340
387
|
type: "prompt",
|
|
341
388
|
name,
|
|
342
|
-
description: `${descriptionText} (${sourceLabel(
|
|
389
|
+
description: `${descriptionText} (${sourceLabel(source)})`,
|
|
343
390
|
isEnabled: true,
|
|
344
391
|
isHidden: true,
|
|
345
392
|
aliases: [],
|
|
@@ -354,10 +401,10 @@ function loadPluginSkillDirectoryCommandsFromBaseDir(args) {
|
|
|
354
401
|
isSkill: true,
|
|
355
402
|
disableModelInvocation,
|
|
356
403
|
hasUserSpecifiedDescription: !!frontmatter.description,
|
|
357
|
-
source
|
|
358
|
-
scope
|
|
404
|
+
source,
|
|
405
|
+
scope,
|
|
359
406
|
userFacingName() {
|
|
360
|
-
return effectiveDeclaredName
|
|
407
|
+
return effectiveDeclaredName || name;
|
|
361
408
|
},
|
|
362
409
|
async getPromptForCommand(argsText) {
|
|
363
410
|
let prompt = `Base directory for this skill: ${skillDir}
|
|
@@ -381,33 +428,18 @@ ARGUMENTS: ${trimmedArgs}`;
|
|
|
381
428
|
}
|
|
382
429
|
return out;
|
|
383
430
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
for (const group of grouped.values()) {
|
|
394
|
-
const skillFiles = group.filter((f) => isSkillMarkdownFile(f.filePath));
|
|
395
|
-
if (skillFiles.length > 0) {
|
|
396
|
-
result.push(skillFiles[0]);
|
|
397
|
-
continue;
|
|
398
|
-
}
|
|
399
|
-
result.push(...group);
|
|
400
|
-
}
|
|
401
|
-
return result;
|
|
402
|
-
}
|
|
403
|
-
function createPromptCommandFromFile(record) {
|
|
404
|
-
const isSkill = isSkillMarkdownFile(record.filePath);
|
|
405
|
-
const name = nameForCommandFile(record.filePath, record.baseDir);
|
|
406
|
-
if (!name) return null;
|
|
407
|
-
const descriptionText = record.frontmatter.description ?? extractDescriptionFromMarkdown(
|
|
408
|
-
record.content,
|
|
409
|
-
isSkill ? "Skill" : "Custom command"
|
|
431
|
+
|
|
432
|
+
// apps/cli/src/services/customCommands/pluginLoader.ts
|
|
433
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync } from "fs";
|
|
434
|
+
import { dirname as dirname3, join as join3 } from "path";
|
|
435
|
+
function createPluginPromptCommandFromFile(record) {
|
|
436
|
+
const name = nameForPluginCommandFile(
|
|
437
|
+
record.filePath,
|
|
438
|
+
record.commandsDir,
|
|
439
|
+
record.pluginName
|
|
410
440
|
);
|
|
441
|
+
if (!name) return null;
|
|
442
|
+
const descriptionText = record.frontmatter.description ?? extractDescriptionFromMarkdown(record.content, "Custom command");
|
|
411
443
|
const allowedTools = parseAllowedTools(record.frontmatter["allowed-tools"]);
|
|
412
444
|
const maxThinkingTokens = parseMaxThinkingTokens(record.frontmatter);
|
|
413
445
|
const argumentHint = record.frontmatter["argument-hint"];
|
|
@@ -417,39 +449,31 @@ function createPromptCommandFromFile(record) {
|
|
|
417
449
|
record.frontmatter["disable-model-invocation"]
|
|
418
450
|
);
|
|
419
451
|
const model = record.frontmatter.model === "inherit" ? void 0 : record.frontmatter.model;
|
|
420
|
-
const description = `${descriptionText} (${sourceLabel(record.source)})`;
|
|
421
|
-
const progressMessage = isSkill ? "loading" : "running";
|
|
422
|
-
const skillBaseDir = isSkill ? dirname(record.filePath) : void 0;
|
|
423
452
|
return {
|
|
424
453
|
type: "prompt",
|
|
425
454
|
name,
|
|
426
|
-
description
|
|
455
|
+
description: `${descriptionText} (${sourceLabel("pluginDir")})`,
|
|
427
456
|
isEnabled: true,
|
|
428
457
|
isHidden: false,
|
|
429
458
|
filePath: record.filePath,
|
|
430
459
|
aliases: [],
|
|
431
|
-
progressMessage,
|
|
460
|
+
progressMessage: "running",
|
|
432
461
|
allowedTools,
|
|
433
462
|
maxThinkingTokens,
|
|
434
463
|
argumentHint,
|
|
435
464
|
whenToUse,
|
|
436
465
|
version,
|
|
437
466
|
model,
|
|
438
|
-
isSkill,
|
|
467
|
+
isSkill: false,
|
|
439
468
|
disableModelInvocation,
|
|
440
469
|
hasUserSpecifiedDescription: !!record.frontmatter.description,
|
|
441
|
-
source:
|
|
442
|
-
scope:
|
|
470
|
+
source: "pluginDir",
|
|
471
|
+
scope: "project",
|
|
443
472
|
userFacingName() {
|
|
444
473
|
return name;
|
|
445
474
|
},
|
|
446
475
|
async getPromptForCommand(args) {
|
|
447
476
|
let prompt = record.content;
|
|
448
|
-
if (isSkill && skillBaseDir) {
|
|
449
|
-
prompt = `Base directory for this skill: ${skillBaseDir}
|
|
450
|
-
|
|
451
|
-
${prompt}`;
|
|
452
|
-
}
|
|
453
477
|
const trimmedArgs = args.trim();
|
|
454
478
|
if (trimmedArgs) {
|
|
455
479
|
if (prompt.includes("$ARGUMENTS")) {
|
|
@@ -464,53 +488,48 @@ ARGUMENTS: ${trimmedArgs}`;
|
|
|
464
488
|
}
|
|
465
489
|
};
|
|
466
490
|
}
|
|
467
|
-
function
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
if (signal.aborted) break;
|
|
481
|
-
const fullPath = join(currentDir, entry.name);
|
|
482
|
-
if (entry.isDirectory()) {
|
|
483
|
-
queue.push(fullPath);
|
|
484
|
-
continue;
|
|
485
|
-
}
|
|
486
|
-
if (entry.isFile() && entry.name.toLowerCase().endsWith(".md")) {
|
|
487
|
-
results.push(fullPath);
|
|
488
|
-
}
|
|
491
|
+
function loadPluginCommandsFromDir(args) {
|
|
492
|
+
let commandsBaseDir = args.commandsDir;
|
|
493
|
+
let files = [];
|
|
494
|
+
try {
|
|
495
|
+
const st = statSync(args.commandsDir);
|
|
496
|
+
if (st.isFile()) {
|
|
497
|
+
if (!args.commandsDir.toLowerCase().endsWith(".md")) return [];
|
|
498
|
+
files = [args.commandsDir];
|
|
499
|
+
commandsBaseDir = dirname3(args.commandsDir);
|
|
500
|
+
} else if (st.isDirectory()) {
|
|
501
|
+
files = listMarkdownFilesRecursively(args.commandsDir, args.signal);
|
|
502
|
+
} else {
|
|
503
|
+
return [];
|
|
489
504
|
}
|
|
505
|
+
} catch {
|
|
506
|
+
return [];
|
|
490
507
|
}
|
|
491
|
-
|
|
492
|
-
}
|
|
493
|
-
function loadCommandMarkdownFilesFromBaseDir(baseDir, source, scope, signal) {
|
|
494
|
-
if (!existsSync(baseDir)) return [];
|
|
495
|
-
const files = listMarkdownFilesRecursively(baseDir, signal);
|
|
496
|
-
const records = [];
|
|
508
|
+
const out = [];
|
|
497
509
|
for (const filePath of files) {
|
|
498
|
-
if (signal.aborted) break;
|
|
510
|
+
if (args.signal.aborted) break;
|
|
499
511
|
try {
|
|
500
|
-
const raw =
|
|
512
|
+
const raw = readFileSync3(filePath, "utf8");
|
|
501
513
|
const { frontmatter, content } = parseFrontmatter(raw);
|
|
502
|
-
|
|
514
|
+
const cmd = createPluginPromptCommandFromFile({
|
|
515
|
+
pluginName: args.pluginName,
|
|
516
|
+
commandsDir: commandsBaseDir,
|
|
517
|
+
filePath,
|
|
518
|
+
frontmatter,
|
|
519
|
+
content
|
|
520
|
+
});
|
|
521
|
+
if (cmd) out.push(cmd);
|
|
503
522
|
} catch {
|
|
504
523
|
}
|
|
505
524
|
}
|
|
506
|
-
return
|
|
525
|
+
return out;
|
|
507
526
|
}
|
|
508
|
-
function
|
|
509
|
-
if (!
|
|
527
|
+
function loadPluginSkillDirectoryCommandsFromBaseDir(args) {
|
|
528
|
+
if (!existsSync3(args.skillsDir)) return [];
|
|
510
529
|
const out = [];
|
|
511
530
|
let entries;
|
|
512
531
|
try {
|
|
513
|
-
entries =
|
|
532
|
+
entries = readdirSync2(args.skillsDir, { withFileTypes: true });
|
|
514
533
|
} catch {
|
|
515
534
|
return [];
|
|
516
535
|
}
|
|
@@ -521,18 +540,18 @@ function loadSkillDirectoryCommandsFromBaseDir(skillsDir, source, scope) {
|
|
|
521
540
|
};
|
|
522
541
|
for (const entry of entries) {
|
|
523
542
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
|
|
524
|
-
const skillDir =
|
|
543
|
+
const skillDir = join3(args.skillsDir, entry.name);
|
|
525
544
|
const skillFileCandidates = [
|
|
526
|
-
|
|
527
|
-
|
|
545
|
+
join3(skillDir, "SKILL.md"),
|
|
546
|
+
join3(skillDir, "skill.md")
|
|
528
547
|
];
|
|
529
|
-
const skillFile = skillFileCandidates.find((p) =>
|
|
548
|
+
const skillFile = skillFileCandidates.find((p) => existsSync3(p));
|
|
530
549
|
if (!skillFile) continue;
|
|
531
550
|
try {
|
|
532
|
-
const raw =
|
|
551
|
+
const raw = readFileSync3(skillFile, "utf8");
|
|
533
552
|
const { frontmatter, content } = parseFrontmatter(raw);
|
|
534
553
|
const dirName = entry.name;
|
|
535
|
-
const declaredName = typeof frontmatter.name === "string" ?
|
|
554
|
+
const declaredName = typeof frontmatter.name === "string" ? frontmatter.name.trim() : "";
|
|
536
555
|
const effectiveDeclaredName = declaredName && declaredName === dirName ? declaredName : "";
|
|
537
556
|
if (declaredName && declaredName !== dirName) {
|
|
538
557
|
if (strictMode) continue;
|
|
@@ -542,10 +561,13 @@ function loadSkillDirectoryCommandsFromBaseDir(skillsDir, source, scope) {
|
|
|
542
561
|
skillFile
|
|
543
562
|
});
|
|
544
563
|
}
|
|
545
|
-
const name = dirName;
|
|
546
|
-
if (!validateName(
|
|
564
|
+
const name = buildPluginQualifiedName(args.pluginName, dirName);
|
|
565
|
+
if (!validateName(dirName)) {
|
|
547
566
|
if (strictMode) continue;
|
|
548
|
-
debug.warn("CUSTOM_COMMAND_SKILL_DIR_INVALID", {
|
|
567
|
+
debug.warn("CUSTOM_COMMAND_SKILL_DIR_INVALID", {
|
|
568
|
+
dirName,
|
|
569
|
+
skillFile
|
|
570
|
+
});
|
|
549
571
|
}
|
|
550
572
|
const descriptionText = frontmatter.description ?? extractDescriptionFromMarkdown(content, "Skill");
|
|
551
573
|
if (strictMode) {
|
|
@@ -564,7 +586,7 @@ function loadSkillDirectoryCommandsFromBaseDir(skillsDir, source, scope) {
|
|
|
564
586
|
out.push({
|
|
565
587
|
type: "prompt",
|
|
566
588
|
name,
|
|
567
|
-
description: `${descriptionText} (${sourceLabel(
|
|
589
|
+
description: `${descriptionText} (${sourceLabel("pluginDir")})`,
|
|
568
590
|
isEnabled: true,
|
|
569
591
|
isHidden: true,
|
|
570
592
|
aliases: [],
|
|
@@ -579,16 +601,16 @@ function loadSkillDirectoryCommandsFromBaseDir(skillsDir, source, scope) {
|
|
|
579
601
|
isSkill: true,
|
|
580
602
|
disableModelInvocation,
|
|
581
603
|
hasUserSpecifiedDescription: !!frontmatter.description,
|
|
582
|
-
source,
|
|
583
|
-
scope,
|
|
604
|
+
source: "pluginDir",
|
|
605
|
+
scope: "project",
|
|
584
606
|
userFacingName() {
|
|
585
|
-
return effectiveDeclaredName
|
|
607
|
+
return effectiveDeclaredName ? buildPluginQualifiedName(args.pluginName, effectiveDeclaredName) : name;
|
|
586
608
|
},
|
|
587
|
-
async getPromptForCommand(
|
|
609
|
+
async getPromptForCommand(argsText) {
|
|
588
610
|
let prompt = `Base directory for this skill: ${skillDir}
|
|
589
611
|
|
|
590
612
|
${content}`;
|
|
591
|
-
const trimmedArgs =
|
|
613
|
+
const trimmedArgs = argsText.trim();
|
|
592
614
|
if (trimmedArgs) {
|
|
593
615
|
if (prompt.includes("$ARGUMENTS")) {
|
|
594
616
|
prompt = prompt.replaceAll("$ARGUMENTS", trimmedArgs);
|
|
@@ -606,19 +628,24 @@ ARGUMENTS: ${trimmedArgs}`;
|
|
|
606
628
|
}
|
|
607
629
|
return out;
|
|
608
630
|
}
|
|
631
|
+
|
|
632
|
+
// apps/cli/src/services/customCommands/loader.ts
|
|
633
|
+
function getUserKodeBaseDir() {
|
|
634
|
+
return getKodeBaseDir();
|
|
635
|
+
}
|
|
609
636
|
var loadCustomCommands = memoize(
|
|
610
637
|
async () => {
|
|
611
638
|
const cwd = getCwd();
|
|
612
639
|
const userKodeBaseDir = getUserKodeBaseDir();
|
|
613
640
|
const sessionPlugins = getSessionPlugins();
|
|
614
|
-
const projectLegacyCommandsDir =
|
|
615
|
-
const userLegacyCommandsDir =
|
|
616
|
-
const projectKodeCommandsDir =
|
|
617
|
-
const userKodeCommandsDir =
|
|
618
|
-
const projectLegacySkillsDir =
|
|
619
|
-
const userLegacySkillsDir =
|
|
620
|
-
const projectKodeSkillsDir =
|
|
621
|
-
const userKodeSkillsDir =
|
|
641
|
+
const projectLegacyCommandsDir = join4(cwd, ".claude", "commands");
|
|
642
|
+
const userLegacyCommandsDir = join4(homedir(), ".claude", "commands");
|
|
643
|
+
const projectKodeCommandsDir = join4(cwd, ".kode", "commands");
|
|
644
|
+
const userKodeCommandsDir = join4(userKodeBaseDir, "commands");
|
|
645
|
+
const projectLegacySkillsDir = join4(cwd, ".claude", "skills");
|
|
646
|
+
const userLegacySkillsDir = join4(homedir(), ".claude", "skills");
|
|
647
|
+
const projectKodeSkillsDir = join4(cwd, ".kode", "skills");
|
|
648
|
+
const userKodeSkillsDir = join4(userKodeBaseDir, "skills");
|
|
622
649
|
const abortController = new AbortController();
|
|
623
650
|
const timeout = setTimeout(() => abortController.abort(), 3e3);
|
|
624
651
|
try {
|
|
@@ -721,16 +748,16 @@ var loadCustomCommands = memoize(
|
|
|
721
748
|
const cwd = getCwd();
|
|
722
749
|
const userKodeBaseDir = getUserKodeBaseDir();
|
|
723
750
|
const dirs = [
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
751
|
+
join4(homedir(), ".claude", "commands"),
|
|
752
|
+
join4(cwd, ".claude", "commands"),
|
|
753
|
+
join4(userKodeBaseDir, "commands"),
|
|
754
|
+
join4(cwd, ".kode", "commands"),
|
|
755
|
+
join4(homedir(), ".claude", "skills"),
|
|
756
|
+
join4(cwd, ".claude", "skills"),
|
|
757
|
+
join4(userKodeBaseDir, "skills"),
|
|
758
|
+
join4(cwd, ".kode", "skills")
|
|
732
759
|
];
|
|
733
|
-
const exists = dirs.map((d) =>
|
|
760
|
+
const exists = dirs.map((d) => existsSync4(d) ? "1" : "0").join("");
|
|
734
761
|
return `${cwd}:${exists}:${Math.floor(Date.now() / 6e4)}`;
|
|
735
762
|
}
|
|
736
763
|
);
|
|
@@ -740,19 +767,19 @@ var reloadCustomCommands = () => {
|
|
|
740
767
|
function getCustomCommandDirectories() {
|
|
741
768
|
const userKodeBaseDir = getUserKodeBaseDir();
|
|
742
769
|
return {
|
|
743
|
-
userClaudeCommands:
|
|
744
|
-
projectClaudeCommands:
|
|
745
|
-
userClaudeSkills:
|
|
746
|
-
projectClaudeSkills:
|
|
747
|
-
userKodeCommands:
|
|
748
|
-
projectKodeCommands:
|
|
749
|
-
userKodeSkills:
|
|
750
|
-
projectKodeSkills:
|
|
770
|
+
userClaudeCommands: join4(homedir(), ".claude", "commands"),
|
|
771
|
+
projectClaudeCommands: join4(getCwd(), ".claude", "commands"),
|
|
772
|
+
userClaudeSkills: join4(homedir(), ".claude", "skills"),
|
|
773
|
+
projectClaudeSkills: join4(getCwd(), ".claude", "skills"),
|
|
774
|
+
userKodeCommands: join4(userKodeBaseDir, "commands"),
|
|
775
|
+
projectKodeCommands: join4(getCwd(), ".kode", "commands"),
|
|
776
|
+
userKodeSkills: join4(userKodeBaseDir, "skills"),
|
|
777
|
+
projectKodeSkills: join4(getCwd(), ".kode", "skills")
|
|
751
778
|
};
|
|
752
779
|
}
|
|
753
780
|
function hasCustomCommands() {
|
|
754
781
|
const dirs = getCustomCommandDirectories();
|
|
755
|
-
return
|
|
782
|
+
return existsSync4(dirs.userClaudeCommands) || existsSync4(dirs.projectClaudeCommands) || existsSync4(dirs.userClaudeSkills) || existsSync4(dirs.projectClaudeSkills) || existsSync4(dirs.userKodeCommands) || existsSync4(dirs.projectKodeCommands) || existsSync4(dirs.userKodeSkills) || existsSync4(dirs.projectKodeSkills);
|
|
756
783
|
}
|
|
757
784
|
|
|
758
785
|
export {
|