@within-7/minto 0.0.12 → 0.1.0

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.
@@ -0,0 +1,113 @@
1
+ import React from "react";
2
+ import { Text, Box } from "ink";
3
+ import { SimpleSpinner } from "../components/Spinner.js";
4
+ import {
5
+ fetchTeamConfig,
6
+ loadTeamConfigFromFile,
7
+ applyTeamConfig,
8
+ addMarketplaces,
9
+ installPlugins
10
+ } from "../utils/teamConfig.js";
11
+ function SetupComponent({ source, strategy = "merge", installPlugins: shouldInstallPlugins = true, onDone }) {
12
+ const [state, setState] = React.useState({ stage: "loading" });
13
+ React.useEffect(() => {
14
+ async function init() {
15
+ try {
16
+ setState({ stage: "loading" });
17
+ const teamConfig = source.startsWith("http://") || source.startsWith("https://") ? await fetchTeamConfig(source) : loadTeamConfigFromFile(source);
18
+ setState({ stage: "applying" });
19
+ const result = applyTeamConfig(teamConfig, strategy);
20
+ let marketplacesAdded = 0;
21
+ if (shouldInstallPlugins && teamConfig.plugins?.marketplaces) {
22
+ const marketplaceCount = teamConfig.plugins.marketplaces.length;
23
+ setState({ stage: "adding-marketplaces", total: marketplaceCount });
24
+ const marketplaceResult = await addMarketplaces(
25
+ teamConfig.plugins.marketplaces
26
+ );
27
+ marketplacesAdded = marketplaceResult.added;
28
+ }
29
+ let pluginsInstalled = 0;
30
+ if (shouldInstallPlugins && teamConfig.plugins?.install) {
31
+ const pluginCount = teamConfig.plugins.install.length;
32
+ setState({ stage: "installing-plugins", total: pluginCount });
33
+ const pluginResult = await installPlugins(
34
+ teamConfig.plugins.install
35
+ );
36
+ pluginsInstalled = pluginResult.installed;
37
+ }
38
+ setState({
39
+ stage: "success",
40
+ modelsAdded: result.modelsAdded,
41
+ mcpServersAdded: result.mcpServersAdded,
42
+ settingsUpdated: result.settingsUpdated,
43
+ marketplacesAdded: marketplacesAdded > 0 ? marketplacesAdded : void 0,
44
+ pluginsInstalled: pluginsInstalled > 0 ? pluginsInstalled : void 0,
45
+ instructions: teamConfig.postInstallInstructions
46
+ });
47
+ setTimeout(() => onDone("Configuration applied successfully"), 2e3);
48
+ } catch (error) {
49
+ const errorMessage = error instanceof Error ? error.message : String(error);
50
+ setState({
51
+ stage: "error",
52
+ message: errorMessage
53
+ });
54
+ setTimeout(() => onDone(), 2e3);
55
+ }
56
+ }
57
+ init();
58
+ }, [source, strategy, shouldInstallPlugins, onDone]);
59
+ if (state.stage === "loading") {
60
+ return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Loading configuration from ", source, "..."));
61
+ }
62
+ if (state.stage === "applying") {
63
+ return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Applying configuration..."));
64
+ }
65
+ if (state.stage === "adding-marketplaces") {
66
+ 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" : "", "..."));
67
+ }
68
+ if (state.stage === "installing-plugins") {
69
+ 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" : "", "..."));
70
+ }
71
+ if (state.stage === "error") {
72
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, { color: "red" }, "\u2717 Initialization failed"), /* @__PURE__ */ React.createElement(Text, { color: "red" }, state.message));
73
+ }
74
+ 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.instructions && /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingTop: 1, borderStyle: "round", borderColor: "yellow", paddingX: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "yellow", bold: true }, "\u{1F4CB} Next Steps:"), /* @__PURE__ */ React.createElement(Text, null, state.instructions)), /* @__PURE__ */ React.createElement(Box, { paddingTop: 1 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "Run ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, "minto"), " to start using your configured setup.")));
75
+ }
76
+ const command = {
77
+ type: "local-jsx",
78
+ name: "setup",
79
+ description: "Initialize Minto with team configuration from a URL or file",
80
+ isEnabled: true,
81
+ isHidden: false,
82
+ userFacingName() {
83
+ return "setup";
84
+ },
85
+ async call(onDone, _context) {
86
+ const args = process.argv.slice(2);
87
+ const fromIndex = args.findIndex((arg) => arg === "--from");
88
+ const strategyIndex = args.findIndex((arg) => arg === "--strategy");
89
+ const noPluginsFlag = args.includes("--no-plugins");
90
+ if (fromIndex === -1 || !args[fromIndex + 1]) {
91
+ onDone();
92
+ 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]"));
93
+ }
94
+ const source = args[fromIndex + 1];
95
+ const strategy = strategyIndex !== -1 && args[strategyIndex + 1] ? args[strategyIndex + 1] : "merge";
96
+ const shouldInstallPlugins = !noPluginsFlag;
97
+ return /* @__PURE__ */ React.createElement(
98
+ SetupComponent,
99
+ {
100
+ source,
101
+ strategy,
102
+ installPlugins: shouldInstallPlugins,
103
+ onDone
104
+ }
105
+ );
106
+ }
107
+ };
108
+ var setup_default = command;
109
+ export {
110
+ SetupComponent,
111
+ setup_default as default
112
+ };
113
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/commands/setup.tsx"],
4
+ "sourcesContent": ["/**\n * Setup Command\n *\n * Initialize Minto with a team configuration from a remote URL or local file\n */\n\nimport React from 'react'\nimport { Text, Box } from 'ink'\nimport { SimpleSpinner } from '@components/Spinner'\nimport type { Command } from '@commands'\nimport {\n fetchTeamConfig,\n loadTeamConfigFromFile,\n applyTeamConfig,\n addMarketplaces,\n installPlugins,\n type MergeStrategy,\n} from '@utils/teamConfig'\n\ntype SetupProps = {\n source: string // URL or file path\n strategy?: MergeStrategy\n installPlugins?: boolean\n onDone: (result?: string) => void\n}\n\ntype SetupState =\n | { stage: 'loading' }\n | { stage: 'applying' }\n | { stage: 'adding-marketplaces'; total: number }\n | { stage: 'installing-plugins'; total: number }\n | {\n stage: 'success'\n modelsAdded: number\n mcpServersAdded: number\n settingsUpdated: string[]\n marketplacesAdded?: number\n pluginsInstalled?: number\n instructions?: string\n }\n | { stage: 'error'; message: string }\n\nexport function SetupComponent({ source, strategy = 'merge', installPlugins: shouldInstallPlugins = true, onDone }: SetupProps) {\n const [state, setState] = React.useState<SetupState>({ stage: 'loading' })\n\n React.useEffect(() => {\n async function init() {\n try {\n // Step 1: Load configuration\n setState({ stage: 'loading' })\n\n const teamConfig = source.startsWith('http://') || source.startsWith('https://')\n ? await fetchTeamConfig(source)\n : loadTeamConfigFromFile(source)\n\n // Step 2: Apply configuration\n setState({ stage: 'applying' })\n\n const result = applyTeamConfig(teamConfig, strategy)\n\n // Step 3: Add marketplaces (if configured)\n let marketplacesAdded = 0\n if (shouldInstallPlugins && teamConfig.plugins?.marketplaces) {\n const marketplaceCount = teamConfig.plugins.marketplaces.length\n setState({ stage: 'adding-marketplaces', total: marketplaceCount })\n\n const marketplaceResult = await addMarketplaces(\n teamConfig.plugins.marketplaces,\n )\n\n marketplacesAdded = marketplaceResult.added\n }\n\n // Step 4: Install plugins (if configured)\n let pluginsInstalled = 0\n if (shouldInstallPlugins && teamConfig.plugins?.install) {\n const pluginCount = teamConfig.plugins.install.length\n setState({ stage: 'installing-plugins', total: pluginCount })\n\n const pluginResult = await installPlugins(\n teamConfig.plugins.install,\n )\n\n pluginsInstalled = pluginResult.installed\n }\n\n // Success\n setState({\n stage: 'success',\n modelsAdded: result.modelsAdded,\n mcpServersAdded: result.mcpServersAdded,\n settingsUpdated: result.settingsUpdated,\n marketplacesAdded: marketplacesAdded > 0 ? marketplacesAdded : undefined,\n pluginsInstalled: pluginsInstalled > 0 ? pluginsInstalled : undefined,\n instructions: teamConfig.postInstallInstructions,\n })\n\n // Notify parent component\n setTimeout(() => onDone('Configuration applied successfully'), 2000)\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n setState({\n stage: 'error',\n message: errorMessage,\n })\n\n // Notify parent component of error\n setTimeout(() => onDone(), 2000)\n }\n }\n\n init()\n }, [source, strategy, shouldInstallPlugins, onDone])\n\n if (state.stage === 'loading') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Loading configuration from {source}...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'applying') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Applying configuration...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'adding-marketplaces') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Adding {state.total} marketplace\n {state.total !== 1 ? 's' : ''}...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'installing-plugins') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Installing {state.total} plugin\n {state.total !== 1 ? 's' : ''}...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'error') {\n return (\n <Box flexDirection=\"column\">\n <Text color=\"red\">\u2717 Initialization failed</Text>\n <Text color=\"red\">{state.message}</Text>\n </Box>\n )\n }\n\n // Success state\n return (\n <Box flexDirection=\"column\" paddingY={1}>\n <Text color=\"green\" bold>\n \u2713 Configuration applied successfully!\n </Text>\n\n <Box flexDirection=\"column\" paddingTop={1}>\n {state.modelsAdded > 0 && (\n <Text>\n \u2022 Added <Text color=\"cyan\">{state.modelsAdded}</Text> model profile\n {state.modelsAdded !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.mcpServersAdded > 0 && (\n <Text>\n \u2022 Added <Text color=\"cyan\">{state.mcpServersAdded}</Text> MCP server\n {state.mcpServersAdded !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.settingsUpdated.length > 0 && (\n <Text>\n \u2022 Updated <Text color=\"cyan\">{state.settingsUpdated.length}</Text> setting\n {state.settingsUpdated.length !== 1 ? 's' : ''}:{' '}\n {state.settingsUpdated.join(', ')}\n </Text>\n )}\n\n {state.marketplacesAdded !== undefined && state.marketplacesAdded > 0 && (\n <Text>\n \u2022 Added <Text color=\"cyan\">{state.marketplacesAdded}</Text> marketplace\n {state.marketplacesAdded !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.pluginsInstalled !== undefined && state.pluginsInstalled > 0 && (\n <Text>\n \u2022 Installed <Text color=\"cyan\">{state.pluginsInstalled}</Text> plugin\n {state.pluginsInstalled !== 1 ? 's' : ''}\n </Text>\n )}\n </Box>\n\n {state.instructions && (\n <Box flexDirection=\"column\" paddingTop={1} borderStyle=\"round\" borderColor=\"yellow\" paddingX={1}>\n <Text color=\"yellow\" bold>\n \uD83D\uDCCB Next Steps:\n </Text>\n <Text>{state.instructions}</Text>\n </Box>\n )}\n\n <Box paddingTop={1}>\n <Text dimColor>\n Run <Text color=\"cyan\">minto</Text> to start using your configured setup.\n </Text>\n </Box>\n </Box>\n )\n}\n\n// Command definition\nconst command = {\n type: 'local-jsx',\n name: 'setup',\n description: 'Initialize Minto with team configuration from a URL or file',\n isEnabled: true,\n isHidden: false,\n userFacingName() {\n return 'setup'\n },\n async call(onDone, _context) {\n // Parse arguments\n const args = process.argv.slice(2)\n const fromIndex = args.findIndex(arg => arg === '--from')\n const strategyIndex = args.findIndex(arg => arg === '--strategy')\n const noPluginsFlag = args.includes('--no-plugins')\n\n if (fromIndex === -1 || !args[fromIndex + 1]) {\n onDone()\n return (\n <Box flexDirection=\"column\">\n <Text color=\"red\">Error: --from parameter is required</Text>\n <Text>\n Usage: minto setup --from &lt;url|path&gt; [--strategy &lt;merge|replace|skip-existing&gt;] [--no-plugins]\n </Text>\n </Box>\n )\n }\n\n const source = args[fromIndex + 1]\n const strategy: MergeStrategy =\n strategyIndex !== -1 && args[strategyIndex + 1]\n ? (args[strategyIndex + 1] as MergeStrategy)\n : 'merge'\n const shouldInstallPlugins = !noPluginsFlag\n\n return (\n <SetupComponent\n source={source}\n strategy={strategy}\n installPlugins={shouldInstallPlugins}\n onDone={onDone}\n />\n )\n },\n} satisfies Command\n\nexport default command\n"],
5
+ "mappings": "AAMA,OAAO,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W;AAAA,EACX,UAAU;AAAA,EACV,iBAAiB;AACf,WAAO;AAAA,EACT;AAAA,EACA,MAAM,KAAK,QAAQ,UAAU;AAE3B,UAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,UAAM,YAAY,KAAK,UAAU,SAAO,QAAQ,QAAQ;AACxD,UAAM,gBAAgB,KAAK,UAAU,SAAO,QAAQ,YAAY;AAChE,UAAM,gBAAgB,KAAK,SAAS,cAAc;AAElD,QAAI,cAAc,MAAM,CAAC,KAAK,YAAY,CAAC,GAAG;AAC5C,aAAO;AACP,aACE,oCAAC,OAAI,eAAc,YACjB,oCAAC,QAAK,OAAM,SAAM,qCAAmC,GACrD,oCAAC,YAAK,gGAEN,CACF;AAAA,IAEJ;AAEA,UAAM,SAAS,KAAK,YAAY,CAAC;AACjC,UAAM,WACJ,kBAAkB,MAAM,KAAK,gBAAgB,CAAC,IACzC,KAAK,gBAAgB,CAAC,IACvB;AACN,UAAM,uBAAuB,CAAC;AAE9B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,gBAAgB;AAAA,QAChB;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,IAAO,gBAAQ;",
6
+ "names": []
7
+ }
package/dist/commands.js CHANGED
@@ -19,6 +19,7 @@ import pr_comments from "./commands/pr_comments.js";
19
19
  import refreshCommands from "./commands/refreshCommands.js";
