@ductape/mcp 0.2.2 → 0.2.3
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/index.js +39 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { createRequire } from 'module';
|
|
13
13
|
import { execSync } from 'child_process';
|
|
14
|
+
import { homedir } from 'os';
|
|
15
|
+
import { delimiter, join } from 'path';
|
|
14
16
|
import { z } from 'zod';
|
|
15
17
|
import { executeViaProxy, generateExecutablePayload, getAssetSchemas, } from './proxy-client.js';
|
|
16
18
|
const MODULES = [
|
|
@@ -141,9 +143,10 @@ There are THREE categories of operations. Use the right tool for each:
|
|
|
141
143
|
ductape_cli("resources database create -f db-config.json")
|
|
142
144
|
This applies to: products, apps, and resources (databases, storage, caches, etc.),
|
|
143
145
|
cloud connections, and secrets. Environments have their own CLI commands (see below);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
through
|
|
146
|
+
App actions and auths are configured in the Workbench UI. Quotas, fallbacks, jobs, and
|
|
147
|
+
healthchecks are administrative resources managed with ductape_cli("resources <type> ...").
|
|
148
|
+
Features have no CLI create command because their definitions are code-first through
|
|
149
|
+
features.define.
|
|
147
150
|
|
|
148
151
|
⚠ MULTI-ENV REQUIREMENT — applies to ALL product assets (storage, database, cache,
|
|
149
152
|
messageBroker, graph, vector, and any other resource with an envs array):
|
|
@@ -1175,15 +1178,19 @@ function checkCli() {
|
|
|
1175
1178
|
try {
|
|
1176
1179
|
const out = execSync('ductape --version', {
|
|
1177
1180
|
encoding: 'utf8',
|
|
1178
|
-
timeout:
|
|
1181
|
+
timeout: 15000,
|
|
1179
1182
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
1180
1183
|
env: cliEnvironment(),
|
|
1181
1184
|
cwd: cliCwd(),
|
|
1182
1185
|
}).trim();
|
|
1183
1186
|
return { available: true, version: out || 'unknown' };
|
|
1184
1187
|
}
|
|
1185
|
-
catch {
|
|
1186
|
-
|
|
1188
|
+
catch (error) {
|
|
1189
|
+
const message = String(error?.stderr || error?.message || error);
|
|
1190
|
+
const commandMissing = error?.code === 'ENOENT' ||
|
|
1191
|
+
error?.status === 127 ||
|
|
1192
|
+
/\b(command not found|not recognized as an internal|no such file or directory)\b/i.test(message);
|
|
1193
|
+
return { available: !commandMissing };
|
|
1187
1194
|
}
|
|
1188
1195
|
}
|
|
1189
1196
|
function checkLoginState() {
|
|
@@ -1298,6 +1305,18 @@ function runCli(command) {
|
|
|
1298
1305
|
function cliEnvironment() {
|
|
1299
1306
|
const environment = { ...process.env };
|
|
1300
1307
|
delete environment.DUCTAPE_ACCESS_KEY;
|
|
1308
|
+
const pathKey = Object.keys(environment).find((key) => key.toLowerCase() === 'path') ?? 'PATH';
|
|
1309
|
+
const configuredPath = environment[pathKey] ?? '';
|
|
1310
|
+
const fallbackBins = [
|
|
1311
|
+
join(homedir(), '.npm-global', 'bin'),
|
|
1312
|
+
join(homedir(), '.local', 'bin'),
|
|
1313
|
+
'/opt/homebrew/bin',
|
|
1314
|
+
'/usr/local/bin',
|
|
1315
|
+
];
|
|
1316
|
+
environment[pathKey] = [...new Set([
|
|
1317
|
+
...configuredPath.split(delimiter).filter(Boolean),
|
|
1318
|
+
...fallbackBins,
|
|
1319
|
+
])].join(delimiter);
|
|
1301
1320
|
return environment;
|
|
1302
1321
|
}
|
|
1303
1322
|
/**
|
|
@@ -2788,10 +2807,13 @@ Resilience covers three mechanisms: quotas (rate-limited provider pools), fallba
|
|
|
2788
2807
|
provider switching), and healthchecks (continuous probe monitoring with failure actions).
|
|
2789
2808
|
|
|
2790
2809
|
CONFIGURATION BOUNDARY
|
|
2791
|
-
Quotas, fallbacks, and health checks are administrative product configuration.
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2810
|
+
Quotas, fallbacks, and health checks are administrative product configuration. Manage them with
|
|
2811
|
+
the authenticated CLI:
|
|
2812
|
+
ductape_cli("resources quota ...")
|
|
2813
|
+
ductape_cli("resources fallback ...")
|
|
2814
|
+
ductape_cli("resources health ...")
|
|
2815
|
+
Workbench is also supported. Never route their administrative create/update methods through
|
|
2816
|
+
ductape_execute: its publishable-key runtime proxy will fail.
|
|
2795
2817
|
|
|
2796
2818
|
QUOTAS — rate-limited multi-provider pools:
|
|
2797
2819
|
Workbench definition shape:
|
|
@@ -4332,8 +4354,9 @@ const cliInputSchema = z.object({
|
|
|
4332
4354
|
'resources (databases, storage, caches…), event broker topics, cloud connections, secrets, ' +
|
|
4333
4355
|
'and for apply/migrate workflows.\n\n' +
|
|
4334
4356
|
'Note: environments have their own CLI commands (products environments list/get/create/update, ' +
|
|
4335
|
-
'no linked project required — the product tag is always an explicit argument).
|
|
4336
|
-
'
|
|
4357
|
+
'no linked project required — the product tag is always an explicit argument). Quotas, ' +
|
|
4358
|
+
'fallbacks, jobs, and healthchecks use resources commands. App actions and auths are ' +
|
|
4359
|
+
'configured in the Workbench UI. Features have no CLI ' +
|
|
4337
4360
|
'creation command: define them in application code with features.define so application ' +
|
|
4338
4361
|
'boot/runtime registration makes them available.\n\n' +
|
|
4339
4362
|
'The CLI uses the user\'s local logged-in session (ductape login) — no key is required.'),
|
|
@@ -4788,13 +4811,14 @@ async function main() {
|
|
|
4788
4811
|
' After importing, create topics first with ductape_cli("events topics create -f topic.json") — SQS requires explicit topic creation with queueUrls. For other providers, topics auto-register on first produce but should still be created explicitly before any consumer subscribes.\n' +
|
|
4789
4812
|
' - Listing workspaces, products, focused product components, secrets\n' +
|
|
4790
4813
|
' Prefer "products components list --product-tag <tag> --json" for compact inventory; use\n' +
|
|
4791
|
-
' "products components get --product-tag <tag> --type notifications|events --json" for focused detail.\n' +
|
|
4814
|
+
' "products components get --product-tag <tag> --type notifications|events|healthchecks|features --json" for focused detail.\n' +
|
|
4792
4815
|
' - Managing notification components and message templates through "resources notifications" and "notifications messages"\n' +
|
|
4793
4816
|
' - Linking a project folder: "link --product <tag> --env <slug>"\n' +
|
|
4794
4817
|
' - Syncing sessions/notifications/events: "apply" or "apply sessions" etc.\n' +
|
|
4795
4818
|
' - Running database migrations: "db migrate", "db schema generate"\n\n' +
|
|
4796
|
-
'NOTE: Environments have their own CLI commands (products environments *). App actions
|
|
4797
|
-
'
|
|
4819
|
+
'NOTE: Environments have their own CLI commands (products environments *). App actions ' +
|
|
4820
|
+
'and auths are configured in the Workbench UI. Quotas, fallbacks, jobs, and healthchecks ' +
|
|
4821
|
+
'are managed with resources commands. Features have no ' +
|
|
4798
4822
|
'CLI creation command because definitions are code-first through features.define and ' +
|
|
4799
4823
|
'registered by the application runtime.\n\n' +
|
|
4800
4824
|
'DO NOT use ductape_execute for admin operations — it uses a publishable key which only ' +
|