@within-7/minto 0.3.9 → 0.3.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.
Files changed (141) hide show
  1. package/dist/commands/agents/AgentsCommand.js +459 -655
  2. package/dist/commands/agents/AgentsCommand.js.map +2 -2
  3. package/dist/commands/agents/types.js +1 -0
  4. package/dist/commands/agents/types.js.map +2 -2
  5. package/dist/commands/agents/utils/fileOperations.js +96 -36
  6. package/dist/commands/agents/utils/fileOperations.js.map +3 -3
  7. package/dist/commands/agents/utils/index.js +3 -1
  8. package/dist/commands/agents/utils/index.js.map +2 -2
  9. package/dist/commands/context.js +54 -23
  10. package/dist/commands/context.js.map +2 -2
  11. package/dist/commands/export.js +673 -93
  12. package/dist/commands/export.js.map +2 -2
  13. package/dist/commands/language.js +19 -46
  14. package/dist/commands/language.js.map +2 -2
  15. package/dist/commands/mcp-interactive.js +419 -217
  16. package/dist/commands/mcp-interactive.js.map +2 -2
  17. package/dist/commands/model.js +415 -66
  18. package/dist/commands/model.js.map +2 -2
  19. package/dist/commands/permissions.js +75 -49
  20. package/dist/commands/permissions.js.map +2 -2
  21. package/dist/commands/plugin.js +882 -185
  22. package/dist/commands/plugin.js.map +3 -3
  23. package/dist/commands/resume.js +1 -1
  24. package/dist/commands/resume.js.map +1 -1
  25. package/dist/commands/sandbox.js +168 -70
  26. package/dist/commands/sandbox.js.map +2 -2
  27. package/dist/commands/setup.js +593 -107
  28. package/dist/commands/setup.js.map +2 -2
  29. package/dist/commands/stats.js +188 -131
  30. package/dist/commands/stats.js.map +2 -2
  31. package/dist/commands/status.js +75 -13
  32. package/dist/commands/status.js.map +2 -2
  33. package/dist/commands/undo.js +138 -174
  34. package/dist/commands/undo.js.map +2 -2
  35. package/dist/commands.js.map +1 -1
  36. package/dist/components/Help.js +165 -32
  37. package/dist/components/Help.js.map +2 -2
  38. package/dist/components/InfoPanel/InfoPanel.js +123 -0
  39. package/dist/components/InfoPanel/InfoPanel.js.map +7 -0
  40. package/dist/components/InfoPanel/index.js +5 -0
  41. package/dist/components/InfoPanel/index.js.map +7 -0
  42. package/dist/components/InfoPanel/types.js +1 -0
  43. package/dist/components/InfoPanel/types.js.map +7 -0
  44. package/dist/components/ModelSelector/BrandTextInput.js +43 -0
  45. package/dist/components/ModelSelector/BrandTextInput.js.map +7 -0
  46. package/dist/components/ModelSelector/ModelSelector.js +419 -501
  47. package/dist/components/ModelSelector/ModelSelector.js.map +2 -2
  48. package/dist/components/ModelSelector/WizardContainer.js +45 -0
  49. package/dist/components/ModelSelector/WizardContainer.js.map +7 -0
  50. package/dist/components/ModelSelector/index.js +1 -3
  51. package/dist/components/ModelSelector/index.js.map +2 -2
  52. package/dist/components/PromptInput.js +5 -5
  53. package/dist/components/PromptInput.js.map +2 -2
  54. package/dist/components/SimpleSelector/SimpleSelector.js +154 -0
  55. package/dist/components/SimpleSelector/SimpleSelector.js.map +7 -0
  56. package/dist/components/SimpleSelector/index.js +5 -0
  57. package/dist/components/SimpleSelector/index.js.map +7 -0
  58. package/dist/components/SimpleSelector/types.js +1 -0
  59. package/dist/components/SimpleSelector/types.js.map +7 -0
  60. package/dist/components/StatusOverlayContent.js +21 -0
  61. package/dist/components/StatusOverlayContent.js.map +7 -0
  62. package/dist/components/TabbedListView/ScrollableList.js +31 -5
  63. package/dist/components/TabbedListView/ScrollableList.js.map +2 -2
  64. package/dist/components/TabbedListView/TabbedListView.js +122 -47
  65. package/dist/components/TabbedListView/TabbedListView.js.map +2 -2
  66. package/dist/core/backupHook.js +29 -0
  67. package/dist/core/backupHook.js.map +7 -0
  68. package/dist/core/config/defaults.js +8 -2
  69. package/dist/core/config/defaults.js.map +2 -2
  70. package/dist/core/config/schema.js +14 -2
  71. package/dist/core/config/schema.js.map +2 -2
  72. package/dist/core/costTracker.js +0 -16
  73. package/dist/core/costTracker.js.map +2 -2
  74. package/dist/cost-tracker.js +0 -16
  75. package/dist/cost-tracker.js.map +2 -2
  76. package/dist/entrypoints/bootstrap.js +3 -1
  77. package/dist/entrypoints/bootstrap.js.map +2 -2
  78. package/dist/entrypoints/cli.js +32 -0
  79. package/dist/entrypoints/cli.js.map +2 -2
  80. package/dist/i18n/locales/en.js +300 -1
  81. package/dist/i18n/locales/en.js.map +2 -2
  82. package/dist/i18n/locales/zh-CN.js +301 -2
  83. package/dist/i18n/locales/zh-CN.js.map +2 -2
  84. package/dist/i18n/types.js.map +1 -1
  85. package/dist/services/customCommands.js +30 -8
  86. package/dist/services/customCommands.js.map +2 -2
  87. package/dist/services/plugins/lspServers.js +1 -1
  88. package/dist/services/plugins/lspServers.js.map +2 -2
  89. package/dist/services/plugins/pluginRuntime.js +2 -1
  90. package/dist/services/plugins/pluginRuntime.js.map +2 -2
  91. package/dist/services/plugins/pluginValidation.js +10 -3
  92. package/dist/services/plugins/pluginValidation.js.map +2 -2
  93. package/dist/services/plugins/skillMarketplace.js +16 -8
  94. package/dist/services/plugins/skillMarketplace.js.map +2 -2
  95. package/dist/services/systemReminder.js +17 -6
  96. package/dist/services/systemReminder.js.map +2 -2
  97. package/dist/tools/FileEditTool/FileEditTool.js +7 -0
  98. package/dist/tools/FileEditTool/FileEditTool.js.map +2 -2
  99. package/dist/tools/FileWriteTool/FileWriteTool.js +7 -0
  100. package/dist/tools/FileWriteTool/FileWriteTool.js.map +2 -2
  101. package/dist/tools/MultiEditTool/MultiEditTool.js +7 -0
  102. package/dist/tools/MultiEditTool/MultiEditTool.js.map +2 -2
  103. package/dist/tools/NotebookEditTool/NotebookEditTool.js +2 -0
  104. package/dist/tools/NotebookEditTool/NotebookEditTool.js.map +2 -2
  105. package/dist/tools/TaskTool/TaskTool.js +9 -6
  106. package/dist/tools/TaskTool/TaskTool.js.map +2 -2
  107. package/dist/types/PermissionMode.js.map +1 -1
  108. package/dist/types/plugin.js +2 -4
  109. package/dist/types/plugin.js.map +2 -2
  110. package/dist/utils/agentHookExecutor.js +1 -4
  111. package/dist/utils/agentHookExecutor.js.map +2 -2
  112. package/dist/utils/agentLoader.js +67 -13
  113. package/dist/utils/agentLoader.js.map +2 -2
  114. package/dist/utils/agentMemory.js.map +2 -2
  115. package/dist/utils/claudeCodeSync.js +439 -0
  116. package/dist/utils/claudeCodeSync.js.map +7 -0
  117. package/dist/utils/config.js +1 -23
  118. package/dist/utils/config.js.map +2 -2
  119. package/dist/utils/execFileNoThrow.js +2 -1
  120. package/dist/utils/execFileNoThrow.js.map +2 -2
  121. package/dist/utils/marketplaceManager.js +80 -43
  122. package/dist/utils/marketplaceManager.js.map +2 -2
  123. package/dist/utils/messages.js +2 -2
  124. package/dist/utils/messages.js.map +2 -2
  125. package/dist/utils/pluginInstaller.js +34 -24
  126. package/dist/utils/pluginInstaller.js.map +2 -2
  127. package/dist/utils/pluginLoader.js +48 -25
  128. package/dist/utils/pluginLoader.js.map +2 -2
  129. package/dist/utils/repoFetcher.js +110 -0
  130. package/dist/utils/repoFetcher.js.map +7 -0
  131. package/dist/utils/skillLoader.js +18 -6
  132. package/dist/utils/skillLoader.js.map +2 -2
  133. package/dist/utils/stringSubstitution.js +4 -5
  134. package/dist/utils/stringSubstitution.js.map +2 -2
  135. package/dist/utils/teamConfig.js +153 -13
  136. package/dist/utils/teamConfig.js.map +2 -2
  137. package/dist/utils/terminal.js +1 -1
  138. package/dist/utils/terminal.js.map +2 -2
  139. package/dist/version.js +2 -2
  140. package/dist/version.js.map +1 -1
  141. package/package.json +6 -6
