@minhluudev/ai-tools 1.0.14 → 1.0.16

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/dist/src/cli.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as process from "node:process";
2
+ import { rm } from "node:fs/promises";
2
3
  import { buildLibInstallPlan, executeLibInstallPlan } from "./lib/ai-libs.js";
3
4
  import { loadPackageConfig } from "./lib/config.js";
4
5
  import { createGitHubClient } from "./lib/github.js";
@@ -8,6 +9,7 @@ import { loadSelectionCatalog, resolveSelectionItems } from "./lib/selection-cat
8
9
  import { buildMcpInstallPlan, createMcpUninstallBackups, executeMcpInstallPlan, inspectMcpUninstallSafety, verifyMcpUninstallExecutionSafety } from "./lib/mcp.js";
9
10
  import { buildPluginInstallPlan, executePluginInstallPlan } from "./lib/plugins.js";
10
11
  import { blessedConfirm } from "./lib/tui-utils.js";
12
+ import { runSkillsWizard, resolveSkillsDir } from "./lib/tui-skills.js";
11
13
  import { runAiLibsWizard } from "./lib/tui-ai-libs.js";
12
14
  import { runEntryMenu } from "./lib/tui-entry-menu.js";
13
15
  import { runMcpWizard } from "./lib/tui-mcp.js";
@@ -351,6 +353,37 @@ export async function runCli() {
351
353
  printBulletPanel(`Install complete (${results.length})`, results.map((result) => `${result.id} -> ${result.targetPath}`), "success");
352
354
  return;
353
355
  }
356
+ if (entryAction === "manage-skills") {
357
+ const skillsResult = await runSkillsWizard();
358
+ if ("backToMenu" in skillsResult) {
359
+ continue;
360
+ }
361
+ const { agent, skillsToDelete } = skillsResult;
362
+ const skillsDir = resolveSkillsDir(agent);
363
+ printSectionHeader("Manage skills", `Deleting ${skillsToDelete.length} skill(s) for ${agent}.`);
364
+ const deleted = [];
365
+ const failed = [];
366
+ for (const skillName of skillsToDelete) {
367
+ const skillPath = `${skillsDir}/${skillName}`;
368
+ try {
369
+ await rm(skillPath, { recursive: true, force: true });
370
+ deleted.push(skillName);
371
+ printStatusLine("delete", skillPath, "muted");
372
+ }
373
+ catch (error) {
374
+ const message = error instanceof Error ? error.message : String(error);
375
+ failed.push({ name: skillName, error: message });
376
+ printStatusLine("warn", `Failed to delete ${skillPath}: ${message}`, "warning");
377
+ }
378
+ }
379
+ if (deleted.length > 0) {
380
+ printBulletPanel(`Deleted (${deleted.length})`, deleted, "success");
381
+ }
382
+ if (failed.length > 0) {
383
+ printBulletPanel(`Failed (${failed.length})`, failed.map((f) => `${f.name}: ${f.error}`), "warning");
384
+ }
385
+ return;
386
+ }
354
387
  // install-skills
355
388
  const config = await loadPackageConfig();
356
389
  const selectionCatalog = await loadSelectionCatalog(config);
@@ -5,6 +5,7 @@ import { spawn } from "node:child_process";
5
5
  const ICM_INSTALL_COMMAND = "curl -fsSL https://raw.githubusercontent.com/rtk-ai/icm/main/install.sh | sh";
6
6
  const RTK_INSTALL_COMMAND = "curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh";
7
7
  const ECC_REPO_URL = "https://github.com/affaan-m/ECC.git";
8
+ const CODEGRAPH_REPO_URL = "https://github.com/colbymchenry/codegraph";
8
9
  const ECC_TEMP_DIR_PREFIX = "ai-tools-ecc-";
9
10
  const ICM_MARKER_START = "<!-- icm:start -->";
10
11
  const ICM_MARKER_END = "<!-- icm:end -->";
@@ -193,6 +194,32 @@ function buildEccInstallSteps(agents) {
193
194
  }
