@mcp-z/cli 1.0.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.
- package/LICENSE +21 -0
- package/README.md +166 -0
- package/bin/cli.js +5 -0
- package/dist/cjs/cli.d.cts +1 -0
- package/dist/cjs/cli.d.ts +1 -0
- package/dist/cjs/cli.js +576 -0
- package/dist/cjs/cli.js.map +1 -0
- package/dist/cjs/commands/call-tool.d.cts +26 -0
- package/dist/cjs/commands/call-tool.d.ts +26 -0
- package/dist/cjs/commands/call-tool.js +362 -0
- package/dist/cjs/commands/call-tool.js.map +1 -0
- package/dist/cjs/commands/get-prompt.d.cts +26 -0
- package/dist/cjs/commands/get-prompt.d.ts +26 -0
- package/dist/cjs/commands/get-prompt.js +335 -0
- package/dist/cjs/commands/get-prompt.js.map +1 -0
- package/dist/cjs/commands/inspect.d.cts +35 -0
- package/dist/cjs/commands/inspect.d.ts +35 -0
- package/dist/cjs/commands/inspect.js +896 -0
- package/dist/cjs/commands/inspect.js.map +1 -0
- package/dist/cjs/commands/manifest/env-prompting.d.cts +21 -0
- package/dist/cjs/commands/manifest/env-prompting.d.ts +21 -0
- package/dist/cjs/commands/manifest/env-prompting.js +657 -0
- package/dist/cjs/commands/manifest/env-prompting.js.map +1 -0
- package/dist/cjs/commands/manifest/generate.d.cts +124 -0
- package/dist/cjs/commands/manifest/generate.d.ts +124 -0
- package/dist/cjs/commands/manifest/generate.js +2541 -0
- package/dist/cjs/commands/manifest/generate.js.map +1 -0
- package/dist/cjs/commands/manifest/index.d.cts +2 -0
- package/dist/cjs/commands/manifest/index.d.ts +2 -0
- package/dist/cjs/commands/manifest/index.js +229 -0
- package/dist/cjs/commands/manifest/index.js.map +1 -0
- package/dist/cjs/commands/manifest/metadata-reader.d.cts +71 -0
- package/dist/cjs/commands/manifest/metadata-reader.d.ts +71 -0
- package/dist/cjs/commands/manifest/metadata-reader.js +441 -0
- package/dist/cjs/commands/manifest/metadata-reader.js.map +1 -0
- package/dist/cjs/commands/manifest/validate.d.cts +1 -0
- package/dist/cjs/commands/manifest/validate.d.ts +1 -0
- package/dist/cjs/commands/manifest/validate.js +525 -0
- package/dist/cjs/commands/manifest/validate.js.map +1 -0
- package/dist/cjs/commands/read-resource.d.cts +24 -0
- package/dist/cjs/commands/read-resource.d.ts +24 -0
- package/dist/cjs/commands/read-resource.js +311 -0
- package/dist/cjs/commands/read-resource.js.map +1 -0
- package/dist/cjs/commands/search.d.cts +31 -0
- package/dist/cjs/commands/search.d.ts +31 -0
- package/dist/cjs/commands/search.js +464 -0
- package/dist/cjs/commands/search.js.map +1 -0
- package/dist/cjs/commands/up.d.cts +49 -0
- package/dist/cjs/commands/up.d.ts +49 -0
- package/dist/cjs/commands/up.js +235 -0
- package/dist/cjs/commands/up.js.map +1 -0
- package/dist/cjs/index.d.cts +7 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +85 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/find-config.d.cts +14 -0
- package/dist/cjs/lib/find-config.d.ts +14 -0
- package/dist/cjs/lib/find-config.js +93 -0
- package/dist/cjs/lib/find-config.js.map +1 -0
- package/dist/cjs/lib/json-schema.d.cts +18 -0
- package/dist/cjs/lib/json-schema.d.ts +18 -0
- package/dist/cjs/lib/json-schema.js +306 -0
- package/dist/cjs/lib/json-schema.js.map +1 -0
- package/dist/cjs/lib/resolve-server-config.d.cts +50 -0
- package/dist/cjs/lib/resolve-server-config.d.ts +50 -0
- package/dist/cjs/lib/resolve-server-config.js +214 -0
- package/dist/cjs/lib/resolve-server-config.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types.d.cts +21 -0
- package/dist/cjs/types.d.ts +21 -0
- package/dist/cjs/types.js +32 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/cli.d.ts +1 -0
- package/dist/esm/cli.js +129 -0
- package/dist/esm/cli.js.map +1 -0
- package/dist/esm/commands/call-tool.d.ts +26 -0
- package/dist/esm/commands/call-tool.js +151 -0
- package/dist/esm/commands/call-tool.js.map +1 -0
- package/dist/esm/commands/get-prompt.d.ts +26 -0
- package/dist/esm/commands/get-prompt.js +118 -0
- package/dist/esm/commands/get-prompt.js.map +1 -0
- package/dist/esm/commands/inspect.d.ts +35 -0
- package/dist/esm/commands/inspect.js +438 -0
- package/dist/esm/commands/inspect.js.map +1 -0
- package/dist/esm/commands/manifest/env-prompting.d.ts +21 -0
- package/dist/esm/commands/manifest/env-prompting.js +213 -0
- package/dist/esm/commands/manifest/env-prompting.js.map +1 -0
- package/dist/esm/commands/manifest/generate.d.ts +124 -0
- package/dist/esm/commands/manifest/generate.js +1087 -0
- package/dist/esm/commands/manifest/generate.js.map +1 -0
- package/dist/esm/commands/manifest/index.d.ts +2 -0
- package/dist/esm/commands/manifest/index.js +23 -0
- package/dist/esm/commands/manifest/index.js.map +1 -0
- package/dist/esm/commands/manifest/metadata-reader.d.ts +71 -0
- package/dist/esm/commands/manifest/metadata-reader.js +143 -0
- package/dist/esm/commands/manifest/metadata-reader.js.map +1 -0
- package/dist/esm/commands/manifest/validate.d.ts +1 -0
- package/dist/esm/commands/manifest/validate.js +167 -0
- package/dist/esm/commands/manifest/validate.js.map +1 -0
- package/dist/esm/commands/read-resource.d.ts +24 -0
- package/dist/esm/commands/read-resource.js +95 -0
- package/dist/esm/commands/read-resource.js.map +1 -0
- package/dist/esm/commands/search.d.ts +31 -0
- package/dist/esm/commands/search.js +145 -0
- package/dist/esm/commands/search.js.map +1 -0
- package/dist/esm/commands/up.d.ts +49 -0
- package/dist/esm/commands/up.js +74 -0
- package/dist/esm/commands/up.js.map +1 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/find-config.d.ts +14 -0
- package/dist/esm/lib/find-config.js +42 -0
- package/dist/esm/lib/find-config.js.map +1 -0
- package/dist/esm/lib/json-schema.d.ts +18 -0
- package/dist/esm/lib/json-schema.js +66 -0
- package/dist/esm/lib/json-schema.js.map +1 -0
- package/dist/esm/lib/resolve-server-config.d.ts +50 -0
- package/dist/esm/lib/resolve-server-config.js +154 -0
- package/dist/esm/lib/resolve-server-config.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/types.d.ts +21 -0
- package/dist/esm/types.js +11 -0
- package/dist/esm/types.js.map +1 -0
- package/package.json +99 -0
- package/schemas/server.schema.json +489 -0
|
@@ -0,0 +1,2541 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get TRANSPORT_MAP () {
|
|
13
|
+
return TRANSPORT_MAP;
|
|
14
|
+
},
|
|
15
|
+
get createConfigChoices () {
|
|
16
|
+
return createConfigChoices;
|
|
17
|
+
},
|
|
18
|
+
get discoverServerJson () {
|
|
19
|
+
return discoverServerJson;
|
|
20
|
+
},
|
|
21
|
+
get extractServerName () {
|
|
22
|
+
return extractServerName;
|
|
23
|
+
},
|
|
24
|
+
get filterConfigChoices () {
|
|
25
|
+
return filterConfigChoices;
|
|
26
|
+
},
|
|
27
|
+
get generateCommand () {
|
|
28
|
+
return generateCommand;
|
|
29
|
+
},
|
|
30
|
+
get generateConditionalCombinations () {
|
|
31
|
+
return generateConditionalCombinations;
|
|
32
|
+
},
|
|
33
|
+
get generateConfigFile () {
|
|
34
|
+
return generateConfigFile;
|
|
35
|
+
},
|
|
36
|
+
get generateConfigObject () {
|
|
37
|
+
return generateConfigObject;
|
|
38
|
+
},
|
|
39
|
+
get generateMatrixCombinations () {
|
|
40
|
+
return generateMatrixCombinations;
|
|
41
|
+
},
|
|
42
|
+
get shouldPromptEnvVar () {
|
|
43
|
+
return shouldPromptEnvVar;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
var _checkbox = /*#__PURE__*/ _interop_require_default(require("@inquirer/checkbox"));
|
|
47
|
+
var _confirm = /*#__PURE__*/ _interop_require_default(require("@inquirer/confirm"));
|
|
48
|
+
var _input = /*#__PURE__*/ _interop_require_default(require("@inquirer/input"));
|
|
49
|
+
var _select = /*#__PURE__*/ _interop_require_default(require("@inquirer/select"));
|
|
50
|
+
var _fs = /*#__PURE__*/ _interop_require_wildcard(require("fs"));
|
|
51
|
+
var _path = /*#__PURE__*/ _interop_require_wildcard(require("path"));
|
|
52
|
+
var _jsonschemats = require("../../lib/json-schema.js");
|
|
53
|
+
var _envpromptingts = require("./env-prompting.js");
|
|
54
|
+
var _metadatareaderts = require("./metadata-reader.js");
|
|
55
|
+
function _array_like_to_array(arr, len) {
|
|
56
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
57
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
58
|
+
return arr2;
|
|
59
|
+
}
|
|
60
|
+
function _array_with_holes(arr) {
|
|
61
|
+
if (Array.isArray(arr)) return arr;
|
|
62
|
+
}
|
|
63
|
+
function _array_without_holes(arr) {
|
|
64
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
65
|
+
}
|
|
66
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
67
|
+
try {
|
|
68
|
+
var info = gen[key](arg);
|
|
69
|
+
var value = info.value;
|
|
70
|
+
} catch (error) {
|
|
71
|
+
reject(error);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (info.done) {
|
|
75
|
+
resolve(value);
|
|
76
|
+
} else {
|
|
77
|
+
Promise.resolve(value).then(_next, _throw);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function _async_to_generator(fn) {
|
|
81
|
+
return function() {
|
|
82
|
+
var self = this, args = arguments;
|
|
83
|
+
return new Promise(function(resolve, reject) {
|
|
84
|
+
var gen = fn.apply(self, args);
|
|
85
|
+
function _next(value) {
|
|
86
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
87
|
+
}
|
|
88
|
+
function _throw(err) {
|
|
89
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
90
|
+
}
|
|
91
|
+
_next(undefined);
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function _define_property(obj, key, value) {
|
|
96
|
+
if (key in obj) {
|
|
97
|
+
Object.defineProperty(obj, key, {
|
|
98
|
+
value: value,
|
|
99
|
+
enumerable: true,
|
|
100
|
+
configurable: true,
|
|
101
|
+
writable: true
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
obj[key] = value;
|
|
105
|
+
}
|
|
106
|
+
return obj;
|
|
107
|
+
}
|
|
108
|
+
function _instanceof(left, right) {
|
|
109
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
110
|
+
return !!right[Symbol.hasInstance](left);
|
|
111
|
+
} else {
|
|
112
|
+
return left instanceof right;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function _interop_require_default(obj) {
|
|
116
|
+
return obj && obj.__esModule ? obj : {
|
|
117
|
+
default: obj
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
121
|
+
if (typeof WeakMap !== "function") return null;
|
|
122
|
+
var cacheBabelInterop = new WeakMap();
|
|
123
|
+
var cacheNodeInterop = new WeakMap();
|
|
124
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
125
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
126
|
+
})(nodeInterop);
|
|
127
|
+
}
|
|
128
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
129
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
130
|
+
return obj;
|
|
131
|
+
}
|
|
132
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
133
|
+
return {
|
|
134
|
+
default: obj
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
138
|
+
if (cache && cache.has(obj)) {
|
|
139
|
+
return cache.get(obj);
|
|
140
|
+
}
|
|
141
|
+
var newObj = {
|
|
142
|
+
__proto__: null
|
|
143
|
+
};
|
|
144
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
145
|
+
for(var key in obj){
|
|
146
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
147
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
148
|
+
if (desc && (desc.get || desc.set)) {
|
|
149
|
+
Object.defineProperty(newObj, key, desc);
|
|
150
|
+
} else {
|
|
151
|
+
newObj[key] = obj[key];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
newObj.default = obj;
|
|
156
|
+
if (cache) {
|
|
157
|
+
cache.set(obj, newObj);
|
|
158
|
+
}
|
|
159
|
+
return newObj;
|
|
160
|
+
}
|
|
161
|
+
function _iterable_to_array(iter) {
|
|
162
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
163
|
+
}
|
|
164
|
+
function _iterable_to_array_limit(arr, i) {
|
|
165
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
166
|
+
if (_i == null) return;
|
|
167
|
+
var _arr = [];
|
|
168
|
+
var _n = true;
|
|
169
|
+
var _d = false;
|
|
170
|
+
var _s, _e;
|
|
171
|
+
try {
|
|
172
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
173
|
+
_arr.push(_s.value);
|
|
174
|
+
if (i && _arr.length === i) break;
|
|
175
|
+
}
|
|
176
|
+
} catch (err) {
|
|
177
|
+
_d = true;
|
|
178
|
+
_e = err;
|
|
179
|
+
} finally{
|
|
180
|
+
try {
|
|
181
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
182
|
+
} finally{
|
|
183
|
+
if (_d) throw _e;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return _arr;
|
|
187
|
+
}
|
|
188
|
+
function _non_iterable_rest() {
|
|
189
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
190
|
+
}
|
|
191
|
+
function _non_iterable_spread() {
|
|
192
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
193
|
+
}
|
|
194
|
+
function _object_spread(target) {
|
|
195
|
+
for(var i = 1; i < arguments.length; i++){
|
|
196
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
197
|
+
var ownKeys = Object.keys(source);
|
|
198
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
199
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
200
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
ownKeys.forEach(function(key) {
|
|
204
|
+
_define_property(target, key, source[key]);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return target;
|
|
208
|
+
}
|
|
209
|
+
function ownKeys(object, enumerableOnly) {
|
|
210
|
+
var keys = Object.keys(object);
|
|
211
|
+
if (Object.getOwnPropertySymbols) {
|
|
212
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
213
|
+
if (enumerableOnly) {
|
|
214
|
+
symbols = symbols.filter(function(sym) {
|
|
215
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
keys.push.apply(keys, symbols);
|
|
219
|
+
}
|
|
220
|
+
return keys;
|
|
221
|
+
}
|
|
222
|
+
function _object_spread_props(target, source) {
|
|
223
|
+
source = source != null ? source : {};
|
|
224
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
225
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
226
|
+
} else {
|
|
227
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
228
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return target;
|
|
232
|
+
}
|
|
233
|
+
function _sliced_to_array(arr, i) {
|
|
234
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
235
|
+
}
|
|
236
|
+
function _to_consumable_array(arr) {
|
|
237
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
238
|
+
}
|
|
239
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
240
|
+
if (!o) return;
|
|
241
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
242
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
243
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
244
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
245
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
246
|
+
}
|
|
247
|
+
function _ts_generator(thisArg, body) {
|
|
248
|
+
var f, y, t, _ = {
|
|
249
|
+
label: 0,
|
|
250
|
+
sent: function() {
|
|
251
|
+
if (t[0] & 1) throw t[1];
|
|
252
|
+
return t[1];
|
|
253
|
+
},
|
|
254
|
+
trys: [],
|
|
255
|
+
ops: []
|
|
256
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
257
|
+
return d(g, "next", {
|
|
258
|
+
value: verb(0)
|
|
259
|
+
}), d(g, "throw", {
|
|
260
|
+
value: verb(1)
|
|
261
|
+
}), d(g, "return", {
|
|
262
|
+
value: verb(2)
|
|
263
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
264
|
+
value: function() {
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
}), g;
|
|
268
|
+
function verb(n) {
|
|
269
|
+
return function(v) {
|
|
270
|
+
return step([
|
|
271
|
+
n,
|
|
272
|
+
v
|
|
273
|
+
]);
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function step(op) {
|
|
277
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
278
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
279
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
280
|
+
if (y = 0, t) op = [
|
|
281
|
+
op[0] & 2,
|
|
282
|
+
t.value
|
|
283
|
+
];
|
|
284
|
+
switch(op[0]){
|
|
285
|
+
case 0:
|
|
286
|
+
case 1:
|
|
287
|
+
t = op;
|
|
288
|
+
break;
|
|
289
|
+
case 4:
|
|
290
|
+
_.label++;
|
|
291
|
+
return {
|
|
292
|
+
value: op[1],
|
|
293
|
+
done: false
|
|
294
|
+
};
|
|
295
|
+
case 5:
|
|
296
|
+
_.label++;
|
|
297
|
+
y = op[1];
|
|
298
|
+
op = [
|
|
299
|
+
0
|
|
300
|
+
];
|
|
301
|
+
continue;
|
|
302
|
+
case 7:
|
|
303
|
+
op = _.ops.pop();
|
|
304
|
+
_.trys.pop();
|
|
305
|
+
continue;
|
|
306
|
+
default:
|
|
307
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
308
|
+
_ = 0;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
312
|
+
_.label = op[1];
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
316
|
+
_.label = t[1];
|
|
317
|
+
t = op;
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
if (t && _.label < t[2]) {
|
|
321
|
+
_.label = t[2];
|
|
322
|
+
_.ops.push(op);
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
if (t[2]) _.ops.pop();
|
|
326
|
+
_.trys.pop();
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
op = body.call(thisArg, _);
|
|
330
|
+
} catch (e) {
|
|
331
|
+
op = [
|
|
332
|
+
6,
|
|
333
|
+
e
|
|
334
|
+
];
|
|
335
|
+
y = 0;
|
|
336
|
+
} finally{
|
|
337
|
+
f = t = 0;
|
|
338
|
+
}
|
|
339
|
+
if (op[0] & 5) throw op[1];
|
|
340
|
+
return {
|
|
341
|
+
value: op[0] ? op[1] : void 0,
|
|
342
|
+
done: true
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
var TRANSPORT_MAP = {
|
|
347
|
+
stdio: 'stdio',
|
|
348
|
+
http: 'streamable-http'
|
|
349
|
+
};
|
|
350
|
+
function createConfigChoices(combinations, transports) {
|
|
351
|
+
var choices = [];
|
|
352
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
353
|
+
try {
|
|
354
|
+
for(var _iterator = combinations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
355
|
+
var combination = _step.value;
|
|
356
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
357
|
+
try {
|
|
358
|
+
for(var _iterator1 = transports[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
359
|
+
var t = _step1.value;
|
|
360
|
+
var transport = TRANSPORT_MAP[t] || t;
|
|
361
|
+
choices.push({
|
|
362
|
+
combination: combination,
|
|
363
|
+
transport: transport,
|
|
364
|
+
label: "".concat(combination.name, " (").concat(t, ")")
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
} catch (err) {
|
|
368
|
+
_didIteratorError1 = true;
|
|
369
|
+
_iteratorError1 = err;
|
|
370
|
+
} finally{
|
|
371
|
+
try {
|
|
372
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
373
|
+
_iterator1.return();
|
|
374
|
+
}
|
|
375
|
+
} finally{
|
|
376
|
+
if (_didIteratorError1) {
|
|
377
|
+
throw _iteratorError1;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
} catch (err) {
|
|
383
|
+
_didIteratorError = true;
|
|
384
|
+
_iteratorError = err;
|
|
385
|
+
} finally{
|
|
386
|
+
try {
|
|
387
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
388
|
+
_iterator.return();
|
|
389
|
+
}
|
|
390
|
+
} finally{
|
|
391
|
+
if (_didIteratorError) {
|
|
392
|
+
throw _iteratorError;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return choices;
|
|
397
|
+
}
|
|
398
|
+
function filterConfigChoices(allChoices, selectedLabels) {
|
|
399
|
+
return allChoices.filter(function(choice) {
|
|
400
|
+
return selectedLabels.includes(choice.label);
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Generate cartesian product of all dimension choices.
|
|
405
|
+
* Example: [AUTH_MODE: [a, b], DCR_MODE: [x, y]] → [[a,x], [a,y], [b,x], [b,y]]
|
|
406
|
+
*/ function generateCartesianProduct(dimensions) {
|
|
407
|
+
if (dimensions.length === 0) return [
|
|
408
|
+
[]
|
|
409
|
+
];
|
|
410
|
+
var first = dimensions[0];
|
|
411
|
+
if (!first || !first.choices || first.choices.length === 0) return [
|
|
412
|
+
[]
|
|
413
|
+
];
|
|
414
|
+
if (dimensions.length === 1) {
|
|
415
|
+
return first.choices.map(function(c) {
|
|
416
|
+
return [
|
|
417
|
+
c
|
|
418
|
+
];
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
var rest = dimensions.slice(1);
|
|
422
|
+
var restProduct = generateCartesianProduct(rest);
|
|
423
|
+
var result = [];
|
|
424
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
425
|
+
try {
|
|
426
|
+
for(var _iterator = first.choices[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
427
|
+
var choice = _step.value;
|
|
428
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
429
|
+
try {
|
|
430
|
+
for(var _iterator1 = restProduct[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
431
|
+
var restCombination = _step1.value;
|
|
432
|
+
result.push([
|
|
433
|
+
choice
|
|
434
|
+
].concat(_to_consumable_array(restCombination)));
|
|
435
|
+
}
|
|
436
|
+
} catch (err) {
|
|
437
|
+
_didIteratorError1 = true;
|
|
438
|
+
_iteratorError1 = err;
|
|
439
|
+
} finally{
|
|
440
|
+
try {
|
|
441
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
442
|
+
_iterator1.return();
|
|
443
|
+
}
|
|
444
|
+
} finally{
|
|
445
|
+
if (_didIteratorError1) {
|
|
446
|
+
throw _iteratorError1;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
} catch (err) {
|
|
452
|
+
_didIteratorError = true;
|
|
453
|
+
_iteratorError = err;
|
|
454
|
+
} finally{
|
|
455
|
+
try {
|
|
456
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
457
|
+
_iterator.return();
|
|
458
|
+
}
|
|
459
|
+
} finally{
|
|
460
|
+
if (_didIteratorError) {
|
|
461
|
+
throw _iteratorError;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return result;
|
|
466
|
+
}
|
|
467
|
+
function generateMatrixCombinations(envVars) {
|
|
468
|
+
var dimensions = envVars.map(function(e) {
|
|
469
|
+
return {
|
|
470
|
+
name: e.name,
|
|
471
|
+
choices: e.choices
|
|
472
|
+
};
|
|
473
|
+
});
|
|
474
|
+
var product = generateCartesianProduct(dimensions);
|
|
475
|
+
return product.map(function(values) {
|
|
476
|
+
var dimensionValues = {};
|
|
477
|
+
dimensions.forEach(function(dim, i) {
|
|
478
|
+
dimensionValues[dim.name] = values[i] || '';
|
|
479
|
+
});
|
|
480
|
+
var nameParts = dimensions.map(function(dim, i) {
|
|
481
|
+
return "".concat(dim.name.toLowerCase(), "-").concat(values[i]);
|
|
482
|
+
});
|
|
483
|
+
return {
|
|
484
|
+
name: nameParts.length > 0 ? nameParts.join('_') : 'minimal',
|
|
485
|
+
envKeys: dimensions.map(function(d) {
|
|
486
|
+
return d.name;
|
|
487
|
+
}),
|
|
488
|
+
argNames: [],
|
|
489
|
+
defaults: {},
|
|
490
|
+
argDefaults: {},
|
|
491
|
+
dimensionValues: dimensionValues
|
|
492
|
+
};
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
function generateConditionalCombinations(envVars) {
|
|
496
|
+
// Separate primary dimensions (no dependsOn) from conditional ones
|
|
497
|
+
var primaryDims = envVars.filter(function(e) {
|
|
498
|
+
return !e.dependsOn;
|
|
499
|
+
});
|
|
500
|
+
var conditionalDims = envVars.filter(function(e) {
|
|
501
|
+
return e.dependsOn;
|
|
502
|
+
});
|
|
503
|
+
if (primaryDims.length === 0) {
|
|
504
|
+
// No primary dimensions - return empty or minimal
|
|
505
|
+
return [
|
|
506
|
+
{
|
|
507
|
+
name: 'minimal',
|
|
508
|
+
envKeys: [],
|
|
509
|
+
argNames: [],
|
|
510
|
+
defaults: {},
|
|
511
|
+
argDefaults: {},
|
|
512
|
+
dimensionValues: {}
|
|
513
|
+
}
|
|
514
|
+
];
|
|
515
|
+
}
|
|
516
|
+
// Generate all combinations of primary dimensions first
|
|
517
|
+
var primaryProduct = generateCartesianProduct(primaryDims);
|
|
518
|
+
var combinations = [];
|
|
519
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
520
|
+
try {
|
|
521
|
+
var _loop = function() {
|
|
522
|
+
var primaryValues = _step.value;
|
|
523
|
+
// Build base dimension values from primary
|
|
524
|
+
var baseDimensionValues = {};
|
|
525
|
+
primaryDims.forEach(function(dim, i) {
|
|
526
|
+
baseDimensionValues[dim.name] = primaryValues[i] || '';
|
|
527
|
+
});
|
|
528
|
+
// Find which conditional dimensions apply to this primary combination
|
|
529
|
+
var applicableConditionals = conditionalDims.filter(function(cond) {
|
|
530
|
+
return shouldPromptEnvVar(cond, baseDimensionValues);
|
|
531
|
+
});
|
|
532
|
+
if (applicableConditionals.length === 0) {
|
|
533
|
+
// No conditional dimensions apply - single combination
|
|
534
|
+
// Only include dimensions with multiple choices in the name (single-choice dimensions don't add discriminating value)
|
|
535
|
+
var nameParts = primaryDims.filter(function(dim) {
|
|
536
|
+
return dim.choices.length > 1;
|
|
537
|
+
}).map(function(dim, _i) {
|
|
538
|
+
return "".concat(dim.name.toLowerCase(), "-").concat(primaryValues[primaryDims.indexOf(dim)]);
|
|
539
|
+
});
|
|
540
|
+
combinations.push({
|
|
541
|
+
name: nameParts.length > 0 ? nameParts.join('_') : 'default',
|
|
542
|
+
envKeys: primaryDims.map(function(d) {
|
|
543
|
+
return d.name;
|
|
544
|
+
}),
|
|
545
|
+
argNames: [],
|
|
546
|
+
defaults: {},
|
|
547
|
+
argDefaults: {},
|
|
548
|
+
dimensionValues: _object_spread({}, baseDimensionValues)
|
|
549
|
+
});
|
|
550
|
+
} else {
|
|
551
|
+
// Generate sub-combinations for applicable conditional dimensions
|
|
552
|
+
var conditionalProduct = generateCartesianProduct(applicableConditionals);
|
|
553
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
554
|
+
try {
|
|
555
|
+
var _loop = function() {
|
|
556
|
+
var condValues = _step1.value;
|
|
557
|
+
var fullDimensionValues = _object_spread({}, baseDimensionValues);
|
|
558
|
+
applicableConditionals.forEach(function(dim, i) {
|
|
559
|
+
fullDimensionValues[dim.name] = condValues[i] || '';
|
|
560
|
+
});
|
|
561
|
+
// Build name from dimensions with multiple choices only (single-choice dimensions don't add discriminating value)
|
|
562
|
+
var allDims = _to_consumable_array(primaryDims).concat(_to_consumable_array(applicableConditionals));
|
|
563
|
+
var nameParts = allDims.filter(function(dim) {
|
|
564
|
+
return dim.choices.length > 1;
|
|
565
|
+
}).map(function(dim) {
|
|
566
|
+
return "".concat(dim.name.toLowerCase(), "-").concat(fullDimensionValues[dim.name]);
|
|
567
|
+
});
|
|
568
|
+
combinations.push({
|
|
569
|
+
name: nameParts.length > 0 ? nameParts.join('_') : 'default',
|
|
570
|
+
envKeys: _to_consumable_array(primaryDims).concat(_to_consumable_array(applicableConditionals)).map(function(d) {
|
|
571
|
+
return d.name;
|
|
572
|
+
}),
|
|
573
|
+
argNames: [],
|
|
574
|
+
defaults: {},
|
|
575
|
+
argDefaults: {},
|
|
576
|
+
dimensionValues: fullDimensionValues
|
|
577
|
+
});
|
|
578
|
+
};
|
|
579
|
+
for(var _iterator = conditionalProduct[Symbol.iterator](), _step1; !(_iteratorNormalCompletion = (_step1 = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
580
|
+
} catch (err) {
|
|
581
|
+
_didIteratorError = true;
|
|
582
|
+
_iteratorError = err;
|
|
583
|
+
} finally{
|
|
584
|
+
try {
|
|
585
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
586
|
+
_iterator.return();
|
|
587
|
+
}
|
|
588
|
+
} finally{
|
|
589
|
+
if (_didIteratorError) {
|
|
590
|
+
throw _iteratorError;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
for(var _iterator = primaryProduct[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
597
|
+
} catch (err) {
|
|
598
|
+
_didIteratorError = true;
|
|
599
|
+
_iteratorError = err;
|
|
600
|
+
} finally{
|
|
601
|
+
try {
|
|
602
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
603
|
+
_iterator.return();
|
|
604
|
+
}
|
|
605
|
+
} finally{
|
|
606
|
+
if (_didIteratorError) {
|
|
607
|
+
throw _iteratorError;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return combinations;
|
|
612
|
+
}
|
|
613
|
+
function shouldPromptEnvVar(envVar, selectedValues) {
|
|
614
|
+
if (!envVar.dependsOn) return true;
|
|
615
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
616
|
+
try {
|
|
617
|
+
// All dependencies must be satisfied
|
|
618
|
+
for(var _iterator = Object.entries(envVar.dependsOn)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
619
|
+
var _step_value = _sliced_to_array(_step.value, 2), depName = _step_value[0], allowedValues = _step_value[1];
|
|
620
|
+
var selectedValue = selectedValues[depName];
|
|
621
|
+
// If dependency not yet selected, or selected value not in allowed list, skip
|
|
622
|
+
if (!selectedValue || !allowedValues.includes(selectedValue)) {
|
|
623
|
+
return false;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
} catch (err) {
|
|
627
|
+
_didIteratorError = true;
|
|
628
|
+
_iteratorError = err;
|
|
629
|
+
} finally{
|
|
630
|
+
try {
|
|
631
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
632
|
+
_iterator.return();
|
|
633
|
+
}
|
|
634
|
+
} finally{
|
|
635
|
+
if (_didIteratorError) {
|
|
636
|
+
throw _iteratorError;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return true;
|
|
641
|
+
}
|
|
642
|
+
function generateCommand() {
|
|
643
|
+
return _async_to_generator(function() {
|
|
644
|
+
var options, useSource, jsonOutput, matrixMode, quickMode, serverJsonPath, packageDir, packageJsonPath, packageJson, packageName, serverName, binPath, packageNameWithoutOrg, serverJsonContent, metadata, error, metadataReader, stdioPackage, envVarsWithChoices, argsWithChoices, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, envVar, _envVar_choices, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, arg, _arg_choices, outputDir, transports, httpPackage, envVarsForMatrix, defaults, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _loop, _iterator2, _step2, combinations, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, combo, httpHost, httpPort, generatedCount, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, combination, _iteratorNormalCompletion5, _didIteratorError5, _iteratorError5, _iterator5, _step5, transport, err, err, configMode, finalServerName, outputDir1, _tmp, combination1, config, transports1, httpHost1, httpPort1, portStr, availableDimensions, _iteratorNormalCompletion6, _didIteratorError6, _iteratorError6, _iterator6, _step6, envVar1, _iteratorNormalCompletion7, _didIteratorError7, _iteratorError7, _iterator7, _step7, arg1, selectedDimensionNames, selectedDimensions, dimensionsWithFilteredChoices, _iteratorNormalCompletion8, _didIteratorError8, _iteratorError8, _iterator8, _step8, dim, choicesWithSkip, selectedChoices, err, dimensionNames, nonDimensionEnvVars, nonDimensionArgs, defaults1, argDefaults, _iteratorNormalCompletion9, _didIteratorError9, _iteratorError9, _iterator9, _step9, envVar2, choicesWithSkip1, defaultValue, err, _iteratorNormalCompletion10, _didIteratorError10, _iteratorError10, _iterator10, _step10, arg2, choicesWithSkip2, defaultValue1, err, combinations1, totalConfigs, _iteratorNormalCompletion11, _didIteratorError11, _iteratorError11, _iterator11, _step11, combo1, _iteratorNormalCompletion12, _didIteratorError12, _iteratorError12, _iterator12, _step12, _step_value, key, value, _iteratorNormalCompletion13, _didIteratorError13, _iteratorError13, _iterator13, _step13, _step_value1, key1, value1, generationMode, selectedConfigs, allChoices, selectedLabels, finalServerName1, outputDir2, _tmp1, optionalVarsToPrompt, _selectedDimensions_, envVarsWithContext, primaryDimensionName, _iteratorNormalCompletion14, _didIteratorError14, _iteratorError14, _iterator14, _step14, combination2, allEnvVars, _iteratorNormalCompletion15, _didIteratorError15, _iteratorError15, _iterator15, _step15, envVar3, context, allSelectedModes, groupedVars, _iteratorNormalCompletion16, _didIteratorError16, _iteratorError16, _iterator16, _step16, _step_value2, envVar4, relevantModes, appliesToAll, _groupedVars_get, groupKey, templateVars, _iteratorNormalCompletion17, _didIteratorError17, _iteratorError17, _iterator17, _step17, _step_value3, groupKey1, vars, _iteratorNormalCompletion18, _didIteratorError18, _iteratorError18, _iterator18, _step18, envVar5, _ref, _envVar_default, rawDefault, defaultVal, label, allOptionalVarNames, configureChoice, _iteratorNormalCompletion19, _didIteratorError19, _iteratorError19, _iterator19, _step19, name, checkboxChoices, _iteratorNormalCompletion20, _didIteratorError20, _iteratorError20, _iterator20, _step20, _step_value4, groupKey2, vars1, _iteratorNormalCompletion21, _didIteratorError21, _iteratorError21, _iterator21, _step21, envVar6, _ref1, _envVar_default1, rawDefault1, defaultVal1, label1, selectedVarNames, _iteratorNormalCompletion22, _didIteratorError22, _iteratorError22, _iterator22, _step22, name1, configs, _iteratorNormalCompletion23, _didIteratorError23, _iteratorError23, _iterator23, _step23, _step_value5, combination3, transport1, config1, err, generatedCount1, _iteratorNormalCompletion24, _didIteratorError24, _iteratorError24, _iterator24, _step24, _step_value6, combination4, transport2, success, err;
|
|
645
|
+
var _arguments = arguments;
|
|
646
|
+
return _ts_generator(this, function(_state) {
|
|
647
|
+
switch(_state.label){
|
|
648
|
+
case 0:
|
|
649
|
+
options = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
|
|
650
|
+
console.log('🔧 MCP Config Generator\n');
|
|
651
|
+
useSource = options.source || false;
|
|
652
|
+
jsonOutput = options.json || false;
|
|
653
|
+
matrixMode = options.matrix || false;
|
|
654
|
+
quickMode = options.quick || false;
|
|
655
|
+
// 1. Discover server.json in current directory or parent
|
|
656
|
+
serverJsonPath = discoverServerJson();
|
|
657
|
+
if (!serverJsonPath) {
|
|
658
|
+
console.error('❌ No server.json found in current directory or parent');
|
|
659
|
+
console.error(' Run this command from an MCP server package directory');
|
|
660
|
+
process.exit(1);
|
|
661
|
+
}
|
|
662
|
+
// 2. Read package.json to get package name
|
|
663
|
+
packageDir = _path.dirname(serverJsonPath);
|
|
664
|
+
packageJsonPath = _path.join(packageDir, 'package.json');
|
|
665
|
+
if (!_fs.existsSync(packageJsonPath)) {
|
|
666
|
+
console.error('❌ No package.json found alongside server.json');
|
|
667
|
+
console.error(' Package.json is required to get package name');
|
|
668
|
+
process.exit(1);
|
|
669
|
+
}
|
|
670
|
+
packageJson = JSON.parse(_fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
671
|
+
packageName = packageJson.name;
|
|
672
|
+
serverName = extractServerName(packageName);
|
|
673
|
+
if (packageJson.bin) {
|
|
674
|
+
if (typeof packageJson.bin === 'string') {
|
|
675
|
+
// Default bin entry
|
|
676
|
+
binPath = packageJson.bin;
|
|
677
|
+
} else {
|
|
678
|
+
// Named bin entries - try to match package name without org
|
|
679
|
+
packageNameWithoutOrg = packageName.replace(/^@[^/]+\//, '');
|
|
680
|
+
binPath = packageJson.bin[packageNameWithoutOrg] || packageJson.bin[Object.keys(packageJson.bin)[0] || ''];
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
console.log("\uD83D\uDCE6 Package: ".concat(packageName));
|
|
684
|
+
// 3. Read and validate server.json metadata
|
|
685
|
+
serverJsonContent = _fs.readFileSync(serverJsonPath, 'utf-8');
|
|
686
|
+
_state.label = 1;
|
|
687
|
+
case 1:
|
|
688
|
+
_state.trys.push([
|
|
689
|
+
1,
|
|
690
|
+
3,
|
|
691
|
+
,
|
|
692
|
+
4
|
|
693
|
+
]);
|
|
694
|
+
metadata = JSON.parse(serverJsonContent);
|
|
695
|
+
return [
|
|
696
|
+
4,
|
|
697
|
+
(0, _jsonschemats.validateSchema)(metadata, serverName)
|
|
698
|
+
];
|
|
699
|
+
case 2:
|
|
700
|
+
_state.sent();
|
|
701
|
+
return [
|
|
702
|
+
3,
|
|
703
|
+
4
|
|
704
|
+
];
|
|
705
|
+
case 3:
|
|
706
|
+
error = _state.sent();
|
|
707
|
+
console.error("❌ Failed to read or validate server.json: ".concat(_instanceof(error, Error) ? error.message : String(error)));
|
|
708
|
+
process.exit(1);
|
|
709
|
+
return [
|
|
710
|
+
3,
|
|
711
|
+
4
|
|
712
|
+
];
|
|
713
|
+
case 4:
|
|
714
|
+
metadataReader = new _metadatareaderts.MetadataReader();
|
|
715
|
+
// 4. Get stdio package to analyze env vars
|
|
716
|
+
stdioPackage = metadataReader.getPackageForTransport(metadata, 'stdio');
|
|
717
|
+
if (!stdioPackage) {
|
|
718
|
+
console.error('❌ No stdio transport found in server.json');
|
|
719
|
+
process.exit(1);
|
|
720
|
+
}
|
|
721
|
+
// 5. Find all environment variables and package arguments with choices
|
|
722
|
+
// Filter to only mandatory matrix items (isMandatoryForMatrix !== false)
|
|
723
|
+
// Non-mandatory items like LOG_LEVEL should not explode the test matrix
|
|
724
|
+
envVarsWithChoices = (stdioPackage.environmentVariables || []).filter(function(envVar) {
|
|
725
|
+
return envVar.choices && envVar.choices.length > 0 && envVar.isMandatoryForMatrix !== false;
|
|
726
|
+
});
|
|
727
|
+
argsWithChoices = (stdioPackage.packageArguments || []).filter(function(arg) {
|
|
728
|
+
return arg.choices !== undefined && arg.choices.length > 0;
|
|
729
|
+
});
|
|
730
|
+
if (envVarsWithChoices.length === 0 && argsWithChoices.length === 0) {
|
|
731
|
+
console.error('❌ No environment variables or package arguments with choices found in server.json');
|
|
732
|
+
console.error(' Cannot generate configurations without choice-based configuration options');
|
|
733
|
+
process.exit(1);
|
|
734
|
+
}
|
|
735
|
+
console.log('\n🔍 Available configuration options:');
|
|
736
|
+
if (envVarsWithChoices.length > 0) {
|
|
737
|
+
console.log(" Environment variables (".concat(envVarsWithChoices.length, "):"));
|
|
738
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
739
|
+
try {
|
|
740
|
+
for(_iterator = envVarsWithChoices[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
741
|
+
envVar = _step.value;
|
|
742
|
+
;
|
|
743
|
+
console.log(" • ".concat(envVar.name, ": ").concat(((_envVar_choices = envVar.choices) === null || _envVar_choices === void 0 ? void 0 : _envVar_choices.join(', ')) || ''));
|
|
744
|
+
}
|
|
745
|
+
} catch (err) {
|
|
746
|
+
_didIteratorError = true;
|
|
747
|
+
_iteratorError = err;
|
|
748
|
+
} finally{
|
|
749
|
+
try {
|
|
750
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
751
|
+
_iterator.return();
|
|
752
|
+
}
|
|
753
|
+
} finally{
|
|
754
|
+
if (_didIteratorError) {
|
|
755
|
+
throw _iteratorError;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
if (argsWithChoices.length > 0) {
|
|
761
|
+
console.log(" Package arguments (".concat(argsWithChoices.length, "):"));
|
|
762
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
763
|
+
try {
|
|
764
|
+
for(_iterator1 = argsWithChoices[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
765
|
+
arg = _step1.value;
|
|
766
|
+
;
|
|
767
|
+
console.log(" • ".concat(arg.name, ": ").concat(((_arg_choices = arg.choices) === null || _arg_choices === void 0 ? void 0 : _arg_choices.join(', ')) || ''));
|
|
768
|
+
}
|
|
769
|
+
} catch (err) {
|
|
770
|
+
_didIteratorError1 = true;
|
|
771
|
+
_iteratorError1 = err;
|
|
772
|
+
} finally{
|
|
773
|
+
try {
|
|
774
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
775
|
+
_iterator1.return();
|
|
776
|
+
}
|
|
777
|
+
} finally{
|
|
778
|
+
if (_didIteratorError1) {
|
|
779
|
+
throw _iteratorError1;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
console.log();
|
|
785
|
+
if (!matrixMode) return [
|
|
786
|
+
3,
|
|
787
|
+
19
|
|
788
|
+
];
|
|
789
|
+
outputDir = options.output || 'examples';
|
|
790
|
+
transports = [
|
|
791
|
+
'stdio'
|
|
792
|
+
];
|
|
793
|
+
// Add http transport if available
|
|
794
|
+
httpPackage = metadataReader.getPackageForTransport(metadata, 'streamable-http');
|
|
795
|
+
if (httpPackage) {
|
|
796
|
+
transports.push('streamable-http');
|
|
797
|
+
}
|
|
798
|
+
// Build env vars for matrix generation (with dependsOn for conditional filtering)
|
|
799
|
+
envVarsForMatrix = envVarsWithChoices.map(function(envVar) {
|
|
800
|
+
return {
|
|
801
|
+
name: envVar.name,
|
|
802
|
+
choices: envVar.choices || [],
|
|
803
|
+
dependsOn: envVar.dependsOn
|
|
804
|
+
};
|
|
805
|
+
});
|
|
806
|
+
// Collect defaults for non-dimension env vars (ones without choices or non-mandatory)
|
|
807
|
+
// Support both 'default' (MCP schema standard) and 'value' (legacy) fields
|
|
808
|
+
defaults = {};
|
|
809
|
+
_iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
810
|
+
try {
|
|
811
|
+
_loop = function() {
|
|
812
|
+
var envVar = _step2.value;
|
|
813
|
+
if (!envVarsWithChoices.some(function(e) {
|
|
814
|
+
return e.name === envVar.name;
|
|
815
|
+
})) {
|
|
816
|
+
var _envVar_default;
|
|
817
|
+
var defaultValue = (_envVar_default = envVar.default) !== null && _envVar_default !== void 0 ? _envVar_default : envVar.value;
|
|
818
|
+
if (defaultValue) {
|
|
819
|
+
defaults[envVar.name] = defaultValue;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
for(_iterator2 = (stdioPackage.environmentVariables || [])[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true)_loop();
|
|
824
|
+
} catch (err) {
|
|
825
|
+
_didIteratorError2 = true;
|
|
826
|
+
_iteratorError2 = err;
|
|
827
|
+
} finally{
|
|
828
|
+
try {
|
|
829
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
830
|
+
_iterator2.return();
|
|
831
|
+
}
|
|
832
|
+
} finally{
|
|
833
|
+
if (_didIteratorError2) {
|
|
834
|
+
throw _iteratorError2;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
// Generate combinations respecting dependsOn relationships (no unnecessary combinations)
|
|
839
|
+
combinations = generateConditionalCombinations(envVarsForMatrix);
|
|
840
|
+
_iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
|
|
841
|
+
try {
|
|
842
|
+
// Add defaults to each combination
|
|
843
|
+
for(_iterator3 = combinations[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
|
|
844
|
+
combo = _step3.value;
|
|
845
|
+
combo.defaults = defaults;
|
|
846
|
+
}
|
|
847
|
+
} catch (err) {
|
|
848
|
+
_didIteratorError3 = true;
|
|
849
|
+
_iteratorError3 = err;
|
|
850
|
+
} finally{
|
|
851
|
+
try {
|
|
852
|
+
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
853
|
+
_iterator3.return();
|
|
854
|
+
}
|
|
855
|
+
} finally{
|
|
856
|
+
if (_didIteratorError3) {
|
|
857
|
+
throw _iteratorError3;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
console.log("\uD83D\uDCCA Matrix mode: Generating ".concat(combinations.length, " combination(s) \xd7 ").concat(transports.length, " transport(s)"));
|
|
862
|
+
console.log(" Output: ".concat(outputDir, "/"));
|
|
863
|
+
console.log(" Transports: ".concat(transports.join(', ')));
|
|
864
|
+
console.log();
|
|
865
|
+
// Create output directory
|
|
866
|
+
_fs.mkdirSync(outputDir, {
|
|
867
|
+
recursive: true
|
|
868
|
+
});
|
|
869
|
+
// Default HTTP settings for matrix mode
|
|
870
|
+
httpHost = 'localhost';
|
|
871
|
+
httpPort = 3000;
|
|
872
|
+
generatedCount = 0;
|
|
873
|
+
_iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = undefined;
|
|
874
|
+
_state.label = 5;
|
|
875
|
+
case 5:
|
|
876
|
+
_state.trys.push([
|
|
877
|
+
5,
|
|
878
|
+
16,
|
|
879
|
+
17,
|
|
880
|
+
18
|
|
881
|
+
]);
|
|
882
|
+
_iterator4 = combinations[Symbol.iterator]();
|
|
883
|
+
_state.label = 6;
|
|
884
|
+
case 6:
|
|
885
|
+
if (!!(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done)) return [
|
|
886
|
+
3,
|
|
887
|
+
15
|
|
888
|
+
];
|
|
889
|
+
combination = _step4.value;
|
|
890
|
+
_iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = undefined;
|
|
891
|
+
_state.label = 7;
|
|
892
|
+
case 7:
|
|
893
|
+
_state.trys.push([
|
|
894
|
+
7,
|
|
895
|
+
12,
|
|
896
|
+
13,
|
|
897
|
+
14
|
|
898
|
+
]);
|
|
899
|
+
_iterator5 = transports[Symbol.iterator]();
|
|
900
|
+
_state.label = 8;
|
|
901
|
+
case 8:
|
|
902
|
+
if (!!(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done)) return [
|
|
903
|
+
3,
|
|
904
|
+
11
|
|
905
|
+
];
|
|
906
|
+
transport = _step5.value;
|
|
907
|
+
return [
|
|
908
|
+
4,
|
|
909
|
+
generateConfigFile(_object_spread_props(_object_spread({
|
|
910
|
+
serverName: serverName,
|
|
911
|
+
combination: combination,
|
|
912
|
+
transport: transport,
|
|
913
|
+
outputDir: outputDir,
|
|
914
|
+
packageName: packageName,
|
|
915
|
+
packageDir: packageDir
|
|
916
|
+
}, binPath !== undefined && {
|
|
917
|
+
binPath: binPath
|
|
918
|
+
}), {
|
|
919
|
+
metadata: metadata,
|
|
920
|
+
metadataReader: metadataReader,
|
|
921
|
+
httpHost: httpHost,
|
|
922
|
+
httpPort: httpPort,
|
|
923
|
+
useSource: useSource,
|
|
924
|
+
quick: true
|
|
925
|
+
}))
|
|
926
|
+
];
|
|
927
|
+
case 9:
|
|
928
|
+
_state.sent();
|
|
929
|
+
generatedCount++;
|
|
930
|
+
_state.label = 10;
|
|
931
|
+
case 10:
|
|
932
|
+
_iteratorNormalCompletion5 = true;
|
|
933
|
+
return [
|
|
934
|
+
3,
|
|
935
|
+
8
|
|
936
|
+
];
|
|
937
|
+
case 11:
|
|
938
|
+
return [
|
|
939
|
+
3,
|
|
940
|
+
14
|
|
941
|
+
];
|
|
942
|
+
case 12:
|
|
943
|
+
err = _state.sent();
|
|
944
|
+
_didIteratorError5 = true;
|
|
945
|
+
_iteratorError5 = err;
|
|
946
|
+
return [
|
|
947
|
+
3,
|
|
948
|
+
14
|
|
949
|
+
];
|
|
950
|
+
case 13:
|
|
951
|
+
try {
|
|
952
|
+
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
|
953
|
+
_iterator5.return();
|
|
954
|
+
}
|
|
955
|
+
} finally{
|
|
956
|
+
if (_didIteratorError5) {
|
|
957
|
+
throw _iteratorError5;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
return [
|
|
961
|
+
7
|
|
962
|
+
];
|
|
963
|
+
case 14:
|
|
964
|
+
_iteratorNormalCompletion4 = true;
|
|
965
|
+
return [
|
|
966
|
+
3,
|
|
967
|
+
6
|
|
968
|
+
];
|
|
969
|
+
case 15:
|
|
970
|
+
return [
|
|
971
|
+
3,
|
|
972
|
+
18
|
|
973
|
+
];
|
|
974
|
+
case 16:
|
|
975
|
+
err = _state.sent();
|
|
976
|
+
_didIteratorError4 = true;
|
|
977
|
+
_iteratorError4 = err;
|
|
978
|
+
return [
|
|
979
|
+
3,
|
|
980
|
+
18
|
|
981
|
+
];
|
|
982
|
+
case 17:
|
|
983
|
+
try {
|
|
984
|
+
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
985
|
+
_iterator4.return();
|
|
986
|
+
}
|
|
987
|
+
} finally{
|
|
988
|
+
if (_didIteratorError4) {
|
|
989
|
+
throw _iteratorError4;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
return [
|
|
993
|
+
7
|
|
994
|
+
];
|
|
995
|
+
case 18:
|
|
996
|
+
console.log("\n✅ Generated ".concat(generatedCount, " config file(s) in ").concat(outputDir));
|
|
997
|
+
return [
|
|
998
|
+
2
|
|
999
|
+
];
|
|
1000
|
+
case 19:
|
|
1001
|
+
return [
|
|
1002
|
+
4,
|
|
1003
|
+
(0, _select.default)({
|
|
1004
|
+
message: 'What do you want to configure?',
|
|
1005
|
+
choices: [
|
|
1006
|
+
{
|
|
1007
|
+
name: 'Environment variables only',
|
|
1008
|
+
value: 'env',
|
|
1009
|
+
disabled: envVarsWithChoices.length === 0
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
name: 'Package arguments only',
|
|
1013
|
+
value: 'args',
|
|
1014
|
+
disabled: argsWithChoices.length === 0
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
name: 'Both environment variables and package arguments',
|
|
1018
|
+
value: 'both',
|
|
1019
|
+
disabled: envVarsWithChoices.length === 0 || argsWithChoices.length === 0
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
name: 'None (minimal server config)',
|
|
1023
|
+
value: 'none'
|
|
1024
|
+
}
|
|
1025
|
+
].filter(function(choice) {
|
|
1026
|
+
return !choice.disabled;
|
|
1027
|
+
})
|
|
1028
|
+
})
|
|
1029
|
+
];
|
|
1030
|
+
case 20:
|
|
1031
|
+
configMode = _state.sent();
|
|
1032
|
+
if (!(configMode === 'none')) return [
|
|
1033
|
+
3,
|
|
1034
|
+
29
|
|
1035
|
+
];
|
|
1036
|
+
return [
|
|
1037
|
+
4,
|
|
1038
|
+
(0, _input.default)({
|
|
1039
|
+
message: 'Server name for mcpServers config:',
|
|
1040
|
+
default: serverName,
|
|
1041
|
+
validate: function(input) {
|
|
1042
|
+
return input.length > 0 || 'Server name is required';
|
|
1043
|
+
}
|
|
1044
|
+
})
|
|
1045
|
+
];
|
|
1046
|
+
case 21:
|
|
1047
|
+
finalServerName = _state.sent();
|
|
1048
|
+
if (!jsonOutput) return [
|
|
1049
|
+
3,
|
|
1050
|
+
22
|
|
1051
|
+
];
|
|
1052
|
+
_tmp = '.';
|
|
1053
|
+
return [
|
|
1054
|
+
3,
|
|
1055
|
+
24
|
|
1056
|
+
];
|
|
1057
|
+
case 22:
|
|
1058
|
+
return [
|
|
1059
|
+
4,
|
|
1060
|
+
(0, _input.default)({
|
|
1061
|
+
message: 'Output directory:',
|
|
1062
|
+
default: '.'
|
|
1063
|
+
})
|
|
1064
|
+
];
|
|
1065
|
+
case 23:
|
|
1066
|
+
_tmp = _state.sent();
|
|
1067
|
+
_state.label = 24;
|
|
1068
|
+
case 24:
|
|
1069
|
+
outputDir1 = _tmp;
|
|
1070
|
+
combination1 = {
|
|
1071
|
+
name: 'minimal',
|
|
1072
|
+
envKeys: [],
|
|
1073
|
+
argNames: [],
|
|
1074
|
+
defaults: {},
|
|
1075
|
+
argDefaults: {},
|
|
1076
|
+
dimensionValues: {}
|
|
1077
|
+
};
|
|
1078
|
+
if (!jsonOutput) return [
|
|
1079
|
+
3,
|
|
1080
|
+
26
|
|
1081
|
+
];
|
|
1082
|
+
return [
|
|
1083
|
+
4,
|
|
1084
|
+
generateConfigObject(_object_spread_props(_object_spread({
|
|
1085
|
+
serverName: finalServerName,
|
|
1086
|
+
combination: combination1,
|
|
1087
|
+
transport: 'stdio',
|
|
1088
|
+
packageName: packageName,
|
|
1089
|
+
packageDir: packageDir
|
|
1090
|
+
}, binPath !== undefined && {
|
|
1091
|
+
binPath: binPath
|
|
1092
|
+
}), {
|
|
1093
|
+
metadata: metadata,
|
|
1094
|
+
metadataReader: metadataReader,
|
|
1095
|
+
useSource: useSource,
|
|
1096
|
+
quick: quickMode
|
|
1097
|
+
}))
|
|
1098
|
+
];
|
|
1099
|
+
case 25:
|
|
1100
|
+
config = _state.sent();
|
|
1101
|
+
console.log(JSON.stringify(config, null, 2));
|
|
1102
|
+
return [
|
|
1103
|
+
3,
|
|
1104
|
+
28
|
|
1105
|
+
];
|
|
1106
|
+
case 26:
|
|
1107
|
+
_fs.mkdirSync(outputDir1, {
|
|
1108
|
+
recursive: true
|
|
1109
|
+
});
|
|
1110
|
+
return [
|
|
1111
|
+
4,
|
|
1112
|
+
generateConfigFile(_object_spread_props(_object_spread({
|
|
1113
|
+
serverName: finalServerName,
|
|
1114
|
+
combination: combination1,
|
|
1115
|
+
transport: 'stdio',
|
|
1116
|
+
outputDir: outputDir1,
|
|
1117
|
+
packageName: packageName,
|
|
1118
|
+
packageDir: packageDir
|
|
1119
|
+
}, binPath !== undefined && {
|
|
1120
|
+
binPath: binPath
|
|
1121
|
+
}), {
|
|
1122
|
+
metadata: metadata,
|
|
1123
|
+
metadataReader: metadataReader,
|
|
1124
|
+
useSource: useSource,
|
|
1125
|
+
quick: quickMode
|
|
1126
|
+
}))
|
|
1127
|
+
];
|
|
1128
|
+
case 27:
|
|
1129
|
+
_state.sent();
|
|
1130
|
+
console.log("\n✅ Generated 1 config file in ".concat(outputDir1));
|
|
1131
|
+
_state.label = 28;
|
|
1132
|
+
case 28:
|
|
1133
|
+
return [
|
|
1134
|
+
2
|
|
1135
|
+
];
|
|
1136
|
+
case 29:
|
|
1137
|
+
return [
|
|
1138
|
+
4,
|
|
1139
|
+
(0, _checkbox.default)({
|
|
1140
|
+
message: 'Select transports:',
|
|
1141
|
+
choices: [
|
|
1142
|
+
{
|
|
1143
|
+
name: 'stdio',
|
|
1144
|
+
value: 'stdio',
|
|
1145
|
+
checked: true
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
name: 'http',
|
|
1149
|
+
value: 'http',
|
|
1150
|
+
checked: true
|
|
1151
|
+
}
|
|
1152
|
+
],
|
|
1153
|
+
validate: function(choices) {
|
|
1154
|
+
return choices.length > 0 || 'Select at least one transport';
|
|
1155
|
+
}
|
|
1156
|
+
})
|
|
1157
|
+
];
|
|
1158
|
+
case 30:
|
|
1159
|
+
transports1 = _state.sent();
|
|
1160
|
+
// 7. HTTP configuration if HTTP transport selected
|
|
1161
|
+
httpHost1 = 'localhost';
|
|
1162
|
+
httpPort1 = 3000;
|
|
1163
|
+
if (!transports1.includes('http')) return [
|
|
1164
|
+
3,
|
|
1165
|
+
33
|
|
1166
|
+
];
|
|
1167
|
+
return [
|
|
1168
|
+
4,
|
|
1169
|
+
(0, _input.default)({
|
|
1170
|
+
message: 'HTTP host:',
|
|
1171
|
+
default: 'localhost'
|
|
1172
|
+
})
|
|
1173
|
+
];
|
|
1174
|
+
case 31:
|
|
1175
|
+
httpHost1 = _state.sent();
|
|
1176
|
+
return [
|
|
1177
|
+
4,
|
|
1178
|
+
(0, _input.default)({
|
|
1179
|
+
message: 'HTTP port:',
|
|
1180
|
+
default: '3000',
|
|
1181
|
+
validate: function(input) {
|
|
1182
|
+
var port = Number.parseInt(input, 10);
|
|
1183
|
+
return !Number.isNaN(port) && port > 0 && port < 65536 || 'Port must be between 1 and 65535';
|
|
1184
|
+
}
|
|
1185
|
+
})
|
|
1186
|
+
];
|
|
1187
|
+
case 32:
|
|
1188
|
+
portStr = _state.sent();
|
|
1189
|
+
httpPort1 = Number.parseInt(portStr, 10);
|
|
1190
|
+
_state.label = 33;
|
|
1191
|
+
case 33:
|
|
1192
|
+
// 8. Collect available dimensions based on configuration mode
|
|
1193
|
+
availableDimensions = [];
|
|
1194
|
+
if (configMode === 'env' || configMode === 'both') {
|
|
1195
|
+
_iteratorNormalCompletion6 = true, _didIteratorError6 = false, _iteratorError6 = undefined;
|
|
1196
|
+
try {
|
|
1197
|
+
for(_iterator6 = envVarsWithChoices[Symbol.iterator](); !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true){
|
|
1198
|
+
envVar1 = _step6.value;
|
|
1199
|
+
availableDimensions.push({
|
|
1200
|
+
name: envVar1.name,
|
|
1201
|
+
type: 'env',
|
|
1202
|
+
choices: envVar1.choices || []
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
} catch (err) {
|
|
1206
|
+
_didIteratorError6 = true;
|
|
1207
|
+
_iteratorError6 = err;
|
|
1208
|
+
} finally{
|
|
1209
|
+
try {
|
|
1210
|
+
if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
|
|
1211
|
+
_iterator6.return();
|
|
1212
|
+
}
|
|
1213
|
+
} finally{
|
|
1214
|
+
if (_didIteratorError6) {
|
|
1215
|
+
throw _iteratorError6;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
if (configMode === 'args' || configMode === 'both') {
|
|
1221
|
+
_iteratorNormalCompletion7 = true, _didIteratorError7 = false, _iteratorError7 = undefined;
|
|
1222
|
+
try {
|
|
1223
|
+
for(_iterator7 = argsWithChoices[Symbol.iterator](); !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true){
|
|
1224
|
+
arg1 = _step7.value;
|
|
1225
|
+
availableDimensions.push({
|
|
1226
|
+
name: arg1.name,
|
|
1227
|
+
type: 'arg',
|
|
1228
|
+
choices: arg1.choices
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
} catch (err) {
|
|
1232
|
+
_didIteratorError7 = true;
|
|
1233
|
+
_iteratorError7 = err;
|
|
1234
|
+
} finally{
|
|
1235
|
+
try {
|
|
1236
|
+
if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
|
|
1237
|
+
_iterator7.return();
|
|
1238
|
+
}
|
|
1239
|
+
} finally{
|
|
1240
|
+
if (_didIteratorError7) {
|
|
1241
|
+
throw _iteratorError7;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
return [
|
|
1247
|
+
4,
|
|
1248
|
+
(0, _checkbox.default)({
|
|
1249
|
+
message: 'Select dimensions to generate combinations from (order determines filename pattern):',
|
|
1250
|
+
choices: availableDimensions.map(function(d) {
|
|
1251
|
+
return {
|
|
1252
|
+
name: "".concat(d.type === 'env' ? 'ENV' : 'ARG', " ").concat(d.name, " (").concat(d.choices.join(', '), ")"),
|
|
1253
|
+
value: d.name,
|
|
1254
|
+
checked: true
|
|
1255
|
+
};
|
|
1256
|
+
}),
|
|
1257
|
+
validate: function(choices) {
|
|
1258
|
+
return choices.length > 0 || 'Select at least one dimension';
|
|
1259
|
+
}
|
|
1260
|
+
})
|
|
1261
|
+
];
|
|
1262
|
+
case 34:
|
|
1263
|
+
selectedDimensionNames = _state.sent();
|
|
1264
|
+
selectedDimensions = availableDimensions.filter(function(d) {
|
|
1265
|
+
return selectedDimensionNames.includes(d.name);
|
|
1266
|
+
});
|
|
1267
|
+
// 9. For each dimension, select which choices to include (with "skip" option)
|
|
1268
|
+
dimensionsWithFilteredChoices = [];
|
|
1269
|
+
_iteratorNormalCompletion8 = true, _didIteratorError8 = false, _iteratorError8 = undefined;
|
|
1270
|
+
_state.label = 35;
|
|
1271
|
+
case 35:
|
|
1272
|
+
_state.trys.push([
|
|
1273
|
+
35,
|
|
1274
|
+
40,
|
|
1275
|
+
41,
|
|
1276
|
+
42
|
|
1277
|
+
]);
|
|
1278
|
+
_iterator8 = selectedDimensions[Symbol.iterator]();
|
|
1279
|
+
_state.label = 36;
|
|
1280
|
+
case 36:
|
|
1281
|
+
if (!!(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done)) return [
|
|
1282
|
+
3,
|
|
1283
|
+
39
|
|
1284
|
+
];
|
|
1285
|
+
dim = _step8.value;
|
|
1286
|
+
choicesWithSkip = _to_consumable_array(dim.choices).concat([
|
|
1287
|
+
'skip'
|
|
1288
|
+
]);
|
|
1289
|
+
return [
|
|
1290
|
+
4,
|
|
1291
|
+
(0, _checkbox.default)({
|
|
1292
|
+
message: "For ".concat(dim.type === 'env' ? 'ENV' : 'ARG', " ").concat(dim.name, ", select choices to include:"),
|
|
1293
|
+
choices: choicesWithSkip.map(function(choice) {
|
|
1294
|
+
return {
|
|
1295
|
+
name: choice === 'skip' ? 'skip (do not configure)' : choice,
|
|
1296
|
+
value: choice,
|
|
1297
|
+
checked: choice !== 'skip'
|
|
1298
|
+
};
|
|
1299
|
+
}),
|
|
1300
|
+
validate: function(choices) {
|
|
1301
|
+
return choices.length > 0 || 'Select at least one choice (or skip)';
|
|
1302
|
+
}
|
|
1303
|
+
})
|
|
1304
|
+
];
|
|
1305
|
+
case 37:
|
|
1306
|
+
selectedChoices = _state.sent();
|
|
1307
|
+
dimensionsWithFilteredChoices.push(_object_spread_props(_object_spread({}, dim), {
|
|
1308
|
+
choices: selectedChoices
|
|
1309
|
+
}));
|
|
1310
|
+
_state.label = 38;
|
|
1311
|
+
case 38:
|
|
1312
|
+
_iteratorNormalCompletion8 = true;
|
|
1313
|
+
return [
|
|
1314
|
+
3,
|
|
1315
|
+
36
|
|
1316
|
+
];
|
|
1317
|
+
case 39:
|
|
1318
|
+
return [
|
|
1319
|
+
3,
|
|
1320
|
+
42
|
|
1321
|
+
];
|
|
1322
|
+
case 40:
|
|
1323
|
+
err = _state.sent();
|
|
1324
|
+
_didIteratorError8 = true;
|
|
1325
|
+
_iteratorError8 = err;
|
|
1326
|
+
return [
|
|
1327
|
+
3,
|
|
1328
|
+
42
|
|
1329
|
+
];
|
|
1330
|
+
case 41:
|
|
1331
|
+
try {
|
|
1332
|
+
if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
|
|
1333
|
+
_iterator8.return();
|
|
1334
|
+
}
|
|
1335
|
+
} finally{
|
|
1336
|
+
if (_didIteratorError8) {
|
|
1337
|
+
throw _iteratorError8;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
return [
|
|
1341
|
+
7
|
|
1342
|
+
];
|
|
1343
|
+
case 42:
|
|
1344
|
+
// 10. For non-dimensions with choices, get default values (including "skip")
|
|
1345
|
+
dimensionNames = selectedDimensions.map(function(d) {
|
|
1346
|
+
return d.name;
|
|
1347
|
+
});
|
|
1348
|
+
nonDimensionEnvVars = envVarsWithChoices.filter(function(e) {
|
|
1349
|
+
return !dimensionNames.includes(e.name);
|
|
1350
|
+
});
|
|
1351
|
+
nonDimensionArgs = argsWithChoices.filter(function(a) {
|
|
1352
|
+
return !dimensionNames.includes(a.name);
|
|
1353
|
+
});
|
|
1354
|
+
defaults1 = {};
|
|
1355
|
+
argDefaults = {};
|
|
1356
|
+
if (!(configMode === 'env' || configMode === 'both')) return [
|
|
1357
|
+
3,
|
|
1358
|
+
50
|
|
1359
|
+
];
|
|
1360
|
+
_iteratorNormalCompletion9 = true, _didIteratorError9 = false, _iteratorError9 = undefined;
|
|
1361
|
+
_state.label = 43;
|
|
1362
|
+
case 43:
|
|
1363
|
+
_state.trys.push([
|
|
1364
|
+
43,
|
|
1365
|
+
48,
|
|
1366
|
+
49,
|
|
1367
|
+
50
|
|
1368
|
+
]);
|
|
1369
|
+
_iterator9 = nonDimensionEnvVars[Symbol.iterator]();
|
|
1370
|
+
_state.label = 44;
|
|
1371
|
+
case 44:
|
|
1372
|
+
if (!!(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done)) return [
|
|
1373
|
+
3,
|
|
1374
|
+
47
|
|
1375
|
+
];
|
|
1376
|
+
envVar2 = _step9.value;
|
|
1377
|
+
choicesWithSkip1 = _to_consumable_array(envVar2.choices || []).concat([
|
|
1378
|
+
'skip'
|
|
1379
|
+
]);
|
|
1380
|
+
return [
|
|
1381
|
+
4,
|
|
1382
|
+
(0, _select.default)({
|
|
1383
|
+
message: "Select default value for ENV ".concat(envVar2.name, " (used in all configs)"),
|
|
1384
|
+
choices: choicesWithSkip1.map(function(c) {
|
|
1385
|
+
return {
|
|
1386
|
+
name: c === 'skip' ? 'skip (do not configure)' : c,
|
|
1387
|
+
value: c
|
|
1388
|
+
};
|
|
1389
|
+
})
|
|
1390
|
+
})
|
|
1391
|
+
];
|
|
1392
|
+
case 45:
|
|
1393
|
+
defaultValue = _state.sent();
|
|
1394
|
+
if (defaultValue !== 'skip') {
|
|
1395
|
+
defaults1[envVar2.name] = defaultValue;
|
|
1396
|
+
}
|
|
1397
|
+
_state.label = 46;
|
|
1398
|
+
case 46:
|
|
1399
|
+
_iteratorNormalCompletion9 = true;
|
|
1400
|
+
return [
|
|
1401
|
+
3,
|
|
1402
|
+
44
|
|
1403
|
+
];
|
|
1404
|
+
case 47:
|
|
1405
|
+
return [
|
|
1406
|
+
3,
|
|
1407
|
+
50
|
|
1408
|
+
];
|
|
1409
|
+
case 48:
|
|
1410
|
+
err = _state.sent();
|
|
1411
|
+
_didIteratorError9 = true;
|
|
1412
|
+
_iteratorError9 = err;
|
|
1413
|
+
return [
|
|
1414
|
+
3,
|
|
1415
|
+
50
|
|
1416
|
+
];
|
|
1417
|
+
case 49:
|
|
1418
|
+
try {
|
|
1419
|
+
if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
|
|
1420
|
+
_iterator9.return();
|
|
1421
|
+
}
|
|
1422
|
+
} finally{
|
|
1423
|
+
if (_didIteratorError9) {
|
|
1424
|
+
throw _iteratorError9;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
return [
|
|
1428
|
+
7
|
|
1429
|
+
];
|
|
1430
|
+
case 50:
|
|
1431
|
+
if (!(configMode === 'args' || configMode === 'both')) return [
|
|
1432
|
+
3,
|
|
1433
|
+
58
|
|
1434
|
+
];
|
|
1435
|
+
_iteratorNormalCompletion10 = true, _didIteratorError10 = false, _iteratorError10 = undefined;
|
|
1436
|
+
_state.label = 51;
|
|
1437
|
+
case 51:
|
|
1438
|
+
_state.trys.push([
|
|
1439
|
+
51,
|
|
1440
|
+
56,
|
|
1441
|
+
57,
|
|
1442
|
+
58
|
|
1443
|
+
]);
|
|
1444
|
+
_iterator10 = nonDimensionArgs[Symbol.iterator]();
|
|
1445
|
+
_state.label = 52;
|
|
1446
|
+
case 52:
|
|
1447
|
+
if (!!(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done)) return [
|
|
1448
|
+
3,
|
|
1449
|
+
55
|
|
1450
|
+
];
|
|
1451
|
+
arg2 = _step10.value;
|
|
1452
|
+
choicesWithSkip2 = _to_consumable_array(arg2.choices).concat([
|
|
1453
|
+
'skip'
|
|
1454
|
+
]);
|
|
1455
|
+
return [
|
|
1456
|
+
4,
|
|
1457
|
+
(0, _select.default)({
|
|
1458
|
+
message: "Select default value for ARG ".concat(arg2.name, " (used in all configs)"),
|
|
1459
|
+
choices: choicesWithSkip2.map(function(c) {
|
|
1460
|
+
return {
|
|
1461
|
+
name: c === 'skip' ? 'skip (do not configure)' : c,
|
|
1462
|
+
value: c
|
|
1463
|
+
};
|
|
1464
|
+
})
|
|
1465
|
+
})
|
|
1466
|
+
];
|
|
1467
|
+
case 53:
|
|
1468
|
+
defaultValue1 = _state.sent();
|
|
1469
|
+
if (defaultValue1 !== 'skip') {
|
|
1470
|
+
argDefaults[arg2.name] = defaultValue1;
|
|
1471
|
+
}
|
|
1472
|
+
_state.label = 54;
|
|
1473
|
+
case 54:
|
|
1474
|
+
_iteratorNormalCompletion10 = true;
|
|
1475
|
+
return [
|
|
1476
|
+
3,
|
|
1477
|
+
52
|
|
1478
|
+
];
|
|
1479
|
+
case 55:
|
|
1480
|
+
return [
|
|
1481
|
+
3,
|
|
1482
|
+
58
|
|
1483
|
+
];
|
|
1484
|
+
case 56:
|
|
1485
|
+
err = _state.sent();
|
|
1486
|
+
_didIteratorError10 = true;
|
|
1487
|
+
_iteratorError10 = err;
|
|
1488
|
+
return [
|
|
1489
|
+
3,
|
|
1490
|
+
58
|
|
1491
|
+
];
|
|
1492
|
+
case 57:
|
|
1493
|
+
try {
|
|
1494
|
+
if (!_iteratorNormalCompletion10 && _iterator10.return != null) {
|
|
1495
|
+
_iterator10.return();
|
|
1496
|
+
}
|
|
1497
|
+
} finally{
|
|
1498
|
+
if (_didIteratorError10) {
|
|
1499
|
+
throw _iteratorError10;
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
return [
|
|
1503
|
+
7
|
|
1504
|
+
];
|
|
1505
|
+
case 58:
|
|
1506
|
+
// 11. Generate combinations as cartesian product
|
|
1507
|
+
combinations1 = generateCartesianProduct(dimensionsWithFilteredChoices).map(function(choiceValues) {
|
|
1508
|
+
// Build name from dimensions that have multiple choices (single-choice dimensions don't add discriminating value)
|
|
1509
|
+
// Also filter out "skip" values
|
|
1510
|
+
var nameParts = [];
|
|
1511
|
+
for(var i = 0; i < choiceValues.length; i++){
|
|
1512
|
+
var dim = dimensionsWithFilteredChoices[i];
|
|
1513
|
+
var value = choiceValues[i];
|
|
1514
|
+
// Only include in name if: not "skip" AND dimension has multiple selected choices
|
|
1515
|
+
if (dim && value !== 'skip' && dim.choices.filter(function(c) {
|
|
1516
|
+
return c !== 'skip';
|
|
1517
|
+
}).length > 1) {
|
|
1518
|
+
nameParts.push(value || '');
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
var name = nameParts.length > 0 ? nameParts.join('-').toLowerCase() : 'defaults';
|
|
1522
|
+
// Map choice values back to dimension names (excluding "skip")
|
|
1523
|
+
var dimensionValues = {};
|
|
1524
|
+
for(var i1 = 0; i1 < choiceValues.length; i1++){
|
|
1525
|
+
var dimension = dimensionsWithFilteredChoices[i1];
|
|
1526
|
+
var value1 = choiceValues[i1];
|
|
1527
|
+
if (dimension && value1 !== 'skip') {
|
|
1528
|
+
dimensionValues[dimension.name] = value1 || '';
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
// Include env vars and args based on what's configured
|
|
1532
|
+
var allEnvKeys = (stdioPackage.environmentVariables || []).map(function(e) {
|
|
1533
|
+
return e.name;
|
|
1534
|
+
});
|
|
1535
|
+
var allArgNames = (stdioPackage.packageArguments || []).map(function(a) {
|
|
1536
|
+
return a.name;
|
|
1537
|
+
});
|
|
1538
|
+
return {
|
|
1539
|
+
name: name,
|
|
1540
|
+
envKeys: configMode === 'env' || configMode === 'both' ? allEnvKeys : [],
|
|
1541
|
+
argNames: configMode === 'args' || configMode === 'both' ? allArgNames : [],
|
|
1542
|
+
defaults: defaults1,
|
|
1543
|
+
argDefaults: argDefaults,
|
|
1544
|
+
dimensionValues: dimensionValues
|
|
1545
|
+
};
|
|
1546
|
+
});
|
|
1547
|
+
// 12. Show preview with final counts
|
|
1548
|
+
totalConfigs = combinations1.length * transports1.length;
|
|
1549
|
+
console.log('\n📋 Preview:');
|
|
1550
|
+
console.log(" ".concat(combinations1.length, " combination(s) \xd7 ").concat(transports1.length, " transport(s) = ").concat(totalConfigs, " config file(s)"));
|
|
1551
|
+
console.log('\n Combinations:');
|
|
1552
|
+
_iteratorNormalCompletion11 = true, _didIteratorError11 = false, _iteratorError11 = undefined;
|
|
1553
|
+
try {
|
|
1554
|
+
for(_iterator11 = combinations1[Symbol.iterator](); !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true){
|
|
1555
|
+
combo1 = _step11.value;
|
|
1556
|
+
console.log(" • ".concat(combo1.name));
|
|
1557
|
+
}
|
|
1558
|
+
} catch (err) {
|
|
1559
|
+
_didIteratorError11 = true;
|
|
1560
|
+
_iteratorError11 = err;
|
|
1561
|
+
} finally{
|
|
1562
|
+
try {
|
|
1563
|
+
if (!_iteratorNormalCompletion11 && _iterator11.return != null) {
|
|
1564
|
+
_iterator11.return();
|
|
1565
|
+
}
|
|
1566
|
+
} finally{
|
|
1567
|
+
if (_didIteratorError11) {
|
|
1568
|
+
throw _iteratorError11;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
console.log("\n Transports: ".concat(transports1.join(', ')));
|
|
1573
|
+
if (Object.keys(defaults1).length > 0) {
|
|
1574
|
+
console.log('\n Default ENV values (used in all configs):');
|
|
1575
|
+
_iteratorNormalCompletion12 = true, _didIteratorError12 = false, _iteratorError12 = undefined;
|
|
1576
|
+
try {
|
|
1577
|
+
for(_iterator12 = Object.entries(defaults1)[Symbol.iterator](); !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true){
|
|
1578
|
+
_step_value = _sliced_to_array(_step12.value, 2), key = _step_value[0], value = _step_value[1];
|
|
1579
|
+
console.log(" • ".concat(key, "=").concat(value));
|
|
1580
|
+
}
|
|
1581
|
+
} catch (err) {
|
|
1582
|
+
_didIteratorError12 = true;
|
|
1583
|
+
_iteratorError12 = err;
|
|
1584
|
+
} finally{
|
|
1585
|
+
try {
|
|
1586
|
+
if (!_iteratorNormalCompletion12 && _iterator12.return != null) {
|
|
1587
|
+
_iterator12.return();
|
|
1588
|
+
}
|
|
1589
|
+
} finally{
|
|
1590
|
+
if (_didIteratorError12) {
|
|
1591
|
+
throw _iteratorError12;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
if (Object.keys(argDefaults).length > 0) {
|
|
1597
|
+
console.log('\n Default ARG values (used in all configs):');
|
|
1598
|
+
_iteratorNormalCompletion13 = true, _didIteratorError13 = false, _iteratorError13 = undefined;
|
|
1599
|
+
try {
|
|
1600
|
+
for(_iterator13 = Object.entries(argDefaults)[Symbol.iterator](); !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true){
|
|
1601
|
+
_step_value1 = _sliced_to_array(_step13.value, 2), key1 = _step_value1[0], value1 = _step_value1[1];
|
|
1602
|
+
console.log(" • ".concat(key1, "=").concat(value1));
|
|
1603
|
+
}
|
|
1604
|
+
} catch (err) {
|
|
1605
|
+
_didIteratorError13 = true;
|
|
1606
|
+
_iteratorError13 = err;
|
|
1607
|
+
} finally{
|
|
1608
|
+
try {
|
|
1609
|
+
if (!_iteratorNormalCompletion13 && _iterator13.return != null) {
|
|
1610
|
+
_iterator13.return();
|
|
1611
|
+
}
|
|
1612
|
+
} finally{
|
|
1613
|
+
if (_didIteratorError13) {
|
|
1614
|
+
throw _iteratorError13;
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
console.log();
|
|
1620
|
+
return [
|
|
1621
|
+
4,
|
|
1622
|
+
(0, _select.default)({
|
|
1623
|
+
message: 'How would you like to proceed?',
|
|
1624
|
+
choices: [
|
|
1625
|
+
{
|
|
1626
|
+
name: 'Generate all configurations',
|
|
1627
|
+
value: 'all'
|
|
1628
|
+
},
|
|
1629
|
+
{
|
|
1630
|
+
name: 'Select specific configurations',
|
|
1631
|
+
value: 'select'
|
|
1632
|
+
},
|
|
1633
|
+
{
|
|
1634
|
+
name: 'Cancel',
|
|
1635
|
+
value: 'cancel'
|
|
1636
|
+
}
|
|
1637
|
+
]
|
|
1638
|
+
})
|
|
1639
|
+
];
|
|
1640
|
+
case 59:
|
|
1641
|
+
generationMode = _state.sent();
|
|
1642
|
+
if (generationMode === 'cancel') {
|
|
1643
|
+
console.log('❌ Cancelled');
|
|
1644
|
+
process.exit(0);
|
|
1645
|
+
}
|
|
1646
|
+
// Build all config choices
|
|
1647
|
+
allChoices = createConfigChoices(combinations1, transports1);
|
|
1648
|
+
if (!(generationMode === 'select')) return [
|
|
1649
|
+
3,
|
|
1650
|
+
61
|
|
1651
|
+
];
|
|
1652
|
+
return [
|
|
1653
|
+
4,
|
|
1654
|
+
(0, _checkbox.default)({
|
|
1655
|
+
message: 'Select configurations to generate:',
|
|
1656
|
+
choices: allChoices.map(function(choice) {
|
|
1657
|
+
return {
|
|
1658
|
+
name: choice.label,
|
|
1659
|
+
value: choice.label,
|
|
1660
|
+
checked: true
|
|
1661
|
+
};
|
|
1662
|
+
}),
|
|
1663
|
+
required: true
|
|
1664
|
+
})
|
|
1665
|
+
];
|
|
1666
|
+
case 60:
|
|
1667
|
+
selectedLabels = _state.sent();
|
|
1668
|
+
selectedConfigs = filterConfigChoices(allChoices, selectedLabels);
|
|
1669
|
+
if (selectedConfigs.length === 0) {
|
|
1670
|
+
console.log('❌ No configurations selected');
|
|
1671
|
+
process.exit(0);
|
|
1672
|
+
}
|
|
1673
|
+
console.log("\n\uD83D\uDCCB Selected ".concat(selectedConfigs.length, " configuration(s)"));
|
|
1674
|
+
return [
|
|
1675
|
+
3,
|
|
1676
|
+
62
|
|
1677
|
+
];
|
|
1678
|
+
case 61:
|
|
1679
|
+
// Generate all
|
|
1680
|
+
selectedConfigs = allChoices;
|
|
1681
|
+
_state.label = 62;
|
|
1682
|
+
case 62:
|
|
1683
|
+
return [
|
|
1684
|
+
4,
|
|
1685
|
+
(0, _input.default)({
|
|
1686
|
+
message: 'Server name for mcpServers config:',
|
|
1687
|
+
default: serverName,
|
|
1688
|
+
validate: function(input) {
|
|
1689
|
+
return input.length > 0 || 'Server name is required';
|
|
1690
|
+
}
|
|
1691
|
+
})
|
|
1692
|
+
];
|
|
1693
|
+
case 63:
|
|
1694
|
+
finalServerName1 = _state.sent();
|
|
1695
|
+
if (!jsonOutput) return [
|
|
1696
|
+
3,
|
|
1697
|
+
64
|
|
1698
|
+
];
|
|
1699
|
+
_tmp1 = '.';
|
|
1700
|
+
return [
|
|
1701
|
+
3,
|
|
1702
|
+
66
|
|
1703
|
+
];
|
|
1704
|
+
case 64:
|
|
1705
|
+
return [
|
|
1706
|
+
4,
|
|
1707
|
+
(0, _input.default)({
|
|
1708
|
+
message: 'Output directory:',
|
|
1709
|
+
default: '.'
|
|
1710
|
+
})
|
|
1711
|
+
];
|
|
1712
|
+
case 65:
|
|
1713
|
+
_tmp1 = _state.sent();
|
|
1714
|
+
_state.label = 66;
|
|
1715
|
+
case 66:
|
|
1716
|
+
outputDir2 = _tmp1;
|
|
1717
|
+
// 13a. Select which optional env vars to prompt for (per-config prompting happens later)
|
|
1718
|
+
// This is just a FILTER - actual prompting happens in buildServerConfig with config context
|
|
1719
|
+
optionalVarsToPrompt = new Set();
|
|
1720
|
+
if (!(!quickMode && process.stdin.isTTY)) return [
|
|
1721
|
+
3,
|
|
1722
|
+
70
|
|
1723
|
+
];
|
|
1724
|
+
envVarsWithContext = new Map();
|
|
1725
|
+
// Get the primary dimension (usually AUTH_MODE) for context grouping
|
|
1726
|
+
primaryDimensionName = selectedDimensions.length > 0 ? (_selectedDimensions_ = selectedDimensions[0]) === null || _selectedDimensions_ === void 0 ? void 0 : _selectedDimensions_.name : undefined;
|
|
1727
|
+
_iteratorNormalCompletion14 = true, _didIteratorError14 = false, _iteratorError14 = undefined;
|
|
1728
|
+
try {
|
|
1729
|
+
for(_iterator14 = selectedConfigs[Symbol.iterator](); !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true){
|
|
1730
|
+
combination2 = _step14.value.combination;
|
|
1731
|
+
allEnvVars = stdioPackage.environmentVariables || [];
|
|
1732
|
+
_iteratorNormalCompletion15 = true, _didIteratorError15 = false, _iteratorError15 = undefined;
|
|
1733
|
+
try {
|
|
1734
|
+
for(_iterator15 = allEnvVars[Symbol.iterator](); !(_iteratorNormalCompletion15 = (_step15 = _iterator15.next()).done); _iteratorNormalCompletion15 = true){
|
|
1735
|
+
envVar3 = _step15.value;
|
|
1736
|
+
// Skip if already in defaults or dimension values
|
|
1737
|
+
if (combination2.envKeys.includes(envVar3.name) && Object.keys(combination2.dimensionValues).includes(envVar3.name)) {
|
|
1738
|
+
continue;
|
|
1739
|
+
}
|
|
1740
|
+
if (Object.keys(combination2.defaults).includes(envVar3.name)) {
|
|
1741
|
+
continue;
|
|
1742
|
+
}
|
|
1743
|
+
// Check dependsOn
|
|
1744
|
+
if (!shouldPromptEnvVar(envVar3, combination2.dimensionValues)) {
|
|
1745
|
+
continue;
|
|
1746
|
+
}
|
|
1747
|
+
// Only collect optional env vars (required ones are always prompted per-config)
|
|
1748
|
+
if (!envVar3.isRequired) {
|
|
1749
|
+
if (!envVarsWithContext.has(envVar3.name)) {
|
|
1750
|
+
envVarsWithContext.set(envVar3.name, {
|
|
1751
|
+
envVar: envVar3,
|
|
1752
|
+
relevantModes: new Set(),
|
|
1753
|
+
appliesToAll: !envVar3.dependsOn
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
context = envVarsWithContext.get(envVar3.name);
|
|
1757
|
+
// Track which primary dimension value this var is relevant to
|
|
1758
|
+
if (context && primaryDimensionName && combination2.dimensionValues[primaryDimensionName]) {
|
|
1759
|
+
context.relevantModes.add(combination2.dimensionValues[primaryDimensionName]);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
} catch (err) {
|
|
1764
|
+
_didIteratorError15 = true;
|
|
1765
|
+
_iteratorError15 = err;
|
|
1766
|
+
} finally{
|
|
1767
|
+
try {
|
|
1768
|
+
if (!_iteratorNormalCompletion15 && _iterator15.return != null) {
|
|
1769
|
+
_iterator15.return();
|
|
1770
|
+
}
|
|
1771
|
+
} finally{
|
|
1772
|
+
if (_didIteratorError15) {
|
|
1773
|
+
throw _iteratorError15;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
} catch (err) {
|
|
1779
|
+
_didIteratorError14 = true;
|
|
1780
|
+
_iteratorError14 = err;
|
|
1781
|
+
} finally{
|
|
1782
|
+
try {
|
|
1783
|
+
if (!_iteratorNormalCompletion14 && _iterator14.return != null) {
|
|
1784
|
+
_iterator14.return();
|
|
1785
|
+
}
|
|
1786
|
+
} finally{
|
|
1787
|
+
if (_didIteratorError14) {
|
|
1788
|
+
throw _iteratorError14;
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
if (!(envVarsWithContext.size > 0)) return [
|
|
1793
|
+
3,
|
|
1794
|
+
70
|
|
1795
|
+
];
|
|
1796
|
+
// Group env vars by their relevance for clearer display
|
|
1797
|
+
allSelectedModes = new Set(selectedConfigs.map(function(c) {
|
|
1798
|
+
return primaryDimensionName ? c.combination.dimensionValues[primaryDimensionName] : '';
|
|
1799
|
+
}).filter(Boolean));
|
|
1800
|
+
groupedVars = new Map();
|
|
1801
|
+
_iteratorNormalCompletion16 = true, _didIteratorError16 = false, _iteratorError16 = undefined;
|
|
1802
|
+
try {
|
|
1803
|
+
for(_iterator16 = envVarsWithContext.values()[Symbol.iterator](); !(_iteratorNormalCompletion16 = (_step16 = _iterator16.next()).done); _iteratorNormalCompletion16 = true){
|
|
1804
|
+
_step_value2 = _step16.value, envVar4 = _step_value2.envVar, relevantModes = _step_value2.relevantModes, appliesToAll = _step_value2.appliesToAll;
|
|
1805
|
+
;
|
|
1806
|
+
groupKey = void 0;
|
|
1807
|
+
if (appliesToAll || relevantModes.size === allSelectedModes.size) {
|
|
1808
|
+
groupKey = 'all';
|
|
1809
|
+
} else {
|
|
1810
|
+
// Sort modes for consistent display
|
|
1811
|
+
groupKey = Array.from(relevantModes).sort().join(', ');
|
|
1812
|
+
}
|
|
1813
|
+
if (!groupedVars.has(groupKey)) {
|
|
1814
|
+
groupedVars.set(groupKey, []);
|
|
1815
|
+
}
|
|
1816
|
+
(_groupedVars_get = groupedVars.get(groupKey)) === null || _groupedVars_get === void 0 ? void 0 : _groupedVars_get.push(envVar4);
|
|
1817
|
+
}
|
|
1818
|
+
} catch (err) {
|
|
1819
|
+
_didIteratorError16 = true;
|
|
1820
|
+
_iteratorError16 = err;
|
|
1821
|
+
} finally{
|
|
1822
|
+
try {
|
|
1823
|
+
if (!_iteratorNormalCompletion16 && _iterator16.return != null) {
|
|
1824
|
+
_iterator16.return();
|
|
1825
|
+
}
|
|
1826
|
+
} finally{
|
|
1827
|
+
if (_didIteratorError16) {
|
|
1828
|
+
throw _iteratorError16;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
console.log("\n\uD83D\uDCCB ".concat(envVarsWithContext.size, " optional env var(s) can be configured:"));
|
|
1833
|
+
// Build template vars from HTTP settings for placeholder substitution
|
|
1834
|
+
templateVars = {};
|
|
1835
|
+
if (transports1.includes('http') || transports1.includes('streamable-http')) {
|
|
1836
|
+
templateVars.HOST = httpHost1;
|
|
1837
|
+
templateVars.PORT = String(httpPort1);
|
|
1838
|
+
}
|
|
1839
|
+
_iteratorNormalCompletion17 = true, _didIteratorError17 = false, _iteratorError17 = undefined;
|
|
1840
|
+
try {
|
|
1841
|
+
// Display grouped by relevance
|
|
1842
|
+
for(_iterator17 = groupedVars.entries()[Symbol.iterator](); !(_iteratorNormalCompletion17 = (_step17 = _iterator17.next()).done); _iteratorNormalCompletion17 = true){
|
|
1843
|
+
_step_value3 = _sliced_to_array(_step17.value, 2), groupKey1 = _step_value3[0], vars = _step_value3[1];
|
|
1844
|
+
if (groupKey1 === 'all') {
|
|
1845
|
+
console.log('\n For all configurations:');
|
|
1846
|
+
} else {
|
|
1847
|
+
console.log("\n For ".concat(groupKey1, " mode:"));
|
|
1848
|
+
}
|
|
1849
|
+
_iteratorNormalCompletion18 = true, _didIteratorError18 = false, _iteratorError18 = undefined;
|
|
1850
|
+
try {
|
|
1851
|
+
for(_iterator18 = vars[Symbol.iterator](); !(_iteratorNormalCompletion18 = (_step18 = _iterator18.next()).done); _iteratorNormalCompletion18 = true){
|
|
1852
|
+
envVar5 = _step18.value;
|
|
1853
|
+
;
|
|
1854
|
+
rawDefault = (_ref = (_envVar_default = envVar5.default) !== null && _envVar_default !== void 0 ? _envVar_default : envVar5.value) !== null && _ref !== void 0 ? _ref : envVar5.placeholder;
|
|
1855
|
+
defaultVal = (0, _envpromptingts.substituteTemplateVars)(rawDefault, templateVars);
|
|
1856
|
+
label = defaultVal ? "(default: ".concat(defaultVal, ")") : '(no default)';
|
|
1857
|
+
console.log(" • ".concat(envVar5.name, " - ").concat(envVar5.description || 'optional', " ").concat(label));
|
|
1858
|
+
}
|
|
1859
|
+
} catch (err) {
|
|
1860
|
+
_didIteratorError18 = true;
|
|
1861
|
+
_iteratorError18 = err;
|
|
1862
|
+
} finally{
|
|
1863
|
+
try {
|
|
1864
|
+
if (!_iteratorNormalCompletion18 && _iterator18.return != null) {
|
|
1865
|
+
_iterator18.return();
|
|
1866
|
+
}
|
|
1867
|
+
} finally{
|
|
1868
|
+
if (_didIteratorError18) {
|
|
1869
|
+
throw _iteratorError18;
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
} catch (err) {
|
|
1875
|
+
_didIteratorError17 = true;
|
|
1876
|
+
_iteratorError17 = err;
|
|
1877
|
+
} finally{
|
|
1878
|
+
try {
|
|
1879
|
+
if (!_iteratorNormalCompletion17 && _iterator17.return != null) {
|
|
1880
|
+
_iterator17.return();
|
|
1881
|
+
}
|
|
1882
|
+
} finally{
|
|
1883
|
+
if (_didIteratorError17) {
|
|
1884
|
+
throw _iteratorError17;
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
// Build flat list of all optional var names for checkbox selection
|
|
1889
|
+
allOptionalVarNames = Array.from(envVarsWithContext.keys());
|
|
1890
|
+
return [
|
|
1891
|
+
4,
|
|
1892
|
+
(0, _select.default)({
|
|
1893
|
+
message: '\nConfigure optional env vars?',
|
|
1894
|
+
choices: [
|
|
1895
|
+
{
|
|
1896
|
+
name: 'None (use defaults)',
|
|
1897
|
+
value: 'none'
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
name: 'All (prompt for each config)',
|
|
1901
|
+
value: 'all'
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
name: 'Select specific ones',
|
|
1905
|
+
value: 'select'
|
|
1906
|
+
}
|
|
1907
|
+
],
|
|
1908
|
+
default: 'none'
|
|
1909
|
+
})
|
|
1910
|
+
];
|
|
1911
|
+
case 67:
|
|
1912
|
+
configureChoice = _state.sent();
|
|
1913
|
+
if (!(configureChoice === 'all')) return [
|
|
1914
|
+
3,
|
|
1915
|
+
68
|
|
1916
|
+
];
|
|
1917
|
+
_iteratorNormalCompletion19 = true, _didIteratorError19 = false, _iteratorError19 = undefined;
|
|
1918
|
+
try {
|
|
1919
|
+
// Add all optional vars to the prompt set
|
|
1920
|
+
for(_iterator19 = allOptionalVarNames[Symbol.iterator](); !(_iteratorNormalCompletion19 = (_step19 = _iterator19.next()).done); _iteratorNormalCompletion19 = true){
|
|
1921
|
+
name = _step19.value;
|
|
1922
|
+
optionalVarsToPrompt.add(name);
|
|
1923
|
+
}
|
|
1924
|
+
} catch (err) {
|
|
1925
|
+
_didIteratorError19 = true;
|
|
1926
|
+
_iteratorError19 = err;
|
|
1927
|
+
} finally{
|
|
1928
|
+
try {
|
|
1929
|
+
if (!_iteratorNormalCompletion19 && _iterator19.return != null) {
|
|
1930
|
+
_iterator19.return();
|
|
1931
|
+
}
|
|
1932
|
+
} finally{
|
|
1933
|
+
if (_didIteratorError19) {
|
|
1934
|
+
throw _iteratorError19;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
return [
|
|
1939
|
+
3,
|
|
1940
|
+
70
|
|
1941
|
+
];
|
|
1942
|
+
case 68:
|
|
1943
|
+
if (!(configureChoice === 'select')) return [
|
|
1944
|
+
3,
|
|
1945
|
+
70
|
|
1946
|
+
];
|
|
1947
|
+
// Show multi-select checkbox grouped by relevance
|
|
1948
|
+
checkboxChoices = [];
|
|
1949
|
+
_iteratorNormalCompletion20 = true, _didIteratorError20 = false, _iteratorError20 = undefined;
|
|
1950
|
+
try {
|
|
1951
|
+
for(_iterator20 = groupedVars.entries()[Symbol.iterator](); !(_iteratorNormalCompletion20 = (_step20 = _iterator20.next()).done); _iteratorNormalCompletion20 = true){
|
|
1952
|
+
_step_value4 = _sliced_to_array(_step20.value, 2), groupKey2 = _step_value4[0], vars1 = _step_value4[1];
|
|
1953
|
+
// Add group separator
|
|
1954
|
+
checkboxChoices.push({
|
|
1955
|
+
name: groupKey2 === 'all' ? '── For all configurations ──' : "── For ".concat(groupKey2, " mode ──"),
|
|
1956
|
+
value: "__separator__".concat(groupKey2),
|
|
1957
|
+
disabled: ' '
|
|
1958
|
+
});
|
|
1959
|
+
_iteratorNormalCompletion21 = true, _didIteratorError21 = false, _iteratorError21 = undefined;
|
|
1960
|
+
try {
|
|
1961
|
+
for(_iterator21 = vars1[Symbol.iterator](); !(_iteratorNormalCompletion21 = (_step21 = _iterator21.next()).done); _iteratorNormalCompletion21 = true){
|
|
1962
|
+
envVar6 = _step21.value;
|
|
1963
|
+
;
|
|
1964
|
+
rawDefault1 = (_ref1 = (_envVar_default1 = envVar6.default) !== null && _envVar_default1 !== void 0 ? _envVar_default1 : envVar6.value) !== null && _ref1 !== void 0 ? _ref1 : envVar6.placeholder;
|
|
1965
|
+
defaultVal1 = (0, _envpromptingts.substituteTemplateVars)(rawDefault1, templateVars);
|
|
1966
|
+
label1 = defaultVal1 ? " (default: ".concat(defaultVal1, ")") : '';
|
|
1967
|
+
checkboxChoices.push({
|
|
1968
|
+
name: "".concat(envVar6.name, " - ").concat(envVar6.description || 'optional').concat(label1),
|
|
1969
|
+
value: envVar6.name
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
} catch (err) {
|
|
1973
|
+
_didIteratorError21 = true;
|
|
1974
|
+
_iteratorError21 = err;
|
|
1975
|
+
} finally{
|
|
1976
|
+
try {
|
|
1977
|
+
if (!_iteratorNormalCompletion21 && _iterator21.return != null) {
|
|
1978
|
+
_iterator21.return();
|
|
1979
|
+
}
|
|
1980
|
+
} finally{
|
|
1981
|
+
if (_didIteratorError21) {
|
|
1982
|
+
throw _iteratorError21;
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
} catch (err) {
|
|
1988
|
+
_didIteratorError20 = true;
|
|
1989
|
+
_iteratorError20 = err;
|
|
1990
|
+
} finally{
|
|
1991
|
+
try {
|
|
1992
|
+
if (!_iteratorNormalCompletion20 && _iterator20.return != null) {
|
|
1993
|
+
_iterator20.return();
|
|
1994
|
+
}
|
|
1995
|
+
} finally{
|
|
1996
|
+
if (_didIteratorError20) {
|
|
1997
|
+
throw _iteratorError20;
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
return [
|
|
2002
|
+
4,
|
|
2003
|
+
(0, _checkbox.default)({
|
|
2004
|
+
message: 'Select which env vars to configure:',
|
|
2005
|
+
choices: checkboxChoices
|
|
2006
|
+
})
|
|
2007
|
+
];
|
|
2008
|
+
case 69:
|
|
2009
|
+
selectedVarNames = _state.sent();
|
|
2010
|
+
_iteratorNormalCompletion22 = true, _didIteratorError22 = false, _iteratorError22 = undefined;
|
|
2011
|
+
try {
|
|
2012
|
+
// Add selected vars to the prompt set (excluding separators)
|
|
2013
|
+
for(_iterator22 = selectedVarNames[Symbol.iterator](); !(_iteratorNormalCompletion22 = (_step22 = _iterator22.next()).done); _iteratorNormalCompletion22 = true){
|
|
2014
|
+
name1 = _step22.value;
|
|
2015
|
+
if (!name1.startsWith('__separator__')) {
|
|
2016
|
+
optionalVarsToPrompt.add(name1);
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
} catch (err) {
|
|
2020
|
+
_didIteratorError22 = true;
|
|
2021
|
+
_iteratorError22 = err;
|
|
2022
|
+
} finally{
|
|
2023
|
+
try {
|
|
2024
|
+
if (!_iteratorNormalCompletion22 && _iterator22.return != null) {
|
|
2025
|
+
_iterator22.return();
|
|
2026
|
+
}
|
|
2027
|
+
} finally{
|
|
2028
|
+
if (_didIteratorError22) {
|
|
2029
|
+
throw _iteratorError22;
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
_state.label = 70;
|
|
2034
|
+
case 70:
|
|
2035
|
+
if (!jsonOutput) return [
|
|
2036
|
+
3,
|
|
2037
|
+
79
|
|
2038
|
+
];
|
|
2039
|
+
// Output selected configs as JSON array to stdout
|
|
2040
|
+
configs = [];
|
|
2041
|
+
_iteratorNormalCompletion23 = true, _didIteratorError23 = false, _iteratorError23 = undefined;
|
|
2042
|
+
_state.label = 71;
|
|
2043
|
+
case 71:
|
|
2044
|
+
_state.trys.push([
|
|
2045
|
+
71,
|
|
2046
|
+
76,
|
|
2047
|
+
77,
|
|
2048
|
+
78
|
|
2049
|
+
]);
|
|
2050
|
+
_iterator23 = selectedConfigs[Symbol.iterator]();
|
|
2051
|
+
_state.label = 72;
|
|
2052
|
+
case 72:
|
|
2053
|
+
if (!!(_iteratorNormalCompletion23 = (_step23 = _iterator23.next()).done)) return [
|
|
2054
|
+
3,
|
|
2055
|
+
75
|
|
2056
|
+
];
|
|
2057
|
+
_step_value5 = _step23.value, combination3 = _step_value5.combination, transport1 = _step_value5.transport;
|
|
2058
|
+
return [
|
|
2059
|
+
4,
|
|
2060
|
+
generateConfigObject(_object_spread_props(_object_spread({
|
|
2061
|
+
serverName: finalServerName1,
|
|
2062
|
+
combination: combination3,
|
|
2063
|
+
transport: transport1,
|
|
2064
|
+
packageName: packageName,
|
|
2065
|
+
packageDir: packageDir
|
|
2066
|
+
}, binPath !== undefined && {
|
|
2067
|
+
binPath: binPath
|
|
2068
|
+
}), {
|
|
2069
|
+
metadata: metadata,
|
|
2070
|
+
metadataReader: metadataReader,
|
|
2071
|
+
httpHost: httpHost1,
|
|
2072
|
+
httpPort: httpPort1,
|
|
2073
|
+
useSource: useSource,
|
|
2074
|
+
quick: quickMode,
|
|
2075
|
+
optionalVarsToPrompt: optionalVarsToPrompt
|
|
2076
|
+
}))
|
|
2077
|
+
];
|
|
2078
|
+
case 73:
|
|
2079
|
+
config1 = _state.sent();
|
|
2080
|
+
configs.push(config1);
|
|
2081
|
+
_state.label = 74;
|
|
2082
|
+
case 74:
|
|
2083
|
+
_iteratorNormalCompletion23 = true;
|
|
2084
|
+
return [
|
|
2085
|
+
3,
|
|
2086
|
+
72
|
|
2087
|
+
];
|
|
2088
|
+
case 75:
|
|
2089
|
+
return [
|
|
2090
|
+
3,
|
|
2091
|
+
78
|
|
2092
|
+
];
|
|
2093
|
+
case 76:
|
|
2094
|
+
err = _state.sent();
|
|
2095
|
+
_didIteratorError23 = true;
|
|
2096
|
+
_iteratorError23 = err;
|
|
2097
|
+
return [
|
|
2098
|
+
3,
|
|
2099
|
+
78
|
|
2100
|
+
];
|
|
2101
|
+
case 77:
|
|
2102
|
+
try {
|
|
2103
|
+
if (!_iteratorNormalCompletion23 && _iterator23.return != null) {
|
|
2104
|
+
_iterator23.return();
|
|
2105
|
+
}
|
|
2106
|
+
} finally{
|
|
2107
|
+
if (_didIteratorError23) {
|
|
2108
|
+
throw _iteratorError23;
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
return [
|
|
2112
|
+
7
|
|
2113
|
+
];
|
|
2114
|
+
case 78:
|
|
2115
|
+
console.log(JSON.stringify(configs, null, 2));
|
|
2116
|
+
return [
|
|
2117
|
+
3,
|
|
2118
|
+
88
|
|
2119
|
+
];
|
|
2120
|
+
case 79:
|
|
2121
|
+
_fs.mkdirSync(outputDir2, {
|
|
2122
|
+
recursive: true
|
|
2123
|
+
});
|
|
2124
|
+
generatedCount1 = 0;
|
|
2125
|
+
_iteratorNormalCompletion24 = true, _didIteratorError24 = false, _iteratorError24 = undefined;
|
|
2126
|
+
_state.label = 80;
|
|
2127
|
+
case 80:
|
|
2128
|
+
_state.trys.push([
|
|
2129
|
+
80,
|
|
2130
|
+
85,
|
|
2131
|
+
86,
|
|
2132
|
+
87
|
|
2133
|
+
]);
|
|
2134
|
+
_iterator24 = selectedConfigs[Symbol.iterator]();
|
|
2135
|
+
_state.label = 81;
|
|
2136
|
+
case 81:
|
|
2137
|
+
if (!!(_iteratorNormalCompletion24 = (_step24 = _iterator24.next()).done)) return [
|
|
2138
|
+
3,
|
|
2139
|
+
84
|
|
2140
|
+
];
|
|
2141
|
+
_step_value6 = _step24.value, combination4 = _step_value6.combination, transport2 = _step_value6.transport;
|
|
2142
|
+
return [
|
|
2143
|
+
4,
|
|
2144
|
+
generateConfigFile(_object_spread_props(_object_spread({
|
|
2145
|
+
serverName: finalServerName1,
|
|
2146
|
+
combination: combination4,
|
|
2147
|
+
transport: transport2,
|
|
2148
|
+
outputDir: outputDir2,
|
|
2149
|
+
packageName: packageName,
|
|
2150
|
+
packageDir: packageDir
|
|
2151
|
+
}, binPath !== undefined && {
|
|
2152
|
+
binPath: binPath
|
|
2153
|
+
}), {
|
|
2154
|
+
metadata: metadata,
|
|
2155
|
+
metadataReader: metadataReader,
|
|
2156
|
+
httpHost: httpHost1,
|
|
2157
|
+
httpPort: httpPort1,
|
|
2158
|
+
useSource: useSource,
|
|
2159
|
+
quick: quickMode,
|
|
2160
|
+
optionalVarsToPrompt: optionalVarsToPrompt
|
|
2161
|
+
}))
|
|
2162
|
+
];
|
|
2163
|
+
case 82:
|
|
2164
|
+
success = _state.sent();
|
|
2165
|
+
if (success) {
|
|
2166
|
+
generatedCount1++;
|
|
2167
|
+
}
|
|
2168
|
+
_state.label = 83;
|
|
2169
|
+
case 83:
|
|
2170
|
+
_iteratorNormalCompletion24 = true;
|
|
2171
|
+
return [
|
|
2172
|
+
3,
|
|
2173
|
+
81
|
|
2174
|
+
];
|
|
2175
|
+
case 84:
|
|
2176
|
+
return [
|
|
2177
|
+
3,
|
|
2178
|
+
87
|
|
2179
|
+
];
|
|
2180
|
+
case 85:
|
|
2181
|
+
err = _state.sent();
|
|
2182
|
+
_didIteratorError24 = true;
|
|
2183
|
+
_iteratorError24 = err;
|
|
2184
|
+
return [
|
|
2185
|
+
3,
|
|
2186
|
+
87
|
|
2187
|
+
];
|
|
2188
|
+
case 86:
|
|
2189
|
+
try {
|
|
2190
|
+
if (!_iteratorNormalCompletion24 && _iterator24.return != null) {
|
|
2191
|
+
_iterator24.return();
|
|
2192
|
+
}
|
|
2193
|
+
} finally{
|
|
2194
|
+
if (_didIteratorError24) {
|
|
2195
|
+
throw _iteratorError24;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
return [
|
|
2199
|
+
7
|
|
2200
|
+
];
|
|
2201
|
+
case 87:
|
|
2202
|
+
console.log("\n✅ Generated ".concat(generatedCount1, " config file(s) in ").concat(outputDir2));
|
|
2203
|
+
_state.label = 88;
|
|
2204
|
+
case 88:
|
|
2205
|
+
return [
|
|
2206
|
+
2
|
|
2207
|
+
];
|
|
2208
|
+
}
|
|
2209
|
+
});
|
|
2210
|
+
}).apply(this, arguments);
|
|
2211
|
+
}
|
|
2212
|
+
function discoverServerJson() {
|
|
2213
|
+
var basePath = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : process.cwd();
|
|
2214
|
+
// Check current directory
|
|
2215
|
+
var currentPath = _path.join(basePath, 'server.json');
|
|
2216
|
+
if (_fs.existsSync(currentPath)) {
|
|
2217
|
+
return currentPath;
|
|
2218
|
+
}
|
|
2219
|
+
// Check parent directory (for monorepo structure)
|
|
2220
|
+
var parentPath = _path.join(basePath, '..', 'server.json');
|
|
2221
|
+
if (_fs.existsSync(parentPath)) {
|
|
2222
|
+
return parentPath;
|
|
2223
|
+
}
|
|
2224
|
+
return null;
|
|
2225
|
+
}
|
|
2226
|
+
function extractServerName(packageName) {
|
|
2227
|
+
// Strip org prefix if present: "@org/package" -> "package"
|
|
2228
|
+
var withoutOrg = packageName.replace(/^@[^/]+\//, '');
|
|
2229
|
+
return withoutOrg || 'server';
|
|
2230
|
+
}
|
|
2231
|
+
/** Build config object (shared logic) */ function buildServerConfig(_0) {
|
|
2232
|
+
return _async_to_generator(function(params) {
|
|
2233
|
+
var envPromptFn, transportType, pkg, envDimensions, argDimensions, allPackageArgNames, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, key, value, relevantEnvVars, envVarsMatchingDependsOn, allEnvVars, filteredDefaults, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _loop, _iterator1, _step1, envDefaultKeys, envDimensionKeys, prePopulatedEnvKeys, envVarsToPrompt, requiredVars, selectedOptionalVars, promptContext, templateVars, promptedEnv, env, command, args, absolutePackageDir, relativePath, allArgValues, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _step_value1, argName, argValue, _params_httpPort, port, serverConfig, _params_httpHost, _params_httpPort1, startBlock, httpConfig, stdioConfig;
|
|
2234
|
+
var _arguments = arguments;
|
|
2235
|
+
return _ts_generator(this, function(_state) {
|
|
2236
|
+
switch(_state.label){
|
|
2237
|
+
case 0:
|
|
2238
|
+
envPromptFn = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : _envpromptingts.promptForEnvVars;
|
|
2239
|
+
// Get package config for transport
|
|
2240
|
+
transportType = params.transport === 'http' ? 'streamable-http' : 'stdio';
|
|
2241
|
+
pkg = params.metadataReader.getPackageForTransport(params.metadata, transportType);
|
|
2242
|
+
if (!pkg) {
|
|
2243
|
+
throw new Error("No ".concat(params.transport, " transport available"));
|
|
2244
|
+
}
|
|
2245
|
+
// Separate env vars and package args from dimensionValues
|
|
2246
|
+
envDimensions = {};
|
|
2247
|
+
argDimensions = {};
|
|
2248
|
+
allPackageArgNames = (pkg.packageArguments || []).map(function(a) {
|
|
2249
|
+
return a.name;
|
|
2250
|
+
});
|
|
2251
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2252
|
+
try {
|
|
2253
|
+
for(_iterator = Object.entries(params.combination.dimensionValues)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2254
|
+
_step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
2255
|
+
if (allPackageArgNames.includes(key)) {
|
|
2256
|
+
argDimensions[key] = value;
|
|
2257
|
+
} else {
|
|
2258
|
+
envDimensions[key] = value;
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
} catch (err) {
|
|
2262
|
+
_didIteratorError = true;
|
|
2263
|
+
_iteratorError = err;
|
|
2264
|
+
} finally{
|
|
2265
|
+
try {
|
|
2266
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2267
|
+
_iterator.return();
|
|
2268
|
+
}
|
|
2269
|
+
} finally{
|
|
2270
|
+
if (_didIteratorError) {
|
|
2271
|
+
throw _iteratorError;
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
// Filter environmentVariables based on combination's envKeys
|
|
2276
|
+
relevantEnvVars = (pkg.environmentVariables || []).filter(function(envVar) {
|
|
2277
|
+
return params.combination.envKeys.includes(envVar.name);
|
|
2278
|
+
});
|
|
2279
|
+
// Filter by dependsOn - only prompt for env vars relevant to this combination's dimension values
|
|
2280
|
+
envVarsMatchingDependsOn = relevantEnvVars.filter(function(envVar) {
|
|
2281
|
+
return shouldPromptEnvVar(envVar, params.combination.dimensionValues);
|
|
2282
|
+
});
|
|
2283
|
+
// Filter defaults to only include env vars whose dependsOn is satisfied for this combination
|
|
2284
|
+
// This ensures DCR_STORE_URI isn't included when AUTH_MODE=loopback-oauth, etc.
|
|
2285
|
+
allEnvVars = pkg.environmentVariables || [];
|
|
2286
|
+
filteredDefaults = {};
|
|
2287
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
2288
|
+
try {
|
|
2289
|
+
_loop = function() {
|
|
2290
|
+
var _step_value = _sliced_to_array(_step1.value, 2), envName = _step_value[0], envValue = _step_value[1];
|
|
2291
|
+
var envVarMeta = allEnvVars.find(function(e) {
|
|
2292
|
+
return e.name === envName;
|
|
2293
|
+
});
|
|
2294
|
+
if (!envVarMeta || shouldPromptEnvVar(envVarMeta, params.combination.dimensionValues)) {
|
|
2295
|
+
filteredDefaults[envName] = envValue;
|
|
2296
|
+
}
|
|
2297
|
+
};
|
|
2298
|
+
for(_iterator1 = Object.entries(params.combination.defaults)[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true)_loop();
|
|
2299
|
+
} catch (err) {
|
|
2300
|
+
_didIteratorError1 = true;
|
|
2301
|
+
_iteratorError1 = err;
|
|
2302
|
+
} finally{
|
|
2303
|
+
try {
|
|
2304
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
2305
|
+
_iterator1.return();
|
|
2306
|
+
}
|
|
2307
|
+
} finally{
|
|
2308
|
+
if (_didIteratorError1) {
|
|
2309
|
+
throw _iteratorError1;
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
// Separate env vars into those with pre-populated values and those to prompt for
|
|
2314
|
+
envDefaultKeys = Object.keys(filteredDefaults);
|
|
2315
|
+
envDimensionKeys = Object.keys(envDimensions);
|
|
2316
|
+
prePopulatedEnvKeys = _to_consumable_array(envDefaultKeys).concat(_to_consumable_array(envDimensionKeys));
|
|
2317
|
+
if (params.optionalVarsToPrompt === undefined) {
|
|
2318
|
+
// No filter provided (e.g., tests, non-interactive) - use old behavior: prompt all relevant vars
|
|
2319
|
+
envVarsToPrompt = envVarsMatchingDependsOn.filter(function(envVar) {
|
|
2320
|
+
return !prePopulatedEnvKeys.includes(envVar.name);
|
|
2321
|
+
});
|
|
2322
|
+
} else if (params.optionalVarsToPrompt.size === 0) {
|
|
2323
|
+
// Empty filter - only prompt for required vars, skip optional
|
|
2324
|
+
envVarsToPrompt = envVarsMatchingDependsOn.filter(function(envVar) {
|
|
2325
|
+
return !prePopulatedEnvKeys.includes(envVar.name) && envVar.isRequired;
|
|
2326
|
+
});
|
|
2327
|
+
} else {
|
|
2328
|
+
// Filter provided - prompt required vars + selected optional vars
|
|
2329
|
+
requiredVars = envVarsMatchingDependsOn.filter(function(envVar) {
|
|
2330
|
+
return !prePopulatedEnvKeys.includes(envVar.name) && envVar.isRequired;
|
|
2331
|
+
});
|
|
2332
|
+
selectedOptionalVars = allEnvVars.filter(function(envVar) {
|
|
2333
|
+
var // Only optional vars
|
|
2334
|
+
_params_optionalVarsToPrompt;
|
|
2335
|
+
return !envVar.isRequired && ((_params_optionalVarsToPrompt = params.optionalVarsToPrompt) === null || _params_optionalVarsToPrompt === void 0 ? void 0 : _params_optionalVarsToPrompt.has(envVar.name)) && // User selected it
|
|
2336
|
+
!prePopulatedEnvKeys.includes(envVar.name) && // Not already populated
|
|
2337
|
+
shouldPromptEnvVar(envVar, params.combination.dimensionValues) // Relevant to this config
|
|
2338
|
+
;
|
|
2339
|
+
});
|
|
2340
|
+
envVarsToPrompt = _to_consumable_array(requiredVars).concat(_to_consumable_array(selectedOptionalVars));
|
|
2341
|
+
}
|
|
2342
|
+
// Prompt for environment variable values using shared logic
|
|
2343
|
+
// In quick mode, skip prompts and use defaults/placeholders via the yes option
|
|
2344
|
+
promptContext = "".concat(params.combination.name, "/").concat(params.transport);
|
|
2345
|
+
// Build template vars for placeholder substitution (e.g., {HOST}, {PORT})
|
|
2346
|
+
templateVars = {};
|
|
2347
|
+
if (params.httpHost) templateVars.HOST = params.httpHost;
|
|
2348
|
+
if (params.httpPort) templateVars.PORT = String(params.httpPort);
|
|
2349
|
+
return [
|
|
2350
|
+
4,
|
|
2351
|
+
envPromptFn(promptContext, envVarsToPrompt, {
|
|
2352
|
+
yes: params.quick,
|
|
2353
|
+
templateVars: templateVars
|
|
2354
|
+
})
|
|
2355
|
+
];
|
|
2356
|
+
case 1:
|
|
2357
|
+
promptedEnv = _state.sent();
|
|
2358
|
+
// Merge all env values: filtered defaults + dimension values + prompted values
|
|
2359
|
+
env = _object_spread({}, filteredDefaults, envDimensions, promptedEnv);
|
|
2360
|
+
if (params.useSource) {
|
|
2361
|
+
// Source mode: use node with relative path to bin entry
|
|
2362
|
+
if (!params.packageDir) {
|
|
2363
|
+
throw new Error('packageDir is required when useSource is true');
|
|
2364
|
+
}
|
|
2365
|
+
if (!params.binPath) {
|
|
2366
|
+
throw new Error('binPath is required when useSource is true (check package.json bin entry)');
|
|
2367
|
+
}
|
|
2368
|
+
absolutePackageDir = _path.resolve(params.packageDir);
|
|
2369
|
+
relativePath = _path.join(absolutePackageDir, params.binPath);
|
|
2370
|
+
command = 'node';
|
|
2371
|
+
args = [
|
|
2372
|
+
relativePath
|
|
2373
|
+
];
|
|
2374
|
+
} else {
|
|
2375
|
+
// Installed mode: use npx (current behavior)
|
|
2376
|
+
command = 'npx';
|
|
2377
|
+
args = [
|
|
2378
|
+
'-y',
|
|
2379
|
+
params.packageName
|
|
2380
|
+
];
|
|
2381
|
+
}
|
|
2382
|
+
// Add package arguments from argDefaults and argDimensions
|
|
2383
|
+
allArgValues = _object_spread({}, params.combination.argDefaults, argDimensions);
|
|
2384
|
+
_iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
2385
|
+
try {
|
|
2386
|
+
for(_iterator2 = Object.entries(allArgValues)[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
2387
|
+
_step_value1 = _sliced_to_array(_step2.value, 2), argName = _step_value1[0], argValue = _step_value1[1];
|
|
2388
|
+
// Named arguments are added as --arg value
|
|
2389
|
+
args.push(argName, argValue);
|
|
2390
|
+
}
|
|
2391
|
+
} catch (err) {
|
|
2392
|
+
_didIteratorError2 = true;
|
|
2393
|
+
_iteratorError2 = err;
|
|
2394
|
+
} finally{
|
|
2395
|
+
try {
|
|
2396
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
2397
|
+
_iterator2.return();
|
|
2398
|
+
}
|
|
2399
|
+
} finally{
|
|
2400
|
+
if (_didIteratorError2) {
|
|
2401
|
+
throw _iteratorError2;
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
// Add HTTP-specific configuration
|
|
2406
|
+
if (params.transport === 'http' || params.transport === 'streamable-http') {
|
|
2407
|
+
;
|
|
2408
|
+
port = (_params_httpPort = params.httpPort) !== null && _params_httpPort !== void 0 ? _params_httpPort : 3000;
|
|
2409
|
+
args.push('--port', String(port));
|
|
2410
|
+
}
|
|
2411
|
+
if (params.transport === 'http' || params.transport === 'streamable-http') {
|
|
2412
|
+
;
|
|
2413
|
+
// HTTP servers use start block with stdio config structure
|
|
2414
|
+
startBlock = _object_spread({
|
|
2415
|
+
command: command
|
|
2416
|
+
}, args.length > 0 && {
|
|
2417
|
+
args: args
|
|
2418
|
+
}, Object.keys(env).length > 0 && {
|
|
2419
|
+
env: env
|
|
2420
|
+
});
|
|
2421
|
+
httpConfig = {
|
|
2422
|
+
type: 'http',
|
|
2423
|
+
url: "http://".concat((_params_httpHost = params.httpHost) !== null && _params_httpHost !== void 0 ? _params_httpHost : 'localhost', ":").concat((_params_httpPort1 = params.httpPort) !== null && _params_httpPort1 !== void 0 ? _params_httpPort1 : 3000, "/mcp"),
|
|
2424
|
+
start: startBlock
|
|
2425
|
+
};
|
|
2426
|
+
serverConfig = httpConfig;
|
|
2427
|
+
} else {
|
|
2428
|
+
// Stdio servers use top-level stdio config structure
|
|
2429
|
+
stdioConfig = _object_spread({
|
|
2430
|
+
command: command
|
|
2431
|
+
}, args.length > 0 && {
|
|
2432
|
+
args: args
|
|
2433
|
+
}, Object.keys(env).length > 0 && {
|
|
2434
|
+
env: env
|
|
2435
|
+
});
|
|
2436
|
+
serverConfig = stdioConfig;
|
|
2437
|
+
}
|
|
2438
|
+
return [
|
|
2439
|
+
2,
|
|
2440
|
+
serverConfig
|
|
2441
|
+
];
|
|
2442
|
+
}
|
|
2443
|
+
});
|
|
2444
|
+
}).apply(this, arguments);
|
|
2445
|
+
}
|
|
2446
|
+
function generateConfigObject(_0) {
|
|
2447
|
+
return _async_to_generator(function(params) {
|
|
2448
|
+
var envPromptFn, serverConfig;
|
|
2449
|
+
var _arguments = arguments;
|
|
2450
|
+
return _ts_generator(this, function(_state) {
|
|
2451
|
+
switch(_state.label){
|
|
2452
|
+
case 0:
|
|
2453
|
+
envPromptFn = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : _envpromptingts.promptForEnvVars;
|
|
2454
|
+
return [
|
|
2455
|
+
4,
|
|
2456
|
+
buildServerConfig(params, envPromptFn)
|
|
2457
|
+
];
|
|
2458
|
+
case 1:
|
|
2459
|
+
serverConfig = _state.sent();
|
|
2460
|
+
return [
|
|
2461
|
+
2,
|
|
2462
|
+
{
|
|
2463
|
+
mcpServers: _define_property({}, params.serverName, serverConfig)
|
|
2464
|
+
}
|
|
2465
|
+
];
|
|
2466
|
+
}
|
|
2467
|
+
});
|
|
2468
|
+
}).apply(this, arguments);
|
|
2469
|
+
}
|
|
2470
|
+
function generateConfigFile(_0) {
|
|
2471
|
+
return _async_to_generator(function(params) {
|
|
2472
|
+
var envPromptFn, transportName, filename, filepath, shouldOverwrite, config, error;
|
|
2473
|
+
var _arguments = arguments;
|
|
2474
|
+
return _ts_generator(this, function(_state) {
|
|
2475
|
+
switch(_state.label){
|
|
2476
|
+
case 0:
|
|
2477
|
+
envPromptFn = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : _envpromptingts.promptForEnvVars;
|
|
2478
|
+
// Normalize transport name for filename ('streamable-http' → 'http' to match config type)
|
|
2479
|
+
transportName = params.transport === 'streamable-http' ? 'http' : params.transport;
|
|
2480
|
+
filename = ".mcp.".concat(params.combination.name, "-").concat(transportName, ".json");
|
|
2481
|
+
filepath = _path.join(params.outputDir, filename);
|
|
2482
|
+
if (!(_fs.existsSync(filepath) && process.stdin.isTTY)) return [
|
|
2483
|
+
3,
|
|
2484
|
+
2
|
|
2485
|
+
];
|
|
2486
|
+
return [
|
|
2487
|
+
4,
|
|
2488
|
+
(0, _confirm.default)({
|
|
2489
|
+
message: "".concat(filename, " already exists. Overwrite?"),
|
|
2490
|
+
default: false
|
|
2491
|
+
})
|
|
2492
|
+
];
|
|
2493
|
+
case 1:
|
|
2494
|
+
shouldOverwrite = _state.sent();
|
|
2495
|
+
if (!shouldOverwrite) {
|
|
2496
|
+
console.log(" ⏭️ Skipped ".concat(filename));
|
|
2497
|
+
return [
|
|
2498
|
+
2,
|
|
2499
|
+
false
|
|
2500
|
+
];
|
|
2501
|
+
}
|
|
2502
|
+
_state.label = 2;
|
|
2503
|
+
case 2:
|
|
2504
|
+
_state.trys.push([
|
|
2505
|
+
2,
|
|
2506
|
+
4,
|
|
2507
|
+
,
|
|
2508
|
+
5
|
|
2509
|
+
]);
|
|
2510
|
+
// Ensure output directory exists
|
|
2511
|
+
_fs.mkdirSync(params.outputDir, {
|
|
2512
|
+
recursive: true
|
|
2513
|
+
});
|
|
2514
|
+
return [
|
|
2515
|
+
4,
|
|
2516
|
+
generateConfigObject(params, envPromptFn)
|
|
2517
|
+
];
|
|
2518
|
+
case 3:
|
|
2519
|
+
config = _state.sent();
|
|
2520
|
+
_fs.writeFileSync(filepath, "".concat(JSON.stringify(config, null, 2), "\n"));
|
|
2521
|
+
console.log(" ✅ ".concat(filename));
|
|
2522
|
+
return [
|
|
2523
|
+
2,
|
|
2524
|
+
true
|
|
2525
|
+
];
|
|
2526
|
+
case 4:
|
|
2527
|
+
error = _state.sent();
|
|
2528
|
+
console.error(" ❌ ".concat(filename, ": ").concat(_instanceof(error, Error) ? error.message : String(error)));
|
|
2529
|
+
return [
|
|
2530
|
+
2,
|
|
2531
|
+
false
|
|
2532
|
+
];
|
|
2533
|
+
case 5:
|
|
2534
|
+
return [
|
|
2535
|
+
2
|
|
2536
|
+
];
|
|
2537
|
+
}
|
|
2538
|
+
});
|
|
2539
|
+
}).apply(this, arguments);
|
|
2540
|
+
}
|
|
2541
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|