@@ -1,7 +1,11 @@
1
- import React from "react";
1
+ import React, { useState, useCallback, useMemo } from "react";
2
2
  import { Text, Box } from "ink";
3
+ import { join } from "path";
4
+ import { homedir } from "os";
3
5
  import { SimpleSpinner } from "../components/Spinner.js";
4
- import { SEMANTIC_COLORS } from "../constants/colors.js";
6
+ import { t } from "../i18n/index.js";
7
+ import { getCwd } from "../utils/state.js";
8
+ import { TabbedListView } from "../components/TabbedListView/TabbedListView.js";
5
9
  import {
6
10
  fetchTeamConfig,
7
11
  loadTeamConfigFromFile,
@@ -10,128 +14,607 @@ import {
10
14
  installPlugins,
11
15
  installRemoteAgents,
12
16
  installInlineAgents,
13
- installTeamHooks
17
+ installTeamHooks,
18
+ installInlineSkills,
19
+ installInlineCommands
14
20
  } from "../utils/teamConfig.js";
21
+ function countHooks(hooks) {
22
+ if (!hooks) return 0;
23
+ return (hooks.sessionStart?.length || 0) + (hooks.sessionEnd?.length || 0) + (hooks.userPromptSubmit?.length || 0) + (hooks.preToolUse?.length || 0) + (hooks.postToolUse?.length || 0);
24
+ }
25
+ function buildTabs(config) {
26
+ const tabs = [
27
+ { id: "overview", label: t("commands.setup.tabOverview") }
28
+ ];
29
+ if (config.models?.profiles && config.models.profiles.length > 0) {
30
+ tabs.push({
31
+ id: "models",
32
+ label: t("commands.setup.tabModels"),
33
+ badge: config.models.profiles.length
34
+ });
35
+ }
36
+ if (config.mcpServers && Object.keys(config.mcpServers).length > 0) {
37
+ tabs.push({
38
+ id: "mcp",
39
+ label: t("commands.setup.tabMcp"),
40
+ badge: Object.keys(config.mcpServers).length
41
+ });
42
+ }
43
+ const pluginCount = (config.plugins?.install?.length || 0) + (config.plugins?.userInstall?.length || 0) + (config.plugins?.projectInstall?.length || 0) + (config.plugins?.marketplaces?.length || 0);
44
+ if (pluginCount > 0) {
45
+ tabs.push({
46
+ id: "plugins",
47
+ label: t("commands.setup.tabPlugins"),
48
+ badge: pluginCount
49
+ });
50
+ }
51
+ const agentCount = (config.agents?.remoteAgents?.length || 0) + (config.agents?.inlineAgents?.length || 0) + (config.agents?.userAgents?.length || 0) + (config.agents?.projectAgents?.length || 0);
52
+ if (agentCount > 0) {
53
+ tabs.push({
54
+ id: "agents",
55
+ label: t("commands.setup.tabAgents"),
56
+ badge: agentCount
57
+ });
58
+ }
59
+ const skillCount = (config.skills?.userSkills?.length || 0) + (config.skills?.projectSkills?.length || 0);
60
+ if (skillCount > 0) {
61
+ tabs.push({
62
+ id: "skills",
63
+ label: t("commands.setup.tabSkills"),
64
+ badge: skillCount
65
+ });
66
+ }
67
+ const commandCount = (config.commands?.userCommands?.length || 0) + (config.commands?.projectCommands?.length || 0);
68
+ if (commandCount > 0) {
69
+ tabs.push({
70
+ id: "commands",
71
+ label: t("commands.setup.tabCommands"),
72
+ badge: commandCount
73
+ });
74
+ }
75
+ const hookCount = countHooks(config.hooks) + countHooks(config.projectHooks);
76
+ if (hookCount > 0) {
77
+ tabs.push({
78
+ id: "hooks",
79
+ label: t("commands.setup.tabHooks"),
80
+ badge: hookCount
81
+ });
82
+ }
83
+ if (config.settings && Object.keys(config.settings).length > 0) {
84
+ tabs.push({
85
+ id: "settings",
86
+ label: t("commands.setup.tabSettings"),
87
+ badge: Object.keys(config.settings).length
88
+ });
89
+ }
90
+ return tabs;
91
+ }
92
+ function buildItems(tabId, config) {
93
+ switch (tabId) {
94
+ case "overview": {
95
+ const items = [
96
+ {
97
+ id: "name",
98
+ label: config.name || "Team Configuration",
99
+ description: config.description,
100
+ category: "Info"
101
+ }
102
+ ];
103
+ if (config.scope) {
104
+ items.push({
105
+ id: "overview-scope",
106
+ label: `Scope: ${config.scope}`,
107
+ category: "Info"
108
+ });
109
+ }
110
+ const modelCount = config.models?.profiles?.length || 0;
111
+ if (modelCount > 0) {
112
+ items.push({
113
+ id: "overview-models",
114
+ label: `${modelCount} model profile${modelCount !== 1 ? "s" : ""}`,
115
+ category: "Summary"
116
+ });
117
+ }
118
+ const mcpCount = config.mcpServers ? Object.keys(config.mcpServers).length : 0;
119
+ if (mcpCount > 0) {
120
+ items.push({
121
+ id: "overview-mcp",
122
+ label: `${mcpCount} MCP server${mcpCount !== 1 ? "s" : ""}`,
123
+ category: "Summary"
124
+ });
125
+ }
126
+ const pluginCount = (config.plugins?.install?.length || 0) + (config.plugins?.userInstall?.length || 0) + (config.plugins?.projectInstall?.length || 0);
127
+ if (pluginCount > 0) {
128
+ items.push({
129
+ id: "overview-plugins",
130
+ label: `${pluginCount} plugin${pluginCount !== 1 ? "s" : ""}`,
131
+ category: "Summary"
132
+ });
133
+ }
134
+ const agentCount = (config.agents?.remoteAgents?.length || 0) + (config.agents?.inlineAgents?.length || 0) + (config.agents?.userAgents?.length || 0) + (config.agents?.projectAgents?.length || 0);
135
+ if (agentCount > 0) {
136
+ items.push({
137
+ id: "overview-agents",
138
+ label: `${agentCount} agent${agentCount !== 1 ? "s" : ""}`,
139
+ category: "Summary"
140
+ });
141
+ }
142
+ const skillCount = (config.skills?.userSkills?.length || 0) + (config.skills?.projectSkills?.length || 0);
143
+ if (skillCount > 0) {
144
+ items.push({
145
+ id: "overview-skills",
146
+ label: `${skillCount} skill${skillCount !== 1 ? "s" : ""}`,
147
+ category: "Summary"
148
+ });
149
+ }
150
+ const commandCount = (config.commands?.userCommands?.length || 0) + (config.commands?.projectCommands?.length || 0);
151
+ if (commandCount > 0) {
152
+ items.push({
153
+ id: "overview-commands",
154
+ label: `${commandCount} command${commandCount !== 1 ? "s" : ""}`,
155
+ category: "Summary"
156
+ });
157
+ }
158
+ return items;
159
+ }
160
+ case "models":
161
+ return (config.models?.profiles || []).map((p, i) => ({
162
+ id: `model-${i}`,
163
+ label: p.name,
164
+ description: `${p.provider} / ${p.modelName}`,
165
+ status: p.isActive ? "enabled" : "disabled"
166
+ }));
167
+ case "mcp":
168
+ return Object.entries(config.mcpServers || {}).map(([name, server]) => ({
169
+ id: `mcp-${name}`,
170
+ label: name,
171
+ description: server.type === "sse" ? `SSE: ${server.url}` : `stdio: ${server.command}`,
172
+ status: server.enabled !== false ? "enabled" : "disabled"
173
+ }));
174
+ case "plugins": {
175
+ const items = [];
176
+ for (const mp of config.plugins?.marketplaces || []) {
177
+ items.push({
178
+ id: `mp-${mp}`,
179
+ label: mp,
180
+ description: "Marketplace source",
181
+ category: "Marketplaces"
182
+ });
183
+ }
184
+ for (const p of config.plugins?.install || []) {
185
+ items.push({
186
+ id: `plugin-${p}`,
187
+ label: p,
188
+ description: "Plugin \u2192 User",
189
+ category: "User"
190
+ });
191
+ }
192
+ for (const p of config.plugins?.userInstall || []) {
193
+ items.push({
194
+ id: `plugin-user-${p}`,
195
+ label: p,
196
+ description: "Plugin \u2192 User",
197
+ category: "User"
198
+ });
199
+ }
200
+ for (const p of config.plugins?.projectInstall || []) {
201
+ items.push({
202
+ id: `plugin-project-${p}`,
203
+ label: p,
204
+ description: "Plugin \u2192 Project",
205
+ category: "Project"
206
+ });
207
+ }
208
+ return items;
209
+ }
210
+ case "agents": {
211
+ const items = [];
212
+ for (const a of config.agents?.remoteAgents || []) {
213
+ items.push({
214
+ id: `remote-agent-${a}`,
215
+ label: a,
216
+ description: "Remote agent URL",
217
+ category: "Remote"
218
+ });
219
+ }
220
+ for (const a of config.agents?.inlineAgents || []) {
221
+ items.push({
222
+ id: `inline-agent-${a.name}`,
223
+ label: a.name,
224
+ description: a.description,
225
+ category: "User"
226
+ });
227
+ }
228
+ for (const a of config.agents?.userAgents || []) {
229
+ items.push({
230
+ id: `user-agent-${a.name}`,
231
+ label: a.name,
232
+ description: a.description,
233
+ category: "User"
234
+ });
235
+ }
236
+ for (const a of config.agents?.projectAgents || []) {
237
+ items.push({
238
+ id: `project-agent-${a.name}`,
239
+ label: a.name,
240
+ description: a.description,
241
+ category: "Project"
242
+ });
243
+ }
244
+ return items;
245
+ }
246
+ case "skills": {
247
+ const items = [];
248
+ for (const s of config.skills?.userSkills || []) {
249
+ items.push({
250
+ id: `skill-user-${s.name}`,
251
+ label: s.name,
252
+ description: s.description,
253
+ category: "User"
254
+ });
255
+ }
256
+ for (const s of config.skills?.projectSkills || []) {
257
+ items.push({
258
+ id: `skill-project-${s.name}`,
259
+ label: s.name,
260
+ description: s.description,
261
+ category: "Project"
262
+ });
263
+ }
264
+ return items;
265
+ }
266
+ case "commands": {
267
+ const items = [];
268
+ for (const c of config.commands?.userCommands || []) {
269
+ items.push({
270
+ id: `cmd-user-${c.name}`,
271
+ label: c.name,
272
+ description: c.description,
273
+ category: "User"
274
+ });
275
+ }
276
+ for (const c of config.commands?.projectCommands || []) {
277
+ items.push({
278
+ id: `cmd-project-${c.name}`,
279
+ label: c.name,
280
+ description: c.description,
281
+ category: "Project"
282
+ });
283
+ }
284
+ return items;
285
+ }
286
+ case "hooks": {
287
+ const items = [];
288
+ const addHooks = (hookList, category, prefix) => {
289
+ if (!hookList) return;
290
+ for (let i = 0; i < hookList.length; i++) {
291
+ const h = hookList[i];
292
+ items.push({
293
+ id: `hook-${prefix}-${category}-${i}`,
294
+ label: h.type || h.command || `Hook ${i + 1}`,
295
+ description: h.command,
296
+ category
297
+ });
298
+ }
299
+ };
300
+ if (config.hooks) {
301
+ addHooks(config.hooks.sessionStart, "User \xB7 Session Start", "user");
302
+ addHooks(config.hooks.sessionEnd, "User \xB7 Session End", "user");
303
+ addHooks(
304
+ config.hooks.userPromptSubmit,
305
+ "User \xB7 User Prompt Submit",
306
+ "user"
307
+ );
308
+ addHooks(config.hooks.preToolUse, "User \xB7 Pre Tool Use", "user");
309
+ addHooks(config.hooks.postToolUse, "User \xB7 Post Tool Use", "user");
310
+ }
311
+ if (config.projectHooks) {
312
+ addHooks(
313
+ config.projectHooks.sessionStart,
314
+ "Project \xB7 Session Start",
315
+ "project"
316
+ );
317
+ addHooks(
318
+ config.projectHooks.sessionEnd,
319
+ "Project \xB7 Session End",
320
+ "project"
321
+ );
322
+ addHooks(
323
+ config.projectHooks.userPromptSubmit,
324
+ "Project \xB7 User Prompt Submit",
325
+ "project"
326
+ );
327
+ addHooks(
328
+ config.projectHooks.preToolUse,
329
+ "Project \xB7 Pre Tool Use",
330
+ "project"
331
+ );
332
+ addHooks(
333
+ config.projectHooks.postToolUse,
334
+ "Project \xB7 Post Tool Use",
335
+ "project"
336
+ );
337
+ }
338
+ return items;
339
+ }
340
+ case "settings":
341
+ return Object.entries(config.settings || {}).map(([key, value]) => ({
342
+ id: `setting-${key}`,
343
+ label: key,
344
+ description: String(value)
345
+ }));
346
+ default:
347
+ return [];
348
+ }
349
+ }
350
+ async function runInstall(config, strategy, shouldInstallPlugins, onProgress) {
351
+ const cwd = getCwd();
352
+ const home = homedir();
353
+ const userDir = join(home, ".minto");
354
+ const projectDir = join(cwd, ".minto");
355
+ onProgress(t("commands.setup.applying"));
356
+ const result = applyTeamConfig(config, strategy);
357
+ const summary = [];
358
+ if (result.modelsAdded > 0) {
359
+ summary.push(
360
+ `${result.modelsAdded} model${result.modelsAdded !== 1 ? "s" : ""}`
361
+ );
362
+ }
363
+ if (result.mcpServersAdded > 0) {
364
+ summary.push(
365
+ `${result.mcpServersAdded} MCP server${result.mcpServersAdded !== 1 ? "s" : ""}`
366
+ );
367
+ }
368
+ if (result.settingsUpdated.length > 0) {
369
+ summary.push(
370
+ `${result.settingsUpdated.length} setting${result.settingsUpdated.length !== 1 ? "s" : ""}`
371
+ );
372
+ }
373
+ if (shouldInstallPlugins) {
374
+ if (config.plugins?.marketplaces && config.plugins.marketplaces.length > 0) {
375
+ onProgress(t("commands.setup.addingMarketplaces"));
376
+ const mpResult = await addMarketplaces(config.plugins.marketplaces);
377
+ if (mpResult.added > 0) {
378
+ summary.push(
379
+ `${mpResult.added} marketplace${mpResult.added !== 1 ? "s" : ""}`
380
+ );
381
+ }
382
+ }
383
+ let pluginsInstalled = 0;
384
+ if (config.plugins?.install && config.plugins.install.length > 0) {
385
+ onProgress(t("commands.setup.installingPlugins"));
386
+ const r = await installPlugins(
387
+ config.plugins.install,
388
+ join(userDir, "plugins")
389
+ );
390
+ pluginsInstalled += r.installed;
391
+ }
392
+ if (config.plugins?.userInstall && config.plugins.userInstall.length > 0) {
393
+ onProgress(t("commands.setup.installingPlugins"));
394
+ const r = await installPlugins(
395
+ config.plugins.userInstall,
396
+ join(userDir, "plugins")
397
+ );
398
+ pluginsInstalled += r.installed;
399
+ }
400
+ if (config.plugins?.projectInstall && config.plugins.projectInstall.length > 0) {
401
+ onProgress(t("commands.setup.installingProjectPlugins"));
402
+ const r = await installPlugins(
403
+ config.plugins.projectInstall,
404
+ join(projectDir, "plugins")
405
+ );
406
+ pluginsInstalled += r.installed;
407
+ }
408
+ if (pluginsInstalled > 0) {
409
+ summary.push(
410
+ `${pluginsInstalled} plugin${pluginsInstalled !== 1 ? "s" : ""}`
411
+ );
412
+ }
413
+ let agentsInstalled = 0;
414
+ if (config.agents) {
415
+ if (config.agents.remoteAgents && config.agents.remoteAgents.length > 0) {
416
+ onProgress(t("commands.setup.installingAgents"));
417
+ const r = await installRemoteAgents(
418
+ config.agents.remoteAgents,
419
+ join(userDir, "agents")
420
+ );
421
+ agentsInstalled += r.installed;
422
+ }
423
+ if (config.agents.inlineAgents && config.agents.inlineAgents.length > 0) {
424
+ onProgress(t("commands.setup.installingAgents"));
425
+ const r = await installInlineAgents(
426
+ config.agents.inlineAgents,
427
+ join(userDir, "agents")
428
+ );
429
+ agentsInstalled += r.installed;
430
+ }
431
+ if (config.agents.userAgents && config.agents.userAgents.length > 0) {
432
+ onProgress(t("commands.setup.installingAgents"));
433
+ const r = await installInlineAgents(
434
+ config.agents.userAgents,
435
+ join(userDir, "agents")
436
+ );
437
+ agentsInstalled += r.installed;
438
+ }
439
+ if (config.agents.projectAgents && config.agents.projectAgents.length > 0) {
440
+ onProgress(t("commands.setup.installingAgents"));
441
+ const r = await installInlineAgents(
442
+ config.agents.projectAgents,
443
+ join(projectDir, "agents")
444
+ );
445
+ agentsInstalled += r.installed;
446
+ }
447
+ }
448
+ if (agentsInstalled > 0) {
449
+ summary.push(
450
+ `${agentsInstalled} agent${agentsInstalled !== 1 ? "s" : ""}`
451
+ );
452
+ }
453
+ let skillsInstalled = 0;
454
+ if (config.skills) {
455
+ if (config.skills.userSkills && config.skills.userSkills.length > 0) {
456
+ onProgress(t("commands.setup.installingSkills"));
457
+ const r = await installInlineSkills(
458
+ config.skills.userSkills,
459
+ join(userDir, "skills")
460
+ );
461
+ skillsInstalled += r.installed;
462
+ }
463
+ if (config.skills.projectSkills && config.skills.projectSkills.length > 0) {
464
+ onProgress(t("commands.setup.installingSkills"));
465
+ const r = await installInlineSkills(
466
+ config.skills.projectSkills,
467
+ join(projectDir, "skills")
468
+ );
469
+ skillsInstalled += r.installed;
470
+ }
471
+ }
472
+ if (skillsInstalled > 0) {
473
+ summary.push(
474
+ `${skillsInstalled} skill${skillsInstalled !== 1 ? "s" : ""}`
475
+ );
476
+ }
477
+ let commandsInstalled = 0;
478
+ if (config.commands) {
479
+ if (config.commands.userCommands && config.commands.userCommands.length > 0) {
480
+ onProgress(t("commands.setup.installingCommands"));
481
+ const r = await installInlineCommands(
482
+ config.commands.userCommands,
483
+ join(userDir, "commands")
484
+ );
485
+ commandsInstalled += r.installed;
486
+ }
487
+ if (config.commands.projectCommands && config.commands.projectCommands.length > 0) {
488
+ onProgress(t("commands.setup.installingCommands"));
489
+ const r = await installInlineCommands(
490
+ config.commands.projectCommands,
491
+ join(projectDir, "commands")
492
+ );
493
+ commandsInstalled += r.installed;
494
+ }
495
+ }
496
+ if (commandsInstalled > 0) {
497
+ summary.push(
498
+ `${commandsInstalled} command${commandsInstalled !== 1 ? "s" : ""}`
499
+ );
500
+ }
501
+ let hooksInstalled = false;
502
+ if (config.hooks) {
503
+ onProgress(t("commands.setup.installingHooks"));
504
+ const r = await installTeamHooks(
505
+ config.hooks,
506
+ join(userDir, "hooks.json")
507
+ );
508
+ if (r.installed) hooksInstalled = true;
509
+ }
510
+ if (config.projectHooks) {
511
+ onProgress(t("commands.setup.installingHooks"));
512
+ const r = await installTeamHooks(
513
+ config.projectHooks,
514
+ join(projectDir, "hooks.json")
515
+ );
516
+ if (r.installed) hooksInstalled = true;
517
+ }
518
+ if (hooksInstalled) {
519
+ summary.push("hooks");
520
+ }
521
+ }
522
+ return summary.length > 0 ? `${t("commands.setup.success")} (${summary.join(", ")})` : t("commands.setup.success");
523
+ }
15
524
  function SetupComponent({
16
525
  source,
17
526
  strategy = "merge",
18
527
  installPlugins: shouldInstallPlugins = true,
19
528
  onDone
20
529
  }) {
21
- const [state, setState] = React.useState({ stage: "loading" });
530
+ const [phase, setPhase] = useState("loading");
531
+ const [teamConfig, setTeamConfig] = useState(null);
532
+ const [activeTab, setActiveTab] = useState("overview");
533
+ const [statusOverlay, setStatusOverlay] = useState(null);
22
534
  React.useEffect(() => {
23
- async function init() {
535
+ async function load() {
24
536
  try {
25
- setState({ stage: "loading" });
26
- const teamConfig = source.startsWith("http://") || source.startsWith("https://") ? await fetchTeamConfig(source) : loadTeamConfigFromFile(source);
27
- setState({ stage: "applying" });
28
- const result = applyTeamConfig(teamConfig, strategy);
29
- let marketplacesAdded = 0;
30
- if (shouldInstallPlugins && teamConfig.plugins?.marketplaces) {
31
- const marketplaceCount = teamConfig.plugins.marketplaces.length;
32
- setState({ stage: "adding-marketplaces", total: marketplaceCount });
33
- const marketplaceResult = await addMarketplaces(
34
- teamConfig.plugins.marketplaces
35
- );
36
- marketplacesAdded = marketplaceResult.added;
37
- }
38
- let pluginsInstalled = 0;
39
- if (shouldInstallPlugins && teamConfig.plugins?.install) {
40
- const pluginCount = teamConfig.plugins.install.length;
41
- setState({ stage: "installing-plugins", total: pluginCount });
42
- const pluginResult = await installPlugins(teamConfig.plugins.install);
43
- pluginsInstalled = pluginResult.installed;
44
- }
45
- let agentsInstalled = 0;
46
- if (shouldInstallPlugins && teamConfig.agents) {
47
- const remoteCount = teamConfig.agents.remoteAgents?.length || 0;
48
- const inlineCount = teamConfig.agents.inlineAgents?.length || 0;
49
- const totalAgents = remoteCount + inlineCount;
50
- if (totalAgents > 0) {
51
- setState({ stage: "installing-agents", total: totalAgents });
52
- if (teamConfig.agents.remoteAgents) {
53
- const remoteResult = await installRemoteAgents(
54
- teamConfig.agents.remoteAgents
55
- );
56
- agentsInstalled += remoteResult.installed;
57
- }
58
- if (teamConfig.agents.inlineAgents) {
59
- const inlineResult = await installInlineAgents(
60
- teamConfig.agents.inlineAgents
61
- );
62
- agentsInstalled += inlineResult.installed;
63
- }
64
- }
65
- }
66
- let hooksInstalled = false;
67
- if (shouldInstallPlugins && teamConfig.hooks) {
68
- setState({ stage: "installing-hooks" });
69
- const hookResult = await installTeamHooks(teamConfig.hooks);
70
- hooksInstalled = hookResult.installed;
71
- }
72
- setState({
73
- stage: "success",
74
- modelsAdded: result.modelsAdded,
75
- mcpServersAdded: result.mcpServersAdded,
76
- settingsUpdated: result.settingsUpdated,
77
- marketplacesAdded: marketplacesAdded > 0 ? marketplacesAdded : void 0,
78
- pluginsInstalled: pluginsInstalled > 0 ? pluginsInstalled : void 0,
79
- agentsInstalled: agentsInstalled > 0 ? agentsInstalled : void 0,
80
- hooksInstalled: hooksInstalled || void 0,
81
- instructions: teamConfig.postInstallInstructions
82
- });
83
- setTimeout(() => onDone("Configuration applied successfully"), 2e3);
537
+ const config = source.startsWith("http://") || source.startsWith("https://") ? await fetchTeamConfig(source) : loadTeamConfigFromFile(source);
538
+ setTeamConfig(config);
539
+ setPhase("preview");
84
540
  } catch (error) {
85
- const errorMessage = error instanceof Error ? error.message : String(error);
86
- setState({
87
- stage: "error",
88
- message: errorMessage
541
+ setTeamConfig(null);
542
+ setPhase("preview");
543
+ setStatusOverlay({
544
+ type: "error",
545
+ message: `${t("commands.setup.failed")}: ${error instanceof Error ? error.message : String(error)}`
89
546
  });
90
- setTimeout(() => onDone(), 2e3);
91
547
  }
92
548
  }
93
- init();
94
- }, [source, strategy, shouldInstallPlugins, onDone]);
95
- if (state.stage === "loading") {
96
- return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Loading configuration from ", source, "..."));
97
- }
98
- if (state.stage === "applying") {
99
- return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Applying configuration..."));
100
- }
101
- if (state.stage === "adding-marketplaces") {
102
- return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Adding ", state.total, " marketplace", state.total !== 1 ? "s" : "", "..."));
103
- }
104
- if (state.stage === "installing-plugins") {
105
- return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Installing ", state.total, " plugin", state.total !== 1 ? "s" : "", "..."));
106
- }
107
- if (state.stage === "installing-agents") {
108
- return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Installing ", state.total, " agent", state.total !== 1 ? "s" : "", "..."));
109
- }
110
- if (state.stage === "installing-hooks") {
111
- return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Installing hooks..."));
112
- }
113
- if (state.stage === "error") {
114
- return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, { color: "red" }, "\u2717 Initialization failed"), /* @__PURE__ */ React.createElement(Text, { color: "red" }, state.message));
549
+ load();
550
+ }, [source]);
551
+ const tabs = useMemo(
552
+ () => teamConfig ? buildTabs(teamConfig) : [{ id: "overview", label: t("commands.setup.tabOverview") }],
553
+ [teamConfig]
554
+ );
555
+ const items = useMemo(
556
+ () => teamConfig ? buildItems(activeTab, teamConfig) : [],
557
+ [teamConfig, activeTab]
558
+ );
559
+ const handleSelect = useCallback(async () => {
560
+ if (!teamConfig || phase !== "preview") return;
561
+ setPhase("installing");
562
+ setStatusOverlay({
563
+ type: "loading",
564
+ message: t("commands.setup.applying")
565
+ });
566
+ try {
567
+ const successMessage = await runInstall(
568
+ teamConfig,
569
+ strategy,
570
+ shouldInstallPlugins,
571
+ (message) => {
572
+ setStatusOverlay({ type: "loading", message });
573
+ }
574
+ );
575
+ setStatusOverlay({
576
+ type: "success",
577
+ message: successMessage
578
+ });
579
+ } catch (error) {
580
+ setStatusOverlay({
581
+ type: "error",
582
+ message: `${t("commands.setup.failed")}: ${error instanceof Error ? error.message : String(error)}`
583
+ });
584
+ }
585
+ }, [teamConfig, phase, strategy, shouldInstallPlugins]);
586
+ const handleClose = useCallback(() => {
587
+ onDone();
588
+ }, [onDone]);
589
+ if (phase === "loading") {
590
+ return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(SimpleSpinner, null), /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, " ", t("commands.setup.loading")));
115
591
  }
