@hncode/hncode 0.8.1 → 0.8.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.
Files changed (52) hide show
  1. package/README.md +18 -0
  2. package/README_CN.md +14 -0
  3. package/bin/hncode +54 -8
  4. package/package.json +1 -1
  5. package/src/agent-task.js +356 -337
  6. package/src/agent.js +1465 -1405
  7. package/src/animate.js +56 -0
  8. package/src/colors.js +615 -593
  9. package/src/config.js +50 -7
  10. package/src/context-bar.js +280 -278
  11. package/src/doctor.js +4 -3
  12. package/src/file-tree.js +4 -3
  13. package/src/highlight.js +20 -6
  14. package/src/i18n.js +1432 -389
  15. package/src/image-row.js +11 -2
  16. package/src/index.js +218 -6
  17. package/src/keybindings.js +2 -1
  18. package/src/llm.js +146 -21
  19. package/src/log-file.js +112 -0
  20. package/src/markdown.js +646 -567
  21. package/src/mcp-server.js +409 -0
  22. package/src/mcp.js +279 -29
  23. package/src/memory-profile.js +19 -16
  24. package/src/migrate-index.js +175 -0
  25. package/src/migrate.js +392 -0
  26. package/src/panels.js +9 -7
  27. package/src/plan.js +7 -5
  28. package/src/plugin.js +37 -21
  29. package/src/registry-browser.js +17 -15
  30. package/src/rows-plan-bg.js +3 -2
  31. package/src/rows-status.js +20 -6
  32. package/src/rows-tool-result.js +242 -208
  33. package/src/screen-paint.js +153 -128
  34. package/src/session-recover.js +317 -0
  35. package/src/session.js +203 -13
  36. package/src/settings-schema.js +9 -0
  37. package/src/swarm-progress.js +6 -2
  38. package/src/tasks-browser.js +37 -36
  39. package/src/team-panel.js +12 -11
  40. package/src/term.js +57 -21
  41. package/src/text.js +254 -149
  42. package/src/tool-line.js +7 -2
  43. package/src/tool-result.js +400 -327
  44. package/src/tools/agent.js +7 -2
  45. package/src/tools/ask-user-question.js +1 -2
  46. package/src/tools/bash.js +446 -434
  47. package/src/tools/edit.js +653 -665
  48. package/src/tools/goal.js +130 -93
  49. package/src/tools/read.js +141 -133
  50. package/src/tools/tasks.js +214 -214
  51. package/src/tools/utils.js +143 -104
  52. package/src/tui.js +20887 -19942
