@minhluudev/ai-tools 1.0.7 → 1.0.10
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 +16 -1
- package/dist/src/bin/ai-tools.js +2 -1
- package/dist/src/cli.js +94 -2
- package/dist/src/lib/ai-libs.js +66 -2
- package/dist/src/lib/mcp.js +665 -0
- package/dist/src/lib/tui-ai-libs.js +41 -35
- package/dist/src/lib/tui-entry-menu.js +27 -18
- package/dist/src/lib/tui-mcp.js +514 -0
- package/dist/src/lib/tui-project-docs.js +15 -15
- package/dist/src/lib/tui-utils.js +41 -36
- package/dist/src/lib/tui-wizard.js +24 -24
- package/package.json +1 -1
- package/project-docs-catalog.json +2 -2
- package/selection-catalog.json +20 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildLibInstallPlan, detectSupportedHostOs } from "./ai-libs.js";
|
|
2
|
-
import { canRun, createTabbedLayout, DEBOUNCE_MOVE_MS, DEBOUNCE_SELECT_MS, renderBannerHeader, renderKeycaps, renderListRow, renderStepSummary, renderTabBar, selectionArray } from "./tui-utils.js";
|
|
2
|
+
import { canRun, createTabbedLayout, DEBOUNCE_MOVE_MS, DEBOUNCE_SELECT_MS, renderBannerHeader, renderKeycaps, renderListRow, renderListContent, renderStepSummary, renderTabBar, selectionArray } from "./tui-utils.js";
|
|
3
3
|
const TAB_ORDER = ["libraries", "agents", "os", "scope", "mode", "review"];
|
|
4
4
|
function buildInitialState() {
|
|
5
5
|
return {
|
|
@@ -26,15 +26,21 @@ function currentTabItems(state) {
|
|
|
26
26
|
return [
|
|
27
27
|
{
|
|
28
28
|
id: "rtk",
|
|
29
|
-
label: "
|
|
29
|
+
label: "◈ rtk-ai/rtk",
|
|
30
30
|
description: "Token-saving CLI proxy with agent-specific init for Codex and Claude.",
|
|
31
31
|
kind: "library"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
id: "icm",
|
|
35
|
-
label: "
|
|
35
|
+
label: "◈ rtk-ai/icm",
|
|
36
36
|
description: "Persistent agent memory with MCP, CLI instructions, rules, and hooks.",
|
|
37
37
|
kind: "library"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "ecc",
|
|
41
|
+
label: "◈ affaan-m/ECC",
|
|
42
|
+
description: "Coding rules, agent instructions, hooks, and skills library for Claude Code and Codex.",
|
|
43
|
+
kind: "library"
|
|
38
44
|
}
|
|
39
45
|
];
|
|
40
46
|
}
|
|
@@ -42,14 +48,14 @@ function currentTabItems(state) {
|
|
|
42
48
|
return [
|
|
43
49
|
{
|
|
44
50
|
id: "codex",
|
|
45
|
-
label: "
|
|
46
|
-
description: "
|
|
51
|
+
label: "◇ Codex",
|
|
52
|
+
description: "Apply library setup to OpenAI Codex config, AGENTS.md, and agent-specific directories.",
|
|
47
53
|
kind: "agents"
|
|
48
54
|
},
|
|
49
55
|
{
|
|
50
56
|
id: "claude",
|
|
51
|
-
label: "
|
|
52
|
-
description: "
|
|
57
|
+
label: "◇ Claude",
|
|
58
|
+
description: "Apply library setup to Claude Code config, CLAUDE.md, and agent-specific directories.",
|
|
53
59
|
kind: "agents"
|
|
54
60
|
}
|
|
55
61
|
];
|
|
@@ -58,13 +64,13 @@ function currentTabItems(state) {
|
|
|
58
64
|
return [
|
|
59
65
|
{
|
|
60
66
|
id: "mac",
|
|
61
|
-
label: "
|
|
67
|
+
label: "⊙ Mac",
|
|
62
68
|
description: "Run the install flow for a macOS host.",
|
|
63
69
|
kind: "os"
|
|
64
70
|
},
|
|
65
71
|
{
|
|
66
72
|
id: "linux",
|
|
67
|
-
label: "
|
|
73
|
+
label: "⊙ Linux",
|
|
68
74
|
description: "Run the install flow for a Linux host.",
|
|
69
75
|
kind: "os"
|
|
70
76
|
}
|
|
@@ -74,14 +80,14 @@ function currentTabItems(state) {
|
|
|
74
80
|
return [
|
|
75
81
|
{
|
|
76
82
|
id: "global",
|
|
77
|
-
label: "
|
|
83
|
+
label: "⊙ Global",
|
|
78
84
|
description: "Use global agent configuration in home-directory tool config files.",
|
|
79
85
|
kind: "scope"
|
|
80
86
|
},
|
|
81
87
|
{
|
|
82
88
|
id: "local",
|
|
83
|
-
label: "
|
|
84
|
-
description: "
|
|
89
|
+
label: "⊕ Local",
|
|
90
|
+
description: "Install into the project's own config dirs (.claude/, .codex/) instead of the home directory.",
|
|
85
91
|
kind: "scope"
|
|
86
92
|
}
|
|
87
93
|
];
|
|
@@ -90,13 +96,13 @@ function currentTabItems(state) {
|
|
|
90
96
|
return [
|
|
91
97
|
{
|
|
92
98
|
id: "install",
|
|
93
|
-
label: "Install",
|
|
99
|
+
label: "▶ Install",
|
|
94
100
|
description: "Install the selected libraries and configure the chosen integrations.",
|
|
95
101
|
kind: "mode"
|
|
96
102
|
},
|
|
97
103
|
{
|
|
98
104
|
id: "uninstall",
|
|
99
|
-
label: "Uninstall",
|
|
105
|
+
label: "← Uninstall",
|
|
100
106
|
description: "Remove library-managed integrations safely and clean up only library-specific artifacts.",
|
|
101
107
|
kind: "mode"
|
|
102
108
|
}
|
|
@@ -105,19 +111,19 @@ function currentTabItems(state) {
|
|
|
105
111
|
return [
|
|
106
112
|
{
|
|
107
113
|
id: "confirm",
|
|
108
|
-
label: "Confirm install",
|
|
114
|
+
label: "✓ Confirm install",
|
|
109
115
|
description: "Run the planned install and configuration commands.",
|
|
110
116
|
kind: "review"
|
|
111
117
|
},
|
|
112
118
|
{
|
|
113
119
|
id: "back",
|
|
114
|
-
label: "Back to main menu",
|
|
120
|
+
label: "← Back to main menu",
|
|
115
121
|
description: "Leave this installer and return to the main menu.",
|
|
116
122
|
kind: "review"
|
|
117
123
|
},
|
|
118
124
|
{
|
|
119
125
|
id: "cancel",
|
|
120
|
-
label: "Cancel",
|
|
126
|
+
label: "✕ Cancel",
|
|
121
127
|
description: "Exit without installing anything.",
|
|
122
128
|
kind: "review"
|
|
123
129
|
}
|
|
@@ -196,7 +202,6 @@ function formatListItem(item, state, isCursorRow, index) {
|
|
|
196
202
|
active: isCursorRow,
|
|
197
203
|
selected: state.reviewAction === item.id,
|
|
198
204
|
label: item.label,
|
|
199
|
-
meta: item.description,
|
|
200
205
|
index
|
|
201
206
|
});
|
|
202
207
|
}
|
|
@@ -204,20 +209,22 @@ function formatListItem(item, state, isCursorRow, index) {
|
|
|
204
209
|
active: isCursorRow,
|
|
205
210
|
selected: isItemSelected(item, state),
|
|
206
211
|
label: item.label,
|
|
207
|
-
meta: item.description,
|
|
208
212
|
index
|
|
209
213
|
});
|
|
210
214
|
}
|
|
211
215
|
function renderReviewSummary(state) {
|
|
212
216
|
const selectedLibraries = selectionArray(state.selectedLibraries);
|
|
213
217
|
const selectedAgents = selectionArray(state.selectedAgents);
|
|
218
|
+
const sep = `{cyan-fg}${"─".repeat(50)}{/cyan-fg}`;
|
|
219
|
+
const none = "{gray-fg}none{/gray-fg}";
|
|
214
220
|
const lines = [
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
`
|
|
218
|
-
`
|
|
219
|
-
`
|
|
220
|
-
`
|
|
221
|
+
`{bold}{white-fg}◈ Summary{/white-fg}{/bold}`,
|
|
222
|
+
sep,
|
|
223
|
+
`{cyan-fg}◆ Libraries{/cyan-fg} ${selectedLibraries.length ? selectedLibraries.join(", ") : none}`,
|
|
224
|
+
`{cyan-fg}◆ Agents{/cyan-fg} ${selectedAgents.length ? selectedAgents.join(", ") : none}`,
|
|
225
|
+
`{cyan-fg}◆ OS{/cyan-fg} ${state.selectedOs ?? none}`,
|
|
226
|
+
`{cyan-fg}◆ Scope{/cyan-fg} ${state.selectedScope}`,
|
|
227
|
+
`{cyan-fg}◆ Mode{/cyan-fg} ${state.selectedMode}`
|
|
221
228
|
];
|
|
222
229
|
if (selectedLibraries.length > 0 && selectedAgents.length > 0 && state.selectedOs) {
|
|
223
230
|
const plan = buildLibInstallPlan({
|
|
@@ -227,14 +234,14 @@ function renderReviewSummary(state) {
|
|
|
227
234
|
agents: selectedAgents,
|
|
228
235
|
libraries: selectedLibraries
|
|
229
236
|
});
|
|
230
|
-
lines.push("",
|
|
237
|
+
lines.push("", sep, `{bold}{white-fg}⊕ Planned steps{/white-fg}{/bold}`);
|
|
231
238
|
for (const step of plan.steps) {
|
|
232
|
-
lines.push(
|
|
239
|
+
lines.push(` {gray-fg}▶{/gray-fg} ${step.title}`);
|
|
233
240
|
}
|
|
234
241
|
if (plan.notes.length > 0) {
|
|
235
|
-
lines.push("",
|
|
242
|
+
lines.push("", `{bold}{white-fg}◎ Notes{/white-fg}{/bold}`);
|
|
236
243
|
for (const note of plan.notes) {
|
|
237
|
-
lines.push(
|
|
244
|
+
lines.push(` {gray-fg}·{/gray-fg} ${note}`);
|
|
238
245
|
}
|
|
239
246
|
}
|
|
240
247
|
}
|
|
@@ -255,7 +262,7 @@ function renderDetailBody(state) {
|
|
|
255
262
|
}
|
|
256
263
|
if (current) {
|
|
257
264
|
const selectedCount = items.filter((item) => isItemSelected(item, state)).length;
|
|
258
|
-
lines.push(
|
|
265
|
+
lines.push(`{cyan-fg}◆ ${selectedCount} of ${items.length} selected{/cyan-fg}`, `{gray-fg}${"─".repeat(40)}{/gray-fg}`, `{bold}{white-fg}${current.label}{/white-fg}{/bold}`, `{gray-fg}${current.description}{/gray-fg}`);
|
|
259
266
|
}
|
|
260
267
|
return lines.join("\n");
|
|
261
268
|
}
|
|
@@ -331,9 +338,8 @@ function syncListSelection(listBox, state) {
|
|
|
331
338
|
const maxIndex = Math.max(items.length - 1, 0);
|
|
332
339
|
const cursor = Math.min(state.listCursor[state.activeTab], maxIndex);
|
|
333
340
|
state.listCursor[state.activeTab] = cursor;
|
|
334
|
-
|
|
335
|
-
listBox
|
|
336
|
-
listBox.scrollTo(cursor);
|
|
341
|
+
const rendered = items.map((item, index) => formatListItem(item, state, index === cursor, index));
|
|
342
|
+
renderListContent(listBox, rendered, cursor);
|
|
337
343
|
}
|
|
338
344
|
export async function runAiLibsWizard() {
|
|
339
345
|
return new Promise((resolve, reject) => {
|
|
@@ -380,7 +386,7 @@ export async function runAiLibsWizard() {
|
|
|
380
386
|
review: "Review selections"
|
|
381
387
|
}[state.activeTab];
|
|
382
388
|
const stepDescription = {
|
|
383
|
-
libraries: "Choose one or
|
|
389
|
+
libraries: "Choose one or more upstream AI libraries to install.",
|
|
384
390
|
agents: "Pick which agent integrations should be configured.",
|
|
385
391
|
os: "Choose the current host OS for sanity checking before install.",
|
|
386
392
|
scope: "Choose whether setup should target global config or project-local files.",
|
|
@@ -395,7 +401,7 @@ export async function runAiLibsWizard() {
|
|
|
395
401
|
mode: state.selectedMode,
|
|
396
402
|
review: state.notice || "Ready for confirmation"
|
|
397
403
|
}[state.activeTab];
|
|
398
|
-
headerBox.setContent(renderBannerHeader("Install libs for AI", "Run upstream installers and init commands for RTK and
|
|
404
|
+
headerBox.setContent(renderBannerHeader("Install libs for AI", "Run upstream installers and init commands for RTK, ICM, and ECC.", [
|
|
399
405
|
{ label: `${state.selectedLibraries.size} libraries`, tone: "accent" },
|
|
400
406
|
{ label: `${state.selectedAgents.size} agents`, tone: "success" },
|
|
401
407
|
{ label: state.selectedOs ?? "OS pending", tone: "muted" },
|
|
@@ -3,25 +3,31 @@ import { canRun, DEBOUNCE_MOVE_MS, DEBOUNCE_SELECT_MS, renderBannerHeader, rende
|
|
|
3
3
|
const MENU_ITEMS = [
|
|
4
4
|
{
|
|
5
5
|
id: "install-skills",
|
|
6
|
-
label: "Install agent skills",
|
|
6
|
+
label: "◈ Install agent skills",
|
|
7
7
|
description: "Open the guided installer for Codex skills and Claude custom agents.",
|
|
8
8
|
meta: "Codex + Claude"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
id: "install-project-docs",
|
|
12
|
-
label: "Install project docs",
|
|
12
|
+
label: "▤ Install project docs",
|
|
13
13
|
description: "Copy selected project docs and workflow templates into the current repository.",
|
|
14
14
|
meta: "Current repo"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
id: "install-libs",
|
|
18
|
-
label: "Install libs for AI",
|
|
19
|
-
description: "Install RTK
|
|
18
|
+
label: "⬡ Install libs for AI",
|
|
19
|
+
description: "Install RTK, ICM, or ECC, then run the supported setup flow for Codex and Claude.",
|
|
20
20
|
meta: "Mac + Linux"
|
|
21
21
|
},
|
|
22
|
+
{
|
|
23
|
+
id: "install-mcp",
|
|
24
|
+
label: "◎ Install MCP",
|
|
25
|
+
description: "Add or remove Ant Design, GitLab, GitHub, and Figma MCP servers for Codex or Claude.",
|
|
26
|
+
meta: "Codex + Claude"
|
|
27
|
+
},
|
|
22
28
|
{
|
|
23
29
|
id: "cancel",
|
|
24
|
-
label: "Cancel",
|
|
30
|
+
label: "✕ Cancel",
|
|
25
31
|
description: "Exit without running any installer.",
|
|
26
32
|
meta: "Safe exit"
|
|
27
33
|
}
|
|
@@ -29,8 +35,7 @@ const MENU_ITEMS = [
|
|
|
29
35
|
function renderItem(item, isActive) {
|
|
30
36
|
return renderListRow({
|
|
31
37
|
active: isActive,
|
|
32
|
-
label: item.label
|
|
33
|
-
meta: item.meta
|
|
38
|
+
label: item.label
|
|
34
39
|
});
|
|
35
40
|
}
|
|
36
41
|
export async function runEntryMenu() {
|
|
@@ -46,7 +51,7 @@ export async function runEntryMenu() {
|
|
|
46
51
|
});
|
|
47
52
|
const headerBox = blessed.box({
|
|
48
53
|
parent: screen,
|
|
49
|
-
top:
|
|
54
|
+
top: 0,
|
|
50
55
|
left: 2,
|
|
51
56
|
width: "100%-4",
|
|
52
57
|
height: 6,
|
|
@@ -65,17 +70,17 @@ export async function runEntryMenu() {
|
|
|
65
70
|
});
|
|
66
71
|
const listBox = blessed.list({
|
|
67
72
|
parent: screen,
|
|
68
|
-
top:
|
|
73
|
+
top: 6,
|
|
69
74
|
left: 2,
|
|
70
|
-
width: "
|
|
71
|
-
height:
|
|
75
|
+
width: "40%-2",
|
|
76
|
+
height: "100%-7",
|
|
72
77
|
tags: true,
|
|
73
78
|
keys: false,
|
|
74
79
|
vi: false,
|
|
75
80
|
mouse: false,
|
|
76
81
|
interactive: false,
|
|
77
82
|
border: { type: "line" },
|
|
78
|
-
label: "
|
|
83
|
+
label: " menu ",
|
|
79
84
|
padding: {
|
|
80
85
|
left: 1,
|
|
81
86
|
right: 1
|
|
@@ -93,10 +98,10 @@ export async function runEntryMenu() {
|
|
|
93
98
|
});
|
|
94
99
|
const detailBox = blessed.box({
|
|
95
100
|
parent: screen,
|
|
96
|
-
top:
|
|
97
|
-
left:
|
|
98
|
-
width: "
|
|
99
|
-
height: 7,
|
|
101
|
+
top: 6,
|
|
102
|
+
left: "40%",
|
|
103
|
+
width: "60%-2",
|
|
104
|
+
height: "100%-7",
|
|
100
105
|
tags: true,
|
|
101
106
|
wrap: true,
|
|
102
107
|
border: { type: "line" },
|
|
@@ -126,6 +131,7 @@ export async function runEntryMenu() {
|
|
|
126
131
|
screen.destroy();
|
|
127
132
|
}
|
|
128
133
|
function render() {
|
|
134
|
+
const active = MENU_ITEMS[cursor];
|
|
129
135
|
headerBox.setContent(renderBannerHeader("Main menu", "Choose the workflow you want to run.", [
|
|
130
136
|
{ label: `${MENU_ITEMS.length - 1} workflows`, tone: "accent" },
|
|
131
137
|
{ label: "Keyboard only", tone: "muted" },
|
|
@@ -134,9 +140,12 @@ export async function runEntryMenu() {
|
|
|
134
140
|
listBox.setItems(MENU_ITEMS.map((item, index) => renderItem(item, index === cursor)));
|
|
135
141
|
listBox.select(cursor);
|
|
136
142
|
detailBox.setContent([
|
|
137
|
-
`{bold}
|
|
143
|
+
`{bold}{white-fg}${active.label}{/white-fg}{/bold}`,
|
|
144
|
+
`{cyan-fg}${active.meta}{/cyan-fg}`,
|
|
145
|
+
"",
|
|
146
|
+
`{gray-fg}${"─".repeat(36)}{/gray-fg}`,
|
|
138
147
|
"",
|
|
139
|
-
|
|
148
|
+
active.description,
|
|
140
149
|
"",
|
|
141
150
|
"{gray-fg}Tip: complete one workflow, then rerun the CLI for another task.{/gray-fg}"
|
|
142
151
|
].join("\n"));
|