@minhluudev/ai-tools 1.0.13 → 1.0.15

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 CHANGED
@@ -19,8 +19,9 @@ Main menu:
19
19
  1. `Install agent skills`
20
20
  2. `Install project docs`
21
21
  3. `Install libs for AI`
22
- 4. `Install mcp`
23
- 5. `Cancel`
22
+ 4. `Install plugin`
23
+ 5. `Install mcp`
24
+ 6. `Cancel`
24
25
 
25
26
  Controls:
26
27
 
@@ -41,6 +42,13 @@ Controls:
41
42
  - runs the current upstream install flow for each selected library and prints safety notes when an upstream flow is broader than the selected agent or scope
42
43
  - for `ECC`, clones the upstream repo into a temporary directory and runs the documented repo-based setup flow for the selected agent, with warnings about the documented Claude plugin overlap
43
44
 
45
+ `Install plugin`
46
+ - opens a guided workflow with tabs for `Plugins`, `Agents`, `Mode`, and `Review`
47
+ - currently supports `Lumin`
48
+ - loads the plugin bundle from the repository `plugins` branch at runtime, so the main branch CLI can install it without vendoring the plugin files into `main`
49
+ - supports `Install` and `Uninstall`
50
+ - installs plugins in global mode only
51
+
44
52
  `Install mcp`
45
53
  - opens a guided workflow with tabs for `Select MCP`, `Agent`, `Mode`, and `Review`
46
54
  - supports `Ant Design`, `GitLab`, `GitHub`, `Figma`, and `Shadcn`
package/dist/src/cli.js CHANGED
@@ -6,10 +6,12 @@ import { detectExistingTargets, installPlannedItems, installProjectDocsItems, pl
6
6
  import { loadProjectDocsCatalog } from "./lib/project-docs-catalog.js";
7
7
  import { loadSelectionCatalog, resolveSelectionItems } from "./lib/selection-catalog.js";
8
8
  import { buildMcpInstallPlan, createMcpUninstallBackups, executeMcpInstallPlan, inspectMcpUninstallSafety, verifyMcpUninstallExecutionSafety } from "./lib/mcp.js";
9
+ import { buildPluginInstallPlan, executePluginInstallPlan } from "./lib/plugins.js";
9
10
  import { blessedConfirm } from "./lib/tui-utils.js";
10
11
  import { runAiLibsWizard } from "./lib/tui-ai-libs.js";
11
12
  import { runEntryMenu } from "./lib/tui-entry-menu.js";
12
13
  import { runMcpWizard } from "./lib/tui-mcp.js";
14
+ import { runPluginWizard } from "./lib/tui-plugins.js";
13
15
  import { runProjectDocsWizard } from "./lib/tui-project-docs.js";
14
16
  import { runTabbedWizard } from "./lib/tui-wizard.js";
15
17
  const ANSI = {
@@ -155,6 +157,14 @@ function printMcpInstallSelectionSummary(plan) {
155
157
  ["OS", plan.os === "mac" ? "MacOS" : "Linux"]
156
158
  ]);
157
159
  }