package/README.md CHANGED
@@ -139,6 +139,24 @@ This project is licensed under the [PolyForm Noncommercial License 1.0.0](https:
139
139
  3. ❌ No commercial use of any kind (selling it, shipping it inside a paid product, or using it to run a commercial service)
140
140
  4. ℹ️ This is *not* a copyleft license: your own additions do not have to be published. Commercial use requires a separate license from the author.
141
141
 
142
+ ### On commercial partnerships
143
+
144
+ **This project does not take commercial partnerships, and is not built toward one.**
145
+
146
+ HNCode exists because I wanted a tool that works the way I work, and because other people who like tinkering deserve the
147
+ same. It is not a product and it is not a business. The moment a partnership enters the picture, the question stops being
148
+ "how do we make this better" and starts being "how do we make this pay" — and that decides the roadmap, the trade-offs,
149
+ even the shape of the code. At that point it is a different project.
150
+
151
+ So:
152
+
153
+ - No investment, no feature sponsorship, no white-labelling, no "build us a commercial fork"
154
+ - Design trade-offs are not renegotiated for a paying customer's needs
155
+ - Using it **internally** — including at a company, to write code — is the normal way to run it and is not restricted.
156
+ What is prohibited is selling it or building a business on it, not working with it
157
+
158
+ The project will keep going this way. If it is useful, use it; if you want it better, file an issue or send a PR.
159
+
142
160
  ---
143
161
 
144
162
  **NPM Package**: [@hncode/hncode](https://www.npmjs.com/package/@hncode/hncode)
package/README_CN.md CHANGED
@@ -95,6 +95,20 @@ npx @hncode/hncode
95
95
  3. ❌ 禁止任何形式的商业使用(出售、作为付费产品的一部分、或用于运营商业服务)
96
96
  4. ℹ️ 这**不是** copyleft 许可:你自己新增的部分无需开源。商业使用需向作者单独获取授权。
97
97
 
98
+ ### 关于商业合作
99
+
100
+ **这个项目不接受商业合作,也不以此为目的。**
101
+
102
+ 做 HNCode 的初衷是给自己和愿意一起折腾的人一个用得顺手的工具,不是做一个产品,更不是一门生意。一旦引入商业合作,方向就会从「怎么让这个东西更好用」变成「怎么让它更赚钱」——需求优先级、功能取舍、甚至代码结构都会跟着变。那就不是同一个项目了。
103
+
104
+ 所以:
105
+
106
+ - 不接受投资、赞助换功能、白标授权、或者「帮你做个商业版」
107
+ - 不会因为某个客户的需求改变既定的设计取舍
108
+ - 个人和企业**内部**把它当工具用(包括在商业公司里写代码)是正常运行方式,不受限制——禁止的是拿它去做生意,不是用它干活
109
+
110
+ 这个项目会一直按非商业的方式走下去。觉得有用,用就是了;想让它更好,提 issue 或者 PR。
111
+
98
112
  ---
99
113
 
100
114
  **NPM 包**: [@hncode/hncode](https://www.npmjs.com/package/@hncode/hncode)
package/bin/hncode CHANGED
@@ -9,14 +9,60 @@
9
9
  // bootstrap() never throws (a missing Node API or a broken plugin dir degrades
10
10
  // to "no patches/plugins"), and we swallow even that here: nothing in the plugin
11
11
  // subsystem may stop hncode itself from launching.
12
- import('../src/bootstrap.js')
13
- .then((b) => b.bootstrap())
14
- .catch((err) => { console.error('[hncode] bootstrap failed, starting without plugins:', err); })
15
- .then(() => import('../src/index.js'))
16
- .then((mod) => mod.main(process.argv.slice(2)))
17
- .then((code) => process.exit(code ?? 0))
18
- .catch((err) => {
12
+ //
13
+ // THE COMPILE CACHE NEEDS A RE-EXEC, BECAUSE NODE READS IT AT STARTUP.
14
+ //
15
+ // The TUI pulls in about ninety modules, and reusing their compiled bytecode measured
16
+ // 393ms -> 298ms on a warm start. The variable is read before this file runs, so the only
17
+ // way to enable it is to start a child with it set and let the child do the work. That
18
+ // happens ONCE per launch, guarded by the variable being absent, so the child (which has
19
+ // it) never repeats it.
20
+ //
21
+ // It is skipped when the environment already names a cache (the user configured one), and
22
+ // when HNCODE_NO_COMPILE_CACHE is set (a sandbox, or a read-only home).
23
+ import path from 'node:path';
24
+ import os from 'node:os';
25
+ import cp from 'node:child_process';
26
+ import { fileURLToPath } from 'node:url';
27
+
28
+ function cacheDir() {
29
+ try { return path.join(os.homedir(), '.hncode', 'compile-cache'); } catch { return null; }
30
+ }
31
+
32
+ /** Start the real CLI with the compile cache on, and return true when that happened. */
33
+ function reexecWithCache() {
34
+ if (process.env.NODE_COMPILE_CACHE) return false;
35
+ if (process.env.HNCODE_NO_COMPILE_CACHE) return false;
36
+ const dir = cacheDir();
37
+ if (!dir) return false;
38
+ const self = fileURLToPath(import.meta.url);
39
+ const child = cp.spawn(process.execPath, [self, ...process.argv.slice(2)], {
40
+ stdio: 'inherit',
41
+ env: { ...process.env, NODE_COMPILE_CACHE: dir },
42
+ });
43
+ child.on('error', () => {
44
+ // The spawn itself failed: fall through to running in this process, uncached.
45
+ run();
46
+ });
47
+ child.on('exit', (code, signal) => {
48
+ if (signal) process.kill(process.pid, signal);
49
+ else process.exit(code ?? 0);
50
+ });
51
+ return true;
52
+ }
53
+
54
+ async function run() {
55
+ await import('../src/bootstrap.js')
56
+ .then((b) => b.bootstrap())
57
+ .catch((err) => { console.error('[hncode] bootstrap failed, starting without plugins:', err); });
58
+ const mod = await import('../src/index.js');
59
+ const code = await mod.main(process.argv.slice(2));
60
+ process.exit(code ?? 0);
61
+ }
62
+
63
+ if (!reexecWithCache()) {
64
+ run().catch((err) => {
19
65
  console.error(err);
20
66
  process.exit(1);
21
67
  });
22
-
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hncode/hncode",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "hncode — A cyan-blue TUI AI coding agent with zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",