replicas-cli 0.2.39 → 0.2.41
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 +14 -2
- package/dist/{index.js → chunk-IO4QHXPW.mjs} +750 -2649
- package/dist/index.mjs +2201 -0
- package/dist/interactive-EQDMW2E3.mjs +2011 -0
- package/package.json +13 -7
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
"use strict";
|
|
1
|
+
#!/usr/bin/env bun
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
10
15
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
16
|
};
|
|
12
|
-
var __export = (target, all) => {
|
|
13
|
-
for (var name in all)
|
|
14
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
-
};
|
|
16
17
|
var __copyProps = (to, from, except, desc) => {
|
|
17
18
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
19
|
for (let key of __getOwnPropNames(from))
|
|
@@ -29,11 +30,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
30
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
31
|
mod
|
|
31
32
|
));
|
|
32
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
33
|
|
|
34
|
-
// ../node_modules/yaml/dist/nodes/identity.js
|
|
34
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/identity.js
|
|
35
35
|
var require_identity = __commonJS({
|
|
36
|
-
"../node_modules/yaml/dist/nodes/identity.js"(
|
|
36
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/identity.js"(exports) {
|
|
37
37
|
"use strict";
|
|
38
38
|
var ALIAS = /* @__PURE__ */ Symbol.for("yaml.alias");
|
|
39
39
|
var DOC = /* @__PURE__ */ Symbol.for("yaml.document");
|
|
@@ -69,28 +69,28 @@ var require_identity = __commonJS({
|
|
|
69
69
|
return false;
|
|
70
70
|
}
|
|
71
71
|
var hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
exports.ALIAS = ALIAS;
|
|
73
|
+
exports.DOC = DOC;
|
|
74
|
+
exports.MAP = MAP;
|
|
75
|
+
exports.NODE_TYPE = NODE_TYPE;
|
|
76
|
+
exports.PAIR = PAIR;
|
|
77
|
+
exports.SCALAR = SCALAR;
|
|
78
|
+
exports.SEQ = SEQ;
|
|
79
|
+
exports.hasAnchor = hasAnchor;
|
|
80
|
+
exports.isAlias = isAlias;
|
|
81
|
+
exports.isCollection = isCollection;
|
|
82
|
+
exports.isDocument = isDocument;
|
|
83
|
+
exports.isMap = isMap;
|
|
84
|
+
exports.isNode = isNode;
|
|
85
|
+
exports.isPair = isPair;
|
|
86
|
+
exports.isScalar = isScalar;
|
|
87
|
+
exports.isSeq = isSeq;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
// ../node_modules/yaml/dist/visit.js
|
|
91
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/visit.js
|
|
92
92
|
var require_visit = __commonJS({
|
|
93
|
-
"../node_modules/yaml/dist/visit.js"(
|
|
93
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/visit.js"(exports) {
|
|
94
94
|
"use strict";
|
|
95
95
|
var identity = require_identity();
|
|
96
96
|
var BREAK = /* @__PURE__ */ Symbol("break visit");
|
|
@@ -108,17 +108,17 @@ var require_visit = __commonJS({
|
|
|
108
108
|
visit.BREAK = BREAK;
|
|
109
109
|
visit.SKIP = SKIP;
|
|
110
110
|
visit.REMOVE = REMOVE;
|
|
111
|
-
function visit_(key, node, visitor,
|
|
112
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
111
|
+
function visit_(key, node, visitor, path2) {
|
|
112
|
+
const ctrl = callVisitor(key, node, visitor, path2);
|
|
113
113
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
114
|
-
replaceNode(key,
|
|
115
|
-
return visit_(key, ctrl, visitor,
|
|
114
|
+
replaceNode(key, path2, ctrl);
|
|
115
|
+
return visit_(key, ctrl, visitor, path2);
|
|
116
116
|
}
|
|
117
117
|
if (typeof ctrl !== "symbol") {
|
|
118
118
|
if (identity.isCollection(node)) {
|
|
119
|
-
|
|
119
|
+
path2 = Object.freeze(path2.concat(node));
|
|
120
120
|
for (let i = 0; i < node.items.length; ++i) {
|
|
121
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
121
|
+
const ci = visit_(i, node.items[i], visitor, path2);
|
|
122
122
|
if (typeof ci === "number")
|
|
123
123
|
i = ci - 1;
|
|
124
124
|
else if (ci === BREAK)
|
|
@@ -129,13 +129,13 @@ var require_visit = __commonJS({
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
} else if (identity.isPair(node)) {
|
|
132
|
-
|
|
133
|
-
const ck = visit_("key", node.key, visitor,
|
|
132
|
+
path2 = Object.freeze(path2.concat(node));
|
|
133
|
+
const ck = visit_("key", node.key, visitor, path2);
|
|
134
134
|
if (ck === BREAK)
|
|
135
135
|
return BREAK;
|
|
136
136
|
else if (ck === REMOVE)
|
|
137
137
|
node.key = null;
|
|
138
|
-
const cv = visit_("value", node.value, visitor,
|
|
138
|
+
const cv = visit_("value", node.value, visitor, path2);
|
|
139
139
|
if (cv === BREAK)
|
|
140
140
|
return BREAK;
|
|
141
141
|
else if (cv === REMOVE)
|
|
@@ -156,17 +156,17 @@ var require_visit = __commonJS({
|
|
|
156
156
|
visitAsync.BREAK = BREAK;
|
|
157
157
|
visitAsync.SKIP = SKIP;
|
|
158
158
|
visitAsync.REMOVE = REMOVE;
|
|
159
|
-
async function visitAsync_(key, node, visitor,
|
|
160
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
159
|
+
async function visitAsync_(key, node, visitor, path2) {
|
|
160
|
+
const ctrl = await callVisitor(key, node, visitor, path2);
|
|
161
161
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
162
|
-
replaceNode(key,
|
|
163
|
-
return visitAsync_(key, ctrl, visitor,
|
|
162
|
+
replaceNode(key, path2, ctrl);
|
|
163
|
+
return visitAsync_(key, ctrl, visitor, path2);
|
|
164
164
|
}
|
|
165
165
|
if (typeof ctrl !== "symbol") {
|
|
166
166
|
if (identity.isCollection(node)) {
|
|
167
|
-
|
|
167
|
+
path2 = Object.freeze(path2.concat(node));
|
|
168
168
|
for (let i = 0; i < node.items.length; ++i) {
|
|
169
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
169
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path2);
|
|
170
170
|
if (typeof ci === "number")
|
|
171
171
|
i = ci - 1;
|
|
172
172
|
else if (ci === BREAK)
|
|
@@ -177,13 +177,13 @@ var require_visit = __commonJS({
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
} else if (identity.isPair(node)) {
|
|
180
|
-
|
|
181
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
180
|
+
path2 = Object.freeze(path2.concat(node));
|
|
181
|
+
const ck = await visitAsync_("key", node.key, visitor, path2);
|
|
182
182
|
if (ck === BREAK)
|
|
183
183
|
return BREAK;
|
|
184
184
|
else if (ck === REMOVE)
|
|
185
185
|
node.key = null;
|
|
186
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
186
|
+
const cv = await visitAsync_("value", node.value, visitor, path2);
|
|
187
187
|
if (cv === BREAK)
|
|
188
188
|
return BREAK;
|
|
189
189
|
else if (cv === REMOVE)
|
|
@@ -210,23 +210,23 @@ var require_visit = __commonJS({
|
|
|
210
210
|
}
|
|
211
211
|
return visitor;
|
|
212
212
|
}
|
|
213
|
-
function callVisitor(key, node, visitor,
|
|
213
|
+
function callVisitor(key, node, visitor, path2) {
|
|
214
214
|
if (typeof visitor === "function")
|
|
215
|
-
return visitor(key, node,
|
|
215
|
+
return visitor(key, node, path2);
|
|
216
216
|
if (identity.isMap(node))
|
|
217
|
-
return visitor.Map?.(key, node,
|
|
217
|
+
return visitor.Map?.(key, node, path2);
|
|
218
218
|
if (identity.isSeq(node))
|
|
219
|
-
return visitor.Seq?.(key, node,
|
|
219
|
+
return visitor.Seq?.(key, node, path2);
|
|
220
220
|
if (identity.isPair(node))
|
|
221
|
-
return visitor.Pair?.(key, node,
|
|
221
|
+
return visitor.Pair?.(key, node, path2);
|
|
222
222
|
if (identity.isScalar(node))
|
|
223
|
-
return visitor.Scalar?.(key, node,
|
|
223
|
+
return visitor.Scalar?.(key, node, path2);
|
|
224
224
|
if (identity.isAlias(node))
|
|
225
|
-
return visitor.Alias?.(key, node,
|
|
225
|
+
return visitor.Alias?.(key, node, path2);
|
|
226
226
|
return void 0;
|
|
227
227
|
}
|
|
228
|
-
function replaceNode(key,
|
|
229
|
-
const parent =
|
|
228
|
+
function replaceNode(key, path2, node) {
|
|
229
|
+
const parent = path2[path2.length - 1];
|
|
230
230
|
if (identity.isCollection(parent)) {
|
|
231
231
|
parent.items[key] = node;
|
|
232
232
|
} else if (identity.isPair(parent)) {
|
|
@@ -241,14 +241,14 @@ var require_visit = __commonJS({
|
|
|
241
241
|
throw new Error(`Cannot replace node with ${pt} parent`);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
exports.visit = visit;
|
|
245
|
+
exports.visitAsync = visitAsync;
|
|
246
246
|
}
|
|
247
247
|
});
|
|
248
248
|
|
|
249
|
-
// ../node_modules/yaml/dist/doc/directives.js
|
|
249
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/directives.js
|
|
250
250
|
var require_directives = __commonJS({
|
|
251
|
-
"../node_modules/yaml/dist/doc/directives.js"(
|
|
251
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/directives.js"(exports) {
|
|
252
252
|
"use strict";
|
|
253
253
|
var identity = require_identity();
|
|
254
254
|
var visit = require_visit();
|
|
@@ -413,13 +413,13 @@ var require_directives = __commonJS({
|
|
|
413
413
|
};
|
|
414
414
|
Directives.defaultYaml = { explicit: false, version: "1.2" };
|
|
415
415
|
Directives.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
416
|
-
|
|
416
|
+
exports.Directives = Directives;
|
|
417
417
|
}
|
|
418
418
|
});
|
|
419
419
|
|
|
420
|
-
// ../node_modules/yaml/dist/doc/anchors.js
|
|
420
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/anchors.js
|
|
421
421
|
var require_anchors = __commonJS({
|
|
422
|
-
"../node_modules/yaml/dist/doc/anchors.js"(
|
|
422
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/anchors.js"(exports) {
|
|
423
423
|
"use strict";
|
|
424
424
|
var identity = require_identity();
|
|
425
425
|
var visit = require_visit();
|
|
@@ -480,16 +480,16 @@ var require_anchors = __commonJS({
|
|
|
480
480
|
sourceObjects
|
|
481
481
|
};
|
|
482
482
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
483
|
+
exports.anchorIsValid = anchorIsValid;
|
|
484
|
+
exports.anchorNames = anchorNames;
|
|
485
|
+
exports.createNodeAnchors = createNodeAnchors;
|
|
486
|
+
exports.findNewAnchor = findNewAnchor;
|
|
487
487
|
}
|
|
488
488
|
});
|
|
489
489
|
|
|
490
|
-
// ../node_modules/yaml/dist/doc/applyReviver.js
|
|
490
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/applyReviver.js
|
|
491
491
|
var require_applyReviver = __commonJS({
|
|
492
|
-
"../node_modules/yaml/dist/doc/applyReviver.js"(
|
|
492
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/applyReviver.js"(exports) {
|
|
493
493
|
"use strict";
|
|
494
494
|
function applyReviver(reviver, obj, key, val) {
|
|
495
495
|
if (val && typeof val === "object") {
|
|
@@ -533,13 +533,13 @@ var require_applyReviver = __commonJS({
|
|
|
533
533
|
}
|
|
534
534
|
return reviver.call(obj, key, val);
|
|
535
535
|
}
|
|
536
|
-
|
|
536
|
+
exports.applyReviver = applyReviver;
|
|
537
537
|
}
|
|
538
538
|
});
|
|
539
539
|
|
|
540
|
-
// ../node_modules/yaml/dist/nodes/toJS.js
|
|
540
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/toJS.js
|
|
541
541
|
var require_toJS = __commonJS({
|
|
542
|
-
"../node_modules/yaml/dist/nodes/toJS.js"(
|
|
542
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/toJS.js"(exports) {
|
|
543
543
|
"use strict";
|
|
544
544
|
var identity = require_identity();
|
|
545
545
|
function toJS(value, arg, ctx) {
|
|
@@ -563,13 +563,13 @@ var require_toJS = __commonJS({
|
|
|
563
563
|
return Number(value);
|
|
564
564
|
return value;
|
|
565
565
|
}
|
|
566
|
-
|
|
566
|
+
exports.toJS = toJS;
|
|
567
567
|
}
|
|
568
568
|
});
|
|
569
569
|
|
|
570
|
-
// ../node_modules/yaml/dist/nodes/Node.js
|
|
570
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Node.js
|
|
571
571
|
var require_Node = __commonJS({
|
|
572
|
-
"../node_modules/yaml/dist/nodes/Node.js"(
|
|
572
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Node.js"(exports) {
|
|
573
573
|
"use strict";
|
|
574
574
|
var applyReviver = require_applyReviver();
|
|
575
575
|
var identity = require_identity();
|
|
@@ -604,13 +604,13 @@ var require_Node = __commonJS({
|
|
|
604
604
|
return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
|
|
605
605
|
}
|
|
606
606
|
};
|
|
607
|
-
|
|
607
|
+
exports.NodeBase = NodeBase;
|
|
608
608
|
}
|
|
609
609
|
});
|
|
610
610
|
|
|
611
|
-
// ../node_modules/yaml/dist/nodes/Alias.js
|
|
611
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Alias.js
|
|
612
612
|
var require_Alias = __commonJS({
|
|
613
|
-
"../node_modules/yaml/dist/nodes/Alias.js"(
|
|
613
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Alias.js"(exports) {
|
|
614
614
|
"use strict";
|
|
615
615
|
var anchors = require_anchors();
|
|
616
616
|
var visit = require_visit();
|
|
@@ -718,13 +718,13 @@ var require_Alias = __commonJS({
|
|
|
718
718
|
}
|
|
719
719
|
return 1;
|
|
720
720
|
}
|
|
721
|
-
|
|
721
|
+
exports.Alias = Alias;
|
|
722
722
|
}
|
|
723
723
|
});
|
|
724
724
|
|
|
725
|
-
// ../node_modules/yaml/dist/nodes/Scalar.js
|
|
725
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Scalar.js
|
|
726
726
|
var require_Scalar = __commonJS({
|
|
727
|
-
"../node_modules/yaml/dist/nodes/Scalar.js"(
|
|
727
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Scalar.js"(exports) {
|
|
728
728
|
"use strict";
|
|
729
729
|
var identity = require_identity();
|
|
730
730
|
var Node = require_Node();
|
|
@@ -747,14 +747,14 @@ var require_Scalar = __commonJS({
|
|
|
747
747
|
Scalar.PLAIN = "PLAIN";
|
|
748
748
|
Scalar.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
749
749
|
Scalar.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
750
|
-
|
|
751
|
-
|
|
750
|
+
exports.Scalar = Scalar;
|
|
751
|
+
exports.isScalarValue = isScalarValue;
|
|
752
752
|
}
|
|
753
753
|
});
|
|
754
754
|
|
|
755
|
-
// ../node_modules/yaml/dist/doc/createNode.js
|
|
755
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/createNode.js
|
|
756
756
|
var require_createNode = __commonJS({
|
|
757
|
-
"../node_modules/yaml/dist/doc/createNode.js"(
|
|
757
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/createNode.js"(exports) {
|
|
758
758
|
"use strict";
|
|
759
759
|
var Alias = require_Alias();
|
|
760
760
|
var identity = require_identity();
|
|
@@ -823,21 +823,21 @@ var require_createNode = __commonJS({
|
|
|
823
823
|
ref.node = node;
|
|
824
824
|
return node;
|
|
825
825
|
}
|
|
826
|
-
|
|
826
|
+
exports.createNode = createNode;
|
|
827
827
|
}
|
|
828
828
|
});
|
|
829
829
|
|
|
830
|
-
// ../node_modules/yaml/dist/nodes/Collection.js
|
|
830
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Collection.js
|
|
831
831
|
var require_Collection = __commonJS({
|
|
832
|
-
"../node_modules/yaml/dist/nodes/Collection.js"(
|
|
832
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Collection.js"(exports) {
|
|
833
833
|
"use strict";
|
|
834
834
|
var createNode = require_createNode();
|
|
835
835
|
var identity = require_identity();
|
|
836
836
|
var Node = require_Node();
|
|
837
|
-
function collectionFromPath(schema,
|
|
837
|
+
function collectionFromPath(schema, path2, value) {
|
|
838
838
|
let v = value;
|
|
839
|
-
for (let i =
|
|
840
|
-
const k =
|
|
839
|
+
for (let i = path2.length - 1; i >= 0; --i) {
|
|
840
|
+
const k = path2[i];
|
|
841
841
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
842
842
|
const a = [];
|
|
843
843
|
a[k] = v;
|
|
@@ -856,7 +856,7 @@ var require_Collection = __commonJS({
|
|
|
856
856
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
857
857
|
});
|
|
858
858
|
}
|
|
859
|
-
var isEmptyPath = (
|
|
859
|
+
var isEmptyPath = (path2) => path2 == null || typeof path2 === "object" && !!path2[Symbol.iterator]().next().done;
|
|
860
860
|
var Collection = class extends Node.NodeBase {
|
|
861
861
|
constructor(type, schema) {
|
|
862
862
|
super(type);
|
|
@@ -886,11 +886,11 @@ var require_Collection = __commonJS({
|
|
|
886
886
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
887
887
|
* that already exists in the map.
|
|
888
888
|
*/
|
|
889
|
-
addIn(
|
|
890
|
-
if (isEmptyPath(
|
|
889
|
+
addIn(path2, value) {
|
|
890
|
+
if (isEmptyPath(path2))
|
|
891
891
|
this.add(value);
|
|
892
892
|
else {
|
|
893
|
-
const [key, ...rest] =
|
|
893
|
+
const [key, ...rest] = path2;
|
|
894
894
|
const node = this.get(key, true);
|
|
895
895
|
if (identity.isCollection(node))
|
|
896
896
|
node.addIn(rest, value);
|
|
@@ -904,8 +904,8 @@ var require_Collection = __commonJS({
|
|
|
904
904
|
* Removes a value from the collection.
|
|
905
905
|
* @returns `true` if the item was found and removed.
|
|
906
906
|
*/
|
|
907
|
-
deleteIn(
|
|
908
|
-
const [key, ...rest] =
|
|
907
|
+
deleteIn(path2) {
|
|
908
|
+
const [key, ...rest] = path2;
|
|
909
909
|
if (rest.length === 0)
|
|
910
910
|
return this.delete(key);
|
|
911
911
|
const node = this.get(key, true);
|
|
@@ -919,8 +919,8 @@ var require_Collection = __commonJS({
|
|
|
919
919
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
920
920
|
* `true` (collections are always returned intact).
|
|
921
921
|
*/
|
|
922
|
-
getIn(
|
|
923
|
-
const [key, ...rest] =
|
|
922
|
+
getIn(path2, keepScalar) {
|
|
923
|
+
const [key, ...rest] = path2;
|
|
924
924
|
const node = this.get(key, true);
|
|
925
925
|
if (rest.length === 0)
|
|
926
926
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -938,8 +938,8 @@ var require_Collection = __commonJS({
|
|
|
938
938
|
/**
|
|
939
939
|
* Checks if the collection includes a value with the key `key`.
|
|
940
940
|
*/
|
|
941
|
-
hasIn(
|
|
942
|
-
const [key, ...rest] =
|
|
941
|
+
hasIn(path2) {
|
|
942
|
+
const [key, ...rest] = path2;
|
|
943
943
|
if (rest.length === 0)
|
|
944
944
|
return this.has(key);
|
|
945
945
|
const node = this.get(key, true);
|
|
@@ -949,8 +949,8 @@ var require_Collection = __commonJS({
|
|
|
949
949
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
950
950
|
* boolean to add/remove the item from the set.
|
|
951
951
|
*/
|
|
952
|
-
setIn(
|
|
953
|
-
const [key, ...rest] =
|
|
952
|
+
setIn(path2, value) {
|
|
953
|
+
const [key, ...rest] = path2;
|
|
954
954
|
if (rest.length === 0) {
|
|
955
955
|
this.set(key, value);
|
|
956
956
|
} else {
|
|
@@ -964,15 +964,15 @@ var require_Collection = __commonJS({
|
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
966
|
};
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
967
|
+
exports.Collection = Collection;
|
|
968
|
+
exports.collectionFromPath = collectionFromPath;
|
|
969
|
+
exports.isEmptyPath = isEmptyPath;
|
|
970
970
|
}
|
|
971
971
|
});
|
|
972
972
|
|
|
973
|
-
// ../node_modules/yaml/dist/stringify/stringifyComment.js
|
|
973
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
974
974
|
var require_stringifyComment = __commonJS({
|
|
975
|
-
"../node_modules/yaml/dist/stringify/stringifyComment.js"(
|
|
975
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyComment.js"(exports) {
|
|
976
976
|
"use strict";
|
|
977
977
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
978
978
|
function indentComment(comment, indent) {
|
|
@@ -981,15 +981,15 @@ var require_stringifyComment = __commonJS({
|
|
|
981
981
|
return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
|
|
982
982
|
}
|
|
983
983
|
var lineComment = (str, indent, comment) => str.endsWith("\n") ? indentComment(comment, indent) : comment.includes("\n") ? "\n" + indentComment(comment, indent) : (str.endsWith(" ") ? "" : " ") + comment;
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
984
|
+
exports.indentComment = indentComment;
|
|
985
|
+
exports.lineComment = lineComment;
|
|
986
|
+
exports.stringifyComment = stringifyComment;
|
|
987
987
|
}
|
|
988
988
|
});
|
|
989
989
|
|
|
990
|
-
// ../node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
990
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
991
991
|
var require_foldFlowLines = __commonJS({
|
|
992
|
-
"../node_modules/yaml/dist/stringify/foldFlowLines.js"(
|
|
992
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/foldFlowLines.js"(exports) {
|
|
993
993
|
"use strict";
|
|
994
994
|
var FOLD_FLOW = "flow";
|
|
995
995
|
var FOLD_BLOCK = "block";
|
|
@@ -1116,16 +1116,16 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
1116
1116
|
}
|
|
1117
1117
|
return end;
|
|
1118
1118
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1119
|
+
exports.FOLD_BLOCK = FOLD_BLOCK;
|
|
1120
|
+
exports.FOLD_FLOW = FOLD_FLOW;
|
|
1121
|
+
exports.FOLD_QUOTED = FOLD_QUOTED;
|
|
1122
|
+
exports.foldFlowLines = foldFlowLines;
|
|
1123
1123
|
}
|
|
1124
1124
|
});
|
|
1125
1125
|
|
|
1126
|
-
// ../node_modules/yaml/dist/stringify/stringifyString.js
|
|
1126
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyString.js
|
|
1127
1127
|
var require_stringifyString = __commonJS({
|
|
1128
|
-
"../node_modules/yaml/dist/stringify/stringifyString.js"(
|
|
1128
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyString.js"(exports) {
|
|
1129
1129
|
"use strict";
|
|
1130
1130
|
var Scalar = require_Scalar();
|
|
1131
1131
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -1402,13 +1402,13 @@ ${indent}`);
|
|
|
1402
1402
|
}
|
|
1403
1403
|
return res;
|
|
1404
1404
|
}
|
|
1405
|
-
|
|
1405
|
+
exports.stringifyString = stringifyString;
|
|
1406
1406
|
}
|
|
1407
1407
|
});
|
|
1408
1408
|
|
|
1409
|
-
// ../node_modules/yaml/dist/stringify/stringify.js
|
|
1409
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringify.js
|
|
1410
1410
|
var require_stringify = __commonJS({
|
|
1411
|
-
"../node_modules/yaml/dist/stringify/stringify.js"(
|
|
1411
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringify.js"(exports) {
|
|
1412
1412
|
"use strict";
|
|
1413
1413
|
var anchors = require_anchors();
|
|
1414
1414
|
var identity = require_identity();
|
|
@@ -1431,6 +1431,7 @@ var require_stringify = __commonJS({
|
|
|
1431
1431
|
nullStr: "null",
|
|
1432
1432
|
simpleKeys: false,
|
|
1433
1433
|
singleQuote: null,
|
|
1434
|
+
trailingComma: false,
|
|
1434
1435
|
trueStr: "true",
|
|
1435
1436
|
verifyAliasOrder: true
|
|
1436
1437
|
}, doc.schema.toStringOptions, options);
|
|
@@ -1524,14 +1525,14 @@ var require_stringify = __commonJS({
|
|
|
1524
1525
|
return identity.isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
|
|
1525
1526
|
${ctx.indent}${str}`;
|
|
1526
1527
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1528
|
+
exports.createStringifyContext = createStringifyContext;
|
|
1529
|
+
exports.stringify = stringify;
|
|
1529
1530
|
}
|
|
1530
1531
|
});
|
|
1531
1532
|
|
|
1532
|
-
// ../node_modules/yaml/dist/stringify/stringifyPair.js
|
|
1533
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
1533
1534
|
var require_stringifyPair = __commonJS({
|
|
1534
|
-
"../node_modules/yaml/dist/stringify/stringifyPair.js"(
|
|
1535
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyPair.js"(exports) {
|
|
1535
1536
|
"use strict";
|
|
1536
1537
|
var identity = require_identity();
|
|
1537
1538
|
var Scalar = require_Scalar();
|
|
@@ -1658,15 +1659,15 @@ ${ctx.indent}`;
|
|
|
1658
1659
|
}
|
|
1659
1660
|
return str;
|
|
1660
1661
|
}
|
|
1661
|
-
|
|
1662
|
+
exports.stringifyPair = stringifyPair;
|
|
1662
1663
|
}
|
|
1663
1664
|
});
|
|
1664
1665
|
|
|
1665
|
-
// ../node_modules/yaml/dist/log.js
|
|
1666
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/log.js
|
|
1666
1667
|
var require_log = __commonJS({
|
|
1667
|
-
"../node_modules/yaml/dist/log.js"(
|
|
1668
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/log.js"(exports) {
|
|
1668
1669
|
"use strict";
|
|
1669
|
-
var node_process =
|
|
1670
|
+
var node_process = __require("process");
|
|
1670
1671
|
function debug(logLevel, ...messages) {
|
|
1671
1672
|
if (logLevel === "debug")
|
|
1672
1673
|
console.log(...messages);
|
|
@@ -1679,14 +1680,14 @@ var require_log = __commonJS({
|
|
|
1679
1680
|
console.warn(warning);
|
|
1680
1681
|
}
|
|
1681
1682
|
}
|
|
1682
|
-
|
|
1683
|
-
|
|
1683
|
+
exports.debug = debug;
|
|
1684
|
+
exports.warn = warn;
|
|
1684
1685
|
}
|
|
1685
1686
|
});
|
|
1686
1687
|
|
|
1687
|
-
// ../node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
1688
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
1688
1689
|
var require_merge = __commonJS({
|
|
1689
|
-
"../node_modules/yaml/dist/schema/yaml-1.1/merge.js"(
|
|
1690
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/merge.js"(exports) {
|
|
1690
1691
|
"use strict";
|
|
1691
1692
|
var identity = require_identity();
|
|
1692
1693
|
var Scalar = require_Scalar();
|
|
@@ -1735,15 +1736,15 @@ var require_merge = __commonJS({
|
|
|
1735
1736
|
}
|
|
1736
1737
|
return map;
|
|
1737
1738
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1739
|
+
exports.addMergeToJSMap = addMergeToJSMap;
|
|
1740
|
+
exports.isMergeKey = isMergeKey;
|
|
1741
|
+
exports.merge = merge;
|
|
1741
1742
|
}
|
|
1742
1743
|
});
|
|
1743
1744
|
|
|
1744
|
-
// ../node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
1745
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
1745
1746
|
var require_addPairToJSMap = __commonJS({
|
|
1746
|
-
"../node_modules/yaml/dist/nodes/addPairToJSMap.js"(
|
|
1747
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/addPairToJSMap.js"(exports) {
|
|
1747
1748
|
"use strict";
|
|
1748
1749
|
var log = require_log();
|
|
1749
1750
|
var merge = require_merge();
|
|
@@ -1801,13 +1802,13 @@ var require_addPairToJSMap = __commonJS({
|
|
|
1801
1802
|
}
|
|
1802
1803
|
return JSON.stringify(jsKey);
|
|
1803
1804
|
}
|
|
1804
|
-
|
|
1805
|
+
exports.addPairToJSMap = addPairToJSMap;
|
|
1805
1806
|
}
|
|
1806
1807
|
});
|
|
1807
1808
|
|
|
1808
|
-
// ../node_modules/yaml/dist/nodes/Pair.js
|
|
1809
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Pair.js
|
|
1809
1810
|
var require_Pair = __commonJS({
|
|
1810
|
-
"../node_modules/yaml/dist/nodes/Pair.js"(
|
|
1811
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Pair.js"(exports) {
|
|
1811
1812
|
"use strict";
|
|
1812
1813
|
var createNode = require_createNode();
|
|
1813
1814
|
var stringifyPair = require_stringifyPair();
|
|
@@ -1840,14 +1841,14 @@ var require_Pair = __commonJS({
|
|
|
1840
1841
|
return ctx?.doc ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep) : JSON.stringify(this);
|
|
1841
1842
|
}
|
|
1842
1843
|
};
|
|
1843
|
-
|
|
1844
|
-
|
|
1844
|
+
exports.Pair = Pair;
|
|
1845
|
+
exports.createPair = createPair;
|
|
1845
1846
|
}
|
|
1846
1847
|
});
|
|
1847
1848
|
|
|
1848
|
-
// ../node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
1849
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
1849
1850
|
var require_stringifyCollection = __commonJS({
|
|
1850
|
-
"../node_modules/yaml/dist/stringify/stringifyCollection.js"(
|
|
1851
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports) {
|
|
1851
1852
|
"use strict";
|
|
1852
1853
|
var identity = require_identity();
|
|
1853
1854
|
var stringify = require_stringify();
|
|
@@ -1948,12 +1949,19 @@ ${indent}${line}` : "\n";
|
|
|
1948
1949
|
if (comment)
|
|
1949
1950
|
reqNewline = true;
|
|
1950
1951
|
let str = stringify.stringify(item, itemCtx, () => comment = null);
|
|
1951
|
-
|
|
1952
|
+
reqNewline || (reqNewline = lines.length > linesAtValue || str.includes("\n"));
|
|
1953
|
+
if (i < items.length - 1) {
|
|
1952
1954
|
str += ",";
|
|
1955
|
+
} else if (ctx.options.trailingComma) {
|
|
1956
|
+
if (ctx.options.lineWidth > 0) {
|
|
1957
|
+
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str.length + 2) > ctx.options.lineWidth);
|
|
1958
|
+
}
|
|
1959
|
+
if (reqNewline) {
|
|
1960
|
+
str += ",";
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1953
1963
|
if (comment)
|
|
1954
1964
|
str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
|
|
1955
|
-
if (!reqNewline && (lines.length > linesAtValue || str.includes("\n")))
|
|
1956
|
-
reqNewline = true;
|
|
1957
1965
|
lines.push(str);
|
|
1958
1966
|
linesAtValue = lines.length;
|
|
1959
1967
|
}
|
|
@@ -1985,13 +1993,13 @@ ${indent}${end}`;
|
|
|
1985
1993
|
lines.push(ic.trimStart());
|
|
1986
1994
|
}
|
|
1987
1995
|
}
|
|
1988
|
-
|
|
1996
|
+
exports.stringifyCollection = stringifyCollection;
|
|
1989
1997
|
}
|
|
1990
1998
|
});
|
|
1991
1999
|
|
|
1992
|
-
// ../node_modules/yaml/dist/nodes/YAMLMap.js
|
|
2000
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
1993
2001
|
var require_YAMLMap = __commonJS({
|
|
1994
|
-
"../node_modules/yaml/dist/nodes/YAMLMap.js"(
|
|
2002
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLMap.js"(exports) {
|
|
1995
2003
|
"use strict";
|
|
1996
2004
|
var stringifyCollection = require_stringifyCollection();
|
|
1997
2005
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -2128,14 +2136,14 @@ var require_YAMLMap = __commonJS({
|
|
|
2128
2136
|
});
|
|
2129
2137
|
}
|
|
2130
2138
|
};
|
|
2131
|
-
|
|
2132
|
-
|
|
2139
|
+
exports.YAMLMap = YAMLMap;
|
|
2140
|
+
exports.findPair = findPair;
|
|
2133
2141
|
}
|
|
2134
2142
|
});
|
|
2135
2143
|
|
|
2136
|
-
// ../node_modules/yaml/dist/schema/common/map.js
|
|
2144
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/map.js
|
|
2137
2145
|
var require_map = __commonJS({
|
|
2138
|
-
"../node_modules/yaml/dist/schema/common/map.js"(
|
|
2146
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/map.js"(exports) {
|
|
2139
2147
|
"use strict";
|
|
2140
2148
|
var identity = require_identity();
|
|
2141
2149
|
var YAMLMap = require_YAMLMap();
|
|
@@ -2151,13 +2159,13 @@ var require_map = __commonJS({
|
|
|
2151
2159
|
},
|
|
2152
2160
|
createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)
|
|
2153
2161
|
};
|
|
2154
|
-
|
|
2162
|
+
exports.map = map;
|
|
2155
2163
|
}
|
|
2156
2164
|
});
|
|
2157
2165
|
|
|
2158
|
-
// ../node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
2166
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
2159
2167
|
var require_YAMLSeq = __commonJS({
|
|
2160
|
-
"../node_modules/yaml/dist/nodes/YAMLSeq.js"(
|
|
2168
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLSeq.js"(exports) {
|
|
2161
2169
|
"use strict";
|
|
2162
2170
|
var createNode = require_createNode();
|
|
2163
2171
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -2267,13 +2275,13 @@ var require_YAMLSeq = __commonJS({
|
|
|
2267
2275
|
idx = Number(idx);
|
|
2268
2276
|
return typeof idx === "number" && Number.isInteger(idx) && idx >= 0 ? idx : null;
|
|
2269
2277
|
}
|
|
2270
|
-
|
|
2278
|
+
exports.YAMLSeq = YAMLSeq;
|
|
2271
2279
|
}
|
|
2272
2280
|
});
|
|
2273
2281
|
|
|
2274
|
-
// ../node_modules/yaml/dist/schema/common/seq.js
|
|
2282
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/seq.js
|
|
2275
2283
|
var require_seq = __commonJS({
|
|
2276
|
-
"../node_modules/yaml/dist/schema/common/seq.js"(
|
|
2284
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/seq.js"(exports) {
|
|
2277
2285
|
"use strict";
|
|
2278
2286
|
var identity = require_identity();
|
|
2279
2287
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -2289,13 +2297,13 @@ var require_seq = __commonJS({
|
|
|
2289
2297
|
},
|
|
2290
2298
|
createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)
|
|
2291
2299
|
};
|
|
2292
|
-
|
|
2300
|
+
exports.seq = seq;
|
|
2293
2301
|
}
|
|
2294
2302
|
});
|
|
2295
2303
|
|
|
2296
|
-
// ../node_modules/yaml/dist/schema/common/string.js
|
|
2304
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/string.js
|
|
2297
2305
|
var require_string = __commonJS({
|
|
2298
|
-
"../node_modules/yaml/dist/schema/common/string.js"(
|
|
2306
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/string.js"(exports) {
|
|
2299
2307
|
"use strict";
|
|
2300
2308
|
var stringifyString = require_stringifyString();
|
|
2301
2309
|
var string = {
|
|
@@ -2308,13 +2316,13 @@ var require_string = __commonJS({
|
|
|
2308
2316
|
return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
|
|
2309
2317
|
}
|
|
2310
2318
|
};
|
|
2311
|
-
|
|
2319
|
+
exports.string = string;
|
|
2312
2320
|
}
|
|
2313
2321
|
});
|
|
2314
2322
|
|
|
2315
|
-
// ../node_modules/yaml/dist/schema/common/null.js
|
|
2323
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/null.js
|
|
2316
2324
|
var require_null = __commonJS({
|
|
2317
|
-
"../node_modules/yaml/dist/schema/common/null.js"(
|
|
2325
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/null.js"(exports) {
|
|
2318
2326
|
"use strict";
|
|
2319
2327
|
var Scalar = require_Scalar();
|
|
2320
2328
|
var nullTag = {
|
|
@@ -2326,13 +2334,13 @@ var require_null = __commonJS({
|
|
|
2326
2334
|
resolve: () => new Scalar.Scalar(null),
|
|
2327
2335
|
stringify: ({ source }, ctx) => typeof source === "string" && nullTag.test.test(source) ? source : ctx.options.nullStr
|
|
2328
2336
|
};
|
|
2329
|
-
|
|
2337
|
+
exports.nullTag = nullTag;
|
|
2330
2338
|
}
|
|
2331
2339
|
});
|
|
2332
2340
|
|
|
2333
|
-
// ../node_modules/yaml/dist/schema/core/bool.js
|
|
2341
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/bool.js
|
|
2334
2342
|
var require_bool = __commonJS({
|
|
2335
|
-
"../node_modules/yaml/dist/schema/core/bool.js"(
|
|
2343
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/bool.js"(exports) {
|
|
2336
2344
|
"use strict";
|
|
2337
2345
|
var Scalar = require_Scalar();
|
|
2338
2346
|
var boolTag = {
|
|
@@ -2350,13 +2358,13 @@ var require_bool = __commonJS({
|
|
|
2350
2358
|
return value ? ctx.options.trueStr : ctx.options.falseStr;
|
|
2351
2359
|
}
|
|
2352
2360
|
};
|
|
2353
|
-
|
|
2361
|
+
exports.boolTag = boolTag;
|
|
2354
2362
|
}
|
|
2355
2363
|
});
|
|
2356
2364
|
|
|
2357
|
-
// ../node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
2365
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
2358
2366
|
var require_stringifyNumber = __commonJS({
|
|
2359
|
-
"../node_modules/yaml/dist/stringify/stringifyNumber.js"(
|
|
2367
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyNumber.js"(exports) {
|
|
2360
2368
|
"use strict";
|
|
2361
2369
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
2362
2370
|
if (typeof value === "bigint")
|
|
@@ -2377,13 +2385,13 @@ var require_stringifyNumber = __commonJS({
|
|
|
2377
2385
|
}
|
|
2378
2386
|
return n;
|
|
2379
2387
|
}
|
|
2380
|
-
|
|
2388
|
+
exports.stringifyNumber = stringifyNumber;
|
|
2381
2389
|
}
|
|
2382
2390
|
});
|
|
2383
2391
|
|
|
2384
|
-
// ../node_modules/yaml/dist/schema/core/float.js
|
|
2392
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/float.js
|
|
2385
2393
|
var require_float = __commonJS({
|
|
2386
|
-
"../node_modules/yaml/dist/schema/core/float.js"(
|
|
2394
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/float.js"(exports) {
|
|
2387
2395
|
"use strict";
|
|
2388
2396
|
var Scalar = require_Scalar();
|
|
2389
2397
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -2421,15 +2429,15 @@ var require_float = __commonJS({
|
|
|
2421
2429
|
},
|
|
2422
2430
|
stringify: stringifyNumber.stringifyNumber
|
|
2423
2431
|
};
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2432
|
+
exports.float = float;
|
|
2433
|
+
exports.floatExp = floatExp;
|
|
2434
|
+
exports.floatNaN = floatNaN;
|
|
2427
2435
|
}
|
|
2428
2436
|
});
|
|
2429
2437
|
|
|
2430
|
-
// ../node_modules/yaml/dist/schema/core/int.js
|
|
2438
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/int.js
|
|
2431
2439
|
var require_int = __commonJS({
|
|
2432
|
-
"../node_modules/yaml/dist/schema/core/int.js"(
|
|
2440
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/int.js"(exports) {
|
|
2433
2441
|
"use strict";
|
|
2434
2442
|
var stringifyNumber = require_stringifyNumber();
|
|
2435
2443
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -2466,15 +2474,15 @@ var require_int = __commonJS({
|
|
|
2466
2474
|
resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
|
|
2467
2475
|
stringify: (node) => intStringify(node, 16, "0x")
|
|
2468
2476
|
};
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2477
|
+
exports.int = int;
|
|
2478
|
+
exports.intHex = intHex;
|
|
2479
|
+
exports.intOct = intOct;
|
|
2472
2480
|
}
|
|
2473
2481
|
});
|
|
2474
2482
|
|
|
2475
|
-
// ../node_modules/yaml/dist/schema/core/schema.js
|
|
2483
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/schema.js
|
|
2476
2484
|
var require_schema = __commonJS({
|
|
2477
|
-
"../node_modules/yaml/dist/schema/core/schema.js"(
|
|
2485
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/schema.js"(exports) {
|
|
2478
2486
|
"use strict";
|
|
2479
2487
|
var map = require_map();
|
|
2480
2488
|
var _null = require_null();
|
|
@@ -2496,13 +2504,13 @@ var require_schema = __commonJS({
|
|
|
2496
2504
|
float.floatExp,
|
|
2497
2505
|
float.float
|
|
2498
2506
|
];
|
|
2499
|
-
|
|
2507
|
+
exports.schema = schema;
|
|
2500
2508
|
}
|
|
2501
2509
|
});
|
|
2502
2510
|
|
|
2503
|
-
// ../node_modules/yaml/dist/schema/json/schema.js
|
|
2511
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/json/schema.js
|
|
2504
2512
|
var require_schema2 = __commonJS({
|
|
2505
|
-
"../node_modules/yaml/dist/schema/json/schema.js"(
|
|
2513
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/json/schema.js"(exports) {
|
|
2506
2514
|
"use strict";
|
|
2507
2515
|
var Scalar = require_Scalar();
|
|
2508
2516
|
var map = require_map();
|
|
@@ -2563,15 +2571,15 @@ var require_schema2 = __commonJS({
|
|
|
2563
2571
|
}
|
|
2564
2572
|
};
|
|
2565
2573
|
var schema = [map.map, seq.seq].concat(jsonScalars, jsonError);
|
|
2566
|
-
|
|
2574
|
+
exports.schema = schema;
|
|
2567
2575
|
}
|
|
2568
2576
|
});
|
|
2569
2577
|
|
|
2570
|
-
// ../node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
2578
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
2571
2579
|
var require_binary = __commonJS({
|
|
2572
|
-
"../node_modules/yaml/dist/schema/yaml-1.1/binary.js"(
|
|
2580
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/binary.js"(exports) {
|
|
2573
2581
|
"use strict";
|
|
2574
|
-
var node_buffer =
|
|
2582
|
+
var node_buffer = __require("buffer");
|
|
2575
2583
|
var Scalar = require_Scalar();
|
|
2576
2584
|
var stringifyString = require_stringifyString();
|
|
2577
2585
|
var binary = {
|
|
@@ -2629,13 +2637,13 @@ var require_binary = __commonJS({
|
|
|
2629
2637
|
return stringifyString.stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
|
|
2630
2638
|
}
|
|
2631
2639
|
};
|
|
2632
|
-
|
|
2640
|
+
exports.binary = binary;
|
|
2633
2641
|
}
|
|
2634
2642
|
});
|
|
2635
2643
|
|
|
2636
|
-
// ../node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
2644
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
2637
2645
|
var require_pairs = __commonJS({
|
|
2638
|
-
"../node_modules/yaml/dist/schema/yaml-1.1/pairs.js"(
|
|
2646
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/pairs.js"(exports) {
|
|
2639
2647
|
"use strict";
|
|
2640
2648
|
var identity = require_identity();
|
|
2641
2649
|
var Pair = require_Pair();
|
|
@@ -2705,15 +2713,15 @@ ${cn.comment}` : item.comment;
|
|
|
2705
2713
|
resolve: resolvePairs,
|
|
2706
2714
|
createNode: createPairs
|
|
2707
2715
|
};
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2716
|
+
exports.createPairs = createPairs;
|
|
2717
|
+
exports.pairs = pairs;
|
|
2718
|
+
exports.resolvePairs = resolvePairs;
|
|
2711
2719
|
}
|
|
2712
2720
|
});
|
|
2713
2721
|
|
|
2714
|
-
// ../node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
2722
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
2715
2723
|
var require_omap = __commonJS({
|
|
2716
|
-
"../node_modules/yaml/dist/schema/yaml-1.1/omap.js"(
|
|
2724
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/omap.js"(exports) {
|
|
2717
2725
|
"use strict";
|
|
2718
2726
|
var identity = require_identity();
|
|
2719
2727
|
var toJS = require_toJS();
|
|
@@ -2784,14 +2792,14 @@ var require_omap = __commonJS({
|
|
|
2784
2792
|
},
|
|
2785
2793
|
createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)
|
|
2786
2794
|
};
|
|
2787
|
-
|
|
2788
|
-
|
|
2795
|
+
exports.YAMLOMap = YAMLOMap;
|
|
2796
|
+
exports.omap = omap;
|
|
2789
2797
|
}
|
|
2790
2798
|
});
|
|
2791
2799
|
|
|
2792
|
-
// ../node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
2800
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
2793
2801
|
var require_bool2 = __commonJS({
|
|
2794
|
-
"../node_modules/yaml/dist/schema/yaml-1.1/bool.js"(
|
|
2802
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/bool.js"(exports) {
|
|
2795
2803
|
"use strict";
|
|
2796
2804
|
var Scalar = require_Scalar();
|
|
2797
2805
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -2816,14 +2824,14 @@ var require_bool2 = __commonJS({
|
|
|
2816
2824
|
resolve: () => new Scalar.Scalar(false),
|
|
2817
2825
|
stringify: boolStringify
|
|
2818
2826
|
};
|
|
2819
|
-
|
|
2820
|
-
|
|
2827
|
+
exports.falseTag = falseTag;
|
|
2828
|
+
exports.trueTag = trueTag;
|
|
2821
2829
|
}
|
|
2822
2830
|
});
|
|
2823
2831
|
|
|
2824
|
-
// ../node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
2832
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
2825
2833
|
var require_float2 = __commonJS({
|
|
2826
|
-
"../node_modules/yaml/dist/schema/yaml-1.1/float.js"(
|
|
2834
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/float.js"(exports) {
|
|
2827
2835
|
"use strict";
|
|
2828
2836
|
var Scalar = require_Scalar();
|
|
2829
2837
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -2864,15 +2872,15 @@ var require_float2 = __commonJS({
|
|
|
2864
2872
|
},
|
|
2865
2873
|
stringify: stringifyNumber.stringifyNumber
|
|
2866
2874
|
};
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2875
|
+
exports.float = float;
|
|
2876
|
+
exports.floatExp = floatExp;
|
|
2877
|
+
exports.floatNaN = floatNaN;
|
|
2870
2878
|
}
|
|
2871
2879
|
});
|
|
2872
2880
|
|
|
2873
|
-
// ../node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
2881
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
2874
2882
|
var require_int2 = __commonJS({
|
|
2875
|
-
"../node_modules/yaml/dist/schema/yaml-1.1/int.js"(
|
|
2883
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/int.js"(exports) {
|
|
2876
2884
|
"use strict";
|
|
2877
2885
|
var stringifyNumber = require_stringifyNumber();
|
|
2878
2886
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -2942,16 +2950,16 @@ var require_int2 = __commonJS({
|
|
|
2942
2950
|
resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
|
|
2943
2951
|
stringify: (node) => intStringify(node, 16, "0x")
|
|
2944
2952
|
};
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2953
|
+
exports.int = int;
|
|
2954
|
+
exports.intBin = intBin;
|
|
2955
|
+
exports.intHex = intHex;
|
|
2956
|
+
exports.intOct = intOct;
|
|
2949
2957
|
}
|
|
2950
2958
|
});
|
|
2951
2959
|
|
|
2952
|
-
// ../node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
2960
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
2953
2961
|
var require_set = __commonJS({
|
|
2954
|
-
"../node_modules/yaml/dist/schema/yaml-1.1/set.js"(
|
|
2962
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/set.js"(exports) {
|
|
2955
2963
|
"use strict";
|
|
2956
2964
|
var identity = require_identity();
|
|
2957
2965
|
var Pair = require_Pair();
|
|
@@ -3033,14 +3041,14 @@ var require_set = __commonJS({
|
|
|
3033
3041
|
return map;
|
|
3034
3042
|
}
|
|
3035
3043
|
};
|
|
3036
|
-
|
|
3037
|
-
|
|
3044
|
+
exports.YAMLSet = YAMLSet;
|
|
3045
|
+
exports.set = set;
|
|
3038
3046
|
}
|
|
3039
3047
|
});
|
|
3040
3048
|
|
|
3041
|
-
// ../node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
3049
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
3042
3050
|
var require_timestamp = __commonJS({
|
|
3043
|
-
"../node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(
|
|
3051
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports) {
|
|
3044
3052
|
"use strict";
|
|
3045
3053
|
var stringifyNumber = require_stringifyNumber();
|
|
3046
3054
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -3120,15 +3128,15 @@ var require_timestamp = __commonJS({
|
|
|
3120
3128
|
},
|
|
3121
3129
|
stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
3122
3130
|
};
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3131
|
+
exports.floatTime = floatTime;
|
|
3132
|
+
exports.intTime = intTime;
|
|
3133
|
+
exports.timestamp = timestamp;
|
|
3126
3134
|
}
|
|
3127
3135
|
});
|
|
3128
3136
|
|
|
3129
|
-
// ../node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
3137
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
3130
3138
|
var require_schema3 = __commonJS({
|
|
3131
|
-
"../node_modules/yaml/dist/schema/yaml-1.1/schema.js"(
|
|
3139
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/schema.js"(exports) {
|
|
3132
3140
|
"use strict";
|
|
3133
3141
|
var map = require_map();
|
|
3134
3142
|
var _null = require_null();
|
|
@@ -3166,13 +3174,13 @@ var require_schema3 = __commonJS({
|
|
|
3166
3174
|
timestamp.floatTime,
|
|
3167
3175
|
timestamp.timestamp
|
|
3168
3176
|
];
|
|
3169
|
-
|
|
3177
|
+
exports.schema = schema;
|
|
3170
3178
|
}
|
|
3171
3179
|
});
|
|
3172
3180
|
|
|
3173
|
-
// ../node_modules/yaml/dist/schema/tags.js
|
|
3181
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/tags.js
|
|
3174
3182
|
var require_tags = __commonJS({
|
|
3175
|
-
"../node_modules/yaml/dist/schema/tags.js"(
|
|
3183
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/tags.js"(exports) {
|
|
3176
3184
|
"use strict";
|
|
3177
3185
|
var map = require_map();
|
|
3178
3186
|
var _null = require_null();
|
|
@@ -3259,14 +3267,14 @@ var require_tags = __commonJS({
|
|
|
3259
3267
|
return tags2;
|
|
3260
3268
|
}, []);
|
|
3261
3269
|
}
|
|
3262
|
-
|
|
3263
|
-
|
|
3270
|
+
exports.coreKnownTags = coreKnownTags;
|
|
3271
|
+
exports.getTags = getTags;
|
|
3264
3272
|
}
|
|
3265
3273
|
});
|
|
3266
3274
|
|
|
3267
|
-
// ../node_modules/yaml/dist/schema/Schema.js
|
|
3275
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/Schema.js
|
|
3268
3276
|
var require_Schema = __commonJS({
|
|
3269
|
-
"../node_modules/yaml/dist/schema/Schema.js"(
|
|
3277
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/Schema.js"(exports) {
|
|
3270
3278
|
"use strict";
|
|
3271
3279
|
var identity = require_identity();
|
|
3272
3280
|
var map = require_map();
|
|
@@ -3292,13 +3300,13 @@ var require_Schema = __commonJS({
|
|
|
3292
3300
|
return copy;
|
|
3293
3301
|
}
|
|
3294
3302
|
};
|
|
3295
|
-
|
|
3303
|
+
exports.Schema = Schema;
|
|
3296
3304
|
}
|
|
3297
3305
|
});
|
|
3298
3306
|
|
|
3299
|
-
// ../node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
3307
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
3300
3308
|
var require_stringifyDocument = __commonJS({
|
|
3301
|
-
"../node_modules/yaml/dist/stringify/stringifyDocument.js"(
|
|
3309
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports) {
|
|
3302
3310
|
"use strict";
|
|
3303
3311
|
var identity = require_identity();
|
|
3304
3312
|
var stringify = require_stringify();
|
|
@@ -3372,13 +3380,13 @@ var require_stringifyDocument = __commonJS({
|
|
|
3372
3380
|
}
|
|
3373
3381
|
return lines.join("\n") + "\n";
|
|
3374
3382
|
}
|
|
3375
|
-
|
|
3383
|
+
exports.stringifyDocument = stringifyDocument;
|
|
3376
3384
|
}
|
|
3377
3385
|
});
|
|
3378
3386
|
|
|
3379
|
-
// ../node_modules/yaml/dist/doc/Document.js
|
|
3387
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/Document.js
|
|
3380
3388
|
var require_Document = __commonJS({
|
|
3381
|
-
"../node_modules/yaml/dist/doc/Document.js"(
|
|
3389
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/Document.js"(exports) {
|
|
3382
3390
|
"use strict";
|
|
3383
3391
|
var Alias = require_Alias();
|
|
3384
3392
|
var Collection = require_Collection();
|
|
@@ -3454,9 +3462,9 @@ var require_Document = __commonJS({
|
|
|
3454
3462
|
this.contents.add(value);
|
|
3455
3463
|
}
|
|
3456
3464
|
/** Adds a value to the document. */
|
|
3457
|
-
addIn(
|
|
3465
|
+
addIn(path2, value) {
|
|
3458
3466
|
if (assertCollection(this.contents))
|
|
3459
|
-
this.contents.addIn(
|
|
3467
|
+
this.contents.addIn(path2, value);
|
|
3460
3468
|
}
|
|
3461
3469
|
/**
|
|
3462
3470
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3531,14 +3539,14 @@ var require_Document = __commonJS({
|
|
|
3531
3539
|
* Removes a value from the document.
|
|
3532
3540
|
* @returns `true` if the item was found and removed.
|
|
3533
3541
|
*/
|
|
3534
|
-
deleteIn(
|
|
3535
|
-
if (Collection.isEmptyPath(
|
|
3542
|
+
deleteIn(path2) {
|
|
3543
|
+
if (Collection.isEmptyPath(path2)) {
|
|
3536
3544
|
if (this.contents == null)
|
|
3537
3545
|
return false;
|
|
3538
3546
|
this.contents = null;
|
|
3539
3547
|
return true;
|
|
3540
3548
|
}
|
|
3541
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3549
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path2) : false;
|
|
3542
3550
|
}
|
|
3543
3551
|
/**
|
|
3544
3552
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3553,10 +3561,10 @@ var require_Document = __commonJS({
|
|
|
3553
3561
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3554
3562
|
* `true` (collections are always returned intact).
|
|
3555
3563
|
*/
|
|
3556
|
-
getIn(
|
|
3557
|
-
if (Collection.isEmptyPath(
|
|
3564
|
+
getIn(path2, keepScalar) {
|
|
3565
|
+
if (Collection.isEmptyPath(path2))
|
|
3558
3566
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3559
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3567
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path2, keepScalar) : void 0;
|
|
3560
3568
|
}
|
|
3561
3569
|
/**
|
|
3562
3570
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3567,10 +3575,10 @@ var require_Document = __commonJS({
|
|
|
3567
3575
|
/**
|
|
3568
3576
|
* Checks if the document includes a value at `path`.
|
|
3569
3577
|
*/
|
|
3570
|
-
hasIn(
|
|
3571
|
-
if (Collection.isEmptyPath(
|
|
3578
|
+
hasIn(path2) {
|
|
3579
|
+
if (Collection.isEmptyPath(path2))
|
|
3572
3580
|
return this.contents !== void 0;
|
|
3573
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3581
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path2) : false;
|
|
3574
3582
|
}
|
|
3575
3583
|
/**
|
|
3576
3584
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3587,13 +3595,13 @@ var require_Document = __commonJS({
|
|
|
3587
3595
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3588
3596
|
* boolean to add/remove the item from the set.
|
|
3589
3597
|
*/
|
|
3590
|
-
setIn(
|
|
3591
|
-
if (Collection.isEmptyPath(
|
|
3598
|
+
setIn(path2, value) {
|
|
3599
|
+
if (Collection.isEmptyPath(path2)) {
|
|
3592
3600
|
this.contents = value;
|
|
3593
3601
|
} else if (this.contents == null) {
|
|
3594
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3602
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path2), value);
|
|
3595
3603
|
} else if (assertCollection(this.contents)) {
|
|
3596
|
-
this.contents.setIn(
|
|
3604
|
+
this.contents.setIn(path2, value);
|
|
3597
3605
|
}
|
|
3598
3606
|
}
|
|
3599
3607
|
/**
|
|
@@ -3681,13 +3689,13 @@ var require_Document = __commonJS({
|
|
|
3681
3689
|
return true;
|
|
3682
3690
|
throw new Error("Expected a YAML collection as document contents");
|
|
3683
3691
|
}
|
|
3684
|
-
|
|
3692
|
+
exports.Document = Document;
|
|
3685
3693
|
}
|
|
3686
3694
|
});
|
|
3687
3695
|
|
|
3688
|
-
// ../node_modules/yaml/dist/errors.js
|
|
3696
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/errors.js
|
|
3689
3697
|
var require_errors = __commonJS({
|
|
3690
|
-
"../node_modules/yaml/dist/errors.js"(
|
|
3698
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/errors.js"(exports) {
|
|
3691
3699
|
"use strict";
|
|
3692
3700
|
var YAMLError = class extends Error {
|
|
3693
3701
|
constructor(name, pos, code, message) {
|
|
@@ -3743,16 +3751,16 @@ ${pointer}
|
|
|
3743
3751
|
`;
|
|
3744
3752
|
}
|
|
3745
3753
|
};
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3754
|
+
exports.YAMLError = YAMLError;
|
|
3755
|
+
exports.YAMLParseError = YAMLParseError;
|
|
3756
|
+
exports.YAMLWarning = YAMLWarning;
|
|
3757
|
+
exports.prettifyError = prettifyError;
|
|
3750
3758
|
}
|
|
3751
3759
|
});
|
|
3752
3760
|
|
|
3753
|
-
// ../node_modules/yaml/dist/compose/resolve-props.js
|
|
3761
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-props.js
|
|
3754
3762
|
var require_resolve_props = __commonJS({
|
|
3755
|
-
"../node_modules/yaml/dist/compose/resolve-props.js"(
|
|
3763
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-props.js"(exports) {
|
|
3756
3764
|
"use strict";
|
|
3757
3765
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
3758
3766
|
let spaceBefore = false;
|
|
@@ -3880,13 +3888,13 @@ var require_resolve_props = __commonJS({
|
|
|
3880
3888
|
start: start ?? end
|
|
3881
3889
|
};
|
|
3882
3890
|
}
|
|
3883
|
-
|
|
3891
|
+
exports.resolveProps = resolveProps;
|
|
3884
3892
|
}
|
|
3885
3893
|
});
|
|
3886
3894
|
|
|
3887
|
-
// ../node_modules/yaml/dist/compose/util-contains-newline.js
|
|
3895
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
3888
3896
|
var require_util_contains_newline = __commonJS({
|
|
3889
|
-
"../node_modules/yaml/dist/compose/util-contains-newline.js"(
|
|
3897
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-contains-newline.js"(exports) {
|
|
3890
3898
|
"use strict";
|
|
3891
3899
|
function containsNewline(key) {
|
|
3892
3900
|
if (!key)
|
|
@@ -3922,13 +3930,13 @@ var require_util_contains_newline = __commonJS({
|
|
|
3922
3930
|
return true;
|
|
3923
3931
|
}
|
|
3924
3932
|
}
|
|
3925
|
-
|
|
3933
|
+
exports.containsNewline = containsNewline;
|
|
3926
3934
|
}
|
|
3927
3935
|
});
|
|
3928
3936
|
|
|
3929
|
-
// ../node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
3937
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
3930
3938
|
var require_util_flow_indent_check = __commonJS({
|
|
3931
|
-
"../node_modules/yaml/dist/compose/util-flow-indent-check.js"(
|
|
3939
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-flow-indent-check.js"(exports) {
|
|
3932
3940
|
"use strict";
|
|
3933
3941
|
var utilContainsNewline = require_util_contains_newline();
|
|
3934
3942
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -3940,13 +3948,13 @@ var require_util_flow_indent_check = __commonJS({
|
|
|
3940
3948
|
}
|
|
3941
3949
|
}
|
|
3942
3950
|
}
|
|
3943
|
-
|
|
3951
|
+
exports.flowIndentCheck = flowIndentCheck;
|
|
3944
3952
|
}
|
|
3945
3953
|
});
|
|
3946
3954
|
|
|
3947
|
-
// ../node_modules/yaml/dist/compose/util-map-includes.js
|
|
3955
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-map-includes.js
|
|
3948
3956
|
var require_util_map_includes = __commonJS({
|
|
3949
|
-
"../node_modules/yaml/dist/compose/util-map-includes.js"(
|
|
3957
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-map-includes.js"(exports) {
|
|
3950
3958
|
"use strict";
|
|
3951
3959
|
var identity = require_identity();
|
|
3952
3960
|
function mapIncludes(ctx, items, search) {
|
|
@@ -3956,13 +3964,13 @@ var require_util_map_includes = __commonJS({
|
|
|
3956
3964
|
const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b || identity.isScalar(a) && identity.isScalar(b) && a.value === b.value;
|
|
3957
3965
|
return items.some((pair) => isEqual(pair.key, search));
|
|
3958
3966
|
}
|
|
3959
|
-
|
|
3967
|
+
exports.mapIncludes = mapIncludes;
|
|
3960
3968
|
}
|
|
3961
3969
|
});
|
|
3962
3970
|
|
|
3963
|
-
// ../node_modules/yaml/dist/compose/resolve-block-map.js
|
|
3971
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
3964
3972
|
var require_resolve_block_map = __commonJS({
|
|
3965
|
-
"../node_modules/yaml/dist/compose/resolve-block-map.js"(
|
|
3973
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-map.js"(exports) {
|
|
3966
3974
|
"use strict";
|
|
3967
3975
|
var Pair = require_Pair();
|
|
3968
3976
|
var YAMLMap = require_YAMLMap();
|
|
@@ -4064,13 +4072,13 @@ var require_resolve_block_map = __commonJS({
|
|
|
4064
4072
|
map.range = [bm.offset, offset, commentEnd ?? offset];
|
|
4065
4073
|
return map;
|
|
4066
4074
|
}
|
|
4067
|
-
|
|
4075
|
+
exports.resolveBlockMap = resolveBlockMap;
|
|
4068
4076
|
}
|
|
4069
4077
|
});
|
|
4070
4078
|
|
|
4071
|
-
// ../node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
4079
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
4072
4080
|
var require_resolve_block_seq = __commonJS({
|
|
4073
|
-
"../node_modules/yaml/dist/compose/resolve-block-seq.js"(
|
|
4081
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-seq.js"(exports) {
|
|
4074
4082
|
"use strict";
|
|
4075
4083
|
var YAMLSeq = require_YAMLSeq();
|
|
4076
4084
|
var resolveProps = require_resolve_props();
|
|
@@ -4115,13 +4123,13 @@ var require_resolve_block_seq = __commonJS({
|
|
|
4115
4123
|
seq.range = [bs.offset, offset, commentEnd ?? offset];
|
|
4116
4124
|
return seq;
|
|
4117
4125
|
}
|
|
4118
|
-
|
|
4126
|
+
exports.resolveBlockSeq = resolveBlockSeq;
|
|
4119
4127
|
}
|
|
4120
4128
|
});
|
|
4121
4129
|
|
|
4122
|
-
// ../node_modules/yaml/dist/compose/resolve-end.js
|
|
4130
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-end.js
|
|
4123
4131
|
var require_resolve_end = __commonJS({
|
|
4124
|
-
"../node_modules/yaml/dist/compose/resolve-end.js"(
|
|
4132
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-end.js"(exports) {
|
|
4125
4133
|
"use strict";
|
|
4126
4134
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
4127
4135
|
let comment = "";
|
|
@@ -4158,13 +4166,13 @@ var require_resolve_end = __commonJS({
|
|
|
4158
4166
|
}
|
|
4159
4167
|
return { comment, offset };
|
|
4160
4168
|
}
|
|
4161
|
-
|
|
4169
|
+
exports.resolveEnd = resolveEnd;
|
|
4162
4170
|
}
|
|
4163
4171
|
});
|
|
4164
4172
|
|
|
4165
|
-
// ../node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
4173
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
4166
4174
|
var require_resolve_flow_collection = __commonJS({
|
|
4167
|
-
"../node_modules/yaml/dist/compose/resolve-flow-collection.js"(
|
|
4175
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-collection.js"(exports) {
|
|
4168
4176
|
"use strict";
|
|
4169
4177
|
var identity = require_identity();
|
|
4170
4178
|
var Pair = require_Pair();
|
|
@@ -4352,13 +4360,13 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4352
4360
|
}
|
|
4353
4361
|
return coll;
|
|
4354
4362
|
}
|
|
4355
|
-
|
|
4363
|
+
exports.resolveFlowCollection = resolveFlowCollection;
|
|
4356
4364
|
}
|
|
4357
4365
|
});
|
|
4358
4366
|
|
|
4359
|
-
// ../node_modules/yaml/dist/compose/compose-collection.js
|
|
4367
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-collection.js
|
|
4360
4368
|
var require_compose_collection = __commonJS({
|
|
4361
|
-
"../node_modules/yaml/dist/compose/compose-collection.js"(
|
|
4369
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-collection.js"(exports) {
|
|
4362
4370
|
"use strict";
|
|
4363
4371
|
var identity = require_identity();
|
|
4364
4372
|
var Scalar = require_Scalar();
|
|
@@ -4417,13 +4425,13 @@ var require_compose_collection = __commonJS({
|
|
|
4417
4425
|
node.format = tag.format;
|
|
4418
4426
|
return node;
|
|
4419
4427
|
}
|
|
4420
|
-
|
|
4428
|
+
exports.composeCollection = composeCollection;
|
|
4421
4429
|
}
|
|
4422
4430
|
});
|
|
4423
4431
|
|
|
4424
|
-
// ../node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
4432
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
4425
4433
|
var require_resolve_block_scalar = __commonJS({
|
|
4426
|
-
"../node_modules/yaml/dist/compose/resolve-block-scalar.js"(
|
|
4434
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-scalar.js"(exports) {
|
|
4427
4435
|
"use strict";
|
|
4428
4436
|
var Scalar = require_Scalar();
|
|
4429
4437
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -4600,13 +4608,13 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4600
4608
|
lines.push([split[i], split[i + 1]]);
|
|
4601
4609
|
return lines;
|
|
4602
4610
|
}
|
|
4603
|
-
|
|
4611
|
+
exports.resolveBlockScalar = resolveBlockScalar;
|
|
4604
4612
|
}
|
|
4605
4613
|
});
|
|
4606
4614
|
|
|
4607
|
-
// ../node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
4615
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
4608
4616
|
var require_resolve_flow_scalar = __commonJS({
|
|
4609
|
-
"../node_modules/yaml/dist/compose/resolve-flow-scalar.js"(
|
|
4617
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-scalar.js"(exports) {
|
|
4610
4618
|
"use strict";
|
|
4611
4619
|
var Scalar = require_Scalar();
|
|
4612
4620
|
var resolveEnd = require_resolve_end();
|
|
@@ -4819,13 +4827,13 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
4819
4827
|
}
|
|
4820
4828
|
return String.fromCodePoint(code);
|
|
4821
4829
|
}
|
|
4822
|
-
|
|
4830
|
+
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4823
4831
|
}
|
|
4824
4832
|
});
|
|
4825
4833
|
|
|
4826
|
-
// ../node_modules/yaml/dist/compose/compose-scalar.js
|
|
4834
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-scalar.js
|
|
4827
4835
|
var require_compose_scalar = __commonJS({
|
|
4828
|
-
"../node_modules/yaml/dist/compose/compose-scalar.js"(
|
|
4836
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-scalar.js"(exports) {
|
|
4829
4837
|
"use strict";
|
|
4830
4838
|
var identity = require_identity();
|
|
4831
4839
|
var Scalar = require_Scalar();
|
|
@@ -4900,13 +4908,13 @@ var require_compose_scalar = __commonJS({
|
|
|
4900
4908
|
}
|
|
4901
4909
|
return tag;
|
|
4902
4910
|
}
|
|
4903
|
-
|
|
4911
|
+
exports.composeScalar = composeScalar;
|
|
4904
4912
|
}
|
|
4905
4913
|
});
|
|
4906
4914
|
|
|
4907
|
-
// ../node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
4915
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
4908
4916
|
var require_util_empty_scalar_position = __commonJS({
|
|
4909
|
-
"../node_modules/yaml/dist/compose/util-empty-scalar-position.js"(
|
|
4917
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-empty-scalar-position.js"(exports) {
|
|
4910
4918
|
"use strict";
|
|
4911
4919
|
function emptyScalarPosition(offset, before, pos) {
|
|
4912
4920
|
if (before) {
|
|
@@ -4930,13 +4938,13 @@ var require_util_empty_scalar_position = __commonJS({
|
|
|
4930
4938
|
}
|
|
4931
4939
|
return offset;
|
|
4932
4940
|
}
|
|
4933
|
-
|
|
4941
|
+
exports.emptyScalarPosition = emptyScalarPosition;
|
|
4934
4942
|
}
|
|
4935
4943
|
});
|
|
4936
4944
|
|
|
4937
|
-
// ../node_modules/yaml/dist/compose/compose-node.js
|
|
4945
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-node.js
|
|
4938
4946
|
var require_compose_node = __commonJS({
|
|
4939
|
-
"../node_modules/yaml/dist/compose/compose-node.js"(
|
|
4947
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-node.js"(exports) {
|
|
4940
4948
|
"use strict";
|
|
4941
4949
|
var Alias = require_Alias();
|
|
4942
4950
|
var identity = require_identity();
|
|
@@ -4967,17 +4975,22 @@ var require_compose_node = __commonJS({
|
|
|
4967
4975
|
case "block-map":
|
|
4968
4976
|
case "block-seq":
|
|
4969
4977
|
case "flow-collection":
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4978
|
+
try {
|
|
4979
|
+
node = composeCollection.composeCollection(CN, ctx, token, props, onError);
|
|
4980
|
+
if (anchor)
|
|
4981
|
+
node.anchor = anchor.source.substring(1);
|
|
4982
|
+
} catch (error) {
|
|
4983
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
4984
|
+
onError(token, "RESOURCE_EXHAUSTION", message);
|
|
4985
|
+
}
|
|
4973
4986
|
break;
|
|
4974
4987
|
default: {
|
|
4975
4988
|
const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
|
|
4976
4989
|
onError(token, "UNEXPECTED_TOKEN", message);
|
|
4977
|
-
node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError);
|
|
4978
4990
|
isSrcToken = false;
|
|
4979
4991
|
}
|
|
4980
4992
|
}
|
|
4993
|
+
node ?? (node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError));
|
|
4981
4994
|
if (anchor && node.anchor === "")
|
|
4982
4995
|
onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
|
|
4983
4996
|
if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
|
|
@@ -5030,14 +5043,14 @@ var require_compose_node = __commonJS({
|
|
|
5030
5043
|
alias.comment = re.comment;
|
|
5031
5044
|
return alias;
|
|
5032
5045
|
}
|
|
5033
|
-
|
|
5034
|
-
|
|
5046
|
+
exports.composeEmptyNode = composeEmptyNode;
|
|
5047
|
+
exports.composeNode = composeNode;
|
|
5035
5048
|
}
|
|
5036
5049
|
});
|
|
5037
5050
|
|
|
5038
|
-
// ../node_modules/yaml/dist/compose/compose-doc.js
|
|
5051
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-doc.js
|
|
5039
5052
|
var require_compose_doc = __commonJS({
|
|
5040
|
-
"../node_modules/yaml/dist/compose/compose-doc.js"(
|
|
5053
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-doc.js"(exports) {
|
|
5041
5054
|
"use strict";
|
|
5042
5055
|
var Document = require_Document();
|
|
5043
5056
|
var composeNode = require_compose_node();
|
|
@@ -5074,15 +5087,15 @@ var require_compose_doc = __commonJS({
|
|
|
5074
5087
|
doc.range = [offset, contentEnd, re.offset];
|
|
5075
5088
|
return doc;
|
|
5076
5089
|
}
|
|
5077
|
-
|
|
5090
|
+
exports.composeDoc = composeDoc;
|
|
5078
5091
|
}
|
|
5079
5092
|
});
|
|
5080
5093
|
|
|
5081
|
-
// ../node_modules/yaml/dist/compose/composer.js
|
|
5094
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/composer.js
|
|
5082
5095
|
var require_composer = __commonJS({
|
|
5083
|
-
"../node_modules/yaml/dist/compose/composer.js"(
|
|
5096
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/composer.js"(exports) {
|
|
5084
5097
|
"use strict";
|
|
5085
|
-
var node_process =
|
|
5098
|
+
var node_process = __require("process");
|
|
5086
5099
|
var directives = require_directives();
|
|
5087
5100
|
var Document = require_Document();
|
|
5088
5101
|
var errors = require_errors();
|
|
@@ -5280,13 +5293,13 @@ ${end.comment}` : end.comment;
|
|
|
5280
5293
|
}
|
|
5281
5294
|
}
|
|
5282
5295
|
};
|
|
5283
|
-
|
|
5296
|
+
exports.Composer = Composer;
|
|
5284
5297
|
}
|
|
5285
5298
|
});
|
|
5286
5299
|
|
|
5287
|
-
// ../node_modules/yaml/dist/parse/cst-scalar.js
|
|
5300
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-scalar.js
|
|
5288
5301
|
var require_cst_scalar = __commonJS({
|
|
5289
|
-
"../node_modules/yaml/dist/parse/cst-scalar.js"(
|
|
5302
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-scalar.js"(exports) {
|
|
5290
5303
|
"use strict";
|
|
5291
5304
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
5292
5305
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -5463,15 +5476,15 @@ var require_cst_scalar = __commonJS({
|
|
|
5463
5476
|
}
|
|
5464
5477
|
}
|
|
5465
5478
|
}
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5479
|
+
exports.createScalarToken = createScalarToken;
|
|
5480
|
+
exports.resolveAsScalar = resolveAsScalar;
|
|
5481
|
+
exports.setScalarValue = setScalarValue;
|
|
5469
5482
|
}
|
|
5470
5483
|
});
|
|
5471
5484
|
|
|
5472
|
-
// ../node_modules/yaml/dist/parse/cst-stringify.js
|
|
5485
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-stringify.js
|
|
5473
5486
|
var require_cst_stringify = __commonJS({
|
|
5474
|
-
"../node_modules/yaml/dist/parse/cst-stringify.js"(
|
|
5487
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-stringify.js"(exports) {
|
|
5475
5488
|
"use strict";
|
|
5476
5489
|
var stringify = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
|
|
5477
5490
|
function stringifyToken(token) {
|
|
@@ -5526,13 +5539,13 @@ var require_cst_stringify = __commonJS({
|
|
|
5526
5539
|
res += stringifyToken(value);
|
|
5527
5540
|
return res;
|
|
5528
5541
|
}
|
|
5529
|
-
|
|
5542
|
+
exports.stringify = stringify;
|
|
5530
5543
|
}
|
|
5531
5544
|
});
|
|
5532
5545
|
|
|
5533
|
-
// ../node_modules/yaml/dist/parse/cst-visit.js
|
|
5546
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-visit.js
|
|
5534
5547
|
var require_cst_visit = __commonJS({
|
|
5535
|
-
"../node_modules/yaml/dist/parse/cst-visit.js"(
|
|
5548
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-visit.js"(exports) {
|
|
5536
5549
|
"use strict";
|
|
5537
5550
|
var BREAK = /* @__PURE__ */ Symbol("break visit");
|
|
5538
5551
|
var SKIP = /* @__PURE__ */ Symbol("skip children");
|
|
@@ -5545,9 +5558,9 @@ var require_cst_visit = __commonJS({
|
|
|
5545
5558
|
visit.BREAK = BREAK;
|
|
5546
5559
|
visit.SKIP = SKIP;
|
|
5547
5560
|
visit.REMOVE = REMOVE;
|
|
5548
|
-
visit.itemAtPath = (cst,
|
|
5561
|
+
visit.itemAtPath = (cst, path2) => {
|
|
5549
5562
|
let item = cst;
|
|
5550
|
-
for (const [field, index] of
|
|
5563
|
+
for (const [field, index] of path2) {
|
|
5551
5564
|
const tok = item?.[field];
|
|
5552
5565
|
if (tok && "items" in tok) {
|
|
5553
5566
|
item = tok.items[index];
|
|
@@ -5556,23 +5569,23 @@ var require_cst_visit = __commonJS({
|
|
|
5556
5569
|
}
|
|
5557
5570
|
return item;
|
|
5558
5571
|
};
|
|
5559
|
-
visit.parentCollection = (cst,
|
|
5560
|
-
const parent = visit.itemAtPath(cst,
|
|
5561
|
-
const field =
|
|
5572
|
+
visit.parentCollection = (cst, path2) => {
|
|
5573
|
+
const parent = visit.itemAtPath(cst, path2.slice(0, -1));
|
|
5574
|
+
const field = path2[path2.length - 1][0];
|
|
5562
5575
|
const coll = parent?.[field];
|
|
5563
5576
|
if (coll && "items" in coll)
|
|
5564
5577
|
return coll;
|
|
5565
5578
|
throw new Error("Parent collection not found");
|
|
5566
5579
|
};
|
|
5567
|
-
function _visit(
|
|
5568
|
-
let ctrl = visitor(item,
|
|
5580
|
+
function _visit(path2, item, visitor) {
|
|
5581
|
+
let ctrl = visitor(item, path2);
|
|
5569
5582
|
if (typeof ctrl === "symbol")
|
|
5570
5583
|
return ctrl;
|
|
5571
5584
|
for (const field of ["key", "value"]) {
|
|
5572
5585
|
const token = item[field];
|
|
5573
5586
|
if (token && "items" in token) {
|
|
5574
5587
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5575
|
-
const ci = _visit(Object.freeze(
|
|
5588
|
+
const ci = _visit(Object.freeze(path2.concat([[field, i]])), token.items[i], visitor);
|
|
5576
5589
|
if (typeof ci === "number")
|
|
5577
5590
|
i = ci - 1;
|
|
5578
5591
|
else if (ci === BREAK)
|
|
@@ -5583,18 +5596,18 @@ var require_cst_visit = __commonJS({
|
|
|
5583
5596
|
}
|
|
5584
5597
|
}
|
|
5585
5598
|
if (typeof ctrl === "function" && field === "key")
|
|
5586
|
-
ctrl = ctrl(item,
|
|
5599
|
+
ctrl = ctrl(item, path2);
|
|
5587
5600
|
}
|
|
5588
5601
|
}
|
|
5589
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5602
|
+
return typeof ctrl === "function" ? ctrl(item, path2) : ctrl;
|
|
5590
5603
|
}
|
|
5591
|
-
|
|
5604
|
+
exports.visit = visit;
|
|
5592
5605
|
}
|
|
5593
5606
|
});
|
|
5594
5607
|
|
|
5595
|
-
// ../node_modules/yaml/dist/parse/cst.js
|
|
5608
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst.js
|
|
5596
5609
|
var require_cst = __commonJS({
|
|
5597
|
-
"../node_modules/yaml/dist/parse/cst.js"(
|
|
5610
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst.js"(exports) {
|
|
5598
5611
|
"use strict";
|
|
5599
5612
|
var cstScalar = require_cst_scalar();
|
|
5600
5613
|
var cstStringify = require_cst_stringify();
|
|
@@ -5678,25 +5691,25 @@ var require_cst = __commonJS({
|
|
|
5678
5691
|
}
|
|
5679
5692
|
return null;
|
|
5680
5693
|
}
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
+
exports.createScalarToken = cstScalar.createScalarToken;
|
|
5695
|
+
exports.resolveAsScalar = cstScalar.resolveAsScalar;
|
|
5696
|
+
exports.setScalarValue = cstScalar.setScalarValue;
|
|
5697
|
+
exports.stringify = cstStringify.stringify;
|
|
5698
|
+
exports.visit = cstVisit.visit;
|
|
5699
|
+
exports.BOM = BOM;
|
|
5700
|
+
exports.DOCUMENT = DOCUMENT;
|
|
5701
|
+
exports.FLOW_END = FLOW_END;
|
|
5702
|
+
exports.SCALAR = SCALAR;
|
|
5703
|
+
exports.isCollection = isCollection;
|
|
5704
|
+
exports.isScalar = isScalar;
|
|
5705
|
+
exports.prettyToken = prettyToken;
|
|
5706
|
+
exports.tokenType = tokenType;
|
|
5694
5707
|
}
|
|
5695
5708
|
});
|
|
5696
5709
|
|
|
5697
|
-
// ../node_modules/yaml/dist/parse/lexer.js
|
|
5710
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/lexer.js
|
|
5698
5711
|
var require_lexer = __commonJS({
|
|
5699
|
-
"../node_modules/yaml/dist/parse/lexer.js"(
|
|
5712
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/lexer.js"(exports) {
|
|
5700
5713
|
"use strict";
|
|
5701
5714
|
var cst = require_cst();
|
|
5702
5715
|
function isEmpty(ch) {
|
|
@@ -6269,13 +6282,13 @@ var require_lexer = __commonJS({
|
|
|
6269
6282
|
return yield* this.pushToIndex(i, false);
|
|
6270
6283
|
}
|
|
6271
6284
|
};
|
|
6272
|
-
|
|
6285
|
+
exports.Lexer = Lexer;
|
|
6273
6286
|
}
|
|
6274
6287
|
});
|
|
6275
6288
|
|
|
6276
|
-
// ../node_modules/yaml/dist/parse/line-counter.js
|
|
6289
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/line-counter.js
|
|
6277
6290
|
var require_line_counter = __commonJS({
|
|
6278
|
-
"../node_modules/yaml/dist/parse/line-counter.js"(
|
|
6291
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/line-counter.js"(exports) {
|
|
6279
6292
|
"use strict";
|
|
6280
6293
|
var LineCounter = class {
|
|
6281
6294
|
constructor() {
|
|
@@ -6300,15 +6313,15 @@ var require_line_counter = __commonJS({
|
|
|
6300
6313
|
};
|
|
6301
6314
|
}
|
|
6302
6315
|
};
|
|
6303
|
-
|
|
6316
|
+
exports.LineCounter = LineCounter;
|
|
6304
6317
|
}
|
|
6305
6318
|
});
|
|
6306
6319
|
|
|
6307
|
-
// ../node_modules/yaml/dist/parse/parser.js
|
|
6320
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/parser.js
|
|
6308
6321
|
var require_parser = __commonJS({
|
|
6309
|
-
"../node_modules/yaml/dist/parse/parser.js"(
|
|
6322
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/parser.js"(exports) {
|
|
6310
6323
|
"use strict";
|
|
6311
|
-
var node_process =
|
|
6324
|
+
var node_process = __require("process");
|
|
6312
6325
|
var cst = require_cst();
|
|
6313
6326
|
var lexer = require_lexer();
|
|
6314
6327
|
function includesToken(list, type) {
|
|
@@ -6871,14 +6884,14 @@ var require_parser = __commonJS({
|
|
|
6871
6884
|
case "scalar":
|
|
6872
6885
|
case "single-quoted-scalar":
|
|
6873
6886
|
case "double-quoted-scalar": {
|
|
6874
|
-
const
|
|
6887
|
+
const fs2 = this.flowScalar(this.type);
|
|
6875
6888
|
if (atNextItem || it.value) {
|
|
6876
|
-
map.items.push({ start, key:
|
|
6889
|
+
map.items.push({ start, key: fs2, sep: [] });
|
|
6877
6890
|
this.onKeyLine = true;
|
|
6878
6891
|
} else if (it.sep) {
|
|
6879
|
-
this.stack.push(
|
|
6892
|
+
this.stack.push(fs2);
|
|
6880
6893
|
} else {
|
|
6881
|
-
Object.assign(it, { key:
|
|
6894
|
+
Object.assign(it, { key: fs2, sep: [] });
|
|
6882
6895
|
this.onKeyLine = true;
|
|
6883
6896
|
}
|
|
6884
6897
|
return;
|
|
@@ -7006,13 +7019,13 @@ var require_parser = __commonJS({
|
|
|
7006
7019
|
case "scalar":
|
|
7007
7020
|
case "single-quoted-scalar":
|
|
7008
7021
|
case "double-quoted-scalar": {
|
|
7009
|
-
const
|
|
7022
|
+
const fs2 = this.flowScalar(this.type);
|
|
7010
7023
|
if (!it || it.value)
|
|
7011
|
-
fc.items.push({ start: [], key:
|
|
7024
|
+
fc.items.push({ start: [], key: fs2, sep: [] });
|
|
7012
7025
|
else if (it.sep)
|
|
7013
|
-
this.stack.push(
|
|
7026
|
+
this.stack.push(fs2);
|
|
7014
7027
|
else
|
|
7015
|
-
Object.assign(it, { key:
|
|
7028
|
+
Object.assign(it, { key: fs2, sep: [] });
|
|
7016
7029
|
return;
|
|
7017
7030
|
}
|
|
7018
7031
|
case "flow-map-end":
|
|
@@ -7167,13 +7180,13 @@ var require_parser = __commonJS({
|
|
|
7167
7180
|
}
|
|
7168
7181
|
}
|
|
7169
7182
|
};
|
|
7170
|
-
|
|
7183
|
+
exports.Parser = Parser;
|
|
7171
7184
|
}
|
|
7172
7185
|
});
|
|
7173
7186
|
|
|
7174
|
-
// ../node_modules/yaml/dist/public-api.js
|
|
7187
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/public-api.js
|
|
7175
7188
|
var require_public_api = __commonJS({
|
|
7176
|
-
"../node_modules/yaml/dist/public-api.js"(
|
|
7189
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/public-api.js"(exports) {
|
|
7177
7190
|
"use strict";
|
|
7178
7191
|
var composer = require_composer();
|
|
7179
7192
|
var Document = require_Document();
|
|
@@ -7261,16 +7274,16 @@ var require_public_api = __commonJS({
|
|
|
7261
7274
|
return value.toString(options);
|
|
7262
7275
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
7263
7276
|
}
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7277
|
+
exports.parse = parse;
|
|
7278
|
+
exports.parseAllDocuments = parseAllDocuments;
|
|
7279
|
+
exports.parseDocument = parseDocument;
|
|
7280
|
+
exports.stringify = stringify;
|
|
7268
7281
|
}
|
|
7269
7282
|
});
|
|
7270
7283
|
|
|
7271
|
-
// ../node_modules/yaml/dist/index.js
|
|
7284
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/index.js
|
|
7272
7285
|
var require_dist = __commonJS({
|
|
7273
|
-
"../node_modules/yaml/dist/index.js"(
|
|
7286
|
+
"../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/index.js"(exports) {
|
|
7274
7287
|
"use strict";
|
|
7275
7288
|
var composer = require_composer();
|
|
7276
7289
|
var Document = require_Document();
|
|
@@ -7288,81 +7301,65 @@ var require_dist = __commonJS({
|
|
|
7288
7301
|
var parser = require_parser();
|
|
7289
7302
|
var publicApi = require_public_api();
|
|
7290
7303
|
var visit = require_visit();
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7304
|
+
exports.Composer = composer.Composer;
|
|
7305
|
+
exports.Document = Document.Document;
|
|
7306
|
+
exports.Schema = Schema.Schema;
|
|
7307
|
+
exports.YAMLError = errors.YAMLError;
|
|
7308
|
+
exports.YAMLParseError = errors.YAMLParseError;
|
|
7309
|
+
exports.YAMLWarning = errors.YAMLWarning;
|
|
7310
|
+
exports.Alias = Alias.Alias;
|
|
7311
|
+
exports.isAlias = identity.isAlias;
|
|
7312
|
+
exports.isCollection = identity.isCollection;
|
|
7313
|
+
exports.isDocument = identity.isDocument;
|
|
7314
|
+
exports.isMap = identity.isMap;
|
|
7315
|
+
exports.isNode = identity.isNode;
|
|
7316
|
+
exports.isPair = identity.isPair;
|
|
7317
|
+
exports.isScalar = identity.isScalar;
|
|
7318
|
+
exports.isSeq = identity.isSeq;
|
|
7319
|
+
exports.Pair = Pair.Pair;
|
|
7320
|
+
exports.Scalar = Scalar.Scalar;
|
|
7321
|
+
exports.YAMLMap = YAMLMap.YAMLMap;
|
|
7322
|
+
exports.YAMLSeq = YAMLSeq.YAMLSeq;
|
|
7323
|
+
exports.CST = cst;
|
|
7324
|
+
exports.Lexer = lexer.Lexer;
|
|
7325
|
+
exports.LineCounter = lineCounter.LineCounter;
|
|
7326
|
+
exports.Parser = parser.Parser;
|
|
7327
|
+
exports.parse = publicApi.parse;
|
|
7328
|
+
exports.parseAllDocuments = publicApi.parseAllDocuments;
|
|
7329
|
+
exports.parseDocument = publicApi.parseDocument;
|
|
7330
|
+
exports.stringify = publicApi.stringify;
|
|
7331
|
+
exports.visit = visit.visit;
|
|
7332
|
+
exports.visitAsync = visit.visitAsync;
|
|
7320
7333
|
}
|
|
7321
7334
|
});
|
|
7322
7335
|
|
|
7323
|
-
// src/index.ts
|
|
7324
|
-
var index_exports = {};
|
|
7325
|
-
__export(index_exports, {
|
|
7326
|
-
CLI_VERSION: () => CLI_VERSION
|
|
7327
|
-
});
|
|
7328
|
-
module.exports = __toCommonJS(index_exports);
|
|
7329
|
-
var import_config17 = require("dotenv/config");
|
|
7330
|
-
var import_commander = require("commander");
|
|
7331
|
-
var import_chalk17 = __toESM(require("chalk"));
|
|
7332
|
-
|
|
7333
|
-
// src/commands/login.ts
|
|
7334
|
-
var import_http = __toESM(require("http"));
|
|
7335
|
-
var import_url = require("url");
|
|
7336
|
-
var import_open = __toESM(require("open"));
|
|
7337
|
-
var import_chalk = __toESM(require("chalk"));
|
|
7338
|
-
|
|
7339
7336
|
// src/lib/config.ts
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
var CONFIG_DIR =
|
|
7344
|
-
var CONFIG_FILE =
|
|
7337
|
+
import fs from "fs";
|
|
7338
|
+
import path from "path";
|
|
7339
|
+
import os from "os";
|
|
7340
|
+
var CONFIG_DIR = path.join(os.homedir(), ".replicas");
|
|
7341
|
+
var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
7345
7342
|
function ensureConfigDir() {
|
|
7346
|
-
if (!
|
|
7347
|
-
|
|
7343
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
7344
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
|
|
7348
7345
|
}
|
|
7349
7346
|
}
|
|
7350
7347
|
function readConfig() {
|
|
7351
|
-
if (!
|
|
7348
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
7352
7349
|
return null;
|
|
7353
7350
|
}
|
|
7354
7351
|
try {
|
|
7355
|
-
const data =
|
|
7352
|
+
const data = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
7356
7353
|
return JSON.parse(data);
|
|
7357
7354
|
} catch (error) {
|
|
7358
7355
|
console.error("Error reading config file:", error);
|
|
7359
7356
|
return null;
|
|
7360
7357
|
}
|
|
7361
7358
|
}
|
|
7362
|
-
function writeConfig(
|
|
7359
|
+
function writeConfig(config) {
|
|
7363
7360
|
ensureConfigDir();
|
|
7364
7361
|
try {
|
|
7365
|
-
|
|
7362
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), {
|
|
7366
7363
|
mode: 384
|
|
7367
7364
|
// Only owner can read/write
|
|
7368
7365
|
});
|
|
@@ -7372,44 +7369,49 @@ function writeConfig(config2) {
|
|
|
7372
7369
|
}
|
|
7373
7370
|
}
|
|
7374
7371
|
function deleteConfig() {
|
|
7375
|
-
if (
|
|
7376
|
-
|
|
7372
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
|
7373
|
+
fs.unlinkSync(CONFIG_FILE);
|
|
7377
7374
|
}
|
|
7378
7375
|
}
|
|
7379
7376
|
function isAuthenticated() {
|
|
7380
|
-
const
|
|
7381
|
-
|
|
7377
|
+
const config = readConfig();
|
|
7378
|
+
if (!config || !config.access_token) return false;
|
|
7379
|
+
if (config.expires_at) {
|
|
7380
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
7381
|
+
if (config.expires_at - now < 60 && !config.refresh_token) return false;
|
|
7382
|
+
}
|
|
7383
|
+
return true;
|
|
7382
7384
|
}
|
|
7383
7385
|
function setOrganizationId(organizationId) {
|
|
7384
|
-
const
|
|
7385
|
-
if (!
|
|
7386
|
+
const config = readConfig();
|
|
7387
|
+
if (!config) {
|
|
7386
7388
|
throw new Error("No config file found. Please login first.");
|
|
7387
7389
|
}
|
|
7388
|
-
|
|
7389
|
-
writeConfig(
|
|
7390
|
+
config.organization_id = organizationId;
|
|
7391
|
+
writeConfig(config);
|
|
7390
7392
|
}
|
|
7391
7393
|
function getOrganizationId() {
|
|
7392
|
-
const
|
|
7393
|
-
return
|
|
7394
|
+
const config = readConfig();
|
|
7395
|
+
return config?.organization_id || null;
|
|
7394
7396
|
}
|
|
7395
7397
|
function setIdeCommand(ideCommand) {
|
|
7396
|
-
const
|
|
7397
|
-
if (!
|
|
7398
|
+
const config = readConfig();
|
|
7399
|
+
if (!config) {
|
|
7398
7400
|
throw new Error("No config file found. Please login first.");
|
|
7399
7401
|
}
|
|
7400
|
-
|
|
7401
|
-
writeConfig(
|
|
7402
|
+
config.ide_command = ideCommand;
|
|
7403
|
+
writeConfig(config);
|
|
7402
7404
|
}
|
|
7403
7405
|
function getIdeCommand() {
|
|
7404
|
-
const
|
|
7405
|
-
return
|
|
7406
|
+
const config = readConfig();
|
|
7407
|
+
return config?.ide_command || "code";
|
|
7406
7408
|
}
|
|
7407
7409
|
function isAgentMode() {
|
|
7408
|
-
if (!
|
|
7410
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
7409
7411
|
return false;
|
|
7410
7412
|
}
|
|
7411
7413
|
try {
|
|
7412
|
-
const data =
|
|
7414
|
+
const data = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
7413
7415
|
const parsed = JSON.parse(data);
|
|
7414
7416
|
return !!parsed.engine_secret && !!parsed.workspace_id;
|
|
7415
7417
|
} catch {
|
|
@@ -7417,11 +7419,11 @@ function isAgentMode() {
|
|
|
7417
7419
|
}
|
|
7418
7420
|
}
|
|
7419
7421
|
function readAgentConfig() {
|
|
7420
|
-
if (!
|
|
7422
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
7421
7423
|
return null;
|
|
7422
7424
|
}
|
|
7423
7425
|
try {
|
|
7424
|
-
const data =
|
|
7426
|
+
const data = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
7425
7427
|
const parsed = JSON.parse(data);
|
|
7426
7428
|
if (parsed.engine_secret && parsed.workspace_id && parsed.organization_id) {
|
|
7427
7429
|
return parsed;
|
|
@@ -7433,13 +7435,13 @@ function readAgentConfig() {
|
|
|
7433
7435
|
}
|
|
7434
7436
|
|
|
7435
7437
|
// src/lib/supabase.ts
|
|
7436
|
-
|
|
7438
|
+
import { createClient } from "@supabase/supabase-js";
|
|
7437
7439
|
var supabaseUrl = process.env.REPLICAS_SUPABASE_URL || "https://mxeqiomwgdgaesecwtct.supabase.co";
|
|
7438
7440
|
var supabaseAnonKey = process.env.REPLICAS_SUPABASE_ANON_KEY || "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im14ZXFpb213Z2RnYWVzZWN3dGN0Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTk4OTk2ODAsImV4cCI6MjA3NTQ3NTY4MH0.zLRoK4r9Zep-WaLNkvWcb7DXlJBZFH26QXWO1ljMctM";
|
|
7439
|
-
var supabase =
|
|
7441
|
+
var supabase = createClient(supabaseUrl, supabaseAnonKey, {
|
|
7440
7442
|
auth: {
|
|
7441
|
-
persistSession:
|
|
7442
|
-
autoRefreshToken:
|
|
7443
|
+
persistSession: true,
|
|
7444
|
+
autoRefreshToken: true
|
|
7443
7445
|
}
|
|
7444
7446
|
});
|
|
7445
7447
|
|
|
@@ -7449,18 +7451,18 @@ function isTokenExpired(expiresAt) {
|
|
|
7449
7451
|
return expiresAt - now < 60;
|
|
7450
7452
|
}
|
|
7451
7453
|
async function refreshToken() {
|
|
7452
|
-
const
|
|
7453
|
-
if (!
|
|
7454
|
+
const config = readConfig();
|
|
7455
|
+
if (!config) {
|
|
7454
7456
|
throw new Error('Not authenticated. Please run "replicas login"');
|
|
7455
7457
|
}
|
|
7456
7458
|
try {
|
|
7457
7459
|
const { data, error } = await supabase.auth.refreshSession({
|
|
7458
|
-
refresh_token:
|
|
7460
|
+
refresh_token: config.refresh_token
|
|
7459
7461
|
});
|
|
7460
7462
|
if (error) throw error;
|
|
7461
7463
|
if (!data.session) throw new Error("Failed to refresh session");
|
|
7462
7464
|
writeConfig({
|
|
7463
|
-
...
|
|
7465
|
+
...config,
|
|
7464
7466
|
access_token: data.session.access_token,
|
|
7465
7467
|
refresh_token: data.session.refresh_token,
|
|
7466
7468
|
expires_at: data.session.expires_at || 0
|
|
@@ -7470,11 +7472,11 @@ async function refreshToken() {
|
|
|
7470
7472
|
}
|
|
7471
7473
|
}
|
|
7472
7474
|
async function getValidToken() {
|
|
7473
|
-
const
|
|
7474
|
-
if (!
|
|
7475
|
+
const config = readConfig();
|
|
7476
|
+
if (!config) {
|
|
7475
7477
|
throw new Error('Not authenticated. Please run "replicas login"');
|
|
7476
7478
|
}
|
|
7477
|
-
if (isTokenExpired(
|
|
7479
|
+
if (isTokenExpired(config.expires_at)) {
|
|
7478
7480
|
await refreshToken();
|
|
7479
7481
|
const newConfig = readConfig();
|
|
7480
7482
|
if (!newConfig) {
|
|
@@ -7482,7 +7484,7 @@ async function getValidToken() {
|
|
|
7482
7484
|
}
|
|
7483
7485
|
return newConfig.access_token;
|
|
7484
7486
|
}
|
|
7485
|
-
return
|
|
7487
|
+
return config.access_token;
|
|
7486
7488
|
}
|
|
7487
7489
|
async function getCurrentUser() {
|
|
7488
7490
|
const token = await getValidToken();
|
|
@@ -7495,526 +7497,6 @@ async function getCurrentUser() {
|
|
|
7495
7497
|
};
|
|
7496
7498
|
}
|
|
7497
7499
|
|
|
7498
|
-
// src/lib/api.ts
|
|
7499
|
-
var MONOLITH_URL = process.env.REPLICAS_MONOLITH_URL || "https://api.replicas.dev";
|
|
7500
|
-
async function authenticatedFetch(url, options) {
|
|
7501
|
-
const token = await getValidToken();
|
|
7502
|
-
if (!token) {
|
|
7503
|
-
throw new Error("No access token available");
|
|
7504
|
-
}
|
|
7505
|
-
const headers = {
|
|
7506
|
-
"Authorization": `Bearer ${token}`,
|
|
7507
|
-
"Content-Type": "application/json",
|
|
7508
|
-
...options?.headers || {}
|
|
7509
|
-
};
|
|
7510
|
-
const absoluteUrl = `${MONOLITH_URL}${url}`;
|
|
7511
|
-
const requestInit = {
|
|
7512
|
-
...options,
|
|
7513
|
-
headers,
|
|
7514
|
-
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
|
|
7515
|
-
};
|
|
7516
|
-
const response = await fetchWithRedirects(absoluteUrl, requestInit);
|
|
7517
|
-
if (!response.ok) {
|
|
7518
|
-
const error = await response.json().catch(() => ({ error: "Request failed" }));
|
|
7519
|
-
throw new Error(error.error || `Request failed with status ${response.status}`);
|
|
7520
|
-
}
|
|
7521
|
-
return response.json();
|
|
7522
|
-
}
|
|
7523
|
-
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
7524
|
-
var MAX_REDIRECTS = 5;
|
|
7525
|
-
async function fetchWithRedirects(url, init, attempt = 0) {
|
|
7526
|
-
const response = await fetch(url, { ...init, redirect: "manual" });
|
|
7527
|
-
if (REDIRECT_STATUSES.has(response.status)) {
|
|
7528
|
-
if (attempt >= MAX_REDIRECTS) {
|
|
7529
|
-
throw new Error("Too many redirects while contacting the Replicas API");
|
|
7530
|
-
}
|
|
7531
|
-
const location = response.headers.get("location");
|
|
7532
|
-
if (!location) {
|
|
7533
|
-
throw new Error(`Redirect status ${response.status} missing Location header`);
|
|
7534
|
-
}
|
|
7535
|
-
const nextUrl = new URL(location, url).toString();
|
|
7536
|
-
const shouldForceGet = response.status === 303 && init.method !== void 0 && init.method.toUpperCase() !== "GET";
|
|
7537
|
-
const nextInit = {
|
|
7538
|
-
...init,
|
|
7539
|
-
method: shouldForceGet ? "GET" : init.method,
|
|
7540
|
-
body: shouldForceGet ? void 0 : init.body
|
|
7541
|
-
};
|
|
7542
|
-
return fetchWithRedirects(nextUrl, nextInit, attempt + 1);
|
|
7543
|
-
}
|
|
7544
|
-
return response;
|
|
7545
|
-
}
|
|
7546
|
-
async function orgAuthenticatedFetch(url, options) {
|
|
7547
|
-
const token = await getValidToken();
|
|
7548
|
-
const organizationId = getOrganizationId();
|
|
7549
|
-
if (!organizationId) {
|
|
7550
|
-
throw new Error(
|
|
7551
|
-
'No organization selected. Please run "replicas org switch" to select an organization.'
|
|
7552
|
-
);
|
|
7553
|
-
}
|
|
7554
|
-
const headers = {
|
|
7555
|
-
"Authorization": `Bearer ${token}`,
|
|
7556
|
-
"Replicas-Org-Id": organizationId,
|
|
7557
|
-
"Content-Type": "application/json",
|
|
7558
|
-
...options?.headers || {}
|
|
7559
|
-
};
|
|
7560
|
-
const absoluteUrl = `${MONOLITH_URL}${url}`;
|
|
7561
|
-
const requestInit = {
|
|
7562
|
-
...options,
|
|
7563
|
-
headers,
|
|
7564
|
-
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
|
|
7565
|
-
};
|
|
7566
|
-
const response = await fetchWithRedirects(absoluteUrl, requestInit);
|
|
7567
|
-
if (!response.ok) {
|
|
7568
|
-
const error = await response.json().catch(() => ({ error: "Request failed" }));
|
|
7569
|
-
throw new Error(error.error || `Request failed with status ${response.status}`);
|
|
7570
|
-
}
|
|
7571
|
-
return response.json();
|
|
7572
|
-
}
|
|
7573
|
-
|
|
7574
|
-
// src/lib/organization.ts
|
|
7575
|
-
async function fetchOrganizations() {
|
|
7576
|
-
const response = await authenticatedFetch(
|
|
7577
|
-
"/v1/user/organizations"
|
|
7578
|
-
);
|
|
7579
|
-
return response.organizations;
|
|
7580
|
-
}
|
|
7581
|
-
async function setActiveOrganization(organizationId) {
|
|
7582
|
-
const organizations = await fetchOrganizations();
|
|
7583
|
-
const organization = organizations.find((org2) => org2.id === organizationId);
|
|
7584
|
-
if (!organization) {
|
|
7585
|
-
throw new Error(`Organization with ID ${organizationId} not found or you don't have access to it.`);
|
|
7586
|
-
}
|
|
7587
|
-
setOrganizationId(organizationId);
|
|
7588
|
-
}
|
|
7589
|
-
async function ensureOrganization() {
|
|
7590
|
-
const organizations = await fetchOrganizations();
|
|
7591
|
-
if (organizations.length === 0) {
|
|
7592
|
-
throw new Error("You are not a member of any organization. Please contact support.");
|
|
7593
|
-
}
|
|
7594
|
-
const defaultOrg = organizations[0];
|
|
7595
|
-
setOrganizationId(defaultOrg.id);
|
|
7596
|
-
return defaultOrg.id;
|
|
7597
|
-
}
|
|
7598
|
-
|
|
7599
|
-
// src/commands/login.ts
|
|
7600
|
-
var WEB_APP_URL = process.env.REPLICAS_WEB_URL || "https://replicas.dev";
|
|
7601
|
-
function generateState() {
|
|
7602
|
-
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
7603
|
-
}
|
|
7604
|
-
async function loginCommand() {
|
|
7605
|
-
const state = generateState();
|
|
7606
|
-
return new Promise((resolve, reject) => {
|
|
7607
|
-
let authTimeout;
|
|
7608
|
-
let hasHandledCallback = false;
|
|
7609
|
-
let lastRedirectUrl = null;
|
|
7610
|
-
let lastMessage = null;
|
|
7611
|
-
const pendingResponses = /* @__PURE__ */ new Set();
|
|
7612
|
-
function respondWithRedirect(res) {
|
|
7613
|
-
if (lastRedirectUrl) {
|
|
7614
|
-
res.writeHead(302, {
|
|
7615
|
-
"Location": lastRedirectUrl,
|
|
7616
|
-
"Connection": "close"
|
|
7617
|
-
});
|
|
7618
|
-
res.end();
|
|
7619
|
-
} else {
|
|
7620
|
-
res.writeHead(200, {
|
|
7621
|
-
"Content-Type": "text/html; charset=utf-8",
|
|
7622
|
-
"Connection": "close"
|
|
7623
|
-
});
|
|
7624
|
-
res.end(`
|
|
7625
|
-
<!DOCTYPE html>
|
|
7626
|
-
<html lang="en">
|
|
7627
|
-
<head>
|
|
7628
|
-
<meta charset="utf-8" />
|
|
7629
|
-
<title>Replicas CLI Login</title>
|
|
7630
|
-
<style>
|
|
7631
|
-
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background:#09090b; color:#f4f4f5; display:flex; align-items:center; justify-content:center; height:100vh; margin:0; }
|
|
7632
|
-
.card { border:1px solid #27272a; padding:32px; border-radius:12px; background:#0f0f12; max-width:420px; text-align:center; }
|
|
7633
|
-
.title { font-size:20px; margin-bottom:12px; letter-spacing:0.08em; text-transform:uppercase; color:#a855f7; }
|
|
7634
|
-
.message { font-family: 'Menlo', 'Source Code Pro', monospace; font-size:14px; line-height:1.6; color:#d4d4d8; white-space:pre-line; }
|
|
7635
|
-
</style>
|
|
7636
|
-
</head>
|
|
7637
|
-
<body>
|
|
7638
|
-
<div class="card">
|
|
7639
|
-
<div class="title">Replicas CLI</div>
|
|
7640
|
-
<div class="message">${lastMessage || "Authentication already processed. You can close this tab."}</div>
|
|
7641
|
-
</div>
|
|
7642
|
-
</body>
|
|
7643
|
-
</html>
|
|
7644
|
-
`);
|
|
7645
|
-
}
|
|
7646
|
-
}
|
|
7647
|
-
function flushPendingResponses() {
|
|
7648
|
-
for (const response of pendingResponses) {
|
|
7649
|
-
respondWithRedirect(response);
|
|
7650
|
-
}
|
|
7651
|
-
pendingResponses.clear();
|
|
7652
|
-
}
|
|
7653
|
-
const server = import_http.default.createServer(async (req, res) => {
|
|
7654
|
-
const url = new import_url.URL(req.url || "", `http://${req.headers.host}`);
|
|
7655
|
-
if (url.pathname === "/callback") {
|
|
7656
|
-
if (hasHandledCallback) {
|
|
7657
|
-
if (!lastRedirectUrl) {
|
|
7658
|
-
pendingResponses.add(res);
|
|
7659
|
-
res.on("close", () => pendingResponses.delete(res));
|
|
7660
|
-
return;
|
|
7661
|
-
}
|
|
7662
|
-
respondWithRedirect(res);
|
|
7663
|
-
return;
|
|
7664
|
-
}
|
|
7665
|
-
const returnedState = url.searchParams.get("state");
|
|
7666
|
-
const accessToken = url.searchParams.get("access_token");
|
|
7667
|
-
const refreshToken2 = url.searchParams.get("refresh_token");
|
|
7668
|
-
const expiresAt = url.searchParams.get("expires_at");
|
|
7669
|
-
const error = url.searchParams.get("error");
|
|
7670
|
-
if (error) {
|
|
7671
|
-
const errorUrl = `${WEB_APP_URL}/cli-login/error?message=${encodeURIComponent(error)}`;
|
|
7672
|
-
lastRedirectUrl = errorUrl;
|
|
7673
|
-
lastMessage = `Authentication failed: ${error}`;
|
|
7674
|
-
respondWithRedirect(res);
|
|
7675
|
-
flushPendingResponses();
|
|
7676
|
-
clearTimeout(authTimeout);
|
|
7677
|
-
setImmediate(() => {
|
|
7678
|
-
server.closeAllConnections?.();
|
|
7679
|
-
server.close();
|
|
7680
|
-
reject(new Error(`Authentication failed: ${error}`));
|
|
7681
|
-
});
|
|
7682
|
-
return;
|
|
7683
|
-
}
|
|
7684
|
-
if (returnedState !== state) {
|
|
7685
|
-
const errorUrl = `${WEB_APP_URL}/cli-login/error?message=${encodeURIComponent("Invalid state parameter. This might be a CSRF attack.")}`;
|
|
7686
|
-
lastRedirectUrl = errorUrl;
|
|
7687
|
-
lastMessage = "Invalid state parameter. This might be a CSRF attack.";
|
|
7688
|
-
respondWithRedirect(res);
|
|
7689
|
-
flushPendingResponses();
|
|
7690
|
-
clearTimeout(authTimeout);
|
|
7691
|
-
setImmediate(() => {
|
|
7692
|
-
server.closeAllConnections?.();
|
|
7693
|
-
server.close();
|
|
7694
|
-
reject(new Error("Invalid state parameter"));
|
|
7695
|
-
});
|
|
7696
|
-
return;
|
|
7697
|
-
}
|
|
7698
|
-
if (!accessToken || !refreshToken2 || !expiresAt) {
|
|
7699
|
-
const errorUrl = `${WEB_APP_URL}/cli-login/error?message=${encodeURIComponent("Missing required authentication tokens.")}`;
|
|
7700
|
-
lastRedirectUrl = errorUrl;
|
|
7701
|
-
lastMessage = "Missing required authentication tokens.";
|
|
7702
|
-
respondWithRedirect(res);
|
|
7703
|
-
flushPendingResponses();
|
|
7704
|
-
clearTimeout(authTimeout);
|
|
7705
|
-
setImmediate(() => {
|
|
7706
|
-
server.closeAllConnections?.();
|
|
7707
|
-
server.close();
|
|
7708
|
-
reject(new Error("Missing authentication tokens"));
|
|
7709
|
-
});
|
|
7710
|
-
return;
|
|
7711
|
-
}
|
|
7712
|
-
hasHandledCallback = true;
|
|
7713
|
-
const existingConfig = readConfig();
|
|
7714
|
-
const config2 = {
|
|
7715
|
-
access_token: accessToken,
|
|
7716
|
-
refresh_token: refreshToken2,
|
|
7717
|
-
expires_at: parseInt(expiresAt, 10),
|
|
7718
|
-
organization_id: existingConfig?.organization_id,
|
|
7719
|
-
ide_command: existingConfig?.ide_command
|
|
7720
|
-
};
|
|
7721
|
-
try {
|
|
7722
|
-
writeConfig(config2);
|
|
7723
|
-
const user = await getCurrentUser();
|
|
7724
|
-
try {
|
|
7725
|
-
const orgId = await ensureOrganization();
|
|
7726
|
-
console.log(import_chalk.default.gray(` Organization: ${orgId}`));
|
|
7727
|
-
} catch (orgError) {
|
|
7728
|
-
console.log(import_chalk.default.yellow(" Warning: Could not fetch organizations"));
|
|
7729
|
-
console.log(import_chalk.default.gray(" You can set your organization later with: replicas org switch"));
|
|
7730
|
-
}
|
|
7731
|
-
const successUrl = `${WEB_APP_URL}/cli-login/success?email=${encodeURIComponent(user.email)}`;
|
|
7732
|
-
lastRedirectUrl = successUrl;
|
|
7733
|
-
lastMessage = `Successfully logged in as ${user.email}. You can close this tab.`;
|
|
7734
|
-
respondWithRedirect(res);
|
|
7735
|
-
flushPendingResponses();
|
|
7736
|
-
console.log(import_chalk.default.green("\n\u2713 Successfully logged in!"));
|
|
7737
|
-
console.log(import_chalk.default.gray(` Email: ${user.email}
|
|
7738
|
-
`));
|
|
7739
|
-
clearTimeout(authTimeout);
|
|
7740
|
-
setImmediate(() => {
|
|
7741
|
-
server.closeAllConnections?.();
|
|
7742
|
-
server.close();
|
|
7743
|
-
resolve();
|
|
7744
|
-
});
|
|
7745
|
-
} catch (error2) {
|
|
7746
|
-
const errorUrl = `${WEB_APP_URL}/cli-login/error?message=${encodeURIComponent("Failed to verify authentication.")}`;
|
|
7747
|
-
lastRedirectUrl = errorUrl;
|
|
7748
|
-
lastMessage = "Failed to verify authentication.";
|
|
7749
|
-
respondWithRedirect(res);
|
|
7750
|
-
flushPendingResponses();
|
|
7751
|
-
clearTimeout(authTimeout);
|
|
7752
|
-
setImmediate(() => {
|
|
7753
|
-
server.closeAllConnections?.();
|
|
7754
|
-
server.close();
|
|
7755
|
-
reject(error2);
|
|
7756
|
-
});
|
|
7757
|
-
}
|
|
7758
|
-
} else {
|
|
7759
|
-
res.writeHead(404);
|
|
7760
|
-
res.end("Not found");
|
|
7761
|
-
}
|
|
7762
|
-
});
|
|
7763
|
-
server.listen(0, "localhost", () => {
|
|
7764
|
-
const address = server.address();
|
|
7765
|
-
if (!address || typeof address === "string") {
|
|
7766
|
-
reject(new Error("Failed to start server"));
|
|
7767
|
-
return;
|
|
7768
|
-
}
|
|
7769
|
-
const port = address.port;
|
|
7770
|
-
const loginUrl = `${WEB_APP_URL}/cli-login?port=${port}&state=${state}`;
|
|
7771
|
-
console.log(import_chalk.default.blue("\nOpening browser for authentication..."));
|
|
7772
|
-
console.log(import_chalk.default.gray(`If the browser doesn't open automatically, visit:
|
|
7773
|
-
${loginUrl}
|
|
7774
|
-
`));
|
|
7775
|
-
(0, import_open.default)(loginUrl).catch((error) => {
|
|
7776
|
-
console.log(import_chalk.default.yellow("Failed to open browser automatically."));
|
|
7777
|
-
console.log(import_chalk.default.gray(`Please open this URL manually:
|
|
7778
|
-
${loginUrl}
|
|
7779
|
-
`));
|
|
7780
|
-
});
|
|
7781
|
-
});
|
|
7782
|
-
authTimeout = setTimeout(() => {
|
|
7783
|
-
server.closeAllConnections?.();
|
|
7784
|
-
server.close();
|
|
7785
|
-
reject(new Error("Authentication timeout. Please try again."));
|
|
7786
|
-
}, 5 * 60 * 1e3);
|
|
7787
|
-
});
|
|
7788
|
-
}
|
|
7789
|
-
|
|
7790
|
-
// src/commands/logout.ts
|
|
7791
|
-
var import_chalk2 = __toESM(require("chalk"));
|
|
7792
|
-
function logoutCommand() {
|
|
7793
|
-
if (!isAuthenticated()) {
|
|
7794
|
-
console.log(import_chalk2.default.yellow("You are not logged in."));
|
|
7795
|
-
return;
|
|
7796
|
-
}
|
|
7797
|
-
deleteConfig();
|
|
7798
|
-
console.log(import_chalk2.default.green("\u2713 Successfully logged out!"));
|
|
7799
|
-
}
|
|
7800
|
-
|
|
7801
|
-
// src/commands/whoami.ts
|
|
7802
|
-
var import_chalk3 = __toESM(require("chalk"));
|
|
7803
|
-
async function whoamiCommand() {
|
|
7804
|
-
if (!isAuthenticated()) {
|
|
7805
|
-
console.log(import_chalk3.default.yellow("You are not logged in."));
|
|
7806
|
-
console.log(import_chalk3.default.gray('Run "replicas login" to authenticate.'));
|
|
7807
|
-
return;
|
|
7808
|
-
}
|
|
7809
|
-
try {
|
|
7810
|
-
const user = await getCurrentUser();
|
|
7811
|
-
console.log(import_chalk3.default.blue("\nCurrent User:"));
|
|
7812
|
-
console.log(import_chalk3.default.gray(` ID: ${user.id}`));
|
|
7813
|
-
console.log(import_chalk3.default.gray(` Email: ${user.email}
|
|
7814
|
-
`));
|
|
7815
|
-
} catch (error) {
|
|
7816
|
-
console.error(import_chalk3.default.red("Failed to get user information."));
|
|
7817
|
-
if (error instanceof Error) {
|
|
7818
|
-
console.error(import_chalk3.default.gray(error.message));
|
|
7819
|
-
}
|
|
7820
|
-
console.log(import_chalk3.default.gray('\nTry running "replicas login" again.'));
|
|
7821
|
-
process.exit(1);
|
|
7822
|
-
}
|
|
7823
|
-
}
|
|
7824
|
-
|
|
7825
|
-
// src/commands/connect.ts
|
|
7826
|
-
var import_chalk5 = __toESM(require("chalk"));
|
|
7827
|
-
|
|
7828
|
-
// src/lib/ssh.ts
|
|
7829
|
-
var import_child_process = require("child_process");
|
|
7830
|
-
var SSH_OPTIONS = ["-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null"];
|
|
7831
|
-
async function connectSSH(token, host) {
|
|
7832
|
-
return new Promise((resolve, reject) => {
|
|
7833
|
-
const sshArgs = [...SSH_OPTIONS, `${token}@${host}`];
|
|
7834
|
-
const ssh = (0, import_child_process.spawn)("ssh", sshArgs, {
|
|
7835
|
-
stdio: "inherit"
|
|
7836
|
-
});
|
|
7837
|
-
ssh.on("close", () => {
|
|
7838
|
-
resolve();
|
|
7839
|
-
});
|
|
7840
|
-
ssh.on("error", reject);
|
|
7841
|
-
});
|
|
7842
|
-
}
|
|
7843
|
-
|
|
7844
|
-
// src/lib/workspace-connection.ts
|
|
7845
|
-
var import_chalk4 = __toESM(require("chalk"));
|
|
7846
|
-
var import_prompts = __toESM(require("prompts"));
|
|
7847
|
-
|
|
7848
|
-
// src/lib/git.ts
|
|
7849
|
-
var import_child_process2 = require("child_process");
|
|
7850
|
-
var import_path2 = __toESM(require("path"));
|
|
7851
|
-
function getGitRoot() {
|
|
7852
|
-
try {
|
|
7853
|
-
const root = (0, import_child_process2.execSync)("git rev-parse --show-toplevel", {
|
|
7854
|
-
encoding: "utf-8",
|
|
7855
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
7856
|
-
}).trim();
|
|
7857
|
-
return root;
|
|
7858
|
-
} catch (error) {
|
|
7859
|
-
throw new Error("Not inside a git repository");
|
|
7860
|
-
}
|
|
7861
|
-
}
|
|
7862
|
-
function getGitRepoName() {
|
|
7863
|
-
const root = getGitRoot();
|
|
7864
|
-
return import_path2.default.basename(root);
|
|
7865
|
-
}
|
|
7866
|
-
function isInsideGitRepo() {
|
|
7867
|
-
try {
|
|
7868
|
-
(0, import_child_process2.execSync)("git rev-parse --is-inside-work-tree", {
|
|
7869
|
-
encoding: "utf-8",
|
|
7870
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
7871
|
-
});
|
|
7872
|
-
return true;
|
|
7873
|
-
} catch {
|
|
7874
|
-
return false;
|
|
7875
|
-
}
|
|
7876
|
-
}
|
|
7877
|
-
|
|
7878
|
-
// src/lib/workspace-connection.ts
|
|
7879
|
-
async function prepareWorkspaceConnection(workspaceName) {
|
|
7880
|
-
const orgId = getOrganizationId();
|
|
7881
|
-
if (!orgId) {
|
|
7882
|
-
throw new Error('No organization selected. Please run "replicas org switch" first.');
|
|
7883
|
-
}
|
|
7884
|
-
console.log(import_chalk4.default.blue(`
|
|
7885
|
-
Searching for workspace: ${workspaceName}...`));
|
|
7886
|
-
const response = await orgAuthenticatedFetch(
|
|
7887
|
-
`/v1/workspaces?name=${encodeURIComponent(workspaceName)}`
|
|
7888
|
-
);
|
|
7889
|
-
if (response.workspaces.length === 0) {
|
|
7890
|
-
throw new Error(`No workspaces found with name matching "${workspaceName}".`);
|
|
7891
|
-
}
|
|
7892
|
-
let selectedWorkspace;
|
|
7893
|
-
if (response.workspaces.length === 1) {
|
|
7894
|
-
selectedWorkspace = response.workspaces[0];
|
|
7895
|
-
} else {
|
|
7896
|
-
console.log(import_chalk4.default.yellow(`
|
|
7897
|
-
Found ${response.workspaces.length} workspaces matching "${workspaceName}":`));
|
|
7898
|
-
const selectResponse = await (0, import_prompts.default)({
|
|
7899
|
-
type: "select",
|
|
7900
|
-
name: "workspaceId",
|
|
7901
|
-
message: "Select a workspace:",
|
|
7902
|
-
choices: response.workspaces.map((ws) => ({
|
|
7903
|
-
title: `${ws.name} (${ws.status || "unknown"})`,
|
|
7904
|
-
value: ws.id,
|
|
7905
|
-
description: `Status: ${ws.status || "unknown"}`
|
|
7906
|
-
}))
|
|
7907
|
-
});
|
|
7908
|
-
if (!selectResponse.workspaceId) {
|
|
7909
|
-
throw new Error("Workspace selection cancelled.");
|
|
7910
|
-
}
|
|
7911
|
-
selectedWorkspace = response.workspaces.find((ws) => ws.id === selectResponse.workspaceId);
|
|
7912
|
-
}
|
|
7913
|
-
console.log(import_chalk4.default.green(`
|
|
7914
|
-
\u2713 Selected workspace: ${selectedWorkspace.name}`));
|
|
7915
|
-
console.log(import_chalk4.default.gray(` Status: ${selectedWorkspace.status || "unknown"}`));
|
|
7916
|
-
if (selectedWorkspace.status === "sleeping") {
|
|
7917
|
-
throw new Error(
|
|
7918
|
-
"Workspace is currently sleeping. Please wake it up in the dashboard at https://replicas.dev before connecting."
|
|
7919
|
-
);
|
|
7920
|
-
}
|
|
7921
|
-
console.log(import_chalk4.default.blue("\nRequesting SSH access token..."));
|
|
7922
|
-
const tokenResponse = await orgAuthenticatedFetch(
|
|
7923
|
-
`/v1/workspaces/${selectedWorkspace.id}/ssh-token`,
|
|
7924
|
-
{ method: "POST" }
|
|
7925
|
-
);
|
|
7926
|
-
console.log(import_chalk4.default.green("\u2713 SSH token received"));
|
|
7927
|
-
let repoName = null;
|
|
7928
|
-
if (isInsideGitRepo()) {
|
|
7929
|
-
try {
|
|
7930
|
-
repoName = getGitRepoName();
|
|
7931
|
-
} catch {
|
|
7932
|
-
}
|
|
7933
|
-
}
|
|
7934
|
-
return {
|
|
7935
|
-
workspace: selectedWorkspace,
|
|
7936
|
-
sshToken: tokenResponse.token,
|
|
7937
|
-
sshHost: tokenResponse.host,
|
|
7938
|
-
repoName
|
|
7939
|
-
};
|
|
7940
|
-
}
|
|
7941
|
-
|
|
7942
|
-
// src/commands/connect.ts
|
|
7943
|
-
async function connectCommand(workspaceName) {
|
|
7944
|
-
if (!isAuthenticated()) {
|
|
7945
|
-
console.log(import_chalk5.default.red('Not logged in. Please run "replicas login" first.'));
|
|
7946
|
-
process.exit(1);
|
|
7947
|
-
}
|
|
7948
|
-
try {
|
|
7949
|
-
const { workspace, sshToken, sshHost } = await prepareWorkspaceConnection(workspaceName);
|
|
7950
|
-
console.log(import_chalk5.default.blue(`
|
|
7951
|
-
Connecting to ${workspace.name}...`));
|
|
7952
|
-
const sshCommand = `ssh ${sshToken}@${sshHost}`;
|
|
7953
|
-
console.log(import_chalk5.default.gray(`SSH command: ${sshCommand}`));
|
|
7954
|
-
console.log(import_chalk5.default.gray("\nPress Ctrl+D to disconnect.\n"));
|
|
7955
|
-
await connectSSH(sshToken, sshHost);
|
|
7956
|
-
console.log(import_chalk5.default.green("\n\u2713 Disconnected from workspace.\n"));
|
|
7957
|
-
} catch (error) {
|
|
7958
|
-
console.error(import_chalk5.default.red(`
|
|
7959
|
-
Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
7960
|
-
process.exit(1);
|
|
7961
|
-
}
|
|
7962
|
-
}
|
|
7963
|
-
|
|
7964
|
-
// src/commands/code.ts
|
|
7965
|
-
var import_chalk6 = __toESM(require("chalk"));
|
|
7966
|
-
var import_child_process3 = require("child_process");
|
|
7967
|
-
|
|
7968
|
-
// ../shared/src/pricing.ts
|
|
7969
|
-
var PLANS = {
|
|
7970
|
-
hobby: {
|
|
7971
|
-
id: "hobby",
|
|
7972
|
-
name: "Hobby",
|
|
7973
|
-
monthlyPrice: 0,
|
|
7974
|
-
seatPriceCents: 0,
|
|
7975
|
-
creditsIncluded: 20,
|
|
7976
|
-
features: ["20 hours of usage"]
|
|
7977
|
-
},
|
|
7978
|
-
developer: {
|
|
7979
|
-
id: "developer",
|
|
7980
|
-
name: "Developer",
|
|
7981
|
-
monthlyPrice: 30,
|
|
7982
|
-
seatPriceCents: 3e3,
|
|
7983
|
-
creditsIncluded: 0,
|
|
7984
|
-
features: ["Unlimited usage", "API access ($1/hr)"]
|
|
7985
|
-
},
|
|
7986
|
-
team: {
|
|
7987
|
-
id: "team",
|
|
7988
|
-
name: "Team",
|
|
7989
|
-
monthlyPrice: 120,
|
|
7990
|
-
seatPriceCents: 12e3,
|
|
7991
|
-
creditsIncluded: 0,
|
|
7992
|
-
features: [
|
|
7993
|
-
"Unlimited usage",
|
|
7994
|
-
"API access",
|
|
7995
|
-
"Higher API rate limits",
|
|
7996
|
-
"Warm hooks and pool access",
|
|
7997
|
-
"Optional add-ons for higher resources, warm pools, rate limits, and SOC 2"
|
|
7998
|
-
]
|
|
7999
|
-
},
|
|
8000
|
-
enterprise: {
|
|
8001
|
-
id: "enterprise",
|
|
8002
|
-
name: "Enterprise",
|
|
8003
|
-
monthlyPrice: 0,
|
|
8004
|
-
seatPriceCents: 0,
|
|
8005
|
-
creditsIncluded: 0,
|
|
8006
|
-
features: [
|
|
8007
|
-
"Unlimited usage",
|
|
8008
|
-
"Custom API rates",
|
|
8009
|
-
"Custom rate limits",
|
|
8010
|
-
"Custom warm hooks and pools",
|
|
8011
|
-
"SOC 2"
|
|
8012
|
-
]
|
|
8013
|
-
}
|
|
8014
|
-
};
|
|
8015
|
-
var TEAM_PLAN = PLANS.team;
|
|
8016
|
-
var ENTERPRISE_PLAN = PLANS.enterprise;
|
|
8017
|
-
|
|
8018
7500
|
// ../shared/src/sandbox.ts
|
|
8019
7501
|
var SANDBOX_LIFECYCLE = {
|
|
8020
7502
|
AUTO_STOP_MINUTES: 60,
|
|
@@ -8042,9 +7524,31 @@ var MAX_WARM_HOOK_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
|
8042
7524
|
// ../shared/src/replicas-config.ts
|
|
8043
7525
|
var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
|
|
8044
7526
|
|
|
8045
|
-
// ../shared/src/
|
|
8046
|
-
var
|
|
8047
|
-
|
|
7527
|
+
// ../shared/src/engine/types.ts
|
|
7528
|
+
var DEFAULT_CHAT_TITLES = {
|
|
7529
|
+
claude: "Claude Code",
|
|
7530
|
+
codex: "Codex"
|
|
7531
|
+
};
|
|
7532
|
+
function getInitialChatId(chats, preferredProvider = "claude") {
|
|
7533
|
+
if (chats.length === 0) return null;
|
|
7534
|
+
const isDefault = (c) => c.title === DEFAULT_CHAT_TITLES[c.provider];
|
|
7535
|
+
const hasActivity = (c) => c.updatedAt > c.createdAt;
|
|
7536
|
+
const mostActive = (list) => list.filter(hasActivity).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))[0] ?? null;
|
|
7537
|
+
const fallbackProvider = preferredProvider === "claude" ? "codex" : "claude";
|
|
7538
|
+
const preferred = chats.filter((c) => c.provider === preferredProvider);
|
|
7539
|
+
const fallback = chats.filter((c) => c.provider === fallbackProvider);
|
|
7540
|
+
return mostActive(preferred)?.id ?? mostActive(fallback)?.id ?? preferred.find(isDefault)?.id ?? fallback.find(isDefault)?.id ?? chats[0]?.id ?? null;
|
|
7541
|
+
}
|
|
7542
|
+
|
|
7543
|
+
// ../shared/src/prompts.ts
|
|
7544
|
+
var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
|
|
7545
|
+
function removeTag(text, tag) {
|
|
7546
|
+
const regex = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, "g");
|
|
7547
|
+
return text.replace(regex, "").trim();
|
|
7548
|
+
}
|
|
7549
|
+
function removeReplicasInstructions(text) {
|
|
7550
|
+
return removeTag(text, REPLICAS_INSTRUCTIONS_TAG);
|
|
7551
|
+
}
|
|
8048
7552
|
|
|
8049
7553
|
// ../shared/src/display-message/parsers/codex-parser.ts
|
|
8050
7554
|
function safeJsonParse(str, fallback) {
|
|
@@ -8365,19 +7869,28 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
8365
7869
|
const inputObj = typeof toolInput === "string" ? safeJsonParse2(toolInput, {}) : toolInput;
|
|
8366
7870
|
const filePath = inputObj.file_path || "";
|
|
8367
7871
|
const action = toolName === "Write" ? "add" : "update";
|
|
7872
|
+
let diff;
|
|
7873
|
+
if (toolName === "Edit" && inputObj.old_string != null && inputObj.new_string != null) {
|
|
7874
|
+
const oldLines = inputObj.old_string.replace(/\n$/, "").split("\n").map((l) => `-${l}`);
|
|
7875
|
+
const newLines = inputObj.new_string.replace(/\n$/, "").split("\n").map((l) => `+${l}`);
|
|
7876
|
+
diff = [...oldLines, ...newLines].join("\n");
|
|
7877
|
+
} else if (toolName === "Write" && inputObj.content != null) {
|
|
7878
|
+
diff = inputObj.content.replace(/\n$/, "").split("\n").map((l) => `+${l}`).join("\n");
|
|
7879
|
+
}
|
|
8368
7880
|
messages.push({
|
|
8369
|
-
id: `
|
|
8370
|
-
type: "
|
|
8371
|
-
|
|
7881
|
+
id: `patch-${event.timestamp}-${messages.length}`,
|
|
7882
|
+
type: "patch",
|
|
7883
|
+
operations: [{
|
|
7884
|
+
action,
|
|
8372
7885
|
path: filePath,
|
|
8373
|
-
|
|
7886
|
+
diff
|
|
8374
7887
|
}],
|
|
8375
7888
|
status: "in_progress",
|
|
8376
7889
|
timestamp: event.timestamp
|
|
8377
7890
|
});
|
|
8378
7891
|
} else if (toolName === "TodoWrite") {
|
|
8379
7892
|
const inputObj = typeof toolInput === "string" ? safeJsonParse2(toolInput, {}) : toolInput;
|
|
8380
|
-
const todos = inputObj.todos
|
|
7893
|
+
const todos = Array.isArray(inputObj.todos) ? inputObj.todos : [];
|
|
8381
7894
|
const todoItems = todos.map((todo) => ({
|
|
8382
7895
|
text: todo.content,
|
|
8383
7896
|
completed: todo.status === "completed"
|
|
@@ -8460,7 +7973,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
8460
7973
|
} else {
|
|
8461
7974
|
message.exitCode = isError ? 1 : 0;
|
|
8462
7975
|
}
|
|
8463
|
-
} else if (message.type === "
|
|
7976
|
+
} else if (message.type === "patch") {
|
|
8464
7977
|
message.status = status;
|
|
8465
7978
|
} else if (message.type === "web_search") {
|
|
8466
7979
|
message.status = status;
|
|
@@ -8480,6 +7993,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
8480
7993
|
}
|
|
8481
7994
|
|
|
8482
7995
|
// ../shared/src/display-message/parsers/index.ts
|
|
7996
|
+
var INTERRUPTED_MESSAGE_REGEX = /^\[Request interrupted by user.*\]$/;
|
|
8483
7997
|
function parseAgentEvents(events, agentType) {
|
|
8484
7998
|
if (agentType === "codex") {
|
|
8485
7999
|
return parseCodexEvents(events);
|
|
@@ -8488,1675 +8002,262 @@ function parseAgentEvents(events, agentType) {
|
|
|
8488
8002
|
}
|
|
8489
8003
|
return [];
|
|
8490
8004
|
}
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
import_fs2.default.mkdirSync(sshDir, { recursive: true, mode: 448 });
|
|
8503
|
-
}
|
|
8504
|
-
}
|
|
8505
|
-
function readSSHConfig() {
|
|
8506
|
-
ensureSSHDir();
|
|
8507
|
-
if (!import_fs2.default.existsSync(SSH_CONFIG_PATH)) {
|
|
8508
|
-
return "";
|
|
8509
|
-
}
|
|
8510
|
-
return import_fs2.default.readFileSync(SSH_CONFIG_PATH, "utf-8");
|
|
8511
|
-
}
|
|
8512
|
-
function writeSSHConfig(content) {
|
|
8513
|
-
ensureSSHDir();
|
|
8514
|
-
import_fs2.default.writeFileSync(SSH_CONFIG_PATH, content, { mode: 384 });
|
|
8005
|
+
function createUserMessage(content) {
|
|
8006
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
8007
|
+
return {
|
|
8008
|
+
message: {
|
|
8009
|
+
id: `user-${Date.now()}`,
|
|
8010
|
+
type: "user",
|
|
8011
|
+
content,
|
|
8012
|
+
timestamp
|
|
8013
|
+
},
|
|
8014
|
+
timestamp
|
|
8015
|
+
};
|
|
8515
8016
|
}
|
|
8516
|
-
function
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
` HostName ${entry.hostname}`,
|
|
8521
|
-
` User ${entry.user}`,
|
|
8522
|
-
` StrictHostKeyChecking no`,
|
|
8523
|
-
` UserKnownHostsFile /dev/null`
|
|
8524
|
-
];
|
|
8525
|
-
lines.push(REPLICAS_MARKER_END);
|
|
8526
|
-
return lines.join("\n");
|
|
8017
|
+
function isAgentBackendEvent(value) {
|
|
8018
|
+
if (!value || typeof value !== "object") return false;
|
|
8019
|
+
const candidate = value;
|
|
8020
|
+
return typeof candidate.timestamp === "string" && typeof candidate.type === "string" && typeof candidate.payload === "object" && candidate.payload !== null;
|
|
8527
8021
|
}
|
|
8528
|
-
function
|
|
8529
|
-
let
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
if (line.trim() === REPLICAS_MARKER_START) {
|
|
8535
|
-
const nextLines = lines.slice(lines.indexOf(line) + 1, lines.indexOf(line) + 3);
|
|
8536
|
-
const hostLine = nextLines.find((l) => l.trim().startsWith("Host "));
|
|
8537
|
-
if (hostLine && hostLine.includes(entry.host)) {
|
|
8538
|
-
inTargetBlock = true;
|
|
8539
|
-
continue;
|
|
8540
|
-
}
|
|
8541
|
-
result.push(line);
|
|
8542
|
-
continue;
|
|
8022
|
+
function filterDisplayMessages(messages, provider) {
|
|
8023
|
+
let result = messages;
|
|
8024
|
+
if (provider === "codex") {
|
|
8025
|
+
const userMessages = result.map((msg, index) => ({ msg, index })).filter(({ msg }) => msg.type === "user");
|
|
8026
|
+
if (userMessages.length >= 2) {
|
|
8027
|
+
result = result.slice(userMessages[1].index);
|
|
8543
8028
|
}
|
|
8544
|
-
if (line.trim() === REPLICAS_MARKER_END) {
|
|
8545
|
-
if (inTargetBlock) {
|
|
8546
|
-
inTargetBlock = false;
|
|
8547
|
-
continue;
|
|
8548
|
-
}
|
|
8549
|
-
result.push(line);
|
|
8550
|
-
continue;
|
|
8551
|
-
}
|
|
8552
|
-
if (inTargetBlock) {
|
|
8553
|
-
continue;
|
|
8554
|
-
}
|
|
8555
|
-
result.push(line);
|
|
8556
|
-
}
|
|
8557
|
-
config2 = result.join("\n");
|
|
8558
|
-
const newEntry = generateConfigBlock(entry);
|
|
8559
|
-
let finalConfig = config2.trim();
|
|
8560
|
-
if (finalConfig.length > 0) {
|
|
8561
|
-
finalConfig += "\n\n";
|
|
8562
|
-
}
|
|
8563
|
-
finalConfig += newEntry + "\n";
|
|
8564
|
-
writeSSHConfig(finalConfig);
|
|
8565
|
-
}
|
|
8566
|
-
function getWorkspaceHostAlias(workspaceName) {
|
|
8567
|
-
return `replicas-${workspaceName.toLowerCase().replace(/[^a-z0-9-]/g, "-")}`;
|
|
8568
|
-
}
|
|
8569
|
-
|
|
8570
|
-
// src/commands/code.ts
|
|
8571
|
-
async function codeCommand(workspaceName) {
|
|
8572
|
-
if (!isAuthenticated()) {
|
|
8573
|
-
console.log(import_chalk6.default.red('Not logged in. Please run "replicas login" first.'));
|
|
8574
|
-
process.exit(1);
|
|
8575
|
-
}
|
|
8576
|
-
try {
|
|
8577
|
-
const { workspace, sshToken, sshHost, repoName } = await prepareWorkspaceConnection(workspaceName);
|
|
8578
|
-
const hostAlias = getWorkspaceHostAlias(workspace.name);
|
|
8579
|
-
console.log(import_chalk6.default.blue("\nConfiguring SSH connection..."));
|
|
8580
|
-
addOrUpdateSSHConfigEntry({
|
|
8581
|
-
host: hostAlias,
|
|
8582
|
-
hostname: sshHost,
|
|
8583
|
-
user: sshToken
|
|
8584
|
-
});
|
|
8585
|
-
console.log(import_chalk6.default.green(`\u2713 SSH config entry created: ${hostAlias}`));
|
|
8586
|
-
const remotePath = repoName ? `${SANDBOX_PATHS.WORKSPACES_DIR}/${repoName}` : SANDBOX_PATHS.HOME_DIR;
|
|
8587
|
-
const ideCommand = getIdeCommand();
|
|
8588
|
-
const fullCommand = `${ideCommand} --remote ssh-remote+${hostAlias} ${remotePath}`;
|
|
8589
|
-
console.log(import_chalk6.default.blue(`
|
|
8590
|
-
Opening ${ideCommand} for workspace ${workspace.name}...`));
|
|
8591
|
-
console.log(import_chalk6.default.gray(`Command: ${fullCommand}`));
|
|
8592
|
-
console.log(import_chalk6.default.yellow(`
|
|
8593
|
-
Note: SSH tokens expire after 3 hours. Run this command again to refresh.`));
|
|
8594
|
-
const ide = (0, import_child_process3.spawn)(ideCommand, [
|
|
8595
|
-
"--remote",
|
|
8596
|
-
`ssh-remote+${hostAlias}`,
|
|
8597
|
-
remotePath
|
|
8598
|
-
], {
|
|
8599
|
-
stdio: "inherit",
|
|
8600
|
-
detached: false
|
|
8601
|
-
});
|
|
8602
|
-
ide.on("error", (error) => {
|
|
8603
|
-
console.error(import_chalk6.default.red(`
|
|
8604
|
-
Failed to launch ${ideCommand}: ${error.message}`));
|
|
8605
|
-
console.log(import_chalk6.default.yellow(`
|
|
8606
|
-
Make sure ${ideCommand} is installed and available in your PATH.`));
|
|
8607
|
-
console.log(import_chalk6.default.gray(`You can configure a different IDE with: replicas config set ide <command>`));
|
|
8608
|
-
process.exit(1);
|
|
8609
|
-
});
|
|
8610
|
-
ide.on("close", (code) => {
|
|
8611
|
-
if (code === 0) {
|
|
8612
|
-
console.log(import_chalk6.default.green(`
|
|
8613
|
-
\u2713 ${ideCommand} closed successfully.
|
|
8614
|
-
`));
|
|
8615
|
-
}
|
|
8616
|
-
});
|
|
8617
|
-
} catch (error) {
|
|
8618
|
-
console.error(import_chalk6.default.red(`
|
|
8619
|
-
Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
8620
|
-
process.exit(1);
|
|
8621
8029
|
}
|
|
8030
|
+
result = result.map((msg) => {
|
|
8031
|
+
if (msg.type !== "user") return msg;
|
|
8032
|
+
const cleaned = removeReplicasInstructions(msg.content).trim();
|
|
8033
|
+
if (INTERRUPTED_MESSAGE_REGEX.test(cleaned)) {
|
|
8034
|
+
return { ...msg, content: "Request interrupted" };
|
|
8035
|
+
}
|
|
8036
|
+
return cleaned !== msg.content ? { ...msg, content: cleaned } : msg;
|
|
8037
|
+
});
|
|
8038
|
+
return result;
|
|
8622
8039
|
}
|
|
8623
8040
|
|
|
8624
|
-
// src/
|
|
8625
|
-
var
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8041
|
+
// ../shared/src/placeholder-names.ts
|
|
8042
|
+
var FRUITS = [
|
|
8043
|
+
"apple",
|
|
8044
|
+
"banana",
|
|
8045
|
+
"cherry",
|
|
8046
|
+
"fig",
|
|
8047
|
+
"grape",
|
|
8048
|
+
"kiwi",
|
|
8049
|
+
"lemon",
|
|
8050
|
+
"lime",
|
|
8051
|
+
"mango",
|
|
8052
|
+
"melon",
|
|
8053
|
+
"olive",
|
|
8054
|
+
"orange",
|
|
8055
|
+
"peach",
|
|
8056
|
+
"pear",
|
|
8057
|
+
"plum",
|
|
8058
|
+
"guava",
|
|
8059
|
+
"papaya",
|
|
8060
|
+
"lychee",
|
|
8061
|
+
"coconut",
|
|
8062
|
+
"apricot",
|
|
8063
|
+
"avocado",
|
|
8064
|
+
"berry",
|
|
8065
|
+
"kumquat",
|
|
8066
|
+
"nectarine",
|
|
8067
|
+
"tangerine",
|
|
8068
|
+
"dragonfruit"
|
|
8069
|
+
];
|
|
8070
|
+
var TTC_STATIONS = [
|
|
8071
|
+
"kipling",
|
|
8072
|
+
"islington",
|
|
8073
|
+
"royal-york",
|
|
8074
|
+
"old-mill",
|
|
8075
|
+
"jane",
|
|
8076
|
+
"runnymede",
|
|
8077
|
+
"high-park",
|
|
8078
|
+
"keele",
|
|
8079
|
+
"dundas-west",
|
|
8080
|
+
"lansdowne",
|
|
8081
|
+
"dufferin",
|
|
8082
|
+
"ossington",
|
|
8083
|
+
"christie",
|
|
8084
|
+
"bathurst",
|
|
8085
|
+
"spadina",
|
|
8086
|
+
"st-george",
|
|
8087
|
+
"bay",
|
|
8088
|
+
"bloor-yonge",
|
|
8089
|
+
"sherbourne",
|
|
8090
|
+
"castle-frank",
|
|
8091
|
+
"broadview",
|
|
8092
|
+
"chester",
|
|
8093
|
+
"pape",
|
|
8094
|
+
"donlands",
|
|
8095
|
+
"greenwood",
|
|
8096
|
+
"woodbine",
|
|
8097
|
+
"warden",
|
|
8098
|
+
"kennedy"
|
|
8099
|
+
];
|
|
8100
|
+
function randomElement(arr) {
|
|
8101
|
+
return arr[Math.floor(Math.random() * arr.length)];
|
|
8654
8102
|
}
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
console.log(import_chalk7.default.red('Not logged in. Please run "replicas login" first.'));
|
|
8658
|
-
process.exit(1);
|
|
8659
|
-
}
|
|
8660
|
-
try {
|
|
8661
|
-
const organizations = await fetchOrganizations();
|
|
8662
|
-
if (organizations.length === 0) {
|
|
8663
|
-
console.log(import_chalk7.default.yellow("You are not a member of any organization."));
|
|
8664
|
-
console.log(import_chalk7.default.gray("Please contact support.\n"));
|
|
8665
|
-
return;
|
|
8666
|
-
}
|
|
8667
|
-
if (organizations.length === 1) {
|
|
8668
|
-
await setActiveOrganization(organizations[0].id);
|
|
8669
|
-
console.log(import_chalk7.default.green(`
|
|
8670
|
-
\u2713 Organization set to: ${organizations[0].name}
|
|
8671
|
-
`));
|
|
8672
|
-
return;
|
|
8673
|
-
}
|
|
8674
|
-
const currentOrgId = getOrganizationId();
|
|
8675
|
-
const response = await (0, import_prompts3.default)({
|
|
8676
|
-
type: "select",
|
|
8677
|
-
name: "organizationId",
|
|
8678
|
-
message: "Select an organization:",
|
|
8679
|
-
choices: organizations.map((org2) => ({
|
|
8680
|
-
title: `${org2.name}${org2.id === currentOrgId ? " (current)" : ""}`,
|
|
8681
|
-
value: org2.id,
|
|
8682
|
-
description: org2.id
|
|
8683
|
-
})),
|
|
8684
|
-
initial: organizations.findIndex((org2) => org2.id === currentOrgId)
|
|
8685
|
-
});
|
|
8686
|
-
if (!response.organizationId) {
|
|
8687
|
-
console.log(import_chalk7.default.yellow("\nCancelled."));
|
|
8688
|
-
return;
|
|
8689
|
-
}
|
|
8690
|
-
await setActiveOrganization(response.organizationId);
|
|
8691
|
-
const selectedOrg = organizations.find((org2) => org2.id === response.organizationId);
|
|
8692
|
-
console.log(import_chalk7.default.green(`
|
|
8693
|
-
\u2713 Switched to organization: ${selectedOrg?.name}
|
|
8694
|
-
`));
|
|
8695
|
-
} catch (error) {
|
|
8696
|
-
console.error(import_chalk7.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
8697
|
-
process.exit(1);
|
|
8698
|
-
}
|
|
8103
|
+
function generatePlaceholderName() {
|
|
8104
|
+
return `${randomElement(FRUITS)}-${randomElement(TTC_STATIONS)}`;
|
|
8699
8105
|
}
|
|
8700
8106
|
|
|
8701
|
-
// src/
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8107
|
+
// ../shared/src/workspace-groups.ts
|
|
8108
|
+
function buildGroups(workspaces, workspacesData, repositories, repositorySets, mockGroupAssignments) {
|
|
8109
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
8110
|
+
for (const repo of repositories) {
|
|
8111
|
+
groupMap.set(repo.id, { type: "repo", id: repo.id, name: repo.name, url: repo.url, workspaces: [] });
|
|
8112
|
+
}
|
|
8113
|
+
for (const repoSet of repositorySets) {
|
|
8114
|
+
const setKey = `set:${repoSet.id}`;
|
|
8115
|
+
groupMap.set(setKey, { type: "set", id: setKey, name: repoSet.name, workspaces: [] });
|
|
8116
|
+
}
|
|
8117
|
+
const allWsRepos = workspacesData?.workspace_repositories ?? [];
|
|
8118
|
+
for (const workspace of workspaces) {
|
|
8119
|
+
const repos = allWsRepos.filter((r) => r.workspace_id === workspace.id);
|
|
8120
|
+
if (repos.length > 0) {
|
|
8121
|
+
let placedInSet = false;
|
|
8122
|
+
for (const repoSet of repositorySets) {
|
|
8123
|
+
const setRepoIds = new Set(repoSet.repositories.map((r) => r.id));
|
|
8124
|
+
const wsRepoIds = repos.map((r) => r.id);
|
|
8125
|
+
if (wsRepoIds.length > 1 && wsRepoIds.every((id) => setRepoIds.has(id))) {
|
|
8126
|
+
const setKey = `set:${repoSet.id}`;
|
|
8127
|
+
if (groupMap.has(setKey)) {
|
|
8128
|
+
groupMap.get(setKey).workspaces.push(workspace);
|
|
8129
|
+
placedInSet = true;
|
|
8130
|
+
break;
|
|
8131
|
+
}
|
|
8132
|
+
}
|
|
8133
|
+
}
|
|
8134
|
+
if (!placedInSet) {
|
|
8135
|
+
const primaryRepo = repos[0];
|
|
8136
|
+
const group = groupMap.get(primaryRepo.id);
|
|
8137
|
+
if (group) {
|
|
8138
|
+
group.workspaces.push(workspace);
|
|
8139
|
+
} else {
|
|
8140
|
+
groupMap.set(primaryRepo.id, {
|
|
8141
|
+
type: "repo",
|
|
8142
|
+
id: primaryRepo.id,
|
|
8143
|
+
name: primaryRepo.name,
|
|
8144
|
+
url: primaryRepo.url,
|
|
8145
|
+
workspaces: [workspace]
|
|
8146
|
+
});
|
|
8147
|
+
}
|
|
8148
|
+
}
|
|
8735
8149
|
} else {
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8150
|
+
const assignedGroup = mockGroupAssignments.get(workspace.id);
|
|
8151
|
+
if (assignedGroup && groupMap.has(assignedGroup)) {
|
|
8152
|
+
groupMap.get(assignedGroup).workspaces.push(workspace);
|
|
8153
|
+
} else {
|
|
8154
|
+
const key = "__ungrouped__";
|
|
8155
|
+
if (!groupMap.has(key)) {
|
|
8156
|
+
groupMap.set(key, { type: "repo", id: key, name: "Other", workspaces: [] });
|
|
8157
|
+
}
|
|
8158
|
+
groupMap.get(key).workspaces.push(workspace);
|
|
8159
|
+
}
|
|
8739
8160
|
}
|
|
8740
|
-
} catch (error) {
|
|
8741
|
-
console.error(import_chalk8.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
8742
|
-
process.exit(1);
|
|
8743
|
-
}
|
|
8744
|
-
}
|
|
8745
|
-
async function configListCommand() {
|
|
8746
|
-
if (!isAuthenticated()) {
|
|
8747
|
-
console.log(import_chalk8.default.red('Not logged in. Please run "replicas login" first.'));
|
|
8748
|
-
process.exit(1);
|
|
8749
|
-
}
|
|
8750
|
-
try {
|
|
8751
|
-
const config2 = readConfig();
|
|
8752
|
-
if (!config2) {
|
|
8753
|
-
console.log(import_chalk8.default.red("No config found. Please login first."));
|
|
8754
|
-
process.exit(1);
|
|
8755
|
-
}
|
|
8756
|
-
console.log(import_chalk8.default.green("\nCurrent configuration:"));
|
|
8757
|
-
console.log(import_chalk8.default.gray(` Organization ID: ${config2.organization_id || "(not set)"}`));
|
|
8758
|
-
console.log(import_chalk8.default.gray(` IDE command: ${config2.ide_command || "code (default)"}`));
|
|
8759
|
-
console.log();
|
|
8760
|
-
} catch (error) {
|
|
8761
|
-
console.error(import_chalk8.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
8762
|
-
process.exit(1);
|
|
8763
8161
|
}
|
|
8162
|
+
return Array.from(groupMap.values()).sort((a, b) => a.name.localeCompare(b.name));
|
|
8764
8163
|
}
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
var import_http2 = __toESM(require("http"));
|
|
8771
|
-
var import_url2 = require("url");
|
|
8772
|
-
var import_open2 = __toESM(require("open"));
|
|
8773
|
-
|
|
8774
|
-
// src/lib/pkce.ts
|
|
8775
|
-
var import_crypto = require("crypto");
|
|
8776
|
-
function generatePkceCodes() {
|
|
8777
|
-
const verifierBytes = (0, import_crypto.randomBytes)(32);
|
|
8778
|
-
const codeVerifier = verifierBytes.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
8779
|
-
const hash = (0, import_crypto.createHash)("sha256");
|
|
8780
|
-
hash.update(codeVerifier);
|
|
8781
|
-
const codeChallenge = hash.digest("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
8164
|
+
function createMockWorkspaceRecord(organizationId, name) {
|
|
8165
|
+
const id = "mock-" + Array.from(
|
|
8166
|
+
{ length: 4 },
|
|
8167
|
+
() => Math.random().toString(36).slice(2, 6)
|
|
8168
|
+
).join("-");
|
|
8782
8169
|
return {
|
|
8783
|
-
|
|
8784
|
-
|
|
8170
|
+
id,
|
|
8171
|
+
user_id: null,
|
|
8172
|
+
organization_id: organizationId,
|
|
8173
|
+
name: name || generatePlaceholderName(),
|
|
8174
|
+
sandbox_id: "",
|
|
8175
|
+
engine_url: null,
|
|
8176
|
+
engine_secret: "",
|
|
8177
|
+
github_installation_id: null,
|
|
8178
|
+
last_activity_at: null,
|
|
8179
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8180
|
+
status: "preparing",
|
|
8181
|
+
creation_source: "dashboard",
|
|
8182
|
+
creator_email: null,
|
|
8183
|
+
soft_delete: false
|
|
8785
8184
|
};
|
|
8786
8185
|
}
|
|
8787
|
-
function generateState2() {
|
|
8788
|
-
return (0, import_crypto.randomBytes)(16).toString("hex");
|
|
8789
|
-
}
|
|
8790
8186
|
|
|
8791
|
-
// src/
|
|
8792
|
-
var
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
}
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
idToken: data.id_token,
|
|
8837
|
-
accessToken: data.access_token,
|
|
8838
|
-
refreshToken: data.refresh_token
|
|
8839
|
-
};
|
|
8840
|
-
}
|
|
8841
|
-
function startCallbackServer(expectedState, codeVerifier) {
|
|
8842
|
-
return new Promise((resolve, reject) => {
|
|
8843
|
-
const server = import_http2.default.createServer(async (req, res) => {
|
|
8844
|
-
try {
|
|
8845
|
-
if (!req.url) {
|
|
8846
|
-
res.writeHead(400);
|
|
8847
|
-
res.end("Bad Request");
|
|
8848
|
-
return;
|
|
8849
|
-
}
|
|
8850
|
-
const url = new import_url2.URL(req.url, `http://127.0.0.1:${CALLBACK_PORT}`);
|
|
8851
|
-
if (url.pathname === CALLBACK_PATH) {
|
|
8852
|
-
const code = url.searchParams.get("code");
|
|
8853
|
-
const state = url.searchParams.get("state");
|
|
8854
|
-
const error = url.searchParams.get("error");
|
|
8855
|
-
const errorDescription = url.searchParams.get("error_description");
|
|
8856
|
-
if (error) {
|
|
8857
|
-
const errorMessage = encodeURIComponent(`${error}: ${errorDescription || "Unknown error"}`);
|
|
8858
|
-
res.writeHead(302, { "Location": `${WEB_APP_URL2}/codex/oauth/error?message=${errorMessage}` });
|
|
8859
|
-
res.end();
|
|
8860
|
-
server.close();
|
|
8861
|
-
reject(new Error(`OAuth error: ${error} - ${errorDescription}`));
|
|
8862
|
-
return;
|
|
8863
|
-
}
|
|
8864
|
-
if (state !== expectedState) {
|
|
8865
|
-
const errorMessage = encodeURIComponent("State parameter mismatch. Possible CSRF attack.");
|
|
8866
|
-
res.writeHead(302, { "Location": `${WEB_APP_URL2}/codex/oauth/error?message=${errorMessage}` });
|
|
8867
|
-
res.end();
|
|
8868
|
-
server.close();
|
|
8869
|
-
reject(new Error("State mismatch - possible CSRF attack"));
|
|
8870
|
-
return;
|
|
8871
|
-
}
|
|
8872
|
-
if (!code) {
|
|
8873
|
-
const errorMessage = encodeURIComponent("No authorization code received.");
|
|
8874
|
-
res.writeHead(302, { "Location": `${WEB_APP_URL2}/codex/oauth/error?message=${errorMessage}` });
|
|
8875
|
-
res.end();
|
|
8876
|
-
server.close();
|
|
8877
|
-
reject(new Error("No authorization code received"));
|
|
8878
|
-
return;
|
|
8879
|
-
}
|
|
8880
|
-
try {
|
|
8881
|
-
const tokens = await exchangeCodeForTokens(code, codeVerifier);
|
|
8882
|
-
res.writeHead(302, { "Location": `${WEB_APP_URL2}/codex/oauth/success` });
|
|
8883
|
-
res.end();
|
|
8884
|
-
server.close();
|
|
8885
|
-
resolve(tokens);
|
|
8886
|
-
} catch (tokenError) {
|
|
8887
|
-
const errorMessage = encodeURIComponent(tokenError instanceof Error ? tokenError.message : "Unknown error");
|
|
8888
|
-
res.writeHead(302, { "Location": `${WEB_APP_URL2}/codex/oauth/error?message=${errorMessage}` });
|
|
8889
|
-
res.end();
|
|
8890
|
-
server.close();
|
|
8891
|
-
reject(tokenError);
|
|
8892
|
-
}
|
|
8893
|
-
} else {
|
|
8894
|
-
res.writeHead(404);
|
|
8895
|
-
res.end("Not Found");
|
|
8896
|
-
}
|
|
8897
|
-
} catch (serverError) {
|
|
8898
|
-
res.writeHead(500);
|
|
8899
|
-
res.end("Internal Server Error");
|
|
8900
|
-
server.close();
|
|
8901
|
-
reject(serverError);
|
|
8902
|
-
}
|
|
8903
|
-
});
|
|
8904
|
-
server.on("error", (err) => {
|
|
8905
|
-
if (err.code === "EADDRINUSE") {
|
|
8906
|
-
reject(new Error(`Port ${CALLBACK_PORT} is already in use. Please close any other OAuth flows and try again.`));
|
|
8907
|
-
} else {
|
|
8908
|
-
reject(err);
|
|
8909
|
-
}
|
|
8910
|
-
});
|
|
8911
|
-
server.listen(CALLBACK_PORT, "127.0.0.1");
|
|
8912
|
-
});
|
|
8913
|
-
}
|
|
8914
|
-
async function runCodexOAuthFlow() {
|
|
8915
|
-
const pkce = generatePkceCodes();
|
|
8916
|
-
const state = generateState2();
|
|
8917
|
-
const authUrl = buildAuthorizationUrl(pkce.codeChallenge, state);
|
|
8918
|
-
const tokensPromise = startCallbackServer(state, pkce.codeVerifier);
|
|
8919
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
8920
|
-
console.log("If the browser does not open automatically, visit:");
|
|
8921
|
-
console.log(authUrl);
|
|
8922
|
-
console.log();
|
|
8923
|
-
try {
|
|
8924
|
-
await (0, import_open2.default)(authUrl);
|
|
8925
|
-
} catch (openError) {
|
|
8926
|
-
console.warn("Failed to open browser automatically. Please open the URL manually.");
|
|
8927
|
-
}
|
|
8928
|
-
console.log("Waiting for authentication...");
|
|
8929
|
-
const tokens = await tokensPromise;
|
|
8930
|
-
console.log("\u2713 Successfully obtained Codex credentials");
|
|
8931
|
-
return tokens;
|
|
8932
|
-
}
|
|
8933
|
-
|
|
8934
|
-
// src/commands/codex-auth.ts
|
|
8935
|
-
async function codexAuthCommand(options = {}) {
|
|
8936
|
-
const isUserScoped = options.user === true;
|
|
8937
|
-
const scopeLabel = isUserScoped ? "personal" : "organization";
|
|
8938
|
-
console.log(import_chalk9.default.cyan(`Authenticating with Codex (${scopeLabel})...
|
|
8939
|
-
`));
|
|
8940
|
-
try {
|
|
8941
|
-
const tokens = await runCodexOAuthFlow();
|
|
8942
|
-
console.log(import_chalk9.default.gray("\nUploading credentials to Replicas..."));
|
|
8943
|
-
const endpoint = isUserScoped ? "/v1/codex/user/credentials" : "/v1/codex/credentials";
|
|
8944
|
-
const response = await orgAuthenticatedFetch(
|
|
8945
|
-
endpoint,
|
|
8946
|
-
{
|
|
8947
|
-
method: "POST",
|
|
8948
|
-
body: {
|
|
8949
|
-
access_token: tokens.accessToken,
|
|
8950
|
-
refresh_token: tokens.refreshToken,
|
|
8951
|
-
id_token: tokens.idToken
|
|
8952
|
-
}
|
|
8953
|
-
}
|
|
8954
|
-
);
|
|
8955
|
-
if (response.success) {
|
|
8956
|
-
console.log(import_chalk9.default.green("\n\u2713 Codex authentication complete!"));
|
|
8957
|
-
if (response.email) {
|
|
8958
|
-
console.log(import_chalk9.default.gray(` Account: ${response.email}`));
|
|
8959
|
-
}
|
|
8960
|
-
if (response.planType) {
|
|
8961
|
-
console.log(import_chalk9.default.gray(` Plan: ${response.planType}`));
|
|
8962
|
-
}
|
|
8963
|
-
if (isUserScoped) {
|
|
8964
|
-
console.log(import_chalk9.default.gray("\nYour personal Codex credentials have been saved.\n"));
|
|
8965
|
-
} else {
|
|
8966
|
-
console.log(import_chalk9.default.gray("\nYou can now use Codex in your workspaces.\n"));
|
|
8967
|
-
}
|
|
8968
|
-
} else {
|
|
8969
|
-
throw new Error(response.error || "Failed to upload Codex credentials to Replicas");
|
|
8970
|
-
}
|
|
8971
|
-
} catch (error) {
|
|
8972
|
-
console.log(import_chalk9.default.red("\n\u2717 Error:"), error instanceof Error ? error.message : error);
|
|
8973
|
-
process.exit(1);
|
|
8974
|
-
}
|
|
8975
|
-
}
|
|
8976
|
-
|
|
8977
|
-
// src/commands/claude-auth.ts
|
|
8978
|
-
var import_chalk11 = __toESM(require("chalk"));
|
|
8979
|
-
|
|
8980
|
-
// src/lib/claude-oauth.ts
|
|
8981
|
-
var import_open3 = __toESM(require("open"));
|
|
8982
|
-
var import_readline = __toESM(require("readline"));
|
|
8983
|
-
var import_chalk10 = __toESM(require("chalk"));
|
|
8984
|
-
var DEFAULT_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
|
|
8985
|
-
var CLAUDE_CLIENT_ID = process.env.CLAUDE_OAUTH_CLIENT_ID || DEFAULT_CLIENT_ID;
|
|
8986
|
-
var AUTHORIZATION_ENDPOINT2 = "https://claude.ai/oauth/authorize";
|
|
8987
|
-
var TOKEN_ENDPOINT2 = "https://console.anthropic.com/v1/oauth/token";
|
|
8988
|
-
var REDIRECT_URI = "https://console.anthropic.com/oauth/code/callback";
|
|
8989
|
-
var SCOPES = "org:create_api_key user:profile user:inference";
|
|
8990
|
-
function buildAuthorizationUrl2(codeChallenge, state) {
|
|
8991
|
-
const params = new URLSearchParams({
|
|
8992
|
-
code: "true",
|
|
8993
|
-
client_id: CLAUDE_CLIENT_ID,
|
|
8994
|
-
response_type: "code",
|
|
8995
|
-
redirect_uri: REDIRECT_URI,
|
|
8996
|
-
scope: SCOPES,
|
|
8997
|
-
code_challenge: codeChallenge,
|
|
8998
|
-
code_challenge_method: "S256",
|
|
8999
|
-
state
|
|
9000
|
-
});
|
|
9001
|
-
return `${AUTHORIZATION_ENDPOINT2}?${params.toString()}`;
|
|
9002
|
-
}
|
|
9003
|
-
async function promptForAuthorizationCode(instruction) {
|
|
9004
|
-
const rl = import_readline.default.createInterface({
|
|
9005
|
-
input: process.stdin,
|
|
9006
|
-
output: process.stdout
|
|
9007
|
-
});
|
|
9008
|
-
return new Promise((resolve) => {
|
|
9009
|
-
rl.question(instruction, (answer) => {
|
|
9010
|
-
rl.close();
|
|
9011
|
-
resolve(answer.trim());
|
|
9012
|
-
});
|
|
9013
|
-
});
|
|
9014
|
-
}
|
|
9015
|
-
function parseUserInput(input) {
|
|
9016
|
-
if (!input.includes("#") && !input.includes("code=")) {
|
|
9017
|
-
return { code: input };
|
|
9018
|
-
}
|
|
9019
|
-
if (input.startsWith("http://") || input.startsWith("https://")) {
|
|
9020
|
-
try {
|
|
9021
|
-
const url = new URL(input);
|
|
9022
|
-
const fragment = url.hash.startsWith("#") ? url.hash.slice(1) : url.hash;
|
|
9023
|
-
const params = new URLSearchParams(fragment);
|
|
9024
|
-
const code2 = params.get("code") ?? void 0;
|
|
9025
|
-
const state2 = params.get("state") ?? void 0;
|
|
9026
|
-
if (code2) {
|
|
9027
|
-
return { code: code2, state: state2 };
|
|
9028
|
-
}
|
|
9029
|
-
} catch {
|
|
9030
|
-
}
|
|
9031
|
-
}
|
|
9032
|
-
const [code, state] = input.split("#");
|
|
9033
|
-
return { code, state };
|
|
9034
|
-
}
|
|
9035
|
-
async function exchangeCodeForTokens2(code, state, expectedState, codeVerifier) {
|
|
9036
|
-
if (state && state !== expectedState) {
|
|
9037
|
-
throw new Error("State mismatch detected. Please restart the authentication flow.");
|
|
9038
|
-
}
|
|
9039
|
-
const payload = {
|
|
9040
|
-
code,
|
|
9041
|
-
state: state ?? expectedState,
|
|
9042
|
-
grant_type: "authorization_code",
|
|
9043
|
-
client_id: CLAUDE_CLIENT_ID,
|
|
9044
|
-
redirect_uri: REDIRECT_URI,
|
|
9045
|
-
code_verifier: codeVerifier
|
|
9046
|
-
};
|
|
9047
|
-
const response = await fetch(TOKEN_ENDPOINT2, {
|
|
9048
|
-
method: "POST",
|
|
9049
|
-
headers: {
|
|
9050
|
-
"Content-Type": "application/json"
|
|
9051
|
-
},
|
|
9052
|
-
body: JSON.stringify(payload)
|
|
9053
|
-
});
|
|
9054
|
-
if (!response.ok) {
|
|
9055
|
-
const text = await response.text();
|
|
9056
|
-
throw new Error(`Failed to exchange authorization code: ${response.status} ${text}`);
|
|
9057
|
-
}
|
|
9058
|
-
const data = await response.json();
|
|
9059
|
-
const now = Date.now();
|
|
9060
|
-
const expiresAt = new Date(now + data.expires_in * 1e3).toISOString();
|
|
9061
|
-
const refreshTokenExpiresAt = data.refresh_token_expires_in ? new Date(now + data.refresh_token_expires_in * 1e3).toISOString() : void 0;
|
|
9062
|
-
return {
|
|
9063
|
-
accessToken: data.access_token,
|
|
9064
|
-
refreshToken: data.refresh_token,
|
|
9065
|
-
tokenType: data.token_type,
|
|
9066
|
-
scope: data.scope,
|
|
9067
|
-
expiresAt,
|
|
9068
|
-
refreshTokenExpiresAt
|
|
9069
|
-
};
|
|
9070
|
-
}
|
|
9071
|
-
async function runClaudeOAuthFlow() {
|
|
9072
|
-
const pkce = generatePkceCodes();
|
|
9073
|
-
const state = generateState2();
|
|
9074
|
-
const authUrl = buildAuthorizationUrl2(pkce.codeChallenge, state);
|
|
9075
|
-
console.log(import_chalk10.default.gray("We will open your browser so you can authenticate with Claude Code."));
|
|
9076
|
-
console.log(import_chalk10.default.gray("If the browser does not open automatically, use the URL below:\n"));
|
|
9077
|
-
console.log(authUrl);
|
|
9078
|
-
console.log();
|
|
9079
|
-
try {
|
|
9080
|
-
await (0, import_open3.default)(authUrl);
|
|
9081
|
-
} catch {
|
|
9082
|
-
console.warn(import_chalk10.default.yellow("Failed to open browser automatically. Please copy and open the URL manually."));
|
|
9083
|
-
}
|
|
9084
|
-
console.log(import_chalk10.default.cyan("After completing authentication, copy the code shown on the success page."));
|
|
9085
|
-
console.log(import_chalk10.default.cyan("You can paste either the full URL, or a value formatted as CODE#STATE.\n"));
|
|
9086
|
-
const userInput = await promptForAuthorizationCode("Paste the authorization code (or URL) here: ");
|
|
9087
|
-
if (!userInput) {
|
|
9088
|
-
throw new Error("No authorization code provided.");
|
|
9089
|
-
}
|
|
9090
|
-
const { code, state: returnedState } = parseUserInput(userInput);
|
|
9091
|
-
if (!code) {
|
|
9092
|
-
throw new Error("Unable to parse authorization code. Please try again.");
|
|
9093
|
-
}
|
|
9094
|
-
console.log(import_chalk10.default.gray("\nExchanging authorization code for tokens..."));
|
|
9095
|
-
const tokens = await exchangeCodeForTokens2(code, returnedState, state, pkce.codeVerifier);
|
|
9096
|
-
console.log(import_chalk10.default.green("\u2713 Successfully obtained Claude credentials"));
|
|
9097
|
-
return tokens;
|
|
9098
|
-
}
|
|
9099
|
-
|
|
9100
|
-
// src/commands/claude-auth.ts
|
|
9101
|
-
async function claudeAuthCommand(options = {}) {
|
|
9102
|
-
const isUserScoped = options.user === true;
|
|
9103
|
-
const scopeLabel = isUserScoped ? "personal" : "organization";
|
|
9104
|
-
console.log(import_chalk11.default.cyan(`Authenticating with Claude Code (${scopeLabel})...
|
|
9105
|
-
`));
|
|
9106
|
-
try {
|
|
9107
|
-
const tokens = await runClaudeOAuthFlow();
|
|
9108
|
-
console.log(import_chalk11.default.gray("\nUploading credentials to Replicas..."));
|
|
9109
|
-
const endpoint = isUserScoped ? "/v1/claude/user/credentials" : "/v1/claude/credentials";
|
|
9110
|
-
const response = await orgAuthenticatedFetch(
|
|
9111
|
-
endpoint,
|
|
9112
|
-
{
|
|
9113
|
-
method: "POST",
|
|
9114
|
-
body: {
|
|
9115
|
-
access_token: tokens.accessToken,
|
|
9116
|
-
refresh_token: tokens.refreshToken,
|
|
9117
|
-
token_type: tokens.tokenType,
|
|
9118
|
-
scope: tokens.scope,
|
|
9119
|
-
expires_at: tokens.expiresAt,
|
|
9120
|
-
refresh_token_expires_at: tokens.refreshTokenExpiresAt
|
|
9121
|
-
}
|
|
9122
|
-
}
|
|
9123
|
-
);
|
|
9124
|
-
if (!response.success) {
|
|
9125
|
-
throw new Error(response.error || "Failed to upload Claude credentials to Replicas");
|
|
9126
|
-
}
|
|
9127
|
-
console.log(import_chalk11.default.green("\n\u2713 Claude authentication complete!"));
|
|
9128
|
-
if (response.email) {
|
|
9129
|
-
console.log(import_chalk11.default.gray(` Account: ${response.email}`));
|
|
9130
|
-
}
|
|
9131
|
-
if (response.planType) {
|
|
9132
|
-
console.log(import_chalk11.default.gray(` Plan: ${response.planType}`));
|
|
9133
|
-
}
|
|
9134
|
-
if (isUserScoped) {
|
|
9135
|
-
console.log(import_chalk11.default.gray("\nYour personal Claude credentials have been saved.\n"));
|
|
9136
|
-
} else {
|
|
9137
|
-
console.log(import_chalk11.default.gray("\nYou can now use Claude Code in your workspaces.\n"));
|
|
9138
|
-
}
|
|
9139
|
-
} catch (error) {
|
|
9140
|
-
console.log(import_chalk11.default.red("\n\u2717 Error:"), error instanceof Error ? error.message : error);
|
|
9141
|
-
process.exit(1);
|
|
9142
|
-
}
|
|
9143
|
-
}
|
|
9144
|
-
|
|
9145
|
-
// src/commands/init.ts
|
|
9146
|
-
var import_chalk12 = __toESM(require("chalk"));
|
|
9147
|
-
var import_fs3 = __toESM(require("fs"));
|
|
9148
|
-
var import_path4 = __toESM(require("path"));
|
|
9149
|
-
function getDefaultConfig() {
|
|
9150
|
-
return {
|
|
9151
|
-
systemPrompt: "",
|
|
9152
|
-
startHook: {
|
|
9153
|
-
timeout: 3e5,
|
|
9154
|
-
commands: []
|
|
9155
|
-
}
|
|
9156
|
-
};
|
|
9157
|
-
}
|
|
9158
|
-
function getDefaultYamlContent() {
|
|
9159
|
-
return `# Replicas workspace configuration
|
|
9160
|
-
# See: https://docs.replicas.dev/features/workspaces/repository-configuration
|
|
9161
|
-
|
|
9162
|
-
systemPrompt: |
|
|
9163
|
-
Add custom instructions for coding agents here.
|
|
9164
|
-
|
|
9165
|
-
startHook:
|
|
9166
|
-
timeout: 300000
|
|
9167
|
-
commands: []
|
|
9168
|
-
`;
|
|
9169
|
-
}
|
|
9170
|
-
function initCommand(options) {
|
|
9171
|
-
const isYaml = options.yaml ?? false;
|
|
9172
|
-
const targetFilename = isYaml ? "replicas.yaml" : "replicas.json";
|
|
9173
|
-
const configPath = import_path4.default.join(process.cwd(), targetFilename);
|
|
9174
|
-
for (const filename of REPLICAS_CONFIG_FILENAMES) {
|
|
9175
|
-
const existingPath = import_path4.default.join(process.cwd(), filename);
|
|
9176
|
-
if (import_fs3.default.existsSync(existingPath) && !options.force) {
|
|
9177
|
-
console.log(
|
|
9178
|
-
import_chalk12.default.yellow(
|
|
9179
|
-
`${filename} already exists in this directory.`
|
|
9180
|
-
)
|
|
9181
|
-
);
|
|
9182
|
-
console.log(import_chalk12.default.gray("Use --force to overwrite the existing file."));
|
|
9183
|
-
return;
|
|
9184
|
-
}
|
|
9185
|
-
}
|
|
9186
|
-
let configContent;
|
|
9187
|
-
if (isYaml) {
|
|
9188
|
-
configContent = getDefaultYamlContent();
|
|
9189
|
-
} else {
|
|
9190
|
-
const defaultConfig = getDefaultConfig();
|
|
9191
|
-
configContent = JSON.stringify(defaultConfig, null, 2) + "\n";
|
|
9192
|
-
}
|
|
9193
|
-
try {
|
|
9194
|
-
import_fs3.default.writeFileSync(configPath, configContent, "utf-8");
|
|
9195
|
-
console.log(import_chalk12.default.green(`\u2713 Created ${targetFilename}`));
|
|
9196
|
-
for (const filename of REPLICAS_CONFIG_FILENAMES) {
|
|
9197
|
-
if (filename === targetFilename) break;
|
|
9198
|
-
const higherPath = import_path4.default.join(process.cwd(), filename);
|
|
9199
|
-
if (import_fs3.default.existsSync(higherPath)) {
|
|
9200
|
-
console.log("");
|
|
9201
|
-
console.log(
|
|
9202
|
-
import_chalk12.default.yellow(
|
|
9203
|
-
`Warning: ${filename} already exists and takes priority over ${targetFilename}.`
|
|
9204
|
-
)
|
|
9205
|
-
);
|
|
9206
|
-
console.log(import_chalk12.default.gray(`Remove or rename ${filename} for ${targetFilename} to take effect.`));
|
|
9207
|
-
}
|
|
9208
|
-
}
|
|
9209
|
-
console.log("");
|
|
9210
|
-
console.log(import_chalk12.default.gray("Configuration options:"));
|
|
9211
|
-
console.log(
|
|
9212
|
-
import_chalk12.default.gray(" systemPrompt - Custom instructions for AI coding assistants")
|
|
9213
|
-
);
|
|
9214
|
-
console.log(
|
|
9215
|
-
import_chalk12.default.gray(" startHook - Commands to run on workspace startup")
|
|
9216
|
-
);
|
|
9217
|
-
if (!isYaml) {
|
|
9218
|
-
console.log("");
|
|
9219
|
-
console.log(import_chalk12.default.gray("Tip: Use --yaml for YAML format with multiline system prompt support."));
|
|
9220
|
-
}
|
|
9221
|
-
} catch (error) {
|
|
9222
|
-
throw new Error(
|
|
9223
|
-
`Failed to create ${targetFilename}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
9224
|
-
);
|
|
9225
|
-
}
|
|
9226
|
-
}
|
|
9227
|
-
|
|
9228
|
-
// src/lib/version-check.ts
|
|
9229
|
-
var import_chalk13 = __toESM(require("chalk"));
|
|
9230
|
-
var MONOLITH_URL2 = process.env.REPLICAS_MONOLITH_URL || "https://api.replicas.dev";
|
|
9231
|
-
var VERSION_CHECK_TIMEOUT = 2e3;
|
|
9232
|
-
function compareVersions(v1, v2) {
|
|
9233
|
-
const parts1 = v1.split(".").map(Number);
|
|
9234
|
-
const parts2 = v2.split(".").map(Number);
|
|
9235
|
-
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
9236
|
-
const num1 = parts1[i] || 0;
|
|
9237
|
-
const num2 = parts2[i] || 0;
|
|
9238
|
-
if (num1 > num2) return 1;
|
|
9239
|
-
if (num1 < num2) return -1;
|
|
9240
|
-
}
|
|
9241
|
-
return 0;
|
|
9242
|
-
}
|
|
9243
|
-
async function checkForUpdates(currentVersion) {
|
|
9244
|
-
try {
|
|
9245
|
-
const controller = new AbortController();
|
|
9246
|
-
const timeoutId = setTimeout(() => controller.abort(), VERSION_CHECK_TIMEOUT);
|
|
9247
|
-
const response = await fetch(`${MONOLITH_URL2}/v1/cli/version`, {
|
|
9248
|
-
signal: controller.signal
|
|
9249
|
-
});
|
|
9250
|
-
clearTimeout(timeoutId);
|
|
9251
|
-
if (!response.ok) return;
|
|
9252
|
-
const data = await response.json();
|
|
9253
|
-
const latestVersion = data.version;
|
|
9254
|
-
if (compareVersions(latestVersion, currentVersion) > 0) {
|
|
9255
|
-
console.error(import_chalk13.default.yellow(`
|
|
9256
|
-
Update available: ${currentVersion} \u2192 ${latestVersion}`));
|
|
9257
|
-
console.error(import_chalk13.default.cyan(`Run: npm i -g replicas-cli@latest
|
|
9258
|
-
`));
|
|
9259
|
-
}
|
|
9260
|
-
} catch {
|
|
9261
|
-
}
|
|
9262
|
-
}
|
|
9263
|
-
|
|
9264
|
-
// src/commands/replica.ts
|
|
9265
|
-
var import_chalk14 = __toESM(require("chalk"));
|
|
9266
|
-
var import_prompts4 = __toESM(require("prompts"));
|
|
9267
|
-
function formatDate(dateString) {
|
|
9268
|
-
return new Date(dateString).toLocaleString();
|
|
9269
|
-
}
|
|
9270
|
-
function formatStatus(status) {
|
|
9271
|
-
switch (status) {
|
|
9272
|
-
case "active":
|
|
9273
|
-
return import_chalk14.default.green(status);
|
|
9274
|
-
case "sleeping":
|
|
9275
|
-
return import_chalk14.default.gray(status);
|
|
9276
|
-
default:
|
|
9277
|
-
return status;
|
|
9278
|
-
}
|
|
9279
|
-
}
|
|
9280
|
-
function truncate(text, maxLength) {
|
|
9281
|
-
if (text.length <= maxLength) return text;
|
|
9282
|
-
return text.substring(0, maxLength) + "...";
|
|
9283
|
-
}
|
|
9284
|
-
function formatDisplayMessage(message) {
|
|
9285
|
-
const time = new Date(message.timestamp).toLocaleTimeString();
|
|
9286
|
-
switch (message.type) {
|
|
9287
|
-
case "user":
|
|
9288
|
-
console.log(import_chalk14.default.blue(`
|
|
9289
|
-
[${time}] USER:`));
|
|
9290
|
-
console.log(import_chalk14.default.white(` ${truncate(message.content, 500)}`));
|
|
9291
|
-
break;
|
|
9292
|
-
case "agent":
|
|
9293
|
-
console.log(import_chalk14.default.green(`
|
|
9294
|
-
[${time}] ASSISTANT:`));
|
|
9295
|
-
console.log(import_chalk14.default.white(` ${truncate(message.content, 500)}`));
|
|
9296
|
-
break;
|
|
9297
|
-
case "reasoning":
|
|
9298
|
-
console.log(import_chalk14.default.gray(`
|
|
9299
|
-
[${time}] THINKING:`));
|
|
9300
|
-
console.log(import_chalk14.default.gray(` ${truncate(message.content, 300)}`));
|
|
9301
|
-
break;
|
|
9302
|
-
case "command":
|
|
9303
|
-
console.log(import_chalk14.default.magenta(`
|
|
9304
|
-
[${time}] COMMAND:`));
|
|
9305
|
-
console.log(import_chalk14.default.white(` $ ${message.command}`));
|
|
9306
|
-
if (message.output) {
|
|
9307
|
-
console.log(import_chalk14.default.gray(` ${truncate(message.output, 200)}`));
|
|
9308
|
-
}
|
|
9309
|
-
if (message.exitCode !== void 0) {
|
|
9310
|
-
const exitColor = message.exitCode === 0 ? import_chalk14.default.green : import_chalk14.default.red;
|
|
9311
|
-
console.log(exitColor(` Exit code: ${message.exitCode}`));
|
|
9312
|
-
}
|
|
9313
|
-
break;
|
|
9314
|
-
case "file_change":
|
|
9315
|
-
console.log(import_chalk14.default.yellow(`
|
|
9316
|
-
[${time}] FILE CHANGES:`));
|
|
9317
|
-
for (const change of message.changes) {
|
|
9318
|
-
const icon = change.kind === "add" ? "+" : change.kind === "delete" ? "-" : "~";
|
|
9319
|
-
const color = change.kind === "add" ? import_chalk14.default.green : change.kind === "delete" ? import_chalk14.default.red : import_chalk14.default.yellow;
|
|
9320
|
-
console.log(color(` ${icon} ${change.path}`));
|
|
9321
|
-
}
|
|
9322
|
-
break;
|
|
9323
|
-
case "patch":
|
|
9324
|
-
console.log(import_chalk14.default.yellow(`
|
|
9325
|
-
[${time}] PATCH:`));
|
|
9326
|
-
for (const op of message.operations) {
|
|
9327
|
-
const icon = op.action === "add" ? "+" : op.action === "delete" ? "-" : "~";
|
|
9328
|
-
const color = op.action === "add" ? import_chalk14.default.green : op.action === "delete" ? import_chalk14.default.red : import_chalk14.default.yellow;
|
|
9329
|
-
console.log(color(` ${icon} ${op.path}`));
|
|
9330
|
-
}
|
|
9331
|
-
break;
|
|
9332
|
-
case "tool_call":
|
|
9333
|
-
console.log(import_chalk14.default.cyan(`
|
|
9334
|
-
[${time}] TOOL: ${message.tool}`));
|
|
9335
|
-
if (message.output) {
|
|
9336
|
-
console.log(import_chalk14.default.gray(` ${truncate(message.output, 200)}`));
|
|
9337
|
-
}
|
|
9338
|
-
break;
|
|
9339
|
-
case "web_search":
|
|
9340
|
-
console.log(import_chalk14.default.cyan(`
|
|
9341
|
-
[${time}] WEB SEARCH:`));
|
|
9342
|
-
console.log(import_chalk14.default.white(` "${message.query}"`));
|
|
9343
|
-
break;
|
|
9344
|
-
case "todo_list":
|
|
9345
|
-
console.log(import_chalk14.default.blue(`
|
|
9346
|
-
[${time}] PLAN:`));
|
|
9347
|
-
for (const item of message.items) {
|
|
9348
|
-
const icon = item.completed ? import_chalk14.default.green("[x]") : import_chalk14.default.gray("[ ]");
|
|
9349
|
-
console.log(` ${icon} ${item.text}`);
|
|
9350
|
-
}
|
|
9351
|
-
break;
|
|
9352
|
-
case "subagent":
|
|
9353
|
-
console.log(import_chalk14.default.magenta(`
|
|
9354
|
-
[${time}] SUBAGENT: ${message.description}`));
|
|
9355
|
-
if (message.output) {
|
|
9356
|
-
console.log(import_chalk14.default.gray(` ${truncate(message.output, 200)}`));
|
|
9357
|
-
}
|
|
9358
|
-
break;
|
|
9359
|
-
case "error":
|
|
9360
|
-
console.log(import_chalk14.default.red(`
|
|
9361
|
-
[${time}] ERROR:`));
|
|
9362
|
-
console.log(import_chalk14.default.red(` ${message.message}`));
|
|
9363
|
-
break;
|
|
9364
|
-
}
|
|
9365
|
-
}
|
|
9366
|
-
async function replicaListCommand(options) {
|
|
9367
|
-
if (!isAuthenticated()) {
|
|
9368
|
-
console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
|
|
9369
|
-
process.exit(1);
|
|
9370
|
-
}
|
|
9371
|
-
try {
|
|
9372
|
-
const params = new URLSearchParams();
|
|
9373
|
-
if (options.page) params.set("page", options.page);
|
|
9374
|
-
if (options.limit) params.set("limit", options.limit);
|
|
9375
|
-
const query = params.toString();
|
|
9376
|
-
const response = await orgAuthenticatedFetch(
|
|
9377
|
-
`/v1/replica${query ? "?" + query : ""}`
|
|
9378
|
-
);
|
|
9379
|
-
if (response.replicas.length === 0) {
|
|
9380
|
-
console.log(import_chalk14.default.yellow("\nNo replicas found.\n"));
|
|
9381
|
-
return;
|
|
9382
|
-
}
|
|
9383
|
-
console.log(import_chalk14.default.green(`
|
|
9384
|
-
Replicas (Page ${response.page} of ${response.totalPages}, Total: ${response.total}):
|
|
9385
|
-
`));
|
|
9386
|
-
for (const replica of response.replicas) {
|
|
9387
|
-
console.log(import_chalk14.default.white(` ${replica.name}`));
|
|
9388
|
-
console.log(import_chalk14.default.gray(` ID: ${replica.id}`));
|
|
9389
|
-
if (replica.repositories.length > 0) {
|
|
9390
|
-
console.log(import_chalk14.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
9391
|
-
}
|
|
9392
|
-
console.log(import_chalk14.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
9393
|
-
console.log(import_chalk14.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
9394
|
-
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
9395
|
-
console.log(import_chalk14.default.gray(` Pull Requests:`));
|
|
9396
|
-
for (const pr of replica.pull_requests) {
|
|
9397
|
-
console.log(import_chalk14.default.cyan(` - ${pr.repository} #${pr.number}: ${pr.url}`));
|
|
9398
|
-
}
|
|
9399
|
-
}
|
|
9400
|
-
console.log();
|
|
9401
|
-
}
|
|
9402
|
-
} catch (error) {
|
|
9403
|
-
console.error(import_chalk14.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
9404
|
-
process.exit(1);
|
|
9405
|
-
}
|
|
9406
|
-
}
|
|
9407
|
-
async function replicaGetCommand(id) {
|
|
9408
|
-
if (!isAuthenticated()) {
|
|
9409
|
-
console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
|
|
9410
|
-
process.exit(1);
|
|
9411
|
-
}
|
|
9412
|
-
try {
|
|
9413
|
-
const response = await orgAuthenticatedFetch(`/v1/replica/${id}`);
|
|
9414
|
-
const replica = response.replica;
|
|
9415
|
-
console.log(import_chalk14.default.green(`
|
|
9416
|
-
Replica: ${replica.name}
|
|
9417
|
-
`));
|
|
9418
|
-
console.log(import_chalk14.default.gray(` ID: ${replica.id}`));
|
|
9419
|
-
if (replica.repositories.length > 0) {
|
|
9420
|
-
console.log(import_chalk14.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
9421
|
-
}
|
|
9422
|
-
console.log(import_chalk14.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
9423
|
-
console.log(import_chalk14.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
9424
|
-
if (replica.waking) {
|
|
9425
|
-
console.log(import_chalk14.default.yellow("\n Workspace is waking from sleep. Retry in 30-90 seconds for full details.\n"));
|
|
9426
|
-
} else {
|
|
9427
|
-
if (replica.coding_agent) {
|
|
9428
|
-
console.log(import_chalk14.default.gray(` Coding Agent: ${replica.coding_agent}`));
|
|
9429
|
-
}
|
|
9430
|
-
if (replica.repository_statuses && replica.repository_statuses.length > 0) {
|
|
9431
|
-
console.log(import_chalk14.default.gray(" Repository Statuses:"));
|
|
9432
|
-
for (const repositoryStatus of replica.repository_statuses) {
|
|
9433
|
-
const changeText = repositoryStatus.git_diff ? ` (${import_chalk14.default.green(`+${repositoryStatus.git_diff.added}`)} / ${import_chalk14.default.red(`-${repositoryStatus.git_diff.removed}`)})` : "";
|
|
9434
|
-
console.log(import_chalk14.default.gray(` - ${repositoryStatus.repository}: ${repositoryStatus.branch || "unknown"}${changeText}`));
|
|
9435
|
-
}
|
|
9436
|
-
}
|
|
9437
|
-
}
|
|
9438
|
-
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
9439
|
-
console.log(import_chalk14.default.gray(` Pull Requests:`));
|
|
9440
|
-
for (const pr of replica.pull_requests) {
|
|
9441
|
-
console.log(import_chalk14.default.cyan(` - ${pr.repository} #${pr.number}: ${pr.url}`));
|
|
9442
|
-
}
|
|
9443
|
-
}
|
|
9444
|
-
console.log();
|
|
9445
|
-
} catch (error) {
|
|
9446
|
-
console.error(import_chalk14.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
9447
|
-
process.exit(1);
|
|
9448
|
-
}
|
|
9449
|
-
}
|
|
9450
|
-
async function replicaCreateCommand(name, options) {
|
|
9451
|
-
if (!isAuthenticated()) {
|
|
9452
|
-
console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
|
|
9453
|
-
process.exit(1);
|
|
9454
|
-
}
|
|
9455
|
-
try {
|
|
9456
|
-
const repoResponse = await orgAuthenticatedFetch("/v1/repositories");
|
|
9457
|
-
const repositories = repoResponse.repositories;
|
|
9458
|
-
if (repositories.length === 0) {
|
|
9459
|
-
console.log(import_chalk14.default.red("No repositories found. Please add a repository first."));
|
|
9460
|
-
process.exit(1);
|
|
9461
|
-
}
|
|
9462
|
-
let replicaName = name;
|
|
9463
|
-
let message = options.message;
|
|
9464
|
-
let selectedRepositories = options.repositories?.split(",").map((repository) => repository.trim()).filter((repository) => repository.length > 0);
|
|
9465
|
-
let codingAgent = options.agent;
|
|
9466
|
-
if (replicaName && /\s/.test(replicaName)) {
|
|
9467
|
-
console.log(import_chalk14.default.red("Replica name cannot contain spaces."));
|
|
9468
|
-
process.exit(1);
|
|
9469
|
-
}
|
|
9470
|
-
if (!replicaName) {
|
|
9471
|
-
const response2 = await (0, import_prompts4.default)({
|
|
9472
|
-
type: "text",
|
|
9473
|
-
name: "name",
|
|
9474
|
-
message: "Enter replica name (without spaces):",
|
|
9475
|
-
validate: (value) => {
|
|
9476
|
-
if (!value.trim()) return "Name is required";
|
|
9477
|
-
if (/\s/.test(value)) return "Name cannot contain spaces";
|
|
9478
|
-
return true;
|
|
9479
|
-
}
|
|
9480
|
-
});
|
|
9481
|
-
if (!response2.name) {
|
|
9482
|
-
console.log(import_chalk14.default.yellow("\nCancelled."));
|
|
9483
|
-
return;
|
|
9484
|
-
}
|
|
9485
|
-
replicaName = response2.name;
|
|
9486
|
-
}
|
|
9487
|
-
if (!selectedRepositories || selectedRepositories.length === 0) {
|
|
9488
|
-
const response2 = await (0, import_prompts4.default)({
|
|
9489
|
-
type: "multiselect",
|
|
9490
|
-
name: "repositories",
|
|
9491
|
-
message: "Select repositories:",
|
|
9492
|
-
choices: repositories.map((repo) => ({
|
|
9493
|
-
title: repo.name,
|
|
9494
|
-
value: repo.name,
|
|
9495
|
-
description: repo.url
|
|
9496
|
-
})),
|
|
9497
|
-
min: 1
|
|
9498
|
-
});
|
|
9499
|
-
if (!response2.repositories || response2.repositories.length === 0) {
|
|
9500
|
-
console.log(import_chalk14.default.yellow("\nCancelled."));
|
|
9501
|
-
return;
|
|
9502
|
-
}
|
|
9503
|
-
selectedRepositories = response2.repositories;
|
|
9504
|
-
}
|
|
9505
|
-
if (!message) {
|
|
9506
|
-
const response2 = await (0, import_prompts4.default)({
|
|
9507
|
-
type: "text",
|
|
9508
|
-
name: "message",
|
|
9509
|
-
message: "Enter initial message for the replica:",
|
|
9510
|
-
validate: (value) => value.trim() ? true : "Message is required"
|
|
9511
|
-
});
|
|
9512
|
-
if (!response2.message) {
|
|
9513
|
-
console.log(import_chalk14.default.yellow("\nCancelled."));
|
|
9514
|
-
return;
|
|
9515
|
-
}
|
|
9516
|
-
message = response2.message;
|
|
9517
|
-
}
|
|
9518
|
-
if (!codingAgent) {
|
|
9519
|
-
const response2 = await (0, import_prompts4.default)({
|
|
9520
|
-
type: "select",
|
|
9521
|
-
name: "agent",
|
|
9522
|
-
message: "Select coding agent:",
|
|
9523
|
-
choices: [
|
|
9524
|
-
{ title: "Claude", value: "claude" },
|
|
9525
|
-
{ title: "Codex", value: "codex" }
|
|
9526
|
-
],
|
|
9527
|
-
initial: 0
|
|
9528
|
-
});
|
|
9529
|
-
if (!response2.agent) {
|
|
9530
|
-
console.log(import_chalk14.default.yellow("\nCancelled."));
|
|
9531
|
-
return;
|
|
9532
|
-
}
|
|
9533
|
-
codingAgent = response2.agent;
|
|
9534
|
-
}
|
|
9535
|
-
if (!codingAgent || !["claude", "codex"].includes(codingAgent)) {
|
|
9536
|
-
console.log(import_chalk14.default.red(`Invalid coding agent: ${codingAgent}. Must be one of: claude, codex`));
|
|
9537
|
-
process.exit(1);
|
|
9538
|
-
}
|
|
9539
|
-
const body = {
|
|
9540
|
-
name: replicaName,
|
|
9541
|
-
message,
|
|
9542
|
-
repositories: selectedRepositories,
|
|
9543
|
-
coding_agent: codingAgent
|
|
9544
|
-
};
|
|
9545
|
-
console.log(import_chalk14.default.gray("\nCreating replica..."));
|
|
9546
|
-
const response = await orgAuthenticatedFetch("/v1/replica", {
|
|
9547
|
-
method: "POST",
|
|
9548
|
-
body
|
|
9549
|
-
});
|
|
9550
|
-
const replica = response.replica;
|
|
9551
|
-
console.log(import_chalk14.default.green(`
|
|
9552
|
-
Created replica: ${replica.name}`));
|
|
9553
|
-
console.log(import_chalk14.default.gray(` ID: ${replica.id}`));
|
|
9554
|
-
console.log(import_chalk14.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
9555
|
-
if (replica.repositories.length > 0) {
|
|
9556
|
-
console.log(import_chalk14.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
9557
|
-
}
|
|
9558
|
-
console.log();
|
|
9559
|
-
} catch (error) {
|
|
9560
|
-
console.error(import_chalk14.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
9561
|
-
process.exit(1);
|
|
9562
|
-
}
|
|
9563
|
-
}
|
|
9564
|
-
async function replicaSendCommand(id, options) {
|
|
9565
|
-
if (!isAuthenticated()) {
|
|
9566
|
-
console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
|
|
9567
|
-
process.exit(1);
|
|
9568
|
-
}
|
|
9569
|
-
try {
|
|
9570
|
-
let message = options.message;
|
|
9571
|
-
if (!message) {
|
|
9572
|
-
const response2 = await (0, import_prompts4.default)({
|
|
9573
|
-
type: "text",
|
|
9574
|
-
name: "message",
|
|
9575
|
-
message: "Enter message to send:",
|
|
9576
|
-
validate: (value) => value.trim() ? true : "Message is required"
|
|
9577
|
-
});
|
|
9578
|
-
if (!response2.message) {
|
|
9579
|
-
console.log(import_chalk14.default.yellow("\nCancelled."));
|
|
9580
|
-
return;
|
|
9581
|
-
}
|
|
9582
|
-
message = response2.message;
|
|
9583
|
-
}
|
|
9584
|
-
const body = {
|
|
9585
|
-
message
|
|
9586
|
-
};
|
|
9587
|
-
if (options.agent) {
|
|
9588
|
-
if (!["claude", "codex"].includes(options.agent)) {
|
|
9589
|
-
console.log(import_chalk14.default.red(`Invalid coding agent: ${options.agent}. Must be one of: claude, codex`));
|
|
9590
|
-
process.exit(1);
|
|
9591
|
-
}
|
|
9592
|
-
body.coding_agent = options.agent;
|
|
9593
|
-
}
|
|
9594
|
-
const response = await orgAuthenticatedFetch(
|
|
9595
|
-
`/v1/replica/${id}/send`,
|
|
9596
|
-
{
|
|
9597
|
-
method: "POST",
|
|
9598
|
-
body
|
|
9599
|
-
}
|
|
9600
|
-
);
|
|
9601
|
-
const statusColor = response.status === "sent" ? import_chalk14.default.green : import_chalk14.default.yellow;
|
|
9602
|
-
console.log(statusColor(`
|
|
9603
|
-
Message ${response.status}`));
|
|
9604
|
-
if (response.position !== void 0 && response.position > 0) {
|
|
9605
|
-
console.log(import_chalk14.default.gray(` Queue position: ${response.position}`));
|
|
9606
|
-
}
|
|
9607
|
-
console.log();
|
|
9608
|
-
} catch (error) {
|
|
9609
|
-
console.error(import_chalk14.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
9610
|
-
process.exit(1);
|
|
9611
|
-
}
|
|
9612
|
-
}
|
|
9613
|
-
async function replicaDeleteCommand(id, options) {
|
|
9614
|
-
if (!isAuthenticated()) {
|
|
9615
|
-
console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
|
|
9616
|
-
process.exit(1);
|
|
9617
|
-
}
|
|
9618
|
-
try {
|
|
9619
|
-
if (!options.force) {
|
|
9620
|
-
const response = await (0, import_prompts4.default)({
|
|
9621
|
-
type: "confirm",
|
|
9622
|
-
name: "confirm",
|
|
9623
|
-
message: `Are you sure you want to delete replica ${id}?`,
|
|
9624
|
-
initial: false
|
|
9625
|
-
});
|
|
9626
|
-
if (!response.confirm) {
|
|
9627
|
-
console.log(import_chalk14.default.yellow("\nCancelled."));
|
|
9628
|
-
return;
|
|
9629
|
-
}
|
|
9630
|
-
}
|
|
9631
|
-
await orgAuthenticatedFetch(`/v1/replica/${id}`, {
|
|
9632
|
-
method: "DELETE"
|
|
9633
|
-
});
|
|
9634
|
-
console.log(import_chalk14.default.green(`
|
|
9635
|
-
Replica ${id} deleted.
|
|
9636
|
-
`));
|
|
9637
|
-
} catch (error) {
|
|
9638
|
-
console.error(import_chalk14.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
9639
|
-
process.exit(1);
|
|
9640
|
-
}
|
|
9641
|
-
}
|
|
9642
|
-
async function replicaReadCommand(id, options) {
|
|
9643
|
-
if (!isAuthenticated()) {
|
|
9644
|
-
console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
|
|
9645
|
-
process.exit(1);
|
|
9646
|
-
}
|
|
9647
|
-
try {
|
|
9648
|
-
const params = new URLSearchParams();
|
|
9649
|
-
if (options.limit) params.set("limit", options.limit);
|
|
9650
|
-
if (options.offset) params.set("offset", options.offset);
|
|
9651
|
-
const query = params.toString();
|
|
9652
|
-
const response = await orgAuthenticatedFetch(
|
|
9653
|
-
`/v1/replica/${id}/read${query ? "?" + query : ""}`
|
|
9654
|
-
);
|
|
9655
|
-
if (response.waking) {
|
|
9656
|
-
console.log(import_chalk14.default.yellow("\nWorkspace is waking from sleep. Retry in 30-90 seconds.\n"));
|
|
9657
|
-
return;
|
|
9658
|
-
}
|
|
9659
|
-
console.log(import_chalk14.default.green(`
|
|
9660
|
-
Conversation History
|
|
9661
|
-
`));
|
|
9662
|
-
if (response.coding_agent) {
|
|
9663
|
-
console.log(import_chalk14.default.gray(` Agent: ${response.coding_agent}`));
|
|
9664
|
-
}
|
|
9665
|
-
if (response.thread_id) {
|
|
9666
|
-
console.log(import_chalk14.default.gray(` Thread ID: ${response.thread_id}`));
|
|
9667
|
-
}
|
|
9668
|
-
console.log(import_chalk14.default.gray(` Total Events: ${response.total}`));
|
|
9669
|
-
console.log(import_chalk14.default.gray(` Showing: ${response.events.length} events`));
|
|
9670
|
-
if (response.hasMore) {
|
|
9671
|
-
console.log(import_chalk14.default.gray(` Has More: yes (use --offset to paginate)`));
|
|
9672
|
-
}
|
|
9673
|
-
console.log();
|
|
9674
|
-
if (response.events.length === 0) {
|
|
9675
|
-
console.log(import_chalk14.default.yellow(" No events found.\n"));
|
|
9676
|
-
return;
|
|
9677
|
-
}
|
|
9678
|
-
console.log(import_chalk14.default.gray("-".repeat(60)));
|
|
9679
|
-
const agentType = response.coding_agent || "claude";
|
|
9680
|
-
const displayMessages = parseAgentEvents(response.events, agentType);
|
|
9681
|
-
for (const message of displayMessages) {
|
|
9682
|
-
formatDisplayMessage(message);
|
|
9683
|
-
}
|
|
9684
|
-
console.log(import_chalk14.default.gray("\n" + "-".repeat(60)));
|
|
9685
|
-
console.log();
|
|
9686
|
-
} catch (error) {
|
|
9687
|
-
console.error(import_chalk14.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
9688
|
-
process.exit(1);
|
|
9689
|
-
}
|
|
9690
|
-
}
|
|
9691
|
-
|
|
9692
|
-
// src/commands/repositories.ts
|
|
9693
|
-
var import_chalk15 = __toESM(require("chalk"));
|
|
9694
|
-
function formatDate2(dateString) {
|
|
9695
|
-
return new Date(dateString).toLocaleString();
|
|
9696
|
-
}
|
|
9697
|
-
async function repositoriesListCommand() {
|
|
9698
|
-
if (!isAuthenticated()) {
|
|
9699
|
-
console.log(import_chalk15.default.red('Not logged in. Please run "replicas login" first.'));
|
|
9700
|
-
process.exit(1);
|
|
9701
|
-
}
|
|
9702
|
-
try {
|
|
9703
|
-
const response = await orgAuthenticatedFetch("/v1/repositories");
|
|
9704
|
-
if (response.repositories.length === 0) {
|
|
9705
|
-
console.log(import_chalk15.default.yellow("\nNo repositories found.\n"));
|
|
9706
|
-
return;
|
|
9707
|
-
}
|
|
9708
|
-
console.log(import_chalk15.default.green(`
|
|
9709
|
-
Repositories (${response.repositories.length}):
|
|
9710
|
-
`));
|
|
9711
|
-
for (const repo of response.repositories) {
|
|
9712
|
-
console.log(import_chalk15.default.white(` ${repo.name}`));
|
|
9713
|
-
console.log(import_chalk15.default.gray(` URL: ${repo.url}`));
|
|
9714
|
-
console.log(import_chalk15.default.gray(` Default Branch: ${repo.default_branch}`));
|
|
9715
|
-
console.log(import_chalk15.default.gray(` Created: ${formatDate2(repo.created_at)}`));
|
|
9716
|
-
if (repo.github_repository_id) {
|
|
9717
|
-
console.log(import_chalk15.default.gray(` GitHub ID: ${repo.github_repository_id}`));
|
|
9718
|
-
}
|
|
9719
|
-
console.log();
|
|
9720
|
-
}
|
|
9721
|
-
} catch (error) {
|
|
9722
|
-
console.error(import_chalk15.default.red(`Error: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
9723
|
-
process.exit(1);
|
|
9724
|
-
}
|
|
9725
|
-
}
|
|
9726
|
-
|
|
9727
|
-
// src/commands/preview.ts
|
|
9728
|
-
var import_chalk16 = __toESM(require("chalk"));
|
|
9729
|
-
|
|
9730
|
-
// src/lib/agent-api.ts
|
|
9731
|
-
var MONOLITH_URL3 = process.env.MONOLITH_URL || process.env.REPLICAS_MONOLITH_URL || "https://api.replicas.dev";
|
|
9732
|
-
var ENGINE_PORT = process.env.REPLICAS_ENGINE_PORT || "3737";
|
|
9733
|
-
async function agentFetch(path5, options) {
|
|
9734
|
-
const config2 = readAgentConfig();
|
|
9735
|
-
if (!config2) {
|
|
9736
|
-
throw new Error("Agent mode config not found");
|
|
9737
|
-
}
|
|
9738
|
-
const headers = {
|
|
9739
|
-
"Authorization": `Bearer ${config2.engine_secret}`,
|
|
9740
|
-
"X-Workspace-Id": config2.workspace_id,
|
|
9741
|
-
"Content-Type": "application/json",
|
|
9742
|
-
...options?.headers || {}
|
|
9743
|
-
};
|
|
9744
|
-
const response = await fetch(`${MONOLITH_URL3}${path5}`, {
|
|
9745
|
-
...options,
|
|
9746
|
-
headers,
|
|
9747
|
-
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
|
|
9748
|
-
});
|
|
9749
|
-
if (!response.ok) {
|
|
9750
|
-
const error = await response.json().catch(() => ({ error: "Request failed" }));
|
|
9751
|
-
throw new Error(error.error || `Request failed with status ${response.status}`);
|
|
9752
|
-
}
|
|
9753
|
-
return response.json();
|
|
9754
|
-
}
|
|
9755
|
-
async function engineFetch(path5, options) {
|
|
9756
|
-
const config2 = readAgentConfig();
|
|
9757
|
-
if (!config2) {
|
|
9758
|
-
throw new Error("Agent mode config not found");
|
|
9759
|
-
}
|
|
9760
|
-
const headers = {
|
|
9761
|
-
"X-Replicas-Engine-Secret": config2.engine_secret,
|
|
9762
|
-
"Content-Type": "application/json",
|
|
9763
|
-
...options?.headers || {}
|
|
9764
|
-
};
|
|
9765
|
-
const response = await fetch(`http://localhost:${ENGINE_PORT}${path5}`, {
|
|
9766
|
-
...options,
|
|
9767
|
-
headers,
|
|
9768
|
-
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
|
|
9769
|
-
});
|
|
9770
|
-
if (!response.ok) {
|
|
9771
|
-
const error = await response.json().catch(() => ({ error: "Request failed" }));
|
|
9772
|
-
throw new Error(error.error || `Request failed with status ${response.status}`);
|
|
8187
|
+
// ../shared/src/pricing.ts
|
|
8188
|
+
var PLANS = {
|
|
8189
|
+
hobby: {
|
|
8190
|
+
id: "hobby",
|
|
8191
|
+
name: "Hobby",
|
|
8192
|
+
monthlyPrice: 0,
|
|
8193
|
+
seatPriceCents: 0,
|
|
8194
|
+
creditsIncluded: 20,
|
|
8195
|
+
features: ["20 hours of usage"]
|
|
8196
|
+
},
|
|
8197
|
+
developer: {
|
|
8198
|
+
id: "developer",
|
|
8199
|
+
name: "Developer",
|
|
8200
|
+
monthlyPrice: 30,
|
|
8201
|
+
seatPriceCents: 3e3,
|
|
8202
|
+
creditsIncluded: 0,
|
|
8203
|
+
features: ["Unlimited usage", "API access ($1/hr)"]
|
|
8204
|
+
},
|
|
8205
|
+
team: {
|
|
8206
|
+
id: "team",
|
|
8207
|
+
name: "Team",
|
|
8208
|
+
monthlyPrice: 120,
|
|
8209
|
+
seatPriceCents: 12e3,
|
|
8210
|
+
creditsIncluded: 0,
|
|
8211
|
+
features: [
|
|
8212
|
+
"Unlimited usage",
|
|
8213
|
+
"API access",
|
|
8214
|
+
"Higher API rate limits",
|
|
8215
|
+
"Warm hooks and pool access",
|
|
8216
|
+
"Optional add-ons for higher resources, warm pools, rate limits, and SOC 2"
|
|
8217
|
+
]
|
|
8218
|
+
},
|
|
8219
|
+
enterprise: {
|
|
8220
|
+
id: "enterprise",
|
|
8221
|
+
name: "Enterprise",
|
|
8222
|
+
monthlyPrice: 0,
|
|
8223
|
+
seatPriceCents: 0,
|
|
8224
|
+
creditsIncluded: 0,
|
|
8225
|
+
features: [
|
|
8226
|
+
"Unlimited usage",
|
|
8227
|
+
"Custom API rates",
|
|
8228
|
+
"Custom rate limits",
|
|
8229
|
+
"Custom warm hooks and pools",
|
|
8230
|
+
"SOC 2"
|
|
8231
|
+
]
|
|
9773
8232
|
}
|
|
9774
|
-
|
|
9775
|
-
|
|
8233
|
+
};
|
|
8234
|
+
var TEAM_PLAN = PLANS.team;
|
|
8235
|
+
var ENTERPRISE_PLAN = PLANS.enterprise;
|
|
9776
8236
|
|
|
9777
|
-
// src/
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
if (isNaN(portNum) || portNum < 1 || portNum > 65535) {
|
|
9781
|
-
throw new Error("Port must be a number between 1 and 65535");
|
|
9782
|
-
}
|
|
9783
|
-
if (isAgentMode()) {
|
|
9784
|
-
const result = await agentFetch("/v1/previews", {
|
|
9785
|
-
method: "POST",
|
|
9786
|
-
body: { port: portNum, authenticated: options.authenticated ?? false }
|
|
9787
|
-
});
|
|
9788
|
-
console.log(result.preview.publicUrl);
|
|
9789
|
-
} else {
|
|
9790
|
-
throw new Error("In human mode, use: replicas preview add <workspaceId> --port <port>");
|
|
9791
|
-
}
|
|
9792
|
-
}
|
|
9793
|
-
async function previewListCommand(workspaceId) {
|
|
9794
|
-
if (isAgentMode()) {
|
|
9795
|
-
const result = await engineFetch("/previews");
|
|
9796
|
-
if (result.previews.length === 0) {
|
|
9797
|
-
console.log("No active previews");
|
|
9798
|
-
return;
|
|
9799
|
-
}
|
|
9800
|
-
for (const preview2 of result.previews) {
|
|
9801
|
-
console.log(`${preview2.port} -> ${preview2.publicUrl}`);
|
|
9802
|
-
}
|
|
9803
|
-
} else {
|
|
9804
|
-
if (!workspaceId) {
|
|
9805
|
-
throw new Error("Workspace ID is required: replicas preview list <workspaceId>");
|
|
9806
|
-
}
|
|
9807
|
-
const result = await orgAuthenticatedFetch(
|
|
9808
|
-
`/v1/workspaces/${workspaceId}/previews`
|
|
9809
|
-
);
|
|
9810
|
-
if (result.previews.length === 0) {
|
|
9811
|
-
console.log(import_chalk16.default.dim("No active previews"));
|
|
9812
|
-
return;
|
|
9813
|
-
}
|
|
9814
|
-
for (const preview2 of result.previews) {
|
|
9815
|
-
console.log(` ${import_chalk16.default.cyan(String(preview2.port))} \u2192 ${import_chalk16.default.underline(preview2.publicUrl)}`);
|
|
9816
|
-
}
|
|
9817
|
-
}
|
|
9818
|
-
}
|
|
9819
|
-
async function previewAddCommand(workspaceId, options) {
|
|
9820
|
-
const portNum = parseInt(options.port, 10);
|
|
9821
|
-
if (isNaN(portNum) || portNum < 1 || portNum > 65535) {
|
|
9822
|
-
throw new Error("Port must be a number between 1 and 65535");
|
|
9823
|
-
}
|
|
9824
|
-
const result = await orgAuthenticatedFetch(
|
|
9825
|
-
`/v1/workspaces/${workspaceId}/previews`,
|
|
9826
|
-
{
|
|
9827
|
-
method: "POST",
|
|
9828
|
-
body: { port: portNum, authenticated: options.authenticated ?? false }
|
|
9829
|
-
}
|
|
9830
|
-
);
|
|
9831
|
-
console.log(import_chalk16.default.green(`Preview created: ${result.preview.publicUrl}`));
|
|
9832
|
-
}
|
|
8237
|
+
// ../shared/src/routes/workspaces.ts
|
|
8238
|
+
var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
|
|
8239
|
+
var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
|
|
9833
8240
|
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
`));
|
|
9858
|
-
}
|
|
9859
|
-
process.exit(1);
|
|
9860
|
-
}
|
|
9861
|
-
});
|
|
9862
|
-
program.command("logout").description("Clear stored credentials").action(() => {
|
|
9863
|
-
try {
|
|
9864
|
-
logoutCommand();
|
|
9865
|
-
} catch (error) {
|
|
9866
|
-
if (error instanceof Error) {
|
|
9867
|
-
console.error(import_chalk17.default.red(`
|
|
9868
|
-
\u2717 ${error.message}
|
|
9869
|
-
`));
|
|
9870
|
-
}
|
|
9871
|
-
process.exit(1);
|
|
9872
|
-
}
|
|
9873
|
-
});
|
|
9874
|
-
program.command("whoami").description("Display current authenticated user").action(async () => {
|
|
9875
|
-
try {
|
|
9876
|
-
await whoamiCommand();
|
|
9877
|
-
} catch (error) {
|
|
9878
|
-
if (error instanceof Error) {
|
|
9879
|
-
console.error(import_chalk17.default.red(`
|
|
9880
|
-
\u2717 ${error.message}
|
|
9881
|
-
`));
|
|
9882
|
-
}
|
|
9883
|
-
process.exit(1);
|
|
9884
|
-
}
|
|
9885
|
-
});
|
|
9886
|
-
program.command("codex-auth").description("Authenticate Replicas with your Codex credentials").option("-u, --user", "Store credentials for your personal account").action(async (options) => {
|
|
9887
|
-
try {
|
|
9888
|
-
await codexAuthCommand(options);
|
|
9889
|
-
} catch (error) {
|
|
9890
|
-
if (error instanceof Error) {
|
|
9891
|
-
console.error(import_chalk17.default.red(`
|
|
9892
|
-
\u2717 ${error.message}
|
|
9893
|
-
`));
|
|
9894
|
-
}
|
|
9895
|
-
process.exit(1);
|
|
9896
|
-
}
|
|
9897
|
-
});
|
|
9898
|
-
program.command("claude-auth").description("Authenticate Replicas with your Claude Code credentials").option("-u, --user", "Store credentials for your personal account").action(async (options) => {
|
|
9899
|
-
try {
|
|
9900
|
-
await claudeAuthCommand(options);
|
|
9901
|
-
} catch (error) {
|
|
9902
|
-
if (error instanceof Error) {
|
|
9903
|
-
console.error(import_chalk17.default.red(`
|
|
9904
|
-
\u2717 ${error.message}
|
|
9905
|
-
`));
|
|
9906
|
-
}
|
|
9907
|
-
process.exit(1);
|
|
9908
|
-
}
|
|
9909
|
-
});
|
|
9910
|
-
var org = program.command("org").description("Manage organizations");
|
|
9911
|
-
org.command("switch").description("Switch to a different organization").action(async () => {
|
|
9912
|
-
try {
|
|
9913
|
-
await orgSwitchCommand();
|
|
9914
|
-
} catch (error) {
|
|
9915
|
-
if (error instanceof Error) {
|
|
9916
|
-
console.error(import_chalk17.default.red(`
|
|
9917
|
-
\u2717 ${error.message}
|
|
9918
|
-
`));
|
|
9919
|
-
}
|
|
9920
|
-
process.exit(1);
|
|
9921
|
-
}
|
|
9922
|
-
});
|
|
9923
|
-
org.action(async () => {
|
|
9924
|
-
try {
|
|
9925
|
-
await orgCommand();
|
|
9926
|
-
} catch (error) {
|
|
9927
|
-
if (error instanceof Error) {
|
|
9928
|
-
console.error(import_chalk17.default.red(`
|
|
9929
|
-
\u2717 ${error.message}
|
|
9930
|
-
`));
|
|
9931
|
-
}
|
|
9932
|
-
process.exit(1);
|
|
9933
|
-
}
|
|
9934
|
-
});
|
|
9935
|
-
program.command("connect <workspace-name>").description("Connect to a workspace via SSH").action(async (workspaceName) => {
|
|
9936
|
-
try {
|
|
9937
|
-
await connectCommand(workspaceName);
|
|
9938
|
-
} catch (error) {
|
|
9939
|
-
if (error instanceof Error) {
|
|
9940
|
-
console.error(import_chalk17.default.red(`
|
|
9941
|
-
\u2717 ${error.message}
|
|
9942
|
-
`));
|
|
9943
|
-
}
|
|
9944
|
-
process.exit(1);
|
|
9945
|
-
}
|
|
9946
|
-
});
|
|
9947
|
-
program.command("code <workspace-name>").description("Open a workspace in VSCode/Cursor via Remote SSH").action(async (workspaceName) => {
|
|
9948
|
-
try {
|
|
9949
|
-
await codeCommand(workspaceName);
|
|
9950
|
-
} catch (error) {
|
|
9951
|
-
if (error instanceof Error) {
|
|
9952
|
-
console.error(import_chalk17.default.red(`
|
|
9953
|
-
\u2717 ${error.message}
|
|
9954
|
-
`));
|
|
9955
|
-
}
|
|
9956
|
-
process.exit(1);
|
|
9957
|
-
}
|
|
9958
|
-
});
|
|
9959
|
-
var config = program.command("config").description("Manage CLI configuration");
|
|
9960
|
-
config.command("get <key>").description("Get a configuration value").action(async (key) => {
|
|
9961
|
-
try {
|
|
9962
|
-
await configGetCommand(key);
|
|
9963
|
-
} catch (error) {
|
|
9964
|
-
if (error instanceof Error) {
|
|
9965
|
-
console.error(import_chalk17.default.red(`
|
|
9966
|
-
\u2717 ${error.message}
|
|
9967
|
-
`));
|
|
9968
|
-
}
|
|
9969
|
-
process.exit(1);
|
|
9970
|
-
}
|
|
9971
|
-
});
|
|
9972
|
-
config.command("set <key> <value>").description("Set a configuration value").action(async (key, value) => {
|
|
9973
|
-
try {
|
|
9974
|
-
await configSetCommand(key, value);
|
|
9975
|
-
} catch (error) {
|
|
9976
|
-
if (error instanceof Error) {
|
|
9977
|
-
console.error(import_chalk17.default.red(`
|
|
9978
|
-
\u2717 ${error.message}
|
|
9979
|
-
`));
|
|
9980
|
-
}
|
|
9981
|
-
process.exit(1);
|
|
9982
|
-
}
|
|
9983
|
-
});
|
|
9984
|
-
config.command("list").description("List all configuration values").action(async () => {
|
|
9985
|
-
try {
|
|
9986
|
-
await configListCommand();
|
|
9987
|
-
} catch (error) {
|
|
9988
|
-
if (error instanceof Error) {
|
|
9989
|
-
console.error(import_chalk17.default.red(`
|
|
9990
|
-
\u2717 ${error.message}
|
|
9991
|
-
`));
|
|
9992
|
-
}
|
|
9993
|
-
process.exit(1);
|
|
9994
|
-
}
|
|
9995
|
-
});
|
|
9996
|
-
program.command("list").description("List all replicas").option("-p, --page <page>", "Page number").option("-l, --limit <limit>", "Number of items per page").action(async (options) => {
|
|
9997
|
-
try {
|
|
9998
|
-
await replicaListCommand(options);
|
|
9999
|
-
} catch (error) {
|
|
10000
|
-
if (error instanceof Error) {
|
|
10001
|
-
console.error(import_chalk17.default.red(`
|
|
10002
|
-
\u2717 ${error.message}
|
|
10003
|
-
`));
|
|
10004
|
-
}
|
|
10005
|
-
process.exit(1);
|
|
10006
|
-
}
|
|
10007
|
-
});
|
|
10008
|
-
program.command("get <id>").description("Get replica details by ID").action(async (id) => {
|
|
10009
|
-
try {
|
|
10010
|
-
await replicaGetCommand(id);
|
|
10011
|
-
} catch (error) {
|
|
10012
|
-
if (error instanceof Error) {
|
|
10013
|
-
console.error(import_chalk17.default.red(`
|
|
10014
|
-
\u2717 ${error.message}
|
|
10015
|
-
`));
|
|
10016
|
-
}
|
|
10017
|
-
process.exit(1);
|
|
10018
|
-
}
|
|
10019
|
-
});
|
|
10020
|
-
program.command("create [name]").description("Create a new replica").option("-m, --message <message>", "Initial message for the replica").option("-r, --repositories <repositories>", "Comma-separated repository names").option("-a, --agent <agent>", "Coding agent (claude, codex)").action(async (name, options) => {
|
|
10021
|
-
try {
|
|
10022
|
-
await replicaCreateCommand(name, options);
|
|
10023
|
-
} catch (error) {
|
|
10024
|
-
if (error instanceof Error) {
|
|
10025
|
-
console.error(import_chalk17.default.red(`
|
|
10026
|
-
\u2717 ${error.message}
|
|
10027
|
-
`));
|
|
10028
|
-
}
|
|
10029
|
-
process.exit(1);
|
|
10030
|
-
}
|
|
10031
|
-
});
|
|
10032
|
-
program.command("send <id>").description("Send a message to a replica").option("-m, --message <message>", "Message to send").option("-a, --agent <agent>", "Coding agent (claude, codex)").action(async (id, options) => {
|
|
10033
|
-
try {
|
|
10034
|
-
await replicaSendCommand(id, options);
|
|
10035
|
-
} catch (error) {
|
|
10036
|
-
if (error instanceof Error) {
|
|
10037
|
-
console.error(import_chalk17.default.red(`
|
|
10038
|
-
\u2717 ${error.message}
|
|
10039
|
-
`));
|
|
10040
|
-
}
|
|
10041
|
-
process.exit(1);
|
|
10042
|
-
}
|
|
10043
|
-
});
|
|
10044
|
-
program.command("delete <id>").description("Delete a replica").option("-f, --force", "Skip confirmation prompt").action(async (id, options) => {
|
|
10045
|
-
try {
|
|
10046
|
-
await replicaDeleteCommand(id, options);
|
|
10047
|
-
} catch (error) {
|
|
10048
|
-
if (error instanceof Error) {
|
|
10049
|
-
console.error(import_chalk17.default.red(`
|
|
10050
|
-
\u2717 ${error.message}
|
|
10051
|
-
`));
|
|
10052
|
-
}
|
|
10053
|
-
process.exit(1);
|
|
10054
|
-
}
|
|
10055
|
-
});
|
|
10056
|
-
program.command("read <id>").description("Read conversation history of a replica").option("-l, --limit <limit>", "Maximum number of events to return").option("-o, --offset <offset>", "Number of events to skip from the end").action(async (id, options) => {
|
|
10057
|
-
try {
|
|
10058
|
-
await replicaReadCommand(id, options);
|
|
10059
|
-
} catch (error) {
|
|
10060
|
-
if (error instanceof Error) {
|
|
10061
|
-
console.error(import_chalk17.default.red(`
|
|
10062
|
-
\u2717 ${error.message}
|
|
10063
|
-
`));
|
|
10064
|
-
}
|
|
10065
|
-
process.exit(1);
|
|
10066
|
-
}
|
|
10067
|
-
});
|
|
10068
|
-
var repos = program.command("repos").description("Manage repositories");
|
|
10069
|
-
repos.command("list").description("List all repositories").action(async () => {
|
|
10070
|
-
try {
|
|
10071
|
-
await repositoriesListCommand();
|
|
10072
|
-
} catch (error) {
|
|
10073
|
-
if (error instanceof Error) {
|
|
10074
|
-
console.error(import_chalk17.default.red(`
|
|
10075
|
-
\u2717 ${error.message}
|
|
10076
|
-
`));
|
|
10077
|
-
}
|
|
10078
|
-
process.exit(1);
|
|
10079
|
-
}
|
|
10080
|
-
});
|
|
10081
|
-
repos.action(async () => {
|
|
10082
|
-
try {
|
|
10083
|
-
await repositoriesListCommand();
|
|
10084
|
-
} catch (error) {
|
|
10085
|
-
if (error instanceof Error) {
|
|
10086
|
-
console.error(import_chalk17.default.red(`
|
|
10087
|
-
\u2717 ${error.message}
|
|
10088
|
-
`));
|
|
10089
|
-
}
|
|
10090
|
-
process.exit(1);
|
|
10091
|
-
}
|
|
10092
|
-
});
|
|
10093
|
-
var preview = program.command("preview").description("Manage preview URLs");
|
|
10094
|
-
if (isAgentMode()) {
|
|
10095
|
-
preview.command("create <port>").description("Register a preview port").option(
|
|
10096
|
-
"-a, --authenticated",
|
|
10097
|
-
"Require cookie authentication for this preview. Use for user-facing frontends (e.g. web apps) where you want only logged-in Replicas users to access the preview. Do not use for backend APIs that are called by frontend code, as the frontend cannot forward the auth cookie."
|
|
10098
|
-
).action(async (port, options) => {
|
|
10099
|
-
try {
|
|
10100
|
-
await previewCreateCommand(port, options);
|
|
10101
|
-
} catch (error) {
|
|
10102
|
-
if (error instanceof Error) {
|
|
10103
|
-
console.error(`Error: ${error.message}`);
|
|
10104
|
-
}
|
|
10105
|
-
process.exit(1);
|
|
10106
|
-
}
|
|
10107
|
-
});
|
|
10108
|
-
preview.command("list").description("List active preview URLs").action(async () => {
|
|
10109
|
-
try {
|
|
10110
|
-
await previewListCommand();
|
|
10111
|
-
} catch (error) {
|
|
10112
|
-
if (error instanceof Error) {
|
|
10113
|
-
console.error(`Error: ${error.message}`);
|
|
10114
|
-
}
|
|
10115
|
-
process.exit(1);
|
|
10116
|
-
}
|
|
10117
|
-
});
|
|
10118
|
-
} else {
|
|
10119
|
-
preview.command("add <workspaceId>").description("Register a preview port for a workspace").requiredOption("-p, --port <port>", "Port number to preview").option(
|
|
10120
|
-
"-a, --authenticated",
|
|
10121
|
-
"Require cookie authentication for this preview. Use for user-facing frontends (e.g. web apps) where you want only logged-in Replicas users to access the preview. Do not use for backend APIs that are called by frontend code, as the frontend cannot forward the auth cookie."
|
|
10122
|
-
).action(async (workspaceId, options) => {
|
|
10123
|
-
try {
|
|
10124
|
-
await previewAddCommand(workspaceId, options);
|
|
10125
|
-
} catch (error) {
|
|
10126
|
-
if (error instanceof Error) {
|
|
10127
|
-
console.error(import_chalk17.default.red(`
|
|
10128
|
-
\u2717 ${error.message}
|
|
10129
|
-
`));
|
|
10130
|
-
}
|
|
10131
|
-
process.exit(1);
|
|
10132
|
-
}
|
|
10133
|
-
});
|
|
10134
|
-
preview.command("list [workspaceId]").description("List active preview URLs for a workspace").action(async (workspaceId) => {
|
|
10135
|
-
try {
|
|
10136
|
-
await previewListCommand(workspaceId);
|
|
10137
|
-
} catch (error) {
|
|
10138
|
-
if (error instanceof Error) {
|
|
10139
|
-
console.error(import_chalk17.default.red(`
|
|
10140
|
-
\u2717 ${error.message}
|
|
10141
|
-
`));
|
|
10142
|
-
}
|
|
10143
|
-
process.exit(1);
|
|
10144
|
-
}
|
|
10145
|
-
});
|
|
10146
|
-
}
|
|
10147
|
-
if (isAgentMode()) {
|
|
10148
|
-
const previewCmd = program.commands.find((cmd) => cmd.name() === "preview");
|
|
10149
|
-
const cmds = program.commands;
|
|
10150
|
-
cmds.length = 0;
|
|
10151
|
-
if (previewCmd) {
|
|
10152
|
-
cmds.push(previewCmd);
|
|
10153
|
-
}
|
|
10154
|
-
}
|
|
10155
|
-
var versionCheckPromise = checkForUpdates(CLI_VERSION);
|
|
10156
|
-
program.parse();
|
|
10157
|
-
versionCheckPromise.catch(() => {
|
|
10158
|
-
});
|
|
10159
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
10160
|
-
0 && (module.exports = {
|
|
10161
|
-
CLI_VERSION
|
|
10162
|
-
});
|
|
8241
|
+
export {
|
|
8242
|
+
readConfig,
|
|
8243
|
+
writeConfig,
|
|
8244
|
+
deleteConfig,
|
|
8245
|
+
isAuthenticated,
|
|
8246
|
+
setOrganizationId,
|
|
8247
|
+
getOrganizationId,
|
|
8248
|
+
setIdeCommand,
|
|
8249
|
+
getIdeCommand,
|
|
8250
|
+
isAgentMode,
|
|
8251
|
+
readAgentConfig,
|
|
8252
|
+
getValidToken,
|
|
8253
|
+
getCurrentUser,
|
|
8254
|
+
SANDBOX_PATHS,
|
|
8255
|
+
REPLICAS_CONFIG_FILENAMES,
|
|
8256
|
+
getInitialChatId,
|
|
8257
|
+
parseAgentEvents,
|
|
8258
|
+
createUserMessage,
|
|
8259
|
+
isAgentBackendEvent,
|
|
8260
|
+
filterDisplayMessages,
|
|
8261
|
+
buildGroups,
|
|
8262
|
+
createMockWorkspaceRecord
|
|
8263
|
+
};
|