116
- return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingY: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "green", bold: true }, "\u2713 Configuration applied successfully!"), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingTop: 1 }, state.modelsAdded > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Added ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.modelsAdded), " model profile", state.modelsAdded !== 1 ? "s" : ""), state.mcpServersAdded > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Added ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.mcpServersAdded), " MCP server", state.mcpServersAdded !== 1 ? "s" : ""), state.settingsUpdated.length > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Updated ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.settingsUpdated.length), " ", "setting", state.settingsUpdated.length !== 1 ? "s" : "", ":", " ", state.settingsUpdated.join(", ")), state.marketplacesAdded !== void 0 && state.marketplacesAdded > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Added ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.marketplacesAdded), " ", "marketplace", state.marketplacesAdded !== 1 ? "s" : ""), state.pluginsInstalled !== void 0 && state.pluginsInstalled > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Installed ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.pluginsInstalled), " ", "plugin", state.pluginsInstalled !== 1 ? "s" : ""), state.agentsInstalled !== void 0 && state.agentsInstalled > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Installed ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.agentsInstalled), " agent", state.agentsInstalled !== 1 ? "s" : ""), state.hooksInstalled && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Installed ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, "hooks"), " configuration")), state.instructions && /* @__PURE__ */ React.createElement(
117
- Box,
592
+ return /* @__PURE__ */ React.createElement(
593
+ TabbedListView,
118
594
  {
119
- flexDirection: "column",
120
- paddingTop: 1,
121
- borderStyle: "round",
122
- borderColor: "yellow",
123
- paddingX: 1
124
- },
125
- /* @__PURE__ */ React.createElement(Text, { color: "yellow", bold: true }, "\u{1F4CB} Next Steps:"),
126
- /* @__PURE__ */ React.createElement(Text, null, state.instructions)
127
- ), /* @__PURE__ */ React.createElement(Box, { paddingTop: 1 }, /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, "Run ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, "minto"), " to start using your configured setup.")));
595
+ title: t("commands.setup.previewTitle"),
596
+ tabs,
597
+ activeTab,
598
+ onTabChange: setActiveTab,
599
+ items,
600
+ searchEnabled: false,
601
+ onSelect: handleSelect,
602
+ onClose: handleClose,
603
+ footerHint: t("commands.setup.confirmHint"),
604
+ statusOverlay,
605
+ statusDismissHint: "Esc Close",
606
+ groupByCategory: activeTab === "overview" || activeTab === "plugins" || activeTab === "agents" || activeTab === "skills" || activeTab === "commands" || activeTab === "hooks",
607
+ isActive: phase !== "installing" || statusOverlay?.type !== "loading"
608
+ }
609
+ );
128
610
  }
