maxsimcli 2.5.6 → 3.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/README.md +4 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapters/base.d.ts +34 -0
- package/dist/adapters/base.d.ts.map +1 -0
- package/dist/adapters/base.js +116 -0
- package/dist/adapters/base.js.map +1 -0
- package/dist/adapters/claude.d.ts +21 -0
- package/dist/adapters/claude.d.ts.map +1 -0
- package/dist/adapters/claude.js +104 -0
- package/dist/adapters/claude.js.map +1 -0
- package/dist/adapters/codex.d.ts +19 -0
- package/dist/adapters/codex.d.ts.map +1 -0
- package/dist/adapters/codex.js +94 -0
- package/dist/adapters/codex.js.map +1 -0
- package/dist/adapters/gemini.d.ts +19 -0
- package/dist/adapters/gemini.d.ts.map +1 -0
- package/dist/adapters/gemini.js +96 -0
- package/dist/adapters/gemini.js.map +1 -0
- package/dist/adapters/index.d.ts +20 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +56 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/opencode.d.ts +17 -0
- package/dist/adapters/opencode.d.ts.map +1 -0
- package/dist/adapters/opencode.js +111 -0
- package/dist/adapters/opencode.js.map +1 -0
- package/dist/adapters/transforms/content.d.ts +39 -0
- package/dist/adapters/transforms/content.d.ts.map +1 -0
- package/dist/adapters/transforms/content.js +125 -0
- package/dist/adapters/transforms/content.js.map +1 -0
- package/dist/adapters/transforms/frontmatter.d.ts +42 -0
- package/dist/adapters/transforms/frontmatter.d.ts.map +1 -0
- package/dist/adapters/transforms/frontmatter.js +204 -0
- package/dist/adapters/transforms/frontmatter.js.map +1 -0
- package/dist/adapters/transforms/tool-maps.d.ts +20 -0
- package/dist/adapters/transforms/tool-maps.d.ts.map +1 -0
- package/dist/adapters/transforms/tool-maps.js +64 -0
- package/dist/adapters/transforms/tool-maps.js.map +1 -0
- package/dist/adapters/types.d.ts +10 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +6 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/assets/CHANGELOG.md +19 -0
- package/dist/assets/dashboard/server.js +27728 -12013
- package/dist/assets/hooks/maxsim-check-update.cjs +2 -2
- package/dist/assets/hooks/maxsim-check-update.cjs.map +1 -0
- package/dist/assets/hooks/maxsim-context-monitor.cjs +2 -2
- package/dist/assets/hooks/maxsim-context-monitor.cjs.map +1 -0
- package/dist/assets/hooks/maxsim-statusline.cjs +2 -2
- package/dist/assets/hooks/maxsim-statusline.cjs.map +1 -0
- package/dist/cli.cjs +15316 -5348
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.ts +0 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +282 -443
- package/dist/cli.js.map +1 -1
- package/dist/core/commands.d.ts +19 -0
- package/dist/core/commands.d.ts.map +1 -0
- package/dist/core/commands.js +560 -0
- package/dist/core/commands.js.map +1 -0
- package/dist/core/config.d.ts +9 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +147 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/core.d.ts +39 -0
- package/dist/core/core.d.ts.map +1 -0
- package/dist/core/core.js +411 -0
- package/dist/core/core.js.map +1 -0
- package/dist/core/frontmatter.d.ts +33 -0
- package/dist/core/frontmatter.d.ts.map +1 -0
- package/dist/core/frontmatter.js +192 -0
- package/dist/core/frontmatter.js.map +1 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +126 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/init.d.ts +252 -0
- package/dist/core/init.d.ts.map +1 -0
- package/dist/core/init.js +578 -0
- package/dist/core/init.js.map +1 -0
- package/dist/core/milestone.d.ts +9 -0
- package/dist/core/milestone.d.ts.map +1 -0
- package/dist/core/milestone.js +191 -0
- package/dist/core/milestone.js.map +1 -0
- package/dist/core/phase.d.ts +17 -0
- package/dist/core/phase.d.ts.map +1 -0
- package/dist/core/phase.js +610 -0
- package/dist/core/phase.js.map +1 -0
- package/dist/core/roadmap.d.ts +9 -0
- package/dist/core/roadmap.d.ts.map +1 -0
- package/dist/core/roadmap.js +228 -0
- package/dist/core/roadmap.js.map +1 -0
- package/dist/core/state.d.ts +21 -0
- package/dist/core/state.d.ts.map +1 -0
- package/dist/core/state.js +507 -0
- package/dist/core/state.js.map +1 -0
- package/dist/core/template.d.ts +30 -0
- package/dist/core/template.d.ts.map +1 -0
- package/dist/core/template.js +225 -0
- package/dist/core/template.js.map +1 -0
- package/dist/core/types.d.ts +374 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +53 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/verify.d.ts +127 -0
- package/dist/core/verify.d.ts.map +1 -0
- package/dist/core/verify.js +783 -0
- package/dist/core/verify.js.map +1 -0
- package/dist/hooks/index.d.ts +11 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +18 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/maxsim-check-update.d.ts +17 -0
- package/dist/hooks/maxsim-check-update.d.ts.map +1 -0
- package/dist/hooks/maxsim-check-update.js +101 -0
- package/dist/hooks/maxsim-check-update.js.map +1 -0
- package/dist/hooks/maxsim-context-monitor.d.ts +21 -0
- package/dist/hooks/maxsim-context-monitor.d.ts.map +1 -0
- package/dist/hooks/maxsim-context-monitor.js +131 -0
- package/dist/hooks/maxsim-context-monitor.js.map +1 -0
- package/dist/hooks/maxsim-statusline.d.ts +19 -0
- package/dist/hooks/maxsim-statusline.d.ts.map +1 -0
- package/dist/hooks/maxsim-statusline.js +146 -0
- package/dist/hooks/maxsim-statusline.js.map +1 -0
- package/dist/hooks/shared.d.ts +11 -0
- package/dist/hooks/shared.d.ts.map +1 -0
- package/dist/hooks/shared.js +29 -0
- package/dist/hooks/shared.js.map +1 -0
- package/dist/install.cjs +2807 -1211
- package/dist/install.cjs.map +1 -1
- package/dist/install.js +34 -85
- package/dist/install.js.map +1 -1
- package/package.json +10 -7
- package/dist/assets/hooks/index.cjs +0 -239
- package/dist/assets/templates/CLAUDE.md +0 -22
- package/dist/assets/templates/package.json +0 -5
- package/dist/assets/templates/project.json +0 -5
package/dist/install.cjs
CHANGED
|
@@ -46,7 +46,1933 @@ let node_async_hooks = require("node:async_hooks");
|
|
|
46
46
|
let node_readline = require("node:readline");
|
|
47
47
|
node_readline = __toESM(node_readline);
|
|
48
48
|
|
|
49
|
-
//#region ../../node_modules
|
|
49
|
+
//#region ../../node_modules/universalify/index.js
|
|
50
|
+
var require_universalify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
51
|
+
exports.fromCallback = function(fn) {
|
|
52
|
+
return Object.defineProperty(function(...args) {
|
|
53
|
+
if (typeof args[args.length - 1] === "function") fn.apply(this, args);
|
|
54
|
+
else return new Promise((resolve, reject) => {
|
|
55
|
+
args.push((err, res) => err != null ? reject(err) : resolve(res));
|
|
56
|
+
fn.apply(this, args);
|
|
57
|
+
});
|
|
58
|
+
}, "name", { value: fn.name });
|
|
59
|
+
};
|
|
60
|
+
exports.fromPromise = function(fn) {
|
|
61
|
+
return Object.defineProperty(function(...args) {
|
|
62
|
+
const cb = args[args.length - 1];
|
|
63
|
+
if (typeof cb !== "function") return fn.apply(this, args);
|
|
64
|
+
else {
|
|
65
|
+
args.pop();
|
|
66
|
+
fn.apply(this, args).then((r) => cb(null, r), cb);
|
|
67
|
+
}
|
|
68
|
+
}, "name", { value: fn.name });
|
|
69
|
+
};
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region ../../node_modules/graceful-fs/polyfills.js
|
|
74
|
+
var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
75
|
+
var constants = require("constants");
|
|
76
|
+
var origCwd = process.cwd;
|
|
77
|
+
var cwd = null;
|
|
78
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
79
|
+
process.cwd = function() {
|
|
80
|
+
if (!cwd) cwd = origCwd.call(process);
|
|
81
|
+
return cwd;
|
|
82
|
+
};
|
|
83
|
+
try {
|
|
84
|
+
process.cwd();
|
|
85
|
+
} catch (er) {}
|
|
86
|
+
if (typeof process.chdir === "function") {
|
|
87
|
+
var chdir = process.chdir;
|
|
88
|
+
process.chdir = function(d) {
|
|
89
|
+
cwd = null;
|
|
90
|
+
chdir.call(process, d);
|
|
91
|
+
};
|
|
92
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
|
|
93
|
+
}
|
|
94
|
+
module.exports = patch;
|
|
95
|
+
function patch(fs) {
|
|
96
|
+
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
|
|
97
|
+
if (!fs.lutimes) patchLutimes(fs);
|
|
98
|
+
fs.chown = chownFix(fs.chown);
|
|
99
|
+
fs.fchown = chownFix(fs.fchown);
|
|
100
|
+
fs.lchown = chownFix(fs.lchown);
|
|
101
|
+
fs.chmod = chmodFix(fs.chmod);
|
|
102
|
+
fs.fchmod = chmodFix(fs.fchmod);
|
|
103
|
+
fs.lchmod = chmodFix(fs.lchmod);
|
|
104
|
+
fs.chownSync = chownFixSync(fs.chownSync);
|
|
105
|
+
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
106
|
+
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
107
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
108
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
109
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
110
|
+
fs.stat = statFix(fs.stat);
|
|
111
|
+
fs.fstat = statFix(fs.fstat);
|
|
112
|
+
fs.lstat = statFix(fs.lstat);
|
|
113
|
+
fs.statSync = statFixSync(fs.statSync);
|
|
114
|
+
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
115
|
+
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
116
|
+
if (fs.chmod && !fs.lchmod) {
|
|
117
|
+
fs.lchmod = function(path, mode, cb) {
|
|
118
|
+
if (cb) process.nextTick(cb);
|
|
119
|
+
};
|
|
120
|
+
fs.lchmodSync = function() {};
|
|
121
|
+
}
|
|
122
|
+
if (fs.chown && !fs.lchown) {
|
|
123
|
+
fs.lchown = function(path, uid, gid, cb) {
|
|
124
|
+
if (cb) process.nextTick(cb);
|
|
125
|
+
};
|
|
126
|
+
fs.lchownSync = function() {};
|
|
127
|
+
}
|
|
128
|
+
if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
|
|
129
|
+
function rename(from, to, cb) {
|
|
130
|
+
var start = Date.now();
|
|
131
|
+
var backoff = 0;
|
|
132
|
+
fs$rename(from, to, function CB(er) {
|
|
133
|
+
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
134
|
+
setTimeout(function() {
|
|
135
|
+
fs.stat(to, function(stater, st) {
|
|
136
|
+
if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
|
|
137
|
+
else cb(er);
|
|
138
|
+
});
|
|
139
|
+
}, backoff);
|
|
140
|
+
if (backoff < 100) backoff += 10;
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (cb) cb(er);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
147
|
+
return rename;
|
|
148
|
+
})(fs.rename);
|
|
149
|
+
fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
|
|
150
|
+
function read(fd, buffer, offset, length, position, callback_) {
|
|
151
|
+
var callback;
|
|
152
|
+
if (callback_ && typeof callback_ === "function") {
|
|
153
|
+
var eagCounter = 0;
|
|
154
|
+
callback = function(er, _, __) {
|
|
155
|
+
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
156
|
+
eagCounter++;
|
|
157
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
158
|
+
}
|
|
159
|
+
callback_.apply(this, arguments);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
163
|
+
}
|
|
164
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
165
|
+
return read;
|
|
166
|
+
})(fs.read);
|
|
167
|
+
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
|
|
168
|
+
return function(fd, buffer, offset, length, position) {
|
|
169
|
+
var eagCounter = 0;
|
|
170
|
+
while (true) try {
|
|
171
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
172
|
+
} catch (er) {
|
|
173
|
+
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
174
|
+
eagCounter++;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
throw er;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
})(fs.readSync);
|
|
181
|
+
function patchLchmod(fs) {
|
|
182
|
+
fs.lchmod = function(path, mode, callback) {
|
|
183
|
+
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
184
|
+
if (err) {
|
|
185
|
+
if (callback) callback(err);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
fs.fchmod(fd, mode, function(err) {
|
|
189
|
+
fs.close(fd, function(err2) {
|
|
190
|
+
if (callback) callback(err || err2);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
fs.lchmodSync = function(path, mode) {
|
|
196
|
+
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
197
|
+
var threw = true;
|
|
198
|
+
var ret;
|
|
199
|
+
try {
|
|
200
|
+
ret = fs.fchmodSync(fd, mode);
|
|
201
|
+
threw = false;
|
|
202
|
+
} finally {
|
|
203
|
+
if (threw) try {
|
|
204
|
+
fs.closeSync(fd);
|
|
205
|
+
} catch (er) {}
|
|
206
|
+
else fs.closeSync(fd);
|
|
207
|
+
}
|
|
208
|
+
return ret;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function patchLutimes(fs) {
|
|
212
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
213
|
+
fs.lutimes = function(path, at, mt, cb) {
|
|
214
|
+
fs.open(path, constants.O_SYMLINK, function(er, fd) {
|
|
215
|
+
if (er) {
|
|
216
|
+
if (cb) cb(er);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
fs.futimes(fd, at, mt, function(er) {
|
|
220
|
+
fs.close(fd, function(er2) {
|
|
221
|
+
if (cb) cb(er || er2);
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
fs.lutimesSync = function(path, at, mt) {
|
|
227
|
+
var fd = fs.openSync(path, constants.O_SYMLINK);
|
|
228
|
+
var ret;
|
|
229
|
+
var threw = true;
|
|
230
|
+
try {
|
|
231
|
+
ret = fs.futimesSync(fd, at, mt);
|
|
232
|
+
threw = false;
|
|
233
|
+
} finally {
|
|
234
|
+
if (threw) try {
|
|
235
|
+
fs.closeSync(fd);
|
|
236
|
+
} catch (er) {}
|
|
237
|
+
else fs.closeSync(fd);
|
|
238
|
+
}
|
|
239
|
+
return ret;
|
|
240
|
+
};
|
|
241
|
+
} else if (fs.futimes) {
|
|
242
|
+
fs.lutimes = function(_a, _b, _c, cb) {
|
|
243
|
+
if (cb) process.nextTick(cb);
|
|
244
|
+
};
|
|
245
|
+
fs.lutimesSync = function() {};
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function chmodFix(orig) {
|
|
249
|
+
if (!orig) return orig;
|
|
250
|
+
return function(target, mode, cb) {
|
|
251
|
+
return orig.call(fs, target, mode, function(er) {
|
|
252
|
+
if (chownErOk(er)) er = null;
|
|
253
|
+
if (cb) cb.apply(this, arguments);
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function chmodFixSync(orig) {
|
|
258
|
+
if (!orig) return orig;
|
|
259
|
+
return function(target, mode) {
|
|
260
|
+
try {
|
|
261
|
+
return orig.call(fs, target, mode);
|
|
262
|
+
} catch (er) {
|
|
263
|
+
if (!chownErOk(er)) throw er;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function chownFix(orig) {
|
|
268
|
+
if (!orig) return orig;
|
|
269
|
+
return function(target, uid, gid, cb) {
|
|
270
|
+
return orig.call(fs, target, uid, gid, function(er) {
|
|
271
|
+
if (chownErOk(er)) er = null;
|
|
272
|
+
if (cb) cb.apply(this, arguments);
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function chownFixSync(orig) {
|
|
277
|
+
if (!orig) return orig;
|
|
278
|
+
return function(target, uid, gid) {
|
|
279
|
+
try {
|
|
280
|
+
return orig.call(fs, target, uid, gid);
|
|
281
|
+
} catch (er) {
|
|
282
|
+
if (!chownErOk(er)) throw er;
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function statFix(orig) {
|
|
287
|
+
if (!orig) return orig;
|
|
288
|
+
return function(target, options, cb) {
|
|
289
|
+
if (typeof options === "function") {
|
|
290
|
+
cb = options;
|
|
291
|
+
options = null;
|
|
292
|
+
}
|
|
293
|
+
function callback(er, stats) {
|
|
294
|
+
if (stats) {
|
|
295
|
+
if (stats.uid < 0) stats.uid += 4294967296;
|
|
296
|
+
if (stats.gid < 0) stats.gid += 4294967296;
|
|
297
|
+
}
|
|
298
|
+
if (cb) cb.apply(this, arguments);
|
|
299
|
+
}
|
|
300
|
+
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function statFixSync(orig) {
|
|
304
|
+
if (!orig) return orig;
|
|
305
|
+
return function(target, options) {
|
|
306
|
+
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
307
|
+
if (stats) {
|
|
308
|
+
if (stats.uid < 0) stats.uid += 4294967296;
|
|
309
|
+
if (stats.gid < 0) stats.gid += 4294967296;
|
|
310
|
+
}
|
|
311
|
+
return stats;
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function chownErOk(er) {
|
|
315
|
+
if (!er) return true;
|
|
316
|
+
if (er.code === "ENOSYS") return true;
|
|
317
|
+
if (!process.getuid || process.getuid() !== 0) {
|
|
318
|
+
if (er.code === "EINVAL" || er.code === "EPERM") return true;
|
|
319
|
+
}
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}));
|
|
324
|
+
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region ../../node_modules/graceful-fs/legacy-streams.js
|
|
327
|
+
var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
328
|
+
var Stream$1 = require("stream").Stream;
|
|
329
|
+
module.exports = legacy;
|
|
330
|
+
function legacy(fs) {
|
|
331
|
+
return {
|
|
332
|
+
ReadStream,
|
|
333
|
+
WriteStream
|
|
334
|
+
};
|
|
335
|
+
function ReadStream(path, options) {
|
|
336
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
337
|
+
Stream$1.call(this);
|
|
338
|
+
var self = this;
|
|
339
|
+
this.path = path;
|
|
340
|
+
this.fd = null;
|
|
341
|
+
this.readable = true;
|
|
342
|
+
this.paused = false;
|
|
343
|
+
this.flags = "r";
|
|
344
|
+
this.mode = 438;
|
|
345
|
+
this.bufferSize = 64 * 1024;
|
|
346
|
+
options = options || {};
|
|
347
|
+
var keys = Object.keys(options);
|
|
348
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
349
|
+
var key = keys[index];
|
|
350
|
+
this[key] = options[key];
|
|
351
|
+
}
|
|
352
|
+
if (this.encoding) this.setEncoding(this.encoding);
|
|
353
|
+
if (this.start !== void 0) {
|
|
354
|
+
if ("number" !== typeof this.start) throw TypeError("start must be a Number");
|
|
355
|
+
if (this.end === void 0) this.end = Infinity;
|
|
356
|
+
else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
|
|
357
|
+
if (this.start > this.end) throw new Error("start must be <= end");
|
|
358
|
+
this.pos = this.start;
|
|
359
|
+
}
|
|
360
|
+
if (this.fd !== null) {
|
|
361
|
+
process.nextTick(function() {
|
|
362
|
+
self._read();
|
|
363
|
+
});
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
367
|
+
if (err) {
|
|
368
|
+
self.emit("error", err);
|
|
369
|
+
self.readable = false;
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
self.fd = fd;
|
|
373
|
+
self.emit("open", fd);
|
|
374
|
+
self._read();
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
function WriteStream(path, options) {
|
|
378
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
379
|
+
Stream$1.call(this);
|
|
380
|
+
this.path = path;
|
|
381
|
+
this.fd = null;
|
|
382
|
+
this.writable = true;
|
|
383
|
+
this.flags = "w";
|
|
384
|
+
this.encoding = "binary";
|
|
385
|
+
this.mode = 438;
|
|
386
|
+
this.bytesWritten = 0;
|
|
387
|
+
options = options || {};
|
|
388
|
+
var keys = Object.keys(options);
|
|
389
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
390
|
+
var key = keys[index];
|
|
391
|
+
this[key] = options[key];
|
|
392
|
+
}
|
|
393
|
+
if (this.start !== void 0) {
|
|
394
|
+
if ("number" !== typeof this.start) throw TypeError("start must be a Number");
|
|
395
|
+
if (this.start < 0) throw new Error("start must be >= zero");
|
|
396
|
+
this.pos = this.start;
|
|
397
|
+
}
|
|
398
|
+
this.busy = false;
|
|
399
|
+
this._queue = [];
|
|
400
|
+
if (this.fd === null) {
|
|
401
|
+
this._open = fs.open;
|
|
402
|
+
this._queue.push([
|
|
403
|
+
this._open,
|
|
404
|
+
this.path,
|
|
405
|
+
this.flags,
|
|
406
|
+
this.mode,
|
|
407
|
+
void 0
|
|
408
|
+
]);
|
|
409
|
+
this.flush();
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}));
|
|
414
|
+
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region ../../node_modules/graceful-fs/clone.js
|
|
417
|
+
var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
418
|
+
module.exports = clone;
|
|
419
|
+
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
420
|
+
return obj.__proto__;
|
|
421
|
+
};
|
|
422
|
+
function clone(obj) {
|
|
423
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
424
|
+
if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
|
|
425
|
+
else var copy = Object.create(null);
|
|
426
|
+
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
427
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
428
|
+
});
|
|
429
|
+
return copy;
|
|
430
|
+
}
|
|
431
|
+
}));
|
|
432
|
+
|
|
433
|
+
//#endregion
|
|
434
|
+
//#region ../../node_modules/graceful-fs/graceful-fs.js
|
|
435
|
+
var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
436
|
+
var fs = require("fs");
|
|
437
|
+
var polyfills = require_polyfills();
|
|
438
|
+
var legacy = require_legacy_streams();
|
|
439
|
+
var clone = require_clone();
|
|
440
|
+
var util = require("util");
|
|
441
|
+
/* istanbul ignore next - node 0.x polyfill */
|
|
442
|
+
var gracefulQueue;
|
|
443
|
+
var previousSymbol;
|
|
444
|
+
/* istanbul ignore else - node 0.x polyfill */
|
|
445
|
+
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
446
|
+
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
447
|
+
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
448
|
+
} else {
|
|
449
|
+
gracefulQueue = "___graceful-fs.queue";
|
|
450
|
+
previousSymbol = "___graceful-fs.previous";
|
|
451
|
+
}
|
|
452
|
+
function noop() {}
|
|
453
|
+
function publishQueue(context, queue) {
|
|
454
|
+
Object.defineProperty(context, gracefulQueue, { get: function() {
|
|
455
|
+
return queue;
|
|
456
|
+
} });
|
|
457
|
+
}
|
|
458
|
+
var debug = noop;
|
|
459
|
+
if (util.debuglog) debug = util.debuglog("gfs4");
|
|
460
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
|
|
461
|
+
var m = util.format.apply(util, arguments);
|
|
462
|
+
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
463
|
+
console.error(m);
|
|
464
|
+
};
|
|
465
|
+
if (!fs[gracefulQueue]) {
|
|
466
|
+
publishQueue(fs, global[gracefulQueue] || []);
|
|
467
|
+
fs.close = (function(fs$close) {
|
|
468
|
+
function close(fd, cb) {
|
|
469
|
+
return fs$close.call(fs, fd, function(err) {
|
|
470
|
+
if (!err) resetQueue();
|
|
471
|
+
if (typeof cb === "function") cb.apply(this, arguments);
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
475
|
+
return close;
|
|
476
|
+
})(fs.close);
|
|
477
|
+
fs.closeSync = (function(fs$closeSync) {
|
|
478
|
+
function closeSync(fd) {
|
|
479
|
+
fs$closeSync.apply(fs, arguments);
|
|
480
|
+
resetQueue();
|
|
481
|
+
}
|
|
482
|
+
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
483
|
+
return closeSync;
|
|
484
|
+
})(fs.closeSync);
|
|
485
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
486
|
+
debug(fs[gracefulQueue]);
|
|
487
|
+
require("assert").equal(fs[gracefulQueue].length, 0);
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
if (!global[gracefulQueue]) publishQueue(global, fs[gracefulQueue]);
|
|
491
|
+
module.exports = patch(clone(fs));
|
|
492
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
493
|
+
module.exports = patch(fs);
|
|
494
|
+
fs.__patched = true;
|
|
495
|
+
}
|
|
496
|
+
function patch(fs) {
|
|
497
|
+
polyfills(fs);
|
|
498
|
+
fs.gracefulify = patch;
|
|
499
|
+
fs.createReadStream = createReadStream;
|
|
500
|
+
fs.createWriteStream = createWriteStream;
|
|
501
|
+
var fs$readFile = fs.readFile;
|
|
502
|
+
fs.readFile = readFile;
|
|
503
|
+
function readFile(path, options, cb) {
|
|
504
|
+
if (typeof options === "function") cb = options, options = null;
|
|
505
|
+
return go$readFile(path, options, cb);
|
|
506
|
+
function go$readFile(path, options, cb, startTime) {
|
|
507
|
+
return fs$readFile(path, options, function(err) {
|
|
508
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
509
|
+
go$readFile,
|
|
510
|
+
[
|
|
511
|
+
path,
|
|
512
|
+
options,
|
|
513
|
+
cb
|
|
514
|
+
],
|
|
515
|
+
err,
|
|
516
|
+
startTime || Date.now(),
|
|
517
|
+
Date.now()
|
|
518
|
+
]);
|
|
519
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
var fs$writeFile = fs.writeFile;
|
|
524
|
+
fs.writeFile = writeFile;
|
|
525
|
+
function writeFile(path, data, options, cb) {
|
|
526
|
+
if (typeof options === "function") cb = options, options = null;
|
|
527
|
+
return go$writeFile(path, data, options, cb);
|
|
528
|
+
function go$writeFile(path, data, options, cb, startTime) {
|
|
529
|
+
return fs$writeFile(path, data, options, function(err) {
|
|
530
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
531
|
+
go$writeFile,
|
|
532
|
+
[
|
|
533
|
+
path,
|
|
534
|
+
data,
|
|
535
|
+
options,
|
|
536
|
+
cb
|
|
537
|
+
],
|
|
538
|
+
err,
|
|
539
|
+
startTime || Date.now(),
|
|
540
|
+
Date.now()
|
|
541
|
+
]);
|
|
542
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
var fs$appendFile = fs.appendFile;
|
|
547
|
+
if (fs$appendFile) fs.appendFile = appendFile;
|
|
548
|
+
function appendFile(path, data, options, cb) {
|
|
549
|
+
if (typeof options === "function") cb = options, options = null;
|
|
550
|
+
return go$appendFile(path, data, options, cb);
|
|
551
|
+
function go$appendFile(path, data, options, cb, startTime) {
|
|
552
|
+
return fs$appendFile(path, data, options, function(err) {
|
|
553
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
554
|
+
go$appendFile,
|
|
555
|
+
[
|
|
556
|
+
path,
|
|
557
|
+
data,
|
|
558
|
+
options,
|
|
559
|
+
cb
|
|
560
|
+
],
|
|
561
|
+
err,
|
|
562
|
+
startTime || Date.now(),
|
|
563
|
+
Date.now()
|
|
564
|
+
]);
|
|
565
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
var fs$copyFile = fs.copyFile;
|
|
570
|
+
if (fs$copyFile) fs.copyFile = copyFile;
|
|
571
|
+
function copyFile(src, dest, flags, cb) {
|
|
572
|
+
if (typeof flags === "function") {
|
|
573
|
+
cb = flags;
|
|
574
|
+
flags = 0;
|
|
575
|
+
}
|
|
576
|
+
return go$copyFile(src, dest, flags, cb);
|
|
577
|
+
function go$copyFile(src, dest, flags, cb, startTime) {
|
|
578
|
+
return fs$copyFile(src, dest, flags, function(err) {
|
|
579
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
580
|
+
go$copyFile,
|
|
581
|
+
[
|
|
582
|
+
src,
|
|
583
|
+
dest,
|
|
584
|
+
flags,
|
|
585
|
+
cb
|
|
586
|
+
],
|
|
587
|
+
err,
|
|
588
|
+
startTime || Date.now(),
|
|
589
|
+
Date.now()
|
|
590
|
+
]);
|
|
591
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
var fs$readdir = fs.readdir;
|
|
596
|
+
fs.readdir = readdir;
|
|
597
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
598
|
+
function readdir(path, options, cb) {
|
|
599
|
+
if (typeof options === "function") cb = options, options = null;
|
|
600
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
|
|
601
|
+
return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
|
|
602
|
+
} : function go$readdir(path, options, cb, startTime) {
|
|
603
|
+
return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
|
|
604
|
+
};
|
|
605
|
+
return go$readdir(path, options, cb);
|
|
606
|
+
function fs$readdirCallback(path, options, cb, startTime) {
|
|
607
|
+
return function(err, files) {
|
|
608
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
609
|
+
go$readdir,
|
|
610
|
+
[
|
|
611
|
+
path,
|
|
612
|
+
options,
|
|
613
|
+
cb
|
|
614
|
+
],
|
|
615
|
+
err,
|
|
616
|
+
startTime || Date.now(),
|
|
617
|
+
Date.now()
|
|
618
|
+
]);
|
|
619
|
+
else {
|
|
620
|
+
if (files && files.sort) files.sort();
|
|
621
|
+
if (typeof cb === "function") cb.call(this, err, files);
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
if (process.version.substr(0, 4) === "v0.8") {
|
|
627
|
+
var legStreams = legacy(fs);
|
|
628
|
+
ReadStream = legStreams.ReadStream;
|
|
629
|
+
WriteStream = legStreams.WriteStream;
|
|
630
|
+
}
|
|
631
|
+
var fs$ReadStream = fs.ReadStream;
|
|
632
|
+
if (fs$ReadStream) {
|
|
633
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
634
|
+
ReadStream.prototype.open = ReadStream$open;
|
|
635
|
+
}
|
|
636
|
+
var fs$WriteStream = fs.WriteStream;
|
|
637
|
+
if (fs$WriteStream) {
|
|
638
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
639
|
+
WriteStream.prototype.open = WriteStream$open;
|
|
640
|
+
}
|
|
641
|
+
Object.defineProperty(fs, "ReadStream", {
|
|
642
|
+
get: function() {
|
|
643
|
+
return ReadStream;
|
|
644
|
+
},
|
|
645
|
+
set: function(val) {
|
|
646
|
+
ReadStream = val;
|
|
647
|
+
},
|
|
648
|
+
enumerable: true,
|
|
649
|
+
configurable: true
|
|
650
|
+
});
|
|
651
|
+
Object.defineProperty(fs, "WriteStream", {
|
|
652
|
+
get: function() {
|
|
653
|
+
return WriteStream;
|
|
654
|
+
},
|
|
655
|
+
set: function(val) {
|
|
656
|
+
WriteStream = val;
|
|
657
|
+
},
|
|
658
|
+
enumerable: true,
|
|
659
|
+
configurable: true
|
|
660
|
+
});
|
|
661
|
+
var FileReadStream = ReadStream;
|
|
662
|
+
Object.defineProperty(fs, "FileReadStream", {
|
|
663
|
+
get: function() {
|
|
664
|
+
return FileReadStream;
|
|
665
|
+
},
|
|
666
|
+
set: function(val) {
|
|
667
|
+
FileReadStream = val;
|
|
668
|
+
},
|
|
669
|
+
enumerable: true,
|
|
670
|
+
configurable: true
|
|
671
|
+
});
|
|
672
|
+
var FileWriteStream = WriteStream;
|
|
673
|
+
Object.defineProperty(fs, "FileWriteStream", {
|
|
674
|
+
get: function() {
|
|
675
|
+
return FileWriteStream;
|
|
676
|
+
},
|
|
677
|
+
set: function(val) {
|
|
678
|
+
FileWriteStream = val;
|
|
679
|
+
},
|
|
680
|
+
enumerable: true,
|
|
681
|
+
configurable: true
|
|
682
|
+
});
|
|
683
|
+
function ReadStream(path, options) {
|
|
684
|
+
if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
|
|
685
|
+
else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
686
|
+
}
|
|
687
|
+
function ReadStream$open() {
|
|
688
|
+
var that = this;
|
|
689
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
690
|
+
if (err) {
|
|
691
|
+
if (that.autoClose) that.destroy();
|
|
692
|
+
that.emit("error", err);
|
|
693
|
+
} else {
|
|
694
|
+
that.fd = fd;
|
|
695
|
+
that.emit("open", fd);
|
|
696
|
+
that.read();
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
function WriteStream(path, options) {
|
|
701
|
+
if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
|
|
702
|
+
else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
703
|
+
}
|
|
704
|
+
function WriteStream$open() {
|
|
705
|
+
var that = this;
|
|
706
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
707
|
+
if (err) {
|
|
708
|
+
that.destroy();
|
|
709
|
+
that.emit("error", err);
|
|
710
|
+
} else {
|
|
711
|
+
that.fd = fd;
|
|
712
|
+
that.emit("open", fd);
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
function createReadStream(path, options) {
|
|
717
|
+
return new fs.ReadStream(path, options);
|
|
718
|
+
}
|
|
719
|
+
function createWriteStream(path, options) {
|
|
720
|
+
return new fs.WriteStream(path, options);
|
|
721
|
+
}
|
|
722
|
+
var fs$open = fs.open;
|
|
723
|
+
fs.open = open;
|
|
724
|
+
function open(path, flags, mode, cb) {
|
|
725
|
+
if (typeof mode === "function") cb = mode, mode = null;
|
|
726
|
+
return go$open(path, flags, mode, cb);
|
|
727
|
+
function go$open(path, flags, mode, cb, startTime) {
|
|
728
|
+
return fs$open(path, flags, mode, function(err, fd) {
|
|
729
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
|
|
730
|
+
go$open,
|
|
731
|
+
[
|
|
732
|
+
path,
|
|
733
|
+
flags,
|
|
734
|
+
mode,
|
|
735
|
+
cb
|
|
736
|
+
],
|
|
737
|
+
err,
|
|
738
|
+
startTime || Date.now(),
|
|
739
|
+
Date.now()
|
|
740
|
+
]);
|
|
741
|
+
else if (typeof cb === "function") cb.apply(this, arguments);
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return fs;
|
|
746
|
+
}
|
|
747
|
+
function enqueue(elem) {
|
|
748
|
+
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
749
|
+
fs[gracefulQueue].push(elem);
|
|
750
|
+
retry();
|
|
751
|
+
}
|
|
752
|
+
var retryTimer;
|
|
753
|
+
function resetQueue() {
|
|
754
|
+
var now = Date.now();
|
|
755
|
+
for (var i = 0; i < fs[gracefulQueue].length; ++i) if (fs[gracefulQueue][i].length > 2) {
|
|
756
|
+
fs[gracefulQueue][i][3] = now;
|
|
757
|
+
fs[gracefulQueue][i][4] = now;
|
|
758
|
+
}
|
|
759
|
+
retry();
|
|
760
|
+
}
|
|
761
|
+
function retry() {
|
|
762
|
+
clearTimeout(retryTimer);
|
|
763
|
+
retryTimer = void 0;
|
|
764
|
+
if (fs[gracefulQueue].length === 0) return;
|
|
765
|
+
var elem = fs[gracefulQueue].shift();
|
|
766
|
+
var fn = elem[0];
|
|
767
|
+
var args = elem[1];
|
|
768
|
+
var err = elem[2];
|
|
769
|
+
var startTime = elem[3];
|
|
770
|
+
var lastTime = elem[4];
|
|
771
|
+
if (startTime === void 0) {
|
|
772
|
+
debug("RETRY", fn.name, args);
|
|
773
|
+
fn.apply(null, args);
|
|
774
|
+
} else if (Date.now() - startTime >= 6e4) {
|
|
775
|
+
debug("TIMEOUT", fn.name, args);
|
|
776
|
+
var cb = args.pop();
|
|
777
|
+
if (typeof cb === "function") cb.call(null, err);
|
|
778
|
+
} else {
|
|
779
|
+
var sinceAttempt = Date.now() - lastTime;
|
|
780
|
+
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
781
|
+
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
782
|
+
debug("RETRY", fn.name, args);
|
|
783
|
+
fn.apply(null, args.concat([startTime]));
|
|
784
|
+
} else fs[gracefulQueue].push(elem);
|
|
785
|
+
}
|
|
786
|
+
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
787
|
+
}
|
|
788
|
+
}));
|
|
789
|
+
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region ../../node_modules/fs-extra/lib/fs/index.js
|
|
792
|
+
var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
793
|
+
const u = require_universalify().fromCallback;
|
|
794
|
+
const fs = require_graceful_fs();
|
|
795
|
+
const api = [
|
|
796
|
+
"access",
|
|
797
|
+
"appendFile",
|
|
798
|
+
"chmod",
|
|
799
|
+
"chown",
|
|
800
|
+
"close",
|
|
801
|
+
"copyFile",
|
|
802
|
+
"cp",
|
|
803
|
+
"fchmod",
|
|
804
|
+
"fchown",
|
|
805
|
+
"fdatasync",
|
|
806
|
+
"fstat",
|
|
807
|
+
"fsync",
|
|
808
|
+
"ftruncate",
|
|
809
|
+
"futimes",
|
|
810
|
+
"glob",
|
|
811
|
+
"lchmod",
|
|
812
|
+
"lchown",
|
|
813
|
+
"lutimes",
|
|
814
|
+
"link",
|
|
815
|
+
"lstat",
|
|
816
|
+
"mkdir",
|
|
817
|
+
"mkdtemp",
|
|
818
|
+
"open",
|
|
819
|
+
"opendir",
|
|
820
|
+
"readdir",
|
|
821
|
+
"readFile",
|
|
822
|
+
"readlink",
|
|
823
|
+
"realpath",
|
|
824
|
+
"rename",
|
|
825
|
+
"rm",
|
|
826
|
+
"rmdir",
|
|
827
|
+
"stat",
|
|
828
|
+
"statfs",
|
|
829
|
+
"symlink",
|
|
830
|
+
"truncate",
|
|
831
|
+
"unlink",
|
|
832
|
+
"utimes",
|
|
833
|
+
"writeFile"
|
|
834
|
+
].filter((key) => {
|
|
835
|
+
return typeof fs[key] === "function";
|
|
836
|
+
});
|
|
837
|
+
Object.assign(exports, fs);
|
|
838
|
+
api.forEach((method) => {
|
|
839
|
+
exports[method] = u(fs[method]);
|
|
840
|
+
});
|
|
841
|
+
exports.exists = function(filename, callback) {
|
|
842
|
+
if (typeof callback === "function") return fs.exists(filename, callback);
|
|
843
|
+
return new Promise((resolve) => {
|
|
844
|
+
return fs.exists(filename, resolve);
|
|
845
|
+
});
|
|
846
|
+
};
|
|
847
|
+
exports.read = function(fd, buffer, offset, length, position, callback) {
|
|
848
|
+
if (typeof callback === "function") return fs.read(fd, buffer, offset, length, position, callback);
|
|
849
|
+
return new Promise((resolve, reject) => {
|
|
850
|
+
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
|
|
851
|
+
if (err) return reject(err);
|
|
852
|
+
resolve({
|
|
853
|
+
bytesRead,
|
|
854
|
+
buffer
|
|
855
|
+
});
|
|
856
|
+
});
|
|
857
|
+
});
|
|
858
|
+
};
|
|
859
|
+
exports.write = function(fd, buffer, ...args) {
|
|
860
|
+
if (typeof args[args.length - 1] === "function") return fs.write(fd, buffer, ...args);
|
|
861
|
+
return new Promise((resolve, reject) => {
|
|
862
|
+
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
|
|
863
|
+
if (err) return reject(err);
|
|
864
|
+
resolve({
|
|
865
|
+
bytesWritten,
|
|
866
|
+
buffer
|
|
867
|
+
});
|
|
868
|
+
});
|
|
869
|
+
});
|
|
870
|
+
};
|
|
871
|
+
exports.readv = function(fd, buffers, ...args) {
|
|
872
|
+
if (typeof args[args.length - 1] === "function") return fs.readv(fd, buffers, ...args);
|
|
873
|
+
return new Promise((resolve, reject) => {
|
|
874
|
+
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
|
|
875
|
+
if (err) return reject(err);
|
|
876
|
+
resolve({
|
|
877
|
+
bytesRead,
|
|
878
|
+
buffers
|
|
879
|
+
});
|
|
880
|
+
});
|
|
881
|
+
});
|
|
882
|
+
};
|
|
883
|
+
exports.writev = function(fd, buffers, ...args) {
|
|
884
|
+
if (typeof args[args.length - 1] === "function") return fs.writev(fd, buffers, ...args);
|
|
885
|
+
return new Promise((resolve, reject) => {
|
|
886
|
+
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
|
|
887
|
+
if (err) return reject(err);
|
|
888
|
+
resolve({
|
|
889
|
+
bytesWritten,
|
|
890
|
+
buffers
|
|
891
|
+
});
|
|
892
|
+
});
|
|
893
|
+
});
|
|
894
|
+
};
|
|
895
|
+
if (typeof fs.realpath.native === "function") exports.realpath.native = u(fs.realpath.native);
|
|
896
|
+
else process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003");
|
|
897
|
+
}));
|
|
898
|
+
|
|
899
|
+
//#endregion
|
|
900
|
+
//#region ../../node_modules/fs-extra/lib/mkdirs/utils.js
|
|
901
|
+
var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
902
|
+
const path$11 = require("path");
|
|
903
|
+
module.exports.checkPath = function checkPath(pth) {
|
|
904
|
+
if (process.platform === "win32") {
|
|
905
|
+
if (/[<>:"|?*]/.test(pth.replace(path$11.parse(pth).root, ""))) {
|
|
906
|
+
const error = /* @__PURE__ */ new Error(`Path contains invalid characters: ${pth}`);
|
|
907
|
+
error.code = "EINVAL";
|
|
908
|
+
throw error;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
}));
|
|
913
|
+
|
|
914
|
+
//#endregion
|
|
915
|
+
//#region ../../node_modules/fs-extra/lib/mkdirs/make-dir.js
|
|
916
|
+
var require_make_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
917
|
+
const fs = require_fs();
|
|
918
|
+
const { checkPath } = require_utils$1();
|
|
919
|
+
const getMode = (options) => {
|
|
920
|
+
const defaults = { mode: 511 };
|
|
921
|
+
if (typeof options === "number") return options;
|
|
922
|
+
return {
|
|
923
|
+
...defaults,
|
|
924
|
+
...options
|
|
925
|
+
}.mode;
|
|
926
|
+
};
|
|
927
|
+
module.exports.makeDir = async (dir, options) => {
|
|
928
|
+
checkPath(dir);
|
|
929
|
+
return fs.mkdir(dir, {
|
|
930
|
+
mode: getMode(options),
|
|
931
|
+
recursive: true
|
|
932
|
+
});
|
|
933
|
+
};
|
|
934
|
+
module.exports.makeDirSync = (dir, options) => {
|
|
935
|
+
checkPath(dir);
|
|
936
|
+
return fs.mkdirSync(dir, {
|
|
937
|
+
mode: getMode(options),
|
|
938
|
+
recursive: true
|
|
939
|
+
});
|
|
940
|
+
};
|
|
941
|
+
}));
|
|
942
|
+
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region ../../node_modules/fs-extra/lib/mkdirs/index.js
|
|
945
|
+
var require_mkdirs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
946
|
+
const u = require_universalify().fromPromise;
|
|
947
|
+
const { makeDir: _makeDir, makeDirSync } = require_make_dir();
|
|
948
|
+
const makeDir = u(_makeDir);
|
|
949
|
+
module.exports = {
|
|
950
|
+
mkdirs: makeDir,
|
|
951
|
+
mkdirsSync: makeDirSync,
|
|
952
|
+
mkdirp: makeDir,
|
|
953
|
+
mkdirpSync: makeDirSync,
|
|
954
|
+
ensureDir: makeDir,
|
|
955
|
+
ensureDirSync: makeDirSync
|
|
956
|
+
};
|
|
957
|
+
}));
|
|
958
|
+
|
|
959
|
+
//#endregion
|
|
960
|
+
//#region ../../node_modules/fs-extra/lib/path-exists/index.js
|
|
961
|
+
var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
962
|
+
const u = require_universalify().fromPromise;
|
|
963
|
+
const fs = require_fs();
|
|
964
|
+
function pathExists(path) {
|
|
965
|
+
return fs.access(path).then(() => true).catch(() => false);
|
|
966
|
+
}
|
|
967
|
+
module.exports = {
|
|
968
|
+
pathExists: u(pathExists),
|
|
969
|
+
pathExistsSync: fs.existsSync
|
|
970
|
+
};
|
|
971
|
+
}));
|
|
972
|
+
|
|
973
|
+
//#endregion
|
|
974
|
+
//#region ../../node_modules/fs-extra/lib/util/utimes.js
|
|
975
|
+
var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
976
|
+
const fs = require_fs();
|
|
977
|
+
const u = require_universalify().fromPromise;
|
|
978
|
+
async function utimesMillis(path, atime, mtime) {
|
|
979
|
+
const fd = await fs.open(path, "r+");
|
|
980
|
+
let closeErr = null;
|
|
981
|
+
try {
|
|
982
|
+
await fs.futimes(fd, atime, mtime);
|
|
983
|
+
} finally {
|
|
984
|
+
try {
|
|
985
|
+
await fs.close(fd);
|
|
986
|
+
} catch (e) {
|
|
987
|
+
closeErr = e;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
if (closeErr) throw closeErr;
|
|
991
|
+
}
|
|
992
|
+
function utimesMillisSync(path, atime, mtime) {
|
|
993
|
+
const fd = fs.openSync(path, "r+");
|
|
994
|
+
fs.futimesSync(fd, atime, mtime);
|
|
995
|
+
return fs.closeSync(fd);
|
|
996
|
+
}
|
|
997
|
+
module.exports = {
|
|
998
|
+
utimesMillis: u(utimesMillis),
|
|
999
|
+
utimesMillisSync
|
|
1000
|
+
};
|
|
1001
|
+
}));
|
|
1002
|
+
|
|
1003
|
+
//#endregion
|
|
1004
|
+
//#region ../../node_modules/fs-extra/lib/util/stat.js
|
|
1005
|
+
var require_stat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1006
|
+
const fs = require_fs();
|
|
1007
|
+
const path$10 = require("path");
|
|
1008
|
+
const u = require_universalify().fromPromise;
|
|
1009
|
+
function getStats(src, dest, opts) {
|
|
1010
|
+
const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true });
|
|
1011
|
+
return Promise.all([statFunc(src), statFunc(dest).catch((err) => {
|
|
1012
|
+
if (err.code === "ENOENT") return null;
|
|
1013
|
+
throw err;
|
|
1014
|
+
})]).then(([srcStat, destStat]) => ({
|
|
1015
|
+
srcStat,
|
|
1016
|
+
destStat
|
|
1017
|
+
}));
|
|
1018
|
+
}
|
|
1019
|
+
function getStatsSync(src, dest, opts) {
|
|
1020
|
+
let destStat;
|
|
1021
|
+
const statFunc = opts.dereference ? (file) => fs.statSync(file, { bigint: true }) : (file) => fs.lstatSync(file, { bigint: true });
|
|
1022
|
+
const srcStat = statFunc(src);
|
|
1023
|
+
try {
|
|
1024
|
+
destStat = statFunc(dest);
|
|
1025
|
+
} catch (err) {
|
|
1026
|
+
if (err.code === "ENOENT") return {
|
|
1027
|
+
srcStat,
|
|
1028
|
+
destStat: null
|
|
1029
|
+
};
|
|
1030
|
+
throw err;
|
|
1031
|
+
}
|
|
1032
|
+
return {
|
|
1033
|
+
srcStat,
|
|
1034
|
+
destStat
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
async function checkPaths(src, dest, funcName, opts) {
|
|
1038
|
+
const { srcStat, destStat } = await getStats(src, dest, opts);
|
|
1039
|
+
if (destStat) {
|
|
1040
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1041
|
+
const srcBaseName = path$10.basename(src);
|
|
1042
|
+
const destBaseName = path$10.basename(dest);
|
|
1043
|
+
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) return {
|
|
1044
|
+
srcStat,
|
|
1045
|
+
destStat,
|
|
1046
|
+
isChangingCase: true
|
|
1047
|
+
};
|
|
1048
|
+
throw new Error("Source and destination must not be the same.");
|
|
1049
|
+
}
|
|
1050
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1051
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1052
|
+
}
|
|
1053
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) throw new Error(errMsg(src, dest, funcName));
|
|
1054
|
+
return {
|
|
1055
|
+
srcStat,
|
|
1056
|
+
destStat
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
function checkPathsSync(src, dest, funcName, opts) {
|
|
1060
|
+
const { srcStat, destStat } = getStatsSync(src, dest, opts);
|
|
1061
|
+
if (destStat) {
|
|
1062
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1063
|
+
const srcBaseName = path$10.basename(src);
|
|
1064
|
+
const destBaseName = path$10.basename(dest);
|
|
1065
|
+
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) return {
|
|
1066
|
+
srcStat,
|
|
1067
|
+
destStat,
|
|
1068
|
+
isChangingCase: true
|
|
1069
|
+
};
|
|
1070
|
+
throw new Error("Source and destination must not be the same.");
|
|
1071
|
+
}
|
|
1072
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
|
|
1073
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
|
|
1074
|
+
}
|
|
1075
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) throw new Error(errMsg(src, dest, funcName));
|
|
1076
|
+
return {
|
|
1077
|
+
srcStat,
|
|
1078
|
+
destStat
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
async function checkParentPaths(src, srcStat, dest, funcName) {
|
|
1082
|
+
const srcParent = path$10.resolve(path$10.dirname(src));
|
|
1083
|
+
const destParent = path$10.resolve(path$10.dirname(dest));
|
|
1084
|
+
if (destParent === srcParent || destParent === path$10.parse(destParent).root) return;
|
|
1085
|
+
let destStat;
|
|
1086
|
+
try {
|
|
1087
|
+
destStat = await fs.stat(destParent, { bigint: true });
|
|
1088
|
+
} catch (err) {
|
|
1089
|
+
if (err.code === "ENOENT") return;
|
|
1090
|
+
throw err;
|
|
1091
|
+
}
|
|
1092
|
+
if (areIdentical(srcStat, destStat)) throw new Error(errMsg(src, dest, funcName));
|
|
1093
|
+
return checkParentPaths(src, srcStat, destParent, funcName);
|
|
1094
|
+
}
|
|
1095
|
+
function checkParentPathsSync(src, srcStat, dest, funcName) {
|
|
1096
|
+
const srcParent = path$10.resolve(path$10.dirname(src));
|
|
1097
|
+
const destParent = path$10.resolve(path$10.dirname(dest));
|
|
1098
|
+
if (destParent === srcParent || destParent === path$10.parse(destParent).root) return;
|
|
1099
|
+
let destStat;
|
|
1100
|
+
try {
|
|
1101
|
+
destStat = fs.statSync(destParent, { bigint: true });
|
|
1102
|
+
} catch (err) {
|
|
1103
|
+
if (err.code === "ENOENT") return;
|
|
1104
|
+
throw err;
|
|
1105
|
+
}
|
|
1106
|
+
if (areIdentical(srcStat, destStat)) throw new Error(errMsg(src, dest, funcName));
|
|
1107
|
+
return checkParentPathsSync(src, srcStat, destParent, funcName);
|
|
1108
|
+
}
|
|
1109
|
+
function areIdentical(srcStat, destStat) {
|
|
1110
|
+
return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
|
|
1111
|
+
}
|
|
1112
|
+
function isSrcSubdir(src, dest) {
|
|
1113
|
+
const srcArr = path$10.resolve(src).split(path$10.sep).filter((i) => i);
|
|
1114
|
+
const destArr = path$10.resolve(dest).split(path$10.sep).filter((i) => i);
|
|
1115
|
+
return srcArr.every((cur, i) => destArr[i] === cur);
|
|
1116
|
+
}
|
|
1117
|
+
function errMsg(src, dest, funcName) {
|
|
1118
|
+
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
|
|
1119
|
+
}
|
|
1120
|
+
module.exports = {
|
|
1121
|
+
checkPaths: u(checkPaths),
|
|
1122
|
+
checkPathsSync,
|
|
1123
|
+
checkParentPaths: u(checkParentPaths),
|
|
1124
|
+
checkParentPathsSync,
|
|
1125
|
+
isSrcSubdir,
|
|
1126
|
+
areIdentical
|
|
1127
|
+
};
|
|
1128
|
+
}));
|
|
1129
|
+
|
|
1130
|
+
//#endregion
|
|
1131
|
+
//#region ../../node_modules/fs-extra/lib/util/async.js
|
|
1132
|
+
var require_async = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1133
|
+
async function asyncIteratorConcurrentProcess(iterator, fn) {
|
|
1134
|
+
const promises = [];
|
|
1135
|
+
for await (const item of iterator) promises.push(fn(item).then(() => null, (err) => err ?? /* @__PURE__ */ new Error("unknown error")));
|
|
1136
|
+
await Promise.all(promises.map((promise) => promise.then((possibleErr) => {
|
|
1137
|
+
if (possibleErr !== null) throw possibleErr;
|
|
1138
|
+
})));
|
|
1139
|
+
}
|
|
1140
|
+
module.exports = { asyncIteratorConcurrentProcess };
|
|
1141
|
+
}));
|
|
1142
|
+
|
|
1143
|
+
//#endregion
|
|
1144
|
+
//#region ../../node_modules/fs-extra/lib/copy/copy.js
|
|
1145
|
+
var require_copy$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1146
|
+
const fs = require_fs();
|
|
1147
|
+
const path$9 = require("path");
|
|
1148
|
+
const { mkdirs } = require_mkdirs();
|
|
1149
|
+
const { pathExists } = require_path_exists();
|
|
1150
|
+
const { utimesMillis } = require_utimes();
|
|
1151
|
+
const stat = require_stat();
|
|
1152
|
+
const { asyncIteratorConcurrentProcess } = require_async();
|
|
1153
|
+
async function copy(src, dest, opts = {}) {
|
|
1154
|
+
if (typeof opts === "function") opts = { filter: opts };
|
|
1155
|
+
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1156
|
+
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1157
|
+
if (opts.preserveTimestamps && process.arch === "ia32") process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0001");
|
|
1158
|
+
const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
|
|
1159
|
+
await stat.checkParentPaths(src, srcStat, dest, "copy");
|
|
1160
|
+
if (!await runFilter(src, dest, opts)) return;
|
|
1161
|
+
const destParent = path$9.dirname(dest);
|
|
1162
|
+
if (!await pathExists(destParent)) await mkdirs(destParent);
|
|
1163
|
+
await getStatsAndPerformCopy(destStat, src, dest, opts);
|
|
1164
|
+
}
|
|
1165
|
+
async function runFilter(src, dest, opts) {
|
|
1166
|
+
if (!opts.filter) return true;
|
|
1167
|
+
return opts.filter(src, dest);
|
|
1168
|
+
}
|
|
1169
|
+
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
|
|
1170
|
+
const srcStat = await (opts.dereference ? fs.stat : fs.lstat)(src);
|
|
1171
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
1172
|
+
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
1173
|
+
if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
|
|
1174
|
+
if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1175
|
+
if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1176
|
+
throw new Error(`Unknown file: ${src}`);
|
|
1177
|
+
}
|
|
1178
|
+
async function onFile(srcStat, destStat, src, dest, opts) {
|
|
1179
|
+
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
1180
|
+
if (opts.overwrite) {
|
|
1181
|
+
await fs.unlink(dest);
|
|
1182
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1183
|
+
}
|
|
1184
|
+
if (opts.errorOnExist) throw new Error(`'${dest}' already exists`);
|
|
1185
|
+
}
|
|
1186
|
+
async function copyFile(srcStat, src, dest, opts) {
|
|
1187
|
+
await fs.copyFile(src, dest);
|
|
1188
|
+
if (opts.preserveTimestamps) {
|
|
1189
|
+
if (fileIsNotWritable(srcStat.mode)) await makeFileWritable(dest, srcStat.mode);
|
|
1190
|
+
const updatedSrcStat = await fs.stat(src);
|
|
1191
|
+
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1192
|
+
}
|
|
1193
|
+
return fs.chmod(dest, srcStat.mode);
|
|
1194
|
+
}
|
|
1195
|
+
function fileIsNotWritable(srcMode) {
|
|
1196
|
+
return (srcMode & 128) === 0;
|
|
1197
|
+
}
|
|
1198
|
+
function makeFileWritable(dest, srcMode) {
|
|
1199
|
+
return fs.chmod(dest, srcMode | 128);
|
|
1200
|
+
}
|
|
1201
|
+
async function onDir(srcStat, destStat, src, dest, opts) {
|
|
1202
|
+
if (!destStat) await fs.mkdir(dest);
|
|
1203
|
+
await asyncIteratorConcurrentProcess(await fs.opendir(src), async (item) => {
|
|
1204
|
+
const srcItem = path$9.join(src, item.name);
|
|
1205
|
+
const destItem = path$9.join(dest, item.name);
|
|
1206
|
+
if (await runFilter(srcItem, destItem, opts)) {
|
|
1207
|
+
const { destStat } = await stat.checkPaths(srcItem, destItem, "copy", opts);
|
|
1208
|
+
await getStatsAndPerformCopy(destStat, srcItem, destItem, opts);
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
if (!destStat) await fs.chmod(dest, srcStat.mode);
|
|
1212
|
+
}
|
|
1213
|
+
async function onLink(destStat, src, dest, opts) {
|
|
1214
|
+
let resolvedSrc = await fs.readlink(src);
|
|
1215
|
+
if (opts.dereference) resolvedSrc = path$9.resolve(process.cwd(), resolvedSrc);
|
|
1216
|
+
if (!destStat) return fs.symlink(resolvedSrc, dest);
|
|
1217
|
+
let resolvedDest = null;
|
|
1218
|
+
try {
|
|
1219
|
+
resolvedDest = await fs.readlink(dest);
|
|
1220
|
+
} catch (e) {
|
|
1221
|
+
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs.symlink(resolvedSrc, dest);
|
|
1222
|
+
throw e;
|
|
1223
|
+
}
|
|
1224
|
+
if (opts.dereference) resolvedDest = path$9.resolve(process.cwd(), resolvedDest);
|
|
1225
|
+
if (resolvedSrc !== resolvedDest) {
|
|
1226
|
+
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1227
|
+
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1228
|
+
}
|
|
1229
|
+
await fs.unlink(dest);
|
|
1230
|
+
return fs.symlink(resolvedSrc, dest);
|
|
1231
|
+
}
|
|
1232
|
+
module.exports = copy;
|
|
1233
|
+
}));
|
|
1234
|
+
|
|
1235
|
+
//#endregion
|
|
1236
|
+
//#region ../../node_modules/fs-extra/lib/copy/copy-sync.js
|
|
1237
|
+
var require_copy_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1238
|
+
const fs = require_graceful_fs();
|
|
1239
|
+
const path$8 = require("path");
|
|
1240
|
+
const mkdirsSync = require_mkdirs().mkdirsSync;
|
|
1241
|
+
const utimesMillisSync = require_utimes().utimesMillisSync;
|
|
1242
|
+
const stat = require_stat();
|
|
1243
|
+
function copySync(src, dest, opts) {
|
|
1244
|
+
if (typeof opts === "function") opts = { filter: opts };
|
|
1245
|
+
opts = opts || {};
|
|
1246
|
+
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
|
|
1247
|
+
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
|
|
1248
|
+
if (opts.preserveTimestamps && process.arch === "ia32") process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0002");
|
|
1249
|
+
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
|
|
1250
|
+
stat.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
1251
|
+
if (opts.filter && !opts.filter(src, dest)) return;
|
|
1252
|
+
const destParent = path$8.dirname(dest);
|
|
1253
|
+
if (!fs.existsSync(destParent)) mkdirsSync(destParent);
|
|
1254
|
+
return getStats(destStat, src, dest, opts);
|
|
1255
|
+
}
|
|
1256
|
+
function getStats(destStat, src, dest, opts) {
|
|
1257
|
+
const srcStat = (opts.dereference ? fs.statSync : fs.lstatSync)(src);
|
|
1258
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
|
|
1259
|
+
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
|
|
1260
|
+
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
|
|
1261
|
+
else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
|
|
1262
|
+
else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
|
|
1263
|
+
throw new Error(`Unknown file: ${src}`);
|
|
1264
|
+
}
|
|
1265
|
+
function onFile(srcStat, destStat, src, dest, opts) {
|
|
1266
|
+
if (!destStat) return copyFile(srcStat, src, dest, opts);
|
|
1267
|
+
return mayCopyFile(srcStat, src, dest, opts);
|
|
1268
|
+
}
|
|
1269
|
+
function mayCopyFile(srcStat, src, dest, opts) {
|
|
1270
|
+
if (opts.overwrite) {
|
|
1271
|
+
fs.unlinkSync(dest);
|
|
1272
|
+
return copyFile(srcStat, src, dest, opts);
|
|
1273
|
+
} else if (opts.errorOnExist) throw new Error(`'${dest}' already exists`);
|
|
1274
|
+
}
|
|
1275
|
+
function copyFile(srcStat, src, dest, opts) {
|
|
1276
|
+
fs.copyFileSync(src, dest);
|
|
1277
|
+
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
|
|
1278
|
+
return setDestMode(dest, srcStat.mode);
|
|
1279
|
+
}
|
|
1280
|
+
function handleTimestamps(srcMode, src, dest) {
|
|
1281
|
+
if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
|
|
1282
|
+
return setDestTimestamps(src, dest);
|
|
1283
|
+
}
|
|
1284
|
+
function fileIsNotWritable(srcMode) {
|
|
1285
|
+
return (srcMode & 128) === 0;
|
|
1286
|
+
}
|
|
1287
|
+
function makeFileWritable(dest, srcMode) {
|
|
1288
|
+
return setDestMode(dest, srcMode | 128);
|
|
1289
|
+
}
|
|
1290
|
+
function setDestMode(dest, srcMode) {
|
|
1291
|
+
return fs.chmodSync(dest, srcMode);
|
|
1292
|
+
}
|
|
1293
|
+
function setDestTimestamps(src, dest) {
|
|
1294
|
+
const updatedSrcStat = fs.statSync(src);
|
|
1295
|
+
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
|
|
1296
|
+
}
|
|
1297
|
+
function onDir(srcStat, destStat, src, dest, opts) {
|
|
1298
|
+
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
|
|
1299
|
+
return copyDir(src, dest, opts);
|
|
1300
|
+
}
|
|
1301
|
+
function mkDirAndCopy(srcMode, src, dest, opts) {
|
|
1302
|
+
fs.mkdirSync(dest);
|
|
1303
|
+
copyDir(src, dest, opts);
|
|
1304
|
+
return setDestMode(dest, srcMode);
|
|
1305
|
+
}
|
|
1306
|
+
function copyDir(src, dest, opts) {
|
|
1307
|
+
const dir = fs.opendirSync(src);
|
|
1308
|
+
try {
|
|
1309
|
+
let dirent;
|
|
1310
|
+
while ((dirent = dir.readSync()) !== null) copyDirItem(dirent.name, src, dest, opts);
|
|
1311
|
+
} finally {
|
|
1312
|
+
dir.closeSync();
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
function copyDirItem(item, src, dest, opts) {
|
|
1316
|
+
const srcItem = path$8.join(src, item);
|
|
1317
|
+
const destItem = path$8.join(dest, item);
|
|
1318
|
+
if (opts.filter && !opts.filter(srcItem, destItem)) return;
|
|
1319
|
+
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
1320
|
+
return getStats(destStat, srcItem, destItem, opts);
|
|
1321
|
+
}
|
|
1322
|
+
function onLink(destStat, src, dest, opts) {
|
|
1323
|
+
let resolvedSrc = fs.readlinkSync(src);
|
|
1324
|
+
if (opts.dereference) resolvedSrc = path$8.resolve(process.cwd(), resolvedSrc);
|
|
1325
|
+
if (!destStat) return fs.symlinkSync(resolvedSrc, dest);
|
|
1326
|
+
else {
|
|
1327
|
+
let resolvedDest;
|
|
1328
|
+
try {
|
|
1329
|
+
resolvedDest = fs.readlinkSync(dest);
|
|
1330
|
+
} catch (err) {
|
|
1331
|
+
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs.symlinkSync(resolvedSrc, dest);
|
|
1332
|
+
throw err;
|
|
1333
|
+
}
|
|
1334
|
+
if (opts.dereference) resolvedDest = path$8.resolve(process.cwd(), resolvedDest);
|
|
1335
|
+
if (resolvedSrc !== resolvedDest) {
|
|
1336
|
+
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
1337
|
+
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
1338
|
+
}
|
|
1339
|
+
return copyLink(resolvedSrc, dest);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
function copyLink(resolvedSrc, dest) {
|
|
1343
|
+
fs.unlinkSync(dest);
|
|
1344
|
+
return fs.symlinkSync(resolvedSrc, dest);
|
|
1345
|
+
}
|
|
1346
|
+
module.exports = copySync;
|
|
1347
|
+
}));
|
|
1348
|
+
|
|
1349
|
+
//#endregion
|
|
1350
|
+
//#region ../../node_modules/fs-extra/lib/copy/index.js
|
|
1351
|
+
var require_copy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1352
|
+
const u = require_universalify().fromPromise;
|
|
1353
|
+
module.exports = {
|
|
1354
|
+
copy: u(require_copy$1()),
|
|
1355
|
+
copySync: require_copy_sync()
|
|
1356
|
+
};
|
|
1357
|
+
}));
|
|
1358
|
+
|
|
1359
|
+
//#endregion
|
|
1360
|
+
//#region ../../node_modules/fs-extra/lib/remove/index.js
|
|
1361
|
+
var require_remove = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1362
|
+
const fs = require_graceful_fs();
|
|
1363
|
+
const u = require_universalify().fromCallback;
|
|
1364
|
+
function remove(path, callback) {
|
|
1365
|
+
fs.rm(path, {
|
|
1366
|
+
recursive: true,
|
|
1367
|
+
force: true
|
|
1368
|
+
}, callback);
|
|
1369
|
+
}
|
|
1370
|
+
function removeSync(path) {
|
|
1371
|
+
fs.rmSync(path, {
|
|
1372
|
+
recursive: true,
|
|
1373
|
+
force: true
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
module.exports = {
|
|
1377
|
+
remove: u(remove),
|
|
1378
|
+
removeSync
|
|
1379
|
+
};
|
|
1380
|
+
}));
|
|
1381
|
+
|
|
1382
|
+
//#endregion
|
|
1383
|
+
//#region ../../node_modules/fs-extra/lib/empty/index.js
|
|
1384
|
+
var require_empty = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1385
|
+
const u = require_universalify().fromPromise;
|
|
1386
|
+
const fs = require_fs();
|
|
1387
|
+
const path$7 = require("path");
|
|
1388
|
+
const mkdir = require_mkdirs();
|
|
1389
|
+
const remove = require_remove();
|
|
1390
|
+
const emptyDir = u(async function emptyDir(dir) {
|
|
1391
|
+
let items;
|
|
1392
|
+
try {
|
|
1393
|
+
items = await fs.readdir(dir);
|
|
1394
|
+
} catch {
|
|
1395
|
+
return mkdir.mkdirs(dir);
|
|
1396
|
+
}
|
|
1397
|
+
return Promise.all(items.map((item) => remove.remove(path$7.join(dir, item))));
|
|
1398
|
+
});
|
|
1399
|
+
function emptyDirSync(dir) {
|
|
1400
|
+
let items;
|
|
1401
|
+
try {
|
|
1402
|
+
items = fs.readdirSync(dir);
|
|
1403
|
+
} catch {
|
|
1404
|
+
return mkdir.mkdirsSync(dir);
|
|
1405
|
+
}
|
|
1406
|
+
items.forEach((item) => {
|
|
1407
|
+
item = path$7.join(dir, item);
|
|
1408
|
+
remove.removeSync(item);
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
module.exports = {
|
|
1412
|
+
emptyDirSync,
|
|
1413
|
+
emptydirSync: emptyDirSync,
|
|
1414
|
+
emptyDir,
|
|
1415
|
+
emptydir: emptyDir
|
|
1416
|
+
};
|
|
1417
|
+
}));
|
|
1418
|
+
|
|
1419
|
+
//#endregion
|
|
1420
|
+
//#region ../../node_modules/fs-extra/lib/ensure/file.js
|
|
1421
|
+
var require_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1422
|
+
const u = require_universalify().fromPromise;
|
|
1423
|
+
const path$6 = require("path");
|
|
1424
|
+
const fs = require_fs();
|
|
1425
|
+
const mkdir = require_mkdirs();
|
|
1426
|
+
async function createFile(file) {
|
|
1427
|
+
let stats;
|
|
1428
|
+
try {
|
|
1429
|
+
stats = await fs.stat(file);
|
|
1430
|
+
} catch {}
|
|
1431
|
+
if (stats && stats.isFile()) return;
|
|
1432
|
+
const dir = path$6.dirname(file);
|
|
1433
|
+
let dirStats = null;
|
|
1434
|
+
try {
|
|
1435
|
+
dirStats = await fs.stat(dir);
|
|
1436
|
+
} catch (err) {
|
|
1437
|
+
if (err.code === "ENOENT") {
|
|
1438
|
+
await mkdir.mkdirs(dir);
|
|
1439
|
+
await fs.writeFile(file, "");
|
|
1440
|
+
return;
|
|
1441
|
+
} else throw err;
|
|
1442
|
+
}
|
|
1443
|
+
if (dirStats.isDirectory()) await fs.writeFile(file, "");
|
|
1444
|
+
else await fs.readdir(dir);
|
|
1445
|
+
}
|
|
1446
|
+
function createFileSync(file) {
|
|
1447
|
+
let stats;
|
|
1448
|
+
try {
|
|
1449
|
+
stats = fs.statSync(file);
|
|
1450
|
+
} catch {}
|
|
1451
|
+
if (stats && stats.isFile()) return;
|
|
1452
|
+
const dir = path$6.dirname(file);
|
|
1453
|
+
try {
|
|
1454
|
+
if (!fs.statSync(dir).isDirectory()) fs.readdirSync(dir);
|
|
1455
|
+
} catch (err) {
|
|
1456
|
+
if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
|
|
1457
|
+
else throw err;
|
|
1458
|
+
}
|
|
1459
|
+
fs.writeFileSync(file, "");
|
|
1460
|
+
}
|
|
1461
|
+
module.exports = {
|
|
1462
|
+
createFile: u(createFile),
|
|
1463
|
+
createFileSync
|
|
1464
|
+
};
|
|
1465
|
+
}));
|
|
1466
|
+
|
|
1467
|
+
//#endregion
|
|
1468
|
+
//#region ../../node_modules/fs-extra/lib/ensure/link.js
|
|
1469
|
+
var require_link = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1470
|
+
const u = require_universalify().fromPromise;
|
|
1471
|
+
const path$5 = require("path");
|
|
1472
|
+
const fs = require_fs();
|
|
1473
|
+
const mkdir = require_mkdirs();
|
|
1474
|
+
const { pathExists } = require_path_exists();
|
|
1475
|
+
const { areIdentical } = require_stat();
|
|
1476
|
+
async function createLink(srcpath, dstpath) {
|
|
1477
|
+
let dstStat;
|
|
1478
|
+
try {
|
|
1479
|
+
dstStat = await fs.lstat(dstpath);
|
|
1480
|
+
} catch {}
|
|
1481
|
+
let srcStat;
|
|
1482
|
+
try {
|
|
1483
|
+
srcStat = await fs.lstat(srcpath);
|
|
1484
|
+
} catch (err) {
|
|
1485
|
+
err.message = err.message.replace("lstat", "ensureLink");
|
|
1486
|
+
throw err;
|
|
1487
|
+
}
|
|
1488
|
+
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
1489
|
+
const dir = path$5.dirname(dstpath);
|
|
1490
|
+
if (!await pathExists(dir)) await mkdir.mkdirs(dir);
|
|
1491
|
+
await fs.link(srcpath, dstpath);
|
|
1492
|
+
}
|
|
1493
|
+
function createLinkSync(srcpath, dstpath) {
|
|
1494
|
+
let dstStat;
|
|
1495
|
+
try {
|
|
1496
|
+
dstStat = fs.lstatSync(dstpath);
|
|
1497
|
+
} catch {}
|
|
1498
|
+
try {
|
|
1499
|
+
const srcStat = fs.lstatSync(srcpath);
|
|
1500
|
+
if (dstStat && areIdentical(srcStat, dstStat)) return;
|
|
1501
|
+
} catch (err) {
|
|
1502
|
+
err.message = err.message.replace("lstat", "ensureLink");
|
|
1503
|
+
throw err;
|
|
1504
|
+
}
|
|
1505
|
+
const dir = path$5.dirname(dstpath);
|
|
1506
|
+
if (fs.existsSync(dir)) return fs.linkSync(srcpath, dstpath);
|
|
1507
|
+
mkdir.mkdirsSync(dir);
|
|
1508
|
+
return fs.linkSync(srcpath, dstpath);
|
|
1509
|
+
}
|
|
1510
|
+
module.exports = {
|
|
1511
|
+
createLink: u(createLink),
|
|
1512
|
+
createLinkSync
|
|
1513
|
+
};
|
|
1514
|
+
}));
|
|
1515
|
+
|
|
1516
|
+
//#endregion
|
|
1517
|
+
//#region ../../node_modules/fs-extra/lib/ensure/symlink-paths.js
|
|
1518
|
+
var require_symlink_paths = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1519
|
+
const path$4 = require("path");
|
|
1520
|
+
const fs = require_fs();
|
|
1521
|
+
const { pathExists } = require_path_exists();
|
|
1522
|
+
const u = require_universalify().fromPromise;
|
|
1523
|
+
/**
|
|
1524
|
+
* Function that returns two types of paths, one relative to symlink, and one
|
|
1525
|
+
* relative to the current working directory. Checks if path is absolute or
|
|
1526
|
+
* relative. If the path is relative, this function checks if the path is
|
|
1527
|
+
* relative to symlink or relative to current working directory. This is an
|
|
1528
|
+
* initiative to find a smarter `srcpath` to supply when building symlinks.
|
|
1529
|
+
* This allows you to determine which path to use out of one of three possible
|
|
1530
|
+
* types of source paths. The first is an absolute path. This is detected by
|
|
1531
|
+
* `path.isAbsolute()`. When an absolute path is provided, it is checked to
|
|
1532
|
+
* see if it exists. If it does it's used, if not an error is returned
|
|
1533
|
+
* (callback)/ thrown (sync). The other two options for `srcpath` are a
|
|
1534
|
+
* relative url. By default Node's `fs.symlink` works by creating a symlink
|
|
1535
|
+
* using `dstpath` and expects the `srcpath` to be relative to the newly
|
|
1536
|
+
* created symlink. If you provide a `srcpath` that does not exist on the file
|
|
1537
|
+
* system it results in a broken symlink. To minimize this, the function
|
|
1538
|
+
* checks to see if the 'relative to symlink' source file exists, and if it
|
|
1539
|
+
* does it will use it. If it does not, it checks if there's a file that
|
|
1540
|
+
* exists that is relative to the current working directory, if does its used.
|
|
1541
|
+
* This preserves the expectations of the original fs.symlink spec and adds
|
|
1542
|
+
* the ability to pass in `relative to current working direcotry` paths.
|
|
1543
|
+
*/
|
|
1544
|
+
async function symlinkPaths(srcpath, dstpath) {
|
|
1545
|
+
if (path$4.isAbsolute(srcpath)) {
|
|
1546
|
+
try {
|
|
1547
|
+
await fs.lstat(srcpath);
|
|
1548
|
+
} catch (err) {
|
|
1549
|
+
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1550
|
+
throw err;
|
|
1551
|
+
}
|
|
1552
|
+
return {
|
|
1553
|
+
toCwd: srcpath,
|
|
1554
|
+
toDst: srcpath
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
const dstdir = path$4.dirname(dstpath);
|
|
1558
|
+
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
1559
|
+
if (await pathExists(relativeToDst)) return {
|
|
1560
|
+
toCwd: relativeToDst,
|
|
1561
|
+
toDst: srcpath
|
|
1562
|
+
};
|
|
1563
|
+
try {
|
|
1564
|
+
await fs.lstat(srcpath);
|
|
1565
|
+
} catch (err) {
|
|
1566
|
+
err.message = err.message.replace("lstat", "ensureSymlink");
|
|
1567
|
+
throw err;
|
|
1568
|
+
}
|
|
1569
|
+
return {
|
|
1570
|
+
toCwd: srcpath,
|
|
1571
|
+
toDst: path$4.relative(dstdir, srcpath)
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
function symlinkPathsSync(srcpath, dstpath) {
|
|
1575
|
+
if (path$4.isAbsolute(srcpath)) {
|
|
1576
|
+
if (!fs.existsSync(srcpath)) throw new Error("absolute srcpath does not exist");
|
|
1577
|
+
return {
|
|
1578
|
+
toCwd: srcpath,
|
|
1579
|
+
toDst: srcpath
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
const dstdir = path$4.dirname(dstpath);
|
|
1583
|
+
const relativeToDst = path$4.join(dstdir, srcpath);
|
|
1584
|
+
if (fs.existsSync(relativeToDst)) return {
|
|
1585
|
+
toCwd: relativeToDst,
|
|
1586
|
+
toDst: srcpath
|
|
1587
|
+
};
|
|
1588
|
+
if (!fs.existsSync(srcpath)) throw new Error("relative srcpath does not exist");
|
|
1589
|
+
return {
|
|
1590
|
+
toCwd: srcpath,
|
|
1591
|
+
toDst: path$4.relative(dstdir, srcpath)
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
module.exports = {
|
|
1595
|
+
symlinkPaths: u(symlinkPaths),
|
|
1596
|
+
symlinkPathsSync
|
|
1597
|
+
};
|
|
1598
|
+
}));
|
|
1599
|
+
|
|
1600
|
+
//#endregion
|
|
1601
|
+
//#region ../../node_modules/fs-extra/lib/ensure/symlink-type.js
|
|
1602
|
+
var require_symlink_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1603
|
+
const fs = require_fs();
|
|
1604
|
+
const u = require_universalify().fromPromise;
|
|
1605
|
+
async function symlinkType(srcpath, type) {
|
|
1606
|
+
if (type) return type;
|
|
1607
|
+
let stats;
|
|
1608
|
+
try {
|
|
1609
|
+
stats = await fs.lstat(srcpath);
|
|
1610
|
+
} catch {
|
|
1611
|
+
return "file";
|
|
1612
|
+
}
|
|
1613
|
+
return stats && stats.isDirectory() ? "dir" : "file";
|
|
1614
|
+
}
|
|
1615
|
+
function symlinkTypeSync(srcpath, type) {
|
|
1616
|
+
if (type) return type;
|
|
1617
|
+
let stats;
|
|
1618
|
+
try {
|
|
1619
|
+
stats = fs.lstatSync(srcpath);
|
|
1620
|
+
} catch {
|
|
1621
|
+
return "file";
|
|
1622
|
+
}
|
|
1623
|
+
return stats && stats.isDirectory() ? "dir" : "file";
|
|
1624
|
+
}
|
|
1625
|
+
module.exports = {
|
|
1626
|
+
symlinkType: u(symlinkType),
|
|
1627
|
+
symlinkTypeSync
|
|
1628
|
+
};
|
|
1629
|
+
}));
|
|
1630
|
+
|
|
1631
|
+
//#endregion
|
|
1632
|
+
//#region ../../node_modules/fs-extra/lib/ensure/symlink.js
|
|
1633
|
+
var require_symlink = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1634
|
+
const u = require_universalify().fromPromise;
|
|
1635
|
+
const path$3 = require("path");
|
|
1636
|
+
const fs = require_fs();
|
|
1637
|
+
const { mkdirs, mkdirsSync } = require_mkdirs();
|
|
1638
|
+
const { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
|
|
1639
|
+
const { symlinkType, symlinkTypeSync } = require_symlink_type();
|
|
1640
|
+
const { pathExists } = require_path_exists();
|
|
1641
|
+
const { areIdentical } = require_stat();
|
|
1642
|
+
async function createSymlink(srcpath, dstpath, type) {
|
|
1643
|
+
let stats;
|
|
1644
|
+
try {
|
|
1645
|
+
stats = await fs.lstat(dstpath);
|
|
1646
|
+
} catch {}
|
|
1647
|
+
if (stats && stats.isSymbolicLink()) {
|
|
1648
|
+
const [srcStat, dstStat] = await Promise.all([fs.stat(srcpath), fs.stat(dstpath)]);
|
|
1649
|
+
if (areIdentical(srcStat, dstStat)) return;
|
|
1650
|
+
}
|
|
1651
|
+
const relative = await symlinkPaths(srcpath, dstpath);
|
|
1652
|
+
srcpath = relative.toDst;
|
|
1653
|
+
const toType = await symlinkType(relative.toCwd, type);
|
|
1654
|
+
const dir = path$3.dirname(dstpath);
|
|
1655
|
+
if (!await pathExists(dir)) await mkdirs(dir);
|
|
1656
|
+
return fs.symlink(srcpath, dstpath, toType);
|
|
1657
|
+
}
|
|
1658
|
+
function createSymlinkSync(srcpath, dstpath, type) {
|
|
1659
|
+
let stats;
|
|
1660
|
+
try {
|
|
1661
|
+
stats = fs.lstatSync(dstpath);
|
|
1662
|
+
} catch {}
|
|
1663
|
+
if (stats && stats.isSymbolicLink()) {
|
|
1664
|
+
if (areIdentical(fs.statSync(srcpath), fs.statSync(dstpath))) return;
|
|
1665
|
+
}
|
|
1666
|
+
const relative = symlinkPathsSync(srcpath, dstpath);
|
|
1667
|
+
srcpath = relative.toDst;
|
|
1668
|
+
type = symlinkTypeSync(relative.toCwd, type);
|
|
1669
|
+
const dir = path$3.dirname(dstpath);
|
|
1670
|
+
if (fs.existsSync(dir)) return fs.symlinkSync(srcpath, dstpath, type);
|
|
1671
|
+
mkdirsSync(dir);
|
|
1672
|
+
return fs.symlinkSync(srcpath, dstpath, type);
|
|
1673
|
+
}
|
|
1674
|
+
module.exports = {
|
|
1675
|
+
createSymlink: u(createSymlink),
|
|
1676
|
+
createSymlinkSync
|
|
1677
|
+
};
|
|
1678
|
+
}));
|
|
1679
|
+
|
|
1680
|
+
//#endregion
|
|
1681
|
+
//#region ../../node_modules/fs-extra/lib/ensure/index.js
|
|
1682
|
+
var require_ensure = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1683
|
+
const { createFile, createFileSync } = require_file();
|
|
1684
|
+
const { createLink, createLinkSync } = require_link();
|
|
1685
|
+
const { createSymlink, createSymlinkSync } = require_symlink();
|
|
1686
|
+
module.exports = {
|
|
1687
|
+
createFile,
|
|
1688
|
+
createFileSync,
|
|
1689
|
+
ensureFile: createFile,
|
|
1690
|
+
ensureFileSync: createFileSync,
|
|
1691
|
+
createLink,
|
|
1692
|
+
createLinkSync,
|
|
1693
|
+
ensureLink: createLink,
|
|
1694
|
+
ensureLinkSync: createLinkSync,
|
|
1695
|
+
createSymlink,
|
|
1696
|
+
createSymlinkSync,
|
|
1697
|
+
ensureSymlink: createSymlink,
|
|
1698
|
+
ensureSymlinkSync: createSymlinkSync
|
|
1699
|
+
};
|
|
1700
|
+
}));
|
|
1701
|
+
|
|
1702
|
+
//#endregion
|
|
1703
|
+
//#region ../../node_modules/jsonfile/utils.js
|
|
1704
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1705
|
+
function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
|
|
1706
|
+
const EOF = finalEOL ? EOL : "";
|
|
1707
|
+
return JSON.stringify(obj, replacer, spaces).replace(/\n/g, EOL) + EOF;
|
|
1708
|
+
}
|
|
1709
|
+
function stripBom(content) {
|
|
1710
|
+
if (Buffer.isBuffer(content)) content = content.toString("utf8");
|
|
1711
|
+
return content.replace(/^\uFEFF/, "");
|
|
1712
|
+
}
|
|
1713
|
+
module.exports = {
|
|
1714
|
+
stringify,
|
|
1715
|
+
stripBom
|
|
1716
|
+
};
|
|
1717
|
+
}));
|
|
1718
|
+
|
|
1719
|
+
//#endregion
|
|
1720
|
+
//#region ../../node_modules/jsonfile/index.js
|
|
1721
|
+
var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1722
|
+
let _fs;
|
|
1723
|
+
try {
|
|
1724
|
+
_fs = require_graceful_fs();
|
|
1725
|
+
} catch (_) {
|
|
1726
|
+
_fs = require("fs");
|
|
1727
|
+
}
|
|
1728
|
+
const universalify = require_universalify();
|
|
1729
|
+
const { stringify, stripBom } = require_utils();
|
|
1730
|
+
async function _readFile(file, options = {}) {
|
|
1731
|
+
if (typeof options === "string") options = { encoding: options };
|
|
1732
|
+
const fs = options.fs || _fs;
|
|
1733
|
+
const shouldThrow = "throws" in options ? options.throws : true;
|
|
1734
|
+
let data = await universalify.fromCallback(fs.readFile)(file, options);
|
|
1735
|
+
data = stripBom(data);
|
|
1736
|
+
let obj;
|
|
1737
|
+
try {
|
|
1738
|
+
obj = JSON.parse(data, options ? options.reviver : null);
|
|
1739
|
+
} catch (err) {
|
|
1740
|
+
if (shouldThrow) {
|
|
1741
|
+
err.message = `${file}: ${err.message}`;
|
|
1742
|
+
throw err;
|
|
1743
|
+
} else return null;
|
|
1744
|
+
}
|
|
1745
|
+
return obj;
|
|
1746
|
+
}
|
|
1747
|
+
const readFile = universalify.fromPromise(_readFile);
|
|
1748
|
+
function readFileSync(file, options = {}) {
|
|
1749
|
+
if (typeof options === "string") options = { encoding: options };
|
|
1750
|
+
const fs = options.fs || _fs;
|
|
1751
|
+
const shouldThrow = "throws" in options ? options.throws : true;
|
|
1752
|
+
try {
|
|
1753
|
+
let content = fs.readFileSync(file, options);
|
|
1754
|
+
content = stripBom(content);
|
|
1755
|
+
return JSON.parse(content, options.reviver);
|
|
1756
|
+
} catch (err) {
|
|
1757
|
+
if (shouldThrow) {
|
|
1758
|
+
err.message = `${file}: ${err.message}`;
|
|
1759
|
+
throw err;
|
|
1760
|
+
} else return null;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
async function _writeFile(file, obj, options = {}) {
|
|
1764
|
+
const fs = options.fs || _fs;
|
|
1765
|
+
const str = stringify(obj, options);
|
|
1766
|
+
await universalify.fromCallback(fs.writeFile)(file, str, options);
|
|
1767
|
+
}
|
|
1768
|
+
const writeFile = universalify.fromPromise(_writeFile);
|
|
1769
|
+
function writeFileSync(file, obj, options = {}) {
|
|
1770
|
+
const fs = options.fs || _fs;
|
|
1771
|
+
const str = stringify(obj, options);
|
|
1772
|
+
return fs.writeFileSync(file, str, options);
|
|
1773
|
+
}
|
|
1774
|
+
module.exports = {
|
|
1775
|
+
readFile,
|
|
1776
|
+
readFileSync,
|
|
1777
|
+
writeFile,
|
|
1778
|
+
writeFileSync
|
|
1779
|
+
};
|
|
1780
|
+
}));
|
|
1781
|
+
|
|
1782
|
+
//#endregion
|
|
1783
|
+
//#region ../../node_modules/fs-extra/lib/json/jsonfile.js
|
|
1784
|
+
var require_jsonfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1785
|
+
const jsonFile = require_jsonfile$1();
|
|
1786
|
+
module.exports = {
|
|
1787
|
+
readJson: jsonFile.readFile,
|
|
1788
|
+
readJsonSync: jsonFile.readFileSync,
|
|
1789
|
+
writeJson: jsonFile.writeFile,
|
|
1790
|
+
writeJsonSync: jsonFile.writeFileSync
|
|
1791
|
+
};
|
|
1792
|
+
}));
|
|
1793
|
+
|
|
1794
|
+
//#endregion
|
|
1795
|
+
//#region ../../node_modules/fs-extra/lib/output-file/index.js
|
|
1796
|
+
var require_output_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1797
|
+
const u = require_universalify().fromPromise;
|
|
1798
|
+
const fs = require_fs();
|
|
1799
|
+
const path$2 = require("path");
|
|
1800
|
+
const mkdir = require_mkdirs();
|
|
1801
|
+
const pathExists = require_path_exists().pathExists;
|
|
1802
|
+
async function outputFile(file, data, encoding = "utf-8") {
|
|
1803
|
+
const dir = path$2.dirname(file);
|
|
1804
|
+
if (!await pathExists(dir)) await mkdir.mkdirs(dir);
|
|
1805
|
+
return fs.writeFile(file, data, encoding);
|
|
1806
|
+
}
|
|
1807
|
+
function outputFileSync(file, ...args) {
|
|
1808
|
+
const dir = path$2.dirname(file);
|
|
1809
|
+
if (!fs.existsSync(dir)) mkdir.mkdirsSync(dir);
|
|
1810
|
+
fs.writeFileSync(file, ...args);
|
|
1811
|
+
}
|
|
1812
|
+
module.exports = {
|
|
1813
|
+
outputFile: u(outputFile),
|
|
1814
|
+
outputFileSync
|
|
1815
|
+
};
|
|
1816
|
+
}));
|
|
1817
|
+
|
|
1818
|
+
//#endregion
|
|
1819
|
+
//#region ../../node_modules/fs-extra/lib/json/output-json.js
|
|
1820
|
+
var require_output_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1821
|
+
const { stringify } = require_utils();
|
|
1822
|
+
const { outputFile } = require_output_file();
|
|
1823
|
+
async function outputJson(file, data, options = {}) {
|
|
1824
|
+
await outputFile(file, stringify(data, options), options);
|
|
1825
|
+
}
|
|
1826
|
+
module.exports = outputJson;
|
|
1827
|
+
}));
|
|
1828
|
+
|
|
1829
|
+
//#endregion
|
|
1830
|
+
//#region ../../node_modules/fs-extra/lib/json/output-json-sync.js
|
|
1831
|
+
var require_output_json_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1832
|
+
const { stringify } = require_utils();
|
|
1833
|
+
const { outputFileSync } = require_output_file();
|
|
1834
|
+
function outputJsonSync(file, data, options) {
|
|
1835
|
+
outputFileSync(file, stringify(data, options), options);
|
|
1836
|
+
}
|
|
1837
|
+
module.exports = outputJsonSync;
|
|
1838
|
+
}));
|
|
1839
|
+
|
|
1840
|
+
//#endregion
|
|
1841
|
+
//#region ../../node_modules/fs-extra/lib/json/index.js
|
|
1842
|
+
var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1843
|
+
const u = require_universalify().fromPromise;
|
|
1844
|
+
const jsonFile = require_jsonfile();
|
|
1845
|
+
jsonFile.outputJson = u(require_output_json());
|
|
1846
|
+
jsonFile.outputJsonSync = require_output_json_sync();
|
|
1847
|
+
jsonFile.outputJSON = jsonFile.outputJson;
|
|
1848
|
+
jsonFile.outputJSONSync = jsonFile.outputJsonSync;
|
|
1849
|
+
jsonFile.writeJSON = jsonFile.writeJson;
|
|
1850
|
+
jsonFile.writeJSONSync = jsonFile.writeJsonSync;
|
|
1851
|
+
jsonFile.readJSON = jsonFile.readJson;
|
|
1852
|
+
jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
1853
|
+
module.exports = jsonFile;
|
|
1854
|
+
}));
|
|
1855
|
+
|
|
1856
|
+
//#endregion
|
|
1857
|
+
//#region ../../node_modules/fs-extra/lib/move/move.js
|
|
1858
|
+
var require_move$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1859
|
+
const fs = require_fs();
|
|
1860
|
+
const path$1 = require("path");
|
|
1861
|
+
const { copy } = require_copy();
|
|
1862
|
+
const { remove } = require_remove();
|
|
1863
|
+
const { mkdirp } = require_mkdirs();
|
|
1864
|
+
const { pathExists } = require_path_exists();
|
|
1865
|
+
const stat = require_stat();
|
|
1866
|
+
async function move(src, dest, opts = {}) {
|
|
1867
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
1868
|
+
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
|
|
1869
|
+
await stat.checkParentPaths(src, srcStat, dest, "move");
|
|
1870
|
+
const destParent = path$1.dirname(dest);
|
|
1871
|
+
if (path$1.parse(destParent).root !== destParent) await mkdirp(destParent);
|
|
1872
|
+
return doRename(src, dest, overwrite, isChangingCase);
|
|
1873
|
+
}
|
|
1874
|
+
async function doRename(src, dest, overwrite, isChangingCase) {
|
|
1875
|
+
if (!isChangingCase) {
|
|
1876
|
+
if (overwrite) await remove(dest);
|
|
1877
|
+
else if (await pathExists(dest)) throw new Error("dest already exists.");
|
|
1878
|
+
}
|
|
1879
|
+
try {
|
|
1880
|
+
await fs.rename(src, dest);
|
|
1881
|
+
} catch (err) {
|
|
1882
|
+
if (err.code !== "EXDEV") throw err;
|
|
1883
|
+
await moveAcrossDevice(src, dest, overwrite);
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
async function moveAcrossDevice(src, dest, overwrite) {
|
|
1887
|
+
await copy(src, dest, {
|
|
1888
|
+
overwrite,
|
|
1889
|
+
errorOnExist: true,
|
|
1890
|
+
preserveTimestamps: true
|
|
1891
|
+
});
|
|
1892
|
+
return remove(src);
|
|
1893
|
+
}
|
|
1894
|
+
module.exports = move;
|
|
1895
|
+
}));
|
|
1896
|
+
|
|
1897
|
+
//#endregion
|
|
1898
|
+
//#region ../../node_modules/fs-extra/lib/move/move-sync.js
|
|
1899
|
+
var require_move_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1900
|
+
const fs = require_graceful_fs();
|
|
1901
|
+
const path = require("path");
|
|
1902
|
+
const copySync = require_copy().copySync;
|
|
1903
|
+
const removeSync = require_remove().removeSync;
|
|
1904
|
+
const mkdirpSync = require_mkdirs().mkdirpSync;
|
|
1905
|
+
const stat = require_stat();
|
|
1906
|
+
function moveSync(src, dest, opts) {
|
|
1907
|
+
opts = opts || {};
|
|
1908
|
+
const overwrite = opts.overwrite || opts.clobber || false;
|
|
1909
|
+
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
|
|
1910
|
+
stat.checkParentPathsSync(src, srcStat, dest, "move");
|
|
1911
|
+
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest));
|
|
1912
|
+
return doRename(src, dest, overwrite, isChangingCase);
|
|
1913
|
+
}
|
|
1914
|
+
function isParentRoot(dest) {
|
|
1915
|
+
const parent = path.dirname(dest);
|
|
1916
|
+
return path.parse(parent).root === parent;
|
|
1917
|
+
}
|
|
1918
|
+
function doRename(src, dest, overwrite, isChangingCase) {
|
|
1919
|
+
if (isChangingCase) return rename(src, dest, overwrite);
|
|
1920
|
+
if (overwrite) {
|
|
1921
|
+
removeSync(dest);
|
|
1922
|
+
return rename(src, dest, overwrite);
|
|
1923
|
+
}
|
|
1924
|
+
if (fs.existsSync(dest)) throw new Error("dest already exists.");
|
|
1925
|
+
return rename(src, dest, overwrite);
|
|
1926
|
+
}
|
|
1927
|
+
function rename(src, dest, overwrite) {
|
|
1928
|
+
try {
|
|
1929
|
+
fs.renameSync(src, dest);
|
|
1930
|
+
} catch (err) {
|
|
1931
|
+
if (err.code !== "EXDEV") throw err;
|
|
1932
|
+
return moveAcrossDevice(src, dest, overwrite);
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
function moveAcrossDevice(src, dest, overwrite) {
|
|
1936
|
+
copySync(src, dest, {
|
|
1937
|
+
overwrite,
|
|
1938
|
+
errorOnExist: true,
|
|
1939
|
+
preserveTimestamps: true
|
|
1940
|
+
});
|
|
1941
|
+
return removeSync(src);
|
|
1942
|
+
}
|
|
1943
|
+
module.exports = moveSync;
|
|
1944
|
+
}));
|
|
1945
|
+
|
|
1946
|
+
//#endregion
|
|
1947
|
+
//#region ../../node_modules/fs-extra/lib/move/index.js
|
|
1948
|
+
var require_move = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1949
|
+
const u = require_universalify().fromPromise;
|
|
1950
|
+
module.exports = {
|
|
1951
|
+
move: u(require_move$1()),
|
|
1952
|
+
moveSync: require_move_sync()
|
|
1953
|
+
};
|
|
1954
|
+
}));
|
|
1955
|
+
|
|
1956
|
+
//#endregion
|
|
1957
|
+
//#region ../../node_modules/fs-extra/lib/index.js
|
|
1958
|
+
var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1959
|
+
module.exports = {
|
|
1960
|
+
...require_fs(),
|
|
1961
|
+
...require_copy(),
|
|
1962
|
+
...require_empty(),
|
|
1963
|
+
...require_ensure(),
|
|
1964
|
+
...require_json(),
|
|
1965
|
+
...require_mkdirs(),
|
|
1966
|
+
...require_move(),
|
|
1967
|
+
...require_output_file(),
|
|
1968
|
+
...require_path_exists(),
|
|
1969
|
+
...require_remove()
|
|
1970
|
+
};
|
|
1971
|
+
}));
|
|
1972
|
+
|
|
1973
|
+
//#endregion
|
|
1974
|
+
//#region ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
1975
|
+
var import_lib = /* @__PURE__ */ __toESM(require_lib$1());
|
|
50
1976
|
const ANSI_BACKGROUND_OFFSET = 10;
|
|
51
1977
|
const wrapAnsi16 = (offset = 0) => (code) => `\u001B[${code + offset}m`;
|
|
52
1978
|
const wrapAnsi256 = (offset = 0) => (code) => `\u001B[${38 + offset};5;${code}m`;
|
|
@@ -211,7 +2137,7 @@ function assembleStyles() {
|
|
|
211
2137
|
const ansiStyles = assembleStyles();
|
|
212
2138
|
|
|
213
2139
|
//#endregion
|
|
214
|
-
//#region ../../node_modules
|
|
2140
|
+
//#region ../../node_modules/chalk/source/vendor/supports-color/index.js
|
|
215
2141
|
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.default.argv) {
|
|
216
2142
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
217
2143
|
const position = argv.indexOf(prefix + flag);
|
|
@@ -300,7 +2226,7 @@ const supportsColor = {
|
|
|
300
2226
|
};
|
|
301
2227
|
|
|
302
2228
|
//#endregion
|
|
303
|
-
//#region ../../node_modules
|
|
2229
|
+
//#region ../../node_modules/chalk/source/utilities.js
|
|
304
2230
|
function stringReplaceAll(string, substring, replacer) {
|
|
305
2231
|
let index = string.indexOf(substring);
|
|
306
2232
|
if (index === -1) return string;
|
|
@@ -329,7 +2255,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
329
2255
|
}
|
|
330
2256
|
|
|
331
2257
|
//#endregion
|
|
332
|
-
//#region ../../node_modules
|
|
2258
|
+
//#region ../../node_modules/chalk/source/index.js
|
|
333
2259
|
const { stdout: stdoutColor, stderr: stderrColor } = supportsColor;
|
|
334
2260
|
const GENERATOR = Symbol("GENERATOR");
|
|
335
2261
|
const STYLER = Symbol("STYLER");
|
|
@@ -452,7 +2378,7 @@ const chalk = createChalk();
|
|
|
452
2378
|
const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
453
2379
|
|
|
454
2380
|
//#endregion
|
|
455
|
-
//#region ../../node_modules
|
|
2381
|
+
//#region ../../node_modules/mimic-function/index.js
|
|
456
2382
|
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
457
2383
|
if (property === "length" || property === "prototype") return;
|
|
458
2384
|
if (property === "arguments" || property === "caller") return;
|
|
@@ -493,7 +2419,7 @@ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
|
493
2419
|
}
|
|
494
2420
|
|
|
495
2421
|
//#endregion
|
|
496
|
-
//#region ../../node_modules
|
|
2422
|
+
//#region ../../node_modules/restore-cursor/node_modules/onetime/index.js
|
|
497
2423
|
const calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
498
2424
|
const onetime = (function_, options = {}) => {
|
|
499
2425
|
if (typeof function_ !== "function") throw new TypeError("Expected a function");
|
|
@@ -518,7 +2444,7 @@ onetime.callCount = (function_) => {
|
|
|
518
2444
|
};
|
|
519
2445
|
|
|
520
2446
|
//#endregion
|
|
521
|
-
//#region ../../node_modules
|
|
2447
|
+
//#region ../../node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/signals.js
|
|
522
2448
|
/**
|
|
523
2449
|
* This is not the set of all possible signals.
|
|
524
2450
|
*
|
|
@@ -545,18 +2471,18 @@ onetime.callCount = (function_) => {
|
|
|
545
2471
|
* state from which it is not safe to try and enter JS
|
|
546
2472
|
* listeners.
|
|
547
2473
|
*/
|
|
548
|
-
const signals = [];
|
|
549
|
-
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
550
|
-
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
551
|
-
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
2474
|
+
const signals$1 = [];
|
|
2475
|
+
signals$1.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
2476
|
+
if (process.platform !== "win32") signals$1.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
2477
|
+
if (process.platform === "linux") signals$1.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
552
2478
|
|
|
553
2479
|
//#endregion
|
|
554
|
-
//#region ../../node_modules
|
|
555
|
-
const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
|
|
556
|
-
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
557
|
-
const global = globalThis;
|
|
558
|
-
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
559
|
-
var Emitter = class {
|
|
2480
|
+
//#region ../../node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/index.js
|
|
2481
|
+
const processOk$1 = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
|
|
2482
|
+
const kExitEmitter$1 = Symbol.for("signal-exit emitter");
|
|
2483
|
+
const global$2 = globalThis;
|
|
2484
|
+
const ObjectDefineProperty$1 = Object.defineProperty.bind(Object);
|
|
2485
|
+
var Emitter$1 = class {
|
|
560
2486
|
emitted = {
|
|
561
2487
|
afterExit: false,
|
|
562
2488
|
exit: false
|
|
@@ -568,8 +2494,8 @@ var Emitter = class {
|
|
|
568
2494
|
count = 0;
|
|
569
2495
|
id = Math.random();
|
|
570
2496
|
constructor() {
|
|
571
|
-
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
572
|
-
ObjectDefineProperty(global, kExitEmitter, {
|
|
2497
|
+
if (global$2[kExitEmitter$1]) return global$2[kExitEmitter$1];
|
|
2498
|
+
ObjectDefineProperty$1(global$2, kExitEmitter$1, {
|
|
573
2499
|
value: this,
|
|
574
2500
|
writable: false,
|
|
575
2501
|
enumerable: false,
|
|
@@ -597,8 +2523,8 @@ var Emitter = class {
|
|
|
597
2523
|
return ret;
|
|
598
2524
|
}
|
|
599
2525
|
};
|
|
600
|
-
var SignalExitBase = class {};
|
|
601
|
-
const signalExitWrap = (handler) => {
|
|
2526
|
+
var SignalExitBase$1 = class {};
|
|
2527
|
+
const signalExitWrap$1 = (handler) => {
|
|
602
2528
|
return {
|
|
603
2529
|
onExit(cb, opts) {
|
|
604
2530
|
return handler.onExit(cb, opts);
|
|
@@ -611,18 +2537,18 @@ const signalExitWrap = (handler) => {
|
|
|
611
2537
|
}
|
|
612
2538
|
};
|
|
613
2539
|
};
|
|
614
|
-
var SignalExitFallback = class extends SignalExitBase {
|
|
2540
|
+
var SignalExitFallback$1 = class extends SignalExitBase$1 {
|
|
615
2541
|
onExit() {
|
|
616
2542
|
return () => {};
|
|
617
2543
|
}
|
|
618
2544
|
load() {}
|
|
619
2545
|
unload() {}
|
|
620
2546
|
};
|
|
621
|
-
var SignalExit = class extends SignalExitBase {
|
|
2547
|
+
var SignalExit$1 = class extends SignalExitBase$1 {
|
|
622
2548
|
/* c8 ignore start */
|
|
623
|
-
#hupSig = process$
|
|
2549
|
+
#hupSig = process$8.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
624
2550
|
/* c8 ignore stop */
|
|
625
|
-
#emitter = new Emitter();
|
|
2551
|
+
#emitter = new Emitter$1();
|
|
626
2552
|
#process;
|
|
627
2553
|
#originalProcessEmit;
|
|
628
2554
|
#originalProcessReallyExit;
|
|
@@ -632,7 +2558,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
632
2558
|
super();
|
|
633
2559
|
this.#process = process;
|
|
634
2560
|
this.#sigListeners = {};
|
|
635
|
-
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
2561
|
+
for (const sig of signals$1) this.#sigListeners[sig] = () => {
|
|
636
2562
|
const listeners = this.#process.listeners(sig);
|
|
637
2563
|
let { count } = this.#emitter;
|
|
638
2564
|
/* c8 ignore start */
|
|
@@ -652,7 +2578,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
652
2578
|
}
|
|
653
2579
|
onExit(cb, opts) {
|
|
654
2580
|
/* c8 ignore start */
|
|
655
|
-
if (!processOk(this.#process)) return () => {};
|
|
2581
|
+
if (!processOk$1(this.#process)) return () => {};
|
|
656
2582
|
/* c8 ignore stop */
|
|
657
2583
|
if (this.#loaded === false) this.load();
|
|
658
2584
|
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
@@ -666,7 +2592,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
666
2592
|
if (this.#loaded) return;
|
|
667
2593
|
this.#loaded = true;
|
|
668
2594
|
this.#emitter.count += 1;
|
|
669
|
-
for (const sig of signals) try {
|
|
2595
|
+
for (const sig of signals$1) try {
|
|
670
2596
|
const fn = this.#sigListeners[sig];
|
|
671
2597
|
if (fn) this.#process.on(sig, fn);
|
|
672
2598
|
} catch (_) {}
|
|
@@ -680,7 +2606,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
680
2606
|
unload() {
|
|
681
2607
|
if (!this.#loaded) return;
|
|
682
2608
|
this.#loaded = false;
|
|
683
|
-
signals.forEach((sig) => {
|
|
2609
|
+
signals$1.forEach((sig) => {
|
|
684
2610
|
const listener = this.#sigListeners[sig];
|
|
685
2611
|
/* c8 ignore start */
|
|
686
2612
|
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
@@ -696,7 +2622,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
696
2622
|
}
|
|
697
2623
|
#processReallyExit(code) {
|
|
698
2624
|
/* c8 ignore start */
|
|
699
|
-
if (!processOk(this.#process)) return 0;
|
|
2625
|
+
if (!processOk$1(this.#process)) return 0;
|
|
700
2626
|
this.#process.exitCode = code || 0;
|
|
701
2627
|
/* c8 ignore stop */
|
|
702
2628
|
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
@@ -704,7 +2630,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
704
2630
|
}
|
|
705
2631
|
#processEmit(ev, ...args) {
|
|
706
2632
|
const og = this.#originalProcessEmit;
|
|
707
|
-
if (ev === "exit" && processOk(this.#process)) {
|
|
2633
|
+
if (ev === "exit" && processOk$1(this.#process)) {
|
|
708
2634
|
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
709
2635
|
/* c8 ignore start */
|
|
710
2636
|
const ret = og.call(this.#process, ev, ...args);
|
|
@@ -715,20 +2641,20 @@ var SignalExit = class extends SignalExitBase {
|
|
|
715
2641
|
} else return og.call(this.#process, ev, ...args);
|
|
716
2642
|
}
|
|
717
2643
|
};
|
|
718
|
-
const process$
|
|
719
|
-
const { onExit, load, unload } = signalExitWrap(processOk(process$
|
|
2644
|
+
const process$8 = globalThis.process;
|
|
2645
|
+
const { onExit: onExit$1, load: load$1, unload: unload$1 } = signalExitWrap$1(processOk$1(process$8) ? new SignalExit$1(process$8) : new SignalExitFallback$1());
|
|
720
2646
|
|
|
721
2647
|
//#endregion
|
|
722
|
-
//#region ../../node_modules
|
|
2648
|
+
//#region ../../node_modules/restore-cursor/index.js
|
|
723
2649
|
const terminal = node_process.default.stderr.isTTY ? node_process.default.stderr : node_process.default.stdout.isTTY ? node_process.default.stdout : void 0;
|
|
724
2650
|
const restoreCursor = terminal ? onetime(() => {
|
|
725
|
-
onExit(() => {
|
|
2651
|
+
onExit$1(() => {
|
|
726
2652
|
terminal.write("\x1B[?25h");
|
|
727
2653
|
}, { alwaysLast: true });
|
|
728
2654
|
}) : () => {};
|
|
729
2655
|
|
|
730
2656
|
//#endregion
|
|
731
|
-
//#region ../../node_modules
|
|
2657
|
+
//#region ../../node_modules/cli-cursor/index.js
|
|
732
2658
|
let isHidden = false;
|
|
733
2659
|
const cliCursor = {};
|
|
734
2660
|
cliCursor.show = (writableStream = node_process.default.stderr) => {
|
|
@@ -749,7 +2675,7 @@ cliCursor.toggle = (force, writableStream) => {
|
|
|
749
2675
|
};
|
|
750
2676
|
|
|
751
2677
|
//#endregion
|
|
752
|
-
//#region ../../node_modules
|
|
2678
|
+
//#region ../../node_modules/cli-spinners/spinners.json
|
|
753
2679
|
var spinners_default = {
|
|
754
2680
|
dots: {
|
|
755
2681
|
"interval": 80,
|
|
@@ -2407,12 +4333,12 @@ var spinners_default = {
|
|
|
2407
4333
|
};
|
|
2408
4334
|
|
|
2409
4335
|
//#endregion
|
|
2410
|
-
//#region ../../node_modules
|
|
4336
|
+
//#region ../../node_modules/cli-spinners/index.js
|
|
2411
4337
|
var cli_spinners_default = spinners_default;
|
|
2412
4338
|
const spinnersList = Object.keys(spinners_default);
|
|
2413
4339
|
|
|
2414
4340
|
//#endregion
|
|
2415
|
-
//#region ../../node_modules
|
|
4341
|
+
//#region ../../node_modules/yoctocolors/base.js
|
|
2416
4342
|
const hasColors = node_tty.default?.WriteStream?.prototype?.hasColors?.() ?? false;
|
|
2417
4343
|
const format = (open, close) => {
|
|
2418
4344
|
if (!hasColors) return (input) => input;
|
|
@@ -2477,7 +4403,7 @@ const bgCyanBright = format(106, 49);
|
|
|
2477
4403
|
const bgWhiteBright = format(107, 49);
|
|
2478
4404
|
|
|
2479
4405
|
//#endregion
|
|
2480
|
-
//#region ../../node_modules
|
|
4406
|
+
//#region ../../node_modules/is-unicode-supported/index.js
|
|
2481
4407
|
function isUnicodeSupported$1() {
|
|
2482
4408
|
const { env } = node_process.default;
|
|
2483
4409
|
const { TERM, TERM_PROGRAM } = env;
|
|
@@ -2486,7 +4412,7 @@ function isUnicodeSupported$1() {
|
|
|
2486
4412
|
}
|
|
2487
4413
|
|
|
2488
4414
|
//#endregion
|
|
2489
|
-
//#region ../../node_modules
|
|
4415
|
+
//#region ../../node_modules/log-symbols/symbols.js
|
|
2490
4416
|
const _isUnicodeSupported = isUnicodeSupported$1();
|
|
2491
4417
|
const info = blue(_isUnicodeSupported ? "ℹ" : "i");
|
|
2492
4418
|
const success = green(_isUnicodeSupported ? "✔" : "√");
|
|
@@ -2494,13 +4420,13 @@ const warning = yellow(_isUnicodeSupported ? "⚠" : "‼");
|
|
|
2494
4420
|
const error = red(_isUnicodeSupported ? "✖" : "×");
|
|
2495
4421
|
|
|
2496
4422
|
//#endregion
|
|
2497
|
-
//#region ../../node_modules
|
|
4423
|
+
//#region ../../node_modules/ansi-regex/index.js
|
|
2498
4424
|
function ansiRegex({ onlyFirst = false } = {}) {
|
|
2499
4425
|
return new RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
|
|
2500
4426
|
}
|
|
2501
4427
|
|
|
2502
4428
|
//#endregion
|
|
2503
|
-
//#region ../../node_modules
|
|
4429
|
+
//#region ../../node_modules/ora/node_modules/strip-ansi/index.js
|
|
2504
4430
|
const regex = ansiRegex();
|
|
2505
4431
|
function stripAnsi(string) {
|
|
2506
4432
|
if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
@@ -2508,7 +4434,7 @@ function stripAnsi(string) {
|
|
|
2508
4434
|
}
|
|
2509
4435
|
|
|
2510
4436
|
//#endregion
|
|
2511
|
-
//#region ../../node_modules
|
|
4437
|
+
//#region ../../node_modules/get-east-asian-width/lookup-data.js
|
|
2512
4438
|
const ambiguousRanges = [
|
|
2513
4439
|
161,
|
|
2514
4440
|
161,
|
|
@@ -3157,7 +5083,7 @@ const wideRanges = [
|
|
|
3157
5083
|
];
|
|
3158
5084
|
|
|
3159
5085
|
//#endregion
|
|
3160
|
-
//#region ../../node_modules
|
|
5086
|
+
//#region ../../node_modules/get-east-asian-width/utilities.js
|
|
3161
5087
|
/**
|
|
3162
5088
|
Binary search on a sorted flat array of [start, end] pairs.
|
|
3163
5089
|
|
|
@@ -3179,7 +5105,7 @@ const isInRange = (ranges, codePoint) => {
|
|
|
3179
5105
|
};
|
|
3180
5106
|
|
|
3181
5107
|
//#endregion
|
|
3182
|
-
//#region ../../node_modules
|
|
5108
|
+
//#region ../../node_modules/get-east-asian-width/lookup.js
|
|
3183
5109
|
const minimumAmbiguousCodePoint = ambiguousRanges[0];
|
|
3184
5110
|
const maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
|
|
3185
5111
|
const minimumFullWidthCodePoint = fullwidthRanges[0];
|
|
@@ -3221,7 +5147,7 @@ const isWide = (codePoint) => {
|
|
|
3221
5147
|
};
|
|
3222
5148
|
|
|
3223
5149
|
//#endregion
|
|
3224
|
-
//#region ../../node_modules
|
|
5150
|
+
//#region ../../node_modules/get-east-asian-width/index.js
|
|
3225
5151
|
function validate(codePoint) {
|
|
3226
5152
|
if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
3227
5153
|
}
|
|
@@ -3232,7 +5158,7 @@ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
|
3232
5158
|
}
|
|
3233
5159
|
|
|
3234
5160
|
//#endregion
|
|
3235
|
-
//#region ../../node_modules
|
|
5161
|
+
//#region ../../node_modules/ora/node_modules/string-width/index.js
|
|
3236
5162
|
/**
|
|
3237
5163
|
Logic:
|
|
3238
5164
|
- Segment graphemes to match how terminals render clusters.
|
|
@@ -3293,13 +5219,13 @@ function stringWidth(input, options = {}) {
|
|
|
3293
5219
|
}
|
|
3294
5220
|
|
|
3295
5221
|
//#endregion
|
|
3296
|
-
//#region ../../node_modules
|
|
5222
|
+
//#region ../../node_modules/is-interactive/index.js
|
|
3297
5223
|
function isInteractive({ stream = process.stdout } = {}) {
|
|
3298
5224
|
return Boolean(stream && stream.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env));
|
|
3299
5225
|
}
|
|
3300
5226
|
|
|
3301
5227
|
//#endregion
|
|
3302
|
-
//#region ../../node_modules
|
|
5228
|
+
//#region ../../node_modules/stdin-discarder/index.js
|
|
3303
5229
|
const ASCII_ETX_CODE = 3;
|
|
3304
5230
|
var StdinDiscarder = class {
|
|
3305
5231
|
#activeCount = 0;
|
|
@@ -3347,7 +5273,7 @@ const stdinDiscarder = new StdinDiscarder();
|
|
|
3347
5273
|
var stdin_discarder_default = Object.freeze(stdinDiscarder);
|
|
3348
5274
|
|
|
3349
5275
|
//#endregion
|
|
3350
|
-
//#region ../../node_modules
|
|
5276
|
+
//#region ../../node_modules/ora/index.js
|
|
3351
5277
|
const RENDER_DEFERRAL_TIMEOUT = 200;
|
|
3352
5278
|
const SYNCHRONIZED_OUTPUT_ENABLE = "\x1B[?2026h";
|
|
3353
5279
|
const SYNCHRONIZED_OUTPUT_DISABLE = "\x1B[?2026l";
|
|
@@ -3716,7 +5642,7 @@ function ora(options) {
|
|
|
3716
5642
|
}
|
|
3717
5643
|
|
|
3718
5644
|
//#endregion
|
|
3719
|
-
//#region ../../node_modules
|
|
5645
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/key.js
|
|
3720
5646
|
const isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
3721
5647
|
const isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
3722
5648
|
const isSpaceKey = (key) => key.name === "space";
|
|
@@ -3726,7 +5652,7 @@ const isNumberKey = (key) => "1234567890".includes(key.name);
|
|
|
3726
5652
|
const isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
3727
5653
|
|
|
3728
5654
|
//#endregion
|
|
3729
|
-
//#region ../../node_modules
|
|
5655
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/errors.js
|
|
3730
5656
|
var AbortPromptError = class extends Error {
|
|
3731
5657
|
name = "AbortPromptError";
|
|
3732
5658
|
message = "Prompt was aborted";
|
|
@@ -3750,7 +5676,7 @@ var ValidationError = class extends Error {
|
|
|
3750
5676
|
};
|
|
3751
5677
|
|
|
3752
5678
|
//#endregion
|
|
3753
|
-
//#region ../../node_modules
|
|
5679
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
3754
5680
|
const hookStorage = new node_async_hooks.AsyncLocalStorage();
|
|
3755
5681
|
function createStore(rl) {
|
|
3756
5682
|
return {
|
|
@@ -3847,7 +5773,7 @@ const effectScheduler = {
|
|
|
3847
5773
|
};
|
|
3848
5774
|
|
|
3849
5775
|
//#endregion
|
|
3850
|
-
//#region ../../node_modules
|
|
5776
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/use-state.js
|
|
3851
5777
|
function useState(defaultValue) {
|
|
3852
5778
|
return withPointer((pointer) => {
|
|
3853
5779
|
const setState = node_async_hooks.AsyncResource.bind(function setState(newValue) {
|
|
@@ -3864,7 +5790,7 @@ function useState(defaultValue) {
|
|
|
3864
5790
|
}
|
|
3865
5791
|
|
|
3866
5792
|
//#endregion
|
|
3867
|
-
//#region ../../node_modules
|
|
5793
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
3868
5794
|
function useEffect(cb, depArray) {
|
|
3869
5795
|
withPointer((pointer) => {
|
|
3870
5796
|
const oldDeps = pointer.get();
|
|
@@ -3874,7 +5800,7 @@ function useEffect(cb, depArray) {
|
|
|
3874
5800
|
}
|
|
3875
5801
|
|
|
3876
5802
|
//#endregion
|
|
3877
|
-
//#region ../../node_modules
|
|
5803
|
+
//#region ../../node_modules/@inquirer/figures/dist/index.js
|
|
3878
5804
|
function isUnicodeSupported() {
|
|
3879
5805
|
if (node_process.default.platform !== "win32") return node_process.default.env["TERM"] !== "linux";
|
|
3880
5806
|
return Boolean(node_process.default.env["WT_SESSION"]) || Boolean(node_process.default.env["TERMINUS_SUBLIME"]) || node_process.default.env["ConEmuTask"] === "{cmd::Cmder}" || node_process.default.env["TERM_PROGRAM"] === "Terminus-Sublime" || node_process.default.env["TERM_PROGRAM"] === "vscode" || node_process.default.env["TERM"] === "xterm-256color" || node_process.default.env["TERM"] === "alacritty" || node_process.default.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
@@ -4160,7 +6086,7 @@ const figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
|
4160
6086
|
const replacements = Object.entries(specialMainSymbols);
|
|
4161
6087
|
|
|
4162
6088
|
//#endregion
|
|
4163
|
-
//#region ../../node_modules
|
|
6089
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/theme.js
|
|
4164
6090
|
const defaultTheme = {
|
|
4165
6091
|
prefix: {
|
|
4166
6092
|
idle: (0, node_util.styleText)("blue", "?"),
|
|
@@ -4193,7 +6119,7 @@ const defaultTheme = {
|
|
|
4193
6119
|
};
|
|
4194
6120
|
|
|
4195
6121
|
//#endregion
|
|
4196
|
-
//#region ../../node_modules
|
|
6122
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
4197
6123
|
function isPlainObject(value) {
|
|
4198
6124
|
if (typeof value !== "object" || value === null) return false;
|
|
4199
6125
|
let proto = value;
|
|
@@ -4213,7 +6139,7 @@ function makeTheme(...themes) {
|
|
|
4213
6139
|
}
|
|
4214
6140
|
|
|
4215
6141
|
//#endregion
|
|
4216
|
-
//#region ../../node_modules
|
|
6142
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
4217
6143
|
function usePrefix({ status = "idle", theme }) {
|
|
4218
6144
|
const [showLoader, setShowLoader] = useState(false);
|
|
4219
6145
|
const [tick, setTick] = useState(0);
|
|
@@ -4240,7 +6166,7 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
4240
6166
|
}
|
|
4241
6167
|
|
|
4242
6168
|
//#endregion
|
|
4243
|
-
//#region ../../node_modules
|
|
6169
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
4244
6170
|
function useMemo(fn, dependencies) {
|
|
4245
6171
|
return withPointer((pointer) => {
|
|
4246
6172
|
const prev = pointer.get();
|
|
@@ -4257,13 +6183,13 @@ function useMemo(fn, dependencies) {
|
|
|
4257
6183
|
}
|
|
4258
6184
|
|
|
4259
6185
|
//#endregion
|
|
4260
|
-
//#region ../../node_modules
|
|
6186
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
4261
6187
|
function useRef(val) {
|
|
4262
6188
|
return useState({ current: val })[0];
|
|
4263
6189
|
}
|
|
4264
6190
|
|
|
4265
6191
|
//#endregion
|
|
4266
|
-
//#region ../../node_modules
|
|
6192
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
4267
6193
|
function useKeypress(userHandler) {
|
|
4268
6194
|
const signal = useRef(userHandler);
|
|
4269
6195
|
signal.current = userHandler;
|
|
@@ -4282,7 +6208,7 @@ function useKeypress(userHandler) {
|
|
|
4282
6208
|
}
|
|
4283
6209
|
|
|
4284
6210
|
//#endregion
|
|
4285
|
-
//#region ../../node_modules
|
|
6211
|
+
//#region ../../node_modules/cli-width/index.js
|
|
4286
6212
|
var require_cli_width = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4287
6213
|
module.exports = cliWidth;
|
|
4288
6214
|
function normalizeOpts(options) {
|
|
@@ -4311,7 +6237,7 @@ var require_cli_width = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4311
6237
|
}));
|
|
4312
6238
|
|
|
4313
6239
|
//#endregion
|
|
4314
|
-
//#region ../../node_modules
|
|
6240
|
+
//#region ../../node_modules/fast-string-truncated-width/dist/utils.js
|
|
4315
6241
|
const getCodePointsLength = (() => {
|
|
4316
6242
|
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
4317
6243
|
return (input) => {
|
|
@@ -4329,7 +6255,7 @@ const isWideNotCJKTNotEmoji = (x) => {
|
|
|
4329
6255
|
};
|
|
4330
6256
|
|
|
4331
6257
|
//#endregion
|
|
4332
|
-
//#region ../../node_modules
|
|
6258
|
+
//#region ../../node_modules/fast-string-truncated-width/dist/index.js
|
|
4333
6259
|
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
4334
6260
|
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
4335
6261
|
const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
|
|
@@ -4420,7 +6346,7 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
4420
6346
|
};
|
|
4421
6347
|
|
|
4422
6348
|
//#endregion
|
|
4423
|
-
//#region ../../node_modules
|
|
6349
|
+
//#region ../../node_modules/fast-string-width/dist/index.js
|
|
4424
6350
|
const NO_TRUNCATION = {
|
|
4425
6351
|
limit: Infinity,
|
|
4426
6352
|
ellipsis: "",
|
|
@@ -4431,7 +6357,7 @@ const fastStringWidth = (input, options = {}) => {
|
|
|
4431
6357
|
};
|
|
4432
6358
|
|
|
4433
6359
|
//#endregion
|
|
4434
|
-
//#region ../../node_modules
|
|
6360
|
+
//#region ../../node_modules/fast-wrap-ansi/lib/main.js
|
|
4435
6361
|
const ESC$1 = "\x1B";
|
|
4436
6362
|
const CSI = "";
|
|
4437
6363
|
const END_CODE = 39;
|
|
@@ -4597,7 +6523,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
4597
6523
|
}
|
|
4598
6524
|
|
|
4599
6525
|
//#endregion
|
|
4600
|
-
//#region ../../node_modules
|
|
6526
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/utils.js
|
|
4601
6527
|
var import_cli_width = /* @__PURE__ */ __toESM(require_cli_width(), 1);
|
|
4602
6528
|
/**
|
|
4603
6529
|
* Force line returns at specific width. This function is ANSI code friendly and it'll
|
|
@@ -4624,7 +6550,7 @@ function readlineWidth() {
|
|
|
4624
6550
|
}
|
|
4625
6551
|
|
|
4626
6552
|
//#endregion
|
|
4627
|
-
//#region ../../node_modules
|
|
6553
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
4628
6554
|
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
4629
6555
|
const state = useRef({
|
|
4630
6556
|
lastPointer: active,
|
|
@@ -4708,7 +6634,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
|
4708
6634
|
}
|
|
4709
6635
|
|
|
4710
6636
|
//#endregion
|
|
4711
|
-
//#region ../../node_modules
|
|
6637
|
+
//#region ../../node_modules/mute-stream/lib/index.js
|
|
4712
6638
|
var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4713
6639
|
const Stream = require("stream");
|
|
4714
6640
|
var MuteStream = class extends Stream {
|
|
@@ -4805,7 +6731,208 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4805
6731
|
}));
|
|
4806
6732
|
|
|
4807
6733
|
//#endregion
|
|
4808
|
-
//#region ../../node_modules
|
|
6734
|
+
//#region ../../node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/signals.js
|
|
6735
|
+
/**
|
|
6736
|
+
* This is not the set of all possible signals.
|
|
6737
|
+
*
|
|
6738
|
+
* It IS, however, the set of all signals that trigger
|
|
6739
|
+
* an exit on either Linux or BSD systems. Linux is a
|
|
6740
|
+
* superset of the signal names supported on BSD, and
|
|
6741
|
+
* the unknown signals just fail to register, so we can
|
|
6742
|
+
* catch that easily enough.
|
|
6743
|
+
*
|
|
6744
|
+
* Windows signals are a different set, since there are
|
|
6745
|
+
* signals that terminate Windows processes, but don't
|
|
6746
|
+
* terminate (or don't even exist) on Posix systems.
|
|
6747
|
+
*
|
|
6748
|
+
* Don't bother with SIGKILL. It's uncatchable, which
|
|
6749
|
+
* means that we can't fire any callbacks anyway.
|
|
6750
|
+
*
|
|
6751
|
+
* If a user does happen to register a handler on a non-
|
|
6752
|
+
* fatal signal like SIGWINCH or something, and then
|
|
6753
|
+
* exit, it'll end up firing `process.emit('exit')`, so
|
|
6754
|
+
* the handler will be fired anyway.
|
|
6755
|
+
*
|
|
6756
|
+
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
6757
|
+
* artificially, inherently leave the process in a
|
|
6758
|
+
* state from which it is not safe to try and enter JS
|
|
6759
|
+
* listeners.
|
|
6760
|
+
*/
|
|
6761
|
+
const signals = [];
|
|
6762
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
6763
|
+
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
6764
|
+
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
6765
|
+
|
|
6766
|
+
//#endregion
|
|
6767
|
+
//#region ../../node_modules/@inquirer/core/node_modules/signal-exit/dist/mjs/index.js
|
|
6768
|
+
const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
|
|
6769
|
+
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
6770
|
+
const global$1 = globalThis;
|
|
6771
|
+
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
6772
|
+
var Emitter = class {
|
|
6773
|
+
emitted = {
|
|
6774
|
+
afterExit: false,
|
|
6775
|
+
exit: false
|
|
6776
|
+
};
|
|
6777
|
+
listeners = {
|
|
6778
|
+
afterExit: [],
|
|
6779
|
+
exit: []
|
|
6780
|
+
};
|
|
6781
|
+
count = 0;
|
|
6782
|
+
id = Math.random();
|
|
6783
|
+
constructor() {
|
|
6784
|
+
if (global$1[kExitEmitter]) return global$1[kExitEmitter];
|
|
6785
|
+
ObjectDefineProperty(global$1, kExitEmitter, {
|
|
6786
|
+
value: this,
|
|
6787
|
+
writable: false,
|
|
6788
|
+
enumerable: false,
|
|
6789
|
+
configurable: false
|
|
6790
|
+
});
|
|
6791
|
+
}
|
|
6792
|
+
on(ev, fn) {
|
|
6793
|
+
this.listeners[ev].push(fn);
|
|
6794
|
+
}
|
|
6795
|
+
removeListener(ev, fn) {
|
|
6796
|
+
const list = this.listeners[ev];
|
|
6797
|
+
const i = list.indexOf(fn);
|
|
6798
|
+
/* c8 ignore start */
|
|
6799
|
+
if (i === -1) return;
|
|
6800
|
+
/* c8 ignore stop */
|
|
6801
|
+
if (i === 0 && list.length === 1) list.length = 0;
|
|
6802
|
+
else list.splice(i, 1);
|
|
6803
|
+
}
|
|
6804
|
+
emit(ev, code, signal) {
|
|
6805
|
+
if (this.emitted[ev]) return false;
|
|
6806
|
+
this.emitted[ev] = true;
|
|
6807
|
+
let ret = false;
|
|
6808
|
+
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
6809
|
+
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
6810
|
+
return ret;
|
|
6811
|
+
}
|
|
6812
|
+
};
|
|
6813
|
+
var SignalExitBase = class {};
|
|
6814
|
+
const signalExitWrap = (handler) => {
|
|
6815
|
+
return {
|
|
6816
|
+
onExit(cb, opts) {
|
|
6817
|
+
return handler.onExit(cb, opts);
|
|
6818
|
+
},
|
|
6819
|
+
load() {
|
|
6820
|
+
return handler.load();
|
|
6821
|
+
},
|
|
6822
|
+
unload() {
|
|
6823
|
+
return handler.unload();
|
|
6824
|
+
}
|
|
6825
|
+
};
|
|
6826
|
+
};
|
|
6827
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
6828
|
+
onExit() {
|
|
6829
|
+
return () => {};
|
|
6830
|
+
}
|
|
6831
|
+
load() {}
|
|
6832
|
+
unload() {}
|
|
6833
|
+
};
|
|
6834
|
+
var SignalExit = class extends SignalExitBase {
|
|
6835
|
+
/* c8 ignore start */
|
|
6836
|
+
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
6837
|
+
/* c8 ignore stop */
|
|
6838
|
+
#emitter = new Emitter();
|
|
6839
|
+
#process;
|
|
6840
|
+
#originalProcessEmit;
|
|
6841
|
+
#originalProcessReallyExit;
|
|
6842
|
+
#sigListeners = {};
|
|
6843
|
+
#loaded = false;
|
|
6844
|
+
constructor(process) {
|
|
6845
|
+
super();
|
|
6846
|
+
this.#process = process;
|
|
6847
|
+
this.#sigListeners = {};
|
|
6848
|
+
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
6849
|
+
const listeners = this.#process.listeners(sig);
|
|
6850
|
+
let { count } = this.#emitter;
|
|
6851
|
+
/* c8 ignore start */
|
|
6852
|
+
const p = process;
|
|
6853
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
6854
|
+
/* c8 ignore stop */
|
|
6855
|
+
if (listeners.length === count) {
|
|
6856
|
+
this.unload();
|
|
6857
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
6858
|
+
/* c8 ignore start */
|
|
6859
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
6860
|
+
if (!ret) process.kill(process.pid, s);
|
|
6861
|
+
}
|
|
6862
|
+
};
|
|
6863
|
+
this.#originalProcessReallyExit = process.reallyExit;
|
|
6864
|
+
this.#originalProcessEmit = process.emit;
|
|
6865
|
+
}
|
|
6866
|
+
onExit(cb, opts) {
|
|
6867
|
+
/* c8 ignore start */
|
|
6868
|
+
if (!processOk(this.#process)) return () => {};
|
|
6869
|
+
/* c8 ignore stop */
|
|
6870
|
+
if (this.#loaded === false) this.load();
|
|
6871
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
6872
|
+
this.#emitter.on(ev, cb);
|
|
6873
|
+
return () => {
|
|
6874
|
+
this.#emitter.removeListener(ev, cb);
|
|
6875
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
6876
|
+
};
|
|
6877
|
+
}
|
|
6878
|
+
load() {
|
|
6879
|
+
if (this.#loaded) return;
|
|
6880
|
+
this.#loaded = true;
|
|
6881
|
+
this.#emitter.count += 1;
|
|
6882
|
+
for (const sig of signals) try {
|
|
6883
|
+
const fn = this.#sigListeners[sig];
|
|
6884
|
+
if (fn) this.#process.on(sig, fn);
|
|
6885
|
+
} catch (_) {}
|
|
6886
|
+
this.#process.emit = (ev, ...a) => {
|
|
6887
|
+
return this.#processEmit(ev, ...a);
|
|
6888
|
+
};
|
|
6889
|
+
this.#process.reallyExit = (code) => {
|
|
6890
|
+
return this.#processReallyExit(code);
|
|
6891
|
+
};
|
|
6892
|
+
}
|
|
6893
|
+
unload() {
|
|
6894
|
+
if (!this.#loaded) return;
|
|
6895
|
+
this.#loaded = false;
|
|
6896
|
+
signals.forEach((sig) => {
|
|
6897
|
+
const listener = this.#sigListeners[sig];
|
|
6898
|
+
/* c8 ignore start */
|
|
6899
|
+
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
6900
|
+
/* c8 ignore stop */
|
|
6901
|
+
try {
|
|
6902
|
+
this.#process.removeListener(sig, listener);
|
|
6903
|
+
} catch (_) {}
|
|
6904
|
+
/* c8 ignore stop */
|
|
6905
|
+
});
|
|
6906
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
6907
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
6908
|
+
this.#emitter.count -= 1;
|
|
6909
|
+
}
|
|
6910
|
+
#processReallyExit(code) {
|
|
6911
|
+
/* c8 ignore start */
|
|
6912
|
+
if (!processOk(this.#process)) return 0;
|
|
6913
|
+
this.#process.exitCode = code || 0;
|
|
6914
|
+
/* c8 ignore stop */
|
|
6915
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
6916
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
6917
|
+
}
|
|
6918
|
+
#processEmit(ev, ...args) {
|
|
6919
|
+
const og = this.#originalProcessEmit;
|
|
6920
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
6921
|
+
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
6922
|
+
/* c8 ignore start */
|
|
6923
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
6924
|
+
/* c8 ignore start */
|
|
6925
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
6926
|
+
/* c8 ignore stop */
|
|
6927
|
+
return ret;
|
|
6928
|
+
} else return og.call(this.#process, ev, ...args);
|
|
6929
|
+
}
|
|
6930
|
+
};
|
|
6931
|
+
const process$1 = globalThis.process;
|
|
6932
|
+
const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
6933
|
+
|
|
6934
|
+
//#endregion
|
|
6935
|
+
//#region ../../node_modules/@inquirer/ansi/dist/index.js
|
|
4809
6936
|
const ESC = "\x1B[";
|
|
4810
6937
|
/** Move cursor to first column */
|
|
4811
6938
|
const cursorLeft = ESC + "G";
|
|
@@ -4827,7 +6954,7 @@ const eraseLine = ESC + "2K";
|
|
|
4827
6954
|
const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
4828
6955
|
|
|
4829
6956
|
//#endregion
|
|
4830
|
-
//#region ../../node_modules
|
|
6957
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
4831
6958
|
const height = (content) => content.split("\n").length;
|
|
4832
6959
|
const lastLine = (content) => content.split("\n").pop() ?? "";
|
|
4833
6960
|
var ScreenManager = class {
|
|
@@ -4883,7 +7010,7 @@ var ScreenManager = class {
|
|
|
4883
7010
|
};
|
|
4884
7011
|
|
|
4885
7012
|
//#endregion
|
|
4886
|
-
//#region ../../node_modules
|
|
7013
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
4887
7014
|
var PromisePolyfill = class extends Promise {
|
|
4888
7015
|
static withResolver() {
|
|
4889
7016
|
let resolve;
|
|
@@ -4900,8 +7027,8 @@ var PromisePolyfill = class extends Promise {
|
|
|
4900
7027
|
};
|
|
4901
7028
|
|
|
4902
7029
|
//#endregion
|
|
4903
|
-
//#region ../../node_modules
|
|
4904
|
-
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
7030
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
7031
|
+
var import_lib$1 = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
4905
7032
|
const nativeSetImmediate = globalThis.setImmediate;
|
|
4906
7033
|
function getCallSites() {
|
|
4907
7034
|
const _prepareStackTrace = Error.prepareStackTrace;
|
|
@@ -4924,7 +7051,7 @@ function createPrompt(view) {
|
|
|
4924
7051
|
const prompt = (config, context = {}) => {
|
|
4925
7052
|
const { input = process.stdin, signal } = context;
|
|
4926
7053
|
const cleanups = /* @__PURE__ */ new Set();
|
|
4927
|
-
const output = new import_lib.default();
|
|
7054
|
+
const output = new import_lib$1.default();
|
|
4928
7055
|
output.pipe(context.output ?? process.stdout);
|
|
4929
7056
|
output.mute();
|
|
4930
7057
|
const rl = node_readline.createInterface({
|
|
@@ -4994,7 +7121,7 @@ function createPrompt(view) {
|
|
|
4994
7121
|
}
|
|
4995
7122
|
|
|
4996
7123
|
//#endregion
|
|
4997
|
-
//#region ../../node_modules
|
|
7124
|
+
//#region ../../node_modules/@inquirer/core/dist/lib/Separator.js
|
|
4998
7125
|
/**
|
|
4999
7126
|
* Separator object
|
|
5000
7127
|
* Used to space/separate choices group
|
|
@@ -5011,7 +7138,7 @@ var Separator = class {
|
|
|
5011
7138
|
};
|
|
5012
7139
|
|
|
5013
7140
|
//#endregion
|
|
5014
|
-
//#region ../../node_modules
|
|
7141
|
+
//#region ../../node_modules/@inquirer/checkbox/dist/index.js
|
|
5015
7142
|
const checkboxTheme = {
|
|
5016
7143
|
icon: {
|
|
5017
7144
|
checked: (0, node_util.styleText)("green", figures.circleFilled),
|
|
@@ -5192,7 +7319,7 @@ var dist_default$2 = createPrompt((config, done) => {
|
|
|
5192
7319
|
});
|
|
5193
7320
|
|
|
5194
7321
|
//#endregion
|
|
5195
|
-
//#region ../../node_modules
|
|
7322
|
+
//#region ../../node_modules/@inquirer/confirm/dist/index.js
|
|
5196
7323
|
function getBooleanValue(value, defaultValue) {
|
|
5197
7324
|
let answer = defaultValue !== false;
|
|
5198
7325
|
if (/^(y|yes)/i.test(value)) answer = true;
|
|
@@ -5233,7 +7360,7 @@ var dist_default$1 = createPrompt((config, done) => {
|
|
|
5233
7360
|
});
|
|
5234
7361
|
|
|
5235
7362
|
//#endregion
|
|
5236
|
-
//#region ../../node_modules
|
|
7363
|
+
//#region ../../node_modules/@inquirer/select/dist/index.js
|
|
5237
7364
|
const selectTheme = {
|
|
5238
7365
|
icon: { cursor: figures.pointer },
|
|
5239
7366
|
style: {
|
|
@@ -5389,1100 +7516,602 @@ var dist_default = createPrompt((config, done) => {
|
|
|
5389
7516
|
});
|
|
5390
7517
|
|
|
5391
7518
|
//#endregion
|
|
5392
|
-
//#region
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
5412
|
-
Object.defineProperty(o, "default", {
|
|
5413
|
-
enumerable: true,
|
|
5414
|
-
value: v
|
|
5415
|
-
});
|
|
5416
|
-
}) : function(o, v) {
|
|
5417
|
-
o["default"] = v;
|
|
5418
|
-
});
|
|
5419
|
-
var __importStar = exports && exports.__importStar || (function() {
|
|
5420
|
-
var ownKeys = function(o) {
|
|
5421
|
-
ownKeys = Object.getOwnPropertyNames || function(o) {
|
|
5422
|
-
var ar = [];
|
|
5423
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
5424
|
-
return ar;
|
|
5425
|
-
};
|
|
5426
|
-
return ownKeys(o);
|
|
5427
|
-
};
|
|
5428
|
-
return function(mod) {
|
|
5429
|
-
if (mod && mod.__esModule) return mod;
|
|
5430
|
-
var result = {};
|
|
5431
|
-
if (mod != null) {
|
|
5432
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
5433
|
-
}
|
|
5434
|
-
__setModuleDefault(result, mod);
|
|
5435
|
-
return result;
|
|
5436
|
-
};
|
|
5437
|
-
})();
|
|
5438
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5439
|
-
exports.expandTilde = expandTilde;
|
|
5440
|
-
exports.extractFrontmatterAndBody = extractFrontmatterAndBody;
|
|
5441
|
-
exports.processAttribution = processAttribution;
|
|
5442
|
-
exports.buildHookCommand = buildHookCommand;
|
|
5443
|
-
exports.readSettings = readSettings;
|
|
5444
|
-
exports.writeSettings = writeSettings;
|
|
5445
|
-
const path$4 = __importStar(require("node:path"));
|
|
5446
|
-
const os$4 = __importStar(require("node:os"));
|
|
5447
|
-
const fs = __importStar(require("node:fs"));
|
|
5448
|
-
/**
|
|
5449
|
-
* Expand ~ to home directory (shell doesn't expand in env vars passed to node)
|
|
5450
|
-
*/
|
|
5451
|
-
function expandTilde(filePath) {
|
|
5452
|
-
if (filePath && filePath.startsWith("~/")) return path$4.join(os$4.homedir(), filePath.slice(2));
|
|
5453
|
-
return filePath;
|
|
5454
|
-
}
|
|
5455
|
-
/**
|
|
5456
|
-
* Extract YAML frontmatter and body from markdown content.
|
|
5457
|
-
* Returns null frontmatter if content doesn't start with ---.
|
|
5458
|
-
*/
|
|
5459
|
-
function extractFrontmatterAndBody(content) {
|
|
5460
|
-
if (!content.startsWith("---")) return {
|
|
5461
|
-
frontmatter: null,
|
|
5462
|
-
body: content
|
|
5463
|
-
};
|
|
5464
|
-
const endIndex = content.indexOf("---", 3);
|
|
5465
|
-
if (endIndex === -1) return {
|
|
5466
|
-
frontmatter: null,
|
|
5467
|
-
body: content
|
|
5468
|
-
};
|
|
5469
|
-
return {
|
|
5470
|
-
frontmatter: content.substring(3, endIndex).trim(),
|
|
5471
|
-
body: content.substring(endIndex + 3)
|
|
5472
|
-
};
|
|
5473
|
-
}
|
|
5474
|
-
/**
|
|
5475
|
-
* Process Co-Authored-By lines based on attribution setting.
|
|
5476
|
-
* @param content - File content to process
|
|
5477
|
-
* @param attribution - null=remove, undefined=keep default, string=replace
|
|
5478
|
-
*/
|
|
5479
|
-
function processAttribution(content, attribution) {
|
|
5480
|
-
if (attribution === null) return content.replace(/(\r?\n){2}Co-Authored-By:.*$/gim, "");
|
|
5481
|
-
if (attribution === void 0) return content;
|
|
5482
|
-
const safeAttribution = attribution.replace(/\$/g, "$$$$");
|
|
5483
|
-
return content.replace(/Co-Authored-By:.*$/gim, `Co-Authored-By: ${safeAttribution}`);
|
|
5484
|
-
}
|
|
5485
|
-
/**
|
|
5486
|
-
* Build a hook command path using forward slashes for cross-platform compatibility.
|
|
5487
|
-
*/
|
|
5488
|
-
function buildHookCommand(configDir, hookName) {
|
|
5489
|
-
return `node "${configDir.replace(/\\/g, "/") + "/hooks/" + hookName}"`;
|
|
5490
|
-
}
|
|
5491
|
-
/**
|
|
5492
|
-
* Read and parse settings.json, returning empty object if it doesn't exist.
|
|
5493
|
-
*/
|
|
5494
|
-
function readSettings(settingsPath) {
|
|
5495
|
-
if (fs.existsSync(settingsPath)) try {
|
|
5496
|
-
return JSON.parse(fs.readFileSync(settingsPath, "utf8"));
|
|
5497
|
-
} catch {
|
|
5498
|
-
return {};
|
|
5499
|
-
}
|
|
5500
|
-
return {};
|
|
5501
|
-
}
|
|
5502
|
-
/**
|
|
5503
|
-
* Write settings.json with proper formatting.
|
|
5504
|
-
*/
|
|
5505
|
-
function writeSettings(settingsPath, settings) {
|
|
5506
|
-
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
5507
|
-
}
|
|
5508
|
-
}));
|
|
5509
|
-
|
|
5510
|
-
//#endregion
|
|
5511
|
-
//#region ../adapters/dist/claude.js
|
|
5512
|
-
var require_claude = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5513
|
-
/**
|
|
5514
|
-
* @maxsim/adapters — Claude Code adapter
|
|
5515
|
-
*
|
|
5516
|
-
* Ports the Claude-specific logic from bin/install.js:
|
|
5517
|
-
* - getGlobalDir('claude', ...) (lines 135-142)
|
|
5518
|
-
* - getDirName('claude') (line 49)
|
|
5519
|
-
* - getConfigDirFromHome('claude', isGlobal) (lines 58-72)
|
|
5520
|
-
* - copyWithPathReplacement for Claude (lines 839-892)
|
|
5521
|
-
*/
|
|
5522
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
5523
|
-
if (k2 === void 0) k2 = k;
|
|
5524
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5525
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
5526
|
-
enumerable: true,
|
|
5527
|
-
get: function() {
|
|
5528
|
-
return m[k];
|
|
5529
|
-
}
|
|
5530
|
-
};
|
|
5531
|
-
Object.defineProperty(o, k2, desc);
|
|
5532
|
-
}) : (function(o, m, k, k2) {
|
|
5533
|
-
if (k2 === void 0) k2 = k;
|
|
5534
|
-
o[k2] = m[k];
|
|
5535
|
-
}));
|
|
5536
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
5537
|
-
Object.defineProperty(o, "default", {
|
|
5538
|
-
enumerable: true,
|
|
5539
|
-
value: v
|
|
5540
|
-
});
|
|
5541
|
-
}) : function(o, v) {
|
|
5542
|
-
o["default"] = v;
|
|
5543
|
-
});
|
|
5544
|
-
var __importStar = exports && exports.__importStar || (function() {
|
|
5545
|
-
var ownKeys = function(o) {
|
|
5546
|
-
ownKeys = Object.getOwnPropertyNames || function(o) {
|
|
5547
|
-
var ar = [];
|
|
5548
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
5549
|
-
return ar;
|
|
5550
|
-
};
|
|
5551
|
-
return ownKeys(o);
|
|
5552
|
-
};
|
|
5553
|
-
return function(mod) {
|
|
5554
|
-
if (mod && mod.__esModule) return mod;
|
|
5555
|
-
var result = {};
|
|
5556
|
-
if (mod != null) {
|
|
5557
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
5558
|
-
}
|
|
5559
|
-
__setModuleDefault(result, mod);
|
|
5560
|
-
return result;
|
|
5561
|
-
};
|
|
5562
|
-
})();
|
|
5563
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5564
|
-
exports.claudeAdapter = void 0;
|
|
5565
|
-
exports.installClaude = installClaude;
|
|
5566
|
-
const path$3 = __importStar(require("node:path"));
|
|
5567
|
-
const os$3 = __importStar(require("node:os"));
|
|
5568
|
-
const base_js_1 = require_base();
|
|
5569
|
-
/**
|
|
5570
|
-
* Get the global config directory for Claude Code.
|
|
5571
|
-
* Priority: explicitDir > CLAUDE_CONFIG_DIR env > ~/.claude
|
|
5572
|
-
*/
|
|
5573
|
-
function getGlobalDir(explicitDir) {
|
|
5574
|
-
if (explicitDir) return (0, base_js_1.expandTilde)(explicitDir);
|
|
5575
|
-
if (process.env.CLAUDE_CONFIG_DIR) return (0, base_js_1.expandTilde)(process.env.CLAUDE_CONFIG_DIR);
|
|
5576
|
-
return path$3.join(os$3.homedir(), ".claude");
|
|
5577
|
-
}
|
|
5578
|
-
/**
|
|
5579
|
-
* Get the config directory path relative to home for hook templating.
|
|
5580
|
-
* Used for path.join(homeDir, '<configDir>', ...) replacement in hooks.
|
|
5581
|
-
*/
|
|
5582
|
-
function getConfigDirFromHome(isGlobal) {
|
|
5583
|
-
return "'.claude'";
|
|
5584
|
-
}
|
|
5585
|
-
/**
|
|
5586
|
-
* Transform markdown content for Claude Code installation.
|
|
5587
|
-
* For Claude, this is path replacement only — no frontmatter conversion needed.
|
|
5588
|
-
* Replaces ~/.claude/ and ./.claude/ references with the actual install path prefix.
|
|
5589
|
-
*/
|
|
5590
|
-
function transformContent(content, pathPrefix) {
|
|
5591
|
-
const globalClaudeRegex = /~\/\.claude\//g;
|
|
5592
|
-
const localClaudeRegex = /\.\/\.claude\//g;
|
|
5593
|
-
let result = content.replace(globalClaudeRegex, pathPrefix);
|
|
5594
|
-
result = result.replace(localClaudeRegex, `./.claude/`);
|
|
5595
|
-
return result;
|
|
5596
|
-
}
|
|
5597
|
-
/**
|
|
5598
|
-
* Claude Code adapter configuration.
|
|
5599
|
-
* Claude uses nested command structure (commands/maxsim/*.md).
|
|
5600
|
-
*/
|
|
5601
|
-
exports.claudeAdapter = {
|
|
5602
|
-
runtime: "claude",
|
|
5603
|
-
dirName: ".claude",
|
|
5604
|
-
getGlobalDir,
|
|
5605
|
-
getConfigDirFromHome,
|
|
5606
|
-
transformContent,
|
|
5607
|
-
commandStructure: "nested"
|
|
7519
|
+
//#region src/adapters/base.ts
|
|
7520
|
+
/**
|
|
7521
|
+
* @maxsim/adapters — Shared base utilities extracted from bin/install.js
|
|
7522
|
+
*/
|
|
7523
|
+
/**
|
|
7524
|
+
* Expand ~ to home directory (shell doesn't expand in env vars passed to node)
|
|
7525
|
+
*/
|
|
7526
|
+
function expandTilde(filePath) {
|
|
7527
|
+
if (filePath && filePath.startsWith("~/")) return node_path.join(node_os.homedir(), filePath.slice(2));
|
|
7528
|
+
return filePath;
|
|
7529
|
+
}
|
|
7530
|
+
/**
|
|
7531
|
+
* Extract YAML frontmatter and body from markdown content.
|
|
7532
|
+
* Returns null frontmatter if content doesn't start with ---.
|
|
7533
|
+
*/
|
|
7534
|
+
function extractFrontmatterAndBody(content) {
|
|
7535
|
+
if (!content.startsWith("---")) return {
|
|
7536
|
+
frontmatter: null,
|
|
7537
|
+
body: content
|
|
5608
7538
|
};
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
function installClaude() {
|
|
5614
|
-
throw new Error("installClaude() not yet implemented — see Phase 5");
|
|
5615
|
-
}
|
|
5616
|
-
}));
|
|
5617
|
-
|
|
5618
|
-
//#endregion
|
|
5619
|
-
//#region ../adapters/dist/transforms/tool-maps.js
|
|
5620
|
-
var require_tool_maps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5621
|
-
/**
|
|
5622
|
-
* @maxsim/adapters — Tool name mappings per runtime
|
|
5623
|
-
*
|
|
5624
|
-
* Ported from bin/install.js lines ~327-390
|
|
5625
|
-
*/
|
|
5626
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5627
|
-
exports.convertToolName = convertToolName;
|
|
5628
|
-
exports.convertGeminiToolName = convertGeminiToolName;
|
|
5629
|
-
/** Tool name mapping from Claude Code to OpenCode */
|
|
5630
|
-
const claudeToOpencodeTools = {
|
|
5631
|
-
AskUserQuestion: "question",
|
|
5632
|
-
SlashCommand: "skill",
|
|
5633
|
-
TodoWrite: "todowrite",
|
|
5634
|
-
WebFetch: "webfetch",
|
|
5635
|
-
WebSearch: "websearch"
|
|
7539
|
+
const endIndex = content.indexOf("---", 3);
|
|
7540
|
+
if (endIndex === -1) return {
|
|
7541
|
+
frontmatter: null,
|
|
7542
|
+
body: content
|
|
5636
7543
|
};
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
Write: "write_file",
|
|
5641
|
-
Edit: "replace",
|
|
5642
|
-
Bash: "run_shell_command",
|
|
5643
|
-
Glob: "glob",
|
|
5644
|
-
Grep: "search_file_content",
|
|
5645
|
-
WebSearch: "google_web_search",
|
|
5646
|
-
WebFetch: "web_fetch",
|
|
5647
|
-
TodoWrite: "write_todos",
|
|
5648
|
-
AskUserQuestion: "ask_user"
|
|
7544
|
+
return {
|
|
7545
|
+
frontmatter: content.substring(3, endIndex).trim(),
|
|
7546
|
+
body: content.substring(endIndex + 3)
|
|
5649
7547
|
};
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
//#region ../adapters/dist/transforms/content.js
|
|
5677
|
-
var require_content = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5678
|
-
/**
|
|
5679
|
-
* @maxsim/adapters — Content transformation utilities
|
|
5680
|
-
*
|
|
5681
|
-
* Ported from bin/install.js lines ~423-564
|
|
5682
|
-
*/
|
|
5683
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5684
|
-
exports.convertSlashCommandsToCodexSkillMentions = convertSlashCommandsToCodexSkillMentions;
|
|
5685
|
-
exports.convertClaudeToCodexMarkdown = convertClaudeToCodexMarkdown;
|
|
5686
|
-
exports.stripSubTags = stripSubTags;
|
|
5687
|
-
exports.convertClaudeToGeminiAgent = convertClaudeToGeminiAgent;
|
|
5688
|
-
exports.replacePathReferences = replacePathReferences;
|
|
5689
|
-
const tool_maps_js_1 = require_tool_maps();
|
|
5690
|
-
/**
|
|
5691
|
-
* Convert /maxsim:command-name to $maxsim-command-name for Codex skill mentions.
|
|
5692
|
-
* Ported from install.js line ~423
|
|
5693
|
-
*/
|
|
5694
|
-
function convertSlashCommandsToCodexSkillMentions(content) {
|
|
5695
|
-
let converted = content.replace(/\/maxsim:([a-z0-9-]+)/gi, (_, commandName) => {
|
|
5696
|
-
return `$maxsim-${String(commandName).toLowerCase()}`;
|
|
5697
|
-
});
|
|
5698
|
-
converted = converted.replace(/\/maxsim-help\b/g, "$maxsim-help");
|
|
5699
|
-
return converted;
|
|
5700
|
-
}
|
|
5701
|
-
/**
|
|
5702
|
-
* Convert Claude markdown to Codex markdown format.
|
|
5703
|
-
* Replaces slash commands and $ARGUMENTS placeholder.
|
|
5704
|
-
* Ported from install.js line ~431
|
|
5705
|
-
*/
|
|
5706
|
-
function convertClaudeToCodexMarkdown(content) {
|
|
5707
|
-
let converted = convertSlashCommandsToCodexSkillMentions(content);
|
|
5708
|
-
converted = converted.replace(/\$ARGUMENTS\b/g, "{{MAXSIM_ARGS}}");
|
|
5709
|
-
return converted;
|
|
5710
|
-
}
|
|
5711
|
-
/**
|
|
5712
|
-
* Strip HTML <sub> tags for Gemini CLI output.
|
|
5713
|
-
* Terminals don't support subscript -- converts <sub>text</sub> to italic *(text)*.
|
|
5714
|
-
* Ported from install.js line ~474
|
|
5715
|
-
*/
|
|
5716
|
-
function stripSubTags(content) {
|
|
5717
|
-
return content.replace(/<sub>(.*?)<\/sub>/g, "*($1)*");
|
|
5718
|
-
}
|
|
5719
|
-
/**
|
|
5720
|
-
* Convert Claude Code agent frontmatter to Gemini CLI format.
|
|
5721
|
-
* - tools: must be a YAML array (not comma-separated string)
|
|
5722
|
-
* - tool names: must use Gemini built-in names (read_file, not Read)
|
|
5723
|
-
* - color: must be removed (causes validation error)
|
|
5724
|
-
* - mcp__* tools: must be excluded (auto-discovered at runtime)
|
|
5725
|
-
* - ${VAR} patterns: escaped to $VAR for Gemini template compatibility
|
|
5726
|
-
*
|
|
5727
|
-
* Ported from install.js line ~487
|
|
5728
|
-
*/
|
|
5729
|
-
function convertClaudeToGeminiAgent(content) {
|
|
5730
|
-
if (!content.startsWith("---")) return content;
|
|
5731
|
-
const endIndex = content.indexOf("---", 3);
|
|
5732
|
-
if (endIndex === -1) return content;
|
|
5733
|
-
const frontmatter = content.substring(3, endIndex).trim();
|
|
5734
|
-
const body = content.substring(endIndex + 3);
|
|
5735
|
-
const lines = frontmatter.split("\n");
|
|
5736
|
-
const newLines = [];
|
|
5737
|
-
let inAllowedTools = false;
|
|
5738
|
-
const tools = [];
|
|
5739
|
-
for (const line of lines) {
|
|
5740
|
-
const trimmed = line.trim();
|
|
5741
|
-
if (trimmed.startsWith("allowed-tools:")) {
|
|
5742
|
-
inAllowedTools = true;
|
|
5743
|
-
continue;
|
|
5744
|
-
}
|
|
5745
|
-
if (trimmed.startsWith("tools:")) {
|
|
5746
|
-
const toolsValue = trimmed.substring(6).trim();
|
|
5747
|
-
if (toolsValue) {
|
|
5748
|
-
const parsed = toolsValue.split(",").map((t) => t.trim()).filter((t) => t);
|
|
5749
|
-
for (const t of parsed) {
|
|
5750
|
-
const mapped = (0, tool_maps_js_1.convertGeminiToolName)(t);
|
|
5751
|
-
if (mapped) tools.push(mapped);
|
|
5752
|
-
}
|
|
5753
|
-
} else inAllowedTools = true;
|
|
5754
|
-
continue;
|
|
5755
|
-
}
|
|
5756
|
-
if (trimmed.startsWith("color:")) continue;
|
|
5757
|
-
if (inAllowedTools) {
|
|
5758
|
-
if (trimmed.startsWith("- ")) {
|
|
5759
|
-
const mapped = (0, tool_maps_js_1.convertGeminiToolName)(trimmed.substring(2).trim());
|
|
5760
|
-
if (mapped) tools.push(mapped);
|
|
5761
|
-
continue;
|
|
5762
|
-
} else if (trimmed && !trimmed.startsWith("-")) inAllowedTools = false;
|
|
5763
|
-
}
|
|
5764
|
-
if (!inAllowedTools) newLines.push(line);
|
|
5765
|
-
}
|
|
5766
|
-
if (tools.length > 0) {
|
|
5767
|
-
newLines.push("tools:");
|
|
5768
|
-
for (const tool of tools) newLines.push(` - ${tool}`);
|
|
5769
|
-
}
|
|
5770
|
-
return `---\n${newLines.join("\n").trim()}\n---${stripSubTags(body.replace(/\$\{(\w+)\}/g, "$$$1"))}`;
|
|
5771
|
-
}
|
|
5772
|
-
/**
|
|
5773
|
-
* Replace path references in markdown content for a target runtime.
|
|
5774
|
-
* Replaces ~/.claude/ with pathPrefix and ./.claude/ with ./dirName/.
|
|
5775
|
-
*/
|
|
5776
|
-
function replacePathReferences(content, pathPrefix, dirName) {
|
|
5777
|
-
const globalClaudeRegex = /~\/\.claude\//g;
|
|
5778
|
-
const localClaudeRegex = /\.\/\.claude\//g;
|
|
5779
|
-
let result = content.replace(globalClaudeRegex, pathPrefix);
|
|
5780
|
-
result = result.replace(localClaudeRegex, `./${dirName}/`);
|
|
5781
|
-
return result;
|
|
7548
|
+
}
|
|
7549
|
+
/**
|
|
7550
|
+
* Process Co-Authored-By lines based on attribution setting.
|
|
7551
|
+
* @param content - File content to process
|
|
7552
|
+
* @param attribution - null=remove, undefined=keep default, string=replace
|
|
7553
|
+
*/
|
|
7554
|
+
function processAttribution(content, attribution) {
|
|
7555
|
+
if (attribution === null) return content.replace(/(\r?\n){2}Co-Authored-By:.*$/gim, "");
|
|
7556
|
+
if (attribution === void 0) return content;
|
|
7557
|
+
const safeAttribution = attribution.replace(/\$/g, "$$$$");
|
|
7558
|
+
return content.replace(/Co-Authored-By:.*$/gim, `Co-Authored-By: ${safeAttribution}`);
|
|
7559
|
+
}
|
|
7560
|
+
/**
|
|
7561
|
+
* Build a hook command path using forward slashes for cross-platform compatibility.
|
|
7562
|
+
*/
|
|
7563
|
+
function buildHookCommand(configDir, hookName) {
|
|
7564
|
+
return `node "${configDir.replace(/\\/g, "/") + "/hooks/" + hookName}"`;
|
|
7565
|
+
}
|
|
7566
|
+
/**
|
|
7567
|
+
* Read and parse settings.json, returning empty object if it doesn't exist.
|
|
7568
|
+
*/
|
|
7569
|
+
function readSettings(settingsPath) {
|
|
7570
|
+
if (node_fs.existsSync(settingsPath)) try {
|
|
7571
|
+
return JSON.parse(node_fs.readFileSync(settingsPath, "utf8"));
|
|
7572
|
+
} catch {
|
|
7573
|
+
return {};
|
|
5782
7574
|
}
|
|
5783
|
-
}
|
|
7575
|
+
return {};
|
|
7576
|
+
}
|
|
7577
|
+
/**
|
|
7578
|
+
* Write settings.json with proper formatting.
|
|
7579
|
+
*/
|
|
7580
|
+
function writeSettings(settingsPath, settings) {
|
|
7581
|
+
node_fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
7582
|
+
}
|
|
5784
7583
|
|
|
5785
7584
|
//#endregion
|
|
5786
|
-
//#region
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
/**
|
|
5837
|
-
* Convert Claude Code frontmatter to OpenCode format.
|
|
5838
|
-
* - Converts 'allowed-tools:' array to 'tools:' object with tool: true entries
|
|
5839
|
-
* - Converts color names to hex
|
|
5840
|
-
* - Removes name: field (opencode uses filename)
|
|
5841
|
-
* - Replaces tool name references in body content
|
|
5842
|
-
* - Replaces /maxsim: with /maxsim- (flat command structure)
|
|
5843
|
-
* - Replaces ~/.claude with ~/.config/opencode
|
|
5844
|
-
* - Replaces subagent_type="general-purpose" with "general"
|
|
5845
|
-
*
|
|
5846
|
-
* Ported from install.js line ~566
|
|
5847
|
-
*/
|
|
5848
|
-
function convertClaudeToOpencodeFrontmatter(content) {
|
|
5849
|
-
let convertedContent = content;
|
|
5850
|
-
convertedContent = convertedContent.replace(/\bAskUserQuestion\b/g, "question");
|
|
5851
|
-
convertedContent = convertedContent.replace(/\bSlashCommand\b/g, "skill");
|
|
5852
|
-
convertedContent = convertedContent.replace(/\bTodoWrite\b/g, "todowrite");
|
|
5853
|
-
convertedContent = convertedContent.replace(/\/maxsim:/g, "/maxsim-");
|
|
5854
|
-
convertedContent = convertedContent.replace(/~\/\.claude\b/g, "~/.config/opencode");
|
|
5855
|
-
convertedContent = convertedContent.replace(/subagent_type="general-purpose"/g, "subagent_type=\"general\"");
|
|
5856
|
-
if (!convertedContent.startsWith("---")) return convertedContent;
|
|
5857
|
-
const endIndex = convertedContent.indexOf("---", 3);
|
|
5858
|
-
if (endIndex === -1) return convertedContent;
|
|
5859
|
-
const frontmatter = convertedContent.substring(3, endIndex).trim();
|
|
5860
|
-
const body = convertedContent.substring(endIndex + 3);
|
|
5861
|
-
const lines = frontmatter.split("\n");
|
|
5862
|
-
const newLines = [];
|
|
5863
|
-
let inAllowedTools = false;
|
|
5864
|
-
const allowedTools = [];
|
|
5865
|
-
for (const line of lines) {
|
|
5866
|
-
const trimmed = line.trim();
|
|
5867
|
-
if (trimmed.startsWith("allowed-tools:")) {
|
|
5868
|
-
inAllowedTools = true;
|
|
5869
|
-
continue;
|
|
5870
|
-
}
|
|
5871
|
-
if (trimmed.startsWith("tools:")) {
|
|
5872
|
-
const toolsValue = trimmed.substring(6).trim();
|
|
5873
|
-
if (toolsValue) {
|
|
5874
|
-
const tools = toolsValue.split(",").map((t) => t.trim()).filter((t) => t);
|
|
5875
|
-
allowedTools.push(...tools);
|
|
5876
|
-
}
|
|
5877
|
-
continue;
|
|
5878
|
-
}
|
|
5879
|
-
if (trimmed.startsWith("name:")) continue;
|
|
5880
|
-
if (trimmed.startsWith("color:")) {
|
|
5881
|
-
const colorValue = trimmed.substring(6).trim().toLowerCase();
|
|
5882
|
-
const hexColor = exports.colorNameToHex[colorValue];
|
|
5883
|
-
if (hexColor) newLines.push(`color: "${hexColor}"`);
|
|
5884
|
-
else if (colorValue.startsWith("#")) {
|
|
5885
|
-
if (/^#[0-9a-f]{3}$|^#[0-9a-f]{6}$/i.test(colorValue)) newLines.push(line);
|
|
5886
|
-
}
|
|
5887
|
-
continue;
|
|
5888
|
-
}
|
|
5889
|
-
if (inAllowedTools) {
|
|
5890
|
-
if (trimmed.startsWith("- ")) {
|
|
5891
|
-
allowedTools.push(trimmed.substring(2).trim());
|
|
5892
|
-
continue;
|
|
5893
|
-
} else if (trimmed && !trimmed.startsWith("-")) inAllowedTools = false;
|
|
5894
|
-
}
|
|
5895
|
-
if (!inAllowedTools) newLines.push(line);
|
|
5896
|
-
}
|
|
5897
|
-
if (allowedTools.length > 0) {
|
|
5898
|
-
newLines.push("tools:");
|
|
5899
|
-
for (const tool of allowedTools) newLines.push(` ${(0, tool_maps_js_1.convertToolName)(tool)}: true`);
|
|
5900
|
-
}
|
|
5901
|
-
return `---\n${newLines.join("\n").trim()}\n---${body}`;
|
|
5902
|
-
}
|
|
5903
|
-
/**
|
|
5904
|
-
* Convert Claude Code markdown command to Gemini TOML format.
|
|
5905
|
-
* Ported from install.js line ~677
|
|
5906
|
-
*/
|
|
5907
|
-
function convertClaudeToGeminiToml(content) {
|
|
5908
|
-
if (!content.startsWith("---")) return `prompt = ${JSON.stringify(content)}\n`;
|
|
5909
|
-
const endIndex = content.indexOf("---", 3);
|
|
5910
|
-
if (endIndex === -1) return `prompt = ${JSON.stringify(content)}\n`;
|
|
5911
|
-
const frontmatter = content.substring(3, endIndex).trim();
|
|
5912
|
-
const body = content.substring(endIndex + 3).trim();
|
|
5913
|
-
let description = "";
|
|
5914
|
-
const lines = frontmatter.split("\n");
|
|
5915
|
-
for (const line of lines) {
|
|
5916
|
-
const trimmed = line.trim();
|
|
5917
|
-
if (trimmed.startsWith("description:")) {
|
|
5918
|
-
description = trimmed.substring(12).trim();
|
|
5919
|
-
break;
|
|
5920
|
-
}
|
|
5921
|
-
}
|
|
5922
|
-
let toml = "";
|
|
5923
|
-
if (description) toml += `description = ${JSON.stringify(description)}\n`;
|
|
5924
|
-
toml += `prompt = ${JSON.stringify(body)}\n`;
|
|
5925
|
-
return toml;
|
|
5926
|
-
}
|
|
5927
|
-
/**
|
|
5928
|
-
* Convert Claude command to Codex skill format with adapter header.
|
|
5929
|
-
* Ported from install.js line ~452
|
|
5930
|
-
*/
|
|
5931
|
-
function convertClaudeCommandToCodexSkill(content, skillName) {
|
|
5932
|
-
const converted = (0, content_js_1.convertClaudeToCodexMarkdown)(content);
|
|
5933
|
-
const { frontmatter, body } = (0, base_js_1.extractFrontmatterAndBody)(converted);
|
|
5934
|
-
let description = `Run MAXSIM workflow ${skillName}.`;
|
|
5935
|
-
if (frontmatter) {
|
|
5936
|
-
const maybeDescription = extractFrontmatterField(frontmatter, "description");
|
|
5937
|
-
if (maybeDescription) description = maybeDescription;
|
|
5938
|
-
}
|
|
5939
|
-
description = toSingleLine(description);
|
|
5940
|
-
const shortDescription = description.length > 180 ? `${description.slice(0, 177)}...` : description;
|
|
5941
|
-
const adapter = getCodexSkillAdapterHeader(skillName);
|
|
5942
|
-
return `---\nname: ${yamlQuote(skillName)}\ndescription: ${yamlQuote(description)}\nmetadata:\n short-description: ${yamlQuote(shortDescription)}\n---\n\n${adapter}\n\n${body.trimStart()}`;
|
|
5943
|
-
}
|
|
5944
|
-
/**
|
|
5945
|
-
* Generate the Codex skill adapter header block.
|
|
5946
|
-
* Ported from install.js line ~437
|
|
5947
|
-
*/
|
|
5948
|
-
function getCodexSkillAdapterHeader(skillName) {
|
|
5949
|
-
const invocation = `$${skillName}`;
|
|
5950
|
-
return `<codex_skill_adapter>
|
|
5951
|
-
Codex skills-first mode:
|
|
5952
|
-
- This skill is invoked by mentioning \`${invocation}\`.
|
|
5953
|
-
- Treat all user text after \`${invocation}\` as \`{{MAXSIM_ARGS}}\`.
|
|
5954
|
-
- If no arguments are present, treat \`{{MAXSIM_ARGS}}\` as empty.
|
|
5955
|
-
|
|
5956
|
-
Legacy orchestration compatibility:
|
|
5957
|
-
- Any \`Task(...)\` pattern in referenced workflow docs is legacy syntax.
|
|
5958
|
-
- Implement equivalent behavior with Codex collaboration tools: \`spawn_agent\`, \`wait\`, \`send_input\`, and \`close_agent\`.
|
|
5959
|
-
- Treat legacy \`subagent_type\` names as role hints in the spawned message.
|
|
5960
|
-
</codex_skill_adapter>`;
|
|
5961
|
-
}
|
|
5962
|
-
}));
|
|
7585
|
+
//#region src/adapters/claude.ts
|
|
7586
|
+
/**
|
|
7587
|
+
* @maxsim/adapters — Claude Code adapter
|
|
7588
|
+
*
|
|
7589
|
+
* Ports the Claude-specific logic from bin/install.js:
|
|
7590
|
+
* - getGlobalDir('claude', ...) (lines 135-142)
|
|
7591
|
+
* - getDirName('claude') (line 49)
|
|
7592
|
+
* - getConfigDirFromHome('claude', isGlobal) (lines 58-72)
|
|
7593
|
+
* - copyWithPathReplacement for Claude (lines 839-892)
|
|
7594
|
+
*/
|
|
7595
|
+
/**
|
|
7596
|
+
* Get the global config directory for Claude Code.
|
|
7597
|
+
* Priority: explicitDir > CLAUDE_CONFIG_DIR env > ~/.claude
|
|
7598
|
+
*/
|
|
7599
|
+
function getGlobalDir$4(explicitDir) {
|
|
7600
|
+
if (explicitDir) return expandTilde(explicitDir);
|
|
7601
|
+
if (process.env.CLAUDE_CONFIG_DIR) return expandTilde(process.env.CLAUDE_CONFIG_DIR);
|
|
7602
|
+
return node_path.join(node_os.homedir(), ".claude");
|
|
7603
|
+
}
|
|
7604
|
+
/**
|
|
7605
|
+
* Get the config directory path relative to home for hook templating.
|
|
7606
|
+
* Used for path.join(homeDir, '<configDir>', ...) replacement in hooks.
|
|
7607
|
+
*/
|
|
7608
|
+
function getConfigDirFromHome$4(isGlobal) {
|
|
7609
|
+
return "'.claude'";
|
|
7610
|
+
}
|
|
7611
|
+
/**
|
|
7612
|
+
* Transform markdown content for Claude Code installation.
|
|
7613
|
+
* For Claude, this is path replacement only — no frontmatter conversion needed.
|
|
7614
|
+
* Replaces ~/.claude/ and ./.claude/ references with the actual install path prefix.
|
|
7615
|
+
*/
|
|
7616
|
+
function transformContent$3(content, pathPrefix) {
|
|
7617
|
+
const globalClaudeRegex = /~\/\.claude\//g;
|
|
7618
|
+
const localClaudeRegex = /\.\/\.claude\//g;
|
|
7619
|
+
let result = content.replace(globalClaudeRegex, pathPrefix);
|
|
7620
|
+
result = result.replace(localClaudeRegex, `./.claude/`);
|
|
7621
|
+
return result;
|
|
7622
|
+
}
|
|
7623
|
+
/**
|
|
7624
|
+
* Claude Code adapter configuration.
|
|
7625
|
+
* Claude uses nested command structure (commands/maxsim/*.md).
|
|
7626
|
+
*/
|
|
7627
|
+
const claudeAdapter = {
|
|
7628
|
+
runtime: "claude",
|
|
7629
|
+
dirName: ".claude",
|
|
7630
|
+
getGlobalDir: getGlobalDir$4,
|
|
7631
|
+
getConfigDirFromHome: getConfigDirFromHome$4,
|
|
7632
|
+
transformContent: transformContent$3,
|
|
7633
|
+
commandStructure: "nested"
|
|
7634
|
+
};
|
|
5963
7635
|
|
|
5964
7636
|
//#endregion
|
|
5965
|
-
//#region
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
return result;
|
|
6016
|
-
};
|
|
6017
|
-
})();
|
|
6018
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6019
|
-
exports.opencodeAdapter = void 0;
|
|
6020
|
-
const path$2 = __importStar(require("node:path"));
|
|
6021
|
-
const os$2 = __importStar(require("node:os"));
|
|
6022
|
-
const base_js_1 = require_base();
|
|
6023
|
-
const frontmatter_js_1 = require_frontmatter();
|
|
6024
|
-
const content_js_1 = require_content();
|
|
6025
|
-
/**
|
|
6026
|
-
* Get the global config directory for OpenCode.
|
|
6027
|
-
* OpenCode follows XDG Base Directory spec and uses ~/.config/opencode/.
|
|
6028
|
-
* Priority: OPENCODE_CONFIG_DIR > dirname(OPENCODE_CONFIG) > XDG_CONFIG_HOME/opencode > ~/.config/opencode
|
|
6029
|
-
*/
|
|
6030
|
-
function getOpencodeGlobalDir() {
|
|
6031
|
-
if (process.env.OPENCODE_CONFIG_DIR) return (0, base_js_1.expandTilde)(process.env.OPENCODE_CONFIG_DIR);
|
|
6032
|
-
if (process.env.OPENCODE_CONFIG) return path$2.dirname((0, base_js_1.expandTilde)(process.env.OPENCODE_CONFIG));
|
|
6033
|
-
if (process.env.XDG_CONFIG_HOME) return path$2.join((0, base_js_1.expandTilde)(process.env.XDG_CONFIG_HOME), "opencode");
|
|
6034
|
-
return path$2.join(os$2.homedir(), ".config", "opencode");
|
|
6035
|
-
}
|
|
6036
|
-
/**
|
|
6037
|
-
* Get the global config directory for OpenCode.
|
|
6038
|
-
* Priority: explicitDir > env vars (via getOpencodeGlobalDir)
|
|
6039
|
-
*/
|
|
6040
|
-
function getGlobalDir(explicitDir) {
|
|
6041
|
-
if (explicitDir) return (0, base_js_1.expandTilde)(explicitDir);
|
|
6042
|
-
return getOpencodeGlobalDir();
|
|
6043
|
-
}
|
|
6044
|
-
/**
|
|
6045
|
-
* Get the config directory path relative to home for hook templating.
|
|
6046
|
-
*/
|
|
6047
|
-
function getConfigDirFromHome(isGlobal) {
|
|
6048
|
-
if (!isGlobal) return "'.opencode'";
|
|
6049
|
-
return "'.config', 'opencode'";
|
|
6050
|
-
}
|
|
6051
|
-
/**
|
|
6052
|
-
* Transform markdown content for OpenCode installation.
|
|
6053
|
-
* Applies frontmatter conversion and path replacement.
|
|
6054
|
-
*/
|
|
6055
|
-
function transformContent(content, pathPrefix) {
|
|
6056
|
-
let result = (0, content_js_1.replacePathReferences)(content, pathPrefix, ".opencode");
|
|
6057
|
-
result = result.replace(/~\/\.opencode\//g, pathPrefix);
|
|
6058
|
-
result = (0, frontmatter_js_1.convertClaudeToOpencodeFrontmatter)(result);
|
|
6059
|
-
return result;
|
|
6060
|
-
}
|
|
6061
|
-
/**
|
|
6062
|
-
* OpenCode adapter configuration.
|
|
6063
|
-
* OpenCode uses flat command structure (command/maxsim-*.md).
|
|
6064
|
-
*/
|
|
6065
|
-
exports.opencodeAdapter = {
|
|
6066
|
-
runtime: "opencode",
|
|
6067
|
-
dirName: ".opencode",
|
|
6068
|
-
getGlobalDir,
|
|
6069
|
-
getConfigDirFromHome,
|
|
6070
|
-
transformContent,
|
|
6071
|
-
commandStructure: "flat"
|
|
6072
|
-
};
|
|
6073
|
-
}));
|
|
7637
|
+
//#region src/adapters/transforms/tool-maps.ts
|
|
7638
|
+
/**
|
|
7639
|
+
* @maxsim/adapters — Tool name mappings per runtime
|
|
7640
|
+
*
|
|
7641
|
+
* Ported from bin/install.js lines ~327-390
|
|
7642
|
+
*/
|
|
7643
|
+
/** Tool name mapping from Claude Code to OpenCode */
|
|
7644
|
+
const claudeToOpencodeTools = {
|
|
7645
|
+
AskUserQuestion: "question",
|
|
7646
|
+
SlashCommand: "skill",
|
|
7647
|
+
TodoWrite: "todowrite",
|
|
7648
|
+
WebFetch: "webfetch",
|
|
7649
|
+
WebSearch: "websearch"
|
|
7650
|
+
};
|
|
7651
|
+
/** Tool name mapping from Claude Code to Gemini CLI */
|
|
7652
|
+
const claudeToGeminiTools = {
|
|
7653
|
+
Read: "read_file",
|
|
7654
|
+
Write: "write_file",
|
|
7655
|
+
Edit: "replace",
|
|
7656
|
+
Bash: "run_shell_command",
|
|
7657
|
+
Glob: "glob",
|
|
7658
|
+
Grep: "search_file_content",
|
|
7659
|
+
WebSearch: "google_web_search",
|
|
7660
|
+
WebFetch: "web_fetch",
|
|
7661
|
+
TodoWrite: "write_todos",
|
|
7662
|
+
AskUserQuestion: "ask_user"
|
|
7663
|
+
};
|
|
7664
|
+
/**
|
|
7665
|
+
* Convert a Claude Code tool name to OpenCode format.
|
|
7666
|
+
* - Applies special mappings (AskUserQuestion -> question, etc.)
|
|
7667
|
+
* - Converts to lowercase (except MCP tools which keep their format)
|
|
7668
|
+
*/
|
|
7669
|
+
function convertToolName(claudeTool) {
|
|
7670
|
+
if (claudeToOpencodeTools[claudeTool]) return claudeToOpencodeTools[claudeTool];
|
|
7671
|
+
if (claudeTool.startsWith("mcp__")) return claudeTool;
|
|
7672
|
+
return claudeTool.toLowerCase();
|
|
7673
|
+
}
|
|
7674
|
+
/**
|
|
7675
|
+
* Convert a Claude Code tool name to Gemini CLI format.
|
|
7676
|
+
* - Applies Claude->Gemini mapping (Read->read_file, Bash->run_shell_command, etc.)
|
|
7677
|
+
* - Filters out MCP tools (mcp__*) -- auto-discovered at runtime in Gemini
|
|
7678
|
+
* - Filters out Task -- agents are auto-registered as tools in Gemini
|
|
7679
|
+
* @returns Gemini tool name, or null if tool should be excluded
|
|
7680
|
+
*/
|
|
7681
|
+
function convertGeminiToolName(claudeTool) {
|
|
7682
|
+
if (claudeTool.startsWith("mcp__")) return null;
|
|
7683
|
+
if (claudeTool === "Task") return null;
|
|
7684
|
+
if (claudeToGeminiTools[claudeTool]) return claudeToGeminiTools[claudeTool];
|
|
7685
|
+
return claudeTool.toLowerCase();
|
|
7686
|
+
}
|
|
6074
7687
|
|
|
6075
7688
|
//#endregion
|
|
6076
|
-
//#region
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6090
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
6091
|
-
enumerable: true,
|
|
6092
|
-
get: function() {
|
|
6093
|
-
return m[k];
|
|
6094
|
-
}
|
|
6095
|
-
};
|
|
6096
|
-
Object.defineProperty(o, k2, desc);
|
|
6097
|
-
}) : (function(o, m, k, k2) {
|
|
6098
|
-
if (k2 === void 0) k2 = k;
|
|
6099
|
-
o[k2] = m[k];
|
|
6100
|
-
}));
|
|
6101
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
6102
|
-
Object.defineProperty(o, "default", {
|
|
6103
|
-
enumerable: true,
|
|
6104
|
-
value: v
|
|
6105
|
-
});
|
|
6106
|
-
}) : function(o, v) {
|
|
6107
|
-
o["default"] = v;
|
|
7689
|
+
//#region src/adapters/transforms/content.ts
|
|
7690
|
+
/**
|
|
7691
|
+
* @maxsim/adapters — Content transformation utilities
|
|
7692
|
+
*
|
|
7693
|
+
* Ported from bin/install.js lines ~423-564
|
|
7694
|
+
*/
|
|
7695
|
+
/**
|
|
7696
|
+
* Convert /maxsim:command-name to $maxsim-command-name for Codex skill mentions.
|
|
7697
|
+
* Ported from install.js line ~423
|
|
7698
|
+
*/
|
|
7699
|
+
function convertSlashCommandsToCodexSkillMentions(content) {
|
|
7700
|
+
let converted = content.replace(/\/maxsim:([a-z0-9-]+)/gi, (_, commandName) => {
|
|
7701
|
+
return `$maxsim-${String(commandName).toLowerCase()}`;
|
|
6108
7702
|
});
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
7703
|
+
converted = converted.replace(/\/maxsim-help\b/g, "$maxsim-help");
|
|
7704
|
+
return converted;
|
|
7705
|
+
}
|
|
7706
|
+
/**
|
|
7707
|
+
* Convert Claude markdown to Codex markdown format.
|
|
7708
|
+
* Replaces slash commands and $ARGUMENTS placeholder.
|
|
7709
|
+
* Ported from install.js line ~431
|
|
7710
|
+
*/
|
|
7711
|
+
function convertClaudeToCodexMarkdown(content) {
|
|
7712
|
+
let converted = convertSlashCommandsToCodexSkillMentions(content);
|
|
7713
|
+
converted = converted.replace(/\$ARGUMENTS\b/g, "{{MAXSIM_ARGS}}");
|
|
7714
|
+
return converted;
|
|
7715
|
+
}
|
|
7716
|
+
/**
|
|
7717
|
+
* Strip HTML <sub> tags for Gemini CLI output.
|
|
7718
|
+
* Terminals don't support subscript -- converts <sub>text</sub> to italic *(text)*.
|
|
7719
|
+
* Ported from install.js line ~474
|
|
7720
|
+
*/
|
|
7721
|
+
function stripSubTags(content) {
|
|
7722
|
+
return content.replace(/<sub>(.*?)<\/sub>/g, "*($1)*");
|
|
7723
|
+
}
|
|
7724
|
+
/**
|
|
7725
|
+
* Convert Claude Code agent frontmatter to Gemini CLI format.
|
|
7726
|
+
* - tools: must be a YAML array (not comma-separated string)
|
|
7727
|
+
* - tool names: must use Gemini built-in names (read_file, not Read)
|
|
7728
|
+
* - color: must be removed (causes validation error)
|
|
7729
|
+
* - mcp__* tools: must be excluded (auto-discovered at runtime)
|
|
7730
|
+
* - ${VAR} patterns: escaped to $VAR for Gemini template compatibility
|
|
7731
|
+
*
|
|
7732
|
+
* Ported from install.js line ~487
|
|
7733
|
+
*/
|
|
7734
|
+
function convertClaudeToGeminiAgent(content) {
|
|
7735
|
+
if (!content.startsWith("---")) return content;
|
|
7736
|
+
const endIndex = content.indexOf("---", 3);
|
|
7737
|
+
if (endIndex === -1) return content;
|
|
7738
|
+
const frontmatter = content.substring(3, endIndex).trim();
|
|
7739
|
+
const body = content.substring(endIndex + 3);
|
|
7740
|
+
const lines = frontmatter.split("\n");
|
|
7741
|
+
const newLines = [];
|
|
7742
|
+
let inAllowedTools = false;
|
|
7743
|
+
const tools = [];
|
|
7744
|
+
for (const line of lines) {
|
|
7745
|
+
const trimmed = line.trim();
|
|
7746
|
+
if (trimmed.startsWith("allowed-tools:")) {
|
|
7747
|
+
inAllowedTools = true;
|
|
7748
|
+
continue;
|
|
6138
7749
|
}
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
7750
|
+
if (trimmed.startsWith("tools:")) {
|
|
7751
|
+
const toolsValue = trimmed.substring(6).trim();
|
|
7752
|
+
if (toolsValue) {
|
|
7753
|
+
const parsed = toolsValue.split(",").map((t) => t.trim()).filter((t) => t);
|
|
7754
|
+
for (const t of parsed) {
|
|
7755
|
+
const mapped = convertGeminiToolName(t);
|
|
7756
|
+
if (mapped) tools.push(mapped);
|
|
7757
|
+
}
|
|
7758
|
+
} else inAllowedTools = true;
|
|
7759
|
+
continue;
|
|
6145
7760
|
}
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
7761
|
+
if (trimmed.startsWith("color:")) continue;
|
|
7762
|
+
if (inAllowedTools) {
|
|
7763
|
+
if (trimmed.startsWith("- ")) {
|
|
7764
|
+
const mapped = convertGeminiToolName(trimmed.substring(2).trim());
|
|
7765
|
+
if (mapped) tools.push(mapped);
|
|
7766
|
+
continue;
|
|
7767
|
+
} else if (trimmed && !trimmed.startsWith("-")) inAllowedTools = false;
|
|
6151
7768
|
}
|
|
6152
|
-
|
|
6153
|
-
/**
|
|
6154
|
-
* Get the global config directory for Gemini.
|
|
6155
|
-
* Priority: explicitDir > GEMINI_CONFIG_DIR env > ~/.gemini
|
|
6156
|
-
*/
|
|
6157
|
-
function getGlobalDir(explicitDir) {
|
|
6158
|
-
if (explicitDir) return (0, base_js_1.expandTilde)(explicitDir);
|
|
6159
|
-
if (process.env.GEMINI_CONFIG_DIR) return (0, base_js_1.expandTilde)(process.env.GEMINI_CONFIG_DIR);
|
|
6160
|
-
return path$1.join(os$1.homedir(), ".gemini");
|
|
6161
|
-
}
|
|
6162
|
-
/**
|
|
6163
|
-
* Get the config directory path relative to home for hook templating.
|
|
6164
|
-
*/
|
|
6165
|
-
function getConfigDirFromHome(_isGlobal) {
|
|
6166
|
-
return "'.gemini'";
|
|
7769
|
+
if (!inAllowedTools) newLines.push(line);
|
|
6167
7770
|
}
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
* stripSubTags, and path replacement.
|
|
6172
|
-
*/
|
|
6173
|
-
function transformContent(content, pathPrefix) {
|
|
6174
|
-
let result = (0, content_js_1.replacePathReferences)(content, pathPrefix, ".gemini");
|
|
6175
|
-
result = (0, content_js_1.stripSubTags)(result);
|
|
6176
|
-
result = (0, frontmatter_js_1.convertClaudeToGeminiToml)(result);
|
|
6177
|
-
return result;
|
|
7771
|
+
if (tools.length > 0) {
|
|
7772
|
+
newLines.push("tools:");
|
|
7773
|
+
for (const tool of tools) newLines.push(` - ${tool}`);
|
|
6178
7774
|
}
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
}
|
|
7775
|
+
return `---\n${newLines.join("\n").trim()}\n---${stripSubTags(body.replace(/\$\{(\w+)\}/g, "$$$1"))}`;
|
|
7776
|
+
}
|
|
7777
|
+
/**
|
|
7778
|
+
* Replace path references in markdown content for a target runtime.
|
|
7779
|
+
* Replaces ~/.claude/ with pathPrefix and ./.claude/ with ./dirName/.
|
|
7780
|
+
*/
|
|
7781
|
+
function replacePathReferences(content, pathPrefix, dirName) {
|
|
7782
|
+
const globalClaudeRegex = /~\/\.claude\//g;
|
|
7783
|
+
const localClaudeRegex = /\.\/\.claude\//g;
|
|
7784
|
+
let result = content.replace(globalClaudeRegex, pathPrefix);
|
|
7785
|
+
result = result.replace(localClaudeRegex, `./${dirName}/`);
|
|
7786
|
+
return result;
|
|
7787
|
+
}
|
|
6192
7788
|
|
|
6193
7789
|
//#endregion
|
|
6194
|
-
//#region
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
7790
|
+
//#region src/adapters/transforms/frontmatter.ts
|
|
7791
|
+
/**
|
|
7792
|
+
* @maxsim/adapters — Frontmatter conversion functions for opencode, gemini, codex
|
|
7793
|
+
*
|
|
7794
|
+
* Ported from bin/install.js lines ~308-711
|
|
7795
|
+
*/
|
|
7796
|
+
/** Color name to hex mapping for opencode compatibility */
|
|
7797
|
+
const colorNameToHex = {
|
|
7798
|
+
cyan: "#00FFFF",
|
|
7799
|
+
red: "#FF0000",
|
|
7800
|
+
green: "#00FF00",
|
|
7801
|
+
blue: "#0000FF",
|
|
7802
|
+
yellow: "#FFFF00",
|
|
7803
|
+
magenta: "#FF00FF",
|
|
7804
|
+
orange: "#FFA500",
|
|
7805
|
+
purple: "#800080",
|
|
7806
|
+
pink: "#FFC0CB",
|
|
7807
|
+
white: "#FFFFFF",
|
|
7808
|
+
black: "#000000",
|
|
7809
|
+
gray: "#808080",
|
|
7810
|
+
grey: "#808080"
|
|
7811
|
+
};
|
|
7812
|
+
/** Collapse whitespace to single line */
|
|
7813
|
+
function toSingleLine(value) {
|
|
7814
|
+
return value.replace(/\s+/g, " ").trim();
|
|
7815
|
+
}
|
|
7816
|
+
/** Quote a value for YAML using JSON.stringify */
|
|
7817
|
+
function yamlQuote(value) {
|
|
7818
|
+
return JSON.stringify(value);
|
|
7819
|
+
}
|
|
7820
|
+
/** Extract a single-line field value from YAML frontmatter text */
|
|
7821
|
+
function extractFrontmatterField(frontmatter, fieldName) {
|
|
7822
|
+
const regex = new RegExp(`^${fieldName}:\\s*(.+)$`, "m");
|
|
7823
|
+
const match = frontmatter.match(regex);
|
|
7824
|
+
if (!match) return null;
|
|
7825
|
+
return match[1].trim().replace(/^['"]|['"]$/g, "");
|
|
7826
|
+
}
|
|
7827
|
+
/**
|
|
7828
|
+
* Convert Claude Code frontmatter to OpenCode format.
|
|
7829
|
+
* - Converts 'allowed-tools:' array to 'tools:' object with tool: true entries
|
|
7830
|
+
* - Converts color names to hex
|
|
7831
|
+
* - Removes name: field (opencode uses filename)
|
|
7832
|
+
* - Replaces tool name references in body content
|
|
7833
|
+
* - Replaces /maxsim: with /maxsim- (flat command structure)
|
|
7834
|
+
* - Replaces ~/.claude with ~/.config/opencode
|
|
7835
|
+
* - Replaces subagent_type="general-purpose" with "general"
|
|
7836
|
+
*
|
|
7837
|
+
* Ported from install.js line ~566
|
|
7838
|
+
*/
|
|
7839
|
+
function convertClaudeToOpencodeFrontmatter(content) {
|
|
7840
|
+
let convertedContent = content;
|
|
7841
|
+
convertedContent = convertedContent.replace(/\bAskUserQuestion\b/g, "question");
|
|
7842
|
+
convertedContent = convertedContent.replace(/\bSlashCommand\b/g, "skill");
|
|
7843
|
+
convertedContent = convertedContent.replace(/\bTodoWrite\b/g, "todowrite");
|
|
7844
|
+
convertedContent = convertedContent.replace(/\/maxsim:/g, "/maxsim-");
|
|
7845
|
+
convertedContent = convertedContent.replace(/~\/\.claude\b/g, "~/.config/opencode");
|
|
7846
|
+
convertedContent = convertedContent.replace(/subagent_type="general-purpose"/g, "subagent_type=\"general\"");
|
|
7847
|
+
if (!convertedContent.startsWith("---")) return convertedContent;
|
|
7848
|
+
const endIndex = convertedContent.indexOf("---", 3);
|
|
7849
|
+
if (endIndex === -1) return convertedContent;
|
|
7850
|
+
const frontmatter = convertedContent.substring(3, endIndex).trim();
|
|
7851
|
+
const body = convertedContent.substring(endIndex + 3);
|
|
7852
|
+
const lines = frontmatter.split("\n");
|
|
7853
|
+
const newLines = [];
|
|
7854
|
+
let inAllowedTools = false;
|
|
7855
|
+
const allowedTools = [];
|
|
7856
|
+
for (const line of lines) {
|
|
7857
|
+
const trimmed = line.trim();
|
|
7858
|
+
if (trimmed.startsWith("allowed-tools:")) {
|
|
7859
|
+
inAllowedTools = true;
|
|
7860
|
+
continue;
|
|
7861
|
+
}
|
|
7862
|
+
if (trimmed.startsWith("tools:")) {
|
|
7863
|
+
const toolsValue = trimmed.substring(6).trim();
|
|
7864
|
+
if (toolsValue) {
|
|
7865
|
+
const tools = toolsValue.split(",").map((t) => t.trim()).filter((t) => t);
|
|
7866
|
+
allowedTools.push(...tools);
|
|
6212
7867
|
}
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
if (
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
value: v
|
|
6223
|
-
});
|
|
6224
|
-
}) : function(o, v) {
|
|
6225
|
-
o["default"] = v;
|
|
6226
|
-
});
|
|
6227
|
-
var __importStar = exports && exports.__importStar || (function() {
|
|
6228
|
-
var ownKeys = function(o) {
|
|
6229
|
-
ownKeys = Object.getOwnPropertyNames || function(o) {
|
|
6230
|
-
var ar = [];
|
|
6231
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
6232
|
-
return ar;
|
|
6233
|
-
};
|
|
6234
|
-
return ownKeys(o);
|
|
6235
|
-
};
|
|
6236
|
-
return function(mod) {
|
|
6237
|
-
if (mod && mod.__esModule) return mod;
|
|
6238
|
-
var result = {};
|
|
6239
|
-
if (mod != null) {
|
|
6240
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
7868
|
+
continue;
|
|
7869
|
+
}
|
|
7870
|
+
if (trimmed.startsWith("name:")) continue;
|
|
7871
|
+
if (trimmed.startsWith("color:")) {
|
|
7872
|
+
const colorValue = trimmed.substring(6).trim().toLowerCase();
|
|
7873
|
+
const hexColor = colorNameToHex[colorValue];
|
|
7874
|
+
if (hexColor) newLines.push(`color: "${hexColor}"`);
|
|
7875
|
+
else if (colorValue.startsWith("#")) {
|
|
7876
|
+
if (/^#[0-9a-f]{3}$|^#[0-9a-f]{6}$/i.test(colorValue)) newLines.push(line);
|
|
6241
7877
|
}
|
|
6242
|
-
|
|
6243
|
-
return result;
|
|
6244
|
-
};
|
|
6245
|
-
})();
|
|
6246
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6247
|
-
exports.convertClaudeToCodexMarkdown = exports.convertClaudeCommandToCodexSkill = exports.codexAdapter = void 0;
|
|
6248
|
-
const path = __importStar(require("node:path"));
|
|
6249
|
-
const os = __importStar(require("node:os"));
|
|
6250
|
-
const base_js_1 = require_base();
|
|
6251
|
-
const frontmatter_js_1 = require_frontmatter();
|
|
6252
|
-
Object.defineProperty(exports, "convertClaudeCommandToCodexSkill", {
|
|
6253
|
-
enumerable: true,
|
|
6254
|
-
get: function() {
|
|
6255
|
-
return frontmatter_js_1.convertClaudeCommandToCodexSkill;
|
|
7878
|
+
continue;
|
|
6256
7879
|
}
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
return content_js_1.convertClaudeToCodexMarkdown;
|
|
7880
|
+
if (inAllowedTools) {
|
|
7881
|
+
if (trimmed.startsWith("- ")) {
|
|
7882
|
+
allowedTools.push(trimmed.substring(2).trim());
|
|
7883
|
+
continue;
|
|
7884
|
+
} else if (trimmed && !trimmed.startsWith("-")) inAllowedTools = false;
|
|
6263
7885
|
}
|
|
6264
|
-
|
|
6265
|
-
/**
|
|
6266
|
-
* Get the global config directory for Codex.
|
|
6267
|
-
* Priority: explicitDir > CODEX_HOME env > ~/.codex
|
|
6268
|
-
*/
|
|
6269
|
-
function getGlobalDir(explicitDir) {
|
|
6270
|
-
if (explicitDir) return (0, base_js_1.expandTilde)(explicitDir);
|
|
6271
|
-
if (process.env.CODEX_HOME) return (0, base_js_1.expandTilde)(process.env.CODEX_HOME);
|
|
6272
|
-
return path.join(os.homedir(), ".codex");
|
|
6273
|
-
}
|
|
6274
|
-
/**
|
|
6275
|
-
* Get the config directory path relative to home for hook templating.
|
|
6276
|
-
*/
|
|
6277
|
-
function getConfigDirFromHome(_isGlobal) {
|
|
6278
|
-
return "'.codex'";
|
|
7886
|
+
if (!inAllowedTools) newLines.push(line);
|
|
6279
7887
|
}
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
*/
|
|
6284
|
-
function transformContent(content, pathPrefix) {
|
|
6285
|
-
let result = (0, content_js_1.replacePathReferences)(content, pathPrefix, ".codex");
|
|
6286
|
-
result = result.replace(/~\/\.codex\//g, pathPrefix);
|
|
6287
|
-
result = (0, frontmatter_js_1.convertClaudeCommandToCodexSkill)(result);
|
|
6288
|
-
return result;
|
|
7888
|
+
if (allowedTools.length > 0) {
|
|
7889
|
+
newLines.push("tools:");
|
|
7890
|
+
for (const tool of allowedTools) newLines.push(` ${convertToolName(tool)}: true`);
|
|
6289
7891
|
}
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
7892
|
+
return `---\n${newLines.join("\n").trim()}\n---${body}`;
|
|
7893
|
+
}
|
|
7894
|
+
/**
|
|
7895
|
+
* Convert Claude Code markdown command to Gemini TOML format.
|
|
7896
|
+
* Ported from install.js line ~677
|
|
7897
|
+
*/
|
|
7898
|
+
function convertClaudeToGeminiToml(content) {
|
|
7899
|
+
if (!content.startsWith("---")) return `prompt = ${JSON.stringify(content)}\n`;
|
|
7900
|
+
const endIndex = content.indexOf("---", 3);
|
|
7901
|
+
if (endIndex === -1) return `prompt = ${JSON.stringify(content)}\n`;
|
|
7902
|
+
const frontmatter = content.substring(3, endIndex).trim();
|
|
7903
|
+
const body = content.substring(endIndex + 3).trim();
|
|
7904
|
+
let description = "";
|
|
7905
|
+
const lines = frontmatter.split("\n");
|
|
7906
|
+
for (const line of lines) {
|
|
7907
|
+
const trimmed = line.trim();
|
|
7908
|
+
if (trimmed.startsWith("description:")) {
|
|
7909
|
+
description = trimmed.substring(12).trim();
|
|
7910
|
+
break;
|
|
7911
|
+
}
|
|
7912
|
+
}
|
|
7913
|
+
let toml = "";
|
|
7914
|
+
if (description) toml += `description = ${JSON.stringify(description)}\n`;
|
|
7915
|
+
toml += `prompt = ${JSON.stringify(body)}\n`;
|
|
7916
|
+
return toml;
|
|
7917
|
+
}
|
|
7918
|
+
/**
|
|
7919
|
+
* Convert Claude command to Codex skill format with adapter header.
|
|
7920
|
+
* Ported from install.js line ~452
|
|
7921
|
+
*/
|
|
7922
|
+
function convertClaudeCommandToCodexSkill(content, skillName) {
|
|
7923
|
+
const { frontmatter, body } = extractFrontmatterAndBody(convertClaudeToCodexMarkdown(content));
|
|
7924
|
+
let description = `Run MAXSIM workflow ${skillName}.`;
|
|
7925
|
+
if (frontmatter) {
|
|
7926
|
+
const maybeDescription = extractFrontmatterField(frontmatter, "description");
|
|
7927
|
+
if (maybeDescription) description = maybeDescription;
|
|
7928
|
+
}
|
|
7929
|
+
description = toSingleLine(description);
|
|
7930
|
+
const shortDescription = description.length > 180 ? `${description.slice(0, 177)}...` : description;
|
|
7931
|
+
const adapter = getCodexSkillAdapterHeader(skillName);
|
|
7932
|
+
return `---\nname: ${yamlQuote(skillName)}\ndescription: ${yamlQuote(description)}\nmetadata:\n short-description: ${yamlQuote(shortDescription)}\n---\n\n${adapter}\n\n${body.trimStart()}`;
|
|
7933
|
+
}
|
|
7934
|
+
/**
|
|
7935
|
+
* Generate the Codex skill adapter header block.
|
|
7936
|
+
* Ported from install.js line ~437
|
|
7937
|
+
*/
|
|
7938
|
+
function getCodexSkillAdapterHeader(skillName) {
|
|
7939
|
+
const invocation = `$${skillName}`;
|
|
7940
|
+
return `<codex_skill_adapter>
|
|
7941
|
+
Codex skills-first mode:
|
|
7942
|
+
- This skill is invoked by mentioning \`${invocation}\`.
|
|
7943
|
+
- Treat all user text after \`${invocation}\` as \`{{MAXSIM_ARGS}}\`.
|
|
7944
|
+
- If no arguments are present, treat \`{{MAXSIM_ARGS}}\` as empty.
|
|
7945
|
+
|
|
7946
|
+
Legacy orchestration compatibility:
|
|
7947
|
+
- Any \`Task(...)\` pattern in referenced workflow docs is legacy syntax.
|
|
7948
|
+
- Implement equivalent behavior with Codex collaboration tools: \`spawn_agent\`, \`wait\`, \`send_input\`, and \`close_agent\`.
|
|
7949
|
+
- Treat legacy \`subagent_type\` names as role hints in the spawned message.
|
|
7950
|
+
</codex_skill_adapter>`;
|
|
7951
|
+
}
|
|
6303
7952
|
|
|
6304
7953
|
//#endregion
|
|
6305
|
-
//#region
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
Object.defineProperty(exports, "stripSubTags", {
|
|
6464
|
-
enumerable: true,
|
|
6465
|
-
get: function() {
|
|
6466
|
-
return content_js_1.stripSubTags;
|
|
6467
|
-
}
|
|
6468
|
-
});
|
|
6469
|
-
Object.defineProperty(exports, "convertClaudeToGeminiAgent", {
|
|
6470
|
-
enumerable: true,
|
|
6471
|
-
get: function() {
|
|
6472
|
-
return content_js_1.convertClaudeToGeminiAgent;
|
|
6473
|
-
}
|
|
6474
|
-
});
|
|
6475
|
-
Object.defineProperty(exports, "replacePathReferences", {
|
|
6476
|
-
enumerable: true,
|
|
6477
|
-
get: function() {
|
|
6478
|
-
return content_js_1.replacePathReferences;
|
|
6479
|
-
}
|
|
6480
|
-
});
|
|
6481
|
-
}));
|
|
7954
|
+
//#region src/adapters/opencode.ts
|
|
7955
|
+
/**
|
|
7956
|
+
* @maxsim/adapters — OpenCode adapter
|
|
7957
|
+
*
|
|
7958
|
+
* Ports the OpenCode-specific logic from bin/install.js:
|
|
7959
|
+
* - getOpencodeGlobalDir() (lines 79-97)
|
|
7960
|
+
* - getGlobalDir('opencode', ...) (lines 104-111)
|
|
7961
|
+
* - getDirName('opencode') (line 46)
|
|
7962
|
+
* - getConfigDirFromHome('opencode', isGlobal) (lines 58-68)
|
|
7963
|
+
* - convertClaudeToOpencodeFrontmatter + path replacement
|
|
7964
|
+
*/
|
|
7965
|
+
/**
|
|
7966
|
+
* Get the global config directory for OpenCode.
|
|
7967
|
+
* OpenCode follows XDG Base Directory spec and uses ~/.config/opencode/.
|
|
7968
|
+
* Priority: OPENCODE_CONFIG_DIR > dirname(OPENCODE_CONFIG) > XDG_CONFIG_HOME/opencode > ~/.config/opencode
|
|
7969
|
+
*/
|
|
7970
|
+
function getOpencodeGlobalDir$1() {
|
|
7971
|
+
if (process.env.OPENCODE_CONFIG_DIR) return expandTilde(process.env.OPENCODE_CONFIG_DIR);
|
|
7972
|
+
if (process.env.OPENCODE_CONFIG) return node_path.dirname(expandTilde(process.env.OPENCODE_CONFIG));
|
|
7973
|
+
if (process.env.XDG_CONFIG_HOME) return node_path.join(expandTilde(process.env.XDG_CONFIG_HOME), "opencode");
|
|
7974
|
+
return node_path.join(node_os.homedir(), ".config", "opencode");
|
|
7975
|
+
}
|
|
7976
|
+
/**
|
|
7977
|
+
* Get the global config directory for OpenCode.
|
|
7978
|
+
* Priority: explicitDir > env vars (via getOpencodeGlobalDir)
|
|
7979
|
+
*/
|
|
7980
|
+
function getGlobalDir$3(explicitDir) {
|
|
7981
|
+
if (explicitDir) return expandTilde(explicitDir);
|
|
7982
|
+
return getOpencodeGlobalDir$1();
|
|
7983
|
+
}
|
|
7984
|
+
/**
|
|
7985
|
+
* Get the config directory path relative to home for hook templating.
|
|
7986
|
+
*/
|
|
7987
|
+
function getConfigDirFromHome$3(isGlobal) {
|
|
7988
|
+
if (!isGlobal) return "'.opencode'";
|
|
7989
|
+
return "'.config', 'opencode'";
|
|
7990
|
+
}
|
|
7991
|
+
/**
|
|
7992
|
+
* Transform markdown content for OpenCode installation.
|
|
7993
|
+
* Applies frontmatter conversion and path replacement.
|
|
7994
|
+
*/
|
|
7995
|
+
function transformContent$2(content, pathPrefix) {
|
|
7996
|
+
let result = replacePathReferences(content, pathPrefix, ".opencode");
|
|
7997
|
+
result = result.replace(/~\/\.opencode\//g, pathPrefix);
|
|
7998
|
+
result = convertClaudeToOpencodeFrontmatter(result);
|
|
7999
|
+
return result;
|
|
8000
|
+
}
|
|
8001
|
+
/**
|
|
8002
|
+
* OpenCode adapter configuration.
|
|
8003
|
+
* OpenCode uses flat command structure (command/maxsim-*.md).
|
|
8004
|
+
*/
|
|
8005
|
+
const opencodeAdapter = {
|
|
8006
|
+
runtime: "opencode",
|
|
8007
|
+
dirName: ".opencode",
|
|
8008
|
+
getGlobalDir: getGlobalDir$3,
|
|
8009
|
+
getConfigDirFromHome: getConfigDirFromHome$3,
|
|
8010
|
+
transformContent: transformContent$2,
|
|
8011
|
+
commandStructure: "flat"
|
|
8012
|
+
};
|
|
8013
|
+
|
|
8014
|
+
//#endregion
|
|
8015
|
+
//#region src/adapters/gemini.ts
|
|
8016
|
+
/**
|
|
8017
|
+
* @maxsim/adapters — Gemini adapter
|
|
8018
|
+
*
|
|
8019
|
+
* Ports the Gemini-specific logic from bin/install.js:
|
|
8020
|
+
* - getGlobalDir('gemini', ...) (lines 113-122)
|
|
8021
|
+
* - getDirName('gemini') (line 47)
|
|
8022
|
+
* - getConfigDirFromHome('gemini', isGlobal) (line 69)
|
|
8023
|
+
* - convertClaudeToGeminiToml + convertClaudeToGeminiAgent + stripSubTags
|
|
8024
|
+
*/
|
|
8025
|
+
/**
|
|
8026
|
+
* Get the global config directory for Gemini.
|
|
8027
|
+
* Priority: explicitDir > GEMINI_CONFIG_DIR env > ~/.gemini
|
|
8028
|
+
*/
|
|
8029
|
+
function getGlobalDir$2(explicitDir) {
|
|
8030
|
+
if (explicitDir) return expandTilde(explicitDir);
|
|
8031
|
+
if (process.env.GEMINI_CONFIG_DIR) return expandTilde(process.env.GEMINI_CONFIG_DIR);
|
|
8032
|
+
return node_path.join(node_os.homedir(), ".gemini");
|
|
8033
|
+
}
|
|
8034
|
+
/**
|
|
8035
|
+
* Get the config directory path relative to home for hook templating.
|
|
8036
|
+
*/
|
|
8037
|
+
function getConfigDirFromHome$2(_isGlobal) {
|
|
8038
|
+
return "'.gemini'";
|
|
8039
|
+
}
|
|
8040
|
+
/**
|
|
8041
|
+
* Transform markdown content for Gemini installation.
|
|
8042
|
+
* Applies TOML conversion for commands, agent conversion for agents,
|
|
8043
|
+
* stripSubTags, and path replacement.
|
|
8044
|
+
*/
|
|
8045
|
+
function transformContent$1(content, pathPrefix) {
|
|
8046
|
+
let result = replacePathReferences(content, pathPrefix, ".gemini");
|
|
8047
|
+
result = stripSubTags(result);
|
|
8048
|
+
result = convertClaudeToGeminiToml(result);
|
|
8049
|
+
return result;
|
|
8050
|
+
}
|
|
8051
|
+
/**
|
|
8052
|
+
* Gemini adapter configuration.
|
|
8053
|
+
* Gemini uses nested command structure (commands/maxsim/*.toml).
|
|
8054
|
+
*/
|
|
8055
|
+
const geminiAdapter = {
|
|
8056
|
+
runtime: "gemini",
|
|
8057
|
+
dirName: ".gemini",
|
|
8058
|
+
getGlobalDir: getGlobalDir$2,
|
|
8059
|
+
getConfigDirFromHome: getConfigDirFromHome$2,
|
|
8060
|
+
transformContent: transformContent$1,
|
|
8061
|
+
commandStructure: "nested"
|
|
8062
|
+
};
|
|
8063
|
+
|
|
8064
|
+
//#endregion
|
|
8065
|
+
//#region src/adapters/codex.ts
|
|
8066
|
+
/**
|
|
8067
|
+
* @maxsim/adapters — Codex adapter
|
|
8068
|
+
*
|
|
8069
|
+
* Ports the Codex-specific logic from bin/install.js:
|
|
8070
|
+
* - getGlobalDir('codex', ...) (lines 124-133)
|
|
8071
|
+
* - getDirName('codex') (line 48)
|
|
8072
|
+
* - getConfigDirFromHome('codex', isGlobal) (line 70)
|
|
8073
|
+
* - convertClaudeCommandToCodexSkill + convertClaudeToCodexMarkdown
|
|
8074
|
+
*/
|
|
8075
|
+
/**
|
|
8076
|
+
* Get the global config directory for Codex.
|
|
8077
|
+
* Priority: explicitDir > CODEX_HOME env > ~/.codex
|
|
8078
|
+
*/
|
|
8079
|
+
function getGlobalDir$1(explicitDir) {
|
|
8080
|
+
if (explicitDir) return expandTilde(explicitDir);
|
|
8081
|
+
if (process.env.CODEX_HOME) return expandTilde(process.env.CODEX_HOME);
|
|
8082
|
+
return node_path.join(node_os.homedir(), ".codex");
|
|
8083
|
+
}
|
|
8084
|
+
/**
|
|
8085
|
+
* Get the config directory path relative to home for hook templating.
|
|
8086
|
+
*/
|
|
8087
|
+
function getConfigDirFromHome$1(_isGlobal) {
|
|
8088
|
+
return "'.codex'";
|
|
8089
|
+
}
|
|
8090
|
+
/**
|
|
8091
|
+
* Transform markdown content for Codex installation.
|
|
8092
|
+
* Applies Codex markdown conversion and path replacement.
|
|
8093
|
+
*/
|
|
8094
|
+
function transformContent(content, pathPrefix) {
|
|
8095
|
+
let result = replacePathReferences(content, pathPrefix, ".codex");
|
|
8096
|
+
result = result.replace(/~\/\.codex\//g, pathPrefix);
|
|
8097
|
+
result = convertClaudeCommandToCodexSkill(result);
|
|
8098
|
+
return result;
|
|
8099
|
+
}
|
|
8100
|
+
/**
|
|
8101
|
+
* Codex adapter configuration.
|
|
8102
|
+
* Codex uses skill-based command structure (skills/maxsim-star/SKILL.md).
|
|
8103
|
+
*/
|
|
8104
|
+
const codexAdapter = {
|
|
8105
|
+
runtime: "codex",
|
|
8106
|
+
dirName: ".codex",
|
|
8107
|
+
getGlobalDir: getGlobalDir$1,
|
|
8108
|
+
getConfigDirFromHome: getConfigDirFromHome$1,
|
|
8109
|
+
transformContent,
|
|
8110
|
+
commandStructure: "skills"
|
|
8111
|
+
};
|
|
6482
8112
|
|
|
6483
8113
|
//#endregion
|
|
6484
8114
|
//#region src/install.ts
|
|
6485
|
-
var import_dist = require_dist();
|
|
6486
8115
|
const pkg = JSON.parse(node_fs.readFileSync(node_path.resolve(__dirname, "..", "package.json"), "utf-8"));
|
|
6487
8116
|
const templatesRoot = node_path.resolve(__dirname, "assets", "templates");
|
|
6488
8117
|
const args = process.argv.slice(2);
|
|
@@ -6513,10 +8142,10 @@ else {
|
|
|
6513
8142
|
* Adapter registry keyed by runtime name
|
|
6514
8143
|
*/
|
|
6515
8144
|
const adapterMap = {
|
|
6516
|
-
claude:
|
|
6517
|
-
opencode:
|
|
6518
|
-
gemini:
|
|
6519
|
-
codex:
|
|
8145
|
+
claude: claudeAdapter,
|
|
8146
|
+
opencode: opencodeAdapter,
|
|
8147
|
+
gemini: geminiAdapter,
|
|
8148
|
+
codex: codexAdapter
|
|
6520
8149
|
};
|
|
6521
8150
|
/**
|
|
6522
8151
|
* Get adapter for a runtime
|
|
@@ -6544,56 +8173,23 @@ function getDirName(runtime) {
|
|
|
6544
8173
|
}
|
|
6545
8174
|
/**
|
|
6546
8175
|
* Recursively remove a directory, handling Windows read-only file attributes.
|
|
6547
|
-
* fs
|
|
6548
|
-
* read-only files on Windows (EPERM). We chmod recursively first on EPERM.
|
|
8176
|
+
* fs-extra handles cross-platform edge cases (EPERM on Windows, symlinks, etc.)
|
|
6549
8177
|
*/
|
|
6550
8178
|
function safeRmDir(dirPath) {
|
|
6551
|
-
|
|
6552
|
-
try {
|
|
6553
|
-
node_fs.rmSync(dirPath, {
|
|
6554
|
-
recursive: true,
|
|
6555
|
-
force: true
|
|
6556
|
-
});
|
|
6557
|
-
} catch (e) {
|
|
6558
|
-
if (e.code === "EPERM" && process.platform === "win32") {
|
|
6559
|
-
const chmodRecursive = (p) => {
|
|
6560
|
-
try {
|
|
6561
|
-
node_fs.chmodSync(p, 438);
|
|
6562
|
-
} catch {}
|
|
6563
|
-
try {
|
|
6564
|
-
for (const entry of node_fs.readdirSync(p, { withFileTypes: true })) chmodRecursive(node_path.join(p, entry.name));
|
|
6565
|
-
} catch {}
|
|
6566
|
-
};
|
|
6567
|
-
chmodRecursive(dirPath);
|
|
6568
|
-
node_fs.rmSync(dirPath, {
|
|
6569
|
-
recursive: true,
|
|
6570
|
-
force: true
|
|
6571
|
-
});
|
|
6572
|
-
} else throw e;
|
|
6573
|
-
}
|
|
8179
|
+
import_lib.default.removeSync(dirPath);
|
|
6574
8180
|
}
|
|
6575
8181
|
/**
|
|
6576
|
-
* Recursively copy a directory (
|
|
8182
|
+
* Recursively copy a directory (dereferences symlinks)
|
|
6577
8183
|
*/
|
|
6578
8184
|
function copyDirRecursive(src, dest) {
|
|
6579
|
-
|
|
6580
|
-
for (const entry of node_fs.readdirSync(src, { withFileTypes: true })) {
|
|
6581
|
-
const srcPath = node_path.join(src, entry.name);
|
|
6582
|
-
const destPath = node_path.join(dest, entry.name);
|
|
6583
|
-
if (entry.isDirectory()) copyDirRecursive(srcPath, destPath);
|
|
6584
|
-
else if (entry.isSymbolicLink()) {
|
|
6585
|
-
const target = node_fs.realpathSync(srcPath);
|
|
6586
|
-
if (node_fs.statSync(target).isDirectory()) copyDirRecursive(target, destPath);
|
|
6587
|
-
else node_fs.copyFileSync(target, destPath);
|
|
6588
|
-
} else node_fs.copyFileSync(srcPath, destPath);
|
|
6589
|
-
}
|
|
8185
|
+
import_lib.default.copySync(src, dest, { dereference: true });
|
|
6590
8186
|
}
|
|
6591
8187
|
/**
|
|
6592
8188
|
* Get the global config directory for OpenCode (for JSONC permissions)
|
|
6593
8189
|
* OpenCode follows XDG Base Directory spec
|
|
6594
8190
|
*/
|
|
6595
8191
|
function getOpencodeGlobalDir() {
|
|
6596
|
-
return
|
|
8192
|
+
return opencodeAdapter.getGlobalDir();
|
|
6597
8193
|
}
|
|
6598
8194
|
const banner = "\n" + chalk.cyan(figlet.default.textSync("MAXSIM", { font: "ANSI Shadow" }).split("\n").map((line) => " " + line).join("\n")) + "\n\n MAXSIM " + chalk.dim("v" + pkg.version) + "\n A meta-prompting, context engineering and spec-driven\n development system for Claude Code, OpenCode, Gemini, and Codex.\n";
|
|
6599
8195
|
function parseConfigDirArg() {
|
|
@@ -6638,14 +8234,14 @@ const attributionCache = /* @__PURE__ */ new Map();
|
|
|
6638
8234
|
function getCommitAttribution(runtime) {
|
|
6639
8235
|
if (attributionCache.has(runtime)) return attributionCache.get(runtime);
|
|
6640
8236
|
let result;
|
|
6641
|
-
if (runtime === "opencode") result =
|
|
8237
|
+
if (runtime === "opencode") result = readSettings(node_path.join(getGlobalDir("opencode", null), "opencode.json")).disable_ai_attribution === true ? null : void 0;
|
|
6642
8238
|
else if (runtime === "gemini") {
|
|
6643
|
-
const attr =
|
|
8239
|
+
const attr = readSettings(node_path.join(getGlobalDir("gemini", explicitConfigDir), "settings.json")).attribution;
|
|
6644
8240
|
if (!attr || attr.commit === void 0) result = void 0;
|
|
6645
8241
|
else if (attr.commit === "") result = null;
|
|
6646
8242
|
else result = attr.commit;
|
|
6647
8243
|
} else if (runtime === "claude") {
|
|
6648
|
-
const attr =
|
|
8244
|
+
const attr = readSettings(node_path.join(getGlobalDir("claude", explicitConfigDir), "settings.json")).attribution;
|
|
6649
8245
|
if (!attr || attr.commit === void 0) result = void 0;
|
|
6650
8246
|
else if (attr.commit === "") result = null;
|
|
6651
8247
|
else result = attr.commit;
|
|
@@ -6677,8 +8273,8 @@ function copyFlattenedCommands(srcDir, destDir, prefix, pathPrefix, runtime) {
|
|
|
6677
8273
|
content = content.replace(globalClaudeRegex, pathPrefix);
|
|
6678
8274
|
content = content.replace(localClaudeRegex, `./${getDirName(runtime)}/`);
|
|
6679
8275
|
content = content.replace(opencodeDirRegex, pathPrefix);
|
|
6680
|
-
content =
|
|
6681
|
-
content =
|
|
8276
|
+
content = processAttribution(content, getCommitAttribution(runtime));
|
|
8277
|
+
content = convertClaudeToOpencodeFrontmatter(content);
|
|
6682
8278
|
node_fs.writeFileSync(destPath, content);
|
|
6683
8279
|
}
|
|
6684
8280
|
}
|
|
@@ -6711,8 +8307,8 @@ function copyCommandsAsCodexSkills(srcDir, skillsDir, prefix, pathPrefix, runtim
|
|
|
6711
8307
|
content = content.replace(globalClaudeRegex, pathPrefix);
|
|
6712
8308
|
content = content.replace(localClaudeRegex, `./${getDirName(runtime)}/`);
|
|
6713
8309
|
content = content.replace(codexDirRegex, pathPrefix);
|
|
6714
|
-
content =
|
|
6715
|
-
content =
|
|
8310
|
+
content = processAttribution(content, getCommitAttribution(runtime));
|
|
8311
|
+
content = convertClaudeCommandToCodexSkill(content, skillName);
|
|
6716
8312
|
node_fs.writeFileSync(node_path.join(skillDir, "SKILL.md"), content);
|
|
6717
8313
|
}
|
|
6718
8314
|
}
|
|
@@ -6739,18 +8335,18 @@ function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime, isCommand
|
|
|
6739
8335
|
const localClaudeRegex = /\.\/\.claude\//g;
|
|
6740
8336
|
content = content.replace(globalClaudeRegex, pathPrefix);
|
|
6741
8337
|
content = content.replace(localClaudeRegex, `./${dirName}/`);
|
|
6742
|
-
content =
|
|
8338
|
+
content = processAttribution(content, getCommitAttribution(runtime));
|
|
6743
8339
|
if (isOpencode) {
|
|
6744
|
-
content =
|
|
8340
|
+
content = convertClaudeToOpencodeFrontmatter(content);
|
|
6745
8341
|
node_fs.writeFileSync(destPath, content);
|
|
6746
8342
|
} else if (runtime === "gemini") if (isCommand) {
|
|
6747
|
-
content =
|
|
6748
|
-
const tomlContent =
|
|
8343
|
+
content = stripSubTags(content);
|
|
8344
|
+
const tomlContent = convertClaudeToGeminiToml(content);
|
|
6749
8345
|
const tomlPath = destPath.replace(/\.md$/, ".toml");
|
|
6750
8346
|
node_fs.writeFileSync(tomlPath, tomlContent);
|
|
6751
8347
|
} else node_fs.writeFileSync(destPath, content);
|
|
6752
8348
|
else if (isCodex) {
|
|
6753
|
-
content =
|
|
8349
|
+
content = convertClaudeToCodexMarkdown(content);
|
|
6754
8350
|
node_fs.writeFileSync(destPath, content);
|
|
6755
8351
|
} else node_fs.writeFileSync(destPath, content);
|
|
6756
8352
|
} else node_fs.copyFileSync(srcPath, destPath);
|
|
@@ -6903,7 +8499,7 @@ function uninstall(isGlobal, runtime = "claude") {
|
|
|
6903
8499
|
} catch {}
|
|
6904
8500
|
const settingsPath = node_path.join(targetDir, "settings.json");
|
|
6905
8501
|
if (node_fs.existsSync(settingsPath)) {
|
|
6906
|
-
const settings =
|
|
8502
|
+
const settings = readSettings(settingsPath);
|
|
6907
8503
|
let settingsModified = false;
|
|
6908
8504
|
const statusLine = settings.statusLine;
|
|
6909
8505
|
if (statusLine && statusLine.command && statusLine.command.includes("maxsim-statusline")) {
|
|
@@ -6938,7 +8534,7 @@ function uninstall(isGlobal, runtime = "claude") {
|
|
|
6938
8534
|
}
|
|
6939
8535
|
if (settingsHooks && Object.keys(settingsHooks).length === 0) delete settings.hooks;
|
|
6940
8536
|
if (settingsModified) {
|
|
6941
|
-
|
|
8537
|
+
writeSettings(settingsPath, settings);
|
|
6942
8538
|
removedCount++;
|
|
6943
8539
|
}
|
|
6944
8540
|
}
|
|
@@ -7284,10 +8880,10 @@ function install(isGlobal, runtime = "claude") {
|
|
|
7284
8880
|
for (const entry of agentEntries) if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
7285
8881
|
let content = node_fs.readFileSync(node_path.join(agentsSrc, entry.name), "utf8");
|
|
7286
8882
|
content = content.replace(/~\/\.claude\//g, pathPrefix);
|
|
7287
|
-
content =
|
|
7288
|
-
if (isOpencode) content =
|
|
7289
|
-
else if (isGemini) content =
|
|
7290
|
-
else if (isCodex) content =
|
|
8883
|
+
content = processAttribution(content, getCommitAttribution(runtime));
|
|
8884
|
+
if (isOpencode) content = convertClaudeToOpencodeFrontmatter(content);
|
|
8885
|
+
else if (isGemini) content = convertClaudeToGeminiAgent(content);
|
|
8886
|
+
else if (isCodex) content = convertClaudeToCodexMarkdown(content);
|
|
7291
8887
|
node_fs.writeFileSync(node_path.join(agentsDest, entry.name), content);
|
|
7292
8888
|
}
|
|
7293
8889
|
if (verifyInstalled(agentsDest, "agents")) spinner.succeed(chalk.green("✓") + " Installed agents");
|
|
@@ -7402,10 +8998,10 @@ function install(isGlobal, runtime = "claude") {
|
|
|
7402
8998
|
runtime
|
|
7403
8999
|
};
|
|
7404
9000
|
const settingsPath = node_path.join(targetDir, "settings.json");
|
|
7405
|
-
const settings = cleanupOrphanedHooks(
|
|
7406
|
-
const statuslineCommand = isGlobal ?
|
|
7407
|
-
const updateCheckCommand = isGlobal ?
|
|
7408
|
-
const contextMonitorCommand = isGlobal ?
|
|
9001
|
+
const settings = cleanupOrphanedHooks(readSettings(settingsPath));
|
|
9002
|
+
const statuslineCommand = isGlobal ? buildHookCommand(targetDir, "maxsim-statusline.js") : "node " + dirName + "/hooks/maxsim-statusline.js";
|
|
9003
|
+
const updateCheckCommand = isGlobal ? buildHookCommand(targetDir, "maxsim-check-update.js") : "node " + dirName + "/hooks/maxsim-check-update.js";
|
|
9004
|
+
const contextMonitorCommand = isGlobal ? buildHookCommand(targetDir, "maxsim-context-monitor.js") : "node " + dirName + "/hooks/maxsim-context-monitor.js";
|
|
7409
9005
|
if (isGemini) {
|
|
7410
9006
|
if (!settings.experimental) settings.experimental = {};
|
|
7411
9007
|
const experimental = settings.experimental;
|
|
@@ -7454,7 +9050,7 @@ function finishInstall(settingsPath, settings, statuslineCommand, shouldInstallS
|
|
|
7454
9050
|
};
|
|
7455
9051
|
console.log(` ${chalk.green("✓")} Configured statusline`);
|
|
7456
9052
|
}
|
|
7457
|
-
if (!isCodex && settingsPath && settings)
|
|
9053
|
+
if (!isCodex && settingsPath && settings) writeSettings(settingsPath, settings);
|
|
7458
9054
|
if (isOpencode) configureOpencodePermissions(isGlobal);
|
|
7459
9055
|
let program = "Claude Code";
|
|
7460
9056
|
if (runtime === "opencode") program = "OpenCode";
|