codeam-cli 2.15.0 → 2.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -30,1309 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  mod
31
31
  ));
32
32
 
33
- // ../../node_modules/node-pty/lib/utils.js
34
- var require_utils = __commonJS({
35
- "../../node_modules/node-pty/lib/utils.js"(exports2) {
36
- "use strict";
37
- Object.defineProperty(exports2, "__esModule", { value: true });
38
- exports2.loadNativeModule = exports2.assign = void 0;
39
- function assign(target) {
40
- var sources = [];
41
- for (var _i = 1; _i < arguments.length; _i++) {
42
- sources[_i - 1] = arguments[_i];
43
- }
44
- sources.forEach(function(source) {
45
- return Object.keys(source).forEach(function(key) {
46
- return target[key] = source[key];
47
- });
48
- });
49
- return target;
50
- }
51
- exports2.assign = assign;
52
- function loadNativeModule(name) {
53
- var dirs = ["build/Release", "build/Debug", "prebuilds/" + process.platform + "-" + process.arch];
54
- var relative3 = ["..", "."];
55
- var lastError;
56
- for (var _i = 0, dirs_1 = dirs; _i < dirs_1.length; _i++) {
57
- var d3 = dirs_1[_i];
58
- for (var _a = 0, relative_1 = relative3; _a < relative_1.length; _a++) {
59
- var r = relative_1[_a];
60
- var dir = r + "/" + d3 + "/";
61
- try {
62
- return { dir, module: require(dir + "/" + name + ".node") };
63
- } catch (e) {
64
- lastError = e;
65
- }
66
- }
67
- }
68
- throw new Error("Failed to load native module: " + name + ".node, checked: " + dirs.join(", ") + ": " + lastError);
69
- }
70
- exports2.loadNativeModule = loadNativeModule;
71
- }
72
- });
73
-
74
- // ../../node_modules/node-pty/lib/eventEmitter2.js
75
- var require_eventEmitter2 = __commonJS({
76
- "../../node_modules/node-pty/lib/eventEmitter2.js"(exports2) {
77
- "use strict";
78
- Object.defineProperty(exports2, "__esModule", { value: true });
79
- exports2.EventEmitter2 = void 0;
80
- var EventEmitter2 = (
81
- /** @class */
82
- (function() {
83
- function EventEmitter22() {
84
- this._listeners = [];
85
- }
86
- Object.defineProperty(EventEmitter22.prototype, "event", {
87
- get: function() {
88
- var _this = this;
89
- if (!this._event) {
90
- this._event = function(listener) {
91
- _this._listeners.push(listener);
92
- var disposable = {
93
- dispose: function() {
94
- for (var i = 0; i < _this._listeners.length; i++) {
95
- if (_this._listeners[i] === listener) {
96
- _this._listeners.splice(i, 1);
97
- return;
98
- }
99
- }
100
- }
101
- };
102
- return disposable;
103
- };
104
- }
105
- return this._event;
106
- },
107
- enumerable: false,
108
- configurable: true
109
- });
110
- EventEmitter22.prototype.fire = function(data) {
111
- var queue = [];
112
- for (var i = 0; i < this._listeners.length; i++) {
113
- queue.push(this._listeners[i]);
114
- }
115
- for (var i = 0; i < queue.length; i++) {
116
- queue[i].call(void 0, data);
117
- }
118
- };
119
- return EventEmitter22;
120
- })()
121
- );
122
- exports2.EventEmitter2 = EventEmitter2;
123
- }
124
- });
125
-
126
- // ../../node_modules/node-pty/lib/terminal.js
127
- var require_terminal = __commonJS({
128
- "../../node_modules/node-pty/lib/terminal.js"(exports2) {
129
- "use strict";
130
- Object.defineProperty(exports2, "__esModule", { value: true });
131
- exports2.Terminal = exports2.DEFAULT_ROWS = exports2.DEFAULT_COLS = void 0;
132
- var events_1 = require("events");
133
- var eventEmitter2_1 = require_eventEmitter2();
134
- exports2.DEFAULT_COLS = 80;
135
- exports2.DEFAULT_ROWS = 24;
136
- var FLOW_CONTROL_PAUSE = "";
137
- var FLOW_CONTROL_RESUME = "";
138
- var Terminal = (
139
- /** @class */
140
- (function() {
141
- function Terminal2(opt) {
142
- this._pid = 0;
143
- this._fd = 0;
144
- this._cols = 0;
145
- this._rows = 0;
146
- this._readable = false;
147
- this._writable = false;
148
- this._onData = new eventEmitter2_1.EventEmitter2();
149
- this._onExit = new eventEmitter2_1.EventEmitter2();
150
- this._internalee = new events_1.EventEmitter();
151
- this.handleFlowControl = !!(opt === null || opt === void 0 ? void 0 : opt.handleFlowControl);
152
- this._flowControlPause = (opt === null || opt === void 0 ? void 0 : opt.flowControlPause) || FLOW_CONTROL_PAUSE;
153
- this._flowControlResume = (opt === null || opt === void 0 ? void 0 : opt.flowControlResume) || FLOW_CONTROL_RESUME;
154
- if (!opt) {
155
- return;
156
- }
157
- this._checkType("name", opt.name ? opt.name : void 0, "string");
158
- this._checkType("cols", opt.cols ? opt.cols : void 0, "number");
159
- this._checkType("rows", opt.rows ? opt.rows : void 0, "number");
160
- this._checkType("cwd", opt.cwd ? opt.cwd : void 0, "string");
161
- this._checkType("env", opt.env ? opt.env : void 0, "object");
162
- this._checkType("uid", opt.uid ? opt.uid : void 0, "number");
163
- this._checkType("gid", opt.gid ? opt.gid : void 0, "number");
164
- this._checkType("encoding", opt.encoding ? opt.encoding : void 0, "string");
165
- }
166
- Object.defineProperty(Terminal2.prototype, "onData", {
167
- get: function() {
168
- return this._onData.event;
169
- },
170
- enumerable: false,
171
- configurable: true
172
- });
173
- Object.defineProperty(Terminal2.prototype, "onExit", {
174
- get: function() {
175
- return this._onExit.event;
176
- },
177
- enumerable: false,
178
- configurable: true
179
- });
180
- Object.defineProperty(Terminal2.prototype, "pid", {
181
- get: function() {
182
- return this._pid;
183
- },
184
- enumerable: false,
185
- configurable: true
186
- });
187
- Object.defineProperty(Terminal2.prototype, "cols", {
188
- get: function() {
189
- return this._cols;
190
- },
191
- enumerable: false,
192
- configurable: true
193
- });
194
- Object.defineProperty(Terminal2.prototype, "rows", {
195
- get: function() {
196
- return this._rows;
197
- },
198
- enumerable: false,
199
- configurable: true
200
- });
201
- Terminal2.prototype.write = function(data) {
202
- if (this.handleFlowControl) {
203
- if (data === this._flowControlPause) {
204
- this.pause();
205
- return;
206
- }
207
- if (data === this._flowControlResume) {
208
- this.resume();
209
- return;
210
- }
211
- }
212
- this._write(data);
213
- };
214
- Terminal2.prototype._forwardEvents = function() {
215
- var _this = this;
216
- this.on("data", function(e) {
217
- return _this._onData.fire(e);
218
- });
219
- this.on("exit", function(exitCode, signal) {
220
- return _this._onExit.fire({ exitCode, signal });
221
- });
222
- };
223
- Terminal2.prototype._checkType = function(name, value, type, allowArray) {
224
- if (allowArray === void 0) {
225
- allowArray = false;
226
- }
227
- if (value === void 0) {
228
- return;
229
- }
230
- if (allowArray) {
231
- if (Array.isArray(value)) {
232
- value.forEach(function(v, i) {
233
- if (typeof v !== type) {
234
- throw new Error(name + "[" + i + "] must be a " + type + " (not a " + typeof v[i] + ")");
235
- }
236
- });
237
- return;
238
- }
239
- }
240
- if (typeof value !== type) {
241
- throw new Error(name + " must be a " + type + " (not a " + typeof value + ")");
242
- }
243
- };
244
- Terminal2.prototype.end = function(data) {
245
- this._socket.end(data);
246
- };
247
- Terminal2.prototype.pipe = function(dest, options) {
248
- return this._socket.pipe(dest, options);
249
- };
250
- Terminal2.prototype.pause = function() {
251
- return this._socket.pause();
252
- };
253
- Terminal2.prototype.resume = function() {
254
- return this._socket.resume();
255
- };
256
- Terminal2.prototype.setEncoding = function(encoding) {
257
- if (this._socket._decoder) {
258
- delete this._socket._decoder;
259
- }
260
- if (encoding) {
261
- this._socket.setEncoding(encoding);
262
- }
263
- };
264
- Terminal2.prototype.addListener = function(eventName, listener) {
265
- this.on(eventName, listener);
266
- };
267
- Terminal2.prototype.on = function(eventName, listener) {
268
- if (eventName === "close") {
269
- this._internalee.on("close", listener);
270
- return;
271
- }
272
- this._socket.on(eventName, listener);
273
- };
274
- Terminal2.prototype.emit = function(eventName) {
275
- var args2 = [];
276
- for (var _i = 1; _i < arguments.length; _i++) {
277
- args2[_i - 1] = arguments[_i];
278
- }
279
- if (eventName === "close") {
280
- return this._internalee.emit.apply(this._internalee, arguments);
281
- }
282
- return this._socket.emit.apply(this._socket, arguments);
283
- };
284
- Terminal2.prototype.listeners = function(eventName) {
285
- return this._socket.listeners(eventName);
286
- };
287
- Terminal2.prototype.removeListener = function(eventName, listener) {
288
- this._socket.removeListener(eventName, listener);
289
- };
290
- Terminal2.prototype.removeAllListeners = function(eventName) {
291
- this._socket.removeAllListeners(eventName);
292
- };
293
- Terminal2.prototype.once = function(eventName, listener) {
294
- this._socket.once(eventName, listener);
295
- };
296
- Terminal2.prototype._close = function() {
297
- this._socket.readable = false;
298
- this.write = function() {
299
- };
300
- this.end = function() {
301
- };
302
- this._writable = false;
303
- this._readable = false;
304
- };
305
- Terminal2.prototype._parseEnv = function(env) {
306
- var keys = Object.keys(env || {});
307
- var pairs = [];
308
- for (var i = 0; i < keys.length; i++) {
309
- if (keys[i] === void 0) {
310
- continue;
311
- }
312
- pairs.push(keys[i] + "=" + env[keys[i]]);
313
- }
314
- return pairs;
315
- };
316
- return Terminal2;
317
- })()
318
- );
319
- exports2.Terminal = Terminal;
320
- }
321
- });
322
-
323
- // ../../node_modules/node-pty/lib/shared/conout.js
324
- var require_conout = __commonJS({
325
- "../../node_modules/node-pty/lib/shared/conout.js"(exports2) {
326
- "use strict";
327
- Object.defineProperty(exports2, "__esModule", { value: true });
328
- exports2.getWorkerPipeName = void 0;
329
- function getWorkerPipeName(conoutPipeName) {
330
- return conoutPipeName + "-worker";
331
- }
332
- exports2.getWorkerPipeName = getWorkerPipeName;
333
- }
334
- });
335
-
336
- // ../../node_modules/node-pty/lib/windowsConoutConnection.js
337
- var require_windowsConoutConnection = __commonJS({
338
- "../../node_modules/node-pty/lib/windowsConoutConnection.js"(exports2) {
339
- "use strict";
340
- var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P3, generator) {
341
- function adopt(value) {
342
- return value instanceof P3 ? value : new P3(function(resolve2) {
343
- resolve2(value);
344
- });
345
- }
346
- return new (P3 || (P3 = Promise))(function(resolve2, reject) {
347
- function fulfilled(value) {
348
- try {
349
- step(generator.next(value));
350
- } catch (e) {
351
- reject(e);
352
- }
353
- }
354
- function rejected(value) {
355
- try {
356
- step(generator["throw"](value));
357
- } catch (e) {
358
- reject(e);
359
- }
360
- }
361
- function step(result) {
362
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
363
- }
364
- step((generator = generator.apply(thisArg, _arguments || [])).next());
365
- });
366
- };
367
- var __generator = exports2 && exports2.__generator || function(thisArg, body) {
368
- var _2 = { label: 0, sent: function() {
369
- if (t2[0] & 1) throw t2[1];
370
- return t2[1];
371
- }, trys: [], ops: [] }, f, y2, t2, g;
372
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
373
- return this;
374
- }), g;
375
- function verb(n) {
376
- return function(v) {
377
- return step([n, v]);
378
- };
379
- }
380
- function step(op) {
381
- if (f) throw new TypeError("Generator is already executing.");
382
- while (_2) try {
383
- if (f = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2;
384
- if (y2 = 0, t2) op = [op[0] & 2, t2.value];
385
- switch (op[0]) {
386
- case 0:
387
- case 1:
388
- t2 = op;
389
- break;
390
- case 4:
391
- _2.label++;
392
- return { value: op[1], done: false };
393
- case 5:
394
- _2.label++;
395
- y2 = op[1];
396
- op = [0];
397
- continue;
398
- case 7:
399
- op = _2.ops.pop();
400
- _2.trys.pop();
401
- continue;
402
- default:
403
- if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
404
- _2 = 0;
405
- continue;
406
- }
407
- if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
408
- _2.label = op[1];
409
- break;
410
- }
411
- if (op[0] === 6 && _2.label < t2[1]) {
412
- _2.label = t2[1];
413
- t2 = op;
414
- break;
415
- }
416
- if (t2 && _2.label < t2[2]) {
417
- _2.label = t2[2];
418
- _2.ops.push(op);
419
- break;
420
- }
421
- if (t2[2]) _2.ops.pop();
422
- _2.trys.pop();
423
- continue;
424
- }
425
- op = body.call(thisArg, _2);
426
- } catch (e) {
427
- op = [6, e];
428
- y2 = 0;
429
- } finally {
430
- f = t2 = 0;
431
- }
432
- if (op[0] & 5) throw op[1];
433
- return { value: op[0] ? op[1] : void 0, done: true };
434
- }
435
- };
436
- Object.defineProperty(exports2, "__esModule", { value: true });
437
- exports2.ConoutConnection = void 0;
438
- var worker_threads_1 = require("worker_threads");
439
- var conout_1 = require_conout();
440
- var path_1 = require("path");
441
- var eventEmitter2_1 = require_eventEmitter2();
442
- var FLUSH_DATA_INTERVAL = 1e3;
443
- var ConoutConnection = (
444
- /** @class */
445
- (function() {
446
- function ConoutConnection2(_conoutPipeName, _useConptyDll) {
447
- var _this = this;
448
- this._conoutPipeName = _conoutPipeName;
449
- this._useConptyDll = _useConptyDll;
450
- this._isDisposed = false;
451
- this._onReady = new eventEmitter2_1.EventEmitter2();
452
- var workerData = {
453
- conoutPipeName: _conoutPipeName
454
- };
455
- var scriptPath = __dirname.replace("node_modules.asar", "node_modules.asar.unpacked");
456
- this._worker = new worker_threads_1.Worker(path_1.join(scriptPath, "worker/conoutSocketWorker.js"), { workerData });
457
- this._worker.on("message", function(message) {
458
- switch (message) {
459
- case 1:
460
- _this._onReady.fire();
461
- return;
462
- default:
463
- console.warn("Unexpected ConoutWorkerMessage", message);
464
- }
465
- });
466
- }
467
- Object.defineProperty(ConoutConnection2.prototype, "onReady", {
468
- get: function() {
469
- return this._onReady.event;
470
- },
471
- enumerable: false,
472
- configurable: true
473
- });
474
- ConoutConnection2.prototype.dispose = function() {
475
- if (!this._useConptyDll && this._isDisposed) {
476
- return;
477
- }
478
- this._isDisposed = true;
479
- this._drainDataAndClose();
480
- };
481
- ConoutConnection2.prototype.connectSocket = function(socket) {
482
- socket.connect(conout_1.getWorkerPipeName(this._conoutPipeName));
483
- };
484
- ConoutConnection2.prototype._drainDataAndClose = function() {
485
- var _this = this;
486
- if (this._drainTimeout) {
487
- clearTimeout(this._drainTimeout);
488
- }
489
- this._drainTimeout = setTimeout(function() {
490
- return _this._destroySocket();
491
- }, FLUSH_DATA_INTERVAL);
492
- };
493
- ConoutConnection2.prototype._destroySocket = function() {
494
- return __awaiter(this, void 0, void 0, function() {
495
- return __generator(this, function(_a) {
496
- switch (_a.label) {
497
- case 0:
498
- return [4, this._worker.terminate()];
499
- case 1:
500
- _a.sent();
501
- return [
502
- 2
503
- /*return*/
504
- ];
505
- }
506
- });
507
- });
508
- };
509
- return ConoutConnection2;
510
- })()
511
- );
512
- exports2.ConoutConnection = ConoutConnection;
513
- }
514
- });
515
-
516
- // ../../node_modules/node-pty/lib/windowsPtyAgent.js
517
- var require_windowsPtyAgent = __commonJS({
518
- "../../node_modules/node-pty/lib/windowsPtyAgent.js"(exports2) {
519
- "use strict";
520
- Object.defineProperty(exports2, "__esModule", { value: true });
521
- exports2.argsToCommandLine = exports2.WindowsPtyAgent = void 0;
522
- var fs17 = require("fs");
523
- var os16 = require("os");
524
- var path23 = require("path");
525
- var child_process_1 = require("child_process");
526
- var net_1 = require("net");
527
- var windowsConoutConnection_1 = require_windowsConoutConnection();
528
- var utils_1 = require_utils();
529
- var conptyNative;
530
- var winptyNative;
531
- var FLUSH_DATA_INTERVAL = 1e3;
532
- var WindowsPtyAgent = (
533
- /** @class */
534
- (function() {
535
- function WindowsPtyAgent2(file, args2, env, cwd, cols, rows, debug, _useConpty, _useConptyDll, conptyInheritCursor) {
536
- var _this = this;
537
- if (_useConptyDll === void 0) {
538
- _useConptyDll = false;
539
- }
540
- if (conptyInheritCursor === void 0) {
541
- conptyInheritCursor = false;
542
- }
543
- this._useConpty = _useConpty;
544
- this._useConptyDll = _useConptyDll;
545
- this._pid = 0;
546
- this._innerPid = 0;
547
- if (this._useConpty === void 0 || this._useConpty === true) {
548
- this._useConpty = this._getWindowsBuildNumber() >= 18309;
549
- }
550
- if (this._useConpty) {
551
- if (!conptyNative) {
552
- conptyNative = utils_1.loadNativeModule("conpty").module;
553
- }
554
- } else {
555
- if (!winptyNative) {
556
- winptyNative = utils_1.loadNativeModule("pty").module;
557
- }
558
- }
559
- this._ptyNative = this._useConpty ? conptyNative : winptyNative;
560
- cwd = path23.resolve(cwd);
561
- var commandLine = argsToCommandLine(file, args2);
562
- var term;
563
- if (this._useConpty) {
564
- term = this._ptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor, this._useConptyDll);
565
- } else {
566
- term = this._ptyNative.startProcess(file, commandLine, env, cwd, cols, rows, debug);
567
- this._pid = term.pid;
568
- this._innerPid = term.innerPid;
569
- }
570
- this._fd = term.fd;
571
- this._pty = term.pty;
572
- this._outSocket = new net_1.Socket();
573
- this._outSocket.setEncoding("utf8");
574
- this._conoutSocketWorker = new windowsConoutConnection_1.ConoutConnection(term.conout, this._useConptyDll);
575
- this._conoutSocketWorker.onReady(function() {
576
- _this._conoutSocketWorker.connectSocket(_this._outSocket);
577
- });
578
- this._outSocket.on("connect", function() {
579
- _this._outSocket.emit("ready_datapipe");
580
- });
581
- var inSocketFD = fs17.openSync(term.conin, "w");
582
- this._inSocket = new net_1.Socket({
583
- fd: inSocketFD,
584
- readable: false,
585
- writable: true
586
- });
587
- this._inSocket.setEncoding("utf8");
588
- if (this._useConpty) {
589
- var connect = this._ptyNative.connect(this._pty, commandLine, cwd, env, this._useConptyDll, function(c2) {
590
- return _this._$onProcessExit(c2);
591
- });
592
- this._innerPid = connect.pid;
593
- }
594
- }
595
- Object.defineProperty(WindowsPtyAgent2.prototype, "inSocket", {
596
- get: function() {
597
- return this._inSocket;
598
- },
599
- enumerable: false,
600
- configurable: true
601
- });
602
- Object.defineProperty(WindowsPtyAgent2.prototype, "outSocket", {
603
- get: function() {
604
- return this._outSocket;
605
- },
606
- enumerable: false,
607
- configurable: true
608
- });
609
- Object.defineProperty(WindowsPtyAgent2.prototype, "fd", {
610
- get: function() {
611
- return this._fd;
612
- },
613
- enumerable: false,
614
- configurable: true
615
- });
616
- Object.defineProperty(WindowsPtyAgent2.prototype, "innerPid", {
617
- get: function() {
618
- return this._innerPid;
619
- },
620
- enumerable: false,
621
- configurable: true
622
- });
623
- Object.defineProperty(WindowsPtyAgent2.prototype, "pty", {
624
- get: function() {
625
- return this._pty;
626
- },
627
- enumerable: false,
628
- configurable: true
629
- });
630
- WindowsPtyAgent2.prototype.resize = function(cols, rows) {
631
- if (this._useConpty) {
632
- if (this._exitCode !== void 0) {
633
- throw new Error("Cannot resize a pty that has already exited");
634
- }
635
- this._ptyNative.resize(this._pty, cols, rows, this._useConptyDll);
636
- return;
637
- }
638
- this._ptyNative.resize(this._pid, cols, rows);
639
- };
640
- WindowsPtyAgent2.prototype.clear = function() {
641
- if (this._useConpty) {
642
- this._ptyNative.clear(this._pty, this._useConptyDll);
643
- }
644
- };
645
- WindowsPtyAgent2.prototype.kill = function() {
646
- var _this = this;
647
- if (this._useConpty) {
648
- if (!this._useConptyDll) {
649
- this._inSocket.readable = false;
650
- this._outSocket.readable = false;
651
- this._getConsoleProcessList().then(function(consoleProcessList) {
652
- consoleProcessList.forEach(function(pid) {
653
- try {
654
- process.kill(pid);
655
- } catch (e) {
656
- }
657
- });
658
- });
659
- this._ptyNative.kill(this._pty, this._useConptyDll);
660
- this._conoutSocketWorker.dispose();
661
- } else {
662
- this._inSocket.destroy();
663
- this._ptyNative.kill(this._pty, this._useConptyDll);
664
- this._outSocket.on("data", function() {
665
- _this._conoutSocketWorker.dispose();
666
- });
667
- }
668
- } else {
669
- var processList = this._ptyNative.getProcessList(this._pid);
670
- this._ptyNative.kill(this._pid, this._innerPid);
671
- processList.forEach(function(pid) {
672
- try {
673
- process.kill(pid);
674
- } catch (e) {
675
- }
676
- });
677
- }
678
- };
679
- WindowsPtyAgent2.prototype._getConsoleProcessList = function() {
680
- var _this = this;
681
- return new Promise(function(resolve2) {
682
- var agent = child_process_1.fork(path23.join(__dirname, "conpty_console_list_agent"), [_this._innerPid.toString()]);
683
- agent.on("message", function(message) {
684
- clearTimeout(timeout);
685
- resolve2(message.consoleProcessList);
686
- });
687
- var timeout = setTimeout(function() {
688
- agent.kill();
689
- resolve2([_this._innerPid]);
690
- }, 5e3);
691
- });
692
- };
693
- Object.defineProperty(WindowsPtyAgent2.prototype, "exitCode", {
694
- get: function() {
695
- if (this._useConpty) {
696
- return this._exitCode;
697
- }
698
- var winptyExitCode = this._ptyNative.getExitCode(this._innerPid);
699
- return winptyExitCode === -1 ? void 0 : winptyExitCode;
700
- },
701
- enumerable: false,
702
- configurable: true
703
- });
704
- WindowsPtyAgent2.prototype._getWindowsBuildNumber = function() {
705
- var osVersion = /(\d+)\.(\d+)\.(\d+)/g.exec(os16.release());
706
- var buildNumber = 0;
707
- if (osVersion && osVersion.length === 4) {
708
- buildNumber = parseInt(osVersion[3]);
709
- }
710
- return buildNumber;
711
- };
712
- WindowsPtyAgent2.prototype._generatePipeName = function() {
713
- return "conpty-" + Math.random() * 1e7;
714
- };
715
- WindowsPtyAgent2.prototype._$onProcessExit = function(exitCode) {
716
- var _this = this;
717
- this._exitCode = exitCode;
718
- if (!this._useConptyDll) {
719
- this._flushDataAndCleanUp();
720
- this._outSocket.on("data", function() {
721
- return _this._flushDataAndCleanUp();
722
- });
723
- }
724
- };
725
- WindowsPtyAgent2.prototype._flushDataAndCleanUp = function() {
726
- var _this = this;
727
- if (this._useConptyDll) {
728
- return;
729
- }
730
- if (this._closeTimeout) {
731
- clearTimeout(this._closeTimeout);
732
- }
733
- this._closeTimeout = setTimeout(function() {
734
- return _this._cleanUpProcess();
735
- }, FLUSH_DATA_INTERVAL);
736
- };
737
- WindowsPtyAgent2.prototype._cleanUpProcess = function() {
738
- if (this._useConptyDll) {
739
- return;
740
- }
741
- this._inSocket.readable = false;
742
- this._outSocket.readable = false;
743
- this._outSocket.destroy();
744
- };
745
- return WindowsPtyAgent2;
746
- })()
747
- );
748
- exports2.WindowsPtyAgent = WindowsPtyAgent;
749
- function argsToCommandLine(file, args2) {
750
- if (isCommandLine(args2)) {
751
- if (args2.length === 0) {
752
- return file;
753
- }
754
- return argsToCommandLine(file, []) + " " + args2;
755
- }
756
- var argv = [file];
757
- Array.prototype.push.apply(argv, args2);
758
- var result = "";
759
- for (var argIndex = 0; argIndex < argv.length; argIndex++) {
760
- if (argIndex > 0) {
761
- result += " ";
762
- }
763
- var arg = argv[argIndex];
764
- var hasLopsidedEnclosingQuote = xOr(arg[0] !== '"', arg[arg.length - 1] !== '"');
765
- var hasNoEnclosingQuotes = arg[0] !== '"' && arg[arg.length - 1] !== '"';
766
- var quote = arg === "" || (arg.indexOf(" ") !== -1 || arg.indexOf(" ") !== -1) && (arg.length > 1 && (hasLopsidedEnclosingQuote || hasNoEnclosingQuotes));
767
- if (quote) {
768
- result += '"';
769
- }
770
- var bsCount = 0;
771
- for (var i = 0; i < arg.length; i++) {
772
- var p2 = arg[i];
773
- if (p2 === "\\") {
774
- bsCount++;
775
- } else if (p2 === '"') {
776
- result += repeatText("\\", bsCount * 2 + 1);
777
- result += '"';
778
- bsCount = 0;
779
- } else {
780
- result += repeatText("\\", bsCount);
781
- bsCount = 0;
782
- result += p2;
783
- }
784
- }
785
- if (quote) {
786
- result += repeatText("\\", bsCount * 2);
787
- result += '"';
788
- } else {
789
- result += repeatText("\\", bsCount);
790
- }
791
- }
792
- return result;
793
- }
794
- exports2.argsToCommandLine = argsToCommandLine;
795
- function isCommandLine(args2) {
796
- return typeof args2 === "string";
797
- }
798
- function repeatText(text, count) {
799
- var result = "";
800
- for (var i = 0; i < count; i++) {
801
- result += text;
802
- }
803
- return result;
804
- }
805
- function xOr(arg1, arg2) {
806
- return arg1 && !arg2 || !arg1 && arg2;
807
- }
808
- }
809
- });
810
-
811
- // ../../node_modules/node-pty/lib/windowsTerminal.js
812
- var require_windowsTerminal = __commonJS({
813
- "../../node_modules/node-pty/lib/windowsTerminal.js"(exports2) {
814
- "use strict";
815
- var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
816
- var extendStatics = function(d3, b) {
817
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d4, b2) {
818
- d4.__proto__ = b2;
819
- } || function(d4, b2) {
820
- for (var p2 in b2) if (b2.hasOwnProperty(p2)) d4[p2] = b2[p2];
821
- };
822
- return extendStatics(d3, b);
823
- };
824
- return function(d3, b) {
825
- extendStatics(d3, b);
826
- function __() {
827
- this.constructor = d3;
828
- }
829
- d3.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
830
- };
831
- })();
832
- Object.defineProperty(exports2, "__esModule", { value: true });
833
- exports2.WindowsTerminal = void 0;
834
- var terminal_1 = require_terminal();
835
- var windowsPtyAgent_1 = require_windowsPtyAgent();
836
- var utils_1 = require_utils();
837
- var DEFAULT_FILE = "cmd.exe";
838
- var DEFAULT_NAME = "Windows Shell";
839
- var WindowsTerminal = (
840
- /** @class */
841
- (function(_super) {
842
- __extends(WindowsTerminal2, _super);
843
- function WindowsTerminal2(file, args2, opt) {
844
- var _this = _super.call(this, opt) || this;
845
- _this._checkType("args", args2, "string", true);
846
- args2 = args2 || [];
847
- file = file || DEFAULT_FILE;
848
- opt = opt || {};
849
- opt.env = opt.env || process.env;
850
- if (opt.encoding) {
851
- console.warn("Setting encoding on Windows is not supported");
852
- }
853
- var env = utils_1.assign({}, opt.env);
854
- _this._cols = opt.cols || terminal_1.DEFAULT_COLS;
855
- _this._rows = opt.rows || terminal_1.DEFAULT_ROWS;
856
- var cwd = opt.cwd || process.cwd();
857
- var name = opt.name || env.TERM || DEFAULT_NAME;
858
- var parsedEnv = _this._parseEnv(env);
859
- _this._isReady = false;
860
- _this._deferreds = [];
861
- _this._agent = new windowsPtyAgent_1.WindowsPtyAgent(file, args2, parsedEnv, cwd, _this._cols, _this._rows, false, opt.useConpty, opt.useConptyDll, opt.conptyInheritCursor);
862
- _this._socket = _this._agent.outSocket;
863
- _this._pid = _this._agent.innerPid;
864
- _this._fd = _this._agent.fd;
865
- _this._pty = _this._agent.pty;
866
- _this._socket.on("ready_datapipe", function() {
867
- _this._socket.once("data", function() {
868
- if (!_this._isReady) {
869
- _this._isReady = true;
870
- _this._deferreds.forEach(function(fn) {
871
- fn.run();
872
- });
873
- _this._deferreds = [];
874
- }
875
- });
876
- _this._socket.on("error", function(err) {
877
- _this._close();
878
- if (err.code) {
879
- if (~err.code.indexOf("errno 5") || ~err.code.indexOf("EIO"))
880
- return;
881
- }
882
- if (_this.listeners("error").length < 2) {
883
- throw err;
884
- }
885
- });
886
- _this._socket.on("close", function() {
887
- _this.emit("exit", _this._agent.exitCode);
888
- _this._close();
889
- });
890
- });
891
- _this._file = file;
892
- _this._name = name;
893
- _this._readable = true;
894
- _this._writable = true;
895
- _this._forwardEvents();
896
- return _this;
897
- }
898
- WindowsTerminal2.prototype._write = function(data) {
899
- this._defer(this._doWrite, data);
900
- };
901
- WindowsTerminal2.prototype._doWrite = function(data) {
902
- this._agent.inSocket.write(data);
903
- };
904
- WindowsTerminal2.open = function(options) {
905
- throw new Error("open() not supported on windows, use Fork() instead.");
906
- };
907
- WindowsTerminal2.prototype.resize = function(cols, rows) {
908
- var _this = this;
909
- if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) {
910
- throw new Error("resizing must be done using positive cols and rows");
911
- }
912
- this._deferNoArgs(function() {
913
- _this._agent.resize(cols, rows);
914
- _this._cols = cols;
915
- _this._rows = rows;
916
- });
917
- };
918
- WindowsTerminal2.prototype.clear = function() {
919
- var _this = this;
920
- this._deferNoArgs(function() {
921
- _this._agent.clear();
922
- });
923
- };
924
- WindowsTerminal2.prototype.destroy = function() {
925
- var _this = this;
926
- this._deferNoArgs(function() {
927
- _this.kill();
928
- });
929
- };
930
- WindowsTerminal2.prototype.kill = function(signal) {
931
- var _this = this;
932
- this._deferNoArgs(function() {
933
- if (signal) {
934
- throw new Error("Signals not supported on windows.");
935
- }
936
- _this._close();
937
- _this._agent.kill();
938
- });
939
- };
940
- WindowsTerminal2.prototype._deferNoArgs = function(deferredFn) {
941
- var _this = this;
942
- if (this._isReady) {
943
- deferredFn.call(this);
944
- return;
945
- }
946
- this._deferreds.push({
947
- run: function() {
948
- return deferredFn.call(_this);
949
- }
950
- });
951
- };
952
- WindowsTerminal2.prototype._defer = function(deferredFn, arg) {
953
- var _this = this;
954
- if (this._isReady) {
955
- deferredFn.call(this, arg);
956
- return;
957
- }
958
- this._deferreds.push({
959
- run: function() {
960
- return deferredFn.call(_this, arg);
961
- }
962
- });
963
- };
964
- Object.defineProperty(WindowsTerminal2.prototype, "process", {
965
- get: function() {
966
- return this._name;
967
- },
968
- enumerable: false,
969
- configurable: true
970
- });
971
- Object.defineProperty(WindowsTerminal2.prototype, "master", {
972
- get: function() {
973
- throw new Error("master is not supported on Windows");
974
- },
975
- enumerable: false,
976
- configurable: true
977
- });
978
- Object.defineProperty(WindowsTerminal2.prototype, "slave", {
979
- get: function() {
980
- throw new Error("slave is not supported on Windows");
981
- },
982
- enumerable: false,
983
- configurable: true
984
- });
985
- return WindowsTerminal2;
986
- })(terminal_1.Terminal)
987
- );
988
- exports2.WindowsTerminal = WindowsTerminal;
989
- }
990
- });
991
-
992
- // ../../node_modules/node-pty/lib/unixTerminal.js
993
- var require_unixTerminal = __commonJS({
994
- "../../node_modules/node-pty/lib/unixTerminal.js"(exports2) {
995
- "use strict";
996
- var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
997
- var extendStatics = function(d3, b) {
998
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d4, b2) {
999
- d4.__proto__ = b2;
1000
- } || function(d4, b2) {
1001
- for (var p2 in b2) if (b2.hasOwnProperty(p2)) d4[p2] = b2[p2];
1002
- };
1003
- return extendStatics(d3, b);
1004
- };
1005
- return function(d3, b) {
1006
- extendStatics(d3, b);
1007
- function __() {
1008
- this.constructor = d3;
1009
- }
1010
- d3.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1011
- };
1012
- })();
1013
- Object.defineProperty(exports2, "__esModule", { value: true });
1014
- exports2.UnixTerminal = void 0;
1015
- var fs17 = require("fs");
1016
- var path23 = require("path");
1017
- var tty = require("tty");
1018
- var terminal_1 = require_terminal();
1019
- var utils_1 = require_utils();
1020
- var native = utils_1.loadNativeModule("pty");
1021
- var pty2 = native.module;
1022
- var helperPath = native.dir + "/spawn-helper";
1023
- helperPath = path23.resolve(__dirname, helperPath);
1024
- helperPath = helperPath.replace("app.asar", "app.asar.unpacked");
1025
- helperPath = helperPath.replace("node_modules.asar", "node_modules.asar.unpacked");
1026
- var DEFAULT_FILE = "sh";
1027
- var DEFAULT_NAME = "xterm";
1028
- var DESTROY_SOCKET_TIMEOUT_MS = 200;
1029
- var UnixTerminal = (
1030
- /** @class */
1031
- (function(_super) {
1032
- __extends(UnixTerminal2, _super);
1033
- function UnixTerminal2(file, args2, opt) {
1034
- var _a, _b;
1035
- var _this = _super.call(this, opt) || this;
1036
- _this._boundClose = false;
1037
- _this._emittedClose = false;
1038
- if (typeof args2 === "string") {
1039
- throw new Error("args as a string is not supported on unix.");
1040
- }
1041
- args2 = args2 || [];
1042
- file = file || DEFAULT_FILE;
1043
- opt = opt || {};
1044
- opt.env = opt.env || process.env;
1045
- _this._cols = opt.cols || terminal_1.DEFAULT_COLS;
1046
- _this._rows = opt.rows || terminal_1.DEFAULT_ROWS;
1047
- var uid = (_a = opt.uid) !== null && _a !== void 0 ? _a : -1;
1048
- var gid = (_b = opt.gid) !== null && _b !== void 0 ? _b : -1;
1049
- var env = utils_1.assign({}, opt.env);
1050
- if (opt.env === process.env) {
1051
- _this._sanitizeEnv(env);
1052
- }
1053
- var cwd = opt.cwd || process.cwd();
1054
- env.PWD = cwd;
1055
- var name = opt.name || env.TERM || DEFAULT_NAME;
1056
- env.TERM = name;
1057
- var parsedEnv = _this._parseEnv(env);
1058
- var encoding = opt.encoding === void 0 ? "utf8" : opt.encoding;
1059
- var onexit = function(code, signal) {
1060
- if (!_this._emittedClose) {
1061
- if (_this._boundClose) {
1062
- return;
1063
- }
1064
- _this._boundClose = true;
1065
- var timeout_1 = setTimeout(function() {
1066
- timeout_1 = null;
1067
- _this._socket.destroy();
1068
- }, DESTROY_SOCKET_TIMEOUT_MS);
1069
- _this.once("close", function() {
1070
- if (timeout_1 !== null) {
1071
- clearTimeout(timeout_1);
1072
- }
1073
- _this.emit("exit", code, signal);
1074
- });
1075
- return;
1076
- }
1077
- _this.emit("exit", code, signal);
1078
- };
1079
- var term = pty2.fork(file, args2, parsedEnv, cwd, _this._cols, _this._rows, uid, gid, encoding === "utf8", helperPath, onexit);
1080
- _this._socket = new tty.ReadStream(term.fd);
1081
- if (encoding !== null) {
1082
- _this._socket.setEncoding(encoding);
1083
- }
1084
- _this._writeStream = new CustomWriteStream(term.fd, encoding || void 0);
1085
- _this._socket.on("error", function(err) {
1086
- if (err.code) {
1087
- if (~err.code.indexOf("EAGAIN")) {
1088
- return;
1089
- }
1090
- }
1091
- _this._close();
1092
- if (!_this._emittedClose) {
1093
- _this._emittedClose = true;
1094
- _this.emit("close");
1095
- }
1096
- if (err.code) {
1097
- if (~err.code.indexOf("errno 5") || ~err.code.indexOf("EIO")) {
1098
- return;
1099
- }
1100
- }
1101
- if (_this.listeners("error").length < 2) {
1102
- throw err;
1103
- }
1104
- });
1105
- _this._pid = term.pid;
1106
- _this._fd = term.fd;
1107
- _this._pty = term.pty;
1108
- _this._file = file;
1109
- _this._name = name;
1110
- _this._readable = true;
1111
- _this._writable = true;
1112
- _this._socket.on("close", function() {
1113
- if (_this._emittedClose) {
1114
- return;
1115
- }
1116
- _this._emittedClose = true;
1117
- _this._close();
1118
- _this.emit("close");
1119
- });
1120
- _this._forwardEvents();
1121
- return _this;
1122
- }
1123
- Object.defineProperty(UnixTerminal2.prototype, "master", {
1124
- get: function() {
1125
- return this._master;
1126
- },
1127
- enumerable: false,
1128
- configurable: true
1129
- });
1130
- Object.defineProperty(UnixTerminal2.prototype, "slave", {
1131
- get: function() {
1132
- return this._slave;
1133
- },
1134
- enumerable: false,
1135
- configurable: true
1136
- });
1137
- UnixTerminal2.prototype._write = function(data) {
1138
- this._writeStream.write(data);
1139
- };
1140
- Object.defineProperty(UnixTerminal2.prototype, "fd", {
1141
- /* Accessors */
1142
- get: function() {
1143
- return this._fd;
1144
- },
1145
- enumerable: false,
1146
- configurable: true
1147
- });
1148
- Object.defineProperty(UnixTerminal2.prototype, "ptsName", {
1149
- get: function() {
1150
- return this._pty;
1151
- },
1152
- enumerable: false,
1153
- configurable: true
1154
- });
1155
- UnixTerminal2.open = function(opt) {
1156
- var self = Object.create(UnixTerminal2.prototype);
1157
- opt = opt || {};
1158
- if (arguments.length > 1) {
1159
- opt = {
1160
- cols: arguments[1],
1161
- rows: arguments[2]
1162
- };
1163
- }
1164
- var cols = opt.cols || terminal_1.DEFAULT_COLS;
1165
- var rows = opt.rows || terminal_1.DEFAULT_ROWS;
1166
- var encoding = opt.encoding === void 0 ? "utf8" : opt.encoding;
1167
- var term = pty2.open(cols, rows);
1168
- self._master = new tty.ReadStream(term.master);
1169
- if (encoding !== null) {
1170
- self._master.setEncoding(encoding);
1171
- }
1172
- self._master.resume();
1173
- self._slave = new tty.ReadStream(term.slave);
1174
- if (encoding !== null) {
1175
- self._slave.setEncoding(encoding);
1176
- }
1177
- self._slave.resume();
1178
- self._socket = self._master;
1179
- self._pid = -1;
1180
- self._fd = term.master;
1181
- self._pty = term.pty;
1182
- self._file = process.argv[0] || "node";
1183
- self._name = process.env.TERM || "";
1184
- self._readable = true;
1185
- self._writable = true;
1186
- self._socket.on("error", function(err) {
1187
- self._close();
1188
- if (self.listeners("error").length < 2) {
1189
- throw err;
1190
- }
1191
- });
1192
- self._socket.on("close", function() {
1193
- self._close();
1194
- });
1195
- return self;
1196
- };
1197
- UnixTerminal2.prototype.destroy = function() {
1198
- var _this = this;
1199
- this._close();
1200
- this._socket.once("close", function() {
1201
- _this.kill("SIGHUP");
1202
- });
1203
- this._socket.destroy();
1204
- this._writeStream.dispose();
1205
- };
1206
- UnixTerminal2.prototype.kill = function(signal) {
1207
- try {
1208
- process.kill(this.pid, signal || "SIGHUP");
1209
- } catch (e) {
1210
- }
1211
- };
1212
- Object.defineProperty(UnixTerminal2.prototype, "process", {
1213
- /**
1214
- * Gets the name of the process.
1215
- */
1216
- get: function() {
1217
- if (process.platform === "darwin") {
1218
- var title = pty2.process(this._fd);
1219
- return title !== "kernel_task" ? title : this._file;
1220
- }
1221
- return pty2.process(this._fd, this._pty) || this._file;
1222
- },
1223
- enumerable: false,
1224
- configurable: true
1225
- });
1226
- UnixTerminal2.prototype.resize = function(cols, rows) {
1227
- if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) {
1228
- throw new Error("resizing must be done using positive cols and rows");
1229
- }
1230
- pty2.resize(this._fd, cols, rows);
1231
- this._cols = cols;
1232
- this._rows = rows;
1233
- };
1234
- UnixTerminal2.prototype.clear = function() {
1235
- };
1236
- UnixTerminal2.prototype._sanitizeEnv = function(env) {
1237
- delete env["TMUX"];
1238
- delete env["TMUX_PANE"];
1239
- delete env["STY"];
1240
- delete env["WINDOW"];
1241
- delete env["WINDOWID"];
1242
- delete env["TERMCAP"];
1243
- delete env["COLUMNS"];
1244
- delete env["LINES"];
1245
- };
1246
- return UnixTerminal2;
1247
- })(terminal_1.Terminal)
1248
- );
1249
- exports2.UnixTerminal = UnixTerminal;
1250
- var CustomWriteStream = (
1251
- /** @class */
1252
- (function() {
1253
- function CustomWriteStream2(_fd, _encoding) {
1254
- this._fd = _fd;
1255
- this._encoding = _encoding;
1256
- this._writeQueue = [];
1257
- }
1258
- CustomWriteStream2.prototype.dispose = function() {
1259
- clearImmediate(this._writeImmediate);
1260
- this._writeImmediate = void 0;
1261
- };
1262
- CustomWriteStream2.prototype.write = function(data) {
1263
- var buffer = typeof data === "string" ? Buffer.from(data, this._encoding) : Buffer.from(data);
1264
- if (buffer.byteLength !== 0) {
1265
- this._writeQueue.push({ buffer, offset: 0 });
1266
- if (this._writeQueue.length === 1) {
1267
- this._processWriteQueue();
1268
- }
1269
- }
1270
- };
1271
- CustomWriteStream2.prototype._processWriteQueue = function() {
1272
- var _this = this;
1273
- this._writeImmediate = void 0;
1274
- if (this._writeQueue.length === 0) {
1275
- return;
1276
- }
1277
- var task = this._writeQueue[0];
1278
- fs17.write(this._fd, task.buffer, task.offset, function(err, written) {
1279
- if (err) {
1280
- if ("code" in err && err.code === "EAGAIN") {
1281
- _this._writeImmediate = setImmediate(function() {
1282
- return _this._processWriteQueue();
1283
- });
1284
- } else {
1285
- _this._writeQueue.length = 0;
1286
- console.error("Unhandled pty write error", err);
1287
- }
1288
- return;
1289
- }
1290
- task.offset += written;
1291
- if (task.offset >= task.buffer.byteLength) {
1292
- _this._writeQueue.shift();
1293
- }
1294
- _this._processWriteQueue();
1295
- });
1296
- };
1297
- return CustomWriteStream2;
1298
- })()
1299
- );
1300
- }
1301
- });
1302
-
1303
- // ../../node_modules/node-pty/lib/index.js
1304
- var require_lib = __commonJS({
1305
- "../../node_modules/node-pty/lib/index.js"(exports2) {
1306
- "use strict";
1307
- Object.defineProperty(exports2, "__esModule", { value: true });
1308
- exports2.native = exports2.open = exports2.createTerminal = exports2.fork = exports2.spawn = void 0;
1309
- var utils_1 = require_utils();
1310
- var terminalCtor;
1311
- if (process.platform === "win32") {
1312
- terminalCtor = require_windowsTerminal().WindowsTerminal;
1313
- } else {
1314
- terminalCtor = require_unixTerminal().UnixTerminal;
1315
- }
1316
- function spawn12(file, args2, opt) {
1317
- return new terminalCtor(file, args2, opt);
1318
- }
1319
- exports2.spawn = spawn12;
1320
- function fork(file, args2, opt) {
1321
- return new terminalCtor(file, args2, opt);
1322
- }
1323
- exports2.fork = fork;
1324
- function createTerminal(file, args2, opt) {
1325
- return new terminalCtor(file, args2, opt);
1326
- }
1327
- exports2.createTerminal = createTerminal;
1328
- function open(options) {
1329
- return terminalCtor.open(options);
1330
- }
1331
- exports2.open = open;
1332
- exports2.native = process.platform !== "win32" ? utils_1.loadNativeModule("pty").module : null;
1333
- }
1334
- });
1335
-
1336
33
  // ../../node_modules/sisteransi/src/index.js