129
611
  const command = {
130
612
  type: "local-jsx",
131
613
  name: "setup",
132
- description: "Initialize Minto with team configuration from a URL or file",
614
+ description: t("commands.setup.description"),
133
615
  isEnabled: true,
134
616
  isHidden: false,
617
+ hidePromptInput: true,
135
618
  userFacingName() {
136
619
  return "setup";
137
620
  },
@@ -142,17 +625,20 @@ const command = {
142
625
  const strategyIndex = args.findIndex((arg) => arg === "--strategy");
143
626
  const noPluginsFlag = args.includes("--no-plugins");
144
627
  if (fromIndex === -1 || !args[fromIndex + 1]) {
145
- onDone();
146
- return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, { color: "red" }, "Error: --from parameter is required"), /* @__PURE__ */ React.createElement(Text, null, "Usage: minto setup --from <url|path> [--strategy <merge|replace|skip-existing>] [--no-plugins]"));
628
+ onDone(
629
+ `${t("commands.setup.errorMissingFrom")}
630
+ ${t("commands.setup.errorUsage")}`
631
+ );
632
+ return null;
147
633
  }
148
634
  const source = args[fromIndex + 1];
149
- const strategy = strategyIndex !== -1 && args[strategyIndex + 1] ? args[strategyIndex + 1] : "merge";
635
+ const setupStrategy = strategyIndex !== -1 && args[strategyIndex + 1] ? args[strategyIndex + 1] : "merge";
150
636
  const shouldInstallPlugins = !noPluginsFlag;
151
637
  return /* @__PURE__ */ React.createElement(
152
638
  SetupComponent,
153
639
  {
154
640
  source,
155
- strategy,
641
+ strategy: setupStrategy,
156
642
  installPlugins: shouldInstallPlugins,
157
643
  onDone
158
644
  }