@datename/fastcode-termux 0.0.0-stage → 0.1.6-beta

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 (347) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +418 -2
  3. package/bin/fastcode.mjs +59 -0
  4. package/dist/agent/approval.d.ts +50 -0
  5. package/dist/agent/approval.js +7 -0
  6. package/dist/agent/compaction.d.ts +39 -0
  7. package/dist/agent/compaction.js +227 -0
  8. package/dist/agent/context.d.ts +29 -0
  9. package/dist/agent/context.js +62 -0
  10. package/dist/agent/guards.d.ts +43 -0
  11. package/dist/agent/guards.js +269 -0
  12. package/dist/agent/ignore.d.ts +11 -0
  13. package/dist/agent/ignore.js +129 -0
  14. package/dist/agent/limits.d.ts +24 -0
  15. package/dist/agent/limits.js +71 -0
  16. package/dist/agent/process-tree.d.ts +2 -0
  17. package/dist/agent/process-tree.js +31 -0
  18. package/dist/agent/protocol-mode.d.ts +6 -0
  19. package/dist/agent/protocol-mode.js +51 -0
  20. package/dist/agent/protocol.d.ts +4 -0
  21. package/dist/agent/protocol.js +129 -0
  22. package/dist/agent/registry.d.ts +17 -0
  23. package/dist/agent/registry.js +90 -0
  24. package/dist/agent/runner.d.ts +106 -0
  25. package/dist/agent/runner.js +352 -0
  26. package/dist/agent/shell-session.d.ts +37 -0
  27. package/dist/agent/shell-session.js +400 -0
  28. package/dist/agent/stream.d.ts +29 -0
  29. package/dist/agent/stream.js +103 -0
  30. package/dist/agent/tool-schemas.d.ts +2 -0
  31. package/dist/agent/tool-schemas.js +63 -0
  32. package/dist/agent/tools/append_file.d.ts +2 -0
  33. package/dist/agent/tools/append_file.js +26 -0
  34. package/dist/agent/tools/apply_patch.d.ts +10 -0
  35. package/dist/agent/tools/apply_patch.js +52 -0
  36. package/dist/agent/tools/copy_file.d.ts +2 -0
  37. package/dist/agent/tools/copy_file.js +30 -0
  38. package/dist/agent/tools/delete_file.d.ts +2 -0
  39. package/dist/agent/tools/delete_file.js +24 -0
  40. package/dist/agent/tools/grep.d.ts +2 -0
  41. package/dist/agent/tools/grep.js +23 -0
  42. package/dist/agent/tools/index.d.ts +2 -0
  43. package/dist/agent/tools/index.js +32 -0
  44. package/dist/agent/tools/list_files.d.ts +2 -0
  45. package/dist/agent/tools/list_files.js +17 -0
  46. package/dist/agent/tools/make_dir.d.ts +2 -0
  47. package/dist/agent/tools/make_dir.js +24 -0
  48. package/dist/agent/tools/move_path.d.ts +2 -0
  49. package/dist/agent/tools/move_path.js +47 -0
  50. package/dist/agent/tools/paths.d.ts +7 -0
  51. package/dist/agent/tools/paths.js +84 -0
  52. package/dist/agent/tools/pwd.d.ts +2 -0
  53. package/dist/agent/tools/pwd.js +10 -0
  54. package/dist/agent/tools/read_file.d.ts +2 -0
  55. package/dist/agent/tools/read_file.js +21 -0
  56. package/dist/agent/tools/read_many.d.ts +2 -0
  57. package/dist/agent/tools/read_many.js +25 -0
  58. package/dist/agent/tools/readers.d.ts +6 -0
  59. package/dist/agent/tools/readers.js +216 -0
  60. package/dist/agent/tools/replace_in_file.d.ts +2 -0
  61. package/dist/agent/tools/replace_in_file.js +30 -0
  62. package/dist/agent/tools/shell.d.ts +2 -0
  63. package/dist/agent/tools/shell.js +48 -0
  64. package/dist/agent/tools/stat_path.d.ts +2 -0
  65. package/dist/agent/tools/stat_path.js +31 -0
  66. package/dist/agent/tools/types.d.ts +39 -0
  67. package/dist/agent/tools/types.js +1 -0
  68. package/dist/agent/tools/validate.d.ts +6 -0
  69. package/dist/agent/tools/validate.js +29 -0
  70. package/dist/agent/tools/write_file.d.ts +2 -0
  71. package/dist/agent/tools/write_file.js +26 -0
  72. package/dist/agent/tools.d.ts +3 -0
  73. package/dist/agent/tools.js +2 -0
  74. package/dist/app.d.ts +4 -0
  75. package/dist/app.js +708 -0
  76. package/dist/cli.d.ts +1 -0
  77. package/dist/cli.js +569 -0
  78. package/dist/commands/about.d.ts +8 -0
  79. package/dist/commands/about.js +16 -0
  80. package/dist/commands/agent.d.ts +11 -0
  81. package/dist/commands/agent.js +18 -0
  82. package/dist/commands/attach.d.ts +9 -0
  83. package/dist/commands/attach.js +15 -0
  84. package/dist/commands/bg.d.ts +7 -0
  85. package/dist/commands/bg.js +9 -0
  86. package/dist/commands/cancel.d.ts +10 -0
  87. package/dist/commands/cancel.js +10 -0
  88. package/dist/commands/clear.d.ts +11 -0
  89. package/dist/commands/clear.js +9 -0
  90. package/dist/commands/compact.d.ts +10 -0
  91. package/dist/commands/compact.js +22 -0
  92. package/dist/commands/config.d.ts +7 -0
  93. package/dist/commands/config.js +24 -0
  94. package/dist/commands/context.d.ts +7 -0
  95. package/dist/commands/context.js +24 -0
  96. package/dist/commands/cost.d.ts +9 -0
  97. package/dist/commands/cost.js +13 -0
  98. package/dist/commands/cwd.d.ts +7 -0
  99. package/dist/commands/cwd.js +7 -0
  100. package/dist/commands/edit.d.ts +10 -0
  101. package/dist/commands/edit.js +36 -0
  102. package/dist/commands/effort.d.ts +25 -0
  103. package/dist/commands/effort.js +48 -0
  104. package/dist/commands/exit.d.ts +9 -0
  105. package/dist/commands/exit.js +8 -0
  106. package/dist/commands/expand.d.ts +10 -0
  107. package/dist/commands/expand.js +8 -0
  108. package/dist/commands/help.d.ts +6 -0
  109. package/dist/commands/help.js +18 -0
  110. package/dist/commands/index.d.ts +9 -0
  111. package/dist/commands/index.js +80 -0
  112. package/dist/commands/jobs.d.ts +7 -0
  113. package/dist/commands/jobs.js +16 -0
  114. package/dist/commands/kill.d.ts +7 -0
  115. package/dist/commands/kill.js +11 -0
  116. package/dist/commands/login.d.ts +18 -0
  117. package/dist/commands/login.js +63 -0
  118. package/dist/commands/logout.d.ts +9 -0
  119. package/dist/commands/logout.js +45 -0
  120. package/dist/commands/model.d.ts +24 -0
  121. package/dist/commands/model.js +50 -0
  122. package/dist/commands/plugin.d.ts +11 -0
  123. package/dist/commands/plugin.js +74 -0
  124. package/dist/commands/provider.d.ts +24 -0
  125. package/dist/commands/provider.js +39 -0
  126. package/dist/commands/reset.d.ts +9 -0
  127. package/dist/commands/reset.js +13 -0
  128. package/dist/commands/skills.d.ts +11 -0
  129. package/dist/commands/skills.js +106 -0
  130. package/dist/commands/steer.d.ts +11 -0
  131. package/dist/commands/steer.js +13 -0
  132. package/dist/commands/system.d.ts +11 -0
  133. package/dist/commands/system.js +20 -0
  134. package/dist/commands/theme.d.ts +11 -0
  135. package/dist/commands/theme.js +22 -0
  136. package/dist/commands/tools.d.ts +7 -0
  137. package/dist/commands/tools.js +29 -0
  138. package/dist/commands/whoami.d.ts +9 -0
  139. package/dist/commands/whoami.js +52 -0
  140. package/dist/config/paths.d.ts +4 -0
  141. package/dist/config/paths.js +59 -0
  142. package/dist/config/store.d.ts +89 -0
  143. package/dist/config/store.js +260 -0
  144. package/dist/config/themes.d.ts +73 -0
  145. package/dist/config/themes.js +77 -0
  146. package/dist/config/trust.d.ts +22 -0
  147. package/dist/config/trust.js +153 -0
  148. package/dist/index.d.ts +1 -0
  149. package/dist/index.js +31 -0
  150. package/dist/lib/diagnostics.d.ts +66 -0
  151. package/dist/lib/diagnostics.js +195 -0
  152. package/dist/lib/http.d.ts +23 -0
  153. package/dist/lib/http.js +128 -0
  154. package/dist/lib/markdown.d.ts +1 -0
  155. package/dist/lib/markdown.js +32 -0
  156. package/dist/lib/model-meta.d.ts +19 -0
  157. package/dist/lib/model-meta.js +113 -0
  158. package/dist/lib/native-tools.d.ts +12 -0
  159. package/dist/lib/native-tools.js +21 -0
  160. package/dist/lib/net.d.ts +33 -0
  161. package/dist/lib/net.js +168 -0
  162. package/dist/lib/pkg.d.ts +5 -0
  163. package/dist/lib/pkg.js +27 -0
  164. package/dist/lib/platform.d.ts +7 -0
  165. package/dist/lib/platform.js +57 -0
  166. package/dist/lib/startup.d.ts +6 -0
  167. package/dist/lib/startup.js +25 -0
  168. package/dist/lib/uiMode.d.ts +2 -0
  169. package/dist/lib/uiMode.js +7 -0
  170. package/dist/patch/apply.d.ts +15 -0
  171. package/dist/patch/apply.js +172 -0
  172. package/dist/patch/parse.d.ts +29 -0
  173. package/dist/patch/parse.js +112 -0
  174. package/dist/patch/plan.d.ts +49 -0
  175. package/dist/patch/plan.js +273 -0
  176. package/dist/plugins/manager.d.ts +23 -0
  177. package/dist/plugins/manager.js +101 -0
  178. package/dist/providers/anthropic.d.ts +22 -0
  179. package/dist/providers/anthropic.js +119 -0
  180. package/dist/providers/custom.d.ts +33 -0
  181. package/dist/providers/custom.js +25 -0
  182. package/dist/providers/deepseek.d.ts +34 -0
  183. package/dist/providers/deepseek.js +16 -0
  184. package/dist/providers/google.d.ts +33 -0
  185. package/dist/providers/google.js +19 -0
  186. package/dist/providers/groq.d.ts +34 -0
  187. package/dist/providers/groq.js +21 -0
  188. package/dist/providers/index.d.ts +10 -0
  189. package/dist/providers/index.js +67 -0
  190. package/dist/providers/mistral.d.ts +34 -0
  191. package/dist/providers/mistral.js +20 -0
  192. package/dist/providers/moonshot.d.ts +34 -0
  193. package/dist/providers/moonshot.js +23 -0
  194. package/dist/providers/ollama.d.ts +33 -0
  195. package/dist/providers/ollama.js +22 -0
  196. package/dist/providers/openai.d.ts +34 -0
  197. package/dist/providers/openai.js +26 -0
  198. package/dist/providers/openaiCompatible.d.ts +26 -0
  199. package/dist/providers/openaiCompatible.js +158 -0
  200. package/dist/providers/openrouter.d.ts +34 -0
  201. package/dist/providers/openrouter.js +27 -0
  202. package/dist/providers/qwen.d.ts +34 -0
  203. package/dist/providers/qwen.js +24 -0
  204. package/dist/providers/xai.d.ts +34 -0
  205. package/dist/providers/xai.js +19 -0
  206. package/dist/providers/zhipu.d.ts +34 -0
  207. package/dist/providers/zhipu.js +24 -0
  208. package/dist/session/log.d.ts +52 -0
  209. package/dist/session/log.js +331 -0
  210. package/dist/session/projection.d.ts +43 -0
  211. package/dist/session/projection.js +257 -0
  212. package/dist/skills/manager.d.ts +18 -0
  213. package/dist/skills/manager.js +201 -0
  214. package/dist/skills/parser.d.ts +18 -0
  215. package/dist/skills/parser.js +65 -0
  216. package/dist/types.d.ts +205 -0
  217. package/dist/types.js +1 -0
  218. package/dist/ui/Banner.d.ts +5 -0
  219. package/dist/ui/Banner.js +65 -0
  220. package/dist/ui/Message.d.ts +1 -0
  221. package/dist/ui/Message.js +24 -0
  222. package/dist/ui/Picker.d.ts +8 -0
  223. package/dist/ui/Picker.js +24 -0
  224. package/dist/ui/Prompt.d.ts +9 -0
  225. package/dist/ui/Prompt.js +38 -0
  226. package/dist/ui/Spinner.d.ts +5 -0
  227. package/dist/ui/Spinner.js +39 -0
  228. package/dist/ui/StatusBar.d.ts +11 -0
  229. package/dist/ui/StatusBar.js +20 -0
  230. package/dist/ui/TrustGate.d.ts +5 -0
  231. package/dist/ui/TrustGate.js +26 -0
  232. package/package.json +96 -4
  233. package/src/agent/approval.ts +47 -0
  234. package/src/agent/compaction.ts +276 -0
  235. package/src/agent/context.ts +97 -0
  236. package/src/agent/guards.ts +270 -0
  237. package/src/agent/ignore.ts +147 -0
  238. package/src/agent/limits.ts +71 -0
  239. package/src/agent/process-tree.ts +32 -0
  240. package/src/agent/protocol-mode.ts +59 -0
  241. package/src/agent/protocol.ts +129 -0
  242. package/src/agent/registry.ts +98 -0
  243. package/src/agent/runner.ts +443 -0
  244. package/src/agent/shell-session.ts +449 -0
  245. package/src/agent/stream.ts +143 -0
  246. package/src/agent/tool-schemas.ts +67 -0
  247. package/src/agent/tools/append_file.ts +28 -0
  248. package/src/agent/tools/apply_patch.ts +54 -0
  249. package/src/agent/tools/copy_file.ts +32 -0
  250. package/src/agent/tools/delete_file.ts +26 -0
  251. package/src/agent/tools/grep.ts +25 -0
  252. package/src/agent/tools/index.ts +34 -0
  253. package/src/agent/tools/list_files.ts +19 -0
  254. package/src/agent/tools/make_dir.ts +26 -0
  255. package/src/agent/tools/move_path.ts +50 -0
  256. package/src/agent/tools/paths.ts +92 -0
  257. package/src/agent/tools/pwd.ts +12 -0
  258. package/src/agent/tools/read_file.ts +23 -0
  259. package/src/agent/tools/read_many.ts +27 -0
  260. package/src/agent/tools/readers.ts +228 -0
  261. package/src/agent/tools/replace_in_file.ts +32 -0
  262. package/src/agent/tools/shell.ts +53 -0
  263. package/src/agent/tools/stat_path.ts +33 -0
  264. package/src/agent/tools/types.ts +42 -0
  265. package/src/agent/tools/validate.ts +35 -0
  266. package/src/agent/tools/write_file.ts +28 -0
  267. package/src/agent/tools.ts +3 -0
  268. package/src/app.ts +708 -0
  269. package/src/cli.ts +335 -0
  270. package/src/commands/about.ts +16 -0
  271. package/src/commands/agent.ts +18 -0
  272. package/src/commands/attach.ts +16 -0
  273. package/src/commands/bg.ts +9 -0
  274. package/src/commands/cancel.ts +10 -0
  275. package/src/commands/clear.ts +9 -0
  276. package/src/commands/compact.ts +23 -0
  277. package/src/commands/config.ts +24 -0
  278. package/src/commands/context.ts +25 -0
  279. package/src/commands/cost.ts +13 -0
  280. package/src/commands/cwd.ts +7 -0
  281. package/src/commands/edit.ts +37 -0
  282. package/src/commands/effort.ts +49 -0
  283. package/src/commands/exit.ts +8 -0
  284. package/src/commands/expand.ts +8 -0
  285. package/src/commands/help.ts +18 -0
  286. package/src/commands/index.ts +80 -0
  287. package/src/commands/jobs.ts +17 -0
  288. package/src/commands/kill.ts +12 -0
  289. package/src/commands/login.ts +63 -0
  290. package/src/commands/logout.ts +45 -0
  291. package/src/commands/model.ts +50 -0
  292. package/src/commands/plugin.ts +74 -0
  293. package/src/commands/provider.ts +39 -0
  294. package/src/commands/reset.ts +13 -0
  295. package/src/commands/skills.ts +106 -0
  296. package/src/commands/steer.ts +13 -0
  297. package/src/commands/system.ts +20 -0
  298. package/src/commands/theme.ts +22 -0
  299. package/src/commands/tools.ts +29 -0
  300. package/src/commands/whoami.ts +52 -0
  301. package/src/config/paths.ts +59 -0
  302. package/src/config/store.ts +293 -0
  303. package/src/config/themes.ts +77 -0
  304. package/src/config/trust.ts +183 -0
  305. package/src/index.ts +31 -0
  306. package/src/lib/diagnostics.ts +195 -0
  307. package/src/lib/http.ts +132 -0
  308. package/src/lib/markdown.ts +32 -0
  309. package/src/lib/model-meta.ts +138 -0
  310. package/src/lib/native-tools.ts +32 -0
  311. package/src/lib/net.ts +204 -0
  312. package/src/lib/pkg.ts +35 -0
  313. package/src/lib/platform.ts +57 -0
  314. package/src/lib/startup.ts +25 -0
  315. package/src/lib/uiMode.ts +7 -0
  316. package/src/patch/apply.ts +194 -0
  317. package/src/patch/parse.ts +131 -0
  318. package/src/patch/plan.ts +317 -0
  319. package/src/plugins/manager.ts +101 -0
  320. package/src/providers/anthropic.ts +119 -0
  321. package/src/providers/custom.ts +25 -0
  322. package/src/providers/deepseek.ts +16 -0
  323. package/src/providers/google.ts +19 -0
  324. package/src/providers/groq.ts +21 -0
  325. package/src/providers/index.ts +68 -0
  326. package/src/providers/mistral.ts +20 -0
  327. package/src/providers/moonshot.ts +23 -0
  328. package/src/providers/ollama.ts +22 -0
  329. package/src/providers/openai.ts +26 -0
  330. package/src/providers/openaiCompatible.ts +158 -0
  331. package/src/providers/openrouter.ts +27 -0
  332. package/src/providers/qwen.ts +24 -0
  333. package/src/providers/xai.ts +19 -0
  334. package/src/providers/zhipu.ts +24 -0
  335. package/src/session/log.ts +374 -0
  336. package/src/session/projection.ts +308 -0
  337. package/src/skills/manager.ts +201 -0
  338. package/src/skills/parser.ts +65 -0
  339. package/src/types.ts +205 -0
  340. package/src/ui/Banner.ts +68 -0
  341. package/src/ui/Message.ts +24 -0
  342. package/src/ui/Picker.ts +24 -0
  343. package/src/ui/Prompt.ts +38 -0
  344. package/src/ui/Spinner.ts +39 -0
  345. package/src/ui/StatusBar.ts +20 -0
  346. package/src/ui/TrustGate.ts +26 -0
  347. package/tsconfig.json +22 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SimpleLittleDev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,419 @@
