@1mcp/agent 0.30.3 → 0.31.0-beta1
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 +75 -2
- package/build/commands/auth/index.d.ts +3 -0
- package/build/commands/auth/index.d.ts.map +1 -0
- package/build/commands/auth/index.js +47 -0
- package/build/commands/auth/index.js.map +1 -0
- package/build/commands/auth/login.d.ts +7 -0
- package/build/commands/auth/login.d.ts.map +1 -0
- package/build/commands/auth/login.js +83 -0
- package/build/commands/auth/login.js.map +1 -0
- package/build/commands/auth/logout.d.ts +7 -0
- package/build/commands/auth/logout.d.ts.map +1 -0
- package/build/commands/auth/logout.js +46 -0
- package/build/commands/auth/logout.js.map +1 -0
- package/build/commands/auth/status.d.ts +6 -0
- package/build/commands/auth/status.d.ts.map +1 -0
- package/build/commands/auth/status.js +54 -0
- package/build/commands/auth/status.js.map +1 -0
- package/build/commands/cliSetup/cliSetup.d.ts +12 -0
- package/build/commands/cliSetup/cliSetup.d.ts.map +1 -0
- package/build/commands/cliSetup/cliSetup.js +49 -0
- package/build/commands/cliSetup/cliSetup.js.map +1 -0
- package/build/commands/cliSetup/index.d.ts +3 -0
- package/build/commands/cliSetup/index.d.ts.map +1 -0
- package/build/commands/cliSetup/index.js +52 -0
- package/build/commands/cliSetup/index.js.map +1 -0
- package/build/commands/cliSetup/setupFiles.d.ts +24 -0
- package/build/commands/cliSetup/setupFiles.d.ts.map +1 -0
- package/build/commands/cliSetup/setupFiles.js +233 -0
- package/build/commands/cliSetup/setupFiles.js.map +1 -0
- package/build/commands/inspect/index.d.ts +3 -0
- package/build/commands/inspect/index.d.ts.map +1 -0
- package/build/commands/inspect/index.js +60 -0
- package/build/commands/inspect/index.js.map +1 -0
- package/build/commands/inspect/inspect.d.ts +36 -0
- package/build/commands/inspect/inspect.d.ts.map +1 -0
- package/build/commands/inspect/inspect.js +274 -0
- package/build/commands/inspect/inspect.js.map +1 -0
- package/build/commands/inspect/inspectUtils.d.ts +76 -0
- package/build/commands/inspect/inspectUtils.d.ts.map +1 -0
- package/build/commands/inspect/inspectUtils.js +303 -0
- package/build/commands/inspect/inspectUtils.js.map +1 -0
- package/build/commands/instructions/index.d.ts +3 -0
- package/build/commands/instructions/index.d.ts.map +1 -0
- package/build/commands/instructions/index.js +34 -0
- package/build/commands/instructions/index.js.map +1 -0
- package/build/commands/instructions/instructions.d.ts +10 -0
- package/build/commands/instructions/instructions.d.ts.map +1 -0
- package/build/commands/instructions/instructions.js +86 -0
- package/build/commands/instructions/instructions.js.map +1 -0
- package/build/commands/instructions/instructionsUtils.d.ts +24 -0
- package/build/commands/instructions/instructionsUtils.d.ts.map +1 -0
- package/build/commands/instructions/instructionsUtils.js +74 -0
- package/build/commands/instructions/instructionsUtils.js.map +1 -0
- package/build/commands/proxy/proxy.d.ts.map +1 -1
- package/build/commands/proxy/proxy.js +26 -30
- package/build/commands/proxy/proxy.js.map +1 -1
- package/build/commands/run/index.d.ts +3 -0
- package/build/commands/run/index.d.ts.map +1 -0
- package/build/commands/run/index.js +62 -0
- package/build/commands/run/index.js.map +1 -0
- package/build/commands/run/run.d.ts +35 -0
- package/build/commands/run/run.d.ts.map +1 -0
- package/build/commands/run/run.js +340 -0
- package/build/commands/run/run.js.map +1 -0
- package/build/commands/run/runUtils.d.ts +49 -0
- package/build/commands/run/runUtils.d.ts.map +1 -0
- package/build/commands/run/runUtils.js +195 -0
- package/build/commands/run/runUtils.js.map +1 -0
- package/build/commands/shared/apiClient.d.ts +27 -0
- package/build/commands/shared/apiClient.d.ts.map +1 -0
- package/build/commands/shared/apiClient.js +96 -0
- package/build/commands/shared/apiClient.js.map +1 -0
- package/build/commands/shared/authProfileStore.d.ts +16 -0
- package/build/commands/shared/authProfileStore.d.ts.map +1 -0
- package/build/commands/shared/authProfileStore.js +109 -0
- package/build/commands/shared/authProfileStore.js.map +1 -0
- package/build/commands/shared/baseConfigUtils.d.ts.map +1 -1
- package/build/commands/shared/baseConfigUtils.js +28 -2
- package/build/commands/shared/baseConfigUtils.js.map +1 -1
- package/build/commands/shared/cliContext.d.ts +13 -0
- package/build/commands/shared/cliContext.d.ts.map +1 -0
- package/build/commands/shared/cliContext.js +71 -0
- package/build/commands/shared/cliContext.js.map +1 -0
- package/build/commands/shared/commandRunner.d.ts +3 -0
- package/build/commands/shared/commandRunner.d.ts.map +1 -0
- package/build/commands/shared/commandRunner.js +13 -0
- package/build/commands/shared/commandRunner.js.map +1 -0
- package/build/commands/shared/serveClient.d.ts +68 -0
- package/build/commands/shared/serveClient.d.ts.map +1 -0
- package/build/commands/shared/serveClient.js +204 -0
- package/build/commands/shared/serveClient.js.map +1 -0
- package/build/commands/shared/serveTargetResolver.d.ts +21 -0
- package/build/commands/shared/serveTargetResolver.d.ts.map +1 -0
- package/build/commands/shared/serveTargetResolver.js +33 -0
- package/build/commands/shared/serveTargetResolver.js.map +1 -0
- package/build/config/configManager.d.ts +10 -0
- package/build/config/configManager.d.ts.map +1 -1
- package/build/config/configManager.js +54 -2
- package/build/config/configManager.js.map +1 -1
- package/build/config/projectConfigLoader.d.ts +9 -0
- package/build/config/projectConfigLoader.d.ts.map +1 -1
- package/build/config/projectConfigLoader.js +72 -20
- package/build/config/projectConfigLoader.js.map +1 -1
- package/build/config/templateProcessor.d.ts.map +1 -1
- package/build/config/templateProcessor.js +2 -2
- package/build/config/templateProcessor.js.map +1 -1
- package/build/constants/api.d.ts +6 -0
- package/build/constants/api.d.ts.map +1 -1
- package/build/constants/api.js +7 -0
- package/build/constants/api.js.map +1 -1
- package/build/constants/mcp.d.ts +1 -1
- package/build/constants/mcp.d.ts.map +1 -1
- package/build/constants/mcp.js +1 -1
- package/build/constants/mcp.js.map +1 -1
- package/build/core/capabilities/lazyLoadingOrchestrator.d.ts +7 -2
- package/build/core/capabilities/lazyLoadingOrchestrator.d.ts.map +1 -1
- package/build/core/capabilities/lazyLoadingOrchestrator.js +12 -12
- package/build/core/capabilities/lazyLoadingOrchestrator.js.map +1 -1
- package/build/core/capabilities/metaToolProvider.d.ts +1 -1
- package/build/core/capabilities/metaToolProvider.d.ts.map +1 -1
- package/build/core/capabilities/metaToolProvider.js +22 -21
- package/build/core/capabilities/metaToolProvider.js.map +1 -1
- package/build/core/server/connectionResolver.d.ts +4 -0
- package/build/core/server/connectionResolver.d.ts.map +1 -1
- package/build/core/server/connectionResolver.js +18 -11
- package/build/core/server/connectionResolver.js.map +1 -1
- package/build/core/server/serverManager.d.ts +4 -0
- package/build/core/server/serverManager.d.ts.map +1 -1
- package/build/core/server/serverManager.js +6 -0
- package/build/core/server/serverManager.js.map +1 -1
- package/build/core/tools/handlers/serverManagementHandler.d.ts +2 -2
- package/build/core/tools/internal/schemas/discovery.d.ts +3 -3
- package/build/core/tools/internal/schemas/index.d.ts +4 -4
- package/build/core/tools/internal/schemas/management.d.ts +1 -1
- package/build/globalOptions.d.ts +6 -0
- package/build/globalOptions.d.ts.map +1 -1
- package/build/globalOptions.js +5 -0
- package/build/globalOptions.js.map +1 -1
- package/build/index.js +20 -1
- package/build/index.js.map +1 -1
- package/build/transport/http/routes/apiRoutes.d.ts +10 -0
- package/build/transport/http/routes/apiRoutes.d.ts.map +1 -0
- package/build/transport/http/routes/apiRoutes.js +18 -0
- package/build/transport/http/routes/apiRoutes.js.map +1 -0
- package/build/transport/http/routes/cliTokenRoute.d.ts +4 -0
- package/build/transport/http/routes/cliTokenRoute.d.ts.map +1 -0
- package/build/transport/http/routes/cliTokenRoute.js +35 -0
- package/build/transport/http/routes/cliTokenRoute.js.map +1 -0
- package/build/transport/http/routes/inspectHelpers.d.ts +68 -0
- package/build/transport/http/routes/inspectHelpers.d.ts.map +1 -0
- package/build/transport/http/routes/inspectHelpers.js +141 -0
- package/build/transport/http/routes/inspectHelpers.js.map +1 -0
- package/build/transport/http/routes/inspectRoutes.d.ts +8 -0
- package/build/transport/http/routes/inspectRoutes.d.ts.map +1 -0
- package/build/transport/http/routes/inspectRoutes.js +348 -0
- package/build/transport/http/routes/inspectRoutes.js.map +1 -0
- package/build/transport/http/routes/toolRoutes.d.ts +5 -0
- package/build/transport/http/routes/toolRoutes.d.ts.map +1 -0
- package/build/transport/http/routes/toolRoutes.js +204 -0
- package/build/transport/http/routes/toolRoutes.js.map +1 -0
- package/build/transport/http/server.d.ts.map +1 -1
- package/build/transport/http/server.js +16 -1
- package/build/transport/http/server.js.map +1 -1
- package/build/transport/http/utils/contextExtractor.d.ts +5 -1
- package/build/transport/http/utils/contextExtractor.d.ts.map +1 -1
- package/build/transport/http/utils/contextExtractor.js +75 -12
- package/build/transport/http/utils/contextExtractor.js.map +1 -1
- package/build/transport/stdioProxyTransport.d.ts +2 -2
- package/build/transport/stdioProxyTransport.d.ts.map +1 -1
- package/build/transport/stdioProxyTransport.js +11 -75
- package/build/transport/stdioProxyTransport.js.map +1 -1
- package/build/types/context.d.ts +1 -0
- package/build/types/context.d.ts.map +1 -1
- package/build/types/context.js.map +1 -1
- package/build/utils/context/contextHash.d.ts +11 -0
- package/build/utils/context/contextHash.d.ts.map +1 -0
- package/build/utils/context/contextHash.js +37 -0
- package/build/utils/context/contextHash.js.map +1 -0
- package/build/utils/typeGuards.d.ts +2 -0
- package/build/utils/typeGuards.d.ts.map +1 -0
- package/build/utils/typeGuards.js +4 -0
- package/build/utils/typeGuards.js.map +1 -0
- package/build/utils/urlUtils.d.ts +2 -0
- package/build/utils/urlUtils.d.ts.map +1 -0
- package/build/utils/urlUtils.js +4 -0
- package/build/utils/urlUtils.js.map +1 -0
- package/build/utils/validation/urlDetection.d.ts +1 -0
- package/build/utils/validation/urlDetection.d.ts.map +1 -1
- package/build/utils/validation/urlDetection.js +8 -3
- package/build/utils/validation/urlDetection.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ A unified Model Context Protocol server implementation that aggregates multiple
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
19
|
- **🔄 Unified Interface**: Aggregates multiple MCP servers into one
|
|
20
|
+
- **🧭 CLI Mode for Agents**: Preferred workflow for Codex, Claude, and other AI agents using progressive disclosure
|
|
20
21
|
- **🔒 OAuth 2.1 Authentication**: Production-ready security with scope-based authorization
|
|
21
22
|
- **⚡ High Performance**: Efficient request forwarding with proper error handling
|
|
22
23
|
- **🛡️ Security First**: Stdio transport isolation, input sanitization, and comprehensive audit logging
|
|
@@ -58,7 +59,13 @@ npx -y @1mcp/agent --help
|
|
|
58
59
|
1mcp
|
|
59
60
|
```
|
|
60
61
|
|
|
61
|
-
### 4.
|
|
62
|
+
### 4. Choose One Interface
|
|
63
|
+
|
|
64
|
+
Do not configure the same agent to use both direct MCP access and CLI mode at the same time.
|
|
65
|
+
|
|
66
|
+
If you switch an agent to CLI mode, remove that agent's existing MCP server configuration first. We recommend CLI mode for Codex, Claude, and similar agent-style sessions.
|
|
67
|
+
|
|
68
|
+
**If you intentionally want direct MCP mode instead**, connect that client to the unified endpoint:
|
|
62
69
|
|
|
63
70
|
**For Cursor**, add to `~/.cursor/mcp.json`:
|
|
64
71
|
|
|
@@ -94,7 +101,15 @@ npx -y @1mcp/agent --help
|
|
|
94
101
|
claude mcp add -t http 1mcp "http://127.0.0.1:3050/mcp?app=claude-code"
|
|
95
102
|
```
|
|
96
103
|
|
|
97
|
-
|
|
104
|
+
**Recommended: for Codex, Claude, and other agent-style CLI sessions, the user should run `1mcp cli-setup` instead of configuring direct MCP attachment:**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
1mcp cli-setup --codex
|
|
108
|
+
# or
|
|
109
|
+
1mcp cli-setup --claude --scope repo --repo-root .
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
That's it! Your MCP servers stay behind one unified 1MCP runtime, and each agent should use one mode only. For agent sessions, the recommended choice is CLI mode. 🎉
|
|
98
113
|
|
|
99
114
|
## Commands
|
|
100
115
|
|
|
@@ -104,9 +119,65 @@ That's it! All your MCP servers are now available through one unified endpoint.
|
|
|
104
119
|
- **`1mcp mcp add <name>`** - Add a new MCP server to configuration
|
|
105
120
|
- **`1mcp mcp list`** - List all configured MCP servers
|
|
106
121
|
- **`1mcp mcp status [name]`** - Show server status and details
|
|
122
|
+
- **`1mcp instructions`** - Show the CLI playbook and current server inventory for agent workflows
|
|
123
|
+
- **`1mcp inspect [target]`** - Inspect available servers, tools, and tool schemas from a running 1MCP instance
|
|
124
|
+
- **`1mcp run <server>/<tool>`** - Call a tool against a running 1MCP instance
|
|
125
|
+
- **`1mcp cli-setup --codex|--claude`** - Install bootstrap hooks and startup references for Codex or Claude
|
|
107
126
|
|
|
108
127
|
For detailed command usage, run: `1mcp <command> --help`
|
|
109
128
|
|
|
129
|
+
### CLI Workflow
|
|
130
|
+
|
|
131
|
+
The user-facing setup step is `1mcp cli-setup`. After that, the following CLI workflow is what the AI agent will normally run against a running `1mcp serve` instance.
|
|
132
|
+
|
|
133
|
+
You can still run these commands manually to test the setup:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Shell 1: start the aggregated MCP server
|
|
137
|
+
1mcp serve
|
|
138
|
+
|
|
139
|
+
# Shell 2: commands the AI agent will normally run
|
|
140
|
+
1mcp instructions
|
|
141
|
+
1mcp inspect context7
|
|
142
|
+
1mcp inspect context7/get-library-docs
|
|
143
|
+
1mcp run context7/get-library-docs --args '{"context7CompatibleLibraryID":"/mongodb/docs","topic":"aggregation pipeline"}'
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Why CLI Mode?
|
|
147
|
+
|
|
148
|
+
CLI mode is the preferred path for agent sessions because it replaces broad direct-MCP exposure inside the agent loop with progressive disclosure:
|
|
149
|
+
|
|
150
|
+
- `instructions` gives the playbook and current inventory
|
|
151
|
+
- `inspect <server>` narrows discovery to one server
|
|
152
|
+
- `inspect <server>/<tool>` narrows again to one tool schema
|
|
153
|
+
- `run` executes only the chosen tool
|
|
154
|
+
|
|
155
|
+
This keeps MCP as the backend protocol while giving the agent a thinner frontend workflow with less tool and schema noise in context.
|
|
156
|
+
|
|
157
|
+
For a given agent, choose only one mode:
|
|
158
|
+
|
|
159
|
+
- Direct MCP mode: keep that agent's MCP server config
|
|
160
|
+
- CLI mode: remove that agent's MCP server config, run `cli-setup`, and let the AI agent use the CLI workflow
|
|
161
|
+
|
|
162
|
+
What the user normally runs:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
1mcp cli-setup --codex
|
|
166
|
+
# or
|
|
167
|
+
1mcp cli-setup --claude --scope repo --repo-root .
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
What the AI agent normally runs after that:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
1mcp instructions
|
|
174
|
+
1mcp inspect filesystem
|
|
175
|
+
1mcp inspect filesystem/read_file
|
|
176
|
+
1mcp run filesystem/read_file --args '{"path":"./mcp.json"}'
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
You may run those commands manually to verify the setup, but they are primarily designed for the agent workflow.
|
|
180
|
+
|
|
110
181
|
## Documentation
|
|
111
182
|
|
|
112
183
|
📚 **[Complete Documentation](https://docs.1mcp.app)** - Comprehensive guides, API reference, and examples
|
|
@@ -124,6 +195,8 @@ For detailed command usage, run: `1mcp <command> --help`
|
|
|
124
195
|
|
|
125
196
|
1MCP acts as a proxy, managing and aggregating multiple MCP servers. It starts and stops these servers as subprocesses and forwards requests from AI assistants to the appropriate server. This architecture allows for a single point of entry for all MCP traffic, simplifying management and reducing overhead.
|
|
126
197
|
|
|
198
|
+
For agent sessions, 1MCP also provides a CLI mode on top of that runtime. MCP remains the interoperability layer behind `1mcp serve`; CLI mode changes how the agent discovers and calls tools so the workflow stays selective and scriptable.
|
|
199
|
+
|
|
127
200
|
## Contributing
|
|
128
201
|
|
|
129
202
|
Contributions are welcome! Please read our [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAiEnD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { runCliCommand } from '../../commands/shared/commandRunner.js';
|
|
2
|
+
import { globalOptions } from '../../globalOptions.js';
|
|
3
|
+
export function setupAuthCommands(yargs) {
|
|
4
|
+
return yargs.command('auth <subcommand>', 'Manage authentication profiles for secured 1MCP serve instances', (commandYargs) => {
|
|
5
|
+
commandYargs
|
|
6
|
+
.command('login', 'Save a bearer token for a 1MCP server URL', (sub) => sub
|
|
7
|
+
.options(globalOptions || {})
|
|
8
|
+
.option('url', {
|
|
9
|
+
alias: 'u',
|
|
10
|
+
describe: '1MCP server URL (auto-detected if omitted)',
|
|
11
|
+
type: 'string',
|
|
12
|
+
})
|
|
13
|
+
.option('token', {
|
|
14
|
+
alias: 't',
|
|
15
|
+
describe: 'Bearer token (reads from stdin if omitted)',
|
|
16
|
+
type: 'string',
|
|
17
|
+
}), async (argv) => {
|
|
18
|
+
const { authLoginCommand } = await import('./login.js');
|
|
19
|
+
await runCliCommand(argv, authLoginCommand);
|
|
20
|
+
})
|
|
21
|
+
.command('status', 'Show saved authentication profiles', (sub) => sub.options(globalOptions || {}).option('url', {
|
|
22
|
+
alias: 'u',
|
|
23
|
+
describe: 'Check a specific server URL',
|
|
24
|
+
type: 'string',
|
|
25
|
+
}), async (argv) => {
|
|
26
|
+
const { authStatusCommand } = await import('./status.js');
|
|
27
|
+
await runCliCommand(argv, authStatusCommand);
|
|
28
|
+
})
|
|
29
|
+
.command('logout', 'Remove a saved authentication profile', (sub) => sub
|
|
30
|
+
.options(globalOptions || {})
|
|
31
|
+
.option('url', {
|
|
32
|
+
alias: 'u',
|
|
33
|
+
describe: 'Server URL to remove',
|
|
34
|
+
type: 'string',
|
|
35
|
+
})
|
|
36
|
+
.option('all', {
|
|
37
|
+
describe: 'Remove all saved profiles',
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
default: false,
|
|
40
|
+
}), async (argv) => {
|
|
41
|
+
const { authLogoutCommand } = await import('./logout.js');
|
|
42
|
+
await runCliCommand(argv, authLogoutCommand);
|
|
43
|
+
})
|
|
44
|
+
.demandCommand(1, 'Specify a subcommand: login, status, or logout');
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItD,MAAM,UAAU,iBAAiB,CAAC,KAAW;IAC3C,OAAO,KAAK,CAAC,OAAO,CAClB,mBAAmB,EACnB,iEAAiE,EACjE,CAAC,YAAY,EAAE,EAAE;QACf,YAAY;aACT,OAAO,CACN,OAAO,EACP,2CAA2C,EAC3C,CAAC,GAAG,EAAE,EAAE,CACN,GAAG;aACA,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;aAC5B,MAAM,CAAC,KAAK,EAAE;YACb,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,4CAA4C;YACtD,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,OAAO,EAAE;YACf,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,4CAA4C;YACtD,IAAI,EAAE,QAAQ;SACf,CAAC,EACN,KAAK,EAAE,IAAI,EAAE,EAAE;YACb,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;YACxD,MAAM,aAAa,CAAC,IAA8C,EAAE,gBAAgB,CAAC,CAAC;QACxF,CAAC,CACF;aACA,OAAO,CACN,QAAQ,EACR,oCAAoC,EACpC,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE;YAC7C,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,6BAA6B;YACvC,IAAI,EAAE,QAAQ;SACf,CAAC,EACJ,KAAK,EAAE,IAAI,EAAE,EAAE;YACb,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;YAC1D,MAAM,aAAa,CAAC,IAA+C,EAAE,iBAAiB,CAAC,CAAC;QAC1F,CAAC,CACF;aACA,OAAO,CACN,QAAQ,EACR,uCAAuC,EACvC,CAAC,GAAG,EAAE,EAAE,CACN,GAAG;aACA,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;aAC5B,MAAM,CAAC,KAAK,EAAE;YACb,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,sBAAsB;YAChC,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,KAAK,EAAE;YACb,QAAQ,EAAE,2BAA2B;YACrC,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACf,CAAC,EACN,KAAK,EAAE,IAAI,EAAE,EAAE;YACb,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;YAC1D,MAAM,aAAa,CAAC,IAA+C,EAAE,iBAAiB,CAAC,CAAC;QAC1F,CAAC,CACF;aACA,aAAa,CAAC,CAAC,EAAE,gDAAgD,CAAC,CAAC;IACxE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GlobalOptions } from '../../globalOptions.js';
|
|
2
|
+
export interface AuthLoginOptions extends GlobalOptions {
|
|
3
|
+
url?: string;
|
|
4
|
+
token?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function authLoginCommand(options: AuthLoginOptions): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiD/E"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ApiClient } from '../../commands/shared/apiClient.js';
|
|
2
|
+
import { normalizeServerUrl, saveAuthProfile } from '../../commands/shared/authProfileStore.js';
|
|
3
|
+
import { API_INSPECT_ENDPOINT } from '../../constants/api.js';
|
|
4
|
+
import { stripMcpSuffix } from '../../utils/urlUtils.js';
|
|
5
|
+
import { discoverServerWithPidFile } from '../../utils/validation/urlDetection.js';
|
|
6
|
+
export async function authLoginCommand(options) {
|
|
7
|
+
const { url: discoveredUrl, source } = await discoverServerWithPidFile(options['config-dir'], options.url);
|
|
8
|
+
const baseUrl = normalizeServerUrl(stripMcpSuffix(discoveredUrl));
|
|
9
|
+
if (source !== 'user') {
|
|
10
|
+
process.stderr.write(`Auto-detected server at ${baseUrl} (via ${source})\n`);
|
|
11
|
+
}
|
|
12
|
+
// Probe without auth — if it succeeds, auth is disabled
|
|
13
|
+
const probeClient = new ApiClient({ baseUrl });
|
|
14
|
+
const probeResponse = await probeClient.get(API_INSPECT_ENDPOINT);
|
|
15
|
+
if (probeResponse.ok) {
|
|
16
|
+
process.stdout.write(`Auth is not required on ${baseUrl} (auth is disabled). No login needed.\n`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// Resolve token: explicit flag > stdin > localhost auto-generate
|
|
20
|
+
let token = options.token || (await readTokenFromStdin());
|
|
21
|
+
if (!token && isLocalhostUrl(baseUrl)) {
|
|
22
|
+
token = await tryCliTokenGeneration(baseUrl);
|
|
23
|
+
}
|
|
24
|
+
if (!token) {
|
|
25
|
+
throw new Error('No token provided. Use --token or pipe a token via stdin.\n' +
|
|
26
|
+
`To get a token, visit ${baseUrl}/oauth or run the OAuth flow.`);
|
|
27
|
+
}
|
|
28
|
+
// Validate token
|
|
29
|
+
const client = new ApiClient({ baseUrl, bearerToken: token });
|
|
30
|
+
const response = await client.get(API_INSPECT_ENDPOINT);
|
|
31
|
+
if (response.status === 401 || response.status === 403) {
|
|
32
|
+
throw new Error(`Authentication failed: token was rejected by ${baseUrl}`);
|
|
33
|
+
}
|
|
34
|
+
if (!response.ok && response.status !== 0) {
|
|
35
|
+
process.stderr.write(`Warning: server returned HTTP ${response.status}, saving token anyway.\n`);
|
|
36
|
+
}
|
|
37
|
+
await saveAuthProfile(options['config-dir'], {
|
|
38
|
+
serverUrl: baseUrl,
|
|
39
|
+
token,
|
|
40
|
+
savedAt: Date.now(),
|
|
41
|
+
});
|
|
42
|
+
process.stdout.write(`Saved authentication profile for ${baseUrl}\n`);
|
|
43
|
+
}
|
|
44
|
+
function isLocalhostUrl(url) {
|
|
45
|
+
try {
|
|
46
|
+
const hostname = new URL(url).hostname;
|
|
47
|
+
return hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '::1' || hostname === '[::1]';
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function tryCliTokenGeneration(baseUrl) {
|
|
54
|
+
try {
|
|
55
|
+
const client = new ApiClient({ baseUrl });
|
|
56
|
+
const response = await client.post('/api/auth/cli-token', {});
|
|
57
|
+
if (response.ok && response.data?.token) {
|
|
58
|
+
process.stderr.write('Auto-generated CLI token for localhost.\n');
|
|
59
|
+
return response.data.token;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// endpoint not available, fall through
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
async function readTokenFromStdin() {
|
|
68
|
+
if (process.stdin.isTTY) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return new Promise((resolve) => {
|
|
72
|
+
let data = '';
|
|
73
|
+
process.stdin.setEncoding('utf8');
|
|
74
|
+
process.stdin.on('data', (chunk) => {
|
|
75
|
+
data += chunk;
|
|
76
|
+
});
|
|
77
|
+
process.stdin.on('end', () => {
|
|
78
|
+
resolve(data.trim() || null);
|
|
79
|
+
});
|
|
80
|
+
process.stdin.on('error', () => resolve(null));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAOlF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAyB;IAC9D,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM,yBAAyB,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3G,MAAM,OAAO,GAAG,kBAAkB,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;IAElE,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,OAAO,SAAS,MAAM,KAAK,CAAC,CAAC;IAC/E,CAAC;IAED,wDAAwD;IACxD,MAAM,WAAW,GA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C,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YACjC,IAAI,IAAI,KAAK,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GlobalOptions } from '../../globalOptions.js';
|
|
2
|
+
export interface AuthLogoutOptions extends GlobalOptions {
|
|
3
|
+
url?: string;
|
|
4
|
+
all?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function authLogoutCommand(options: AuthLogoutOptions): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/logout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0CjF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { deleteAuthProfile, listAuthProfiles, normalizeServerUrl } from '../../commands/shared/authProfileStore.js';
|
|
2
|
+
import { stripMcpSuffix } from '../../utils/urlUtils.js';
|
|
3
|
+
import { discoverServerWithPidFile } from '../../utils/validation/urlDetection.js';
|
|
4
|
+
export async function authLogoutCommand(options) {
|
|
5
|
+
if (options.all) {
|
|
6
|
+
const profiles = await listAuthProfiles(options['config-dir']);
|
|
7
|
+
if (profiles.length === 0) {
|
|
8
|
+
process.stdout.write('No saved profiles to remove.\n');
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
for (const profile of profiles) {
|
|
12
|
+
await deleteAuthProfile(options['config-dir'], profile.serverUrl);
|
|
13
|
+
}
|
|
14
|
+
process.stdout.write(`Removed ${profiles.length} profile${profiles.length !== 1 ? 's' : ''}.\n`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (!options.url) {
|
|
18
|
+
let discoveredUrl;
|
|
19
|
+
let source;
|
|
20
|
+
try {
|
|
21
|
+
({ url: discoveredUrl, source } = await discoverServerWithPidFile(options['config-dir']));
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
throw new Error('Specify --url <server-url> or --all. No running server detected for auto-discovery.');
|
|
25
|
+
}
|
|
26
|
+
const baseUrl = normalizeServerUrl(stripMcpSuffix(discoveredUrl));
|
|
27
|
+
process.stderr.write(`Auto-detected server at ${baseUrl} (via ${source})\n`);
|
|
28
|
+
const removed = await deleteAuthProfile(options['config-dir'], baseUrl);
|
|
29
|
+
if (removed) {
|
|
30
|
+
process.stdout.write(`Removed profile for ${baseUrl}\n`);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
process.stdout.write(`No saved profile for ${baseUrl}\n`);
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const baseUrl = normalizeServerUrl(options.url);
|
|
38
|
+
const removed = await deleteAuthProfile(options['config-dir'], baseUrl);
|
|
39
|
+
if (removed) {
|
|
40
|
+
process.stdout.write(`Removed profile for ${baseUrl}\n`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
process.stdout.write(`No saved profile for ${base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,MAAM,CAAC;CACd;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BjF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ApiClient } from '../../commands/shared/apiClient.js';
|
|
2
|
+
import { listAuthProfiles, loadAuthProfile, normalizeServerUrl } from '../../commands/shared/authProfileStore.js';
|
|
3
|
+
import { API_INSPECT_ENDPOINT } from '../../constants/api.js';
|
|
4
|
+
import { stripMcpSuffix } from '../../utils/urlUtils.js';
|
|
5
|
+
import { discoverServerWithPidFile } from '../../utils/validation/urlDetection.js';
|
|
6
|
+
export async function authStatusCommand(options) {
|
|
7
|
+
if (options.url) {
|
|
8
|
+
await showProfileStatus(options['config-dir'], normalizeServerUrl(options.url));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
// Try auto-discovery first
|
|
12
|
+
try {
|
|
13
|
+
const { url: discoveredUrl, source } = await discoverServerWithPidFile(options['config-dir']);
|
|
14
|
+
const baseUrl = normalizeServerUrl(stripMcpSuffix(discoveredUrl));
|
|
15
|
+
process.stderr.write(`Auto-detected server at ${baseUrl} (via ${source})\n`);
|
|
16
|
+
await showProfileStatus(options['config-dir'], baseUrl);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// No server found, fall through to list all profiles
|
|
21
|
+
}
|
|
22
|
+
const profiles = await listAuthProfiles(options['config-dir']);
|
|
23
|
+
if (profiles.length === 0) {
|
|
24
|
+
process.stdout.write('No saved authentication profiles.\n');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
process.stdout.write(`Saved profiles (${profiles.length}):\n`);
|
|
28
|
+
for (const profile of profiles) {
|
|
29
|
+
const savedAt = new Date(profile.savedAt).toLocaleString();
|
|
30
|
+
process.stdout.write(` - ${profile.serverUrl} (saved ${savedAt})\n`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async function showProfileStatus(configDir, baseUrl) {
|
|
34
|
+
const profile = await loadAuthProfile(configDir, baseUrl);
|
|
35
|
+
if (!profile) {
|
|
36
|
+
process.stdout.write(`No saved profile for ${baseUrl}\n`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const savedAt = new Date(profile.savedAt).toLocaleString();
|
|
40
|
+
process.stdout.write(`Profile: ${baseUrl}\n`);
|
|
41
|
+
process.stdout.write(` Saved: ${savedAt}\n`);
|
|
42
|
+
const client = new ApiClient({ baseUrl, bearerToken: profile.token });
|
|
43
|
+
const response = await client.get(API_INSPECT_ENDPOINT);
|
|
44
|
+
if (response.ok) {
|
|
45
|
+
process.stdout.write(` Status: connected\n`);
|
|
46
|
+
}
|
|
47
|
+
else if (response.status === 401 || response.status === 403) {
|
|
48
|
+
process.stdout.write(` Status: token rejected (HTTP ${response.status})\n`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
process.stdout.write(` Status: unreachable (${response.error ?? `HTTP ${response.status}`})\n`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/auth/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACjH,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAMlF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAA0B;IAChE,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,MAAM,iBAAiB,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,kBAAkB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AC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,OAAO,IAAI,CAAC,CAAC;QAC1D,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,CAAC;IAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,OAAO,IAAI,CAAC,CAAC;IAC9C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,OAAO,IAAI,CAAC,CAAC;IAE9C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACxD,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;QAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAChD,CAAC;SAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC9D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC;IAC/E,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,QAAQ,CAAC,KAAK,IAAI,QAAQ,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GlobalOptions } from '../../globalOptions.js';
|
|
2
|
+
import { type CliSetupTarget } from './setupFiles.js';
|
|
3
|
+
export interface CliSetupCommandOptions extends GlobalOptions {
|
|
4
|
+
scope?: string;
|
|
5
|
+
claude?: boolean;
|
|
6
|
+
codex?: boolean;
|
|
7
|
+
'repo-root'?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function cliSetupCommand(options: CliSetupCommandOptions): Promise<void>;
|
|
10
|
+
export declare function formatCodexConfigNotice(): string;
|
|
11
|
+
export declare function resolveCliSetupTargetsFromFlags(options: Pick<CliSetupCommandOptions, 'claude' | 'codex'>): CliSetupTarget[];
|
|
12
|
+
//# sourceMappingURL=cliSetup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliSetup.d.ts","sourceRoot":"","sources":["../../../src/commands/cliSetup/cliSetup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,cAAc,EAAkE,MAAM,iBAAiB,CAAC;AAEtH,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAapF;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAmBhD;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,OAAO,CAAC,GACxD,cAAc,EAAE,CAmBlB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { formatCliSetupOutput, resolveCliSetupScope, writeCliSetupFiles } from './setupFiles.js';
|
|
2
|
+
export async function cliSetupCommand(options) {
|
|
3
|
+
const targets = resolveCliSetupTargetsFromFlags(options);
|
|
4
|
+
const results = await writeCliSetupFiles({
|
|
5
|
+
repoRoot: options['repo-root'] ?? process.cwd(),
|
|
6
|
+
scope: resolveCliSetupScope(options.scope),
|
|
7
|
+
targets,
|
|
8
|
+
});
|
|
9
|
+
process.stdout.write(`${formatCliSetupOutput(results)}\n`);
|
|
10
|
+
if (targets.includes('codex')) {
|
|
11
|
+
process.stdout.write(`\n${formatCodexConfigNotice()}\n`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function formatCodexConfigNotice() {
|
|
15
|
+
const configContent = [
|
|
16
|
+
'approval_policy = "on-request"',
|
|
17
|
+
'sandbox_mode = "workspace-write"',
|
|
18
|
+
'',
|
|
19
|
+
'[sandbox_workspace_write]',
|
|
20
|
+
'network_access = true',
|
|
21
|
+
'',
|
|
22
|
+
'[features]',
|
|
23
|
+
'codex_hooks = true',
|
|
24
|
+
].join('\n');
|
|
25
|
+
return [
|
|
26
|
+
'Action required: update your Codex config.toml (~/.codex/config.toml) to include:',
|
|
27
|
+
'',
|
|
28
|
+
configContent,
|
|
29
|
+
'',
|
|
30
|
+
'This enables hooks support and allows 1MCP to run within the Codex sandbox.',
|
|
31
|
+
].join('\n');
|
|
32
|
+
}
|
|
33
|
+
export function resolveCliSetupTargetsFromFlags(options) {
|
|
34
|
+
const targets = [];
|
|
35
|
+
if (options.codex) {
|
|
36
|
+
targets.push('codex');
|
|
37
|
+
}
|
|
38
|
+
if (options.claude) {
|
|
39
|
+
targets.push('claude');
|
|
40
|
+
}
|
|
41
|
+
if (targets.length === 0) {
|
|
42
|
+
throw new Error('Specify exactly one client: use `--codex` or `--claude`.');
|
|
43
|
+
}
|
|
44
|
+
if (targets.length > 1) {
|
|
45
|
+
throw new Error('Specify only one client at a time: use either `--codex` or `--claude`.');
|
|
46
|
+
}
|
|
47
|
+
return targets;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=cliSetup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliSetup.js","sourceRoot":"","sources":["../../../src/commands/cliSetup/cliSetup.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,oBAAoB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAA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CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cliSetup/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CA4DtD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { globalOptions } from '../../globalOptions.js';
|
|
2
|
+
export function setupCliSetupCommand(yargs) {
|
|
3
|
+
return yargs.command('cli-setup', 'Install 1MCP CLI hooks and reference files for Codex and Claude', (commandYargs) => commandYargs
|
|
4
|
+
.options(globalOptions || {})
|
|
5
|
+
.option('scope', {
|
|
6
|
+
describe: 'Setup scope',
|
|
7
|
+
type: 'string',
|
|
8
|
+
choices: ['global', 'repo', 'all'],
|
|
9
|
+
default: 'global',
|
|
10
|
+
})
|
|
11
|
+
.option('codex', {
|
|
12
|
+
describe: 'Install setup files for Codex only',
|
|
13
|
+
type: 'boolean',
|
|
14
|
+
default: false,
|
|
15
|
+
})
|
|
16
|
+
.option('claude', {
|
|
17
|
+
describe: 'Install setup files for Claude only',
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
default: false,
|
|
20
|
+
})
|
|
21
|
+
.option('repo-root', {
|
|
22
|
+
describe: 'Repository root used for repo-scoped setup',
|
|
23
|
+
type: 'string',
|
|
24
|
+
})
|
|
25
|
+
.check((argv) => {
|
|
26
|
+
const selected = [argv.codex, argv.claude].filter(Boolean);
|
|
27
|
+
if (selected.length === 0) {
|
|
28
|
+
throw new Error('Specify exactly one client: use `--codex` or `--claude`.');
|
|
29
|
+
}
|
|
30
|
+
if (selected.length > 1) {
|
|
31
|
+
throw new Error('Specify only one client at a time: use either `--codex` or `--claude`.');
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
})
|
|
35
|
+
.example('$0 cli-setup --codex', 'Install global Codex hooks and reference files')
|
|
36
|
+
.example('$0 cli-setup --claude --scope repo --repo-root .', 'Install repo-local Claude hooks and reference files')
|
|
37
|
+
.example('$0 cli-setup --codex --scope all', 'Install global and repo-local Codex setup')
|
|
38
|
+
.epilogue('This command writes hook config and lightweight startup-file references. Errors are written to stderr only.'), async (argv) => {
|
|
39
|
+
const { configureGlobalLogger } = await import('../../logger/configureGlobalLogger.js');
|
|
40
|
+
const { cliSetupCommand } = await import('./cliSetup.js');
|
|
41
|
+
configureGlobalLogger(argv, 'stdio');
|
|
42
|
+
try {
|
|
43
|
+
await cliSetupCommand(argv);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
47
|
+
process.stderr.write(`${message}\n`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cliSetup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItD,MAAM,UAAU,oBAAoB,CAAC,KAAW;IAC9C,OAAO,KAAK,CAAC,OAAO,CAClB,WAAW,EACX,iEAAiE,EACjE,CAAC,YAAY,EAAE,EAAE,CACf,YAAY;SACT,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,OAAO,EAAE;QACf,QAAQ,EAAE,aAAa;QACvB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,QAAQ,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ACrC,IAAI,CAAC;YACH,MAAM,eAAe,CAAC,IAA6C,CAAC,CAAC;QACvE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;YACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const CLI_SETUP_TARGETS: readonly ["codex", "claude"];
|
|
2
|
+
export type CliSetupTarget = (typeof CLI_SETUP_TARGETS)[number];
|
|
3
|
+
export declare const CLI_SETUP_SCOPES: readonly ["global", "repo", "all"];
|
|
4
|
+
export type CliSetupScope = (typeof CLI_SETUP_SCOPES)[number];
|
|
5
|
+
interface WriteCliSetupOptions {
|
|
6
|
+
repoRoot: string;
|
|
7
|
+
scope: CliSetupScope;
|
|
8
|
+
targets: CliSetupTarget[];
|
|
9
|
+
}
|
|
10
|
+
export interface CliSetupWriteResult {
|
|
11
|
+
path: string;
|
|
12
|
+
changed: boolean;
|
|
13
|
+
kind: 'hook' | 'startup-doc' | 'managed-doc';
|
|
14
|
+
target: CliSetupTarget;
|
|
15
|
+
scope: Exclude<CliSetupScope, 'all'>;
|
|
16
|
+
}
|
|
17
|
+
export declare function resolveCliSetupScope(rawScope?: string): CliSetupScope;
|
|
18
|
+
export declare function writeCliSetupFiles(options: WriteCliSetupOptions): Promise<CliSetupWriteResult[]>;
|
|
19
|
+
export declare function formatCliSetupOutput(results: CliSetupWriteResult[]): string;
|
|
20
|
+
export declare function renderManagedDocContent(): string;
|
|
21
|
+
export declare function renderStartupDocManagedBlock(startupDocPath: string, managedDocPath: string): string;
|
|
22
|
+
export declare function upsertStartupDocManagedBlock(existingContent: string, managedBlock: string): string;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=setupFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupFiles.d.ts","sourceRoot":"","sources":["../../../src/commands/cliSetup/setupFiles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB,8BAA+B,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,gBAAgB,oCAAqC,CAAC;AACnE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAkB9D,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC;IAC7C,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;CACtC;AAsBD,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAWrE;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAiBtG;AAsBD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAO3E;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAkBhD;AAED,wBAAgB,4BAA4B,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAGnG;AAED,wBAAgB,4BAA4B,CAAC,eA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