@shareai-lab/kode 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +426 -0
  3. package/README.zh-CN.md +326 -0
  4. package/cli.js +79 -0
  5. package/package.json +119 -0
  6. package/scripts/postinstall.js +18 -0
  7. package/src/ProjectOnboarding.tsx +198 -0
  8. package/src/Tool.ts +82 -0
  9. package/src/commands/agents.tsx +3410 -0
  10. package/src/commands/approvedTools.ts +53 -0
  11. package/src/commands/bug.tsx +20 -0
  12. package/src/commands/clear.ts +43 -0
  13. package/src/commands/compact.ts +120 -0
  14. package/src/commands/config.tsx +19 -0
  15. package/src/commands/cost.ts +18 -0
  16. package/src/commands/ctx_viz.ts +209 -0
  17. package/src/commands/doctor.ts +24 -0
  18. package/src/commands/help.tsx +19 -0
  19. package/src/commands/init.ts +37 -0
  20. package/src/commands/listen.ts +42 -0
  21. package/src/commands/login.tsx +51 -0
  22. package/src/commands/logout.tsx +40 -0
  23. package/src/commands/mcp.ts +41 -0
  24. package/src/commands/model.tsx +40 -0
  25. package/src/commands/modelstatus.tsx +20 -0
  26. package/src/commands/onboarding.tsx +34 -0
  27. package/src/commands/pr_comments.ts +59 -0
  28. package/src/commands/refreshCommands.ts +54 -0
  29. package/src/commands/release-notes.ts +34 -0
  30. package/src/commands/resume.tsx +31 -0
  31. package/src/commands/review.ts +49 -0
  32. package/src/commands/terminalSetup.ts +221 -0
  33. package/src/commands.ts +139 -0
  34. package/src/components/ApproveApiKey.tsx +93 -0
  35. package/src/components/AsciiLogo.tsx +13 -0
  36. package/src/components/AutoUpdater.tsx +148 -0
  37. package/src/components/Bug.tsx +367 -0
  38. package/src/components/Config.tsx +293 -0
  39. package/src/components/ConsoleOAuthFlow.tsx +327 -0
  40. package/src/components/Cost.tsx +23 -0
  41. package/src/components/CostThresholdDialog.tsx +46 -0
  42. package/src/components/CustomSelect/option-map.ts +42 -0
  43. package/src/components/CustomSelect/select-option.tsx +78 -0
  44. package/src/components/CustomSelect/select.tsx +152 -0
  45. package/src/components/CustomSelect/theme.ts +45 -0
  46. package/src/components/CustomSelect/use-select-state.ts +414 -0
  47. package/src/components/CustomSelect/use-select.ts +35 -0
  48. package/src/components/FallbackToolUseRejectedMessage.tsx +15 -0
  49. package/src/components/FileEditToolUpdatedMessage.tsx +66 -0
  50. package/src/components/Help.tsx +215 -0
  51. package/src/components/HighlightedCode.tsx +33 -0
  52. package/src/components/InvalidConfigDialog.tsx +113 -0
  53. package/src/components/Link.tsx +32 -0
  54. package/src/components/LogSelector.tsx +86 -0
  55. package/src/components/Logo.tsx +170 -0
  56. package/src/components/MCPServerApprovalDialog.tsx +100 -0
  57. package/src/components/MCPServerDialogCopy.tsx +25 -0
  58. package/src/components/MCPServerMultiselectDialog.tsx +109 -0
  59. package/src/components/Message.tsx +221 -0
  60. package/src/components/MessageResponse.tsx +15 -0
  61. package/src/components/MessageSelector.tsx +211 -0
  62. package/src/components/ModeIndicator.tsx +88 -0
  63. package/src/components/ModelConfig.tsx +301 -0
  64. package/src/components/ModelListManager.tsx +227 -0
  65. package/src/components/ModelSelector.tsx +3387 -0
  66. package/src/components/ModelStatusDisplay.tsx +230 -0
  67. package/src/components/Onboarding.tsx +274 -0
  68. package/src/components/PressEnterToContinue.tsx +11 -0
  69. package/src/components/PromptInput.tsx +760 -0
  70. package/src/components/SentryErrorBoundary.ts +39 -0
  71. package/src/components/Spinner.tsx +129 -0
  72. package/src/components/StickerRequestForm.tsx +16 -0
  73. package/src/components/StructuredDiff.tsx +191 -0
  74. package/src/components/TextInput.tsx +259 -0
  75. package/src/components/TodoItem.tsx +47 -0
  76. package/src/components/TokenWarning.tsx +31 -0
  77. package/src/components/ToolUseLoader.tsx +40 -0
  78. package/src/components/TrustDialog.tsx +106 -0
  79. package/src/components/binary-feedback/BinaryFeedback.tsx +63 -0
  80. package/src/components/binary-feedback/BinaryFeedbackOption.tsx +111 -0
  81. package/src/components/binary-feedback/BinaryFeedbackView.tsx +172 -0
  82. package/src/components/binary-feedback/utils.ts +220 -0
  83. package/src/components/messages/AssistantBashOutputMessage.tsx +22 -0
  84. package/src/components/messages/AssistantLocalCommandOutputMessage.tsx +49 -0
  85. package/src/components/messages/AssistantRedactedThinkingMessage.tsx +19 -0
  86. package/src/components/messages/AssistantTextMessage.tsx +144 -0
  87. package/src/components/messages/AssistantThinkingMessage.tsx +40 -0
  88. package/src/components/messages/AssistantToolUseMessage.tsx +133 -0
  89. package/src/components/messages/TaskProgressMessage.tsx +32 -0
  90. package/src/components/messages/TaskToolMessage.tsx +58 -0
  91. package/src/components/messages/UserBashInputMessage.tsx +28 -0
  92. package/src/components/messages/UserCommandMessage.tsx +30 -0
  93. package/src/components/messages/UserKodingInputMessage.tsx +28 -0
  94. package/src/components/messages/UserPromptMessage.tsx +35 -0
  95. package/src/components/messages/UserTextMessage.tsx +39 -0
  96. package/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.tsx +12 -0
  97. package/src/components/messages/UserToolResultMessage/UserToolErrorMessage.tsx +36 -0
  98. package/src/components/messages/UserToolResultMessage/UserToolRejectMessage.tsx +31 -0
  99. package/src/components/messages/UserToolResultMessage/UserToolResultMessage.tsx +57 -0
  100. package/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.tsx +35 -0
  101. package/src/components/messages/UserToolResultMessage/utils.tsx +56 -0
  102. package/src/components/permissions/BashPermissionRequest/BashPermissionRequest.tsx +121 -0
  103. package/src/components/permissions/FallbackPermissionRequest.tsx +153 -0
  104. package/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.tsx +182 -0
  105. package/src/components/permissions/FileEditPermissionRequest/FileEditToolDiff.tsx +77 -0
  106. package/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.tsx +164 -0
  107. package/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.tsx +83 -0
  108. package/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.tsx +240 -0
  109. package/src/components/permissions/PermissionRequest.tsx +101 -0
  110. package/src/components/permissions/PermissionRequestTitle.tsx +69 -0
  111. package/src/components/permissions/hooks.ts +44 -0
  112. package/src/components/permissions/toolUseOptions.ts +59 -0
  113. package/src/components/permissions/utils.ts +23 -0
  114. package/src/constants/betas.ts +5 -0
  115. package/src/constants/claude-asterisk-ascii-art.tsx +238 -0
  116. package/src/constants/figures.ts +4 -0
  117. package/src/constants/keys.ts +3 -0
  118. package/src/constants/macros.ts +8 -0
  119. package/src/constants/modelCapabilities.ts +179 -0
  120. package/src/constants/models.ts +1025 -0
  121. package/src/constants/oauth.ts +18 -0
  122. package/src/constants/product.ts +17 -0
  123. package/src/constants/prompts.ts +168 -0
  124. package/src/constants/releaseNotes.ts +7 -0
  125. package/src/context/PermissionContext.tsx +149 -0
  126. package/src/context.ts +278 -0
  127. package/src/cost-tracker.ts +84 -0
  128. package/src/entrypoints/cli.tsx +1542 -0
  129. package/src/entrypoints/mcp.ts +176 -0
  130. package/src/history.ts +25 -0
  131. package/src/hooks/useApiKeyVerification.ts +59 -0
  132. package/src/hooks/useArrowKeyHistory.ts +55 -0
  133. package/src/hooks/useCanUseTool.ts +138 -0
  134. package/src/hooks/useCancelRequest.ts +39 -0
  135. package/src/hooks/useDoublePress.ts +42 -0
  136. package/src/hooks/useExitOnCtrlCD.ts +31 -0
  137. package/src/hooks/useInterval.ts +25 -0
  138. package/src/hooks/useLogMessages.ts +16 -0
  139. package/src/hooks/useLogStartupTime.ts +12 -0
  140. package/src/hooks/useNotifyAfterTimeout.ts +65 -0
  141. package/src/hooks/usePermissionRequestLogging.ts +44 -0
  142. package/src/hooks/useTerminalSize.ts +49 -0
  143. package/src/hooks/useTextInput.ts +318 -0
  144. package/src/hooks/useUnifiedCompletion.ts +1405 -0
  145. package/src/messages.ts +38 -0
  146. package/src/permissions.ts +268 -0
  147. package/src/query.ts +715 -0
  148. package/src/screens/ConfigureNpmPrefix.tsx +197 -0
  149. package/src/screens/Doctor.tsx +219 -0
  150. package/src/screens/LogList.tsx +68 -0
  151. package/src/screens/REPL.tsx +809 -0
  152. package/src/screens/ResumeConversation.tsx +68 -0
  153. package/src/services/adapters/base.ts +38 -0
  154. package/src/services/adapters/chatCompletions.ts +90 -0
  155. package/src/services/adapters/responsesAPI.ts +170 -0
  156. package/src/services/browserMocks.ts +66 -0
  157. package/src/services/claude.ts +2197 -0
  158. package/src/services/customCommands.ts +704 -0
  159. package/src/services/fileFreshness.ts +377 -0
  160. package/src/services/gpt5ConnectionTest.ts +340 -0
  161. package/src/services/mcpClient.ts +564 -0
  162. package/src/services/mcpServerApproval.tsx +50 -0
  163. package/src/services/mentionProcessor.ts +273 -0
  164. package/src/services/modelAdapterFactory.ts +69 -0
  165. package/src/services/notifier.ts +40 -0
  166. package/src/services/oauth.ts +357 -0
  167. package/src/services/openai.ts +1338 -0
  168. package/src/services/responseStateManager.ts +90 -0
  169. package/src/services/sentry.ts +3 -0
  170. package/src/services/statsig.ts +172 -0
  171. package/src/services/statsigStorage.ts +86 -0
  172. package/src/services/systemReminder.ts +507 -0
  173. package/src/services/vcr.ts +161 -0
  174. package/src/test/testAdapters.ts +96 -0
  175. package/src/tools/ArchitectTool/ArchitectTool.tsx +122 -0
  176. package/src/tools/ArchitectTool/prompt.ts +15 -0
  177. package/src/tools/AskExpertModelTool/AskExpertModelTool.tsx +569 -0
  178. package/src/tools/BashTool/BashTool.tsx +243 -0
  179. package/src/tools/BashTool/BashToolResultMessage.tsx +38 -0
  180. package/src/tools/BashTool/OutputLine.tsx +49 -0
  181. package/src/tools/BashTool/prompt.ts +174 -0
  182. package/src/tools/BashTool/utils.ts +56 -0
  183. package/src/tools/FileEditTool/FileEditTool.tsx +315 -0
  184. package/src/tools/FileEditTool/prompt.ts +51 -0
  185. package/src/tools/FileEditTool/utils.ts +58 -0
  186. package/src/tools/FileReadTool/FileReadTool.tsx +404 -0
  187. package/src/tools/FileReadTool/prompt.ts +7 -0
  188. package/src/tools/FileWriteTool/FileWriteTool.tsx +297 -0
  189. package/src/tools/FileWriteTool/prompt.ts +10 -0
  190. package/src/tools/GlobTool/GlobTool.tsx +119 -0
  191. package/src/tools/GlobTool/prompt.ts +8 -0
  192. package/src/tools/GrepTool/GrepTool.tsx +147 -0
  193. package/src/tools/GrepTool/prompt.ts +11 -0
  194. package/src/tools/MCPTool/MCPTool.tsx +107 -0
  195. package/src/tools/MCPTool/prompt.ts +3 -0
  196. package/src/tools/MemoryReadTool/MemoryReadTool.tsx +127 -0
  197. package/src/tools/MemoryReadTool/prompt.ts +3 -0
  198. package/src/tools/MemoryWriteTool/MemoryWriteTool.tsx +89 -0
  199. package/src/tools/MemoryWriteTool/prompt.ts +3 -0
  200. package/src/tools/MultiEditTool/MultiEditTool.tsx +366 -0
  201. package/src/tools/MultiEditTool/prompt.ts +45 -0
  202. package/src/tools/NotebookEditTool/NotebookEditTool.tsx +298 -0
  203. package/src/tools/NotebookEditTool/prompt.ts +3 -0
  204. package/src/tools/NotebookReadTool/NotebookReadTool.tsx +258 -0
  205. package/src/tools/NotebookReadTool/prompt.ts +3 -0
  206. package/src/tools/StickerRequestTool/StickerRequestTool.tsx +93 -0
  207. package/src/tools/StickerRequestTool/prompt.ts +19 -0
  208. package/src/tools/TaskTool/TaskTool.tsx +466 -0
  209. package/src/tools/TaskTool/constants.ts +1 -0
  210. package/src/tools/TaskTool/prompt.ts +92 -0
  211. package/src/tools/ThinkTool/ThinkTool.tsx +54 -0
  212. package/src/tools/ThinkTool/prompt.ts +12 -0
  213. package/src/tools/TodoWriteTool/TodoWriteTool.tsx +313 -0
  214. package/src/tools/TodoWriteTool/prompt.ts +63 -0
  215. package/src/tools/URLFetcherTool/URLFetcherTool.tsx +178 -0
  216. package/src/tools/URLFetcherTool/cache.ts +55 -0
  217. package/src/tools/URLFetcherTool/htmlToMarkdown.ts +55 -0
  218. package/src/tools/URLFetcherTool/prompt.ts +17 -0
  219. package/src/tools/WebSearchTool/WebSearchTool.tsx +103 -0
  220. package/src/tools/WebSearchTool/prompt.ts +13 -0
  221. package/src/tools/WebSearchTool/searchProviders.ts +66 -0
  222. package/src/tools/lsTool/lsTool.tsx +272 -0
  223. package/src/tools/lsTool/prompt.ts +2 -0
  224. package/src/tools.ts +67 -0
  225. package/src/types/PermissionMode.ts +120 -0
  226. package/src/types/RequestContext.ts +72 -0
  227. package/src/types/conversation.ts +51 -0
  228. package/src/types/logs.ts +58 -0
  229. package/src/types/modelCapabilities.ts +64 -0
  230. package/src/types/notebook.ts +87 -0
  231. package/src/utils/Cursor.ts +436 -0
  232. package/src/utils/PersistentShell.ts +552 -0
  233. package/src/utils/advancedFuzzyMatcher.ts +290 -0
  234. package/src/utils/agentLoader.ts +278 -0
  235. package/src/utils/agentStorage.ts +97 -0
  236. package/src/utils/array.ts +3 -0
  237. package/src/utils/ask.tsx +99 -0
  238. package/src/utils/auth.ts +13 -0
  239. package/src/utils/autoCompactCore.ts +223 -0
  240. package/src/utils/autoUpdater.ts +458 -0
  241. package/src/utils/betas.ts +20 -0
  242. package/src/utils/browser.ts +14 -0
  243. package/src/utils/cleanup.ts +72 -0
  244. package/src/utils/commands.ts +261 -0
  245. package/src/utils/commonUnixCommands.ts +161 -0
  246. package/src/utils/config.ts +945 -0
  247. package/src/utils/conversationRecovery.ts +55 -0
  248. package/src/utils/debugLogger.ts +1235 -0
  249. package/src/utils/diff.ts +42 -0
  250. package/src/utils/env.ts +57 -0
  251. package/src/utils/errors.ts +21 -0
  252. package/src/utils/exampleCommands.ts +109 -0
  253. package/src/utils/execFileNoThrow.ts +51 -0
  254. package/src/utils/expertChatStorage.ts +136 -0
  255. package/src/utils/file.ts +405 -0
  256. package/src/utils/fileRecoveryCore.ts +71 -0
  257. package/src/utils/format.tsx +44 -0
  258. package/src/utils/fuzzyMatcher.ts +328 -0
  259. package/src/utils/generators.ts +62 -0
  260. package/src/utils/git.ts +92 -0
  261. package/src/utils/globalLogger.ts +77 -0
  262. package/src/utils/http.ts +10 -0
  263. package/src/utils/imagePaste.ts +38 -0
  264. package/src/utils/json.ts +13 -0
  265. package/src/utils/log.ts +382 -0
  266. package/src/utils/markdown.ts +213 -0
  267. package/src/utils/messageContextManager.ts +289 -0
  268. package/src/utils/messages.tsx +939 -0
  269. package/src/utils/model.ts +914 -0
  270. package/src/utils/permissions/filesystem.ts +127 -0
  271. package/src/utils/responseState.ts +23 -0
  272. package/src/utils/ripgrep.ts +167 -0
  273. package/src/utils/secureFile.ts +564 -0
  274. package/src/utils/sessionState.ts +49 -0
  275. package/src/utils/state.ts +25 -0
  276. package/src/utils/style.ts +29 -0
  277. package/src/utils/terminal.ts +50 -0
  278. package/src/utils/theme.ts +127 -0
  279. package/src/utils/thinking.ts +144 -0
  280. package/src/utils/todoStorage.ts +431 -0
  281. package/src/utils/tokens.ts +43 -0
  282. package/src/utils/toolExecutionController.ts +163 -0
  283. package/src/utils/unaryLogging.ts +26 -0
  284. package/src/utils/user.ts +37 -0
  285. package/src/utils/validate.ts +165 -0
  286. package/yoga.wasm +0 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2024 ShareAI Lab
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,426 @@
1
+ # Kode - AI Assistant for Your Terminal
2
+
3
+ [![npm version](https://badge.fury.io/js/@shareai-lab%2Fkode.svg)](https://www.npmjs.com/package/@shareai-lab/kode)
4
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
5
+ [![AGENTS.md](https://img.shields.io/badge/AGENTS.md-Compatible-brightgreen)](https://agents.md)
6
+
7
+ [中文文档](README.zh-CN.md) | [Contributing](CONTRIBUTING.md) | [Documentation](docs/)
8
+
9
+ ## 🎉 Big Announcement: We're Now Apache 2.0 Licensed!
10
+
11
+ **Great news for the developer community!** In our commitment to democratizing AI agent technology and fostering a vibrant ecosystem of innovation, we're thrilled to announce that Kode has transitioned from AGPLv3 to the **Apache 2.0 license**.
12
+
13
+ ### What This Means for You:
14
+ - ✅ **Complete Freedom**: Use Kode in any project - personal, commercial, or enterprise
15
+ - ✅ **Build Without Barriers**: Create proprietary solutions without open-sourcing requirements
16
+ - ✅ **Simple Attribution**: Just maintain copyright notices and license info
17
+ - ✅ **Join a Movement**: Be part of accelerating the world's transition to AI-powered development
18
+
19
+ This change reflects our belief that the future of software development is collaborative, open, and augmented by AI. By removing licensing barriers, we're empowering developers worldwide to build the next generation of AI-assisted tools and workflows. Let's build the future together! 🚀
20
+
21
+ ## 📢 Update Log
22
+
23
+ **2025-08-29**: We've added Windows support! All Windows users can now run Kode using Git Bash, Unix subsystems, or WSL (Windows Subsystem for Linux) on their computers.
24
+
25
+
26
+ <img width="606" height="303" alt="image" src="https://github.com/user-attachments/assets/6cf50553-aacd-4241-a579-6e935b6c62b5" />
27
+
28
+ ## 🤝 AGENTS.md Standard Support
29
+
30
+ **Kode proudly supports the [AGENTS.md standard protocol](https://agents.md) initiated by OpenAI** - a simple, open format for guiding programming agents that's used by 20k+ open source projects.
31
+
32
+ ### Full Compatibility with Multiple Standards
33
+
34
+ - ✅ **AGENTS.md** - Native support for the OpenAI-initiated standard format
35
+ - ✅ **CLAUDE.md** - Full backward compatibility with Claude Code configurations
36
+ - ✅ **Subagent System** - Advanced agent delegation and task orchestration
37
+ - ✅ **Cross-platform** - Works with 20+ AI models and providers
38
+
39
+ Use `# Your documentation request` to generate and maintain your AGENTS.md file automatically, while maintaining full compatibility with existing Claude Code workflows.
40
+
41
+ ## Overview
42
+
43
+ Kode is a powerful AI assistant that lives in your terminal. It can understand your codebase, edit files, run commands, and handle entire workflows for you.
44
+
45
+ > **⚠️ Security Notice**: Kode runs in YOLO mode by default (equivalent to Claude's `--dangerously-skip-permissions` flag), bypassing all permission checks for maximum productivity. YOLO mode is recommended only for trusted, secure environments when working on non-critical projects. If you're working with important files or using models of questionable capability, we strongly recommend using `kode --safe` to enable permission checks and manual approval for all operations.
46
+ >
47
+ > **📊 Model Performance**: For optimal performance, we recommend using newer, more capable models designed for autonomous task completion. Avoid older Q&A-focused models like GPT-4o or Gemini 2.5 Pro, which are optimized for answering questions rather than sustained independent task execution. Choose models specifically trained for agentic workflows and extended reasoning capabilities.
48
+
49
+ <img width="600" height="577" alt="image" src="https://github.com/user-attachments/assets/8b46a39d-1ab6-4669-9391-14ccc6c5234c" />
50
+
51
+ ## Features
52
+
53
+ ### Core Capabilities
54
+ - 🤖 **AI-Powered Assistance** - Uses advanced AI models to understand and respond to your requests
55
+ - 🔄 **Multi-Model Collaboration** - Flexibly switch and combine multiple AI models to leverage their unique strengths
56
+ - 🦜 **Expert Model Consultation** - Use `@ask-model-name` to consult specific AI models for specialized analysis
57
+ - 👤 **Intelligent Agent System** - Use `@run-agent-name` to delegate tasks to specialized subagents
58
+ - 📝 **Code Editing** - Directly edit files with intelligent suggestions and improvements
59
+ - 🔍 **Codebase Understanding** - Analyzes your project structure and code relationships
60
+ - 🚀 **Command Execution** - Run shell commands and see results in real-time
61
+ - 🛠️ **Workflow Automation** - Handle complex development tasks with simple prompts
62
+
63
+ ### 🎯 Advanced Intelligent Completion System
64
+ Our state-of-the-art completion system provides unparalleled coding assistance:
65
+
66
+ #### Smart Fuzzy Matching
67
+ - **Hyphen-Aware Matching** - Type `dao` to match `run-agent-dao-qi-harmony-designer`
68
+ - **Abbreviation Support** - `dq` matches `dao-qi`, `nde` matches `node`
69
+ - **Numeric Suffix Handling** - `py3` intelligently matches `python3`
70
+ - **Multi-Algorithm Fusion** - Combines 7+ matching algorithms for best results
71
+
72
+ #### Intelligent Context Detection
73
+ - **No @ Required** - Type `gp5` directly to match `@ask-gpt-5`
74
+ - **Auto-Prefix Addition** - Tab/Enter automatically adds `@` for agents and models
75
+ - **Mixed Completion** - Seamlessly switch between commands, files, agents, and models
76
+ - **Smart Prioritization** - Results ranked by relevance and usage frequency
77
+
78
+ #### Unix Command Optimization
79
+ - **500+ Common Commands** - Curated database of frequently used Unix/Linux commands
80
+ - **System Intersection** - Only shows commands that actually exist on your system
81
+ - **Priority Scoring** - Common commands appear first (git, npm, docker, etc.)
82
+ - **Real-time Loading** - Dynamic command discovery from system PATH
83
+
84
+ ### User Experience
85
+ - 🎨 **Interactive UI** - Beautiful terminal interface with syntax highlighting
86
+ - 🔌 **Tool System** - Extensible architecture with specialized tools for different tasks
87
+ - 💾 **Context Management** - Smart context handling to maintain conversation continuity
88
+ - 📋 **AGENTS.md Integration** - Use `# documentation requests` to auto-generate and maintain project documentation
89
+
90
+ ## Installation
91
+
92
+ ### Recommended: Using Bun (Fastest)
93
+
94
+ First install Bun if you haven't already:
95
+ ```bash
96
+ curl -fsSL https://bun.sh/install | bash
97
+ ```
98
+
99
+ Then install Kode:
100
+ ```bash
101
+ bun add -g @shareai-lab/kode
102
+ ```
103
+
104
+ ### Alternative: Using npm
105
+
106
+ ```bash
107
+ npm install -g @shareai-lab/kode
108
+ ```
109
+
110
+ After installation, you can use any of these commands:
111
+ - `kode` - Primary command
112
+ - `kwa` - Kode With Agent (alternative)
113
+ - `kd` - Ultra-short alias
114
+
115
+ ## Usage
116
+
117
+ ### Interactive Mode
118
+ Start an interactive session:
119
+ ```bash
120
+ kode
121
+ # or
122
+ kwa
123
+ # or
124
+ kd
125
+ ```
126
+
127
+ ### Non-Interactive Mode
128
+ Get a quick response:
129
+ ```bash
130
+ kode -p "explain this function" main.js
131
+ # or
132
+ kwa -p "explain this function" main.js
133
+ ```
134
+
135
+ ### Using the @ Mention System
136
+
137
+ Kode supports a powerful @ mention system for intelligent completions:
138
+
139
+ #### 🦜 Expert Model Consultation
140
+ ```bash
141
+ # Consult specific AI models for expert opinions
142
+ @ask-claude-sonnet-4 How should I optimize this React component for performance?
143
+ @ask-gpt-5 What are the security implications of this authentication method?
144
+ @ask-o1-preview Analyze the complexity of this algorithm
145
+ ```
146
+
147
+ #### 👤 Specialized Agent Delegation
148
+ ```bash
149
+ # Delegate tasks to specialized subagents
150
+ @run-agent-simplicity-auditor Review this code for over-engineering
151
+ @run-agent-architect Design a microservices architecture for this system
152
+ @run-agent-test-writer Create comprehensive tests for these modules
153
+ ```
154
+
155
+ #### 📁 Smart File References
156
+ ```bash
157
+ # Reference files and directories with auto-completion
158
+ @src/components/Button.tsx
159
+ @docs/api-reference.md
160
+ @.env.example
161
+ ```
162
+
163
+ The @ mention system provides intelligent completions as you type, showing available models, agents, and files.
164
+
165
+ ### AGENTS.md Documentation Mode
166
+
167
+ Use the `#` prefix to generate and maintain your AGENTS.md documentation:
168
+
169
+ ```bash
170
+ # Generate setup instructions
171
+ # How do I set up the development environment?
172
+
173
+ # Create testing documentation
174
+ # What are the testing procedures for this project?
175
+
176
+ # Document deployment process
177
+ # Explain the deployment pipeline and requirements
178
+ ```
179
+
180
+ This mode automatically formats responses as structured documentation and appends them to your AGENTS.md file.
181
+
182
+ ### Docker Usage
183
+
184
+ #### Alternative: Build from local source
185
+
186
+ ```bash
187
+ # Clone the repository
188
+ git clone https://github.com/shareAI-lab/Kode.git
189
+ cd Kode
190
+
191
+ # Build the image locally
192
+ docker build --no-cache -t kode .
193
+
194
+ # Run in your project directory
195
+ cd your-project
196
+ docker run -it --rm \
197
+ -v $(pwd):/workspace \
198
+ -v ~/.kode:/root/.kode \
199
+ -v ~/.kode.json:/root/.kode.json \
200
+ -w /workspace \
201
+ kode
202
+ ```
203
+
204
+ #### Docker Configuration Details
205
+
206
+ The Docker setup includes:
207
+
208
+ - **Volume Mounts**:
209
+ - `$(pwd):/workspace` - Mounts your current project directory
210
+ - `~/.kode:/root/.kode` - Preserves your kode configuration directory between runs
211
+ - `~/.kode.json:/root/.kode.json` - Preserves your kode global configuration file between runs
212
+
213
+ - **Working Directory**: Set to `/workspace` inside the container
214
+
215
+ - **Interactive Mode**: Uses `-it` flags for interactive terminal access
216
+
217
+ - **Cleanup**: `--rm` flag removes the container after exit
218
+
219
+ **Note**: Kode uses both `~/.kode` directory for additional data (like memory files) and `~/.kode.json` file for global configuration.
220
+
221
+ The first time you run the Docker command, it will build the image. Subsequent runs will use the cached image for faster startup.
222
+
223
+ You can use the onboarding to set up the model, or `/model`.
224
+ If you don't see the models you want on the list, you can manually set them in `/config`
225
+ As long as you have an openai-like endpoint, it should work.
226
+
227
+ ### Commands
228
+
229
+ - `/help` - Show available commands
230
+ - `/model` - Change AI model settings
231
+ - `/config` - Open configuration panel
232
+ - `/cost` - Show token usage and costs
233
+ - `/clear` - Clear conversation history
234
+ - `/init` - Initialize project context
235
+
236
+ ## Multi-Model Intelligent Collaboration
237
+
238
+ Unlike official Claude which supports only a single model, Kode implements **true multi-model collaboration**, allowing you to fully leverage the unique strengths of different AI models.
239
+
240
+ ### 🏗️ Core Technical Architecture
241
+
242
+ #### 1. **ModelManager Multi-Model Manager**
243
+ We designed a unified `ModelManager` system that supports:
244
+ - **Model Profiles**: Each model has an independent configuration file containing API endpoints, authentication, context window size, cost parameters, etc.
245
+ - **Model Pointers**: Users can configure default models for different purposes in the `/model` command:
246
+ - `main`: Default model for main Agent
247
+ - `task`: Default model for SubAgent
248
+ - `reasoning`: Reserved for future ThinkTool usage
249
+ - `quick`: Fast model for simple NLP tasks (security identification, title generation, etc.)
250
+ - **Dynamic Model Switching**: Support runtime model switching without restarting sessions, maintaining context continuity
251
+
252
+ #### 2. **TaskTool Intelligent Task Distribution**
253
+ Our specially designed `TaskTool` (Architect tool) implements:
254
+ - **Subagent Mechanism**: Can launch multiple sub-agents to process tasks in parallel
255
+ - **Model Parameter Passing**: Users can specify which model SubAgents should use in their requests
256
+ - **Default Model Configuration**: SubAgents use the model configured by the `task` pointer by default
257
+
258
+ #### 3. **AskExpertModel Expert Consultation Tool**
259
+ We specially designed the `AskExpertModel` tool:
260
+ - **Expert Model Invocation**: Allows temporarily calling specific expert models to solve difficult problems during conversations
261
+ - **Model Isolation Execution**: Expert model responses are processed independently without affecting the main conversation flow
262
+ - **Knowledge Integration**: Integrates expert model insights into the current task
263
+
264
+ #### 🎯 Flexible Model Switching
265
+ - **Tab Key Quick Switch**: Press Tab in the input box to quickly switch the model for the current conversation
266
+ - **`/model` Command**: Use `/model` command to configure and manage multiple model profiles, set default models for different purposes
267
+ - **User Control**: Users can specify specific models for task processing at any time
268
+
269
+ #### 🔄 Intelligent Work Allocation Strategy
270
+
271
+ **Architecture Design Phase**
272
+ - Use **o3 model** or **GPT-5 model** to explore system architecture and formulate sharp and clear technical solutions
273
+ - These models excel in abstract thinking and system design
274
+
275
+ **Solution Refinement Phase**
276
+ - Use **gemini model** to deeply explore production environment design details
277
+ - Leverage its deep accumulation in practical engineering and balanced reasoning capabilities
278
+
279
+ **Code Implementation Phase**
280
+ - Use **Qwen Coder model**, **Kimi k2 model**, **GLM-4.5 model**, or **Claude Sonnet 4 model** for specific code writing
281
+ - These models have strong performance in code generation, file editing, and engineering implementation
282
+ - Support parallel processing of multiple coding tasks through subagents
283
+
284
+ **Problem Solving**
285
+ - When encountering complex problems, consult expert models like **o3 model**, **Claude Opus 4.1 model**, or **Grok 4 model**
286
+ - Obtain deep technical insights and innovative solutions
287
+
288
+ #### 💡 Practical Application Scenarios
289
+
290
+ ```bash
291
+ # Example 1: Architecture Design
292
+ "Use o3 model to help me design a high-concurrency message queue system architecture"
293
+
294
+ # Example 2: Multi-Model Collaboration
295
+ "First use GPT-5 model to analyze the root cause of this performance issue, then use Claude Sonnet 4 model to write optimization code"
296
+
297
+ # Example 3: Parallel Task Processing
298
+ "Use Qwen Coder model as subagent to refactor these three modules simultaneously"
299
+
300
+ # Example 4: Expert Consultation
301
+ "This memory leak issue is tricky, ask Claude Opus 4.1 model separately for solutions"
302
+
303
+ # Example 5: Code Review
304
+ "Have Kimi k2 model review the code quality of this PR"
305
+
306
+ # Example 6: Complex Reasoning
307
+ "Use Grok 4 model to help me derive the time complexity of this algorithm"
308
+
309
+ # Example 7: Solution Design
310
+ "Have GLM-4.5 model design a microservice decomposition plan"
311
+ ```
312
+
313
+ ### 🛠️ Key Implementation Mechanisms
314
+
315
+ #### **Configuration System**
316
+ ```typescript
317
+ // Example of multi-model configuration support
318
+ {
319
+ "modelProfiles": {
320
+ "o3": { "provider": "openai", "model": "o3", "apiKey": "..." },
321
+ "claude4": { "provider": "anthropic", "model": "claude-sonnet-4", "apiKey": "..." },
322
+ "qwen": { "provider": "alibaba", "model": "qwen-coder", "apiKey": "..." }
323
+ },
324
+ "modelPointers": {
325
+ "main": "claude4", // Main conversation model
326
+ "task": "qwen", // Task execution model
327
+ "reasoning": "o3", // Reasoning model
328
+ "quick": "glm-4.5" // Quick response model
329
+ }
330
+ }
331
+ ```
332
+
333
+ #### **Cost Tracking System**
334
+ - **Usage Statistics**: Use `/cost` command to view token usage and costs for each model
335
+ - **Multi-Model Cost Comparison**: Track usage costs of different models in real-time
336
+ - **History Records**: Save cost data for each session
337
+
338
+ #### **Context Manager**
339
+ - **Context Inheritance**: Maintain conversation continuity when switching models
340
+ - **Context Window Adaptation**: Automatically adjust based on different models' context window sizes
341
+ - **Session State Preservation**: Ensure information consistency during multi-model collaboration
342
+
343
+ ### 🚀 Advantages of Multi-Model Collaboration
344
+
345
+ 1. **Maximized Efficiency**: Each task is handled by the most suitable model
346
+ 2. **Cost Optimization**: Use lightweight models for simple tasks, powerful models for complex tasks
347
+ 3. **Parallel Processing**: Multiple models can work on different subtasks simultaneously
348
+ 4. **Flexible Switching**: Switch models based on task requirements without restarting sessions
349
+ 5. **Leveraging Strengths**: Combine advantages of different models for optimal overall results
350
+
351
+ ### 📊 Comparison with Official Implementation
352
+
353
+ | Feature | Kode | Official Claude |
354
+ |---------|------|-----------------|
355
+ | Number of Supported Models | Unlimited, configurable for any model | Only supports single Claude model |
356
+ | Model Switching | ✅ Tab key quick switch | ❌ Requires session restart |
357
+ | Parallel Processing | ✅ Multiple SubAgents work in parallel | ❌ Single-threaded processing |
358
+ | Cost Tracking | ✅ Separate statistics for multiple models | ❌ Single model cost |
359
+ | Task Model Configuration | ✅ Different default models for different purposes | ❌ Same model for all tasks |
360
+ | Expert Consultation | ✅ AskExpertModel tool | ❌ Not supported |
361
+
362
+ This multi-model collaboration capability makes Kode a true **AI Development Workbench**, not just a single AI assistant.
363
+
364
+ ## Development
365
+
366
+ Kode is built with modern tools and requires [Bun](https://bun.sh) for development.
367
+
368
+ ### Install Bun
369
+
370
+ ```bash
371
+ # macOS/Linux
372
+ curl -fsSL https://bun.sh/install | bash
373
+
374
+ # Windows
375
+ powershell -c "irm bun.sh/install.ps1 | iex"
376
+ ```
377
+
378
+ ### Setup Development Environment
379
+
380
+ ```bash
381
+ # Clone the repository
382
+ git clone https://github.com/shareAI-lab/kode.git
383
+ cd kode
384
+
385
+ # Install dependencies
386
+ bun install
387
+
388
+ # Run in development mode
389
+ bun run dev
390
+ ```
391
+
392
+ ### Build
393
+
394
+ ```bash
395
+ bun run build
396
+ ```
397
+
398
+ ### Testing
399
+
400
+ ```bash
401
+ # Run tests
402
+ bun test
403
+
404
+ # Test the CLI
405
+ ./cli.js --help
406
+ ```
407
+
408
+ ## Contributing
409
+
410
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
411
+
412
+ ## License
413
+
414
+ Apache 2.0 License - see [LICENSE](LICENSE) for details.
415
+
416
+ ## Thanks
417
+
418
+ - Some code from @dnakov's anonkode
419
+ - Some UI learned from gemini-cli
420
+ - Some system design learned from claude code
421
+
422
+ ## Support
423
+
424
+ - 📚 [Documentation](docs/)
425
+ - 🐛 [Report Issues](https://github.com/shareAI-lab/kode/issues)
426
+ - 💬 [Discussions](https://github.com/shareAI-lab/kode/discussions)