1
- # Temporary Holding Version
1
+ # ⚡ FastCode
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center">
4
+ <strong>A colorful, fast, terminal-first AI coding assistant.</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ Multi-LLM chat • Agent Skills • Slash commands • Themes • Termux-ready
9
+ </p>
10
+
11
+ <p align="center">
12
+ <img alt="Node" src="https://img.shields.io/badge/node-%3E%3D18.17-3c873a?style=for-the-badge&logo=node.js&logoColor=white">
13
+ <img alt="npm" src="https://img.shields.io/badge/npm-@datename%2Ffastcode--termux-cb3837?style=for-the-badge&logo=npm&logoColor=white">
14
+ <img alt="License" src="https://img.shields.io/badge/license-MIT-f59e0b?style=for-the-badge">
15
+ <img alt="Termux" src="https://img.shields.io/badge/Termux-ready-7c3aed?style=for-the-badge&logo=android&logoColor=white">
16
+ </p>
17
+
18
+ ```bash
19
+ npm install -g @datename/fastcode-termux
20
+ fastcode
21
+ ```
22
+
23
+ Short alias included:
24
+
25
+ ```bash
26
+ fc
27
+ ```
28
+
29
+ This tree is **0.1.6-beta**. When the beta is published to npm, install it with
30
+ `npm install -g @datename/fastcode-termux@0.1.6-beta`; until then use the repo/portable build.
31
+
32
+ ---
33
+
34
+ ## 🌈 What Is FastCode?
35
+
36
+ FastCode is a beautiful TUI coding assistant that runs inside your terminal.
37
+ It connects to your favorite AI provider, keeps the workflow command-driven,
38
+ and supports Anthropic-style **Agent Skills** for specialized abilities.
39
+
40
+ It is built for developers who want an AI assistant that feels quick, direct,
41
+ and usable from anywhere: Linux, macOS, Windows, and Android through Termux.
42
+
43
+ ---
44
+
45
+ ## ✨ Highlights
46
+
47
+ | Feature | What You Get |
48
+ | --- | --- |
49
+ | 🎨 Colorful TUI | Big FastCode banner, themes, transcript bubbles, status bar |
50
+ | 🤖 Multi-provider | Anthropic, OpenAI, Gemini, OpenRouter, Groq, DeepSeek, Mistral, Ollama |
51
+ | 🧠 Agent Skills | Install and enable `SKILL.md` powered workflows |
52
+ | 🧩 Plugins | Import always-active plugin packs with bundled skills |
53
+ | 🛠️ Coding Agent | Shell, file editing, grep, patching, and sandboxed local tools |
54
+ | ⚡ Slash commands | Switch models, manage keys, enable skills, inspect config |
55
+ | 📱 Termux-ready | Stable UI mode helps avoid flicker on Android terminals |
56
+ | 🔐 Local config | Keys and preferences stay under `~/.fastcode` |
57
+
58
+ ---
59
+
60
+ ## 🚀 Install
61
+
62
+ ### Install from the source repo (recommended)
63
+
64
+ The repo ships a self-contained bundle at `package/dist/cli.js`, so a plain
65
+ `git clone` runs without `npm install`:
66
+
67
+ ```bash
68
+ git clone https://github.com/dateName/fastcode-termux.git
69
+ cd fastcode-termux
70
+ bash scripts/install.sh
71
+ fastcode
72
+ ```
73
+
74
+ Manual equivalent:
75
+
76
+ ```bash
77
+ git clone https://github.com/dateName/fastcode-termux.git
78
+ cd fastcode-termux/package
79
+ npm install # ⚠️ do not skip
80
+ npm link
81
+ ```
82
+
83
+ ### Global install
84
+
85
+ ```bash
86
+ npm install -g @datename/fastcode-termux
87
+ fastcode
88
+ ```
89
+
90
+ ### Run without installing globally
91
+
92
+ ```bash
93
+ npx @datename/fastcode-termux
94
+ ```
95
+
96
+ ### Start with a prompt
97
+
98
+ ```bash
99
+ fastcode "explain this repository"
100
+ ```
101
+
102
+ ---
103
+
104
+ ## 🔑 Add Your API Key
105
+
106
+ Use environment variables:
107
+
108
+ ```bash
109
+ export ANTHROPIC_API_KEY="sk-ant-..."
110
+ export OPENAI_API_KEY="sk-..."
111
+ export OPENROUTER_API_KEY="sk-or-..."
112
+ ```
113
+
114
+ Or bind a key from inside FastCode — one key per provider, reused by all its models (input is masked):
115
+
116
+ ```text
117
+ /login # guided: provider → model → key
118
+ /login openai gpt-4o-mini sk-...
119
+ /login anthropic claude-3-5-sonnet-latest sk-ant-...
120
+ ```
121
+
122
+ Then start chatting:
123
+
124
+ ```bash
125
+ fastcode
126
+ ```
127
+
128
+ ---
129
+
130
+ ## 🧩 Providers
131
+
132
+ | Provider | Default Model | Auth |
133
+ | --- | --- | --- |
134
+ | `anthropic` | `claude-3-5-sonnet-latest` | `ANTHROPIC_API_KEY` or `CLAUDE_API_KEY` |
135
+ | `openai` | `gpt-4o-mini` | `OPENAI_API_KEY` |
136
+ | `google` | `gemini-1.5-flash` | `GEMINI_API_KEY` or `GOOGLE_API_KEY` |
137
+ | `openrouter` | `anthropic/claude-3.5-sonnet` | `OPENROUTER_API_KEY` |
138
+ | `groq` | `llama-3.3-70b-versatile` | `GROQ_API_KEY` |
139
+ | `deepseek` | `deepseek-chat` | `DEEPSEEK_API_KEY` |
140
+ | `mistral` | `mistral-small-latest` | `MISTRAL_API_KEY` |
141
+ | `ollama` | `llama3.2` | Local, no API key required |
142
+
143
+ Switch anytime:
144
+
145
+ ```text
146
+ /provider openai
147
+ /model gpt-4o-mini
148
+ ```
149
+
150
+ ---
151
+
152
+ ## 🪄 Agent Skills
153
+
154
+ FastCode can install and inject Anthropic-style skills into the system prompt.
155
+
156
+ ```text
157
+ /skills search pdf
158
+ /skills install pdf
159
+ /skills install anthropics/skills/pdf
160
+ /skills install https://example.com/my-skill/SKILL.md
161
+ /skills enable pdf
162
+ /skills list
163
+ /skills info pdf
164
+ ```
165
+
166
+ Installed skills live here:
167
+
168
+ ```text
169
+ ~/.fastcode/skills/<name>/SKILL.md
170
+ ```
171
+
172
+ ---
173
+
174
+ ## 🛠️ Coding Agent
175
+
176
+ FastCode can act as a local coding agent. Agent mode is enabled by default and
177
+ works with any provider, including local Ollama models.
178
+
179
+ ```text
180
+ /agent status
181
+ /agent on
182
+ /agent off
183
+ /tools
184
+ /cwd
185
+ ```
186
+
187
+ Available tools include:
188
+
189
+ ```text
190
+ shell, pwd, read_file, read_many, write_file, append_file, apply_patch,
191
+ replace_in_file, list_files, grep, stat_path, make_dir, copy_file,
192
+ move_path, delete_file
193
+ ```
194
+
195
+ Tools run inside a sandbox rooted at the directory where you start FastCode.
196
+ File tools cannot access paths outside that root. Shell commands run with:
197
+
198
+ ```text
199
+ FASTCODE_SANDBOX=1
200
+ FASTCODE_SANDBOX_ROOT=<current-working-directory>
201
+ ```
202
+
203
+ Example:
204
+
205
+ ```bash
206
+ cd ~/my-project
207
+ fastcode "run the tests, find the failing file, patch it, and verify the fix"
208
+ ```
209
+
210
+ ---
211
+
212
+ ## 🧩 Plugins
213
+
214
+ Plugins are always-active behavior packs. A plugin folder can contain:
215
+
216
+ ```text
217
+ my-plugin/
218
+ ├── PLUGIN.md
219
+ └── skills/
220
+ └── reviewer/
221
+ └── SKILL.md
222
+ ```
223
+
224
+ Import and enable a plugin:
225
+
226
+ ```text
227
+ /plugin import ./my-plugin reviewer
228
+ /plugin list
229
+ /plugin info reviewer
230
+ /plugin disable reviewer
231
+ /plugin enable reviewer
232
+ /plugin remove reviewer
233
+ ```
234
+
235
+ Installed plugins live under:
236
+
237
+ ```text
238
+ ~/.fastcode/plugins/
239
+ ```
240
+
241
+ ---
242
+
243
+ ## 🎮 Slash Commands
244
+
245
+ | Command | Action |
246
+ | --- | --- |
247
+ | `/help` | Show command list |
248
+ | `/agent [on/off/status]` | Toggle local coding-agent tools |
249
+ | `/tools` | Show available coding tools |
250
+ | `/cwd` | Show agent sandbox root |
251
+ | `/plugin ...` | Import and manage always-active plugin packs |
252
+ | `/provider [id]` | Pick or switch provider (interactive when omitted) |
253
+ | `/model [id]` | Pick or switch model (interactive when omitted) |
254
+ | `/effort [level]` | Thinking effort: auto / low / medium / high / max |
255
+ | `/login [provider] [model] [key]` | Bind a provider-wide API key (guided when omitted) |
256
+ | `/logout <provider>` | Remove the provider's key (`--all` accepted for compatibility) |
257
+ | `/skills ...` | Search, install, enable, disable, list skills |
258
+ | `/theme [id]` | Switch theme |
259
+ | `/cost` | Show token and cost usage |
260
+ | `/system [text]` | Show or update system prompt |
261
+ | `/whoami` | Show configured provider keys |
262
+ | `/config` | Print config and paths |
263
+ | `/clear` | Clear conversation |
264
+ | `/reset` | Reset config |
265
+ | `/about` | Show version and platform |
266
+ | `/context` | Token estimate, compaction threshold, heap |
267
+ | `/compact` | Force local context compaction |
268
+ | `/cancel` | Abort the active run (mobile alternative to Esc) |
269
+ | `/steer <text>` | Guide the next request of an active run |
270
+ | `/jobs` / `/attach <id>` / `/kill <id>` | Background shell sessions |
271
+ | `/expand` | Toggle full/collapsed tool output |
272
+ | `/edit` | Edit the prompt in `$EDITOR` (works around Ink IME bugs) |
273
+ | `/bg` | Explain background shell behaviour |
274
+ | `/exit` | Quit |
275
+
276
+ Keyboard controls:
277
+
278
+ ```text
279
+ Esc cancel streaming
280
+ Ctrl+C press twice to quit
281
+ ```
282
+
283
+ ---
284
+
285
+ ## 🎨 Themes
286
+
287
+ ```text
288
+ /theme fastcode
289
+ /theme neon
290
+ /theme sunset
291
+ /theme matrix
292
+ /theme mono
293
+ ```
294
+
295
+ Want the calmest terminal experience?
296
+
297
+ ```bash
298
+ FASTCODE_STABLE_UI=1 fastcode
299
+ ```
300
+
301
+ Termux enables stable UI automatically.
302
+
303
+ ---
304
+
305
+ ## 📱 Termux
306
+
307
+ Install Node.js first:
308
+
309
+ ```bash
310
+ pkg install nodejs
311
+ npm install -g @datename/fastcode-termux
312
+ fastcode
313
+ ```
314
+
315
+ If the command is not found, check your npm global binary path:
316
+
317
+ ```bash
318
+ npm bin -g
319
+ echo "$PATH"
320
+ ```
321
+
322
+ FastCode stores config inside your home directory:
323
+
324
+ ```text
325
+ ~/.fastcode/
326
+ ├── config.json
327
+ ├── auth.json
328
+ ├── skills/
329
+ ├── plugins/
330
+ ├── cache/
331
+ ├── sessions/
332
+ └── logs/
333
+ ```
334
+
335
+ You can move that root with:
336
+
337
+ ```bash
338
+ FASTCODE_HOME=/path/to/fastcode fastcode
339
+ ```
340
+
341
+ ---
342
+
343
+ ## 🛠️ Development
344
+
345
+ ```bash
346
+ git clone https://github.com/dateName/fastcode-termux
347
+ cd FastCode
348
+ npm install
349
+ npm run dev
350
+ ```
351
+
352
+ Quality checks:
353
+
354
+ ```bash
355
+ npm run check
356
+ ```
357
+
358
+ Or run each step:
359
+
360
+ ```bash
361
+ npm test
362
+ npm run typecheck
363
+ npm run lint
364
+ npm run build
365
+ ```
366
+
367
+ Run the built CLI:
368
+
369
+ ```bash
370
+ node ./bin/fastcode.mjs
371
+ ```
372
+
373
+ ---
374
+
375
+ ## 📦 Publish Notes
376
+
377
+ The package exposes two global commands:
378
+
379
+ ```json
380
+ {
381
+ "bin": {
382
+ "fastcode": "./bin/fastcode.mjs",
383
+ "fc": "./bin/fastcode.mjs"
384
+ }
385
+ }
386
+ ```
387
+
388
+ Publish public scoped releases with:
389
+
390
+ ```bash
391
+ npm publish --access public
392
+ ```
393
+
394
+ ---
395
+
396
+ ## Safety, sessions and limits (0.1.6-beta)
397
+
398
+ | Feature | Behaviour | Override |
399
+ | --- | --- | --- |
400
+ | Project trust | First run in a folder asks before agent tools load; the list lives in ~/.fastcode/trusted.json | fastcode trust / untrust / trusted, FASTCODE_TRUST_ALL=1 |
401
+ | Dangerous-command guard | rm -rf, del /f, rmdir /s, format / mkfs / diskpart, dd if=, writes to /dev/sd, shutdown / reboot / poweroff and fork bombs are refused before execution | FASTCODE_ALLOW_DANGEROUS=1, FASTCODE_SHELL_ALLOWLIST, FASTCODE_SHELL_DENY_EXTRA |
402
+ | Unified tool-output cap | Output is truncated while it is produced, not sliced afterwards (default 30000 characters) | FASTCODE_TOOL_OUTPUT_LIMIT |
403
+ | Session log | Append-only JSONL in ~/.fastcode/sessions, resumable after a crash (cache cap 256MB by default) | fastcode sessions, fastcode resume, FASTCODE_SESSION_LOG=0, FASTCODE_SESSION_CACHE_MB |
404
+ | Checkpoints/projection | `*.projection.json` (<20KB) with tool/model/cwd fingerprint; unpaired tool calls are completed on resume | FASTCODE_FSYNC, FASTCODE_SESSION_LOG |
405
+ | Patch transaction | parse → plan → apply; CRLF/mode kept; symlinks refused; move never overwrites | `/expand` for the full diff |
406
+ | Process tree | abort or `/kill` kills children/grandchildren | POSIX process group, Windows `taskkill /T` |
407
+ | Compaction | token threshold or heap pressure; summary written to `summary-*.md` | FASTCODE_COMPACTION=0, FASTCODE_HEAP_LIMIT_MB |
408
+ | Background shell | Commands over ~2s return a session id; poll incrementally | `/jobs`, `/attach`, `/kill`, FASTCODE_MAX_SPAWN_PER_TURN |
409
+ | Approval hook | Sensitive/large patches need approval; without a resolver they are denied (fail closed) | pending UI not implemented yet |
410
+
411
+ ## 🙏 Credits
412
+
413
+ - **SimpleLittleDev** — author of the original FastCode TUI; the npm package
414
+ `@simplelittledev/fastcode` and its credit belong to them.
415
+ - All upstream dependency authors (Ink, React, meow, cfonts, marked, chalk, ...).
416
+
417
+ ## 📜 License
418
+
419
+ MIT © SimpleLittleDev
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ // FastCode CLI shim.
3
+ //
4
+ // Resolution order:
5
+ // 1. dist/cli.js — self-contained esbuild bundle (committed to git: works
6
+ // after a plain `git clone`, no `npm install` required)
7
+ // 2. dist/index.js — tsc output (needs node_modules)
8
+ // 3. src/index.ts — dev fallback via tsx
9
+ import { fileURLToPath, pathToFileURL } from "node:url";
10
+ import { dirname, join } from "node:path";
11
+ import { existsSync } from "node:fs";
12
+
13
+ const here = dirname(fileURLToPath(import.meta.url));
14
+ const bundleEntry = join(here, "..", "dist", "cli.js");
15
+ const distEntry = join(here, "..", "dist", "index.js");
16
+ const srcEntry = [join(here, "..", "src", "index.ts"), join(here, "..", "src", "index.tsx")].find((p) => existsSync(p));
17
+
18
+ const MISSING_DEPS_HELP = `
19
+ ╭─────────────────────────────────────────────╮
20
+ │ ⚠️ FastCode 缺少依赖包 │
21
+ ╰─────────────────────────────────────────────╯
22
+
23
+ 请选择以下任一方式修复:
24
+
25
+ 【方式一】一键安装(推荐)
26
+ bash scripts/install.sh
27
+
28
+ 【方式二】手动安装依赖
29
+ cd package && npm install
30
+
31
+ 【方式三】下载便携版
32
+ https://github.com/dateName/fastcode-termux/releases
33
+ `;
34
+
35
+ async function run() {
36
+ try {
37
+ if (existsSync(bundleEntry)) {
38
+ await import(pathToFileURL(bundleEntry).href);
39
+ } else if (existsSync(distEntry)) {
40
+ await import(pathToFileURL(distEntry).href);
41
+ } else if (srcEntry) {
42
+ // Local dev fallback — let users `node ./bin/fastcode.mjs` from the repo
43
+ const { register } = await import("node:module");
44
+ register("tsx/esm", import.meta.url);
45
+ await import(pathToFileURL(srcEntry).href);
46
+ } else {
47
+ console.error("FastCode build artifacts not found. Did you run `npm run build`?");
48
+ process.exit(1);
49
+ }
50
+ } catch (err) {
51
+ if (err && err.code === "ERR_MODULE_NOT_FOUND") {
52
+ console.error(MISSING_DEPS_HELP);
53
+ process.exit(1);
54
+ }
55
+ throw err;
56
+ }
57
+ }
58
+
59
+ run();
@@ -0,0 +1,50 @@
1
+ export type ApprovalScope = "once" | "session" | "always";
2
+ export type ApprovalReason = "trust" | "sensitive_path" | "ambiguous_match" | "destructive" | "large_diff";
3
+ export interface ChoiceItem {
4
+ label: string;
5
+ value: string;
6
+ }
7
+ export type ApprovalPreview = {
8
+ kind: "diff";
9
+ text: string;
10
+ } | {
11
+ kind: "choices";
12
+ items: ChoiceItem[];
13
+ };
14
+ export type ApprovalOption = {
15
+ kind: "allow";
16
+ scope: ApprovalScope;
17
+ label: string;
18
+ } | {
19
+ kind: "deny";
20
+ label: string;
21
+ } | {
22
+ kind: "choose";
23
+ label: string;
24
+ value: string;
25
+ } | {
26
+ kind: "feedback";
27
+ label: string;
28
+ prompt: string;
29
+ };
30
+ export interface ApprovalRequest {
31
+ id: string;
32
+ tool: string;
33
+ args: unknown;
34
+ reason: ApprovalReason;
35
+ options: ApprovalOption[];
36
+ preview?: ApprovalPreview;
37
+ }
38
+ export type ApprovalDecision = {
39
+ kind: "allow";
40
+ scope: ApprovalScope;
41
+ } | {
42
+ kind: "deny";
43
+ reason?: string;
44
+ feedback?: string;
45
+ } | {
46
+ kind: "pending";
47
+ request: ApprovalRequest;
48
+ };
49
+ export type ApprovalResolver = (request: ApprovalRequest) => ApprovalDecision | Promise<ApprovalDecision>;
50
+ export declare const DEFAULT_ALLOW_OPTIONS: ApprovalOption[];
@@ -0,0 +1,7 @@
1
+ export const DEFAULT_ALLOW_OPTIONS = [
2
+ { kind: "allow", scope: "once", label: "Allow once" },
3
+ { kind: "allow", scope: "session", label: "Allow for this session" },
4
+ { kind: "allow", scope: "always", label: "Always allow" },
5
+ { kind: "deny", label: "Deny" },
6
+ { kind: "feedback", label: "Deny with feedback", prompt: "Why should this be denied?" },
7
+ ];
@@ -0,0 +1,39 @@
1
+ import type { ChatMessage } from "../types.js";
2
+ export interface CompactionConfig {
3
+ enabled: boolean;
4
+ localThresholdRatio: number;
5
+ keepTurns: number;
6
+ serverCompactionAware: boolean;
7
+ serverCompactThreshold?: number;
8
+ clampAboveServerByTokens: number;
9
+ maxSummaryTokens: number;
10
+ heapLimitMb: number;
11
+ }
12
+ export declare const DEFAULT_COMPACTION_CONFIG: CompactionConfig;
13
+ export interface CompactionOptions {
14
+ contextWindow: number;
15
+ providerId?: string;
16
+ model?: string;
17
+ force?: boolean;
18
+ serverOpaqueState?: string;
19
+ }
20
+ export interface CompactionResult {
21
+ messages: ChatMessage[];
22
+ compacted: boolean;
23
+ reason?: "threshold" | "heap";
24
+ source: "local" | "server" | "none";
25
+ beforeTokens: number;
26
+ afterTokens: number;
27
+ beforeChars: number;
28
+ afterChars: number;
29
+ droppedMessages: number;
30
+ keptMessages: number;
31
+ summary?: string;
32
+ summaryFile?: string;
33
+ }
34
+ export declare function compactionConfigFromEnv(): CompactionConfig;
35
+ export declare function localThresholdTokens(config: CompactionConfig, contextWindow: number): number;
36
+ export declare function heapExceeded(config: CompactionConfig): boolean;
37
+ export declare function shouldCompact(messages: ChatMessage[], config: CompactionConfig, options: CompactionOptions): boolean;
38
+ export declare function compactMessages(messages: ChatMessage[], config: CompactionConfig, options: CompactionOptions): CompactionResult;
39
+ export declare function buildSummary(messages: ChatMessage[], config: CompactionConfig, options: Pick<CompactionOptions, "providerId" | "model">): string;