194
195
  return steps;
195
196
  }
197
+ function buildCodegraphInstallSteps() {
198
+ return [
199
+ {
200
+ id: "codegraph-install",
201
+ library: "codegraph",
202
+ phase: "install",
203
+ title: "Install CodeGraph binary",
204
+ description: `Install the CodeGraph CLI globally from the upstream GitHub repo (${CODEGRAPH_REPO_URL}).`,
205
+ command: `npm install -g ${CODEGRAPH_REPO_URL}`,
206
+ runner: "shell"
207
+ }
208
+ ];
209
+ }
210
+ function buildCodegraphUninstallSteps() {
211
+ return [
212
+ {
213
+ id: "codegraph-uninstall",
214
+ library: "codegraph",
215
+ phase: "uninstall",
216
+ title: "Uninstall CodeGraph binary",
217
+ description: "Remove the globally installed CodeGraph CLI.",
218
+ command: "npm uninstall -g codegraph",
219
+ runner: "shell"
220
+ }
221
+ ];
222
+ }
196
223
  export function buildLibInstallPlan(input) {
197
224
  const agents = uniq(input.agents);
198
225
  const libraries = uniq(input.libraries);
@@ -250,6 +277,18 @@ export function buildLibInstallPlan(input) {
250
277
  notes.push("Automatic ECC uninstall is not supported in this CLI. Upstream documents repo-root lifecycle commands such as `node scripts/uninstall.js --dry-run` followed by `node scripts/uninstall.js` for manual cleanup.");
251
278
  notes.push("If ECC was installed through the Claude plugin path, remove the plugin first and then delete only the specific ECC rule folders you copied manually.");
252
279
  }
280
+ continue;
281
+ }
282
+ if (library === "codegraph") {
283
+ if (input.mode === "install") {
284
+ steps.push(...buildCodegraphInstallSteps());
285
+ notes.push("CodeGraph is a project-level indexer. After installing the CLI, run `codegraph init` in each project you want to index — indexing is intentionally per-project and not run automatically here.");
286
+ notes.push("The MCP tools (codegraph_explore, codegraph_node) become available only after a project has been indexed with `codegraph init`.");
287
+ }
288
+ else {
289
+ steps.push(...buildCodegraphUninstallSteps());
290
+ notes.push("CodeGraph uninstall removes only the global CLI binary. Existing `.codegraph/` index directories in your projects are not removed and can be deleted manually with `rm -rf .codegraph`.");
291
+ }
253
292
  }
254
293
  }
255
294
  if (input.mode === "install" && libraries.some((library) => library === "rtk" || library === "icm")) {
@@ -41,6 +41,12 @@ function currentTabItems(state) {
41
41
  label: "◈ affaan-m/ECC",
42
42
  description: "Coding rules, agent instructions, hooks, and skills library for Claude Code and Codex.",
43
43
  kind: "library"
44
+ },
45
+ {
46
+ id: "codegraph",
47
+ label: "◈ colbymchenry/codegraph",
48
+ description: "Codebase indexer that maps symbols and call paths — enables fast semantic code exploration via MCP or CLI.",
49
+ kind: "library"
44
50
  }
45
51
  ];
46
52
  }
@@ -401,7 +407,7 @@ export async function runAiLibsWizard() {
401
407
  mode: state.selectedMode,
402
408
  review: state.notice || "Ready for confirmation"
403
409
  }[state.activeTab];
