@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.
- package/README.md +18 -0
- package/README_CN.md +14 -0
- package/bin/hncode +54 -8
- package/package.json +1 -1
- package/src/agent-task.js +356 -337
- package/src/agent.js +1465 -1405
- package/src/animate.js +56 -0
- package/src/colors.js +615 -593
- package/src/config.js +50 -7
- package/src/context-bar.js +280 -278
- package/src/doctor.js +4 -3
- package/src/file-tree.js +4 -3
- package/src/highlight.js +20 -6
- package/src/i18n.js +1432 -389
- package/src/image-row.js +11 -2
- package/src/index.js +218 -6
- package/src/keybindings.js +2 -1
- package/src/llm.js +146 -21
- package/src/log-file.js +112 -0
- package/src/markdown.js +646 -567
- package/src/mcp-server.js +409 -0
- package/src/mcp.js +279 -29
- package/src/memory-profile.js +19 -16
- package/src/migrate-index.js +175 -0
- package/src/migrate.js +392 -0
- package/src/panels.js +9 -7
- package/src/plan.js +7 -5
- package/src/plugin.js +37 -21
- package/src/registry-browser.js +17 -15
- package/src/rows-plan-bg.js +3 -2
- package/src/rows-status.js +20 -6
- package/src/rows-tool-result.js +242 -208
- package/src/screen-paint.js +153 -128
- package/src/session-recover.js +317 -0
- package/src/session.js +203 -13
- package/src/settings-schema.js +9 -0
- package/src/swarm-progress.js +6 -2
- package/src/tasks-browser.js +37 -36
- package/src/team-panel.js +12 -11
- package/src/term.js +57 -21
- package/src/text.js +254 -149
- package/src/tool-line.js +7 -2
- package/src/tool-result.js +400 -327
- package/src/tools/agent.js +7 -2
- package/src/tools/ask-user-question.js +1 -2
- package/src/tools/bash.js +446 -434
- package/src/tools/edit.js +653 -665
- package/src/tools/goal.js +130 -93
- package/src/tools/read.js +141 -133
- package/src/tools/tasks.js +214 -214
- package/src/tools/utils.js +143 -104
- 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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
}
|