oh-aicoding-tool 0.1.4 → 0.1.6
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 +12 -12
- package/bin/cli.js +61 -24
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ CLI 运行时会解析依赖包暴露的 bin 并转发参数。因此功能逻
|
|
|
25
25
|
运行交互式安装器:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npx oh-aicoding-tool
|
|
28
|
+
npx oh-aicoding-tool@latest
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
从当前仓库运行:
|
|
@@ -49,27 +49,27 @@ npm start
|
|
|
49
49
|
Langfuse 命令会转发给 `oh-langfuse`:
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
npx oh-aicoding-tool langfuse setup
|
|
53
|
-
npx oh-aicoding-tool langfuse setup claude
|
|
54
|
-
npx oh-aicoding-tool langfuse setup opencode
|
|
55
|
-
npx oh-aicoding-tool langfuse setup codex
|
|
56
|
-
npx oh-aicoding-tool langfuse check
|
|
57
|
-
npx oh-aicoding-tool langfuse check environment
|
|
52
|
+
npx oh-aicoding-tool@latest langfuse setup
|
|
53
|
+
npx oh-aicoding-tool@latest langfuse setup claude
|
|
54
|
+
npx oh-aicoding-tool@latest langfuse setup opencode
|
|
55
|
+
npx oh-aicoding-tool@latest langfuse setup codex
|
|
56
|
+
npx oh-aicoding-tool@latest langfuse check
|
|
57
|
+
npx oh-aicoding-tool@latest langfuse check environment
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
也支持 Langfuse 的短命令别名:
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
npx oh-aicoding-tool setup
|
|
64
|
-
npx oh-aicoding-tool check
|
|
63
|
+
npx oh-aicoding-tool@latest setup
|
|
64
|
+
npx oh-aicoding-tool@latest check
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
问题上报命令会转发给 `oh-aireport`:
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
npx oh-aicoding-tool report install opencode --email xxxxx@huawei.com
|
|
71
|
-
npx oh-aicoding-tool report install claude
|
|
72
|
-
npx oh-aicoding-tool report install both
|
|
70
|
+
npx oh-aicoding-tool@latest report install opencode --email xxxxx@huawei.com
|
|
71
|
+
npx oh-aicoding-tool@latest report install claude
|
|
72
|
+
npx oh-aicoding-tool@latest report install both
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
如果交互流程中未填写邮箱,聚合器会向 `oh-aireport` 传递 `--skip-email`,
|
package/bin/cli.js
CHANGED
|
@@ -83,11 +83,48 @@ function runPackageBin(packageName, binName, args) {
|
|
|
83
83
|
return result.status ?? (result.error ? 1 : 0);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function emailIsValid(value) {
|
|
87
|
-
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(value || "").trim());
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function
|
|
86
|
+
function emailIsValid(value) {
|
|
87
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(value || "").trim());
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function keySeq(raw, key = {}) {
|
|
91
|
+
return String(key.sequence ?? raw ?? "");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function isCtrlC(raw, key = {}) {
|
|
95
|
+
return Boolean(key.ctrl && key.name === "c") || keySeq(raw, key) === "\x03";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function isEscape(raw, key = {}) {
|
|
99
|
+
const seq = keySeq(raw, key);
|
|
100
|
+
return key.name === "escape" || seq === "\x1b";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function isUpKey(raw, key = {}) {
|
|
104
|
+
const seq = keySeq(raw, key);
|
|
105
|
+
return key.name === "up" || seq === "\x1b[A" || seq === "\x1bOA";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function isDownKey(raw, key = {}) {
|
|
109
|
+
const seq = keySeq(raw, key);
|
|
110
|
+
return key.name === "down" || seq === "\x1b[B" || seq === "\x1bOB";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function isEnterKey(raw, key = {}) {
|
|
114
|
+
const seq = keySeq(raw, key);
|
|
115
|
+
return key.name === "return" || key.name === "enter" || seq === "\r" || seq === "\n";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function isSpaceKey(raw, key = {}) {
|
|
119
|
+
return key.name === "space" || keySeq(raw, key) === " ";
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function numberKey(raw, key = {}) {
|
|
123
|
+
const seq = keySeq(raw, key);
|
|
124
|
+
return /^[1-9]$/.test(seq) ? Number.parseInt(seq, 10) : Number.NaN;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function renderMultiChoice(title, choices, index, selected, subtitle) {
|
|
91
128
|
renderHeader(subtitle);
|
|
92
129
|
console.log("");
|
|
93
130
|
console.log(paint(title, t.bold, t.blue));
|
|
@@ -128,25 +165,25 @@ async function askMultiChoice(rl, title, choices, subtitle) {
|
|
|
128
165
|
renderMultiChoice(title, choices, index, selected, subtitle);
|
|
129
166
|
}
|
|
130
167
|
|
|
131
|
-
function onKeypress(
|
|
132
|
-
if (
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (key
|
|
145
|
-
if (
|
|
146
|
-
const number =
|
|
147
|
-
if (Number.isInteger(number) && choices[number - 1]) {
|
|
148
|
-
index = number - 1;
|
|
149
|
-
toggle();
|
|
168
|
+
function onKeypress(raw, key = {}) {
|
|
169
|
+
if (isCtrlC(raw, key)) return cleanup([]);
|
|
170
|
+
if (isUpKey(raw, key)) {
|
|
171
|
+
index = (index - 1 + choices.length) % choices.length;
|
|
172
|
+
renderMultiChoice(title, choices, index, selected, subtitle);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (isDownKey(raw, key)) {
|
|
176
|
+
index = (index + 1) % choices.length;
|
|
177
|
+
renderMultiChoice(title, choices, index, selected, subtitle);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (keySeq(raw, key).toLowerCase() === "q" || isEscape(raw, key)) return cleanup([]);
|
|
181
|
+
if (isSpaceKey(raw, key)) return toggle();
|
|
182
|
+
if (isEnterKey(raw, key)) return cleanup([...selected]);
|
|
183
|
+
const number = numberKey(raw, key);
|
|
184
|
+
if (Number.isInteger(number) && choices[number - 1]) {
|
|
185
|
+
index = number - 1;
|
|
186
|
+
toggle();
|
|
150
187
|
}
|
|
151
188
|
}
|
|
152
189
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-aicoding-tool",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Interactive installer for AI coding tools: Langfuse tracing and oh-ai-report.",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"issue-report"
|
|
25
25
|
],
|
|
26
26
|
"license": "UNLICENSED",
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"oh-langfuse": "^0.1.
|
|
29
|
-
"oh-aireport": "^0.1.
|
|
30
|
-
}
|
|
31
|
-
}
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"oh-langfuse": "^0.1.9",
|
|
29
|
+
"oh-aireport": "^0.1.1"
|
|
30
|
+
}
|
|
31
|
+
}
|