1337
34
  var require_src = __commonJS({
1338
35
  "../../node_modules/sisteransi/src/index.js"(exports2, module2) {
@@ -1689,7 +386,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
1689
386
  // package.json
1690
387
  var package_default = {
1691
388
  name: "codeam-cli",
1692
- version: "2.15.0",
389
+ version: "2.15.2",
1693
390
  description: "Remote control Claude Code (and other AI coding agents) from your mobile phone. Pair your device, send prompts, stream responses in real-time, and approve commands \u2014 from anywhere.",
1694
391
  type: "commonjs",
1695
392
  main: "dist/index.js",
@@ -2596,7 +1293,7 @@ function loadNodePty() {
2596
1293
  return require(vendoredPath);
2597
1294
  } catch (vendorErr) {
2598
1295
  try {
2599
- return require_lib();
1296
+ return require("node-pty");
2600
1297
  } catch {
2601
1298
  void vendorErr;
2602
1299
  return null;
@@ -7488,9 +6185,9 @@ function buildKeepAlive(ctx) {
7488
6185
  // src/commands/start/handlers.ts
7489
6186
  var fs14 = __toESM(require("fs"));
7490
6187
  var os13 = __toESM(require("os"));
7491
- var path17 = __toESM(require("path"));
6188
+ var path18 = __toESM(require("path"));
7492
6189
  var import_crypto2 = require("crypto");
7493
- var import_child_process8 = require("child_process");
6190
+ var import_child_process9 = require("child_process");
7494
6191
 
7495
6192
  // src/lib/payload.ts
7496
6193
  var import_zod2 = require("zod");
@@ -8038,9 +6735,27 @@ async function jsSearchFiles(opts, cwd, cap) {
8038
6735
  }
8039
6736
 
8040
6737
  // src/services/terminal-ops.service.ts
6738
+ var import_child_process8 = require("child_process");
8041
6739
  var import_crypto = require("crypto");
8042
- var pty = __toESM(require_lib());
6740
+ var import_path = __toESM(require("path"));
8043
6741
  var MAX_CONCURRENT_SESSIONS = 4;
6742
+ var nodePtyModule;
6743
+ function loadNodePty2() {
6744
+ if (nodePtyModule !== void 0) return nodePtyModule;
6745
+ const vendoredPath = import_path.default.join(__dirname, "vendor", "node-pty");
6746
+ try {
6747
+ nodePtyModule = require(vendoredPath);
6748
+ return nodePtyModule;
6749
+ } catch {
6750
+ try {
6751
+ nodePtyModule = require("node-pty");
6752
+ return nodePtyModule;
6753
+ } catch {
6754
+ nodePtyModule = null;
6755
+ return nodePtyModule;
6756
+ }
6757
+ }
6758
+ }
8044
6759
  var sessions = /* @__PURE__ */ new Map();
8045
6760
  var onDataHandler = null;
8046
6761
  var onExitHandler = null;
@@ -8054,6 +6769,135 @@ function defaultShell() {
8054
6769
  }
8055
6770
  return process.env.SHELL ?? "/bin/bash";
8056
6771
  }
6772
+ var PYTHON_TERMINAL_HELPER = `import os,pty,sys,select,signal,struct,fcntl,termios,errno,re
6773
+ m,s=pty.openpty()
6774
+ try:
6775
+ cols=int(os.environ.get('COLUMNS','80'))
6776
+ rows=int(os.environ.get('LINES','24'))
6777
+ fcntl.ioctl(s,termios.TIOCSWINSZ,struct.pack('HHHH',rows,cols,0,0))
6778
+ except Exception:pass
6779
+ pid=os.fork()
6780
+ if pid==0:
6781
+ os.close(m)
6782
+ os.setsid()
6783
+ try:fcntl.ioctl(s,termios.TIOCSCTTY,0)
6784
+ except Exception:pass
6785
+ for fd in[0,1,2]:os.dup2(s,fd)
6786
+ if s>2:os.close(s)
6787
+ os.execvp(sys.argv[1],sys.argv[1:])
6788
+ sys.exit(127)
6789
+ os.close(s)
6790
+ done=[False]
6791
+ def onchld(n,f):
6792
+ try:os.waitpid(pid,os.WNOHANG)
6793
+ except Exception:pass
6794
+ done[0]=True
6795
+ signal.signal(signal.SIGCHLD,onchld)
6796
+ signal.signal(signal.SIGHUP,signal.SIG_IGN)
6797
+ i=sys.stdin.fileno()
6798
+ o=sys.stdout.fileno()
6799
+ in_buf=b''
6800
+ resize_re=re.compile(rb'\\x00CW (\\d+) (\\d+)\\n')
6801
+ while not done[0]:
6802
+ try:r,_,_=select.select([i,m],[],[],0.1)
6803
+ except OSError as e:
6804
+ if e.errno==errno.EINTR:continue
6805
+ break
6806
+ if i in r:
6807
+ try:
6808
+ d=os.read(i,4096)
6809
+ if not d:break
6810
+ in_buf+=d
6811
+ while True:
6812
+ mo=resize_re.search(in_buf)
6813
+ if not mo:break
6814
+ try:
6815
+ rows=int(mo.group(1));cols=int(mo.group(2))
6816
+ fcntl.ioctl(m,termios.TIOCSWINSZ,struct.pack('HHHH',rows,cols,0,0))
6817
+ except Exception:pass
6818
+ in_buf=in_buf[:mo.start()]+in_buf[mo.end():]
6819
+ if in_buf:
6820
+ # Don't forward a dangling NUL that might be the
6821
+ # start of an incomplete resize marker \u2014 hold it
6822
+ # until the next read so the regex matches.
6823
+ nul=in_buf.rfind(b'\\x00')
6824
+ if nul>=0 and len(in_buf)-nul<32:
6825
+ tail=in_buf[nul:];body=in_buf[:nul]
6826
+ if body:os.write(m,body)
6827
+ in_buf=tail
6828
+ else:
6829
+ os.write(m,in_buf);in_buf=b''
6830
+ except OSError:break
6831
+ if m in r:
6832
+ try:
6833
+ d=os.read(m,4096)
6834
+ if d:os.write(o,d)
6835
+ except OSError:done[0]=True
6836
+ try:os.kill(pid,signal.SIGTERM)
6837
+ except Exception:pass
6838
+ try:
6839
+ _,st=os.waitpid(pid,0)
6840
+ sys.exit((st>>8)&0xFF)
6841
+ except Exception:sys.exit(0)
6842
+ `;
6843
+ function findPython3() {
6844
+ for (const name of ["python3", "python"]) {
6845
+ try {
6846
+ const out = require("child_process").spawnSync("which", [name], { encoding: "utf8" });
6847
+ if (out.status === 0 && out.stdout?.trim()) return out.stdout.trim();
6848
+ } catch {
6849
+ }
6850
+ }
6851
+ return null;
6852
+ }
6853
+ function createPythonSession(id, shell, cwd, env, cols, rows) {
6854
+ const python = findPython3();
6855
+ if (!python) {
6856
+ return { error: "python3 not found on PATH \u2014 required for terminal sessions on Linux/macOS without node-pty." };
6857
+ }
6858
+ let child;
6859
+ try {
6860
+ child = (0, import_child_process8.spawn)(python, ["-c", PYTHON_TERMINAL_HELPER, shell], {
6861
+ cwd,
6862
+ env: { ...env, COLUMNS: String(cols), LINES: String(rows) },
6863
+ stdio: ["pipe", "pipe", "pipe"]
6864
+ });
6865
+ } catch (e) {
6866
+ return { error: e instanceof Error ? e.message : "python spawn failed" };
6867
+ }
6868
+ child.stdout.on("data", (buf) => {
6869
+ onDataHandler?.({ sessionId: id, data: buf.toString("utf8") });
6870
+ });
6871
+ child.stderr.on("data", (buf) => {
6872
+ onDataHandler?.({ sessionId: id, data: buf.toString("utf8") });
6873
+ });
6874
+ child.on("exit", (code) => {
6875
+ onExitHandler?.({ sessionId: id, exitCode: code ?? 0 });
6876
+ sessions.delete(id);
6877
+ });
6878
+ return {
6879
+ id,
6880
+ write(data) {
6881
+ try {
6882
+ child.stdin.write(data);
6883
+ } catch {
6884
+ }
6885
+ },
6886
+ resize(cs, rs) {
6887
+ try {
6888
+ child.stdin.write(`\0CW ${rs} ${cs}
6889
+ `);
6890
+ } catch {
6891
+ }
6892
+ },
6893
+ kill() {
6894
+ try {
6895
+ child.kill("SIGTERM");
6896
+ } catch {
6897
+ }
6898
+ }
6899
+ };
6900
+ }
8057
6901
  function openTerminal(opts) {
8058
6902
  if (sessions.size >= MAX_CONCURRENT_SESSIONS) {
8059
6903
  return { error: `Too many open terminals (max ${MAX_CONCURRENT_SESSIONS})` };
@@ -8063,40 +6907,61 @@ function openTerminal(opts) {
8063
6907
  const env = {
8064
6908
  ...process.env,
8065
6909
  TERM: "xterm-256color",
8066
- COLORTERM: "truecolor"
6910
+ COLORTERM: "truecolor",
6911
+ FORCE_COLOR: "1"
8067
6912
  };
8068
- env.FORCE_COLOR = "1";
8069
- try {
8070
- const term = pty.spawn(shell, [], {
8071
- name: "xterm-256color",
8072
- cols: Math.max(1, Math.min(opts.cols ?? 80, 500)),
8073
- rows: Math.max(1, Math.min(opts.rows ?? 24, 200)),
8074
- cwd,
8075
- env,
8076
- // Windows-specific: ConPTY is the default on Win 10 1809+
8077
- // and is what we want. node-pty falls back to winpty
8078
- // automatically on older builds.
8079
- useConpty: process.platform === "win32" ? true : void 0
8080
- });
8081
- const id = (0, import_crypto.randomUUID)();
8082
- const dataListener = term.onData((data) => {
8083
- onDataHandler?.({ sessionId: id, data });
8084
- });
8085
- const exitListener = term.onExit(({ exitCode }) => {
8086
- onExitHandler?.({ sessionId: id, exitCode });
8087
- sessions.delete(id);
8088
- });
8089
- sessions.set(id, { id, pty: term, dataListener, exitListener });
8090
- return { sessionId: id };
8091
- } catch (e) {
8092
- return { error: e instanceof Error ? e.message : "spawn failed" };
6913
+ const cols = Math.max(1, Math.min(opts.cols ?? 80, 500));
6914
+ const rows = Math.max(1, Math.min(opts.rows ?? 24, 200));
6915
+ const id = (0, import_crypto.randomUUID)();
6916
+ const ptyMod = loadNodePty2();
6917
+ if (ptyMod) {
6918
+ try {
6919
+ const term = ptyMod.spawn(shell, [], {
6920
+ name: "xterm-256color",
6921
+ cols,
6922
+ rows,
6923
+ cwd,
6924
+ env,
6925
+ useConpty: process.platform === "win32" ? true : void 0
6926
+ });
6927
+ const dataListener = term.onData((data) => {
6928
+ onDataHandler?.({ sessionId: id, data });
6929
+ });
6930
+ const exitListener = term.onExit(({ exitCode }) => {
6931
+ onExitHandler?.({ sessionId: id, exitCode });
6932
+ sessions.delete(id);
6933
+ });
6934
+ sessions.set(id, {
6935
+ id,
6936
+ write: (d3) => term.write(d3),
6937
+ resize: (cs, rs) => term.resize(cs, rs),
6938
+ kill: () => {
6939
+ dataListener.dispose();
6940
+ exitListener.dispose();
6941
+ term.kill();
6942
+ }
6943
+ });
6944
+ return { sessionId: id };
6945
+ } catch (e) {
6946
+ if (process.platform === "win32") {
6947
+ return { error: e instanceof Error ? e.message : "spawn failed" };
6948
+ }
6949
+ }
6950
+ } else if (process.platform === "win32") {
6951
+ return {
6952
+ error: `node-pty native module unavailable on ${process.platform}-${process.arch}; terminal feature disabled for this platform`
6953
+ };
8093
6954
  }
6955
+ const sess = createPythonSession(id, shell, cwd, env, cols, rows);
6956
+ if ("error" in sess) return { error: sess.error };
6957
+ sessions.set(id, sess);
6958
+ return { sessionId: id };
8094
6959
  }
8095
6960
  function writeTerminal(sessionId, data) {
8096
6961
  const s = sessions.get(sessionId);
8097
6962
  if (!s) return { ok: false, error: "No such session" };
8098
6963
  try {
8099
- s.pty.write(data);
6964
+ s.write(data);
8100
6965
  return { ok: true };
8101
6966
  } catch (e) {
8102
6967
  return { ok: false, error: e instanceof Error ? e.message : "write failed" };
@@ -8106,7 +6971,7 @@ function resizeTerminal(sessionId, cols, rows) {
8106
6971
  const s = sessions.get(sessionId);
8107
6972
  if (!s) return { ok: false, error: "No such session" };
8108
6973
  try {
8109
- s.pty.resize(Math.max(1, Math.min(cols, 500)), Math.max(1, Math.min(rows, 200)));
6974
+ s.resize?.(Math.max(1, Math.min(cols, 500)), Math.max(1, Math.min(rows, 200)));
8110
6975
  return { ok: true };
8111
6976
  } catch (e) {
8112
6977
  return { ok: false, error: e instanceof Error ? e.message : "resize failed" };
@@ -8116,9 +6981,7 @@ function closeTerminal(sessionId) {
8116
6981
  const s = sessions.get(sessionId);
8117
6982
  if (!s) return { ok: true };
8118
6983
  try {
8119
- s.dataListener.dispose();
8120
- s.exitListener.dispose();
8121
- s.pty.kill();
6984
+ s.kill();
8122
6985
  } catch {
8123
6986
  }
8124
6987
  sessions.delete(sessionId);
@@ -8129,7 +6992,7 @@ function closeTerminal(sessionId) {
8129
6992
  function saveFilesTemp(files) {
8130
6993
  return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
8131
6994
  const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
8132
- const tmpPath = path17.join(os13.tmpdir(), `codeam-${(0, import_crypto2.randomUUID)()}-${safeName}`);
6995
+ const tmpPath = path18.join(os13.tmpdir(), `codeam-${(0, import_crypto2.randomUUID)()}-${safeName}`);
8133
6996
  fs14.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
8134
6997
  return tmpPath;
8135
6998
  });
@@ -8261,7 +7124,7 @@ var sessionTerminated = (ctx) => {
8261
7124
  } catch {
8262
7125
  }
8263
7126
  try {
8264
- const proc = (0, import_child_process8.spawn)("bash", ["-lc", "pm2 delete codeam-pair >/dev/null 2>&1 || true"], {
7127
+ const proc = (0, import_child_process9.spawn)("bash", ["-lc", "pm2 delete codeam-pair >/dev/null 2>&1 || true"], {
8265
7128
  detached: true,
8266
7129
  stdio: "ignore"
8267
7130
  });
@@ -8283,7 +7146,7 @@ var shutdownSession = async (ctx, cmd) => {
8283
7146
  }
8284
7147
  if (ctx.keepAliveCtx.inCodespace && ctx.keepAliveCtx.codespaceName) {
8285
7148
  try {
8286
- const stopProc = (0, import_child_process8.spawn)(
7149
+ const stopProc = (0, import_child_process9.spawn)(
8287
7150
  "bash",
8288
7151
  ["-lc", `sleep 1; gh codespace stop -c ${JSON.stringify(ctx.keepAliveCtx.codespaceName)} >/dev/null 2>&1 || true`],
8289
7152
  { detached: true, stdio: "ignore" }
@@ -8293,7 +7156,7 @@ var shutdownSession = async (ctx, cmd) => {
8293
7156
  }
8294
7157
  }
8295
7158
  try {
8296
- const proc = (0, import_child_process8.spawn)("bash", ["-lc", "pm2 delete codeam-pair >/dev/null 2>&1 || true"], {
7159
+ const proc = (0, import_child_process9.spawn)("bash", ["-lc", "pm2 delete codeam-pair >/dev/null 2>&1 || true"], {
8297
7160
  detached: true,
8298
7161
  stdio: "ignore"
8299
7162
  });
@@ -8701,12 +7564,12 @@ function readTokenFromArgs(args2) {
8701
7564
  }
8702
7565
  const fileFlag = args2.find((a) => a.startsWith("--token-file="));
8703
7566
  if (fileFlag) {
8704
- const path23 = fileFlag.slice("--token-file=".length);
7567
+ const path24 = fileFlag.slice("--token-file=".length);
8705
7568
  try {
8706
- const content = fs15.readFileSync(path23, "utf8").trim();
8707
- if (content.length === 0) fail(`--token-file ${path23} is empty`);
7569
+ const content = fs15.readFileSync(path24, "utf8").trim();
7570
+ if (content.length === 0) fail(`--token-file ${path24} is empty`);
8708
7571
  try {
8709
- fs15.unlinkSync(path23);
7572
+ fs15.unlinkSync(path24);
8710
7573
  } catch {
8711
7574
  }
8712
7575
  return content;
@@ -8873,11 +7736,11 @@ async function logout() {
8873
7736
  var import_picocolors9 = __toESM(require("picocolors"));
8874
7737
 
8875
7738
  // src/services/providers/github-codespaces.ts
8876
- var import_child_process9 = require("child_process");
7739
+ var import_child_process10 = require("child_process");
8877
7740
  var import_util3 = require("util");
8878
7741
  var import_picocolors7 = __toESM(require("picocolors"));
8879
- var path18 = __toESM(require("path"));
8880
- var execFileP3 = (0, import_util3.promisify)(import_child_process9.execFile);
7742
+ var path19 = __toESM(require("path"));
7743
+ var execFileP3 = (0, import_util3.promisify)(import_child_process10.execFile);
8881
7744
  var MAX_BUFFER = 8 * 1024 * 1024;
8882
7745
  function resetStdinForChild() {
8883
7746
  if (process.stdin.isTTY) {
@@ -8921,7 +7784,7 @@ var GitHubCodespacesProvider = class {
8921
7784
  if (!isAuthed) {
8922
7785
  resetStdinForChild();
8923
7786
  await new Promise((resolve2, reject) => {
8924
- const proc = (0, import_child_process9.spawn)("gh", ["auth", "login", "-s", "codespace,repo,read:user"], {
7787
+ const proc = (0, import_child_process10.spawn)("gh", ["auth", "login", "-s", "codespace,repo,read:user"], {
8925
7788
  stdio: "inherit"
8926
7789
  });
8927
7790
  proc.on("exit", (code) => {
@@ -8955,7 +7818,7 @@ var GitHubCodespacesProvider = class {
8955
7818
  wt(noteLines.join("\n"), "One more permission needed");
8956
7819
  resetStdinForChild();
8957
7820
  const refreshCode = await new Promise((resolve2, reject) => {
8958
- const proc = (0, import_child_process9.spawn)(
7821
+ const proc = (0, import_child_process10.spawn)(
8959
7822
  "gh",
8960
7823
  ["auth", "refresh", "-h", "github.com", "-s", "codespace"],
8961
7824
  { stdio: "inherit" }
@@ -9105,7 +7968,7 @@ var GitHubCodespacesProvider = class {
9105
7968
  O2.step(`Installing gh via ${installCmd.describe}\u2026`);
9106
7969
  resetStdinForChild();
9107
7970
  const ok = await new Promise((resolve2) => {
9108
- const proc = (0, import_child_process9.spawn)(installCmd.exe, installCmd.args, { stdio: "inherit" });
7971
+ const proc = (0, import_child_process10.spawn)(installCmd.exe, installCmd.args, { stdio: "inherit" });
9109
7972
  proc.on("exit", (code) => resolve2(code === 0));
9110
7973
  proc.on("error", () => resolve2(false));
9111
7974
  });
@@ -9132,7 +7995,7 @@ var GitHubCodespacesProvider = class {
9132
7995
  );
9133
7996
  resetStdinForChild();
9134
7997
  await new Promise((resolve2, reject) => {
9135
- const proc = (0, import_child_process9.spawn)(
7998
+ const proc = (0, import_child_process10.spawn)(
9136
7999
  "gh",
9137
8000
  ["auth", "refresh", "-h", "github.com", "-s", "repo,read:org"],
9138
8001
  { stdio: "inherit" }
@@ -9310,7 +8173,7 @@ var GitHubCodespacesProvider = class {
9310
8173
  async streamCommand(workspaceId, command2) {
9311
8174
  resetStdinForChild();
9312
8175
  return new Promise((resolve2, reject) => {
9313
- const proc = (0, import_child_process9.spawn)(
8176
+ const proc = (0, import_child_process10.spawn)(
9314
8177
  "gh",
9315
8178
  ["codespace", "ssh", "-c", workspaceId, "--", "-tt", command2],
9316
8179
  { stdio: "inherit" }
@@ -9337,11 +8200,11 @@ var GitHubCodespacesProvider = class {
9337
8200
  `mkdir -p ${shellQuote(remoteDir)} && tar -xzf - -C ${shellQuote(remoteDir)}`
9338
8201
  ];
9339
8202
  await new Promise((resolve2, reject) => {
9340
- const tar = (0, import_child_process9.spawn)("tar", tarArgs, {
8203
+ const tar = (0, import_child_process10.spawn)("tar", tarArgs, {
9341
8204
  stdio: ["ignore", "pipe", "pipe"],
9342
8205
  env: tarEnv
9343
8206
  });
9344
- const ssh = (0, import_child_process9.spawn)("gh", sshArgs, {
8207
+ const ssh = (0, import_child_process10.spawn)("gh", sshArgs, {
9345
8208
  stdio: [tar.stdout, "pipe", "pipe"]
9346
8209
  });
9347
8210
  let tarErr = "";
@@ -9365,7 +8228,7 @@ var GitHubCodespacesProvider = class {
9365
8228
  });
9366
8229
  }
9367
8230
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
9368
- const remoteDir = path18.posix.dirname(remotePath);
8231
+ const remoteDir = path19.posix.dirname(remotePath);
9369
8232
  const parts = [
9370
8233
  `mkdir -p ${shellQuote(remoteDir)}`,
9371
8234
  `cat > ${shellQuote(remotePath)}`
@@ -9375,7 +8238,7 @@ var GitHubCodespacesProvider = class {
9375
8238
  }
9376
8239
  const cmd = parts.join(" && ");
9377
8240
  await new Promise((resolve2, reject) => {
9378
- const proc = (0, import_child_process9.spawn)(
8241
+ const proc = (0, import_child_process10.spawn)(
9379
8242
  "gh",
9380
8243
  ["codespace", "ssh", "-c", workspaceId, "--", cmd],
9381
8244
  { stdio: ["pipe", "pipe", "pipe"] }
@@ -9433,11 +8296,11 @@ function shellQuote(s) {
9433
8296
  }
9434
8297
 
9435
8298
  // src/services/providers/gitpod.ts
9436
- var import_child_process10 = require("child_process");
8299
+ var import_child_process11 = require("child_process");
9437
8300
  var import_util4 = require("util");
9438
- var path19 = __toESM(require("path"));
8301
+ var path20 = __toESM(require("path"));
9439
8302
  var import_picocolors8 = __toESM(require("picocolors"));
9440
- var execFileP4 = (0, import_util4.promisify)(import_child_process10.execFile);
8303
+ var execFileP4 = (0, import_util4.promisify)(import_child_process11.execFile);
9441
8304
  var MAX_BUFFER2 = 8 * 1024 * 1024;
9442
8305
  function resetStdinForChild2() {
9443
8306
  if (process.stdin.isTTY) {
@@ -9477,7 +8340,7 @@ var GitpodProvider = class {
9477
8340
  );
9478
8341
  resetStdinForChild2();
9479
8342
  await new Promise((resolve2, reject) => {
9480
- const proc = (0, import_child_process10.spawn)("gitpod", ["login"], { stdio: "inherit" });
8343
+ const proc = (0, import_child_process11.spawn)("gitpod", ["login"], { stdio: "inherit" });
9481
8344
  proc.on("exit", (code) => {
9482
8345
  if (code === 0) resolve2();
9483
8346
  else reject(new Error("gitpod login failed."));
@@ -9629,7 +8492,7 @@ var GitpodProvider = class {
9629
8492
  async streamCommand(workspaceId, command2) {
9630
8493
  resetStdinForChild2();
9631
8494
  return new Promise((resolve2, reject) => {
9632
- const proc = (0, import_child_process10.spawn)(
8495
+ const proc = (0, import_child_process11.spawn)(
9633
8496
  "gitpod",
9634
8497
  ["workspace", "ssh", workspaceId, "--", "-tt", command2],
9635
8498
  { stdio: "inherit" }
@@ -9649,11 +8512,11 @@ var GitpodProvider = class {
9649
8512
  const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
9650
8513
  const remoteCmd = `mkdir -p ${shellQuote2(remoteDir)} && tar -xzf - -C ${shellQuote2(remoteDir)}`;
9651
8514
  await new Promise((resolve2, reject) => {
9652
- const tar = (0, import_child_process10.spawn)("tar", tarArgs, {
8515
+ const tar = (0, import_child_process11.spawn)("tar", tarArgs, {
9653
8516
  stdio: ["ignore", "pipe", "pipe"],
9654
8517
  env: tarEnv
9655
8518
  });
9656
- const ssh = (0, import_child_process10.spawn)(
8519
+ const ssh = (0, import_child_process11.spawn)(
9657
8520
  "gitpod",
9658
8521
  ["workspace", "ssh", workspaceId, "--", remoteCmd],
9659
8522
  { stdio: [tar.stdout, "pipe", "pipe"] }
@@ -9675,7 +8538,7 @@ var GitpodProvider = class {
9675
8538
  });
9676
8539
  }
9677
8540
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
9678
- const remoteDir = path19.posix.dirname(remotePath);
8541
+ const remoteDir = path20.posix.dirname(remotePath);
9679
8542
  const parts = [
9680
8543
  `mkdir -p ${shellQuote2(remoteDir)}`,
9681
8544
  `cat > ${shellQuote2(remotePath)}`
@@ -9685,7 +8548,7 @@ var GitpodProvider = class {
9685
8548
  }
9686
8549
  const cmd = parts.join(" && ");
9687
8550
  await new Promise((resolve2, reject) => {
9688
- const proc = (0, import_child_process10.spawn)(
8551
+ const proc = (0, import_child_process11.spawn)(
9689
8552
  "gitpod",
9690
8553
  ["workspace", "ssh", workspaceId, "--", cmd],
9691
8554
  { stdio: ["pipe", "pipe", "pipe"] }
@@ -9709,10 +8572,10 @@ function shellQuote2(s) {
9709
8572
  }
9710
8573
 
9711
8574
  // src/services/providers/gitlab-workspaces.ts
9712
- var import_child_process11 = require("child_process");
8575
+ var import_child_process12 = require("child_process");
9713
8576
  var import_util5 = require("util");
9714
- var path20 = __toESM(require("path"));
9715
- var execFileP5 = (0, import_util5.promisify)(import_child_process11.execFile);
8577
+ var path21 = __toESM(require("path"));
8578
+ var execFileP5 = (0, import_util5.promisify)(import_child_process12.execFile);
9716
8579
  var MAX_BUFFER3 = 8 * 1024 * 1024;
9717
8580
  var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
9718
8581
  function resetStdinForChild3() {
@@ -9754,7 +8617,7 @@ var GitLabWorkspacesProvider = class {
9754
8617
  );
9755
8618
  resetStdinForChild3();
9756
8619
  await new Promise((resolve2, reject) => {
9757
- const proc = (0, import_child_process11.spawn)(
8620
+ const proc = (0, import_child_process12.spawn)(
9758
8621
  "glab",
9759
8622
  ["auth", "login", "--scopes", "api,read_user,read_repository"],
9760
8623
  { stdio: "inherit" }
@@ -9926,7 +8789,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
9926
8789
  const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
9927
8790
  resetStdinForChild3();
9928
8791
  return new Promise((resolve2, reject) => {
9929
- const proc = (0, import_child_process11.spawn)(
8792
+ const proc = (0, import_child_process12.spawn)(
9930
8793
  "ssh",
9931
8794
  ["-tt", "-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, command2],
9932
8795
  { stdio: "inherit" }
@@ -9947,8 +8810,8 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
9947
8810
  const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
9948
8811
  const remoteCmd = `mkdir -p ${shellQuote3(remoteDir)} && tar -xzf - -C ${shellQuote3(remoteDir)}`;
9949
8812
  await new Promise((resolve2, reject) => {
9950
- const tar = (0, import_child_process11.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
9951
- const ssh = (0, import_child_process11.spawn)(
8813
+ const tar = (0, import_child_process12.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
8814
+ const ssh = (0, import_child_process12.spawn)(
9952
8815
  "ssh",
9953
8816
  ["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, remoteCmd],
9954
8817
  { stdio: [tar.stdout, "pipe", "pipe"] }
@@ -9971,14 +8834,14 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
9971
8834
  }
9972
8835
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
9973
8836
  const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
9974
- const remoteDir = path20.posix.dirname(remotePath);
8837
+ const remoteDir = path21.posix.dirname(remotePath);
9975
8838
  const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
9976
8839
  if (options.mode != null) {
9977
8840
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
9978
8841
  }
9979
8842
  const cmd = parts.join(" && ");
9980
8843
  await new Promise((resolve2, reject) => {
9981
- const proc = (0, import_child_process11.spawn)(
8844
+ const proc = (0, import_child_process12.spawn)(
9982
8845
  "ssh",
9983
8846
  ["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, cmd],
9984
8847
  { stdio: ["pipe", "pipe", "pipe"] }
@@ -10037,10 +8900,10 @@ function shellQuote3(s) {
10037
8900
  }
10038
8901
 
10039
8902
  // src/services/providers/railway.ts
10040
- var import_child_process12 = require("child_process");
8903
+ var import_child_process13 = require("child_process");
10041
8904
  var import_util6 = require("util");
10042
- var path21 = __toESM(require("path"));
10043
- var execFileP6 = (0, import_util6.promisify)(import_child_process12.execFile);
8905
+ var path22 = __toESM(require("path"));
8906
+ var execFileP6 = (0, import_util6.promisify)(import_child_process13.execFile);
10044
8907
  var MAX_BUFFER4 = 8 * 1024 * 1024;
10045
8908
  function resetStdinForChild4() {
10046
8909
  if (process.stdin.isTTY) {
@@ -10081,7 +8944,7 @@ var RailwayProvider = class {
10081
8944
  );
10082
8945
  resetStdinForChild4();
10083
8946
  await new Promise((resolve2, reject) => {
10084
- const proc = (0, import_child_process12.spawn)("railway", ["login"], { stdio: "inherit" });
8947
+ const proc = (0, import_child_process13.spawn)("railway", ["login"], { stdio: "inherit" });
10085
8948
  proc.on("exit", (code) => {
10086
8949
  if (code === 0) resolve2();
10087
8950
  else reject(new Error("railway login failed."));
@@ -10224,7 +9087,7 @@ var RailwayProvider = class {
10224
9087
  }
10225
9088
  resetStdinForChild4();
10226
9089
  return new Promise((resolve2, reject) => {
10227
- const proc = (0, import_child_process12.spawn)(
9090
+ const proc = (0, import_child_process13.spawn)(
10228
9091
  "railway",
10229
9092
  ["shell", "--project", projectId, "--service", serviceId, "--command", command2],
10230
9093
  { stdio: "inherit" }
@@ -10248,8 +9111,8 @@ var RailwayProvider = class {
10248
9111
  const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
10249
9112
  const remoteCmd = `mkdir -p ${shellQuote4(remoteDir)} && tar -xzf - -C ${shellQuote4(remoteDir)}`;
10250
9113
  await new Promise((resolve2, reject) => {
10251
- const tar = (0, import_child_process12.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
10252
- const sh = (0, import_child_process12.spawn)(
9114
+ const tar = (0, import_child_process13.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
9115
+ const sh = (0, import_child_process13.spawn)(
10253
9116
  "railway",
10254
9117
  ["shell", "--project", projectId, "--service", serviceId, "--command", remoteCmd],
10255
9118
  { stdio: [tar.stdout, "pipe", "pipe"] }
@@ -10275,14 +9138,14 @@ var RailwayProvider = class {
10275
9138
  if (!projectId || !serviceId) {
10276
9139
  throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
10277
9140
  }
10278
- const remoteDir = path21.posix.dirname(remotePath);
9141
+ const remoteDir = path22.posix.dirname(remotePath);
10279
9142
  const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
10280
9143
  if (options.mode != null) {
10281
9144
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
10282
9145
  }
10283
9146
  const cmd = parts.join(" && ");
10284
9147
  await new Promise((resolve2, reject) => {
10285
- const proc = (0, import_child_process12.spawn)(
9148
+ const proc = (0, import_child_process13.spawn)(
10286
9149
  "railway",
10287
9150
  ["shell", "--project", projectId, "--service", serviceId, "--command", cmd],
10288
9151
  { stdio: ["pipe", "pipe", "pipe"] }
@@ -10817,7 +9680,7 @@ async function stopWorkspaceFromLocal(target) {
10817
9680
  // src/commands/version.ts
10818
9681
  var import_picocolors11 = __toESM(require("picocolors"));
10819
9682
  function version() {
10820
- const v = true ? "2.15.0" : "unknown";
9683
+ const v = true ? "2.15.2" : "unknown";
10821
9684
  console.log(`${import_picocolors11.default.bold("codeam-cli")} ${import_picocolors11.default.cyan(v)}`);
10822
9685
  }
10823
9686
 
@@ -10860,7 +9723,7 @@ function help() {
10860
9723
  // src/lib/updateNotifier.ts
10861
9724
  var fs16 = __toESM(require("fs"));
10862
9725
  var os15 = __toESM(require("os"));
10863
- var path22 = __toESM(require("path"));
9726
+ var path23 = __toESM(require("path"));
10864
9727
  var https5 = __toESM(require("https"));
10865
9728
  var import_picocolors13 = __toESM(require("picocolors"));
10866
9729
  var PKG_NAME = "codeam-cli";
@@ -10868,8 +9731,8 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
10868
9731
  var TTL_MS = 24 * 60 * 60 * 1e3;
10869
9732
  var REQUEST_TIMEOUT_MS = 1500;
10870
9733
  function cachePath() {
10871
- const dir = path22.join(os15.homedir(), ".codeam");
10872
- return path22.join(dir, "update-check.json");
9734
+ const dir = path23.join(os15.homedir(), ".codeam");
9735
+ return path23.join(dir, "update-check.json");
10873
9736
  }
10874
9737
  function readCache() {
10875
9738
  try {
@@ -10884,7 +9747,7 @@ function readCache() {
10884
9747
  function writeCache(cache) {
10885
9748
  try {
10886
9749
  const file = cachePath();
10887
- fs16.mkdirSync(path22.dirname(file), { recursive: true });
9750
+ fs16.mkdirSync(path23.dirname(file), { recursive: true });
10888
9751
  fs16.writeFileSync(file, JSON.stringify(cache));
10889
9752
  } catch {
10890
9753
  }
@@ -10956,7 +9819,7 @@ function checkForUpdates() {
10956
9819
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
10957
9820
  if (process.env.CI) return;
10958
9821
  if (!process.stdout.isTTY) return;
10959
- const current = true ? "2.15.0" : null;
9822
+ const current = true ? "2.15.2" : null;
10960
9823
  if (!current) return;
10961
9824
  const cache = readCache();
10962
9825
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;