mnotes-cli 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/connect/index.js +15 -23
- package/package.json +1 -1
|
@@ -40,6 +40,7 @@ const fs = __importStar(require("fs"));
|
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const config_utils_1 = require("./config-utils");
|
|
42
42
|
const workspace_prompt_1 = require("./workspace-prompt");
|
|
43
|
+
const config_1 = require("../../config");
|
|
43
44
|
const claude_code_1 = require("../../templates/claude-code");
|
|
44
45
|
const codex_1 = require("../../templates/codex");
|
|
45
46
|
const openclaw_1 = require("../../templates/openclaw");
|
|
@@ -91,11 +92,11 @@ function printConnectionStatus() {
|
|
|
91
92
|
* prompts interactively after validating the connection.
|
|
92
93
|
*/
|
|
93
94
|
async function resolveWorkspace(opts) {
|
|
94
|
-
//
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
return
|
|
98
|
-
//
|
|
95
|
+
// Check flag, env, dir map, global config
|
|
96
|
+
const fromConfig = (0, config_1.resolveConfig)({ workspaceId: opts.workspace });
|
|
97
|
+
if (fromConfig.workspaceId)
|
|
98
|
+
return fromConfig.workspaceId;
|
|
99
|
+
// Nothing stored — interactive selection/creation
|
|
99
100
|
const resolved = await (0, workspace_prompt_1.resolveWorkspaceInteractively)(opts.url, opts.apiKey);
|
|
100
101
|
return resolved.id;
|
|
101
102
|
}
|
|
@@ -110,12 +111,9 @@ function normalizeBaseUrl(raw) {
|
|
|
110
111
|
return raw.replace(/\/+$/, "").replace(/\/api\/mcp$/i, "");
|
|
111
112
|
}
|
|
112
113
|
async function handleClaudeCode(opts) {
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
process.stderr.write("Error: API key required. Use --api-key or set MNOTES_API_KEY\n");
|
|
117
|
-
process.exit(1);
|
|
118
|
-
}
|
|
114
|
+
const config = (0, config_1.resolveConfig)(opts);
|
|
115
|
+
const url = normalizeBaseUrl(config.baseUrl);
|
|
116
|
+
const apiKey = config.apiKey;
|
|
119
117
|
const validation = await (0, config_utils_1.validateConnection)(url, apiKey);
|
|
120
118
|
if (!validation.ok) {
|
|
121
119
|
process.stderr.write(`Error: Cannot connect to ${url}: ${validation.error}\n`);
|
|
@@ -179,12 +177,9 @@ function printScaffoldResults(results) {
|
|
|
179
177
|
* Handles the `codex` integration target.
|
|
180
178
|
*/
|
|
181
179
|
async function handleCodex(opts) {
|
|
182
|
-
const
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
process.stderr.write("Error: API key required. Use --api-key or set MNOTES_API_KEY\n");
|
|
186
|
-
process.exit(1);
|
|
187
|
-
}
|
|
180
|
+
const config = (0, config_1.resolveConfig)(opts);
|
|
181
|
+
const url = normalizeBaseUrl(config.baseUrl);
|
|
182
|
+
const apiKey = config.apiKey;
|
|
188
183
|
const validation = await (0, config_utils_1.validateConnection)(url, apiKey);
|
|
189
184
|
if (!validation.ok) {
|
|
190
185
|
process.stderr.write(`Error: Cannot connect to ${url}: ${validation.error}\n`);
|
|
@@ -216,13 +211,10 @@ async function handleCodex(opts) {
|
|
|
216
211
|
* Handles the `openclaw` integration target.
|
|
217
212
|
*/
|
|
218
213
|
async function handleOpenClaw(opts) {
|
|
219
|
-
const
|
|
220
|
-
const
|
|
214
|
+
const config = (0, config_1.resolveConfig)(opts);
|
|
215
|
+
const url = normalizeBaseUrl(config.baseUrl);
|
|
216
|
+
const apiKey = config.apiKey;
|
|
221
217
|
const configPath = opts.configPath || path.join(process.env.HOME || "~", ".openclaw", "mcp.json");
|
|
222
|
-
if (!apiKey) {
|
|
223
|
-
process.stderr.write("Error: API key required. Use --api-key or set MNOTES_API_KEY\n");
|
|
224
|
-
process.exit(1);
|
|
225
|
-
}
|
|
226
218
|
const validation = await (0, config_utils_1.validateConnection)(url, apiKey);
|
|
227
219
|
if (!validation.ok) {
|
|
228
220
|
process.stderr.write(`Error: Cannot connect to ${url}: ${validation.error}\n`);
|