160
+ function printPluginInstallSelectionSummary(plan) {
161
+ printLabeledRows("Selected items", [
162
+ ["Mode", plan.mode],
163
+ ["Plugins", plan.plugins.length ? plan.plugins.join(", ") : "none"],
164
+ ["Agents", plan.agents.length ? plan.agents.join(", ") : "none"],
165
+ ["Source branch", plan.sourceBranch]
166
+ ]);
167
+ }
158
168
  export async function runCli() {
159
169
  while (true) {
160
170
  const entryAction = await runEntryMenu();
@@ -194,6 +204,41 @@ export async function runCli() {
194
204
  printBulletPanel(`Install complete (${plan.steps.length})`, plan.steps.map((step) => step.title), "success");
195
205
  return;
196
206
  }
207
+ if (entryAction === "install-plugin") {
208
+ const config = await loadPackageConfig();
209
+ const pluginResult = await runPluginWizard();
210
+ if ("backToMenu" in pluginResult) {
211
+ continue;
212
+ }
213
+ const plan = buildPluginInstallPlan({
214
+ mode: pluginResult.mode,
215
+ agents: pluginResult.agents,
216
+ plugins: pluginResult.plugins,
217
+ sourceBranch: config.github.pluginsBranch
218
+ });
219
+ printSectionHeader("Install plugin", pluginResult.mode === "install"
220
+ ? "Preparing plugin bundle from the dedicated plugins branch."
221
+ : "Preparing plugin removal using the dedicated plugins branch.");
222
+ printPluginInstallSelectionSummary(plan);
223
+ if (plan.notes.length > 0) {
224
+ printBulletPanel("Notes", plan.notes, "warning");
225
+ }
226
+ printBulletPanel(`Execution plan (${plan.steps.length})`, plan.steps.map((step) => `${step.title}: ${step.command}`), "muted");
227
+ const client = createGitHubClient(config.github);
228
+ printStatusLine(plan.mode === "install" ? "install" : "uninstall", plan.mode === "install"
229
+ ? "Running selected plugin installers..."
230
+ : "Running selected plugin uninstallers...");
231
+ await executePluginInstallPlan({
232
+ cwd: process.cwd(),
233
+ client,
234
+ plan,
235
+ onProgress(step) {
236
+ printStatusLine("run", `${step.title} -> ${step.command}`, "muted");
237
+ }
238
+ });
239
+ printBulletPanel(`${plan.mode === "install" ? "Install" : "Uninstall"} complete (${plan.steps.length})`, plan.steps.map((step) => step.title), "success");
240
+ return;
241
+ }
197
242
  if (entryAction === "install-mcp") {
198
243
  const mcpResult = await runMcpWizard();
199
244
  if ("backToMenu" in mcpResult) {
@@ -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")) {
@@ -19,6 +19,7 @@ export async function loadPackageConfig() {
19
19
  repo: aiTools.github.repo,
20
20
  defaultBranch: aiTools.github.defaultBranch || "main",
21
21
  skillsBranch: aiTools.github.skillsBranch || "skill-general",
22
+ pluginsBranch: aiTools.github.pluginsBranch || "plugins",
22
23
  manifestPath: aiTools.github.manifestPath || "ai-tools.catalog.json",
23
24
  excludeBranches: aiTools.github.excludeBranches || ["main", "master"]
24
25
  }
@@ -0,0 +1,155 @@
1
+ import { mkdtemp, rm } from "node:fs/promises";
2
+ import * as os from "node:os";
3
+ import * as path from "node:path";
4
+ import { spawn } from "node:child_process";
5
+ const LUMIN_PLUGIN_ENTRY = "plugins/lumin";
6
+ const LUMIN_MARKETPLACE_ENTRY = ".agents/plugins";
7
+ const LUMIN_TEMP_DIR_PREFIX = "ai-tools-plugin-lumin-";
8
+ function uniq(items) {
9
+ return [...new Set(items)];
10
+ }
11
+ function buildLuminSteps(input) {
12
+ const steps = [];
13
+ const notes = [
14
+ "Lumin is loaded from the repository's dedicated plugins branch at install time.",
15
+ "Lumin installs in global mode only through this CLI.",
16
+ "The plugin installs namespaced host skills and an instruction layer so Codex and Claude can apply Lumin skills by context."
17
+ ];
18
+ for (const agent of uniq(input.agents)) {
19
+ if (agent === "claude") {
20
+ steps.push({
21
+ id: `lumin-${input.mode}-claude`,
22
+ plugin: "lumin",
23
+ agent,
24
+ phase: input.mode,
25
+ title: `${input.mode === "install" ? "Install" : "Uninstall"} Lumin for Claude`,
26
+ description: `${input.mode === "install" ? "Install" : "Remove"} Lumin in the user's Claude home directories.`,
27
+ command: `sh plugins/lumin/scripts/${input.mode}-claude.sh --global`,
28
+ runner: input.mode === "install" ? "setup-lumin-claude" : "remove-lumin-claude",
29
+ });
30
+ continue;
31
+ }
32
+ steps.push({
33
+ id: `lumin-${input.mode}-codex`,
34
+ plugin: "lumin",
35
+ agent,
36
+ phase: input.mode,
37
+ title: `${input.mode === "install" ? "Install" : "Uninstall"} Lumin for Codex`,
38
+ description: `${input.mode === "install" ? "Install" : "Remove"} the Lumin Codex plugin and global auto skill surface in the user's home directory.`,
39
+ command: `sh plugins/lumin/scripts/${input.mode}-codex.sh`,
40
+ runner: input.mode === "install" ? "setup-lumin-codex" : "remove-lumin-codex"
41
+ });
42
+ }
43
+ if (steps.some((step) => step.agent === "codex")) {
44
+ notes.push("Codex registration, auto skills, and the Lumin instruction layer are installed under the user's home directory.");
45
+ }
46
+ if (steps.some((step) => step.agent === "claude")) {
47
+ notes.push("Claude install adds `/lumin:<skill>` commands and also installs `~/.agents/skills/lumin-*` for auto-apply behavior.");
48
+ }
49
+ return { steps, notes };
50
+ }
51
+ export function buildPluginInstallPlan(input) {
52
+ const plugins = uniq(input.plugins);
53
+ const agents = uniq(input.agents);
54
+ const steps = [];
55
+ const notes = [];
56
+ for (const plugin of plugins) {
57
+ if (plugin !== "lumin") {
58
+ continue;
59
+ }
60
+ const lumin = buildLuminSteps({
61
+ mode: input.mode,
62
+ agents
63
+ });
64
+ steps.push(...lumin.steps);
65
+ notes.push(...lumin.notes);
66
+ }
67
+ return {
68
+ mode: input.mode,
69
+ agents,
70
+ plugins,
71
+ sourceBranch: input.sourceBranch,
72
+ steps,
73
+ notes: uniq(notes)
74
+ };
75
+ }
76
+ async function prepareLuminPluginRepo(input) {
77
+ const archivePath = await input.client.getArchive({
78
+ branch: input.branch,
79
+ sha: "latest"
80
+ });
81
+ const tempRoot = await mkdtemp(path.join(os.tmpdir(), LUMIN_TEMP_DIR_PREFIX));
82
+ try {
83
+ const pluginRoot = await input.client.extractArchiveEntry({
84
+ archivePath,
85
+ entryPath: LUMIN_PLUGIN_ENTRY,
86
+ destinationDir: tempRoot
87
+ });
88
+ await input.client.extractArchiveEntry({
89
+ archivePath,
90
+ entryPath: LUMIN_MARKETPLACE_ENTRY,
91
+ destinationDir: tempRoot
92
+ });
93
+ return {
94
+ pluginRoot,
95
+ cleanup: async () => {
96
+ await rm(tempRoot, { recursive: true, force: true });
97
+ }
98
+ };
99
+ }
100
+ catch (error) {
101
+ await rm(tempRoot, { recursive: true, force: true });
102
+ throw error;
103
+ }
104
+ }
105
+ function runShellCommand(command, cwd) {
106
+ return new Promise((resolve, reject) => {
107
+ const child = spawn("/bin/sh", ["-lc", command], {
108
+ cwd,
109
+ stdio: "inherit"
110
+ });
111
+ child.on("error", reject);
112
+ child.on("close", (code) => {
113
+ if (code === 0) {
114
+ resolve();
115
+ return;
116
+ }
117
+ reject(new Error(`Command failed with exit code ${code}: ${command}`));
118
+ });
119
+ });
120
+ }
121
+ export async function executePluginInstallPlan(input) {
122
+ let luminRepo = null;
123
+ try {
124
+ for (const step of input.plan.steps) {
125
+ input.onProgress?.(step);
126
+ if (step.plugin !== "lumin") {
127
+ continue;
128
+ }
129
+ if (!luminRepo) {
130
+ luminRepo = await prepareLuminPluginRepo({
131
+ client: input.client,
132
+ branch: input.plan.sourceBranch
133
+ });
134
+ }
135
+ const scriptsDir = path.join(luminRepo.pluginRoot, "scripts");
136
+ const codexGlobalRoot = os.homedir();
137
+ if (step.runner === "setup-lumin-claude") {
138
+ await runShellCommand(`sh "${path.join(scriptsDir, "install-claude.sh")}" --global`, luminRepo.pluginRoot);
139
+ continue;
140
+ }
141
+ if (step.runner === "remove-lumin-claude") {
142
+ await runShellCommand(`sh "${path.join(scriptsDir, "uninstall-claude.sh")}" --global`, luminRepo.pluginRoot);
143
+ continue;
144
+ }
145
+ if (step.runner === "setup-lumin-codex") {
146
+ await runShellCommand(`sh "${path.join(scriptsDir, "install-codex.sh")}"`, codexGlobalRoot);
147
+ continue;
148
+ }
149
+ await runShellCommand(`sh "${path.join(scriptsDir, "uninstall-codex.sh")}"`, codexGlobalRoot);
150
+ }
151
+ }
152
+ finally {
153
+ await luminRepo?.cleanup();
154
+ }
155
+ }
@@ -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" },
@@ -19,6 +19,12 @@ const MENU_ITEMS = [
19
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-plugin",
24
+ label: "◉ Install plugin",
25
+ description: "Install or remove shared plugins such as Lumin for Codex and Claude.",
26
+ meta: "Codex + Claude"
27
+ },
22
28
  {
23
29
  id: "install-mcp",
24
30
  label: "◎ Install MCP",
@@ -0,0 +1,408 @@
1
+ import { buildPluginInstallPlan } from "./plugins.js";
2
+ import { canRun, createTabbedLayout, DEBOUNCE_MOVE_MS, DEBOUNCE_SELECT_MS, renderBannerHeader, renderKeycaps, renderListContent, renderListRow, renderStepSummary, renderTabBar, selectionArray } from "./tui-utils.js";
3
+ const TAB_ORDER = ["plugins", "agents", "mode", "review"];
4
+ function buildInitialState() {
5
+ return {
6
+ activeTab: "plugins",
7
+ selectedPlugins: new Set(),
8
+ selectedAgents: new Set(),
9
+ selectedMode: "install",
10
+ listCursor: {
11
+ plugins: 0,
12
+ agents: 0,
13
+ mode: 0,
14
+ review: 0
15
+ },
16
+ reviewAction: "confirm",
17
+ notice: ""
18
+ };
19
+ }
20
+ function currentTabItems(state) {
21
+ if (state.activeTab === "plugins") {
22
+ return [{
23
+ id: "lumin",
24
+ label: "◈ Lumin",
25
+ description: "Cross-harness skill plugin for Codex and Claude with explicit commands and auto-apply skill surfaces.",
26
+ kind: "plugin"
27
+ }];
28
+ }
29
+ if (state.activeTab === "agents") {
30
+ return [
31
+ {
32
+ id: "codex",
33
+ label: "◇ Codex",
34
+ description: "Install the Codex-side plugin and global auto skill surface in the user home directory.",
35
+ kind: "agents"
36
+ },
37
+ {
38
+ id: "claude",
39
+ label: "◇ Claude",
40
+ description: "Install Claude slash commands and namespaced host skills in the user home directory.",
41
+ kind: "agents"
42
+ }
43
+ ];
44
+ }
45
+ if (state.activeTab === "mode") {
46
+ return [
47
+ {
48
+ id: "install",
49
+ label: "▶ Install",
50
+ description: "Install the selected plugins.",
51
+ kind: "mode"
52
+ },
53
+ {
54
+ id: "uninstall",
55
+ label: "← Uninstall",
56
+ description: "Remove the selected plugins safely.",
57
+ kind: "mode"
58
+ }
59
+ ];
60
+ }
61
+ return [
62
+ {
63
+ id: "confirm",
64
+ label: `✓ Confirm ${state.selectedMode}`,
65
+ description: "Run the planned plugin actions.",
66
+ kind: "review"
67
+ },
68
+ {
69
+ id: "back",
70
+ label: "← Back to main menu",
71
+ description: "Leave this installer and return to the main menu.",
72
+ kind: "review"
73
+ },
74
+ {
75
+ id: "cancel",
76
+ label: "✕ Cancel",
77
+ description: "Exit without changing plugins.",
78
+ kind: "review"
79
+ }
80
+ ];
81
+ }
82
+ function isItemSelected(item, state) {
83
+ if (item.kind === "plugin") {
84
+ return state.selectedPlugins.has(item.id);
85
+ }
86
+ if (item.kind === "agents") {
87
+ return state.selectedAgents.has(item.id);
88
+ }
89
+ if (item.kind === "mode") {
90
+ return state.selectedMode === item.id;
91
+ }
92
+ return state.reviewAction === item.id;
93
+ }
94
+ function toggleItem(item, state) {
95
+ if (item.kind === "plugin") {
96
+ if (state.selectedPlugins.has(item.id)) {
97
+ state.selectedPlugins.delete(item.id);
98
+ }
99
+ else {
100
+ state.selectedPlugins.add(item.id);
101
+ }
102
+ return;
103
+ }
104
+ if (item.kind === "agents") {
105
+ const agent = item.id;
106
+ if (state.selectedAgents.has(agent)) {
107
+ state.selectedAgents.delete(agent);
108
+ }
109
+ else {
110
+ state.selectedAgents.add(agent);
111
+ }
112
+ return;
113
+ }
114
+ if (item.kind === "mode") {
115
+ state.selectedMode = item.id;
116
+ return;
117
+ }
118
+ state.reviewAction = item.id;
119
+ }
120
+ function renderTabs(state) {
121
+ const counts = {
122
+ plugins: state.selectedPlugins.size,
123
+ agents: state.selectedAgents.size,
124
+ mode: 1,
125
+ review: state.reviewAction === "confirm" ? 1 : 0
126
+ };
127
+ return renderTabBar(TAB_ORDER.map((tab, index) => ({
128
+ label: `${index + 1}. ${tab.charAt(0).toUpperCase() + tab.slice(1)}`,
129
+ meta: tab === "review" ? "ready" : `${counts[tab]} selected`,
130
+ active: state.activeTab === tab
131
+ })));
132
+ }
133
+ function formatListItem(item, state, isCursorRow, index) {
134
+ if (item.kind === "review") {
135
+ return renderListRow({
136
+ active: isCursorRow,
137
+ selected: state.reviewAction === item.id,
138
+ label: item.label,
139
+ index
140
+ });
141
+ }
142
+ return renderListRow({
143
+ active: isCursorRow,
144
+ selected: isItemSelected(item, state),
145
+ label: item.label,
146
+ index
147
+ });
148
+ }
149
+ function renderReviewSummary(state) {
150
+ const selectedPlugins = selectionArray(state.selectedPlugins);
151
+ const selectedAgents = selectionArray(state.selectedAgents);
152
+ const sep = `{cyan-fg}${"─".repeat(50)}{/cyan-fg}`;
153
+ const none = "{gray-fg}none{/gray-fg}";
154
+ const lines = [
155
+ `{bold}{white-fg}◈ Summary{/white-fg}{/bold}`,
156
+ sep,
157
+ `{cyan-fg}◆ Plugins{/cyan-fg} ${selectedPlugins.length ? selectedPlugins.join(", ") : none}`,
158
+ `{cyan-fg}◆ Agents{/cyan-fg} ${selectedAgents.length ? selectedAgents.join(", ") : none}`,
159
+ `{cyan-fg}◆ Install{/cyan-fg} global`,
160
+ `{cyan-fg}◆ Mode{/cyan-fg} ${state.selectedMode}`
161
+ ];
162
+ if (selectedPlugins.length > 0 && selectedAgents.length > 0) {
163
+ try {
164
+ const plan = buildPluginInstallPlan({
165
+ mode: state.selectedMode,
166
+ agents: selectedAgents,
167
+ plugins: selectedPlugins,
168
+ sourceBranch: "plugins"
169
+ });
170
+ lines.push("", sep, `{bold}{white-fg}⊕ Planned steps{/white-fg}{/bold}`);
171
+ for (const step of plan.steps) {
172
+ lines.push(` {gray-fg}▶{/gray-fg} ${step.title}`);
173
+ }
174
+ if (plan.notes.length > 0) {
175
+ lines.push("", `{bold}{white-fg}◎ Notes{/white-fg}{/bold}`);
176
+ for (const note of plan.notes) {
177
+ lines.push(` {gray-fg}·{/gray-fg} ${note}`);
178
+ }
179
+ }
180
+ }
181
+ catch (error) {
182
+ const message = error instanceof Error ? error.message : String(error);
183
+ lines.push("", `{yellow-fg}${message}{/yellow-fg}`);
184
+ }
185
+ }
186
+ if (state.notice) {
187
+ lines.push("", `{yellow-fg}${state.notice}{/yellow-fg}`);
188
+ }
189
+ return lines.join("\n");
190
+ }
191
+ function renderDetailBody(state) {
192
+ if (state.activeTab === "review") {
193
+ return renderReviewSummary(state);
194
+ }
195
+ const items = currentTabItems(state);
196
+ const current = items[state.listCursor[state.activeTab]];
197
+ const lines = [];
198
+ if (state.notice) {
199
+ lines.push(`{yellow-fg}${state.notice}{/yellow-fg}`, "");
200
+ }
201
+ if (current) {
202
+ const selectedCount = items.filter((item) => isItemSelected(item, state)).length;
203
+ 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}`);
204
+ }
205
+ return lines.join("\n");
206
+ }
207
+ function renderFooter(state) {
208
+ if (state.activeTab === "review") {
209
+ return renderKeycaps([
210
+ { key: "LEFT/RIGHT", label: "switch tab" },
211
+ { key: "UP/DOWN", label: "move" },
212
+ { key: "ENTER", label: "confirm action" },
213
+ { key: "Q", label: "quit" }
214
+ ]);
215
+ }
216
+ return renderKeycaps([
217
+ { key: "LEFT/RIGHT", label: "switch tab" },
218
+ { key: "UP/DOWN", label: "move" },
219
+ { key: "SPACE", label: "toggle" },
220
+ { key: "A", label: "toggle all" },
221
+ { key: "Q", label: "quit" }
222
+ ]);
223
+ }
224
+ function setNotice(state, message) {
225
+ state.notice = message;
226
+ }
227
+ function moveTab(state, delta) {
228
+ const index = TAB_ORDER.indexOf(state.activeTab);
229
+ const nextIndex = (index + delta + TAB_ORDER.length) % TAB_ORDER.length;
230
+ state.activeTab = TAB_ORDER[nextIndex];
231
+ state.notice = "";
232
+ }
233
+ function moveCursor(state, delta) {
234
+ const items = currentTabItems(state);
235
+ if (items.length === 0) {
236
+ return;
237
+ }
238
+ const current = state.listCursor[state.activeTab];
239
+ const next = (current + delta + items.length) % items.length;
240
+ state.listCursor[state.activeTab] = next;
241
+ if (state.activeTab === "review") {
242
+ state.reviewAction = items[next]?.id;
243
+ }
244
+ }
245
+ function toggleCurrentItem(state) {
246
+ if (state.activeTab === "review") {
247
+ return;
248
+ }
249
+ const items = currentTabItems(state);
250
+ const current = items[state.listCursor[state.activeTab]];
251
+ if (!current) {
252
+ return;
253
+ }
254
+ toggleItem(current, state);
255
+ }
256
+ function toggleAllItems(state) {
257
+ if (state.activeTab !== "plugins" && state.activeTab !== "agents") {
258
+ return;
259
+ }
260
+ const items = currentTabItems(state);
261
+ if (state.activeTab === "plugins") {
262
+ const allSelected = items.every((item) => state.selectedPlugins.has(item.id));
263
+ state.selectedPlugins.clear();
264
+ if (!allSelected) {
265
+ for (const item of items) {
266
+ state.selectedPlugins.add(item.id);
267
+ }
268
+ }
269
+ return;
270
+ }
271
+ const allSelected = items.every((item) => state.selectedAgents.has(item.id));
272
+ state.selectedAgents.clear();
273
+ if (!allSelected) {
274
+ for (const item of items) {
275
+ state.selectedAgents.add(item.id);
276
+ }
277
+ }
278
+ }
279
+ function validateReview(state) {
280
+ if (state.reviewAction !== "confirm") {
281
+ return state.reviewAction;
282
+ }
283
+ if (state.selectedPlugins.size === 0) {
284
+ setNotice(state, "Select at least one plugin before continuing.");
285
+ return null;
286
+ }
287
+ if (state.selectedAgents.size === 0) {
288
+ setNotice(state, "Select at least one agent before continuing.");
289
+ return null;
290
+ }
291
+ return "confirm";
292
+ }
293
+ export async function runPluginWizard() {
294
+ const state = buildInitialState();
295
+ const { screen, headerBox, tabsBox, titleBox, listBox, detailBox, footerBox } = createTabbedLayout();
296
+ let lastMoveAt = 0;
297
+ let lastSelectAt = 0;
298
+ return await new Promise((resolve) => {
299
+ function cleanup() {
300
+ screen.destroy();
301
+ }
302
+ function render() {
303
+ const items = currentTabItems(state);
304
+ const cursor = state.listCursor[state.activeTab];
305
+ const detail = renderDetailBody(state);
306
+ const renderedItems = items.map((item, index) => formatListItem(item, state, index === cursor, index));
307
+ headerBox.setContent(renderBannerHeader("Install plugin", "Install or remove shared plugins such as Lumin.", [
308
+ { label: `${state.selectedPlugins.size} plugins`, tone: "accent" },
309
+ { label: `${state.selectedAgents.size} agents`, tone: "muted" },
310
+ { label: `${state.selectedMode}`, tone: "success" }
311
+ ]));
312
+ tabsBox.setContent(renderTabs(state));
313
+ titleBox.setContent(renderStepSummary({
314
+ step: `${TAB_ORDER.indexOf(state.activeTab) + 1}/${TAB_ORDER.length}`,
315
+ title: state.activeTab === "review" ? "Review" : "Details",
316
+ description: "Choose plugin options and confirm the execution plan."
317
+ }));
318
+ renderListContent(listBox, renderedItems, cursor);
319
+ detailBox.setContent(detail);
320
+ footerBox.setContent(renderFooter(state));
321
+ screen.render();
322
+ }
323
+ screen.key(["left"], () => {
324
+ if (!canRun(lastMoveAt, DEBOUNCE_MOVE_MS)) {
325
+ return;
326
+ }
327
+ lastMoveAt = Date.now();
328
+ moveTab(state, -1);
329
+ render();
330
+ });
331
+ screen.key(["right"], () => {
332
+ if (!canRun(lastMoveAt, DEBOUNCE_MOVE_MS)) {
333
+ return;
334
+ }
335
+ lastMoveAt = Date.now();
336
+ moveTab(state, 1);
337
+ render();
338
+ });
339
+ screen.key(["up"], () => {
340
+ if (!canRun(lastMoveAt, DEBOUNCE_MOVE_MS)) {
341
+ return;
342
+ }
343
+ lastMoveAt = Date.now();
344
+ moveCursor(state, -1);
345
+ render();
346
+ });
347
+ screen.key(["down"], () => {
348
+ if (!canRun(lastMoveAt, DEBOUNCE_MOVE_MS)) {
349
+ return;
350
+ }
351
+ lastMoveAt = Date.now();
352
+ moveCursor(state, 1);
353
+ render();
354
+ });
355
+ screen.key(["space"], () => {
356
+ if (!canRun(lastSelectAt, DEBOUNCE_SELECT_MS)) {
357
+ return;
358
+ }
359
+ lastSelectAt = Date.now();
360
+ toggleCurrentItem(state);
361
+ render();
362
+ });
363
+ screen.key(["a"], () => {
364
+ if (!canRun(lastSelectAt, DEBOUNCE_SELECT_MS)) {
365
+ return;
366
+ }
367
+ lastSelectAt = Date.now();
368
+ toggleAllItems(state);
369
+ render();
370
+ });
371
+ screen.key(["enter"], () => {
372
+ if (!canRun(lastSelectAt, DEBOUNCE_SELECT_MS)) {
373
+ return;
374
+ }
375
+ lastSelectAt = Date.now();
376
+ if (state.activeTab !== "review") {
377
+ moveTab(state, 1);
378
+ render();
379
+ return;
380
+ }
381
+ const action = validateReview(state);
382
+ if (!action) {
383
+ render();
384
+ return;
385
+ }
386
+ cleanup();
387
+ if (action === "back") {
388
+ resolve({ backToMenu: true });
389
+ return;
390
+ }
391
+ if (action === "cancel") {
392
+ process.exitCode = 1;
393
+ resolve({ backToMenu: true });
394
+ return;
395
+ }
396
+ resolve({
397
+ plugins: selectionArray(state.selectedPlugins),
398
+ agents: selectionArray(state.selectedAgents),
399
+ mode: state.selectedMode
400
+ });
401
+ });
402
+ screen.key(["q", "escape", "C-c"], () => {
403
+ cleanup();
404
+ resolve({ backToMenu: true });
405
+ });
406
+ render();
407
+ });
408
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minhluudev/ai-tools",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "CLI to install AI skills from GitHub branches into Codex and Claude.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,6 +45,7 @@
45
45
  "repo": "ai-tools",
46
46
  "defaultBranch": "main",
47
47
  "skillsBranch": "skill-general",
48
+ "pluginsBranch": "plugins",
48
49
  "manifestPath": "ai-tools.catalog.json",
49
50
  "excludeBranches": [
50
51
  "main",
@@ -63,6 +63,13 @@
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"
66
73
  }
67
74
  ]
68
75
  }