404
- headerBox.setContent(renderBannerHeader("Install libs for AI", "Run upstream installers and init commands for RTK, ICM, and ECC.", [
410
+ headerBox.setContent(renderBannerHeader("Install libs for AI", "Run upstream installers and init commands for RTK, ICM, ECC, and CodeGraph.", [
405
411
  { label: `${state.selectedLibraries.size} libraries`, tone: "accent" },
406
412
  { label: `${state.selectedAgents.size} agents`, tone: "success" },
407
413
  { label: state.selectedOs ?? "OS pending", tone: "muted" },
@@ -31,6 +31,12 @@ const MENU_ITEMS = [
31
31
  description: "Add or remove Ant Design, GitLab, GitHub, and Figma MCP servers for Codex or Claude.",
32
32
  meta: "Codex + Claude"
33
33
  },
34
+ {
35
+ id: "manage-skills",
36
+ label: "⊘ Manage skills",
37
+ description: "List and delete installed skills for Claude or Codex.",
38
+ meta: "Claude + Codex"
39
+ },
34
40
  {
35
41
  id: "cancel",
36
42
  label: "✕ Cancel",
@@ -38,6 +44,7 @@ const MENU_ITEMS = [
38
44
  meta: "Safe exit"
39
45
  }
40
46
  ];
47
+ export const MENU_ITEMS_FOR_TEST = MENU_ITEMS;
41
48
  function renderItem(item, isActive) {
42
49
  return renderListRow({
43
50
  active: isActive,
@@ -0,0 +1,322 @@
1
+ import { readdir } from "node:fs/promises";
2
+ import * as os from "node:os";
3
+ import * as path from "node:path";
4
+ import { canRun, createTabbedLayout, DEBOUNCE_MOVE_MS, DEBOUNCE_SELECT_MS, renderBannerHeader, renderKeycaps, renderListContent, renderListRow, renderStepSummary, renderTabBar, selectionArray } from "./tui-utils.js";
5
+ const TAB_ORDER = ["agent", "skills", "review"];
6
+ const AGENT_DIR = {
7
+ claude: ".claude",
8
+ codex: ".codex"
9
+ };
10
+ export function resolveSkillsDir(agent) {
11
+ return path.join(os.homedir(), AGENT_DIR[agent], "skills");
12
+ }
13
+ export async function readInstalledSkills(skillsDir) {
14
+ try {
15
+ const entries = await readdir(skillsDir, { withFileTypes: true });
16
+ return entries
17
+ .filter((entry) => entry.isDirectory())
18
+ .map((entry) => entry.name);
19
+ }
20
+ catch {
21
+ return [];
22
+ }
23
+ }
24
+ function buildInitialState(availableSkills) {
25
+ return {
26
+ activeTab: "agent",
27
+ selectedAgent: "claude",
28
+ availableSkills,
29
+ selectedSkills: new Set(),
30
+ listCursor: { agent: 0, skills: 0, review: 0 },
31
+ reviewAction: "confirm",
32
+ notice: ""
33
+ };
34
+ }
35
+ function agentItems() {
36
+ return [
37
+ { id: "claude", label: "◇ Claude" },
38
+ { id: "codex", label: "◇ Codex" }
39
+ ];
40
+ }
41
+ function reviewItems() {
42
+ return [
43
+ { id: "confirm", label: "✓ Confirm delete" },
44
+ { id: "back", label: "← Back to main menu" },
45
+ { id: "cancel", label: "✕ Cancel" }
46
+ ];
47
+ }
48
+ function renderTabs(state) {
49
+ return renderTabBar(TAB_ORDER.map((tab, index) => ({
50
+ label: `${index + 1}. ${tab.charAt(0).toUpperCase() + tab.slice(1)}`,
51
+ meta: tab === "agent"
52
+ ? state.selectedAgent
53
+ : tab === "skills"
54
+ ? `${state.selectedSkills.size} selected`
55
+ : "ready",
56
+ active: state.activeTab === tab
57
+ })));
58
+ }
59
+ function renderDetailBody(state) {
60
+ const lines = [];
61
+ if (state.notice) {
62
+ lines.push(`{yellow-fg}${state.notice}{/yellow-fg}`, "");
63
+ }
64
+ if (state.activeTab === "review") {
65
+ const selected = selectionArray(state.selectedSkills);
66
+ const sep = `{cyan-fg}${"─".repeat(50)}{/cyan-fg}`;
67
+ lines.push(`{bold}{white-fg}◈ Delete summary{/white-fg}{/bold}`, sep, `{cyan-fg}◆ Agent{/cyan-fg} ${state.selectedAgent}`, `{cyan-fg}◆ Skills{/cyan-fg} ${selected.length ? selected.join(", ") : "{gray-fg}none{/gray-fg}"}`, "", `{gray-fg}This will permanently remove the selected skill directories.{/gray-fg}`);
68
+ return lines.join("\n");
69
+ }
70
+ if (state.activeTab === "agent") {
71
+ lines.push(`{cyan-fg}◆ Select the agent whose skills you want to manage.{/cyan-fg}`);
72
+ return lines.join("\n");
73
+ }
74
+ const count = state.selectedSkills.size;
75
+ const total = state.availableSkills.length;
76
+ lines.push(`{cyan-fg}◆ ${count} of ${total} selected{/cyan-fg}`, `{gray-fg}${"─".repeat(40)}{/gray-fg}`, `{gray-fg}Skills for ${state.selectedAgent} in ${resolveSkillsDir(state.selectedAgent)}{/gray-fg}`);
77
+ return lines.join("\n");
78
+ }
79
+ function renderFooter(state) {
80
+ if (state.activeTab === "review") {
81
+ return renderKeycaps([
82
+ { key: "LEFT/RIGHT", label: "switch tab" },
83
+ { key: "UP/DOWN", label: "move" },
84
+ { key: "ENTER", label: "confirm action" },
85
+ { key: "Q", label: "quit" }
86
+ ]);
87
+ }
88
+ if (state.activeTab === "skills") {
89
+ return renderKeycaps([
90
+ { key: "LEFT/RIGHT", label: "switch tab" },
91
+ { key: "UP/DOWN", label: "move" },
92
+ { key: "SPACE", label: "toggle" },
93
+ { key: "A", label: "toggle all" },
94
+ { key: "ENTER", label: "next" },
95
+ { key: "Q", label: "quit" }
96
+ ]);
97
+ }
98
+ return renderKeycaps([
99
+ { key: "LEFT/RIGHT", label: "switch tab" },
100
+ { key: "UP/DOWN", label: "move" },
101
+ { key: "SPACE", label: "select" },
102
+ { key: "ENTER", label: "next" },
103
+ { key: "Q", label: "quit" }
104
+ ]);
105
+ }
106
+ function moveTab(state, delta) {
107
+ const index = TAB_ORDER.indexOf(state.activeTab);
108
+ const nextIndex = (index + delta + TAB_ORDER.length) % TAB_ORDER.length;
109
+ state.activeTab = TAB_ORDER[nextIndex];
110
+ state.notice = "";
111
+ }
112
+ function moveCursor(state, delta) {
113
+ let length = 0;
114
+ if (state.activeTab === "agent")
115
+ length = agentItems().length;
116
+ else if (state.activeTab === "skills")
117
+ length = state.availableSkills.length;
118
+ else
119
+ length = reviewItems().length;
120
+ if (length === 0)
121
+ return;
122
+ const current = state.listCursor[state.activeTab];
123
+ const next = (current + delta + length) % length;
124
+ state.listCursor[state.activeTab] = next;
125
+ if (state.activeTab === "review") {
126
+ state.reviewAction = reviewItems()[next]?.id ?? "confirm";
127
+ }
128
+ }
129
+ function toggleCurrentItem(state) {
130
+ if (state.activeTab === "agent") {
131
+ const item = agentItems()[state.listCursor.agent];
132
+ if (item) {
133
+ state.selectedAgent = item.id;
134
+ }
135
+ return;
136
+ }
137
+ if (state.activeTab === "skills") {
138
+ const skill = state.availableSkills[state.listCursor.skills];
139
+ if (!skill)
140
+ return;
141
+ if (state.selectedSkills.has(skill)) {
142
+ state.selectedSkills.delete(skill);
143
+ }
144
+ else {
145
+ state.selectedSkills.add(skill);
146
+ }
147
+ }
148
+ }
149
+ function toggleAllSkills(state) {
150
+ if (state.activeTab !== "skills")
151
+ return;
152
+ const allSelected = state.availableSkills.every((s) => state.selectedSkills.has(s));
153
+ state.selectedSkills.clear();
154
+ if (!allSelected) {
155
+ for (const s of state.availableSkills) {
156
+ state.selectedSkills.add(s);
157
+ }
158
+ }
159
+ }
160
+ function validateAndAdvance(state) {
161
+ if (state.activeTab === "agent") {
162
+ moveTab(state, 1);
163
+ return true;
164
+ }
165
+ if (state.activeTab === "skills") {
166
+ if (state.availableSkills.length === 0) {
167
+ state.notice = "No skills found. Install skills first.";
168
+ return false;
169
+ }
170
+ if (state.selectedSkills.size === 0) {
171
+ state.notice = "Select at least one skill to delete.";
172
+ return false;
173
+ }
174
+ moveTab(state, 1);
175
+ return true;
176
+ }
177
+ return false;
178
+ }
179
+ function buildListItems(state) {
180
+ if (state.activeTab === "agent") {
181
+ return agentItems().map((item, index) => renderListRow({
182
+ active: index === state.listCursor.agent,
183
+ selected: state.selectedAgent === item.id,
184
+ label: item.label,
185
+ index
186
+ }));
187
+ }
188
+ if (state.activeTab === "skills") {
189
+ if (state.availableSkills.length === 0) {
190
+ return [renderListRow({ active: false, label: "{gray-fg}No skills found{/gray-fg}" })];
191
+ }
192
+ return state.availableSkills.map((skill, index) => renderListRow({
193
+ active: index === state.listCursor.skills,
194
+ selected: state.selectedSkills.has(skill),
195
+ label: `◈ ${skill}`,
196
+ index
197
+ }));
198
+ }
199
+ return reviewItems().map((item, index) => renderListRow({
200
+ active: index === state.listCursor.review,
201
+ selected: state.reviewAction === item.id,
202
+ label: item.label,
203
+ index
204
+ }));
205
+ }
206
+ export async function runSkillsWizard() {
207
+ const initialSkills = await readInstalledSkills(resolveSkillsDir("claude"));
208
+ const state = buildInitialState(initialSkills);
209
+ const { screen, headerBox, tabsBox, titleBox, listBox, detailBox, footerBox } = createTabbedLayout();
210
+ let lastMoveAt = 0;
211
+ let lastSelectAt = 0;
212
+ return new Promise((resolve) => {
213
+ function cleanup() {
214
+ screen.destroy();
215
+ }
216
+ async function refreshSkills() {
217
+ const skills = await readInstalledSkills(resolveSkillsDir(state.selectedAgent));
218
+ state.availableSkills = skills;
219
+ state.selectedSkills.clear();
220
+ state.listCursor.skills = 0;
221
+ state.notice = "";
222
+ render();
223
+ }
224
+ function render() {
225
+ const items = buildListItems(state);
226
+ const cursor = state.listCursor[state.activeTab];
227
+ headerBox.setContent(renderBannerHeader("Manage skills", "List and delete installed skills for Claude or Codex.", [
228
+ { label: state.selectedAgent, tone: "accent" },
229
+ { label: `${state.selectedSkills.size} selected`, tone: "muted" },
230
+ { label: "delete", tone: "warning" }
231
+ ]));
232
+ tabsBox.setContent(renderTabs(state));
233
+ titleBox.setContent(renderStepSummary({
234
+ step: `${TAB_ORDER.indexOf(state.activeTab) + 1}/${TAB_ORDER.length}`,
235
+ title: state.activeTab === "review"
236
+ ? "Review"
237
+ : state.activeTab.charAt(0).toUpperCase() + state.activeTab.slice(1),
238
+ description: "Choose agent, select skills to remove, then confirm."
239
+ }));
240
+ renderListContent(listBox, items, cursor);
241
+ detailBox.setContent(renderDetailBody(state));
242
+ footerBox.setContent(renderFooter(state));
243
+ screen.render();
244
+ }
245
+ screen.key(["left"], () => {
246
+ if (!canRun(lastMoveAt, DEBOUNCE_MOVE_MS))
247
+ return;
248
+ lastMoveAt = Date.now();
249
+ moveTab(state, -1);
250
+ render();
251
+ });
252
+ screen.key(["right"], () => {
253
+ if (!canRun(lastMoveAt, DEBOUNCE_MOVE_MS))
254
+ return;
255
+ lastMoveAt = Date.now();
256
+ moveTab(state, 1);
257
+ render();
258
+ });
259
+ screen.key(["up"], () => {
260
+ if (!canRun(lastMoveAt, DEBOUNCE_MOVE_MS))
261
+ return;
262
+ lastMoveAt = Date.now();
263
+ moveCursor(state, -1);
264
+ render();
265
+ });
266
+ screen.key(["down"], () => {
267
+ if (!canRun(lastMoveAt, DEBOUNCE_MOVE_MS))
268
+ return;
269
+ lastMoveAt = Date.now();
270
+ moveCursor(state, 1);
271
+ render();
272
+ });
273
+ screen.key(["space"], () => {
274
+ if (!canRun(lastSelectAt, DEBOUNCE_SELECT_MS))
275
+ return;
276
+ lastSelectAt = Date.now();
277
+ toggleCurrentItem(state);
278
+ render();
279
+ });
280
+ screen.key(["a"], () => {
281
+ if (!canRun(lastSelectAt, DEBOUNCE_SELECT_MS))
282
+ return;
283
+ lastSelectAt = Date.now();
284
+ toggleAllSkills(state);
285
+ render();
286
+ });
287
+ screen.key(["enter"], () => {
288
+ if (!canRun(lastSelectAt, DEBOUNCE_SELECT_MS))
289
+ return;
290
+ lastSelectAt = Date.now();
291
+ if (state.activeTab !== "review") {
292
+ const prevAgent = state.selectedAgent;
293
+ if (state.activeTab === "agent") {
294
+ const item = agentItems()[state.listCursor.agent];
295
+ if (item)
296
+ state.selectedAgent = item.id;
297
+ }
298
+ const advanced = validateAndAdvance(state);
299
+ if (advanced && state.activeTab === "skills" && state.selectedAgent !== prevAgent) {
300
+ void refreshSkills();
301
+ return;
302
+ }
303
+ render();
304
+ return;
305
+ }
306
+ cleanup();
307
+ if (state.reviewAction === "back" || state.reviewAction === "cancel") {
308
+ resolve({ backToMenu: true });
309
+ return;
310
+ }
311
+ resolve({
312
+ agent: state.selectedAgent,
313
+ skillsToDelete: selectionArray(state.selectedSkills)
314
+ });
315
+ });
316
+ screen.key(["q", "escape", "C-c"], () => {
317
+ cleanup();
318
+ resolve({ backToMenu: true });
319
+ });
320
+ render();
321
+ });
322
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minhluudev/ai-tools",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "CLI to install AI skills from GitHub branches into Codex and Claude.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -63,6 +63,20 @@
63
63
  "description": "Full TDD agent team — spec → testcases → tests → implement → verify → review. Leader and Tester agents included.",
64
64
  "sourceBranch": "agent-skills",
65
65
  "sourcePath": "team-full"
66
+ },
67
+ {
68
+ "id": "make-task",
69
+ "label": "Make Task",
70
+ "description": "Create or update structured task documents from Jira, Trello, Notion, Linear, GitHub Issues, or plain descriptions.",
71
+ "sourceBranch": "agent-skills",
72
+ "sourcePath": "make-task"
73
+ },
74
+ {
75
+ "id": "generate-flow",
76
+ "label": "Generate Flow",
77
+ "description": "Trace a feature's data and logic end-to-end through source code layers — from trigger to persistence, event emission, response, or failure.",
78
+ "sourceBranch": "agent-skills",
79
+ "sourcePath": "generate-flow"
66
80
  }
67
81
  ]
68
82
  }