20
20
  import releaseNotes from "./commands/release-notes.js";
21
21
  import review from "./commands/review.js";
22
+ import setup from "./commands/setup.js";
22
23
  import terminalSetup from "./commands/terminalSetup.js";
23
24
  import resume from "./commands/resume.js";
24
25
  import agents from "./commands/agents.js";
@@ -50,6 +51,7 @@ const COMMANDS = memoize(() => [
50
51
  releaseNotes,
51
52
  bug,
52
53
  review,
54
+ setup,
53
55
  terminalSetup,
54
56
  ...isAnthropicAuthEnabled() ? [logout, login()] : [],
55
57
  ...INTERNAL_ONLY_COMMANDS
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/commands.ts"],
4
- "sourcesContent": ["import React from 'react'\nimport bug from './commands/bug'\nimport clear from './commands/clear'\nimport compact from './commands/compact'\nimport compression from './commands/compression'\nimport config from './commands/config'\nimport cost from './commands/cost'\nimport ctx_viz from './commands/ctx_viz'\nimport doctor from './commands/doctor'\nimport help from './commands/help'\nimport init from './commands/init'\nimport listen from './commands/listen'\nimport login from './commands/login'\nimport logout from './commands/logout'\nimport mcp from './commands/mcp-interactive'\nimport * as model from './commands/model'\nimport modelstatus from './commands/modelstatus'\nimport onboarding from './commands/onboarding'\nimport pr_comments from './commands/pr_comments'\nimport refreshCommands from './commands/refreshCommands'\nimport releaseNotes from './commands/release-notes'\nimport review from './commands/review'\nimport terminalSetup from './commands/terminalSetup'\nimport { Tool, ToolUseContext } from './Tool'\nimport resume from './commands/resume'\nimport agents from './commands/agents'\nimport plugin from './commands/plugin'\nimport { quit } from './commands/quit'\nimport { getMCPCommands } from './services/mcpClient'\nimport { loadCustomCommands, loadPluginCommands } from './services/customCommands'\nimport type { MessageParam } from '@anthropic-ai/sdk/resources/index.mjs'\nimport { memoize } from 'lodash-es'\nimport type { Message } from './query'\nimport { isAnthropicAuthEnabled } from './utils/auth'\n\ntype PromptCommand = {\n type: 'prompt'\n progressMessage: string\n argNames?: string[]\n getPromptForCommand(args: string): Promise<MessageParam[]>\n}\n\ntype LocalCommand = {\n type: 'local'\n call(\n args: string,\n context: {\n options: {\n commands: Command[]\n tools: Tool[]\n slowAndCapableModel: string\n }\n abortController: AbortController\n setForkConvoWithMessagesOnTheNextRender: (\n forkConvoWithMessages: Message[],\n ) => void\n },\n ): Promise<string>\n}\n\ntype LocalJSXCommand = {\n type: 'local-jsx'\n call(\n onDone: (result?: string) => void,\n context: ToolUseContext & {\n setForkConvoWithMessagesOnTheNextRender: (\n forkConvoWithMessages: Message[],\n ) => void\n },\n ): Promise<React.ReactNode>\n}\n\nexport type Command = {\n description: string\n isEnabled: boolean\n isHidden: boolean\n name: string\n aliases?: string[]\n userFacingName(): string\n} & (PromptCommand | LocalCommand | LocalJSXCommand)\n\nconst INTERNAL_ONLY_COMMANDS = [ctx_viz, resume, listen]\n\n// Declared as a function so that we don't run this until getCommands is called,\n// since underlying functions read from config, which can't be read at module initialization time\nconst COMMANDS = memoize((): Command[] => [\n agents,\n plugin,\n clear,\n compact,\n compression,\n config,\n cost,\n doctor,\n help,\n init,\n mcp,\n model,\n modelstatus,\n onboarding,\n pr_comments,\n quit,\n refreshCommands,\n releaseNotes,\n bug,\n review,\n terminalSetup,\n ...(isAnthropicAuthEnabled() ? [logout, login()] : []),\n ...INTERNAL_ONLY_COMMANDS,\n])\n\nexport const getCommands = memoize(async (): Promise<Command[]> => {\n const [mcpCommands, customCommands, pluginCommands] = await Promise.all([\n getMCPCommands(),\n loadCustomCommands(),\n loadPluginCommands(),\n ])\n\n // Get built-in commands\n const builtInCommands = COMMANDS()\n\n // Sort built-in commands alphabetically by name\n const sortedBuiltIn = [...builtInCommands].sort((a, b) =>\n a.userFacingName().localeCompare(b.userFacingName())\n )\n\n // Sort MCP commands alphabetically by name\n const sortedMCP = [...mcpCommands].sort((a, b) =>\n a.userFacingName().localeCompare(b.userFacingName())\n )\n\n // Sort plugin commands alphabetically by name\n const sortedPlugin = [...pluginCommands].sort((a, b) =>\n a.userFacingName().localeCompare(b.userFacingName())\n )\n\n // Sort custom commands alphabetically by name\n const sortedCustom = [...customCommands].sort((a, b) =>\n a.userFacingName().localeCompare(b.userFacingName())\n )\n\n // Command priority (later overrides earlier):\n // 1. MCP commands (lowest priority) - sorted alphabetically\n // 2. Plugin commands - sorted alphabetically\n // 3. Custom commands (user/project) - sorted alphabetically\n // 4. Built-in commands (highest priority) - sorted alphabetically\n // Display order: Built-in first, then custom/plugin/MCP\n return [...sortedBuiltIn, ...sortedCustom, ...sortedPlugin, ...sortedMCP].filter(\n _ => _.isEnabled,\n )\n})\n\nexport function hasCommand(commandName: string, commands: Command[]): boolean {\n return commands.some(\n _ => _.userFacingName() === commandName || _.aliases?.includes(commandName),\n )\n}\n\nexport function getCommand(commandName: string, commands: Command[]): Command {\n const command = commands.find(\n _ => _.userFacingName() === commandName || _.aliases?.includes(commandName),\n ) as Command | undefined\n if (!command) {\n throw ReferenceError(\n `Command ${commandName} not found. Available commands: ${commands\n .map(_ => {\n const name = _.userFacingName()\n return _.aliases ? `${name} (aliases: ${_.aliases.join(', ')})` : name\n })\n .join(', ')}`,\n )\n }\n\n return command\n}\n"],
5
- "mappings": "AACA,OAAO,SAAS;AAChB,OAAO,WAAW;AAClB,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,SAAS;AAChB,YAAY,WAAW;AACvB,OAAO,iBAAiB;AACxB,OAAO,gBAAgB;AACvB,OAAO,iBAAiB;AACxB,OAAO,qBAAqB;AAC5B,OAAO,kBAAkB;AACzB,OAAO,YAAY;AACnB,OAAO,mBAAmB;AAE1B,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB,0BAA0B;AAEvD,SAAS,eAAe;AAExB,SAAS,8BAA8B;AAgDvC,MAAM,yBAAyB,CAAC,SAAS,QAAQ,MAAM;AAIvD,MAAM,WAAW,QAAQ,MAAiB;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAI,uBAAuB,IAAI,CAAC,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IAAI,OAAK;AACR,cAAM,OAAO,EAAE,eAAe;AAC9B,eAAO,EAAE,UAAU,GAAG,IAAI,cAAc,EAAE,QAAQ,KAAK,IAAI,CAAC,MAAM;AAAA,MACpE,CAAC,EACA,KAAK,IAAI,CAAC;AAAA,IACf;AAAA,EACF;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import React from 'react'\nimport bug from './commands/bug'\nimport clear from './commands/clear'\nimport compact from './commands/compact'\nimport compression from './commands/compression'\nimport config from './commands/config'\nimport cost from './commands/cost'\nimport ctx_viz from './commands/ctx_viz'\nimport doctor from './commands/doctor'\nimport help from './commands/help'\nimport init from './commands/init'\nimport listen from './commands/listen'\nimport login from './commands/login'\nimport logout from './commands/logout'\nimport mcp from './commands/mcp-interactive'\nimport * as model from './commands/model'\nimport modelstatus from './commands/modelstatus'\nimport onboarding from './commands/onboarding'\nimport pr_comments from './commands/pr_comments'\nimport refreshCommands from './commands/refreshCommands'\nimport releaseNotes from './commands/release-notes'\nimport review from './commands/review'\nimport setup from './commands/setup'\nimport terminalSetup from './commands/terminalSetup'\nimport { Tool, ToolUseContext } from './Tool'\nimport resume from './commands/resume'\nimport agents from './commands/agents'\nimport plugin from './commands/plugin'\nimport { quit } from './commands/quit'\nimport { getMCPCommands } from './services/mcpClient'\nimport { loadCustomCommands, loadPluginCommands } from './services/customCommands'\nimport type { MessageParam } from '@anthropic-ai/sdk/resources/index.mjs'\nimport { memoize } from 'lodash-es'\nimport type { Message } from './query'\nimport { isAnthropicAuthEnabled } from './utils/auth'\n\ntype PromptCommand = {\n type: 'prompt'\n progressMessage: string\n argNames?: string[]\n getPromptForCommand(args: string): Promise<MessageParam[]>\n}\n\ntype LocalCommand = {\n type: 'local'\n call(\n args: string,\n context: {\n options: {\n commands: Command[]\n tools: Tool[]\n slowAndCapableModel: string\n }\n abortController: AbortController\n setForkConvoWithMessagesOnTheNextRender: (\n forkConvoWithMessages: Message[],\n ) => void\n },\n ): Promise<string>\n}\n\ntype LocalJSXCommand = {\n type: 'local-jsx'\n call(\n onDone: (result?: string) => void,\n context: ToolUseContext & {\n setForkConvoWithMessagesOnTheNextRender: (\n forkConvoWithMessages: Message[],\n ) => void\n },\n ): Promise<React.ReactNode>\n}\n\nexport type Command = {\n description: string\n isEnabled: boolean\n isHidden: boolean\n name: string\n aliases?: string[]\n userFacingName(): string\n} & (PromptCommand | LocalCommand | LocalJSXCommand)\n\nconst INTERNAL_ONLY_COMMANDS = [ctx_viz, resume, listen]\n\n// Declared as a function so that we don't run this until getCommands is called,\n// since underlying functions read from config, which can't be read at module initialization time\nconst COMMANDS = memoize((): Command[] => [\n agents,\n plugin,\n clear,\n compact,\n compression,\n config,\n cost,\n doctor,\n help,\n init,\n mcp,\n model,\n modelstatus,\n onboarding,\n pr_comments,\n quit,\n refreshCommands,\n releaseNotes,\n bug,\n review,\n setup,\n terminalSetup,\n ...(isAnthropicAuthEnabled() ? [logout, login()] : []),\n ...INTERNAL_ONLY_COMMANDS,\n])\n\nexport const getCommands = memoize(async (): Promise<Command[]> => {\n const [mcpCommands, customCommands, pluginCommands] = await Promise.all([\n getMCPCommands(),\n loadCustomCommands(),\n loadPluginCommands(),\n ])\n\n // Get built-in commands\n const builtInCommands = COMMANDS()\n\n // Sort built-in commands alphabetically by name\n const sortedBuiltIn = [...builtInCommands].sort((a, b) =>\n a.userFacingName().localeCompare(b.userFacingName())\n )\n\n // Sort MCP commands alphabetically by name\n const sortedMCP = [...mcpCommands].sort((a, b) =>\n a.userFacingName().localeCompare(b.userFacingName())\n )\n\n // Sort plugin commands alphabetically by name\n const sortedPlugin = [...pluginCommands].sort((a, b) =>\n a.userFacingName().localeCompare(b.userFacingName())\n )\n\n // Sort custom commands alphabetically by name\n const sortedCustom = [...customCommands].sort((a, b) =>\n a.userFacingName().localeCompare(b.userFacingName())\n )\n\n // Command priority (later overrides earlier):\n // 1. MCP commands (lowest priority) - sorted alphabetically\n // 2. Plugin commands - sorted alphabetically\n // 3. Custom commands (user/project) - sorted alphabetically\n // 4. Built-in commands (highest priority) - sorted alphabetically\n // Display order: Built-in first, then custom/plugin/MCP\n return [...sortedBuiltIn, ...sortedCustom, ...sortedPlugin, ...sortedMCP].filter(\n _ => _.isEnabled,\n )\n})\n\nexport function hasCommand(commandName: string, commands: Command[]): boolean {\n return commands.some(\n _ => _.userFacingName() === commandName || _.aliases?.includes(commandName),\n )\n}\n\nexport function getCommand(commandName: string, commands: Command[]): Command {\n const command = commands.find(\n _ => _.userFacingName() === commandName || _.aliases?.includes(commandName),\n ) as Command | undefined\n if (!command) {\n throw ReferenceError(\n `Command ${commandName} not found. Available commands: ${commands\n .map(_ => {\n const name = _.userFacingName()\n return _.aliases ? `${name} (aliases: ${_.aliases.join(', ')})` : name\n })\n .join(', ')}`,\n )\n }\n\n return command\n}\n"],
5
+ "mappings": "AACA,OAAO,SAAS;AAChB,OAAO,WAAW;AAClB,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,SAAS;AAChB,YAAY,WAAW;AACvB,OAAO,iBAAiB;AACxB,OAAO,gBAAgB;AACvB,OAAO,iBAAiB;AACxB,OAAO,qBAAqB;AAC5B,OAAO,kBAAkB;AACzB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,mBAAmB;AAE1B,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB,0BAA0B;AAEvD,SAAS,eAAe;AAExB,SAAS,8BAA8B;AAgDvC,MAAM,yBAAyB,CAAC,SAAS,QAAQ,MAAM;AAIvD,MAAM,WAAW,QAAQ,MAAiB;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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AAA,EAC5E;AACF;AAEO,SAAS,WAAW,aAAqB,UAA8B;AAC5E,QAAM,UAAU,SAAS;AAAA,IACvB,OAAK,EAAE,eAAe,MAAM,eAAe,EAAE,SAAS,SAAS,WAAW;AAAA,EAC5E;AACA,MAAI,CAAC,SAAS;AACZ,UAAM;AAAA,MACJ,WAAW,WAAW,mCAAmC,SACtD,IAAI,OAAK;AACR,cAAM,OAAO,EAAE,eAAe;AAC9B,eAAO,EAAE,UAAU,GAAG,IAAI,cAAc,EAAE,QAAQ,KAAK,IAAI,CAAC,MAAM;AAAA,MACpE,CAAC,EACA,KAAK,IAAI,CAAC;AAAA,IACf;AAAA,EACF;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,312 @@
1
+ import { existsSync, readFileSync } from "fs";
2
+ import {
3
+ getGlobalConfig,
4
+ saveGlobalConfig
5
+ } from "./config.js";
6
+ import { debug as debugLogger } from "./debugLogger.js";
7
+ import { safeParseJSON } from "./json.js";
8
+ function interpolateEnvVars(value) {
9
+ return value.replace(/\$\{([^}]+)\}/g, (match, varName) => {
10
+ const envValue = process.env[varName.trim()];
11
+ if (envValue === void 0) {
12
+ debugLogger.warn("ENV_VAR_NOT_FOUND", {
13
+ varName,
14
+ original: match
15
+ });
16
+ return match;
17
+ }
18
+ return envValue;
19
+ });
20
+ }
21
+ function interpolateEnvVarsInObject(obj) {
22
+ if (typeof obj === "string") {
23
+ return interpolateEnvVars(obj);
24
+ }
25
+ if (Array.isArray(obj)) {
26
+ return obj.map((item) => interpolateEnvVarsInObject(item));
27
+ }
28
+ if (obj && typeof obj === "object") {
29
+ const result = {};
30
+ for (const [key, value] of Object.entries(obj)) {
31
+ result[key] = interpolateEnvVarsInObject(value);
32
+ }
33
+ return result;
34
+ }
35
+ return obj;
36
+ }
37
+ function convertTeamModelProfile(teamProfile) {
38
+ const now = Date.now();
39
+ return {
40
+ name: teamProfile.name,
41
+ provider: teamProfile.provider,
42
+ modelName: teamProfile.modelName,
43
+ baseURL: teamProfile.baseURL,
44
+ apiKey: interpolateEnvVars(teamProfile.apiKey),
45
+ maxTokens: teamProfile.maxTokens,
46
+ contextLength: teamProfile.contextLength,
47
+ reasoningEffort: teamProfile.reasoningEffort,
48
+ isActive: teamProfile.isActive ?? true,
49
+ createdAt: now,
50
+ lastUsed: now
51
+ };
52
+ }
53
+ function convertTeamMcpConfig(teamConfig) {
54
+ if (teamConfig.type === "sse") {
55
+ return {
56
+ type: "sse",
57
+ url: interpolateEnvVars(teamConfig.url || ""),
58
+ enabled: teamConfig.enabled ?? true
59
+ };
60
+ }
61
+ return {
62
+ type: "stdio",
63
+ command: interpolateEnvVars(teamConfig.command || ""),
64
+ args: (teamConfig.args || []).map((arg) => interpolateEnvVars(arg)),
65
+ env: teamConfig.env ? interpolateEnvVarsInObject(teamConfig.env) : void 0,
66
+ enabled: teamConfig.enabled ?? true
67
+ };
68
+ }
69
+ async function fetchTeamConfig(url) {
70
+ debugLogger.state("TEAM_CONFIG_FETCH_START", { url });
71
+ try {
72
+ const response = await fetch(url);
73
+ if (!response.ok) {
74
+ throw new Error(
75
+ `Failed to fetch config: ${response.status} ${response.statusText}`
76
+ );
77
+ }
78
+ const configText = await response.text();
79
+ const config = JSON.parse(configText);
80
+ if (config.version !== "1.0") {
81
+ throw new Error(
82
+ `Unsupported config version: ${config.version}. Expected 1.0`
83
+ );
84
+ }
85
+ debugLogger.state("TEAM_CONFIG_FETCH_SUCCESS", {
86
+ url,
87
+ configName: config.name,
88
+ hasModels: !!config.models,
89
+ hasMcpServers: !!config.mcpServers
90
+ });
91
+ return config;
92
+ } catch (error) {
93
+ debugLogger.error("TEAM_CONFIG_FETCH_ERROR", {
94
+ url,
95
+ error: error instanceof Error ? error.message : String(error)
96
+ });
97
+ throw error;
98
+ }
99
+ }
100
+ function loadTeamConfigFromFile(filePath) {
101
+ debugLogger.state("TEAM_CONFIG_LOAD_FILE", { filePath });
102
+ if (!existsSync(filePath)) {
103
+ throw new Error(`Configuration file not found: ${filePath}`);
104
+ }
105
+ try {
106
+ const configText = readFileSync(filePath, "utf-8");
107
+ const config = safeParseJSON(configText);
108
+ if (!config) {
109
+ throw new Error("Invalid JSON in configuration file");
110
+ }
111
+ if (config.version !== "1.0") {
112
+ throw new Error(
113
+ `Unsupported config version: ${config.version}. Expected 1.0`
114
+ );
115
+ }
116
+ debugLogger.state("TEAM_CONFIG_LOAD_FILE_SUCCESS", {
117
+ filePath,
118
+ configName: config.name
119
+ });
120
+ return config;
121
+ } catch (error) {
122
+ debugLogger.error("TEAM_CONFIG_LOAD_FILE_ERROR", {
123
+ filePath,
124
+ error: error instanceof Error ? error.message : String(error)
125
+ });
126
+ throw error;
127
+ }
128
+ }
129
+ function applyTeamConfig(teamConfig, strategy = "merge") {
130
+ debugLogger.state("TEAM_CONFIG_APPLY_START", {
131
+ configName: teamConfig.name,
132
+ strategy
133
+ });
134
+ const globalConfig = getGlobalConfig();
135
+ let modelsAdded = 0;
136
+ let mcpServersAdded = 0;
137
+ const settingsUpdated = [];
138
+ if (teamConfig.models?.profiles) {
139
+ const existingProfiles = globalConfig.modelProfiles || [];
140
+ const existingModelNames = new Set(
141
+ existingProfiles.map((p) => p.modelName)
142
+ );
143
+ for (const teamProfile of teamConfig.models.profiles) {
144
+ const runtimeProfile = convertTeamModelProfile(teamProfile);
145
+ if (strategy === "skip-existing" && existingModelNames.has(runtimeProfile.modelName)) {
146
+ debugLogger.state("TEAM_CONFIG_SKIP_MODEL", {
147
+ modelName: runtimeProfile.modelName,
148
+ reason: "already_exists"
149
+ });
150
+ continue;
151
+ }
152
+ if (strategy === "replace") {
153
+ const index = existingProfiles.findIndex(
154
+ (p) => p.modelName === runtimeProfile.modelName
155
+ );
156
+ if (index !== -1) {
157
+ existingProfiles.splice(index, 1);
158
+ }
159
+ }
160
+ existingProfiles.push(runtimeProfile);
161
+ modelsAdded++;
162
+ debugLogger.state("TEAM_CONFIG_ADD_MODEL", {
163
+ modelName: runtimeProfile.modelName,
164
+ provider: runtimeProfile.provider
165
+ });
166
+ }
167
+ globalConfig.modelProfiles = existingProfiles;
168
+ }
169
+ if (teamConfig.models?.pointers) {
170
+ globalConfig.modelPointers = {
171
+ ...globalConfig.modelPointers || { main: "", task: "", reasoning: "", quick: "" },
172
+ ...teamConfig.models.pointers
173
+ };
174
+ settingsUpdated.push("modelPointers");
175
+ }
176
+ if (teamConfig.models?.defaultModel) {
177
+ globalConfig.defaultModelName = teamConfig.models.defaultModel;
178
+ settingsUpdated.push("defaultModelName");
179
+ }
180
+ if (teamConfig.mcpServers) {
181
+ const existingMcpServers = globalConfig.mcpServers || {};
182
+ const existingServerNames = new Set(Object.keys(existingMcpServers));
183
+ for (const [serverName, teamMcpConfig] of Object.entries(
184
+ teamConfig.mcpServers
185
+ )) {
186
+ if (strategy === "skip-existing" && existingServerNames.has(serverName)) {
187
+ debugLogger.state("TEAM_CONFIG_SKIP_MCP", {
188
+ serverName,
189
+ reason: "already_exists"
190
+ });
191
+ continue;
192
+ }
193
+ const runtimeMcpConfig = convertTeamMcpConfig(teamMcpConfig);
194
+ existingMcpServers[serverName] = runtimeMcpConfig;
195
+ mcpServersAdded++;
196
+ debugLogger.state("TEAM_CONFIG_ADD_MCP", {
197
+ serverName,
198
+ type: runtimeMcpConfig.type || "stdio"
199
+ });
200
+ }
201
+ globalConfig.mcpServers = existingMcpServers;
202
+ }
203
+ if (teamConfig.settings) {
204
+ const { settings } = teamConfig;
205
+ if (settings.theme !== void 0) {
206
+ globalConfig.theme = settings.theme;
207
+ settingsUpdated.push("theme");
208
+ }
209
+ if (settings.verbose !== void 0) {
210
+ globalConfig.verbose = settings.verbose;
211
+ settingsUpdated.push("verbose");
212
+ }
213
+ if (settings.compressionMode !== void 0) {
214
+ globalConfig.compressionMode = settings.compressionMode;
215
+ settingsUpdated.push("compressionMode");
216
+ }
217
+ if (settings.thinking !== void 0) {
218
+ globalConfig.thinking = settings.thinking;
219
+ settingsUpdated.push("thinking");
220
+ }
221
+ if (settings.proxy !== void 0) {
222
+ globalConfig.proxy = settings.proxy;
223
+ settingsUpdated.push("proxy");
224
+ }
225
+ if (settings.stream !== void 0) {
226
+ globalConfig.stream = settings.stream;
227
+ settingsUpdated.push("stream");
228
+ }
229
+ }
230
+ saveGlobalConfig(globalConfig);
231
+ debugLogger.state("TEAM_CONFIG_APPLY_SUCCESS", {
232
+ configName: teamConfig.name,
233
+ modelsAdded,
234
+ mcpServersAdded,
235
+ settingsUpdated: settingsUpdated.join(", ")
236
+ });
237
+ return {
238
+ applied: true,
239
+ modelsAdded,
240
+ mcpServersAdded,
241
+ settingsUpdated
242
+ };
243
+ }
244
+ async function addMarketplaces(marketplaceUrls) {
245
+ let added = 0;
246
+ let failed = 0;
247
+ const errors = [];
248
+ const { addMarketplace } = await import("./marketplaceManager.js");
249
+ for (const url of marketplaceUrls) {
250
+ try {
251
+ debugLogger.state("TEAM_CONFIG_ADD_MARKETPLACE", { url });
252
+ await addMarketplace(url);
253
+ added++;
254
+ debugLogger.state("TEAM_CONFIG_ADD_MARKETPLACE_SUCCESS", { url });
255
+ } catch (error) {
256
+ failed++;
257
+ const errorMsg = error instanceof Error ? error.message : String(error);
258
+ errors.push(`${url}: ${errorMsg}`);
259
+ debugLogger.error("TEAM_CONFIG_ADD_MARKETPLACE_ERROR", {
260
+ url,
261
+ error: errorMsg
262
+ });
263
+ }
264
+ }
265
+ return { added, failed, errors };
266
+ }
267
+ async function installPlugins(pluginNames, targetDir) {
268
+ let installed = 0;
269
+ let failed = 0;
270
+ const errors = [];
271
+ const { installPluginFromMarketplace } = await import("./marketplaceManager.js");
272
+ const { join } = await import("path");
273
+ const { homedir } = await import("os");
274
+ const installDir = targetDir || join(homedir(), ".minto", "plugins");
275
+ for (const pluginName of pluginNames) {
276
+ try {
277
+ debugLogger.state("TEAM_CONFIG_INSTALL_PLUGIN", {
278
+ pluginName,
279
+ targetDir: installDir
280
+ });
281
+ await installPluginFromMarketplace(
282
+ pluginName,
283
+ void 0,
284
+ // Search all marketplaces
285
+ join(installDir, pluginName)
286
+ );
287
+ installed++;
288
+ debugLogger.state("TEAM_CONFIG_INSTALL_PLUGIN_SUCCESS", { pluginName });
289
+ } catch (error) {
290
+ failed++;
291
+ const errorMsg = error instanceof Error ? error.message : String(error);
292
+ errors.push(`${pluginName}: ${errorMsg}`);
293
+ debugLogger.error("TEAM_CONFIG_INSTALL_PLUGIN_ERROR", {
294
+ pluginName,
295
+ error: errorMsg
296
+ });
297
+ }
298
+ }
299
+ return { installed, failed, errors };
300
+ }
301
+ export {
302
+ addMarketplaces,
303
+ applyTeamConfig,
304
+ convertTeamMcpConfig,
305
+ convertTeamModelProfile,
306
+ fetchTeamConfig,
307
+ installPlugins,
308
+ interpolateEnvVars,
309
+ interpolateEnvVarsInObject,
310
+ loadTeamConfigFromFile
311
+ };
312
+ //# sourceMappingURL=teamConfig.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/teamConfig.ts"],
4
+ "sourcesContent": ["/**\n * Team Configuration System\n *\n * Enables teams to share a unified Minto configuration via remote URLs.\n * Supports environment variable interpolation and flexible configuration merging.\n */\n\nimport { existsSync, readFileSync } from 'fs'\nimport {\n getGlobalConfig,\n saveGlobalConfig,\n ModelProfile,\n ModelPointers,\n McpServerConfig,\n ProviderType,\n} from './config'\nimport { debug as debugLogger } from './debugLogger'\nimport { safeParseJSON } from './json'\n\n/**\n * Team configuration schema\n * Represents a shareable configuration template for teams\n */\nexport type TeamConfig = {\n version: '1.0'\n name: string // Configuration name (e.g., \"Acme Inc. Default Config\")\n description?: string // Optional description\n\n // Model Configuration\n models?: {\n profiles?: TeamModelProfile[]\n pointers?: Partial<ModelPointers> // Default model pointers\n defaultModel?: string // Default model name\n }\n\n // MCP Server Configuration\n mcpServers?: Record<string, TeamMcpServerConfig>\n\n // Plugin Marketplace Configuration\n plugins?: {\n // Plugin marketplace URLs (marketplace.json)\n marketplaces?: string[]\n // Specific plugins to install from marketplaces\n install?: string[] // Plugin names to install\n }\n\n // Global Settings\n settings?: {\n theme?: 'dark' | 'light'\n verbose?: boolean\n compressionMode?: 'business' | 'code'\n thinking?: boolean\n proxy?: string\n stream?: boolean\n }\n\n // Instructions for users\n postInstallInstructions?: string\n}\n\n/**\n * Model profile template with environment variable support\n */\nexport type TeamModelProfile = {\n name: string\n provider: ProviderType\n modelName: string\n baseURL?: string\n apiKey: string // Can be env var like \"${ANTHROPIC_API_KEY}\"\n maxTokens: number\n contextLength: number\n reasoningEffort?: 'low' | 'medium' | 'high' | 'minimal'\n isActive?: boolean\n}\n\n/**\n * MCP server config with env var support\n */\nexport type TeamMcpServerConfig = {\n type?: 'stdio' | 'sse'\n command?: string // For stdio\n args?: string[] // For stdio, supports env vars like \"${HOME}/.local/bin/mcp-server\"\n url?: string // For SSE\n env?: Record<string, string> // Env vars, supports interpolation\n enabled?: boolean\n}\n\n/**\n * Interpolate environment variables in a string\n * Supports ${VAR_NAME} syntax\n */\nexport function interpolateEnvVars(value: string): string {\n return value.replace(/\\$\\{([^}]+)\\}/g, (match, varName) => {\n const envValue = process.env[varName.trim()]\n if (envValue === undefined) {\n debugLogger.warn('ENV_VAR_NOT_FOUND', {\n varName,\n original: match,\n })\n // Keep the placeholder if env var not found\n return match\n }\n return envValue\n })\n}\n\n/**\n * Recursively interpolate env vars in an object\n */\nexport function interpolateEnvVarsInObject<T>(obj: T): T {\n if (typeof obj === 'string') {\n return interpolateEnvVars(obj) as T\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => interpolateEnvVarsInObject(item)) as T\n }\n\n if (obj && typeof obj === 'object') {\n const result: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(obj)) {\n result[key] = interpolateEnvVarsInObject(value)\n }\n return result as T\n }\n\n return obj\n}\n\n/**\n * Convert team model profile to runtime model profile\n */\nexport function convertTeamModelProfile(\n teamProfile: TeamModelProfile,\n): ModelProfile {\n const now = Date.now()\n\n return {\n name: teamProfile.name,\n provider: teamProfile.provider,\n modelName: teamProfile.modelName,\n baseURL: teamProfile.baseURL,\n apiKey: interpolateEnvVars(teamProfile.apiKey),\n maxTokens: teamProfile.maxTokens,\n contextLength: teamProfile.contextLength,\n reasoningEffort: teamProfile.reasoningEffort,\n isActive: teamProfile.isActive ?? true,\n createdAt: now,\n lastUsed: now,\n }\n}\n\n/**\n * Convert team MCP config to runtime MCP config\n */\nexport function convertTeamMcpConfig(\n teamConfig: TeamMcpServerConfig,\n): McpServerConfig {\n if (teamConfig.type === 'sse') {\n return {\n type: 'sse',\n url: interpolateEnvVars(teamConfig.url || ''),\n enabled: teamConfig.enabled ?? true,\n }\n }\n\n // Default to stdio\n return {\n type: 'stdio',\n command: interpolateEnvVars(teamConfig.command || ''),\n args: (teamConfig.args || []).map(arg => interpolateEnvVars(arg)),\n env: teamConfig.env\n ? interpolateEnvVarsInObject(teamConfig.env)\n : undefined,\n enabled: teamConfig.enabled ?? true,\n }\n}\n\n/**\n * Fetch team configuration from a URL\n */\nexport async function fetchTeamConfig(url: string): Promise<TeamConfig> {\n debugLogger.state('TEAM_CONFIG_FETCH_START', { url })\n\n try {\n const response = await fetch(url)\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch config: ${response.status} ${response.statusText}`,\n )\n }\n\n const configText = await response.text()\n const config = JSON.parse(configText) as TeamConfig\n\n // Validate version\n if (config.version !== '1.0') {\n throw new Error(\n `Unsupported config version: ${config.version}. Expected 1.0`,\n )\n }\n\n debugLogger.state('TEAM_CONFIG_FETCH_SUCCESS', {\n url,\n configName: config.name,\n hasModels: !!config.models,\n hasMcpServers: !!config.mcpServers,\n })\n\n return config\n } catch (error) {\n debugLogger.error('TEAM_CONFIG_FETCH_ERROR', {\n url,\n error: error instanceof Error ? error.message : String(error),\n })\n throw error\n }\n}\n\n/**\n * Load team configuration from a local file\n */\nexport function loadTeamConfigFromFile(filePath: string): TeamConfig {\n debugLogger.state('TEAM_CONFIG_LOAD_FILE', { filePath })\n\n if (!existsSync(filePath)) {\n throw new Error(`Configuration file not found: ${filePath}`)\n }\n\n try {\n const configText = readFileSync(filePath, 'utf-8')\n const config = safeParseJSON(configText) as TeamConfig\n\n if (!config) {\n throw new Error('Invalid JSON in configuration file')\n }\n\n if (config.version !== '1.0') {\n throw new Error(\n `Unsupported config version: ${config.version}. Expected 1.0`,\n )\n }\n\n debugLogger.state('TEAM_CONFIG_LOAD_FILE_SUCCESS', {\n filePath,\n configName: config.name,\n })\n\n return config\n } catch (error) {\n debugLogger.error('TEAM_CONFIG_LOAD_FILE_ERROR', {\n filePath,\n error: error instanceof Error ? error.message : String(error),\n })\n throw error\n }\n}\n\n/**\n * Merge strategy for configuration\n */\nexport type MergeStrategy = 'replace' | 'merge' | 'skip-existing'\n\n/**\n * Apply team configuration to global config\n */\nexport function applyTeamConfig(\n teamConfig: TeamConfig,\n strategy: MergeStrategy = 'merge',\n): {\n applied: boolean\n modelsAdded: number\n mcpServersAdded: number\n settingsUpdated: string[]\n} {\n debugLogger.state('TEAM_CONFIG_APPLY_START', {\n configName: teamConfig.name,\n strategy,\n })\n\n const globalConfig = getGlobalConfig()\n let modelsAdded = 0\n let mcpServersAdded = 0\n const settingsUpdated: string[] = []\n\n // Apply model profiles\n if (teamConfig.models?.profiles) {\n const existingProfiles = globalConfig.modelProfiles || []\n const existingModelNames = new Set(\n existingProfiles.map(p => p.modelName),\n )\n\n for (const teamProfile of teamConfig.models.profiles) {\n const runtimeProfile = convertTeamModelProfile(teamProfile)\n\n if (strategy === 'skip-existing' && existingModelNames.has(runtimeProfile.modelName)) {\n debugLogger.state('TEAM_CONFIG_SKIP_MODEL', {\n modelName: runtimeProfile.modelName,\n reason: 'already_exists',\n })\n continue\n }\n\n if (strategy === 'replace') {\n // Remove existing profile with same modelName\n const index = existingProfiles.findIndex(\n p => p.modelName === runtimeProfile.modelName,\n )\n if (index !== -1) {\n existingProfiles.splice(index, 1)\n }\n }\n\n existingProfiles.push(runtimeProfile)\n modelsAdded++\n\n debugLogger.state('TEAM_CONFIG_ADD_MODEL', {\n modelName: runtimeProfile.modelName,\n provider: runtimeProfile.provider,\n })\n }\n\n globalConfig.modelProfiles = existingProfiles\n }\n\n // Apply model pointers\n if (teamConfig.models?.pointers) {\n globalConfig.modelPointers = {\n ...(globalConfig.modelPointers || { main: '', task: '', reasoning: '', quick: '' }),\n ...teamConfig.models.pointers,\n }\n settingsUpdated.push('modelPointers')\n }\n\n // Apply default model\n if (teamConfig.models?.defaultModel) {\n globalConfig.defaultModelName = teamConfig.models.defaultModel\n settingsUpdated.push('defaultModelName')\n }\n\n // Apply MCP servers\n if (teamConfig.mcpServers) {\n const existingMcpServers = globalConfig.mcpServers || {}\n const existingServerNames = new Set(Object.keys(existingMcpServers))\n\n for (const [serverName, teamMcpConfig] of Object.entries(\n teamConfig.mcpServers,\n )) {\n if (strategy === 'skip-existing' && existingServerNames.has(serverName)) {\n debugLogger.state('TEAM_CONFIG_SKIP_MCP', {\n serverName,\n reason: 'already_exists',\n })\n continue\n }\n\n const runtimeMcpConfig = convertTeamMcpConfig(teamMcpConfig)\n existingMcpServers[serverName] = runtimeMcpConfig\n mcpServersAdded++\n\n debugLogger.state('TEAM_CONFIG_ADD_MCP', {\n serverName,\n type: runtimeMcpConfig.type || 'stdio',\n })\n }\n\n globalConfig.mcpServers = existingMcpServers\n }\n\n // Apply global settings\n if (teamConfig.settings) {\n const { settings } = teamConfig\n\n if (settings.theme !== undefined) {\n globalConfig.theme = settings.theme\n settingsUpdated.push('theme')\n }\n\n if (settings.verbose !== undefined) {\n globalConfig.verbose = settings.verbose\n settingsUpdated.push('verbose')\n }\n\n if (settings.compressionMode !== undefined) {\n globalConfig.compressionMode = settings.compressionMode\n settingsUpdated.push('compressionMode')\n }\n\n if (settings.thinking !== undefined) {\n globalConfig.thinking = settings.thinking\n settingsUpdated.push('thinking')\n }\n\n if (settings.proxy !== undefined) {\n globalConfig.proxy = settings.proxy\n settingsUpdated.push('proxy')\n }\n\n if (settings.stream !== undefined) {\n globalConfig.stream = settings.stream\n settingsUpdated.push('stream')\n }\n }\n\n // Save updated config\n saveGlobalConfig(globalConfig)\n\n debugLogger.state('TEAM_CONFIG_APPLY_SUCCESS', {\n configName: teamConfig.name,\n modelsAdded,\n mcpServersAdded,\n settingsUpdated: settingsUpdated.join(', '),\n })\n\n return {\n applied: true,\n modelsAdded,\n mcpServersAdded,\n settingsUpdated,\n }\n}\n\n/**\n * Add marketplaces from URLs\n */\nexport async function addMarketplaces(\n marketplaceUrls: string[],\n): Promise<{ added: number; failed: number; errors: string[] }> {\n let added = 0\n let failed = 0\n const errors: string[] = []\n\n // Import marketplace manager\n const { addMarketplace } = await import('./marketplaceManager')\n\n for (const url of marketplaceUrls) {\n try {\n debugLogger.state('TEAM_CONFIG_ADD_MARKETPLACE', { url })\n\n await addMarketplace(url)\n added++\n\n debugLogger.state('TEAM_CONFIG_ADD_MARKETPLACE_SUCCESS', { url })\n } catch (error) {\n failed++\n const errorMsg = error instanceof Error ? error.message : String(error)\n errors.push(`${url}: ${errorMsg}`)\n\n debugLogger.error('TEAM_CONFIG_ADD_MARKETPLACE_ERROR', {\n url,\n error: errorMsg,\n })\n }\n }\n\n return { added, failed, errors }\n}\n\n/**\n * Install plugins from marketplaces\n */\nexport async function installPlugins(\n pluginNames: string[],\n targetDir?: string,\n): Promise<{ installed: number; failed: number; errors: string[] }> {\n let installed = 0\n let failed = 0\n const errors: string[] = []\n\n // Import marketplace manager and path utilities\n const { installPluginFromMarketplace } = await import('./marketplaceManager')\n const { join } = await import('path')\n const { homedir } = await import('os')\n\n // Default target: ~/.minto/plugins\n const installDir = targetDir || join(homedir(), '.minto', 'plugins')\n\n for (const pluginName of pluginNames) {\n try {\n debugLogger.state('TEAM_CONFIG_INSTALL_PLUGIN', {\n pluginName,\n targetDir: installDir,\n })\n\n await installPluginFromMarketplace(\n pluginName,\n undefined, // Search all marketplaces\n join(installDir, pluginName),\n )\n\n installed++\n debugLogger.state('TEAM_CONFIG_INSTALL_PLUGIN_SUCCESS', { pluginName })\n } catch (error) {\n failed++\n const errorMsg = error instanceof Error ? error.message : String(error)\n errors.push(`${pluginName}: ${errorMsg}`)\n\n debugLogger.error('TEAM_CONFIG_INSTALL_PLUGIN_ERROR', {\n pluginName,\n error: errorMsg,\n })\n }\n }\n\n return { installed, failed, errors }\n}\n"],
5
+ "mappings": "AAOA,SAAS,YAAY,oBAAoB;AACzC;AAAA,EACE;AAAA,EACA;AAAA,OAKK;AACP,SAAS,SAAS,mBAAmB;AACrC,SAAS,qBAAqB;AA0EvB,SAAS,mBAAmB,OAAuB;AACxD,SAAO,MAAM,QAAQ,kBAAkB,CAAC,OAAO,YAAY;AACzD,UAAM,WAAW,QAAQ,IAAI,QAAQ,KAAK,CAAC;AAC3C,QAAI,aAAa,QAAW;AAC1B,kBAAY,KAAK,qBAAqB;AAAA,QACpC;AAAA,QACA,UAAU;AAAA,MACZ,CAAC;AAED,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT,CAAC;AACH;AAKO,SAAS,2BAA8B,KAAW;AACvD,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,mBAAmB,GAAG;AAAA,EAC/B;AAEA,MAAI,MAAM,QAAQ,GAAG,GAAG;AACtB,WAAO,IAAI,IAAI,UAAQ,2BAA2B,IAAI,CAAC;AAAA,EACzD;AAEA,MAAI,OAAO,OAAO,QAAQ,UAAU;AAClC,UAAM,SAAkC,CAAC;AACzC,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,aAAO,GAAG,IAAI,2BAA2B,KAAK;AAAA,IAChD;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAKO,SAAS,wBACd,aACc;AACd,QAAM,MAAM,KAAK,IAAI;AAErB,SAAO;AAAA,IACL,MAAM,YAAY;AAAA,IAClB,UAAU,YAAY;AAAA,IACtB,WAAW,YAAY;AAAA,IACvB,SAAS,YAAY;AAAA,IACrB,QAAQ,mBAAmB,YAAY,MAAM;AAAA,IAC7C,WAAW,YAAY;AAAA,IACvB,e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-7/minto",
3
- "version": "0.0.12",
3
+ "version": "0.1.0",
4
4
  "bin": {
5
5
  "minto": "cli.js",
6
6
  "mt": "cli.js"