@mmmnt/cli 0.2.0 → 0.3.1
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 +24 -18
- package/dist/moment.mjs +614 -487
- package/dist/moment.mjs.map +3 -3
- package/package.json +9 -9
package/dist/moment.mjs
CHANGED
|
@@ -3994,10 +3994,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
3994
3994
|
let offset = bm.offset;
|
|
3995
3995
|
let commentEnd = null;
|
|
3996
3996
|
for (const collItem of bm.items) {
|
|
3997
|
-
const { start, key, sep:
|
|
3997
|
+
const { start, key, sep: sep3, value } = collItem;
|
|
3998
3998
|
const keyProps = resolveProps.resolveProps(start, {
|
|
3999
3999
|
indicator: "explicit-key-ind",
|
|
4000
|
-
next: key ??
|
|
4000
|
+
next: key ?? sep3?.[0],
|
|
4001
4001
|
offset,
|
|
4002
4002
|
onError,
|
|
4003
4003
|
parentIndent: bm.indent,
|
|
@@ -4011,7 +4011,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4011
4011
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
4012
4012
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
4013
4013
|
}
|
|
4014
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
4014
|
+
if (!keyProps.anchor && !keyProps.tag && !sep3) {
|
|
4015
4015
|
commentEnd = keyProps.end;
|
|
4016
4016
|
if (keyProps.comment) {
|
|
4017
4017
|
if (map2.comment)
|
|
@@ -4035,7 +4035,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4035
4035
|
ctx.atKey = false;
|
|
4036
4036
|
if (utilMapIncludes.mapIncludes(ctx, map2.items, keyNode))
|
|
4037
4037
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4038
|
-
const valueProps = resolveProps.resolveProps(
|
|
4038
|
+
const valueProps = resolveProps.resolveProps(sep3 ?? [], {
|
|
4039
4039
|
indicator: "map-value-ind",
|
|
4040
4040
|
next: value,
|
|
4041
4041
|
offset: keyNode.range[2],
|
|
@@ -4051,7 +4051,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4051
4051
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
4052
4052
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
4053
4053
|
}
|
|
4054
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
4054
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep3, null, valueProps, onError);
|
|
4055
4055
|
if (ctx.schema.compat)
|
|
4056
4056
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
4057
4057
|
offset = valueNode.range[2];
|
|
@@ -4142,7 +4142,7 @@ var require_resolve_end = __commonJS({
|
|
|
4142
4142
|
let comment = "";
|
|
4143
4143
|
if (end) {
|
|
4144
4144
|
let hasSpace = false;
|
|
4145
|
-
let
|
|
4145
|
+
let sep3 = "";
|
|
4146
4146
|
for (const token of end) {
|
|
4147
4147
|
const { source, type } = token;
|
|
4148
4148
|
switch (type) {
|
|
@@ -4156,13 +4156,13 @@ var require_resolve_end = __commonJS({
|
|
|
4156
4156
|
if (!comment)
|
|
4157
4157
|
comment = cb;
|
|
4158
4158
|
else
|
|
4159
|
-
comment +=
|
|
4160
|
-
|
|
4159
|
+
comment += sep3 + cb;
|
|
4160
|
+
sep3 = "";
|
|
4161
4161
|
break;
|
|
4162
4162
|
}
|
|
4163
4163
|
case "newline":
|
|
4164
4164
|
if (comment)
|
|
4165
|
-
|
|
4165
|
+
sep3 += source;
|
|
4166
4166
|
hasSpace = true;
|
|
4167
4167
|
break;
|
|
4168
4168
|
default:
|
|
@@ -4205,18 +4205,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4205
4205
|
let offset = fc.offset + fc.start.source.length;
|
|
4206
4206
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
4207
4207
|
const collItem = fc.items[i];
|
|
4208
|
-
const { start, key, sep:
|
|
4208
|
+
const { start, key, sep: sep3, value } = collItem;
|
|
4209
4209
|
const props = resolveProps.resolveProps(start, {
|
|
4210
4210
|
flow: fcName,
|
|
4211
4211
|
indicator: "explicit-key-ind",
|
|
4212
|
-
next: key ??
|
|
4212
|
+
next: key ?? sep3?.[0],
|
|
4213
4213
|
offset,
|
|
4214
4214
|
onError,
|
|
4215
4215
|
parentIndent: fc.indent,
|
|
4216
4216
|
startOnNewline: false
|
|
4217
4217
|
});
|
|
4218
4218
|
if (!props.found) {
|
|
4219
|
-
if (!props.anchor && !props.tag && !
|
|
4219
|
+
if (!props.anchor && !props.tag && !sep3 && !value) {
|
|
4220
4220
|
if (i === 0 && props.comma)
|
|
4221
4221
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
4222
4222
|
else if (i < fc.items.length - 1)
|
|
@@ -4270,8 +4270,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4270
4270
|
}
|
|
4271
4271
|
}
|
|
4272
4272
|
}
|
|
4273
|
-
if (!isMap2 && !
|
|
4274
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
4273
|
+
if (!isMap2 && !sep3 && !props.found) {
|
|
4274
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep3, null, props, onError);
|
|
4275
4275
|
coll.items.push(valueNode);
|
|
4276
4276
|
offset = valueNode.range[2];
|
|
4277
4277
|
if (isBlock(value))
|
|
@@ -4283,7 +4283,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4283
4283
|
if (isBlock(key))
|
|
4284
4284
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
4285
4285
|
ctx.atKey = false;
|
|
4286
|
-
const valueProps = resolveProps.resolveProps(
|
|
4286
|
+
const valueProps = resolveProps.resolveProps(sep3 ?? [], {
|
|
4287
4287
|
flow: fcName,
|
|
4288
4288
|
indicator: "map-value-ind",
|
|
4289
4289
|
next: value,
|
|
@@ -4294,8 +4294,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4294
4294
|
});
|
|
4295
4295
|
if (valueProps.found) {
|
|
4296
4296
|
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
4297
|
-
if (
|
|
4298
|
-
for (const st of
|
|
4297
|
+
if (sep3)
|
|
4298
|
+
for (const st of sep3) {
|
|
4299
4299
|
if (st === valueProps.found)
|
|
4300
4300
|
break;
|
|
4301
4301
|
if (st.type === "newline") {
|
|
@@ -4312,7 +4312,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4312
4312
|
else
|
|
4313
4313
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
4314
4314
|
}
|
|
4315
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
4315
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep3, null, valueProps, onError) : null;
|
|
4316
4316
|
if (valueNode) {
|
|
4317
4317
|
if (isBlock(value))
|
|
4318
4318
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -4492,7 +4492,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4492
4492
|
chompStart = i + 1;
|
|
4493
4493
|
}
|
|
4494
4494
|
let value = "";
|
|
4495
|
-
let
|
|
4495
|
+
let sep3 = "";
|
|
4496
4496
|
let prevMoreIndented = false;
|
|
4497
4497
|
for (let i = 0; i < contentStart; ++i)
|
|
4498
4498
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -4509,24 +4509,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4509
4509
|
indent = "";
|
|
4510
4510
|
}
|
|
4511
4511
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
4512
|
-
value +=
|
|
4513
|
-
|
|
4512
|
+
value += sep3 + indent.slice(trimIndent) + content;
|
|
4513
|
+
sep3 = "\n";
|
|
4514
4514
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
4515
|
-
if (
|
|
4516
|
-
|
|
4517
|
-
else if (!prevMoreIndented &&
|
|
4518
|
-
|
|
4519
|
-
value +=
|
|
4520
|
-
|
|
4515
|
+
if (sep3 === " ")
|
|
4516
|
+
sep3 = "\n";
|
|
4517
|
+
else if (!prevMoreIndented && sep3 === "\n")
|
|
4518
|
+
sep3 = "\n\n";
|
|
4519
|
+
value += sep3 + indent.slice(trimIndent) + content;
|
|
4520
|
+
sep3 = "\n";
|
|
4521
4521
|
prevMoreIndented = true;
|
|
4522
4522
|
} else if (content === "") {
|
|
4523
|
-
if (
|
|
4523
|
+
if (sep3 === "\n")
|
|
4524
4524
|
value += "\n";
|
|
4525
4525
|
else
|
|
4526
|
-
|
|
4526
|
+
sep3 = "\n";
|
|
4527
4527
|
} else {
|
|
4528
|
-
value +=
|
|
4529
|
-
|
|
4528
|
+
value += sep3 + content;
|
|
4529
|
+
sep3 = " ";
|
|
4530
4530
|
prevMoreIndented = false;
|
|
4531
4531
|
}
|
|
4532
4532
|
}
|
|
@@ -4708,25 +4708,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
4708
4708
|
if (!match)
|
|
4709
4709
|
return source;
|
|
4710
4710
|
let res = match[1];
|
|
4711
|
-
let
|
|
4711
|
+
let sep3 = " ";
|
|
4712
4712
|
let pos = first2.lastIndex;
|
|
4713
4713
|
line.lastIndex = pos;
|
|
4714
4714
|
while (match = line.exec(source)) {
|
|
4715
4715
|
if (match[1] === "") {
|
|
4716
|
-
if (
|
|
4717
|
-
res +=
|
|
4716
|
+
if (sep3 === "\n")
|
|
4717
|
+
res += sep3;
|
|
4718
4718
|
else
|
|
4719
|
-
|
|
4719
|
+
sep3 = "\n";
|
|
4720
4720
|
} else {
|
|
4721
|
-
res +=
|
|
4722
|
-
|
|
4721
|
+
res += sep3 + match[1];
|
|
4722
|
+
sep3 = " ";
|
|
4723
4723
|
}
|
|
4724
4724
|
pos = line.lastIndex;
|
|
4725
4725
|
}
|
|
4726
4726
|
const last2 = /[ \t]*(.*)/sy;
|
|
4727
4727
|
last2.lastIndex = pos;
|
|
4728
4728
|
match = last2.exec(source);
|
|
4729
|
-
return res +
|
|
4729
|
+
return res + sep3 + (match?.[1] ?? "");
|
|
4730
4730
|
}
|
|
4731
4731
|
function doubleQuotedValue(source, onError) {
|
|
4732
4732
|
let res = "";
|
|
@@ -5533,14 +5533,14 @@ var require_cst_stringify = __commonJS({
|
|
|
5533
5533
|
}
|
|
5534
5534
|
}
|
|
5535
5535
|
}
|
|
5536
|
-
function stringifyItem({ start, key, sep:
|
|
5536
|
+
function stringifyItem({ start, key, sep: sep3, value }) {
|
|
5537
5537
|
let res = "";
|
|
5538
5538
|
for (const st of start)
|
|
5539
5539
|
res += st.source;
|
|
5540
5540
|
if (key)
|
|
5541
5541
|
res += stringifyToken(key);
|
|
5542
|
-
if (
|
|
5543
|
-
for (const st of
|
|
5542
|
+
if (sep3)
|
|
5543
|
+
for (const st of sep3)
|
|
5544
5544
|
res += st.source;
|
|
5545
5545
|
if (value)
|
|
5546
5546
|
res += stringifyToken(value);
|
|
@@ -6690,18 +6690,18 @@ var require_parser = __commonJS({
|
|
|
6690
6690
|
if (this.type === "map-value-ind") {
|
|
6691
6691
|
const prev = getPrevProps(this.peek(2));
|
|
6692
6692
|
const start = getFirstKeyStartProps(prev);
|
|
6693
|
-
let
|
|
6693
|
+
let sep3;
|
|
6694
6694
|
if (scalar.end) {
|
|
6695
|
-
|
|
6696
|
-
|
|
6695
|
+
sep3 = scalar.end;
|
|
6696
|
+
sep3.push(this.sourceToken);
|
|
6697
6697
|
delete scalar.end;
|
|
6698
6698
|
} else
|
|
6699
|
-
|
|
6699
|
+
sep3 = [this.sourceToken];
|
|
6700
6700
|
const map2 = {
|
|
6701
6701
|
type: "block-map",
|
|
6702
6702
|
offset: scalar.offset,
|
|
6703
6703
|
indent: scalar.indent,
|
|
6704
|
-
items: [{ start, key: scalar, sep:
|
|
6704
|
+
items: [{ start, key: scalar, sep: sep3 }]
|
|
6705
6705
|
};
|
|
6706
6706
|
this.onKeyLine = true;
|
|
6707
6707
|
this.stack[this.stack.length - 1] = map2;
|
|
@@ -6854,15 +6854,15 @@ var require_parser = __commonJS({
|
|
|
6854
6854
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
6855
6855
|
const start2 = getFirstKeyStartProps(it.start);
|
|
6856
6856
|
const key = it.key;
|
|
6857
|
-
const
|
|
6858
|
-
|
|
6857
|
+
const sep3 = it.sep;
|
|
6858
|
+
sep3.push(this.sourceToken);
|
|
6859
6859
|
delete it.key;
|
|
6860
6860
|
delete it.sep;
|
|
6861
6861
|
this.stack.push({
|
|
6862
6862
|
type: "block-map",
|
|
6863
6863
|
offset: this.offset,
|
|
6864
6864
|
indent: this.indent,
|
|
6865
|
-
items: [{ start: start2, key, sep:
|
|
6865
|
+
items: [{ start: start2, key, sep: sep3 }]
|
|
6866
6866
|
});
|
|
6867
6867
|
} else if (start.length > 0) {
|
|
6868
6868
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -7056,13 +7056,13 @@ var require_parser = __commonJS({
|
|
|
7056
7056
|
const prev = getPrevProps(parent);
|
|
7057
7057
|
const start = getFirstKeyStartProps(prev);
|
|
7058
7058
|
fixFlowSeqItems(fc);
|
|
7059
|
-
const
|
|
7060
|
-
|
|
7059
|
+
const sep3 = fc.end.splice(1, fc.end.length);
|
|
7060
|
+
sep3.push(this.sourceToken);
|
|
7061
7061
|
const map2 = {
|
|
7062
7062
|
type: "block-map",
|
|
7063
7063
|
offset: fc.offset,
|
|
7064
7064
|
indent: fc.indent,
|
|
7065
|
-
items: [{ start, key: fc, sep:
|
|
7065
|
+
items: [{ start, key: fc, sep: sep3 }]
|
|
7066
7066
|
};
|
|
7067
7067
|
this.onKeyLine = true;
|
|
7068
7068
|
this.stack[this.stack.length - 1] = map2;
|
|
@@ -8341,8 +8341,8 @@ var require_semaphore = __commonJS({
|
|
|
8341
8341
|
this._waiting = [];
|
|
8342
8342
|
}
|
|
8343
8343
|
lock(thunk) {
|
|
8344
|
-
return new Promise((
|
|
8345
|
-
this._waiting.push({ thunk, resolve:
|
|
8344
|
+
return new Promise((resolve24, reject2) => {
|
|
8345
|
+
this._waiting.push({ thunk, resolve: resolve24, reject: reject2 });
|
|
8346
8346
|
this.runNext();
|
|
8347
8347
|
});
|
|
8348
8348
|
}
|
|
@@ -9832,9 +9832,9 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
9832
9832
|
if (typeof cancellationStrategy.sender.enableCancellation === "function") {
|
|
9833
9833
|
cancellationStrategy.sender.enableCancellation(requestMessage);
|
|
9834
9834
|
}
|
|
9835
|
-
return new Promise(async (
|
|
9835
|
+
return new Promise(async (resolve24, reject2) => {
|
|
9836
9836
|
const resolveWithCleanup = (r) => {
|
|
9837
|
-
|
|
9837
|
+
resolve24(r);
|
|
9838
9838
|
cancellationStrategy.sender.cleanup(id);
|
|
9839
9839
|
disposable?.dispose();
|
|
9840
9840
|
};
|
|
@@ -10245,10 +10245,10 @@ var require_ril = __commonJS({
|
|
|
10245
10245
|
return api_1.Disposable.create(() => this.stream.off("end", listener));
|
|
10246
10246
|
}
|
|
10247
10247
|
write(data, encoding) {
|
|
10248
|
-
return new Promise((
|
|
10248
|
+
return new Promise((resolve24, reject2) => {
|
|
10249
10249
|
const callback = (error) => {
|
|
10250
10250
|
if (error === void 0 || error === null) {
|
|
10251
|
-
|
|
10251
|
+
resolve24();
|
|
10252
10252
|
} else {
|
|
10253
10253
|
reject2(error);
|
|
10254
10254
|
}
|
|
@@ -10500,10 +10500,10 @@ var require_main = __commonJS({
|
|
|
10500
10500
|
exports2.generateRandomPipeName = generateRandomPipeName;
|
|
10501
10501
|
function createClientPipeTransport(pipeName, encoding = "utf-8") {
|
|
10502
10502
|
let connectResolve;
|
|
10503
|
-
const connected = new Promise((
|
|
10504
|
-
connectResolve =
|
|
10503
|
+
const connected = new Promise((resolve24, _reject) => {
|
|
10504
|
+
connectResolve = resolve24;
|
|
10505
10505
|
});
|
|
10506
|
-
return new Promise((
|
|
10506
|
+
return new Promise((resolve24, reject2) => {
|
|
10507
10507
|
let server = (0, net_1.createServer)((socket) => {
|
|
10508
10508
|
server.close();
|
|
10509
10509
|
connectResolve([
|
|
@@ -10514,7 +10514,7 @@ var require_main = __commonJS({
|
|
|
10514
10514
|
server.on("error", reject2);
|
|
10515
10515
|
server.listen(pipeName, () => {
|
|
10516
10516
|
server.removeListener("error", reject2);
|
|
10517
|
-
|
|
10517
|
+
resolve24({
|
|
10518
10518
|
onConnected: () => {
|
|
10519
10519
|
return connected;
|
|
10520
10520
|
}
|
|
@@ -10533,10 +10533,10 @@ var require_main = __commonJS({
|
|
|
10533
10533
|
exports2.createServerPipeTransport = createServerPipeTransport;
|
|
10534
10534
|
function createClientSocketTransport(port, encoding = "utf-8") {
|
|
10535
10535
|
let connectResolve;
|
|
10536
|
-
const connected = new Promise((
|
|
10537
|
-
connectResolve =
|
|
10536
|
+
const connected = new Promise((resolve24, _reject) => {
|
|
10537
|
+
connectResolve = resolve24;
|
|
10538
10538
|
});
|
|
10539
|
-
return new Promise((
|
|
10539
|
+
return new Promise((resolve24, reject2) => {
|
|
10540
10540
|
const server = (0, net_1.createServer)((socket) => {
|
|
10541
10541
|
server.close();
|
|
10542
10542
|
connectResolve([
|
|
@@ -10547,7 +10547,7 @@ var require_main = __commonJS({
|
|
|
10547
10547
|
server.on("error", reject2);
|
|
10548
10548
|
server.listen(port, "127.0.0.1", () => {
|
|
10549
10549
|
server.removeListener("error", reject2);
|
|
10550
|
-
|
|
10550
|
+
resolve24({
|
|
10551
10551
|
onConnected: () => {
|
|
10552
10552
|
return connected;
|
|
10553
10553
|
}
|
|
@@ -17281,8 +17281,8 @@ var require_lib = __commonJS({
|
|
|
17281
17281
|
if (typeof cb !== "function") {
|
|
17282
17282
|
opts = cb;
|
|
17283
17283
|
cb = null;
|
|
17284
|
-
deferred = new this.Promise(function(
|
|
17285
|
-
deferredResolve =
|
|
17284
|
+
deferred = new this.Promise(function(resolve24, reject2) {
|
|
17285
|
+
deferredResolve = resolve24;
|
|
17286
17286
|
deferredReject = reject2;
|
|
17287
17287
|
});
|
|
17288
17288
|
}
|
|
@@ -17430,17 +17430,17 @@ var require_lib = __commonJS({
|
|
|
17430
17430
|
if (typeof cb === "function") {
|
|
17431
17431
|
fnx(cb);
|
|
17432
17432
|
} else {
|
|
17433
|
-
return new this.Promise(function(
|
|
17433
|
+
return new this.Promise(function(resolve24, reject2) {
|
|
17434
17434
|
if (fnx.length === 1) {
|
|
17435
17435
|
fnx(function(err, ret) {
|
|
17436
17436
|
if (err) {
|
|
17437
17437
|
reject2(err);
|
|
17438
17438
|
} else {
|
|
17439
|
-
|
|
17439
|
+
resolve24(ret);
|
|
17440
17440
|
}
|
|
17441
17441
|
});
|
|
17442
17442
|
} else {
|
|
17443
|
-
|
|
17443
|
+
resolve24(fnx());
|
|
17444
17444
|
}
|
|
17445
17445
|
});
|
|
17446
17446
|
}
|
|
@@ -23488,7 +23488,7 @@ var require_pify = __commonJS({
|
|
|
23488
23488
|
"use strict";
|
|
23489
23489
|
var processFn = (fn, options) => function(...args2) {
|
|
23490
23490
|
const P = options.promiseModule;
|
|
23491
|
-
return new P((
|
|
23491
|
+
return new P((resolve24, reject2) => {
|
|
23492
23492
|
if (options.multiArgs) {
|
|
23493
23493
|
args2.push((...result) => {
|
|
23494
23494
|
if (options.errorFirst) {
|
|
@@ -23496,10 +23496,10 @@ var require_pify = __commonJS({
|
|
|
23496
23496
|
reject2(result);
|
|
23497
23497
|
} else {
|
|
23498
23498
|
result.shift();
|
|
23499
|
-
|
|
23499
|
+
resolve24(result);
|
|
23500
23500
|
}
|
|
23501
23501
|
} else {
|
|
23502
|
-
|
|
23502
|
+
resolve24(result);
|
|
23503
23503
|
}
|
|
23504
23504
|
});
|
|
23505
23505
|
} else if (options.errorFirst) {
|
|
@@ -23507,11 +23507,11 @@ var require_pify = __commonJS({
|
|
|
23507
23507
|
if (error) {
|
|
23508
23508
|
reject2(error);
|
|
23509
23509
|
} else {
|
|
23510
|
-
|
|
23510
|
+
resolve24(result);
|
|
23511
23511
|
}
|
|
23512
23512
|
});
|
|
23513
23513
|
} else {
|
|
23514
|
-
args2.push(
|
|
23514
|
+
args2.push(resolve24);
|
|
23515
23515
|
}
|
|
23516
23516
|
fn.apply(this, args2);
|
|
23517
23517
|
});
|
|
@@ -24861,7 +24861,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
24861
24861
|
}
|
|
24862
24862
|
return path;
|
|
24863
24863
|
}
|
|
24864
|
-
function
|
|
24864
|
+
function dirname11(path) {
|
|
24865
24865
|
const last2 = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
|
|
24866
24866
|
if (last2 === -1) return ".";
|
|
24867
24867
|
if (last2 === 0) return "/";
|
|
@@ -24879,7 +24879,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
24879
24879
|
children: []
|
|
24880
24880
|
};
|
|
24881
24881
|
inodes.set(name, dir);
|
|
24882
|
-
dir.parent = mkdir2(
|
|
24882
|
+
dir.parent = mkdir2(dirname11(name));
|
|
24883
24883
|
if (dir.parent && dir.parent !== dir) dir.parent.children.push(dir);
|
|
24884
24884
|
}
|
|
24885
24885
|
return inodes.get(name);
|
|
@@ -24892,7 +24892,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
24892
24892
|
basename: basename4(name),
|
|
24893
24893
|
metadata,
|
|
24894
24894
|
// This recursively generates any missing parent folders.
|
|
24895
|
-
parent: mkdir2(
|
|
24895
|
+
parent: mkdir2(dirname11(name)),
|
|
24896
24896
|
children: []
|
|
24897
24897
|
};
|
|
24898
24898
|
if (file.parent) file.parent.children.push(file);
|
|
@@ -25270,7 +25270,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
25270
25270
|
if (trailingSeparator) path += "/";
|
|
25271
25271
|
return isAbsolute5 ? `/${path}` : path;
|
|
25272
25272
|
}
|
|
25273
|
-
function
|
|
25273
|
+
function join13(...args2) {
|
|
25274
25274
|
if (args2.length === 0) return ".";
|
|
25275
25275
|
let joined;
|
|
25276
25276
|
for (let i = 0; i < args2.length; ++i) {
|
|
@@ -25655,7 +25655,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
25655
25655
|
for (const [key, value] of actualRefsToWrite) {
|
|
25656
25656
|
await acquireLock(
|
|
25657
25657
|
key,
|
|
25658
|
-
async () => fs2.write(
|
|
25658
|
+
async () => fs2.write(join13(gitdir, key), `${value.trim()}
|
|
25659
25659
|
`, "utf8")
|
|
25660
25660
|
);
|
|
25661
25661
|
}
|
|
@@ -25678,7 +25678,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
25678
25678
|
}
|
|
25679
25679
|
await acquireLock(
|
|
25680
25680
|
ref,
|
|
25681
|
-
async () => fs2.write(
|
|
25681
|
+
async () => fs2.write(join13(gitdir, ref), `${value.trim()}
|
|
25682
25682
|
`, "utf8")
|
|
25683
25683
|
);
|
|
25684
25684
|
}
|
|
@@ -25695,7 +25695,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
25695
25695
|
static async writeSymbolicRef({ fs: fs2, gitdir, ref, value }) {
|
|
25696
25696
|
await acquireLock(
|
|
25697
25697
|
ref,
|
|
25698
|
-
async () => fs2.write(
|
|
25698
|
+
async () => fs2.write(join13(gitdir, ref), `ref: ${value.trim()}
|
|
25699
25699
|
`, "utf8")
|
|
25700
25700
|
);
|
|
25701
25701
|
}
|
|
@@ -25721,7 +25721,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
25721
25721
|
* @returns {Promise<void>}
|
|
25722
25722
|
*/
|
|
25723
25723
|
static async deleteRefs({ fs: fs2, gitdir, refs }) {
|
|
25724
|
-
await Promise.all(refs.map((ref) => fs2.rm(
|
|
25724
|
+
await Promise.all(refs.map((ref) => fs2.rm(join13(gitdir, ref))));
|
|
25725
25725
|
let text = await acquireLock(
|
|
25726
25726
|
"packed-refs",
|
|
25727
25727
|
async () => fs2.read(`${gitdir}/packed-refs`, { encoding: "utf8" })
|
|
@@ -26753,7 +26753,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
26753
26753
|
format = "content",
|
|
26754
26754
|
getExternalRefDelta
|
|
26755
26755
|
}) {
|
|
26756
|
-
let list = await fs2.readdir(
|
|
26756
|
+
let list = await fs2.readdir(join13(gitdir, "objects/pack"));
|
|
26757
26757
|
list = list.filter((x) => x.endsWith(".idx"));
|
|
26758
26758
|
for (const filename of list) {
|
|
26759
26759
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -27614,9 +27614,9 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
27614
27614
|
}
|
|
27615
27615
|
const tree = GitTree.from(object);
|
|
27616
27616
|
for (const entry2 of tree) {
|
|
27617
|
-
map2.set(
|
|
27617
|
+
map2.set(join13(filepath, entry2.path), entry2);
|
|
27618
27618
|
}
|
|
27619
|
-
return tree.entries().map((entry2) =>
|
|
27619
|
+
return tree.entries().map((entry2) => join13(filepath, entry2.path));
|
|
27620
27620
|
}
|
|
27621
27621
|
async type(entry) {
|
|
27622
27622
|
if (entry._type === false) {
|
|
@@ -27707,9 +27707,9 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
27707
27707
|
async readdir(entry) {
|
|
27708
27708
|
const filepath = entry._fullpath;
|
|
27709
27709
|
const { fs: fs2, dir } = this;
|
|
27710
|
-
const names = await fs2.readdir(
|
|
27710
|
+
const names = await fs2.readdir(join13(dir, filepath));
|
|
27711
27711
|
if (names === null) return null;
|
|
27712
|
-
return names.map((name) =>
|
|
27712
|
+
return names.map((name) => join13(filepath, name));
|
|
27713
27713
|
}
|
|
27714
27714
|
async type(entry) {
|
|
27715
27715
|
if (entry._type === false) {
|
|
@@ -27937,7 +27937,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
27937
27937
|
} else if (entries.length) {
|
|
27938
27938
|
await Promise.all(
|
|
27939
27939
|
entries.map((entry) => {
|
|
27940
|
-
const subpath =
|
|
27940
|
+
const subpath = join13(filepath, entry);
|
|
27941
27941
|
return fs2.lstat(subpath).then((stat5) => {
|
|
27942
27942
|
if (!stat5) return;
|
|
27943
27943
|
return stat5.isDirectory() ? rmRecursive(fs2, subpath) : fs2.rm(subpath);
|
|
@@ -28076,7 +28076,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28076
28076
|
try {
|
|
28077
28077
|
await this._writeFile(filepath, contents, options);
|
|
28078
28078
|
} catch (err) {
|
|
28079
|
-
await this.mkdir(
|
|
28079
|
+
await this.mkdir(dirname11(filepath));
|
|
28080
28080
|
await this._writeFile(filepath, contents, options);
|
|
28081
28081
|
}
|
|
28082
28082
|
}
|
|
@@ -28095,7 +28095,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28095
28095
|
if (err.code === "EEXIST") return;
|
|
28096
28096
|
if (_selfCall) throw err;
|
|
28097
28097
|
if (err.code === "ENOENT") {
|
|
28098
|
-
const parent =
|
|
28098
|
+
const parent = dirname11(filepath);
|
|
28099
28099
|
if (parent === "." || parent === "/" || parent === filepath) throw err;
|
|
28100
28100
|
await this.mkdir(parent);
|
|
28101
28101
|
await this.mkdir(filepath, true);
|
|
@@ -28235,7 +28235,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28235
28235
|
if (isAbsolute4(submoduleGitdir)) {
|
|
28236
28236
|
return submoduleGitdir;
|
|
28237
28237
|
}
|
|
28238
|
-
const gitdir =
|
|
28238
|
+
const gitdir = join13(dirname11(dotgit), submoduleGitdir);
|
|
28239
28239
|
return gitdir;
|
|
28240
28240
|
});
|
|
28241
28241
|
} else {
|
|
@@ -28257,7 +28257,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28257
28257
|
async function abortMerge({
|
|
28258
28258
|
fs: _fs,
|
|
28259
28259
|
dir,
|
|
28260
|
-
gitdir =
|
|
28260
|
+
gitdir = join13(dir, ".git"),
|
|
28261
28261
|
commit: commit2 = "HEAD",
|
|
28262
28262
|
cache = {}
|
|
28263
28263
|
}) {
|
|
@@ -28338,17 +28338,17 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28338
28338
|
* @param {string} args.filepath - The path of the file to check.
|
|
28339
28339
|
* @returns {Promise<boolean>} - `true` if the file is ignored, `false` otherwise.
|
|
28340
28340
|
*/
|
|
28341
|
-
static async isIgnored({ fs: fs2, dir, gitdir =
|
|
28341
|
+
static async isIgnored({ fs: fs2, dir, gitdir = join13(dir, ".git"), filepath }) {
|
|
28342
28342
|
if (basename4(filepath) === ".git") return true;
|
|
28343
28343
|
if (filepath === ".") return false;
|
|
28344
28344
|
let excludes = "";
|
|
28345
|
-
const excludesFile =
|
|
28345
|
+
const excludesFile = join13(gitdir, "info", "exclude");
|
|
28346
28346
|
if (await fs2.exists(excludesFile)) {
|
|
28347
28347
|
excludes = await fs2.read(excludesFile, "utf8");
|
|
28348
28348
|
}
|
|
28349
28349
|
const pairs = [
|
|
28350
28350
|
{
|
|
28351
|
-
gitignore:
|
|
28351
|
+
gitignore: join13(dir, ".gitignore"),
|
|
28352
28352
|
filepath
|
|
28353
28353
|
}
|
|
28354
28354
|
];
|
|
@@ -28357,7 +28357,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28357
28357
|
const folder = pieces.slice(0, i).join("/");
|
|
28358
28358
|
const file = pieces.slice(i).join("/");
|
|
28359
28359
|
pairs.push({
|
|
28360
|
-
gitignore:
|
|
28360
|
+
gitignore: join13(dir, folder, ".gitignore"),
|
|
28361
28361
|
filepath: file
|
|
28362
28362
|
});
|
|
28363
28363
|
}
|
|
@@ -28371,7 +28371,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28371
28371
|
}
|
|
28372
28372
|
const ign = ignore().add(excludes);
|
|
28373
28373
|
ign.add(file);
|
|
28374
|
-
const parentdir =
|
|
28374
|
+
const parentdir = dirname11(p.filepath);
|
|
28375
28375
|
if (parentdir !== "." && ign.ignores(parentdir)) return true;
|
|
28376
28376
|
if (ignoredStatus) {
|
|
28377
28377
|
ignoredStatus = !ign.test(p.filepath).unignored;
|
|
@@ -28444,7 +28444,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28444
28444
|
async function add({
|
|
28445
28445
|
fs: _fs,
|
|
28446
28446
|
dir,
|
|
28447
|
-
gitdir =
|
|
28447
|
+
gitdir = join13(dir, ".git"),
|
|
28448
28448
|
filepath,
|
|
28449
28449
|
cache = {},
|
|
28450
28450
|
force = false,
|
|
@@ -28500,17 +28500,17 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28500
28500
|
});
|
|
28501
28501
|
if (ignored) return;
|
|
28502
28502
|
}
|
|
28503
|
-
const stats = await fs2.lstat(
|
|
28503
|
+
const stats = await fs2.lstat(join13(dir, currentFilepath));
|
|
28504
28504
|
if (!stats) throw new NotFoundError(currentFilepath);
|
|
28505
28505
|
if (stats.isDirectory()) {
|
|
28506
|
-
const children = await fs2.readdir(
|
|
28506
|
+
const children = await fs2.readdir(join13(dir, currentFilepath));
|
|
28507
28507
|
if (parallel) {
|
|
28508
28508
|
const promises2 = children.map(
|
|
28509
28509
|
(child) => addToIndex({
|
|
28510
28510
|
dir,
|
|
28511
28511
|
gitdir,
|
|
28512
28512
|
fs: fs2,
|
|
28513
|
-
filepath: [
|
|
28513
|
+
filepath: [join13(currentFilepath, child)],
|
|
28514
28514
|
index: index2,
|
|
28515
28515
|
force,
|
|
28516
28516
|
parallel,
|
|
@@ -28524,7 +28524,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28524
28524
|
dir,
|
|
28525
28525
|
gitdir,
|
|
28526
28526
|
fs: fs2,
|
|
28527
|
-
filepath: [
|
|
28527
|
+
filepath: [join13(currentFilepath, child)],
|
|
28528
28528
|
index: index2,
|
|
28529
28529
|
force,
|
|
28530
28530
|
parallel,
|
|
@@ -28533,7 +28533,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28533
28533
|
}
|
|
28534
28534
|
}
|
|
28535
28535
|
} else {
|
|
28536
|
-
const object = stats.isSymbolicLink() ? await fs2.readlink(
|
|
28536
|
+
const object = stats.isSymbolicLink() ? await fs2.readlink(join13(dir, currentFilepath)).then(posixifyPathBuffer) : await fs2.read(join13(dir, currentFilepath), { autocrlf });
|
|
28537
28537
|
if (object === null) throw new NotFoundError(currentFilepath);
|
|
28538
28538
|
const oid = await _writeObject({ fs: fs2, gitdir, type: "blob", object });
|
|
28539
28539
|
index2.insert({ filepath: currentFilepath, stats, oid });
|
|
@@ -28947,7 +28947,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
28947
28947
|
fs: _fs,
|
|
28948
28948
|
onSign,
|
|
28949
28949
|
dir,
|
|
28950
|
-
gitdir =
|
|
28950
|
+
gitdir = join13(dir, ".git"),
|
|
28951
28951
|
ref = "refs/notes/commits",
|
|
28952
28952
|
oid,
|
|
28953
28953
|
note,
|
|
@@ -29023,7 +29023,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
29023
29023
|
async function addRemote({
|
|
29024
29024
|
fs: fs2,
|
|
29025
29025
|
dir,
|
|
29026
|
-
gitdir =
|
|
29026
|
+
gitdir = join13(dir, ".git"),
|
|
29027
29027
|
remote,
|
|
29028
29028
|
url,
|
|
29029
29029
|
force = false
|
|
@@ -29093,7 +29093,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
29093
29093
|
fs: _fs,
|
|
29094
29094
|
onSign,
|
|
29095
29095
|
dir,
|
|
29096
|
-
gitdir =
|
|
29096
|
+
gitdir = join13(dir, ".git"),
|
|
29097
29097
|
ref,
|
|
29098
29098
|
tagger: _tagger,
|
|
29099
29099
|
message = ref,
|
|
@@ -29174,7 +29174,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
29174
29174
|
async function branch({
|
|
29175
29175
|
fs: fs2,
|
|
29176
29176
|
dir,
|
|
29177
|
-
gitdir =
|
|
29177
|
+
gitdir = join13(dir, ".git"),
|
|
29178
29178
|
ref,
|
|
29179
29179
|
object,
|
|
29180
29180
|
checkout: checkout2 = false,
|
|
@@ -29800,7 +29800,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
29800
29800
|
onProgress,
|
|
29801
29801
|
onPostCheckout,
|
|
29802
29802
|
dir,
|
|
29803
|
-
gitdir =
|
|
29803
|
+
gitdir = join13(dir, ".git"),
|
|
29804
29804
|
remote = "origin",
|
|
29805
29805
|
ref: _ref,
|
|
29806
29806
|
filepaths,
|
|
@@ -29879,7 +29879,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
29879
29879
|
fs: fs2,
|
|
29880
29880
|
cache,
|
|
29881
29881
|
dir,
|
|
29882
|
-
gitdir =
|
|
29882
|
+
gitdir = join13(dir, ".git"),
|
|
29883
29883
|
index: index2,
|
|
29884
29884
|
ourOid,
|
|
29885
29885
|
baseOid,
|
|
@@ -30154,7 +30154,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
30154
30154
|
return lock$2.acquire(ref, callback);
|
|
30155
30155
|
}
|
|
30156
30156
|
async function checkAndWriteBlob(fs2, gitdir, dir, filepath, oid = null) {
|
|
30157
|
-
const currentFilepath =
|
|
30157
|
+
const currentFilepath = join13(dir, filepath);
|
|
30158
30158
|
const stats = await fs2.lstat(currentFilepath);
|
|
30159
30159
|
if (!stats) throw new NotFoundError(currentFilepath);
|
|
30160
30160
|
if (stats.isDirectory())
|
|
@@ -30323,7 +30323,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
30323
30323
|
stageUpdated.push({
|
|
30324
30324
|
filepath,
|
|
30325
30325
|
oid,
|
|
30326
|
-
stats: await fs2.lstat(
|
|
30326
|
+
stats: await fs2.lstat(join13(dir, filepath))
|
|
30327
30327
|
});
|
|
30328
30328
|
return {
|
|
30329
30329
|
method: "write",
|
|
@@ -30336,7 +30336,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
30336
30336
|
});
|
|
30337
30337
|
await acquireLock$1({ fs: fs2, gitdir, dirRemoved, ops }, async () => {
|
|
30338
30338
|
for (const op of ops) {
|
|
30339
|
-
const currentFilepath =
|
|
30339
|
+
const currentFilepath = join13(dir, op.filepath);
|
|
30340
30340
|
switch (op.method) {
|
|
30341
30341
|
case "rmdir":
|
|
30342
30342
|
await fs2.rmdir(currentFilepath);
|
|
@@ -30468,7 +30468,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
30468
30468
|
async function cherryPick({
|
|
30469
30469
|
fs: _fs,
|
|
30470
30470
|
dir,
|
|
30471
|
-
gitdir =
|
|
30471
|
+
gitdir = join13(dir, ".git"),
|
|
30472
30472
|
oid,
|
|
30473
30473
|
cache = {},
|
|
30474
30474
|
committer,
|
|
@@ -30704,8 +30704,8 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
30704
30704
|
}
|
|
30705
30705
|
return { protocolVersion: 1, capabilities, refs, symrefs };
|
|
30706
30706
|
}
|
|
30707
|
-
function splitAndAssert(line,
|
|
30708
|
-
const split = line.trim().split(
|
|
30707
|
+
function splitAndAssert(line, sep3, expected) {
|
|
30708
|
+
const split = line.trim().split(sep3);
|
|
30709
30709
|
if (split.length !== 2) {
|
|
30710
30710
|
throw new ParseError(
|
|
30711
30711
|
`Two strings separated by '${expected}'`,
|
|
@@ -30937,7 +30937,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
30937
30937
|
*/
|
|
30938
30938
|
static async read({ fs: fs2, gitdir }) {
|
|
30939
30939
|
if (lock$3 === null) lock$3 = new AsyncLock();
|
|
30940
|
-
const filepath =
|
|
30940
|
+
const filepath = join13(gitdir, "shallow");
|
|
30941
30941
|
const oids = /* @__PURE__ */ new Set();
|
|
30942
30942
|
await lock$3.acquire(filepath, async function() {
|
|
30943
30943
|
const text = await fs2.read(filepath, { encoding: "utf8" });
|
|
@@ -30959,7 +30959,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
30959
30959
|
*/
|
|
30960
30960
|
static async write({ fs: fs2, gitdir, oids }) {
|
|
30961
30961
|
if (lock$3 === null) lock$3 = new AsyncLock();
|
|
30962
|
-
const filepath =
|
|
30962
|
+
const filepath = join13(gitdir, "shallow");
|
|
30963
30963
|
if (oids.size > 0) {
|
|
30964
30964
|
const text = [...oids].join("\n") + "\n";
|
|
30965
30965
|
await lock$3.acquire(filepath, async function() {
|
|
@@ -30985,7 +30985,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
30985
30985
|
oid,
|
|
30986
30986
|
getExternalRefDelta
|
|
30987
30987
|
}) {
|
|
30988
|
-
let list = await fs2.readdir(
|
|
30988
|
+
let list = await fs2.readdir(join13(gitdir, "objects/pack"));
|
|
30989
30989
|
list = list.filter((x) => x.endsWith(".idx"));
|
|
30990
30990
|
for (const filename of list) {
|
|
30991
30991
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -31050,9 +31050,9 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31050
31050
|
throw Error("You cannot write to a FIFO that has already been ended!");
|
|
31051
31051
|
}
|
|
31052
31052
|
if (this._waiting) {
|
|
31053
|
-
const
|
|
31053
|
+
const resolve24 = this._waiting;
|
|
31054
31054
|
this._waiting = null;
|
|
31055
|
-
|
|
31055
|
+
resolve24({ value: chunk });
|
|
31056
31056
|
} else {
|
|
31057
31057
|
this._queue.push(chunk);
|
|
31058
31058
|
}
|
|
@@ -31060,9 +31060,9 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31060
31060
|
end() {
|
|
31061
31061
|
this._ended = true;
|
|
31062
31062
|
if (this._waiting) {
|
|
31063
|
-
const
|
|
31063
|
+
const resolve24 = this._waiting;
|
|
31064
31064
|
this._waiting = null;
|
|
31065
|
-
|
|
31065
|
+
resolve24({ done: true });
|
|
31066
31066
|
}
|
|
31067
31067
|
}
|
|
31068
31068
|
destroy(err) {
|
|
@@ -31081,8 +31081,8 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31081
31081
|
"You cannot call read until the previous call to read has returned!"
|
|
31082
31082
|
);
|
|
31083
31083
|
}
|
|
31084
|
-
return new Promise((
|
|
31085
|
-
this._waiting =
|
|
31084
|
+
return new Promise((resolve24) => {
|
|
31085
|
+
this._waiting = resolve24;
|
|
31086
31086
|
});
|
|
31087
31087
|
}
|
|
31088
31088
|
};
|
|
@@ -31236,7 +31236,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31236
31236
|
const acks = [];
|
|
31237
31237
|
let nak = false;
|
|
31238
31238
|
let done = false;
|
|
31239
|
-
return new Promise((
|
|
31239
|
+
return new Promise((resolve24, reject2) => {
|
|
31240
31240
|
forAwait(packetlines, (data) => {
|
|
31241
31241
|
const line = data.toString("utf8").trim();
|
|
31242
31242
|
if (line.startsWith("shallow")) {
|
|
@@ -31263,11 +31263,11 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31263
31263
|
nak = true;
|
|
31264
31264
|
}
|
|
31265
31265
|
if (done) {
|
|
31266
|
-
stream2.error ? reject2(stream2.error) :
|
|
31266
|
+
stream2.error ? reject2(stream2.error) : resolve24({ shallows, unshallows, acks, nak, packfile, progress });
|
|
31267
31267
|
}
|
|
31268
31268
|
}).finally(() => {
|
|
31269
31269
|
if (!done) {
|
|
31270
|
-
stream2.error ? reject2(stream2.error) :
|
|
31270
|
+
stream2.error ? reject2(stream2.error) : resolve24({ shallows, unshallows, acks, nak, packfile, progress });
|
|
31271
31271
|
}
|
|
31272
31272
|
});
|
|
31273
31273
|
});
|
|
@@ -31568,7 +31568,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31568
31568
|
}
|
|
31569
31569
|
if (packfileSha !== "" && !emptyPackfile(packfile)) {
|
|
31570
31570
|
res.packfile = `objects/pack/pack-${packfileSha}.pack`;
|
|
31571
|
-
const fullpath =
|
|
31571
|
+
const fullpath = join13(gitdir, res.packfile);
|
|
31572
31572
|
await fs2.write(fullpath, packfile);
|
|
31573
31573
|
const getExternalRefDelta = (oid2) => _readObject({ fs: fs2, cache, gitdir, oid: oid2 });
|
|
31574
31574
|
const idx = await GitPackIndex.fromPack({
|
|
@@ -31584,7 +31584,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31584
31584
|
fs: fs2,
|
|
31585
31585
|
bare = false,
|
|
31586
31586
|
dir,
|
|
31587
|
-
gitdir = bare ? dir :
|
|
31587
|
+
gitdir = bare ? dir : join13(dir, ".git"),
|
|
31588
31588
|
defaultBranch = "master"
|
|
31589
31589
|
}) {
|
|
31590
31590
|
if (await fs2.exists(gitdir + "/config")) return;
|
|
@@ -31698,7 +31698,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31698
31698
|
onAuthFailure,
|
|
31699
31699
|
onPostCheckout,
|
|
31700
31700
|
dir,
|
|
31701
|
-
gitdir =
|
|
31701
|
+
gitdir = join13(dir, ".git"),
|
|
31702
31702
|
url,
|
|
31703
31703
|
corsProxy = void 0,
|
|
31704
31704
|
ref = void 0,
|
|
@@ -31761,7 +31761,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31761
31761
|
fs: _fs,
|
|
31762
31762
|
onSign,
|
|
31763
31763
|
dir,
|
|
31764
|
-
gitdir =
|
|
31764
|
+
gitdir = join13(dir, ".git"),
|
|
31765
31765
|
message,
|
|
31766
31766
|
author,
|
|
31767
31767
|
committer,
|
|
@@ -31808,7 +31808,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31808
31808
|
async function currentBranch({
|
|
31809
31809
|
fs: fs2,
|
|
31810
31810
|
dir,
|
|
31811
|
-
gitdir =
|
|
31811
|
+
gitdir = join13(dir, ".git"),
|
|
31812
31812
|
fullname = false,
|
|
31813
31813
|
test = false
|
|
31814
31814
|
}) {
|
|
@@ -31849,7 +31849,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31849
31849
|
async function deleteBranch({
|
|
31850
31850
|
fs: fs2,
|
|
31851
31851
|
dir,
|
|
31852
|
-
gitdir =
|
|
31852
|
+
gitdir = join13(dir, ".git"),
|
|
31853
31853
|
ref
|
|
31854
31854
|
}) {
|
|
31855
31855
|
try {
|
|
@@ -31867,7 +31867,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31867
31867
|
throw err;
|
|
31868
31868
|
}
|
|
31869
31869
|
}
|
|
31870
|
-
async function deleteRef({ fs: fs2, dir, gitdir =
|
|
31870
|
+
async function deleteRef({ fs: fs2, dir, gitdir = join13(dir, ".git"), ref }) {
|
|
31871
31871
|
try {
|
|
31872
31872
|
assertParameter("fs", fs2);
|
|
31873
31873
|
assertParameter("ref", ref);
|
|
@@ -31887,7 +31887,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31887
31887
|
async function deleteRemote({
|
|
31888
31888
|
fs: fs2,
|
|
31889
31889
|
dir,
|
|
31890
|
-
gitdir =
|
|
31890
|
+
gitdir = join13(dir, ".git"),
|
|
31891
31891
|
remote
|
|
31892
31892
|
}) {
|
|
31893
31893
|
try {
|
|
@@ -31909,7 +31909,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31909
31909
|
ref = ref.startsWith("refs/tags/") ? ref : `refs/tags/${ref}`;
|
|
31910
31910
|
await GitRefManager.deleteRef({ fs: fs2, gitdir, ref });
|
|
31911
31911
|
}
|
|
31912
|
-
async function deleteTag({ fs: fs2, dir, gitdir =
|
|
31912
|
+
async function deleteTag({ fs: fs2, dir, gitdir = join13(dir, ".git"), ref }) {
|
|
31913
31913
|
try {
|
|
31914
31914
|
assertParameter("fs", fs2);
|
|
31915
31915
|
assertParameter("ref", ref);
|
|
@@ -31938,7 +31938,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31938
31938
|
getExternalRefDelta
|
|
31939
31939
|
}) {
|
|
31940
31940
|
const results = [];
|
|
31941
|
-
let list = await fs2.readdir(
|
|
31941
|
+
let list = await fs2.readdir(join13(gitdir, "objects/pack"));
|
|
31942
31942
|
list = list.filter((x) => x.endsWith(".idx"));
|
|
31943
31943
|
for (const filename of list) {
|
|
31944
31944
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -31981,7 +31981,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
31981
31981
|
async function expandOid({
|
|
31982
31982
|
fs: fs2,
|
|
31983
31983
|
dir,
|
|
31984
|
-
gitdir =
|
|
31984
|
+
gitdir = join13(dir, ".git"),
|
|
31985
31985
|
oid,
|
|
31986
31986
|
cache = {}
|
|
31987
31987
|
}) {
|
|
@@ -32002,7 +32002,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32002
32002
|
throw err;
|
|
32003
32003
|
}
|
|
32004
32004
|
}
|
|
32005
|
-
async function expandRef({ fs: fs2, dir, gitdir =
|
|
32005
|
+
async function expandRef({ fs: fs2, dir, gitdir = join13(dir, ".git"), ref }) {
|
|
32006
32006
|
try {
|
|
32007
32007
|
assertParameter("fs", fs2);
|
|
32008
32008
|
assertParameter("gitdir", gitdir);
|
|
@@ -32270,7 +32270,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32270
32270
|
onAuthSuccess,
|
|
32271
32271
|
onAuthFailure,
|
|
32272
32272
|
dir,
|
|
32273
|
-
gitdir =
|
|
32273
|
+
gitdir = join13(dir, ".git"),
|
|
32274
32274
|
ref,
|
|
32275
32275
|
url,
|
|
32276
32276
|
remote,
|
|
@@ -32328,7 +32328,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32328
32328
|
onAuthSuccess,
|
|
32329
32329
|
onAuthFailure,
|
|
32330
32330
|
dir,
|
|
32331
|
-
gitdir =
|
|
32331
|
+
gitdir = join13(dir, ".git"),
|
|
32332
32332
|
ref,
|
|
32333
32333
|
remote,
|
|
32334
32334
|
remoteRef,
|
|
@@ -32384,7 +32384,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32384
32384
|
async function findMergeBase({
|
|
32385
32385
|
fs: fs2,
|
|
32386
32386
|
dir,
|
|
32387
|
-
gitdir =
|
|
32387
|
+
gitdir = join13(dir, ".git"),
|
|
32388
32388
|
oids,
|
|
32389
32389
|
cache = {}
|
|
32390
32390
|
}) {
|
|
@@ -32406,10 +32406,10 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32406
32406
|
}
|
|
32407
32407
|
}
|
|
32408
32408
|
async function _findRoot({ fs: fs2, filepath }) {
|
|
32409
|
-
if (await fs2.exists(
|
|
32409
|
+
if (await fs2.exists(join13(filepath, ".git"))) {
|
|
32410
32410
|
return filepath;
|
|
32411
32411
|
} else {
|
|
32412
|
-
const parent =
|
|
32412
|
+
const parent = dirname11(filepath);
|
|
32413
32413
|
if (parent === filepath) {
|
|
32414
32414
|
throw new NotFoundError(`git root for ${filepath}`);
|
|
32415
32415
|
}
|
|
@@ -32426,7 +32426,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32426
32426
|
throw err;
|
|
32427
32427
|
}
|
|
32428
32428
|
}
|
|
32429
|
-
async function getConfig({ fs: fs2, dir, gitdir =
|
|
32429
|
+
async function getConfig({ fs: fs2, dir, gitdir = join13(dir, ".git"), path }) {
|
|
32430
32430
|
try {
|
|
32431
32431
|
assertParameter("fs", fs2);
|
|
32432
32432
|
assertParameter("gitdir", gitdir);
|
|
@@ -32450,7 +32450,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32450
32450
|
async function getConfigAll({
|
|
32451
32451
|
fs: fs2,
|
|
32452
32452
|
dir,
|
|
32453
|
-
gitdir =
|
|
32453
|
+
gitdir = join13(dir, ".git"),
|
|
32454
32454
|
path
|
|
32455
32455
|
}) {
|
|
32456
32456
|
try {
|
|
@@ -32643,7 +32643,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32643
32643
|
filepath
|
|
32644
32644
|
}) {
|
|
32645
32645
|
try {
|
|
32646
|
-
filepath =
|
|
32646
|
+
filepath = join13(dir, filepath);
|
|
32647
32647
|
const pack = await fs2.read(filepath);
|
|
32648
32648
|
const getExternalRefDelta = (oid) => _readObject({ fs: fs2, cache, gitdir, oid });
|
|
32649
32649
|
const idx = await GitPackIndex.fromPack({
|
|
@@ -32664,7 +32664,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32664
32664
|
fs: fs2,
|
|
32665
32665
|
onProgress,
|
|
32666
32666
|
dir,
|
|
32667
|
-
gitdir =
|
|
32667
|
+
gitdir = join13(dir, ".git"),
|
|
32668
32668
|
filepath,
|
|
32669
32669
|
cache = {}
|
|
32670
32670
|
}) {
|
|
@@ -32692,7 +32692,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32692
32692
|
fs: fs2,
|
|
32693
32693
|
bare = false,
|
|
32694
32694
|
dir,
|
|
32695
|
-
gitdir = bare ? dir :
|
|
32695
|
+
gitdir = bare ? dir : join13(dir, ".git"),
|
|
32696
32696
|
defaultBranch = "master"
|
|
32697
32697
|
}) {
|
|
32698
32698
|
try {
|
|
@@ -32766,7 +32766,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32766
32766
|
async function isDescendent({
|
|
32767
32767
|
fs: fs2,
|
|
32768
32768
|
dir,
|
|
32769
|
-
gitdir =
|
|
32769
|
+
gitdir = join13(dir, ".git"),
|
|
32770
32770
|
oid,
|
|
32771
32771
|
ancestor,
|
|
32772
32772
|
depth = -1,
|
|
@@ -32795,7 +32795,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32795
32795
|
async function isIgnored({
|
|
32796
32796
|
fs: fs2,
|
|
32797
32797
|
dir,
|
|
32798
|
-
gitdir =
|
|
32798
|
+
gitdir = join13(dir, ".git"),
|
|
32799
32799
|
filepath
|
|
32800
32800
|
}) {
|
|
32801
32801
|
try {
|
|
@@ -32819,7 +32819,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32819
32819
|
async function listBranches({
|
|
32820
32820
|
fs: fs2,
|
|
32821
32821
|
dir,
|
|
32822
|
-
gitdir =
|
|
32822
|
+
gitdir = join13(dir, ".git"),
|
|
32823
32823
|
remote
|
|
32824
32824
|
}) {
|
|
32825
32825
|
try {
|
|
@@ -32876,17 +32876,17 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32876
32876
|
gitdir,
|
|
32877
32877
|
oid: entry.oid,
|
|
32878
32878
|
filenames,
|
|
32879
|
-
prefix:
|
|
32879
|
+
prefix: join13(prefix, entry.path)
|
|
32880
32880
|
});
|
|
32881
32881
|
} else {
|
|
32882
|
-
filenames.push(
|
|
32882
|
+
filenames.push(join13(prefix, entry.path));
|
|
32883
32883
|
}
|
|
32884
32884
|
}
|
|
32885
32885
|
}
|
|
32886
32886
|
async function listFiles2({
|
|
32887
32887
|
fs: fs2,
|
|
32888
32888
|
dir,
|
|
32889
|
-
gitdir =
|
|
32889
|
+
gitdir = join13(dir, ".git"),
|
|
32890
32890
|
ref,
|
|
32891
32891
|
cache = {}
|
|
32892
32892
|
}) {
|
|
@@ -32930,7 +32930,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32930
32930
|
async function listNotes({
|
|
32931
32931
|
fs: fs2,
|
|
32932
32932
|
dir,
|
|
32933
|
-
gitdir =
|
|
32933
|
+
gitdir = join13(dir, ".git"),
|
|
32934
32934
|
ref = "refs/notes/commits",
|
|
32935
32935
|
cache = {}
|
|
32936
32936
|
}) {
|
|
@@ -32954,7 +32954,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32954
32954
|
async function listRefs({
|
|
32955
32955
|
fs: fs2,
|
|
32956
32956
|
dir,
|
|
32957
|
-
gitdir =
|
|
32957
|
+
gitdir = join13(dir, ".git"),
|
|
32958
32958
|
filepath
|
|
32959
32959
|
}) {
|
|
32960
32960
|
try {
|
|
@@ -32979,7 +32979,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
32979
32979
|
);
|
|
32980
32980
|
return remotes;
|
|
32981
32981
|
}
|
|
32982
|
-
async function listRemotes({ fs: fs2, dir, gitdir =
|
|
32982
|
+
async function listRemotes({ fs: fs2, dir, gitdir = join13(dir, ".git") }) {
|
|
32983
32983
|
try {
|
|
32984
32984
|
assertParameter("fs", fs2);
|
|
32985
32985
|
assertParameter("gitdir", gitdir);
|
|
@@ -33078,7 +33078,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33078
33078
|
throw err;
|
|
33079
33079
|
}
|
|
33080
33080
|
}
|
|
33081
|
-
async function listTags({ fs: fs2, dir, gitdir =
|
|
33081
|
+
async function listTags({ fs: fs2, dir, gitdir = join13(dir, ".git") }) {
|
|
33082
33082
|
try {
|
|
33083
33083
|
assertParameter("fs", fs2);
|
|
33084
33084
|
assertParameter("gitdir", gitdir);
|
|
@@ -33131,7 +33131,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33131
33131
|
const walks = tree.entries().map(function(entry) {
|
|
33132
33132
|
let result;
|
|
33133
33133
|
if (entry.oid === fileId) {
|
|
33134
|
-
result =
|
|
33134
|
+
result = join13(parentPath, entry.path);
|
|
33135
33135
|
filepaths.push(result);
|
|
33136
33136
|
} else if (entry.type === "tree") {
|
|
33137
33137
|
result = _readObject({
|
|
@@ -33148,7 +33148,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33148
33148
|
fileId,
|
|
33149
33149
|
oid,
|
|
33150
33150
|
filepaths,
|
|
33151
|
-
parentPath:
|
|
33151
|
+
parentPath: join13(parentPath, entry.path)
|
|
33152
33152
|
});
|
|
33153
33153
|
});
|
|
33154
33154
|
}
|
|
@@ -33276,7 +33276,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33276
33276
|
async function log({
|
|
33277
33277
|
fs: fs2,
|
|
33278
33278
|
dir,
|
|
33279
|
-
gitdir =
|
|
33279
|
+
gitdir = join13(dir, ".git"),
|
|
33280
33280
|
filepath,
|
|
33281
33281
|
ref = "HEAD",
|
|
33282
33282
|
depth,
|
|
@@ -33312,7 +33312,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33312
33312
|
fs: _fs,
|
|
33313
33313
|
onSign,
|
|
33314
33314
|
dir,
|
|
33315
|
-
gitdir =
|
|
33315
|
+
gitdir = join13(dir, ".git"),
|
|
33316
33316
|
ours,
|
|
33317
33317
|
theirs,
|
|
33318
33318
|
fastForward: fastForward2 = true,
|
|
@@ -33389,7 +33389,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33389
33389
|
fs: fs2,
|
|
33390
33390
|
cache,
|
|
33391
33391
|
dir,
|
|
33392
|
-
gitdir =
|
|
33392
|
+
gitdir = join13(dir, ".git"),
|
|
33393
33393
|
oids
|
|
33394
33394
|
}) {
|
|
33395
33395
|
const hash = new Hash2();
|
|
@@ -33432,7 +33432,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33432
33432
|
const packfileSha = packfile.slice(-20).toString("hex");
|
|
33433
33433
|
const filename = `pack-${packfileSha}.pack`;
|
|
33434
33434
|
if (write) {
|
|
33435
|
-
await fs2.write(
|
|
33435
|
+
await fs2.write(join13(gitdir, `objects/pack/${filename}`), packfile);
|
|
33436
33436
|
return { filename };
|
|
33437
33437
|
}
|
|
33438
33438
|
return {
|
|
@@ -33443,7 +33443,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33443
33443
|
async function packObjects({
|
|
33444
33444
|
fs: fs2,
|
|
33445
33445
|
dir,
|
|
33446
|
-
gitdir =
|
|
33446
|
+
gitdir = join13(dir, ".git"),
|
|
33447
33447
|
oids,
|
|
33448
33448
|
write = false,
|
|
33449
33449
|
cache = {}
|
|
@@ -33475,7 +33475,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33475
33475
|
onAuthSuccess,
|
|
33476
33476
|
onAuthFailure,
|
|
33477
33477
|
dir,
|
|
33478
|
-
gitdir =
|
|
33478
|
+
gitdir = join13(dir, ".git"),
|
|
33479
33479
|
ref,
|
|
33480
33480
|
url,
|
|
33481
33481
|
remote,
|
|
@@ -33545,7 +33545,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33545
33545
|
fs: fs2,
|
|
33546
33546
|
cache,
|
|
33547
33547
|
dir,
|
|
33548
|
-
gitdir =
|
|
33548
|
+
gitdir = join13(dir, ".git"),
|
|
33549
33549
|
start,
|
|
33550
33550
|
finish
|
|
33551
33551
|
}) {
|
|
@@ -33593,7 +33593,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33593
33593
|
fs: fs2,
|
|
33594
33594
|
cache,
|
|
33595
33595
|
dir,
|
|
33596
|
-
gitdir =
|
|
33596
|
+
gitdir = join13(dir, ".git"),
|
|
33597
33597
|
oids
|
|
33598
33598
|
}) {
|
|
33599
33599
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -33888,7 +33888,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33888
33888
|
onAuthFailure,
|
|
33889
33889
|
onPrePush,
|
|
33890
33890
|
dir,
|
|
33891
|
-
gitdir =
|
|
33891
|
+
gitdir = join13(dir, ".git"),
|
|
33892
33892
|
ref,
|
|
33893
33893
|
remoteRef,
|
|
33894
33894
|
remote = "origin",
|
|
@@ -33962,7 +33962,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33962
33962
|
async function readBlob2({
|
|
33963
33963
|
fs: fs2,
|
|
33964
33964
|
dir,
|
|
33965
|
-
gitdir =
|
|
33965
|
+
gitdir = join13(dir, ".git"),
|
|
33966
33966
|
oid,
|
|
33967
33967
|
filepath,
|
|
33968
33968
|
cache = {}
|
|
@@ -33988,7 +33988,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
33988
33988
|
async function readCommit({
|
|
33989
33989
|
fs: fs2,
|
|
33990
33990
|
dir,
|
|
33991
|
-
gitdir =
|
|
33991
|
+
gitdir = join13(dir, ".git"),
|
|
33992
33992
|
oid,
|
|
33993
33993
|
cache = {}
|
|
33994
33994
|
}) {
|
|
@@ -34029,7 +34029,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34029
34029
|
async function readNote({
|
|
34030
34030
|
fs: fs2,
|
|
34031
34031
|
dir,
|
|
34032
|
-
gitdir =
|
|
34032
|
+
gitdir = join13(dir, ".git"),
|
|
34033
34033
|
ref = "refs/notes/commits",
|
|
34034
34034
|
oid,
|
|
34035
34035
|
cache = {}
|
|
@@ -34056,7 +34056,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34056
34056
|
async function readObject({
|
|
34057
34057
|
fs: _fs,
|
|
34058
34058
|
dir,
|
|
34059
|
-
gitdir =
|
|
34059
|
+
gitdir = join13(dir, ".git"),
|
|
34060
34060
|
oid,
|
|
34061
34061
|
format = "parsed",
|
|
34062
34062
|
filepath = void 0,
|
|
@@ -34145,7 +34145,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34145
34145
|
async function readTag({
|
|
34146
34146
|
fs: fs2,
|
|
34147
34147
|
dir,
|
|
34148
|
-
gitdir =
|
|
34148
|
+
gitdir = join13(dir, ".git"),
|
|
34149
34149
|
oid,
|
|
34150
34150
|
cache = {}
|
|
34151
34151
|
}) {
|
|
@@ -34169,7 +34169,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34169
34169
|
async function readTree({
|
|
34170
34170
|
fs: fs2,
|
|
34171
34171
|
dir,
|
|
34172
|
-
gitdir =
|
|
34172
|
+
gitdir = join13(dir, ".git"),
|
|
34173
34173
|
oid,
|
|
34174
34174
|
filepath = void 0,
|
|
34175
34175
|
cache = {}
|
|
@@ -34195,7 +34195,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34195
34195
|
async function remove({
|
|
34196
34196
|
fs: _fs,
|
|
34197
34197
|
dir,
|
|
34198
|
-
gitdir =
|
|
34198
|
+
gitdir = join13(dir, ".git"),
|
|
34199
34199
|
filepath,
|
|
34200
34200
|
cache = {}
|
|
34201
34201
|
}) {
|
|
@@ -34268,7 +34268,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34268
34268
|
fs: _fs,
|
|
34269
34269
|
onSign,
|
|
34270
34270
|
dir,
|
|
34271
|
-
gitdir =
|
|
34271
|
+
gitdir = join13(dir, ".git"),
|
|
34272
34272
|
ref = "refs/notes/commits",
|
|
34273
34273
|
oid,
|
|
34274
34274
|
author: _author,
|
|
@@ -34356,7 +34356,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34356
34356
|
async function renameBranch({
|
|
34357
34357
|
fs: fs2,
|
|
34358
34358
|
dir,
|
|
34359
|
-
gitdir =
|
|
34359
|
+
gitdir = join13(dir, ".git"),
|
|
34360
34360
|
ref,
|
|
34361
34361
|
oldref,
|
|
34362
34362
|
checkout: checkout2 = false
|
|
@@ -34386,7 +34386,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34386
34386
|
async function resetIndex({
|
|
34387
34387
|
fs: _fs,
|
|
34388
34388
|
dir,
|
|
34389
|
-
gitdir =
|
|
34389
|
+
gitdir = join13(dir, ".git"),
|
|
34390
34390
|
filepath,
|
|
34391
34391
|
ref,
|
|
34392
34392
|
cache = {}
|
|
@@ -34433,7 +34433,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34433
34433
|
gid: 0,
|
|
34434
34434
|
size: 0
|
|
34435
34435
|
};
|
|
34436
|
-
const object = dir && await fs2.read(
|
|
34436
|
+
const object = dir && await fs2.read(join13(dir, filepath));
|
|
34437
34437
|
if (object) {
|
|
34438
34438
|
workdirOid = await hashObject$1({
|
|
34439
34439
|
gitdir: updatedGitdir,
|
|
@@ -34441,7 +34441,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34441
34441
|
object
|
|
34442
34442
|
});
|
|
34443
34443
|
if (oid === workdirOid) {
|
|
34444
|
-
stats = await fs2.lstat(
|
|
34444
|
+
stats = await fs2.lstat(join13(dir, filepath));
|
|
34445
34445
|
}
|
|
34446
34446
|
}
|
|
34447
34447
|
await GitIndexManager.acquire(
|
|
@@ -34461,7 +34461,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34461
34461
|
async function resolveRef2({
|
|
34462
34462
|
fs: fs2,
|
|
34463
34463
|
dir,
|
|
34464
|
-
gitdir =
|
|
34464
|
+
gitdir = join13(dir, ".git"),
|
|
34465
34465
|
ref,
|
|
34466
34466
|
depth
|
|
34467
34467
|
}) {
|
|
@@ -34486,7 +34486,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34486
34486
|
async function setConfig({
|
|
34487
34487
|
fs: _fs,
|
|
34488
34488
|
dir,
|
|
34489
|
-
gitdir =
|
|
34489
|
+
gitdir = join13(dir, ".git"),
|
|
34490
34490
|
path,
|
|
34491
34491
|
value,
|
|
34492
34492
|
append = false
|
|
@@ -34554,7 +34554,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34554
34554
|
* @param {string} args.dir - The working directory.
|
|
34555
34555
|
* @param {string}[args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
34556
34556
|
*/
|
|
34557
|
-
constructor({ fs: fs2, dir, gitdir =
|
|
34557
|
+
constructor({ fs: fs2, dir, gitdir = join13(dir, ".git") }) {
|
|
34558
34558
|
Object.assign(this, {
|
|
34559
34559
|
fs: fs2,
|
|
34560
34560
|
dir,
|
|
@@ -34584,7 +34584,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34584
34584
|
* @returns {string} - The file path for the stash reference.
|
|
34585
34585
|
*/
|
|
34586
34586
|
get refStashPath() {
|
|
34587
|
-
return
|
|
34587
|
+
return join13(this.gitdir, _GitStashManager.refStash);
|
|
34588
34588
|
}
|
|
34589
34589
|
/**
|
|
34590
34590
|
* Gets the file path for the stash reflogs.
|
|
@@ -34592,7 +34592,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34592
34592
|
* @returns {string} - The file path for the stash reflogs.
|
|
34593
34593
|
*/
|
|
34594
34594
|
get refLogsStashPath() {
|
|
34595
|
-
return
|
|
34595
|
+
return join13(this.gitdir, _GitStashManager.refLogsStash);
|
|
34596
34596
|
}
|
|
34597
34597
|
/**
|
|
34598
34598
|
* Retrieves the author information for the stash.
|
|
@@ -34898,7 +34898,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34898
34898
|
async function stash({
|
|
34899
34899
|
fs: fs2,
|
|
34900
34900
|
dir,
|
|
34901
|
-
gitdir =
|
|
34901
|
+
gitdir = join13(dir, ".git"),
|
|
34902
34902
|
op = "push",
|
|
34903
34903
|
message = "",
|
|
34904
34904
|
refIdx = 0
|
|
@@ -34921,7 +34921,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34921
34921
|
const _fs = new FileSystem(fs2);
|
|
34922
34922
|
const updatedGitdir = await discoverGitdir({ fsp: _fs, dotgit: gitdir });
|
|
34923
34923
|
const folders = ["refs", "logs", "logs/refs"];
|
|
34924
|
-
folders.map((f) =>
|
|
34924
|
+
folders.map((f) => join13(updatedGitdir, f)).forEach(async (folder) => {
|
|
34925
34925
|
if (!await _fs.exists(folder)) {
|
|
34926
34926
|
await _fs.mkdir(folder);
|
|
34927
34927
|
}
|
|
@@ -34951,7 +34951,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34951
34951
|
async function status({
|
|
34952
34952
|
fs: _fs,
|
|
34953
34953
|
dir,
|
|
34954
|
-
gitdir =
|
|
34954
|
+
gitdir = join13(dir, ".git"),
|
|
34955
34955
|
filepath,
|
|
34956
34956
|
cache = {}
|
|
34957
34957
|
}) {
|
|
@@ -34987,7 +34987,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34987
34987
|
return null;
|
|
34988
34988
|
}
|
|
34989
34989
|
);
|
|
34990
|
-
const stats = await fs2.lstat(
|
|
34990
|
+
const stats = await fs2.lstat(join13(dir, filepath));
|
|
34991
34991
|
const H = treeOid !== null;
|
|
34992
34992
|
const I = indexEntry !== null;
|
|
34993
34993
|
const W = stats !== null;
|
|
@@ -34995,7 +34995,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
34995
34995
|
if (I && !compareStats(indexEntry, stats)) {
|
|
34996
34996
|
return indexEntry.oid;
|
|
34997
34997
|
} else {
|
|
34998
|
-
const object = await fs2.read(
|
|
34998
|
+
const object = await fs2.read(join13(dir, filepath));
|
|
34999
34999
|
const workdirOid = await hashObject$1({
|
|
35000
35000
|
gitdir: updatedGitdir,
|
|
35001
35001
|
type: "blob",
|
|
@@ -35044,9 +35044,9 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35044
35044
|
}
|
|
35045
35045
|
async function getOidAtPath({ fs: fs2, cache, gitdir: updatedGitdir, tree, path }) {
|
|
35046
35046
|
if (typeof path === "string") path = path.split("/");
|
|
35047
|
-
const
|
|
35047
|
+
const dirname12 = path.shift();
|
|
35048
35048
|
for (const entry of tree) {
|
|
35049
|
-
if (entry.path ===
|
|
35049
|
+
if (entry.path === dirname12) {
|
|
35050
35050
|
if (path.length === 0) {
|
|
35051
35051
|
return entry.oid;
|
|
35052
35052
|
}
|
|
@@ -35086,7 +35086,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35086
35086
|
async function statusMatrix({
|
|
35087
35087
|
fs: _fs,
|
|
35088
35088
|
dir,
|
|
35089
|
-
gitdir =
|
|
35089
|
+
gitdir = join13(dir, ".git"),
|
|
35090
35090
|
ref = "HEAD",
|
|
35091
35091
|
filepaths = ["."],
|
|
35092
35092
|
filter: filter2,
|
|
@@ -35158,7 +35158,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35158
35158
|
async function tag({
|
|
35159
35159
|
fs: _fs,
|
|
35160
35160
|
dir,
|
|
35161
|
-
gitdir =
|
|
35161
|
+
gitdir = join13(dir, ".git"),
|
|
35162
35162
|
ref,
|
|
35163
35163
|
object,
|
|
35164
35164
|
force = false
|
|
@@ -35190,7 +35190,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35190
35190
|
async function updateIndex$1({
|
|
35191
35191
|
fs: _fs,
|
|
35192
35192
|
dir,
|
|
35193
|
-
gitdir =
|
|
35193
|
+
gitdir = join13(dir, ".git"),
|
|
35194
35194
|
cache = {},
|
|
35195
35195
|
filepath,
|
|
35196
35196
|
oid,
|
|
@@ -35210,7 +35210,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35210
35210
|
{ fs: fs2, gitdir: updatedGitdir, cache },
|
|
35211
35211
|
async function(index2) {
|
|
35212
35212
|
if (!force) {
|
|
35213
|
-
const fileStats2 = await fs2.lstat(
|
|
35213
|
+
const fileStats2 = await fs2.lstat(join13(dir, filepath));
|
|
35214
35214
|
if (fileStats2) {
|
|
35215
35215
|
if (fileStats2.isDirectory()) {
|
|
35216
35216
|
throw new InvalidFilepathError("directory");
|
|
@@ -35228,7 +35228,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35228
35228
|
}
|
|
35229
35229
|
let fileStats;
|
|
35230
35230
|
if (!oid) {
|
|
35231
|
-
fileStats = await fs2.lstat(
|
|
35231
|
+
fileStats = await fs2.lstat(join13(dir, filepath));
|
|
35232
35232
|
if (!fileStats) {
|
|
35233
35233
|
throw new NotFoundError(
|
|
35234
35234
|
`file at "${filepath}" on disk and "remove" not set`
|
|
@@ -35249,7 +35249,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35249
35249
|
let stats;
|
|
35250
35250
|
if (!oid) {
|
|
35251
35251
|
stats = fileStats;
|
|
35252
|
-
const object = stats.isSymbolicLink() ? await fs2.readlink(
|
|
35252
|
+
const object = stats.isSymbolicLink() ? await fs2.readlink(join13(dir, filepath)) : await fs2.read(join13(dir, filepath));
|
|
35253
35253
|
oid = await _writeObject({
|
|
35254
35254
|
fs: fs2,
|
|
35255
35255
|
gitdir: updatedGitdir,
|
|
@@ -35293,7 +35293,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35293
35293
|
async function walk({
|
|
35294
35294
|
fs: fs2,
|
|
35295
35295
|
dir,
|
|
35296
|
-
gitdir =
|
|
35296
|
+
gitdir = join13(dir, ".git"),
|
|
35297
35297
|
trees,
|
|
35298
35298
|
map: map2,
|
|
35299
35299
|
reduce: reduce2,
|
|
@@ -35321,7 +35321,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35321
35321
|
throw err;
|
|
35322
35322
|
}
|
|
35323
35323
|
}
|
|
35324
|
-
async function writeBlob({ fs: fs2, dir, gitdir =
|
|
35324
|
+
async function writeBlob({ fs: fs2, dir, gitdir = join13(dir, ".git"), blob }) {
|
|
35325
35325
|
try {
|
|
35326
35326
|
assertParameter("fs", fs2);
|
|
35327
35327
|
assertParameter("gitdir", gitdir);
|
|
@@ -35343,7 +35343,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35343
35343
|
async function writeCommit({
|
|
35344
35344
|
fs: fs2,
|
|
35345
35345
|
dir,
|
|
35346
|
-
gitdir =
|
|
35346
|
+
gitdir = join13(dir, ".git"),
|
|
35347
35347
|
commit: commit2
|
|
35348
35348
|
}) {
|
|
35349
35349
|
try {
|
|
@@ -35365,7 +35365,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35365
35365
|
async function writeObject({
|
|
35366
35366
|
fs: _fs,
|
|
35367
35367
|
dir,
|
|
35368
|
-
gitdir =
|
|
35368
|
+
gitdir = join13(dir, ".git"),
|
|
35369
35369
|
type,
|
|
35370
35370
|
object,
|
|
35371
35371
|
format = "parsed",
|
|
@@ -35411,7 +35411,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35411
35411
|
async function writeRef({
|
|
35412
35412
|
fs: _fs,
|
|
35413
35413
|
dir,
|
|
35414
|
-
gitdir =
|
|
35414
|
+
gitdir = join13(dir, ".git"),
|
|
35415
35415
|
ref,
|
|
35416
35416
|
value,
|
|
35417
35417
|
force = false,
|
|
@@ -35466,7 +35466,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35466
35466
|
});
|
|
35467
35467
|
return oid;
|
|
35468
35468
|
}
|
|
35469
|
-
async function writeTag({ fs: fs2, dir, gitdir =
|
|
35469
|
+
async function writeTag({ fs: fs2, dir, gitdir = join13(dir, ".git"), tag: tag2 }) {
|
|
35470
35470
|
try {
|
|
35471
35471
|
assertParameter("fs", fs2);
|
|
35472
35472
|
assertParameter("gitdir", gitdir);
|
|
@@ -35483,7 +35483,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
35483
35483
|
throw err;
|
|
35484
35484
|
}
|
|
35485
35485
|
}
|
|
35486
|
-
async function writeTree({ fs: fs2, dir, gitdir =
|
|
35486
|
+
async function writeTree({ fs: fs2, dir, gitdir = join13(dir, ".git"), tree }) {
|
|
35487
35487
|
try {
|
|
35488
35488
|
assertParameter("fs", fs2);
|
|
35489
35489
|
assertParameter("gitdir", gitdir);
|
|
@@ -35698,7 +35698,7 @@ var ManifestScaffolder = class {
|
|
|
35698
35698
|
|
|
35699
35699
|
// ../core/dist/manifest/manifest-updater.js
|
|
35700
35700
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
35701
|
-
import { readFileSync, writeFileSync as writeFileSync2, existsSync, readdirSync } from "node:fs";
|
|
35701
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync, readdirSync } from "node:fs";
|
|
35702
35702
|
import { join as join2, relative } from "node:path";
|
|
35703
35703
|
var ManifestUpdater = class {
|
|
35704
35704
|
/**
|
|
@@ -35710,7 +35710,7 @@ var ManifestUpdater = class {
|
|
|
35710
35710
|
if (!existsSync(manifestPath)) {
|
|
35711
35711
|
return { updated: false, contextsAdded: 0, flowsAdded: 0 };
|
|
35712
35712
|
}
|
|
35713
|
-
const content =
|
|
35713
|
+
const content = readFileSync2(manifestPath, "utf-8");
|
|
35714
35714
|
const manifest = (0, import_yaml2.parse)(content);
|
|
35715
35715
|
const existingContexts = this.extractFileRefs(manifest.contexts);
|
|
35716
35716
|
const existingFlows = this.extractFileRefs(manifest.flows);
|
|
@@ -35746,7 +35746,7 @@ var ManifestUpdater = class {
|
|
|
35746
35746
|
if (!existsSync(manifestPath)) {
|
|
35747
35747
|
return { updated: false, contextsAdded: 0, flowsAdded: 0 };
|
|
35748
35748
|
}
|
|
35749
|
-
const content =
|
|
35749
|
+
const content = readFileSync2(manifestPath, "utf-8");
|
|
35750
35750
|
const manifest = (0, import_yaml2.parse)(content);
|
|
35751
35751
|
const existingContexts = this.extractFileRefs(manifest.contexts);
|
|
35752
35752
|
const existingFlows = this.extractFileRefs(manifest.flows);
|
|
@@ -48481,8 +48481,8 @@ function repetitionSep(atn, rule, repetition2) {
|
|
|
48481
48481
|
});
|
|
48482
48482
|
defineDecisionState(atn, starState);
|
|
48483
48483
|
const handle = makeAlts(atn, rule, starState, repetition2, block(atn, rule, repetition2));
|
|
48484
|
-
const
|
|
48485
|
-
return star(atn, rule, repetition2, handle,
|
|
48484
|
+
const sep3 = tokenRef(atn, rule, repetition2.separator, repetition2);
|
|
48485
|
+
return star(atn, rule, repetition2, handle, sep3);
|
|
48486
48486
|
}
|
|
48487
48487
|
function repetitionMandatory(atn, rule, repetition2) {
|
|
48488
48488
|
const plusState = newState(atn, rule, repetition2, {
|
|
@@ -48498,8 +48498,8 @@ function repetitionMandatorySep(atn, rule, repetition2) {
|
|
|
48498
48498
|
});
|
|
48499
48499
|
defineDecisionState(atn, plusState);
|
|
48500
48500
|
const handle = makeAlts(atn, rule, plusState, repetition2, block(atn, rule, repetition2));
|
|
48501
|
-
const
|
|
48502
|
-
return plus(atn, rule, repetition2, handle,
|
|
48501
|
+
const sep3 = tokenRef(atn, rule, repetition2.separator, repetition2);
|
|
48502
|
+
return plus(atn, rule, repetition2, handle, sep3);
|
|
48503
48503
|
}
|
|
48504
48504
|
function alternation(atn, rule, alternation2) {
|
|
48505
48505
|
const start = newState(atn, rule, alternation2, {
|
|
@@ -48528,7 +48528,7 @@ function block(atn, rule, block2) {
|
|
|
48528
48528
|
return makeBlock(atn, handles);
|
|
48529
48529
|
}
|
|
48530
48530
|
}
|
|
48531
|
-
function plus(atn, rule, plus2, handle,
|
|
48531
|
+
function plus(atn, rule, plus2, handle, sep3) {
|
|
48532
48532
|
const blkStart = handle.left;
|
|
48533
48533
|
const blkEnd = handle.right;
|
|
48534
48534
|
const loop = newState(atn, rule, plus2, {
|
|
@@ -48540,22 +48540,22 @@ function plus(atn, rule, plus2, handle, sep2) {
|
|
|
48540
48540
|
});
|
|
48541
48541
|
blkStart.loopback = loop;
|
|
48542
48542
|
end.loopback = loop;
|
|
48543
|
-
atn.decisionMap[buildATNKey(rule,
|
|
48543
|
+
atn.decisionMap[buildATNKey(rule, sep3 ? "RepetitionMandatoryWithSeparator" : "RepetitionMandatory", plus2.idx)] = loop;
|
|
48544
48544
|
epsilon(blkEnd, loop);
|
|
48545
|
-
if (
|
|
48545
|
+
if (sep3 === void 0) {
|
|
48546
48546
|
epsilon(loop, blkStart);
|
|
48547
48547
|
epsilon(loop, end);
|
|
48548
48548
|
} else {
|
|
48549
48549
|
epsilon(loop, end);
|
|
48550
|
-
epsilon(loop,
|
|
48551
|
-
epsilon(
|
|
48550
|
+
epsilon(loop, sep3.left);
|
|
48551
|
+
epsilon(sep3.right, blkStart);
|
|
48552
48552
|
}
|
|
48553
48553
|
return {
|
|
48554
48554
|
left: blkStart,
|
|
48555
48555
|
right: end
|
|
48556
48556
|
};
|
|
48557
48557
|
}
|
|
48558
|
-
function star(atn, rule, star2, handle,
|
|
48558
|
+
function star(atn, rule, star2, handle, sep3) {
|
|
48559
48559
|
const start = handle.left;
|
|
48560
48560
|
const end = handle.right;
|
|
48561
48561
|
const entry = newState(atn, rule, star2, {
|
|
@@ -48573,14 +48573,14 @@ function star(atn, rule, star2, handle, sep2) {
|
|
|
48573
48573
|
epsilon(entry, start);
|
|
48574
48574
|
epsilon(entry, loopEnd);
|
|
48575
48575
|
epsilon(end, loop);
|
|
48576
|
-
if (
|
|
48576
|
+
if (sep3 !== void 0) {
|
|
48577
48577
|
epsilon(loop, loopEnd);
|
|
48578
|
-
epsilon(loop,
|
|
48579
|
-
epsilon(
|
|
48578
|
+
epsilon(loop, sep3.left);
|
|
48579
|
+
epsilon(sep3.right, start);
|
|
48580
48580
|
} else {
|
|
48581
48581
|
epsilon(loop, entry);
|
|
48582
48582
|
}
|
|
48583
|
-
atn.decisionMap[buildATNKey(rule,
|
|
48583
|
+
atn.decisionMap[buildATNKey(rule, sep3 ? "RepetitionWithSeparator" : "Repetition", star2.idx)] = entry;
|
|
48584
48584
|
return {
|
|
48585
48585
|
left: entry,
|
|
48586
48586
|
right: loopEnd
|
|
@@ -51882,11 +51882,11 @@ __reExport(cancellation_exports, __toESM(require_cancellation(), 1));
|
|
|
51882
51882
|
|
|
51883
51883
|
// ../../node_modules/.pnpm/langium@4.2.1/node_modules/langium/lib/utils/promise-utils.js
|
|
51884
51884
|
function delayNextTick() {
|
|
51885
|
-
return new Promise((
|
|
51885
|
+
return new Promise((resolve24) => {
|
|
51886
51886
|
if (typeof setImmediate === "undefined") {
|
|
51887
|
-
setTimeout(
|
|
51887
|
+
setTimeout(resolve24, 0);
|
|
51888
51888
|
} else {
|
|
51889
|
-
setImmediate(
|
|
51889
|
+
setImmediate(resolve24);
|
|
51890
51890
|
}
|
|
51891
51891
|
});
|
|
51892
51892
|
}
|
|
@@ -51919,9 +51919,9 @@ async function interruptAndCheck(token) {
|
|
|
51919
51919
|
}
|
|
51920
51920
|
var Deferred = class {
|
|
51921
51921
|
constructor() {
|
|
51922
|
-
this.promise = new Promise((
|
|
51922
|
+
this.promise = new Promise((resolve24, reject2) => {
|
|
51923
51923
|
this.resolve = (arg) => {
|
|
51924
|
-
|
|
51924
|
+
resolve24(arg);
|
|
51925
51925
|
return this;
|
|
51926
51926
|
};
|
|
51927
51927
|
this.reject = (err) => {
|
|
@@ -55065,12 +55065,12 @@ var DefaultDocumentBuilder = class {
|
|
|
55065
55065
|
} else if (this.currentState >= state && state > document2.state) {
|
|
55066
55066
|
return Promise.reject(new import_vscode_languageserver_protocol.ResponseError(import_vscode_languageserver_protocol.LSPErrorCodes.RequestFailed, `Document state of ${uri.toString()} is ${DocumentState[document2.state]}, requiring ${DocumentState[state]}, but workspace state is already ${DocumentState[this.currentState]}. Returning undefined.`));
|
|
55067
55067
|
}
|
|
55068
|
-
return new Promise((
|
|
55068
|
+
return new Promise((resolve24, reject2) => {
|
|
55069
55069
|
const buildDisposable = this.onDocumentPhase(state, (doc) => {
|
|
55070
55070
|
if (UriUtils.equals(doc.uri, uri)) {
|
|
55071
55071
|
buildDisposable.dispose();
|
|
55072
55072
|
cancelDisposable.dispose();
|
|
55073
|
-
|
|
55073
|
+
resolve24(doc.uri);
|
|
55074
55074
|
}
|
|
55075
55075
|
});
|
|
55076
55076
|
const cancelDisposable = cancelToken.onCancellationRequested(() => {
|
|
@@ -55086,11 +55086,11 @@ var DefaultDocumentBuilder = class {
|
|
|
55086
55086
|
} else if (cancelToken.isCancellationRequested) {
|
|
55087
55087
|
return Promise.reject(OperationCancelled);
|
|
55088
55088
|
}
|
|
55089
|
-
return new Promise((
|
|
55089
|
+
return new Promise((resolve24, reject2) => {
|
|
55090
55090
|
const buildDisposable = this.onBuildPhase(state, () => {
|
|
55091
55091
|
buildDisposable.dispose();
|
|
55092
55092
|
cancelDisposable.dispose();
|
|
55093
|
-
|
|
55093
|
+
resolve24();
|
|
55094
55094
|
});
|
|
55095
55095
|
const cancelDisposable = cancelToken.onCancellationRequested(() => {
|
|
55096
55096
|
buildDisposable.dispose();
|
|
@@ -61376,9 +61376,9 @@ var NodeFsHandler = class {
|
|
|
61376
61376
|
if (this.fsw.closed) {
|
|
61377
61377
|
return;
|
|
61378
61378
|
}
|
|
61379
|
-
const
|
|
61379
|
+
const dirname11 = sp.dirname(file);
|
|
61380
61380
|
const basename4 = sp.basename(file);
|
|
61381
|
-
const parent = this.fsw._getWatchedDir(
|
|
61381
|
+
const parent = this.fsw._getWatchedDir(dirname11);
|
|
61382
61382
|
let prevStats = stats;
|
|
61383
61383
|
if (parent.has(basename4))
|
|
61384
61384
|
return;
|
|
@@ -61405,7 +61405,7 @@ var NodeFsHandler = class {
|
|
|
61405
61405
|
prevStats = newStats2;
|
|
61406
61406
|
}
|
|
61407
61407
|
} catch (error) {
|
|
61408
|
-
this.fsw._remove(
|
|
61408
|
+
this.fsw._remove(dirname11, basename4);
|
|
61409
61409
|
}
|
|
61410
61410
|
} else if (parent.has(basename4)) {
|
|
61411
61411
|
const at = newStats.atimeMs;
|
|
@@ -61502,7 +61502,7 @@ var NodeFsHandler = class {
|
|
|
61502
61502
|
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
|
61503
61503
|
}
|
|
61504
61504
|
}).on(EV.ERROR, this._boundHandleError);
|
|
61505
|
-
return new Promise((
|
|
61505
|
+
return new Promise((resolve24, reject2) => {
|
|
61506
61506
|
if (!stream2)
|
|
61507
61507
|
return reject2();
|
|
61508
61508
|
stream2.once(STR_END, () => {
|
|
@@ -61511,7 +61511,7 @@ var NodeFsHandler = class {
|
|
|
61511
61511
|
return;
|
|
61512
61512
|
}
|
|
61513
61513
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
61514
|
-
|
|
61514
|
+
resolve24(void 0);
|
|
61515
61515
|
previous.getChildren().filter((item) => {
|
|
61516
61516
|
return item !== directory && !current.has(item);
|
|
61517
61517
|
}).forEach((item) => {
|
|
@@ -62412,14 +62412,14 @@ var FileWatcher = class {
|
|
|
62412
62412
|
};
|
|
62413
62413
|
|
|
62414
62414
|
// ../core/dist/policies/regenerate-on-moment-file-changed.js
|
|
62415
|
-
import { readFileSync as
|
|
62415
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
62416
62416
|
var RegenerateOnMomentFileChanged = class {
|
|
62417
62417
|
parser;
|
|
62418
62418
|
constructor(parser) {
|
|
62419
62419
|
this.parser = parser ?? new MomentParser();
|
|
62420
62420
|
}
|
|
62421
62421
|
async onFileChanged(filePath) {
|
|
62422
|
-
const content =
|
|
62422
|
+
const content = readFileSync3(filePath, "utf-8");
|
|
62423
62423
|
const parseResult = await this.parser.parseContent(content);
|
|
62424
62424
|
return { filePath, parseResult };
|
|
62425
62425
|
}
|
|
@@ -62570,7 +62570,7 @@ function runInit(argv) {
|
|
|
62570
62570
|
}
|
|
62571
62571
|
|
|
62572
62572
|
// src/commands/parse.ts
|
|
62573
|
-
import { readFileSync as
|
|
62573
|
+
import { readFileSync as readFileSync4, existsSync as existsSync3 } from "node:fs";
|
|
62574
62574
|
import { resolve as resolve6 } from "node:path";
|
|
62575
62575
|
|
|
62576
62576
|
// src/commands/project-fs.ts
|
|
@@ -62642,7 +62642,7 @@ function formatDiagnostic(d, fallbackFile) {
|
|
|
62642
62642
|
}
|
|
62643
62643
|
function readFile(path) {
|
|
62644
62644
|
try {
|
|
62645
|
-
return
|
|
62645
|
+
return readFileSync4(path, "utf-8");
|
|
62646
62646
|
} catch (err) {
|
|
62647
62647
|
const msg = err instanceof Error ? err.message : String(err);
|
|
62648
62648
|
return fail(`Error: Failed to read ${path}: ${msg}`);
|
|
@@ -62729,8 +62729,8 @@ function runWatch(argv, log = console.log, logError = console.error) {
|
|
|
62729
62729
|
}
|
|
62730
62730
|
|
|
62731
62731
|
// src/commands/serve.ts
|
|
62732
|
-
import { readFileSync as
|
|
62733
|
-
import { resolve as resolve8 } from "node:path";
|
|
62732
|
+
import { readFileSync as readFileSync5, existsSync as existsSync4, statSync, watch as watch2 } from "node:fs";
|
|
62733
|
+
import { resolve as resolve8, join as join6, sep as sep2 } from "node:path";
|
|
62734
62734
|
import { parseArgs as parseArgs3 } from "node:util";
|
|
62735
62735
|
import { randomUUID } from "node:crypto";
|
|
62736
62736
|
|
|
@@ -63927,7 +63927,7 @@ function collectContextIds2(flow) {
|
|
|
63927
63927
|
|
|
63928
63928
|
// src/commands/serve.ts
|
|
63929
63929
|
async function runPipeline(specPath, includeAll) {
|
|
63930
|
-
const content =
|
|
63930
|
+
const content = readFileSync5(specPath, "utf-8");
|
|
63931
63931
|
const parser = new MomentParser();
|
|
63932
63932
|
const result = await parser.parseContent(content);
|
|
63933
63933
|
if (!result.success) {
|
|
@@ -63981,6 +63981,134 @@ function buildPayloads(ir, includeAll) {
|
|
|
63981
63981
|
function kebab(s) {
|
|
63982
63982
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
63983
63983
|
}
|
|
63984
|
+
function readJson(path) {
|
|
63985
|
+
return JSON.parse(readFileSync5(path, "utf-8"));
|
|
63986
|
+
}
|
|
63987
|
+
function loadFacetManifest(dir) {
|
|
63988
|
+
const manifestPath = join6(dir, "manifest.json");
|
|
63989
|
+
if (!existsSync4(manifestPath)) {
|
|
63990
|
+
throw new Error(
|
|
63991
|
+
`Facet directory is missing manifest.json at ${manifestPath}. Run \`moment simulate <spec.moment> --out-dir ${dir} --all\` to populate it.`
|
|
63992
|
+
);
|
|
63993
|
+
}
|
|
63994
|
+
const raw = readJson(manifestPath);
|
|
63995
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
63996
|
+
throw new Error(`${manifestPath}: expected a JSON object at the root`);
|
|
63997
|
+
}
|
|
63998
|
+
const obj = raw;
|
|
63999
|
+
if (!Array.isArray(obj.flows)) {
|
|
64000
|
+
throw new Error(`${manifestPath}: expected a 'flows' array`);
|
|
64001
|
+
}
|
|
64002
|
+
if (!obj.artifacts || typeof obj.artifacts !== "object" || Array.isArray(obj.artifacts)) {
|
|
64003
|
+
throw new Error(`${manifestPath}: expected an 'artifacts' object`);
|
|
64004
|
+
}
|
|
64005
|
+
return {
|
|
64006
|
+
flows: obj.flows,
|
|
64007
|
+
artifacts: obj.artifacts
|
|
64008
|
+
};
|
|
64009
|
+
}
|
|
64010
|
+
function loadArtifact(dir, filename) {
|
|
64011
|
+
if (!filename) return null;
|
|
64012
|
+
let fullPath;
|
|
64013
|
+
try {
|
|
64014
|
+
fullPath = resolveWithinFacetDir(dir, filename);
|
|
64015
|
+
} catch (err) {
|
|
64016
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
64017
|
+
console.error(`[serve] refusing to load artifact ${filename}: ${msg}`);
|
|
64018
|
+
return null;
|
|
64019
|
+
}
|
|
64020
|
+
if (!existsSync4(fullPath)) return null;
|
|
64021
|
+
try {
|
|
64022
|
+
return readJson(fullPath);
|
|
64023
|
+
} catch (err) {
|
|
64024
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
64025
|
+
console.error(`[serve] skipping artifact ${filename}: ${msg}`);
|
|
64026
|
+
return null;
|
|
64027
|
+
}
|
|
64028
|
+
}
|
|
64029
|
+
function shouldIncludeScenario(scenario, includeAll) {
|
|
64030
|
+
if (includeAll) return true;
|
|
64031
|
+
return scenario.isHappyPath === true;
|
|
64032
|
+
}
|
|
64033
|
+
function resolveWithinFacetDir(dir, relative4) {
|
|
64034
|
+
const resolvedBase = resolve8(dir);
|
|
64035
|
+
const resolvedTarget = resolve8(resolvedBase, relative4);
|
|
64036
|
+
const baseWithSep = resolvedBase.endsWith(sep2) ? resolvedBase : resolvedBase + sep2;
|
|
64037
|
+
if (resolvedTarget !== resolvedBase && !resolvedTarget.startsWith(baseWithSep)) {
|
|
64038
|
+
throw new Error(
|
|
64039
|
+
`Facet manifest references '${relative4}' which escapes the facet directory ${dir}`
|
|
64040
|
+
);
|
|
64041
|
+
}
|
|
64042
|
+
return resolvedTarget;
|
|
64043
|
+
}
|
|
64044
|
+
function readRequiredJson(fullPath, manifestEntry) {
|
|
64045
|
+
if (!existsSync4(fullPath)) {
|
|
64046
|
+
throw new Error(`Facet manifest references '${manifestEntry}' that does not exist`);
|
|
64047
|
+
}
|
|
64048
|
+
try {
|
|
64049
|
+
return readJson(fullPath);
|
|
64050
|
+
} catch (err) {
|
|
64051
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
64052
|
+
throw new Error(`Facet file '${manifestEntry}' is not valid JSON: ${msg}`);
|
|
64053
|
+
}
|
|
64054
|
+
}
|
|
64055
|
+
function normalizeArtifactFilenames(raw) {
|
|
64056
|
+
return {
|
|
64057
|
+
eventCatalog: raw.eventCatalog ?? "event-catalog.json",
|
|
64058
|
+
impactAnalysis: raw.impactAnalysis ?? "impact-analysis.json",
|
|
64059
|
+
sagaStateMachines: raw.sagaStateMachines ?? "saga-state-machines.json"
|
|
64060
|
+
};
|
|
64061
|
+
}
|
|
64062
|
+
function loadFlowAssets(dir, flow, includeAll, topologies, scenarios) {
|
|
64063
|
+
const topologyPath = resolveWithinFacetDir(dir, flow.topology);
|
|
64064
|
+
topologies[flow.topology] = readRequiredJson(topologyPath, flow.topology);
|
|
64065
|
+
const selected = flow.scenarios.filter((s) => shouldIncludeScenario(s, includeAll));
|
|
64066
|
+
for (const scenarioEntry of selected) {
|
|
64067
|
+
const scenarioPath = resolveWithinFacetDir(dir, scenarioEntry.file);
|
|
64068
|
+
scenarios[scenarioEntry.file] = readRequiredJson(
|
|
64069
|
+
scenarioPath,
|
|
64070
|
+
scenarioEntry.file
|
|
64071
|
+
);
|
|
64072
|
+
}
|
|
64073
|
+
return selected.length;
|
|
64074
|
+
}
|
|
64075
|
+
function runFacetDirPipeline(dir, includeAll) {
|
|
64076
|
+
const facetManifest = loadFacetManifest(dir);
|
|
64077
|
+
const topologies = {};
|
|
64078
|
+
const scenarios = {};
|
|
64079
|
+
const manifestFlows = [];
|
|
64080
|
+
for (const flow of facetManifest.flows) {
|
|
64081
|
+
const scenarioCount = loadFlowAssets(dir, flow, includeAll, topologies, scenarios);
|
|
64082
|
+
manifestFlows.push({
|
|
64083
|
+
flowId: flow.flowId,
|
|
64084
|
+
flowName: flow.flowName,
|
|
64085
|
+
topology: flow.topology,
|
|
64086
|
+
scenarioCount
|
|
64087
|
+
});
|
|
64088
|
+
}
|
|
64089
|
+
const artifactNames = normalizeArtifactFilenames(facetManifest.artifacts);
|
|
64090
|
+
return {
|
|
64091
|
+
// No IR in facet-dir mode — downstream pushUpdates/connection handlers
|
|
64092
|
+
// only touch manifest/topologies/scenarios/artifacts, never `ir`.
|
|
64093
|
+
ir: {
|
|
64094
|
+
metadata: { name: "", description: "" },
|
|
64095
|
+
contexts: [],
|
|
64096
|
+
flows: [],
|
|
64097
|
+
relationships: []
|
|
64098
|
+
},
|
|
64099
|
+
manifest: {
|
|
64100
|
+
flows: manifestFlows,
|
|
64101
|
+
artifacts: artifactNames
|
|
64102
|
+
},
|
|
64103
|
+
topologies,
|
|
64104
|
+
scenarios,
|
|
64105
|
+
artifacts: {
|
|
64106
|
+
eventCatalog: loadArtifact(dir, artifactNames.eventCatalog),
|
|
64107
|
+
impactAnalysis: loadArtifact(dir, artifactNames.impactAnalysis),
|
|
64108
|
+
sagaStateMachines: loadArtifact(dir, artifactNames.sagaStateMachines)
|
|
64109
|
+
}
|
|
64110
|
+
};
|
|
64111
|
+
}
|
|
63984
64112
|
var MAX_CLIENTS = 10;
|
|
63985
64113
|
var PING_INTERVAL_MS = 3e4;
|
|
63986
64114
|
var PONG_TIMEOUT_MS = 1e4;
|
|
@@ -64157,28 +64285,58 @@ function parseServeArgs(argv) {
|
|
|
64157
64285
|
});
|
|
64158
64286
|
const specPath = positionals[0];
|
|
64159
64287
|
if (!specPath) {
|
|
64160
|
-
return {
|
|
64288
|
+
return {
|
|
64289
|
+
success: false,
|
|
64290
|
+
message: "Usage: moment serve <file.moment | facet-dir> [--port 4321] [--all]"
|
|
64291
|
+
};
|
|
64161
64292
|
}
|
|
64162
64293
|
const resolvedPath = resolve8(specPath);
|
|
64163
64294
|
if (!existsSync4(resolvedPath)) {
|
|
64164
|
-
return { success: false, message: `Error:
|
|
64295
|
+
return { success: false, message: `Error: Path not found: ${resolvedPath}` };
|
|
64165
64296
|
}
|
|
64297
|
+
const isFacetDir = statSync(resolvedPath).isDirectory();
|
|
64166
64298
|
const rawPort = values2.port ?? "4321";
|
|
64167
64299
|
const port = parseInt(rawPort, 10);
|
|
64168
64300
|
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
64169
64301
|
return { success: false, message: `Error: Invalid port "${rawPort}". Expected 1-65535.` };
|
|
64170
64302
|
}
|
|
64171
|
-
return { resolvedPath, port, includeAll: values2.all === true };
|
|
64303
|
+
return { resolvedPath, port, includeAll: values2.all === true, isFacetDir };
|
|
64304
|
+
}
|
|
64305
|
+
async function initialPipeline(isFacetDir, resolvedPath, includeAll) {
|
|
64306
|
+
return isFacetDir ? runFacetDirPipeline(resolvedPath, includeAll) : await runPipeline(resolvedPath, includeAll);
|
|
64307
|
+
}
|
|
64308
|
+
function describeMode(isFacetDir, includeAll) {
|
|
64309
|
+
if (!isFacetDir) return "spec file";
|
|
64310
|
+
return `facet dir, ${includeAll ? "all scenarios" : "happy path only"}`;
|
|
64311
|
+
}
|
|
64312
|
+
function startWatcher(args2, clients, sessionId, setResult, log, logError) {
|
|
64313
|
+
return args2.isFacetDir ? setupFacetDirWatcher(
|
|
64314
|
+
args2.resolvedPath,
|
|
64315
|
+
args2.includeAll,
|
|
64316
|
+
clients,
|
|
64317
|
+
sessionId,
|
|
64318
|
+
setResult,
|
|
64319
|
+
log,
|
|
64320
|
+
logError
|
|
64321
|
+
) : setupFileWatcher(
|
|
64322
|
+
args2.resolvedPath,
|
|
64323
|
+
args2.includeAll,
|
|
64324
|
+
clients,
|
|
64325
|
+
sessionId,
|
|
64326
|
+
setResult,
|
|
64327
|
+
log,
|
|
64328
|
+
logError
|
|
64329
|
+
);
|
|
64172
64330
|
}
|
|
64173
64331
|
async function runServe(argv, log = console.log, logError = console.error) {
|
|
64174
64332
|
const parsed = parseServeArgs(argv);
|
|
64175
64333
|
if ("success" in parsed) return parsed;
|
|
64176
|
-
const { resolvedPath, port, includeAll } = parsed;
|
|
64334
|
+
const { resolvedPath, port, includeAll, isFacetDir } = parsed;
|
|
64177
64335
|
const sessionId = randomUUID();
|
|
64178
64336
|
const clients = /* @__PURE__ */ new Set();
|
|
64179
64337
|
let lastResult;
|
|
64180
64338
|
try {
|
|
64181
|
-
lastResult = await
|
|
64339
|
+
lastResult = await initialPipeline(isFacetDir, resolvedPath, includeAll);
|
|
64182
64340
|
} catch (error) {
|
|
64183
64341
|
const msg = error instanceof Error ? error.message : String(error);
|
|
64184
64342
|
return { success: false, message: `Initial pipeline failed: ${msg}` };
|
|
@@ -64187,14 +64345,15 @@ async function runServe(argv, log = console.log, logError = console.error) {
|
|
|
64187
64345
|
if (!wss) {
|
|
64188
64346
|
return { success: false, message: `Error: Could not bind to port ${port} after 3 attempts` };
|
|
64189
64347
|
}
|
|
64190
|
-
log(
|
|
64348
|
+
log(
|
|
64349
|
+
`Serving ${resolvedPath} (${describeMode(isFacetDir, includeAll)}) on ws://localhost:${port}`
|
|
64350
|
+
);
|
|
64191
64351
|
log(`Flows: ${lastResult.manifest.flows.map((f) => f.flowName).join(", ")}`);
|
|
64192
64352
|
log(`Scenarios: ${Object.keys(lastResult.scenarios).length} | Press Ctrl+C to stop`);
|
|
64193
64353
|
setupConnectionHandler(wss, clients, sessionId, () => lastResult, resolvedPath, log);
|
|
64194
64354
|
const pingInterval = startHeartbeat(clients, log);
|
|
64195
|
-
const fileWatcher =
|
|
64196
|
-
|
|
64197
|
-
includeAll,
|
|
64355
|
+
const fileWatcher = startWatcher(
|
|
64356
|
+
parsed,
|
|
64198
64357
|
clients,
|
|
64199
64358
|
sessionId,
|
|
64200
64359
|
(r) => {
|
|
@@ -64206,6 +64365,47 @@ async function runServe(argv, log = console.log, logError = console.error) {
|
|
|
64206
64365
|
setupGracefulShutdown(wss, clients, pingInterval, fileWatcher, log);
|
|
64207
64366
|
return { success: true, message: `Serving on ws://localhost:${port}` };
|
|
64208
64367
|
}
|
|
64368
|
+
function setupFacetDirWatcher(dir, includeAll, clients, sessionId, setResult, log, logError) {
|
|
64369
|
+
let debounceTimer = null;
|
|
64370
|
+
let rebuildInFlight = false;
|
|
64371
|
+
let rebuildQueued = false;
|
|
64372
|
+
const rebuild = () => {
|
|
64373
|
+
if (rebuildInFlight) {
|
|
64374
|
+
rebuildQueued = true;
|
|
64375
|
+
return;
|
|
64376
|
+
}
|
|
64377
|
+
rebuildInFlight = true;
|
|
64378
|
+
try {
|
|
64379
|
+
log("Facet directory changed, reloading...");
|
|
64380
|
+
const newResult = runFacetDirPipeline(dir, includeAll);
|
|
64381
|
+
setResult(newResult);
|
|
64382
|
+
pushUpdates(newResult, clients, sessionId);
|
|
64383
|
+
log("Reload complete, updates pushed");
|
|
64384
|
+
} catch (error) {
|
|
64385
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
64386
|
+
const wsError = {
|
|
64387
|
+
type: "error",
|
|
64388
|
+
sessionId,
|
|
64389
|
+
phase: "simulate",
|
|
64390
|
+
message: msg,
|
|
64391
|
+
diagnostics: []
|
|
64392
|
+
};
|
|
64393
|
+
broadcast(clients, JSON.stringify(wsError));
|
|
64394
|
+
logError(`Facet reload error: ${msg}`);
|
|
64395
|
+
} finally {
|
|
64396
|
+
rebuildInFlight = false;
|
|
64397
|
+
}
|
|
64398
|
+
if (rebuildQueued) {
|
|
64399
|
+
rebuildQueued = false;
|
|
64400
|
+
rebuild();
|
|
64401
|
+
}
|
|
64402
|
+
};
|
|
64403
|
+
return watch2(dir, { recursive: false }, (_eventType, filename) => {
|
|
64404
|
+
if (!filename || !filename.endsWith(".json")) return;
|
|
64405
|
+
if (debounceTimer) clearTimeout(debounceTimer);
|
|
64406
|
+
debounceTimer = setTimeout(rebuild, 300);
|
|
64407
|
+
});
|
|
64408
|
+
}
|
|
64209
64409
|
async function startServerWithRetry(port, log) {
|
|
64210
64410
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
64211
64411
|
try {
|
|
@@ -64222,9 +64422,9 @@ async function startServerWithRetry(port, log) {
|
|
|
64222
64422
|
return null;
|
|
64223
64423
|
}
|
|
64224
64424
|
function startServer(port) {
|
|
64225
|
-
return new Promise((
|
|
64425
|
+
return new Promise((resolve24, reject2) => {
|
|
64226
64426
|
const wss = new import_websocket_server.default({ port, host: "127.0.0.1" });
|
|
64227
|
-
wss.on("listening", () =>
|
|
64427
|
+
wss.on("listening", () => resolve24(wss));
|
|
64228
64428
|
wss.on("error", (err) => reject2(err));
|
|
64229
64429
|
});
|
|
64230
64430
|
}
|
|
@@ -64233,7 +64433,7 @@ function sleep(ms) {
|
|
|
64233
64433
|
}
|
|
64234
64434
|
|
|
64235
64435
|
// src/commands/derive.ts
|
|
64236
|
-
import { readFileSync as
|
|
64436
|
+
import { readFileSync as readFileSync6, existsSync as existsSync5 } from "node:fs";
|
|
64237
64437
|
import { resolve as resolve9 } from "node:path";
|
|
64238
64438
|
import { parseArgs as parseArgs4 } from "node:util";
|
|
64239
64439
|
var EMPTY2 = [];
|
|
@@ -64242,7 +64442,7 @@ function fail2(message) {
|
|
|
64242
64442
|
}
|
|
64243
64443
|
function readFile2(path) {
|
|
64244
64444
|
try {
|
|
64245
|
-
return
|
|
64445
|
+
return readFileSync6(path, "utf-8");
|
|
64246
64446
|
} catch (err) {
|
|
64247
64447
|
const msg = err instanceof Error ? err.message : String(err);
|
|
64248
64448
|
return fail2(`Error: Failed to read ${path}: ${msg}`);
|
|
@@ -64295,7 +64495,7 @@ async function runDerive(argv) {
|
|
|
64295
64495
|
}
|
|
64296
64496
|
|
|
64297
64497
|
// src/commands/generate.ts
|
|
64298
|
-
import { readFileSync as
|
|
64498
|
+
import { readFileSync as readFileSync7, existsSync as existsSync6 } from "node:fs";
|
|
64299
64499
|
import { resolve as resolve10 } from "node:path";
|
|
64300
64500
|
import { parseArgs as parseArgs5 } from "node:util";
|
|
64301
64501
|
|
|
@@ -65999,7 +66199,7 @@ function fail3(message) {
|
|
|
65999
66199
|
}
|
|
66000
66200
|
function readFile3(path) {
|
|
66001
66201
|
try {
|
|
66002
|
-
return
|
|
66202
|
+
return readFileSync7(path, "utf-8");
|
|
66003
66203
|
} catch (err) {
|
|
66004
66204
|
const msg = err instanceof Error ? err.message : String(err);
|
|
66005
66205
|
return fail3(`Error: Failed to read ${path}: ${msg}`);
|
|
@@ -66072,7 +66272,7 @@ Wrote ${filesWritten.length} file(s) to ${outDir}`,
|
|
|
66072
66272
|
}
|
|
66073
66273
|
|
|
66074
66274
|
// src/commands/cucumber-json.ts
|
|
66075
|
-
import { readFileSync as
|
|
66275
|
+
import { readFileSync as readFileSync8, existsSync as existsSync7 } from "node:fs";
|
|
66076
66276
|
import { resolve as resolve11 } from "node:path";
|
|
66077
66277
|
import { parseArgs as parseArgs6 } from "node:util";
|
|
66078
66278
|
|
|
@@ -66270,7 +66470,7 @@ function fail4(message) {
|
|
|
66270
66470
|
}
|
|
66271
66471
|
function readFile4(path) {
|
|
66272
66472
|
try {
|
|
66273
|
-
return
|
|
66473
|
+
return readFileSync8(path, "utf-8");
|
|
66274
66474
|
} catch (err) {
|
|
66275
66475
|
const msg = err instanceof Error ? err.message : String(err);
|
|
66276
66476
|
return fail4(`Error: Failed to read ${path}: ${msg}`);
|
|
@@ -66316,7 +66516,7 @@ async function runCucumberJson(argv) {
|
|
|
66316
66516
|
}
|
|
66317
66517
|
|
|
66318
66518
|
// src/commands/emit-ts.ts
|
|
66319
|
-
import { readFileSync as
|
|
66519
|
+
import { readFileSync as readFileSync9, existsSync as existsSync8 } from "node:fs";
|
|
66320
66520
|
import { resolve as resolve12 } from "node:path";
|
|
66321
66521
|
import { parseArgs as parseArgs7 } from "node:util";
|
|
66322
66522
|
var EMPTY5 = [];
|
|
@@ -66325,7 +66525,7 @@ function fail5(message) {
|
|
|
66325
66525
|
}
|
|
66326
66526
|
function readFile5(path) {
|
|
66327
66527
|
try {
|
|
66328
|
-
return
|
|
66528
|
+
return readFileSync9(path, "utf-8");
|
|
66329
66529
|
} catch (err) {
|
|
66330
66530
|
const msg = err instanceof Error ? err.message : String(err);
|
|
66331
66531
|
return fail5(`Error: Failed to read ${path}: ${msg}`);
|
|
@@ -66402,7 +66602,7 @@ Wrote ${filesWritten.length} file(s) to ${outDir}`,
|
|
|
66402
66602
|
}
|
|
66403
66603
|
|
|
66404
66604
|
// src/commands/test.ts
|
|
66405
|
-
import { readFileSync as
|
|
66605
|
+
import { readFileSync as readFileSync10, existsSync as existsSync9 } from "node:fs";
|
|
66406
66606
|
import { resolve as resolve13 } from "node:path";
|
|
66407
66607
|
import { parseArgs as parseArgs8 } from "node:util";
|
|
66408
66608
|
var EMPTY6 = [];
|
|
@@ -66411,7 +66611,7 @@ function fail6(message) {
|
|
|
66411
66611
|
}
|
|
66412
66612
|
function readFile6(path) {
|
|
66413
66613
|
try {
|
|
66414
|
-
return
|
|
66614
|
+
return readFileSync10(path, "utf-8");
|
|
66415
66615
|
} catch (err) {
|
|
66416
66616
|
const msg = err instanceof Error ? err.message : String(err);
|
|
66417
66617
|
return fail6(`Error: Failed to read ${path}: ${msg}`);
|
|
@@ -66454,7 +66654,7 @@ async function runTest(argv) {
|
|
|
66454
66654
|
}
|
|
66455
66655
|
|
|
66456
66656
|
// src/commands/viz.ts
|
|
66457
|
-
import { readFileSync as
|
|
66657
|
+
import { readFileSync as readFileSync11, existsSync as existsSync10 } from "node:fs";
|
|
66458
66658
|
import { resolve as resolve14, basename as basename3 } from "node:path";
|
|
66459
66659
|
import { parseArgs as parseArgs9 } from "node:util";
|
|
66460
66660
|
|
|
@@ -66688,7 +66888,7 @@ function fail7(message) {
|
|
|
66688
66888
|
}
|
|
66689
66889
|
function readFile7(path) {
|
|
66690
66890
|
try {
|
|
66691
|
-
return
|
|
66891
|
+
return readFileSync11(path, "utf-8");
|
|
66692
66892
|
} catch (err) {
|
|
66693
66893
|
const msg = err instanceof Error ? err.message : String(err);
|
|
66694
66894
|
return fail7(`Error: Failed to read ${path}: ${msg}`);
|
|
@@ -66736,7 +66936,7 @@ async function runViz(argv) {
|
|
|
66736
66936
|
}
|
|
66737
66937
|
|
|
66738
66938
|
// src/commands/sync-status.ts
|
|
66739
|
-
import { readFileSync as
|
|
66939
|
+
import { readFileSync as readFileSync13, existsSync as existsSync12 } from "node:fs";
|
|
66740
66940
|
import { resolve as resolve16, dirname as dirname4 } from "node:path";
|
|
66741
66941
|
import { parseArgs as parseArgs10 } from "node:util";
|
|
66742
66942
|
|
|
@@ -67754,8 +67954,8 @@ var LocalGitArtifactStore = class {
|
|
|
67754
67954
|
};
|
|
67755
67955
|
|
|
67756
67956
|
// ../sync/dist/services/sift-event-stream-reader.js
|
|
67757
|
-
import { readFileSync as
|
|
67758
|
-
import { join as
|
|
67957
|
+
import { readFileSync as readFileSync12, readdirSync as readdirSync2, existsSync as existsSync11 } from "node:fs";
|
|
67958
|
+
import { join as join7 } from "node:path";
|
|
67759
67959
|
var SiftEventStreamReader = class {
|
|
67760
67960
|
read(domainDir) {
|
|
67761
67961
|
if (!existsSync11(domainDir)) {
|
|
@@ -67769,7 +67969,7 @@ var SiftEventStreamReader = class {
|
|
|
67769
67969
|
const errors = [];
|
|
67770
67970
|
let eventsProcessed = 0;
|
|
67771
67971
|
for (const file of jsonlFiles) {
|
|
67772
|
-
const filePath =
|
|
67972
|
+
const filePath = join7(domainDir, file);
|
|
67773
67973
|
const result = this.processFile(filePath, accumulator);
|
|
67774
67974
|
eventsProcessed += result.processed;
|
|
67775
67975
|
errors.push(...result.errors);
|
|
@@ -67784,7 +67984,7 @@ var SiftEventStreamReader = class {
|
|
|
67784
67984
|
processFile(filePath, accumulator) {
|
|
67785
67985
|
let content;
|
|
67786
67986
|
try {
|
|
67787
|
-
content =
|
|
67987
|
+
content = readFileSync12(filePath, "utf-8");
|
|
67788
67988
|
} catch (err) {
|
|
67789
67989
|
const msg = err instanceof Error ? err.message : String(err);
|
|
67790
67990
|
return { processed: 0, errors: [`Failed to read ${filePath}: ${msg}`] };
|
|
@@ -67924,7 +68124,7 @@ function fail8(message) {
|
|
|
67924
68124
|
}
|
|
67925
68125
|
function readFile8(path) {
|
|
67926
68126
|
try {
|
|
67927
|
-
return
|
|
68127
|
+
return readFileSync13(path, "utf-8");
|
|
67928
68128
|
} catch (err) {
|
|
67929
68129
|
const msg = err instanceof Error ? err.message : String(err);
|
|
67930
68130
|
return fail8(`Error: Failed to read ${path}: ${msg}`);
|
|
@@ -67990,7 +68190,7 @@ async function runSyncStatus(argv) {
|
|
|
67990
68190
|
}
|
|
67991
68191
|
|
|
67992
68192
|
// src/commands/sync-propose.ts
|
|
67993
|
-
import { readFileSync as
|
|
68193
|
+
import { readFileSync as readFileSync14, existsSync as existsSync13 } from "node:fs";
|
|
67994
68194
|
import { resolve as resolve17, dirname as dirname5 } from "node:path";
|
|
67995
68195
|
import { parseArgs as parseArgs11 } from "node:util";
|
|
67996
68196
|
var EMPTY9 = [];
|
|
@@ -67999,7 +68199,7 @@ function fail9(message) {
|
|
|
67999
68199
|
}
|
|
68000
68200
|
function readFile9(path) {
|
|
68001
68201
|
try {
|
|
68002
|
-
return
|
|
68202
|
+
return readFileSync14(path, "utf-8");
|
|
68003
68203
|
} catch (err) {
|
|
68004
68204
|
const msg = err instanceof Error ? err.message : String(err);
|
|
68005
68205
|
return fail9(`Error: Failed to read ${path}: ${msg}`);
|
|
@@ -68015,6 +68215,11 @@ async function runSyncPropose(argv) {
|
|
|
68015
68215
|
allowPositionals: true,
|
|
68016
68216
|
strict: false
|
|
68017
68217
|
});
|
|
68218
|
+
if (values2["auto-accept"] === true) {
|
|
68219
|
+
return fail9(
|
|
68220
|
+
"Error: --auto-accept is not yet fully implemented \u2014 accepted proposals are not persisted and not applied to files. Omit --auto-accept to generate proposals for manual review instead. See https://github.com/mmmnt/mmmnt/issues for tracking."
|
|
68221
|
+
);
|
|
68222
|
+
}
|
|
68018
68223
|
const filePath = positionals[0];
|
|
68019
68224
|
if (!filePath) return fail9("Usage: moment sync propose <file.moment>");
|
|
68020
68225
|
const resolvedPath = resolve17(filePath);
|
|
@@ -68062,7 +68267,7 @@ async function runSyncPropose(argv) {
|
|
|
68062
68267
|
for (const p of proposals) {
|
|
68063
68268
|
syncState.recordProposal(p);
|
|
68064
68269
|
}
|
|
68065
|
-
const autoAccept =
|
|
68270
|
+
const autoAccept = false;
|
|
68066
68271
|
const counts = processProposals(proposals, syncState, autoAccept);
|
|
68067
68272
|
saga.confirmationComplete(counts.accepted, counts.rejected, counts.skipped);
|
|
68068
68273
|
saga.recordingComplete(counts.accepted);
|
|
@@ -68119,27 +68324,19 @@ function formatProposalSummary(proposals, counts) {
|
|
|
68119
68324
|
lines.push(` File: ${p.sourceFile}`);
|
|
68120
68325
|
}
|
|
68121
68326
|
lines.push("");
|
|
68122
|
-
lines.push(
|
|
68327
|
+
lines.push(
|
|
68328
|
+
`Accepted: ${counts.accepted}, Rejected: ${counts.rejected}, Skipped: ${counts.skipped}`
|
|
68329
|
+
);
|
|
68123
68330
|
return lines.join("\n");
|
|
68124
68331
|
}
|
|
68125
68332
|
|
|
68126
68333
|
// src/commands/sync-accept.ts
|
|
68127
|
-
import { readFileSync as readFileSync14, existsSync as existsSync14 } from "node:fs";
|
|
68128
|
-
import { resolve as resolve18, dirname as dirname6 } from "node:path";
|
|
68129
68334
|
import { parseArgs as parseArgs12 } from "node:util";
|
|
68130
68335
|
var EMPTY10 = [];
|
|
68131
68336
|
var USAGE = "Usage: moment sync accept [--all] <file.moment> [<proposal-id>...]";
|
|
68132
68337
|
function fail10(message) {
|
|
68133
68338
|
return { success: false, message, diagnostics: EMPTY10, acceptedCount: 0 };
|
|
68134
68339
|
}
|
|
68135
|
-
function readFile10(path) {
|
|
68136
|
-
try {
|
|
68137
|
-
return readFileSync14(path, "utf-8");
|
|
68138
|
-
} catch (err) {
|
|
68139
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
68140
|
-
return fail10(`Error: Failed to read ${path}: ${msg}`);
|
|
68141
|
-
}
|
|
68142
|
-
}
|
|
68143
68340
|
async function runSyncAccept(argv) {
|
|
68144
68341
|
const { values: values2, positionals } = parseArgs12({
|
|
68145
68342
|
args: argv,
|
|
@@ -68152,98 +68349,14 @@ async function runSyncAccept(argv) {
|
|
|
68152
68349
|
});
|
|
68153
68350
|
const filePath = positionals[0];
|
|
68154
68351
|
if (!filePath) return fail10(USAGE);
|
|
68155
|
-
|
|
68156
|
-
|
|
68157
|
-
|
|
68158
|
-
const proposals = await generateProposals(ir, resolvedPath);
|
|
68159
|
-
if (proposals.length === 0) {
|
|
68160
|
-
return { success: true, message: "No pending proposals to accept", diagnostics: EMPTY10, acceptedCount: 0 };
|
|
68161
|
-
}
|
|
68162
|
-
return executeAccept(proposals, values2.all === true, positionals.slice(1), values2.json === true);
|
|
68163
|
-
}
|
|
68164
|
-
function executeAccept(proposals, acceptAll, proposalIds, asJson) {
|
|
68165
|
-
const syncState = new SyncState();
|
|
68166
|
-
for (const p of proposals) {
|
|
68167
|
-
syncState.recordProposal(p);
|
|
68168
|
-
}
|
|
68169
|
-
if (!acceptAll && proposalIds.length === 0) {
|
|
68170
|
-
return fail10(USAGE);
|
|
68171
|
-
}
|
|
68172
|
-
const result = acceptAll ? acceptAllProposals(syncState, proposals.map((p) => p.proposalId)) : acceptByIds(syncState, proposalIds, proposals.map((p) => p.proposalId));
|
|
68173
|
-
if (!result.success || !asJson) return result;
|
|
68174
|
-
const json = JSON.stringify({ accepted: result.acceptedCount }, null, 2);
|
|
68175
|
-
return { ...result, message: json, json };
|
|
68176
|
-
}
|
|
68177
|
-
async function parseSpecFile(filePath) {
|
|
68178
|
-
const resolvedPath = resolve18(filePath);
|
|
68179
|
-
if (!existsSync14(resolvedPath)) return fail10(`Error: File not found: ${resolvedPath}`);
|
|
68180
|
-
const content = readFile10(resolvedPath);
|
|
68181
|
-
if (typeof content !== "string") return content;
|
|
68182
|
-
const parseResult = await new MomentParser().parseContent(content);
|
|
68183
|
-
if (!parseResult.success) {
|
|
68184
|
-
return {
|
|
68185
|
-
success: false,
|
|
68186
|
-
message: `Parse failed with ${parseResult.diagnostics.length} diagnostic(s)`,
|
|
68187
|
-
diagnostics: parseResult.diagnostics,
|
|
68188
|
-
filePath: resolvedPath,
|
|
68189
|
-
acceptedCount: 0
|
|
68190
|
-
};
|
|
68191
|
-
}
|
|
68192
|
-
return { ir: parseResult.ir, resolvedPath };
|
|
68193
|
-
}
|
|
68194
|
-
async function generateProposals(ir, resolvedPath) {
|
|
68195
|
-
const tsOutput = new TypeScriptEmitter().emit(ir, { scope: { level: "system" } });
|
|
68196
|
-
const repoRoot = dirname6(resolvedPath);
|
|
68197
|
-
const store = new LocalGitArtifactStore(repoRoot);
|
|
68198
|
-
const actual = await readActualFiles2(store, [...tsOutput.files.keys()]);
|
|
68199
|
-
return new ASTDiffEngine().generateProposals({ expected: tsOutput.files, actual });
|
|
68200
|
-
}
|
|
68201
|
-
function acceptAllProposals(syncState, allIds) {
|
|
68202
|
-
for (const id of allIds) {
|
|
68203
|
-
syncState.acceptProposal(id);
|
|
68204
|
-
}
|
|
68205
|
-
return {
|
|
68206
|
-
success: true,
|
|
68207
|
-
message: `Accepted ${allIds.length} proposal(s)`,
|
|
68208
|
-
diagnostics: EMPTY10,
|
|
68209
|
-
acceptedCount: allIds.length
|
|
68210
|
-
};
|
|
68211
|
-
}
|
|
68212
|
-
function acceptByIds(syncState, requestedIds, validIds) {
|
|
68213
|
-
const uniqueIds = [...new Set(requestedIds)];
|
|
68214
|
-
const validSet = new Set(validIds);
|
|
68215
|
-
const invalid = uniqueIds.filter((id) => !validSet.has(id));
|
|
68216
|
-
if (invalid.length > 0) {
|
|
68217
|
-
return fail10(`Error: Unknown proposal ID(s): ${invalid.join(", ")}`);
|
|
68218
|
-
}
|
|
68219
|
-
for (const id of uniqueIds) {
|
|
68220
|
-
syncState.acceptProposal(id);
|
|
68221
|
-
}
|
|
68222
|
-
return {
|
|
68223
|
-
success: true,
|
|
68224
|
-
message: `Accepted ${uniqueIds.length} proposal(s)`,
|
|
68225
|
-
diagnostics: EMPTY10,
|
|
68226
|
-
acceptedCount: uniqueIds.length
|
|
68227
|
-
};
|
|
68228
|
-
}
|
|
68229
|
-
async function readActualFiles2(store, paths) {
|
|
68230
|
-
const actual = /* @__PURE__ */ new Map();
|
|
68231
|
-
for (const path of paths) {
|
|
68232
|
-
try {
|
|
68233
|
-
const content = await store.readArtifact(path);
|
|
68234
|
-
actual.set(path, content);
|
|
68235
|
-
} catch (err) {
|
|
68236
|
-
const msg = err instanceof Error ? err.message : "";
|
|
68237
|
-
if (msg.startsWith("Artifact not found")) continue;
|
|
68238
|
-
throw err;
|
|
68239
|
-
}
|
|
68240
|
-
}
|
|
68241
|
-
return actual;
|
|
68352
|
+
return fail10(
|
|
68353
|
+
"Error: sync accept is not yet fully implemented \u2014 accepted proposals are not persisted and not applied to files. Use `moment sync propose` to generate proposals, then apply them manually. See https://github.com/mmmnt/mmmnt/issues for tracking."
|
|
68354
|
+
);
|
|
68242
68355
|
}
|
|
68243
68356
|
|
|
68244
68357
|
// src/commands/schema-status.ts
|
|
68245
|
-
import { readFileSync as readFileSync15, existsSync as
|
|
68246
|
-
import { resolve as
|
|
68358
|
+
import { readFileSync as readFileSync15, existsSync as existsSync14 } from "node:fs";
|
|
68359
|
+
import { resolve as resolve18 } from "node:path";
|
|
68247
68360
|
import { parseArgs as parseArgs13 } from "node:util";
|
|
68248
68361
|
|
|
68249
68362
|
// ../schema/dist/aggregates/schema-registry.js
|
|
@@ -68555,7 +68668,7 @@ async function runSchemaStatus(argv) {
|
|
|
68555
68668
|
});
|
|
68556
68669
|
const filePath = positionals[0];
|
|
68557
68670
|
if (!filePath) return fail11("Usage: moment schema status <file.moment>");
|
|
68558
|
-
const parsed = await
|
|
68671
|
+
const parsed = await parseSpecFile(filePath);
|
|
68559
68672
|
if (!("ir" in parsed)) return parsed;
|
|
68560
68673
|
const { ir } = parsed;
|
|
68561
68674
|
const entries = buildSchemaEntries(ir);
|
|
@@ -68646,9 +68759,9 @@ function formatSchemaTable(entries) {
|
|
|
68646
68759
|
lines.push(`Total: ${entries.length} field(s)`);
|
|
68647
68760
|
return lines.join("\n");
|
|
68648
68761
|
}
|
|
68649
|
-
async function
|
|
68650
|
-
const resolvedPath =
|
|
68651
|
-
if (!
|
|
68762
|
+
async function parseSpecFile(filePath) {
|
|
68763
|
+
const resolvedPath = resolve18(filePath);
|
|
68764
|
+
if (!existsSync14(resolvedPath)) return fail11(`Error: File not found: ${resolvedPath}`);
|
|
68652
68765
|
let content;
|
|
68653
68766
|
try {
|
|
68654
68767
|
content = readFileSync15(resolvedPath, "utf-8");
|
|
@@ -68669,8 +68782,8 @@ async function parseSpecFile2(filePath) {
|
|
|
68669
68782
|
}
|
|
68670
68783
|
|
|
68671
68784
|
// src/commands/lint.ts
|
|
68672
|
-
import { readFileSync as readFileSync16, existsSync as
|
|
68673
|
-
import { resolve as
|
|
68785
|
+
import { readFileSync as readFileSync16, existsSync as existsSync15 } from "node:fs";
|
|
68786
|
+
import { resolve as resolve19, dirname as dirname6 } from "node:path";
|
|
68674
68787
|
import { parseArgs as parseArgs14 } from "node:util";
|
|
68675
68788
|
var EMPTY_ISSUES = [];
|
|
68676
68789
|
function fail12(message) {
|
|
@@ -68685,8 +68798,8 @@ async function runLint(argv) {
|
|
|
68685
68798
|
});
|
|
68686
68799
|
const filePath = positionals[0];
|
|
68687
68800
|
if (!filePath) return fail12("Usage: moment lint <file.moment>");
|
|
68688
|
-
const resolvedPath =
|
|
68689
|
-
if (!
|
|
68801
|
+
const resolvedPath = resolve19(filePath);
|
|
68802
|
+
if (!existsSync15(resolvedPath)) return fail12(`Error: File not found: ${resolvedPath}`);
|
|
68690
68803
|
let content;
|
|
68691
68804
|
try {
|
|
68692
68805
|
content = readFileSync16(resolvedPath, "utf-8");
|
|
@@ -68717,7 +68830,7 @@ function collectParseDiagnostics(diagnostics, issues) {
|
|
|
68717
68830
|
async function collectDriftWarnings(ir, resolvedPath, issues) {
|
|
68718
68831
|
try {
|
|
68719
68832
|
const tsOutput = new TypeScriptEmitter().emit(ir, { scope: { level: "system" } });
|
|
68720
|
-
const repoRoot = findGitRoot(
|
|
68833
|
+
const repoRoot = findGitRoot(dirname6(resolvedPath));
|
|
68721
68834
|
const store = new LocalGitArtifactStore(repoRoot);
|
|
68722
68835
|
const actual = /* @__PURE__ */ new Map();
|
|
68723
68836
|
for (const path of tsOutput.files.keys()) {
|
|
@@ -68738,10 +68851,10 @@ async function collectDriftWarnings(ir, resolvedPath, issues) {
|
|
|
68738
68851
|
}
|
|
68739
68852
|
}
|
|
68740
68853
|
function findGitRoot(startDir) {
|
|
68741
|
-
let dir =
|
|
68742
|
-
while (dir !==
|
|
68743
|
-
if (
|
|
68744
|
-
dir =
|
|
68854
|
+
let dir = resolve19(startDir);
|
|
68855
|
+
while (dir !== dirname6(dir)) {
|
|
68856
|
+
if (existsSync15(resolve19(dir, ".git"))) return dir;
|
|
68857
|
+
dir = dirname6(dir);
|
|
68745
68858
|
}
|
|
68746
68859
|
return startDir;
|
|
68747
68860
|
}
|
|
@@ -68795,8 +68908,8 @@ function buildResult2(issues, hasParseErrors, asJson) {
|
|
|
68795
68908
|
}
|
|
68796
68909
|
|
|
68797
68910
|
// src/commands/import-from-sift.ts
|
|
68798
|
-
import { readFileSync as readFileSync17, writeFileSync as writeFileSync4, existsSync as
|
|
68799
|
-
import { resolve as
|
|
68911
|
+
import { readFileSync as readFileSync17, writeFileSync as writeFileSync4, existsSync as existsSync16, mkdirSync as mkdirSync3 } from "node:fs";
|
|
68912
|
+
import { resolve as resolve20, dirname as dirname7, join as join8 } from "node:path";
|
|
68800
68913
|
import { parseArgs as parseArgs15 } from "node:util";
|
|
68801
68914
|
import { createHash as createHash3 } from "node:crypto";
|
|
68802
68915
|
var EMPTY12 = [];
|
|
@@ -68815,8 +68928,8 @@ async function runImportFromSift(argv) {
|
|
|
68815
68928
|
});
|
|
68816
68929
|
const domainDir = positionals[0];
|
|
68817
68930
|
if (!domainDir) return fail13("Usage: moment import --from-sift <.domain/ directory>");
|
|
68818
|
-
const resolvedDir =
|
|
68819
|
-
if (!
|
|
68931
|
+
const resolvedDir = resolve20(domainDir);
|
|
68932
|
+
if (!existsSync16(resolvedDir)) return fail13(`Error: Directory not found: ${resolvedDir}`);
|
|
68820
68933
|
return executeImport(resolvedDir, values2["output-dir"], values2.json === true);
|
|
68821
68934
|
}
|
|
68822
68935
|
function executeImport(domainDir, outputDir, asJson) {
|
|
@@ -68833,29 +68946,36 @@ function executeImport(domainDir, outputDir, asJson) {
|
|
|
68833
68946
|
const importResult = importer.import(siftInput);
|
|
68834
68947
|
if (importResult.diagnostics.some((d) => d.severity === "error")) {
|
|
68835
68948
|
const errorCount = importResult.diagnostics.filter((d) => d.severity === "error").length;
|
|
68836
|
-
return {
|
|
68949
|
+
return {
|
|
68950
|
+
success: false,
|
|
68951
|
+
message: `Import failed with ${errorCount} error(s)`,
|
|
68952
|
+
diagnostics: importResult.diagnostics,
|
|
68953
|
+
filesWritten: 0,
|
|
68954
|
+
eventsProcessed: readResult.eventsProcessed
|
|
68955
|
+
};
|
|
68837
68956
|
}
|
|
68838
|
-
const outDir =
|
|
68957
|
+
const outDir = resolve20(outputDir ?? dirname7(domainDir));
|
|
68839
68958
|
const filesWritten = writeOutputFiles2(importer, siftInput, outDir);
|
|
68840
68959
|
writeFingerprint(siftInput, importResult, domainDir, outDir);
|
|
68841
|
-
return buildResult3(
|
|
68960
|
+
return buildResult3(
|
|
68961
|
+
importResult,
|
|
68962
|
+
filesWritten,
|
|
68963
|
+
readResult.eventsProcessed,
|
|
68964
|
+
readResult.filesRead,
|
|
68965
|
+
asJson
|
|
68966
|
+
);
|
|
68842
68967
|
}
|
|
68843
68968
|
function sanitizeFileName(name) {
|
|
68844
68969
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
68845
68970
|
}
|
|
68846
|
-
function assertPathWithin2(filePath, baseDir) {
|
|
68847
|
-
if (!resolve21(filePath).startsWith(resolve21(baseDir))) {
|
|
68848
|
-
throw new Error(`Path traversal detected: ${filePath} escapes ${baseDir}`);
|
|
68849
|
-
}
|
|
68850
|
-
}
|
|
68851
68971
|
function writeOutputFiles2(importer, input, outDir) {
|
|
68852
68972
|
let count = 0;
|
|
68853
|
-
const momentDir =
|
|
68973
|
+
const momentDir = join8(outDir, ".moment");
|
|
68854
68974
|
for (const block2 of input.buildingBlocks) {
|
|
68855
68975
|
const fileName = sanitizeFileName(block2.contextName);
|
|
68856
|
-
const filePath =
|
|
68857
|
-
|
|
68858
|
-
mkdirSync3(
|
|
68976
|
+
const filePath = join8(momentDir, "contexts", `${fileName}.moment`);
|
|
68977
|
+
assertPathWithin(filePath, momentDir);
|
|
68978
|
+
mkdirSync3(dirname7(filePath), { recursive: true });
|
|
68859
68979
|
writeFileSync4(filePath, importer.generateContextFile(block2));
|
|
68860
68980
|
count++;
|
|
68861
68981
|
}
|
|
@@ -68863,9 +68983,9 @@ function writeOutputFiles2(importer, input, outDir) {
|
|
|
68863
68983
|
}
|
|
68864
68984
|
function writeFingerprint(siftInput, importResult, domainDir, outDir) {
|
|
68865
68985
|
const contentHash = computeDomainHash(domainDir);
|
|
68866
|
-
const fpDir =
|
|
68867
|
-
const fpPath =
|
|
68868
|
-
if (
|
|
68986
|
+
const fpDir = join8(outDir, ".moment");
|
|
68987
|
+
const fpPath = join8(fpDir, ".upstream-fingerprint.json");
|
|
68988
|
+
if (existsSync16(fpPath)) {
|
|
68869
68989
|
try {
|
|
68870
68990
|
const existing = JSON.parse(readFileSync17(fpPath, "utf-8"));
|
|
68871
68991
|
if (existing.sift?.contentHash === contentHash) return;
|
|
@@ -68890,7 +69010,7 @@ function computeDomainHash(domainDir) {
|
|
|
68890
69010
|
const files = readdirSync3(domainDir).filter((f) => f.endsWith(".jsonl")).sort();
|
|
68891
69011
|
const hash = createHash3("sha256");
|
|
68892
69012
|
for (const file of files) {
|
|
68893
|
-
hash.update(readFileSync17(
|
|
69013
|
+
hash.update(readFileSync17(join8(domainDir, file), "utf-8"));
|
|
68894
69014
|
}
|
|
68895
69015
|
return hash.digest("hex");
|
|
68896
69016
|
}
|
|
@@ -68898,7 +69018,10 @@ function countAggregates(input) {
|
|
|
68898
69018
|
return input.buildingBlocks.reduce((sum, b) => sum + b.aggregates.length, 0);
|
|
68899
69019
|
}
|
|
68900
69020
|
function countDomainEvents(input) {
|
|
68901
|
-
return input.buildingBlocks.reduce(
|
|
69021
|
+
return input.buildingBlocks.reduce(
|
|
69022
|
+
(sum, b) => sum + b.aggregates.reduce((s, a) => s + a.events.length, 0),
|
|
69023
|
+
0
|
|
69024
|
+
);
|
|
68902
69025
|
}
|
|
68903
69026
|
function buildResult3(importResult, filesWritten, eventsProcessed, filesRead, asJson) {
|
|
68904
69027
|
const summary = {
|
|
@@ -68910,7 +69033,14 @@ function buildResult3(importResult, filesWritten, eventsProcessed, filesRead, as
|
|
|
68910
69033
|
};
|
|
68911
69034
|
if (asJson) {
|
|
68912
69035
|
const json = JSON.stringify(summary, null, 2);
|
|
68913
|
-
return {
|
|
69036
|
+
return {
|
|
69037
|
+
success: true,
|
|
69038
|
+
message: json,
|
|
69039
|
+
diagnostics: importResult.diagnostics,
|
|
69040
|
+
filesWritten,
|
|
69041
|
+
eventsProcessed,
|
|
69042
|
+
json
|
|
69043
|
+
};
|
|
68914
69044
|
}
|
|
68915
69045
|
return {
|
|
68916
69046
|
success: true,
|
|
@@ -68922,8 +69052,8 @@ function buildResult3(importResult, filesWritten, eventsProcessed, filesRead, as
|
|
|
68922
69052
|
}
|
|
68923
69053
|
|
|
68924
69054
|
// src/commands/status.ts
|
|
68925
|
-
import { readFileSync as readFileSync18, existsSync as
|
|
68926
|
-
import { resolve as
|
|
69055
|
+
import { readFileSync as readFileSync18, existsSync as existsSync17 } from "node:fs";
|
|
69056
|
+
import { resolve as resolve21, dirname as dirname8, join as join9 } from "node:path";
|
|
68927
69057
|
import { parseArgs as parseArgs16 } from "node:util";
|
|
68928
69058
|
function fail14(message) {
|
|
68929
69059
|
return { success: false, hasDrift: false, message, sections: [] };
|
|
@@ -68941,8 +69071,8 @@ async function runStatus(argv) {
|
|
|
68941
69071
|
});
|
|
68942
69072
|
const filePath = positionals[0];
|
|
68943
69073
|
if (!filePath) return fail14("Usage: moment status <file.moment>");
|
|
68944
|
-
const resolvedPath =
|
|
68945
|
-
if (!
|
|
69074
|
+
const resolvedPath = resolve21(filePath);
|
|
69075
|
+
if (!existsSync17(resolvedPath)) return fail14(`Error: File not found: ${resolvedPath}`);
|
|
68946
69076
|
let content;
|
|
68947
69077
|
try {
|
|
68948
69078
|
content = readFileSync18(resolvedPath, "utf-8");
|
|
@@ -68974,7 +69104,7 @@ function buildParseSection(parseResult) {
|
|
|
68974
69104
|
};
|
|
68975
69105
|
}
|
|
68976
69106
|
async function buildDriftSection(ir, resolvedPath) {
|
|
68977
|
-
const gitRoot = findGitRoot2(
|
|
69107
|
+
const gitRoot = findGitRoot2(dirname8(resolvedPath));
|
|
68978
69108
|
if (!gitRoot) {
|
|
68979
69109
|
return { label: "Implementation Sync", state: "ok", summary: "Not available (no git repository)" };
|
|
68980
69110
|
}
|
|
@@ -69026,13 +69156,13 @@ function buildSchemaSection(ir) {
|
|
|
69026
69156
|
};
|
|
69027
69157
|
}
|
|
69028
69158
|
function buildUpstreamSection(resolvedPath) {
|
|
69029
|
-
const projectDir =
|
|
69030
|
-
const domainDir =
|
|
69031
|
-
const fpPath =
|
|
69032
|
-
if (!
|
|
69159
|
+
const projectDir = dirname8(resolvedPath);
|
|
69160
|
+
const domainDir = join9(projectDir, ".domain");
|
|
69161
|
+
const fpPath = join9(projectDir, ".moment", ".upstream-fingerprint.json");
|
|
69162
|
+
if (!existsSync17(domainDir)) {
|
|
69033
69163
|
return { label: "Upstream Source", state: "ok", summary: "No upstream source configured" };
|
|
69034
69164
|
}
|
|
69035
|
-
if (!
|
|
69165
|
+
if (!existsSync17(fpPath)) {
|
|
69036
69166
|
return { label: "Upstream Source", state: "drift", summary: ".domain/ exists but no fingerprint \u2014 run moment import --from-sift" };
|
|
69037
69167
|
}
|
|
69038
69168
|
try {
|
|
@@ -69048,10 +69178,10 @@ function buildUpstreamSection(resolvedPath) {
|
|
|
69048
69178
|
}
|
|
69049
69179
|
}
|
|
69050
69180
|
function findGitRoot2(startDir) {
|
|
69051
|
-
let dir =
|
|
69052
|
-
while (dir !==
|
|
69053
|
-
if (
|
|
69054
|
-
dir =
|
|
69181
|
+
let dir = resolve21(startDir);
|
|
69182
|
+
while (dir !== dirname8(dir)) {
|
|
69183
|
+
if (existsSync17(join9(dir, ".git"))) return dir;
|
|
69184
|
+
dir = dirname8(dir);
|
|
69055
69185
|
}
|
|
69056
69186
|
return void 0;
|
|
69057
69187
|
}
|
|
@@ -69079,8 +69209,8 @@ function formatOutput(sections, hasDrift, values2) {
|
|
|
69079
69209
|
}
|
|
69080
69210
|
|
|
69081
69211
|
// src/commands/reconcile.ts
|
|
69082
|
-
import { readFileSync as readFileSync19, writeFileSync as writeFileSync5, existsSync as
|
|
69083
|
-
import { resolve as
|
|
69212
|
+
import { readFileSync as readFileSync19, writeFileSync as writeFileSync5, existsSync as existsSync18, mkdirSync as mkdirSync4 } from "node:fs";
|
|
69213
|
+
import { resolve as resolve22, dirname as dirname9, join as join10 } from "node:path";
|
|
69084
69214
|
import { parseArgs as parseArgs17 } from "node:util";
|
|
69085
69215
|
import { createHash as createHash4 } from "node:crypto";
|
|
69086
69216
|
function fail15(message) {
|
|
@@ -69099,7 +69229,7 @@ async function runReconcile(argv) {
|
|
|
69099
69229
|
});
|
|
69100
69230
|
const validation = validateArgs(values2, positionals);
|
|
69101
69231
|
if (validation) return validation;
|
|
69102
|
-
const resolvedPath =
|
|
69232
|
+
const resolvedPath = resolve22(positionals[0]);
|
|
69103
69233
|
const parsed = await parseSpec(resolvedPath);
|
|
69104
69234
|
if (!("ir" in parsed)) return parsed;
|
|
69105
69235
|
const asJson = values2.json === true;
|
|
@@ -69115,7 +69245,7 @@ function validateArgs(values2, positionals) {
|
|
|
69115
69245
|
return null;
|
|
69116
69246
|
}
|
|
69117
69247
|
async function parseSpec(resolvedPath) {
|
|
69118
|
-
if (!
|
|
69248
|
+
if (!existsSync18(resolvedPath)) return fail15(`Error: File not found: ${resolvedPath}`);
|
|
69119
69249
|
let content;
|
|
69120
69250
|
try {
|
|
69121
69251
|
content = readFileSync19(resolvedPath, "utf-8");
|
|
@@ -69127,9 +69257,9 @@ async function parseSpec(resolvedPath) {
|
|
|
69127
69257
|
return { ir: parseResult.ir };
|
|
69128
69258
|
}
|
|
69129
69259
|
function reconcileLocal(ir, specPath, asJson) {
|
|
69130
|
-
const projectDir =
|
|
69131
|
-
const domainDir =
|
|
69132
|
-
if (!
|
|
69260
|
+
const projectDir = dirname9(specPath);
|
|
69261
|
+
const domainDir = join10(projectDir, ".domain");
|
|
69262
|
+
if (!existsSync18(domainDir)) {
|
|
69133
69263
|
return buildNoChangesResult(asJson);
|
|
69134
69264
|
}
|
|
69135
69265
|
const category = classifyDrift(ir, specPath);
|
|
@@ -69141,8 +69271,8 @@ function reconcileLocal(ir, specPath, asJson) {
|
|
|
69141
69271
|
return buildResult4(outcome, category, asJson);
|
|
69142
69272
|
}
|
|
69143
69273
|
function reconcileFromEvent(ir, specPath, eventPath, asJson) {
|
|
69144
|
-
const resolvedEventPath =
|
|
69145
|
-
if (!
|
|
69274
|
+
const resolvedEventPath = resolve22(eventPath);
|
|
69275
|
+
if (!existsSync18(resolvedEventPath)) return fail15(`Error: Event file not found: ${resolvedEventPath}`);
|
|
69146
69276
|
let raw;
|
|
69147
69277
|
try {
|
|
69148
69278
|
raw = JSON.parse(readFileSync19(resolvedEventPath, "utf-8"));
|
|
@@ -69153,7 +69283,7 @@ function reconcileFromEvent(ir, specPath, eventPath, asJson) {
|
|
|
69153
69283
|
const eventPayload = raw;
|
|
69154
69284
|
const elements = validateAffectedElements(eventPayload.affectedElements);
|
|
69155
69285
|
if (typeof elements === "string") return fail15(elements);
|
|
69156
|
-
const projectDir =
|
|
69286
|
+
const projectDir = dirname9(specPath);
|
|
69157
69287
|
const category = classifyAffectedElements(ir, elements);
|
|
69158
69288
|
const outcome = categoryToOutcome(category);
|
|
69159
69289
|
writeReconcileEvent(projectDir, outcome, category);
|
|
@@ -69167,7 +69297,7 @@ function validateAffectedElements(value) {
|
|
|
69167
69297
|
}
|
|
69168
69298
|
function classifyDrift(ir, specPath) {
|
|
69169
69299
|
try {
|
|
69170
|
-
const domainDir =
|
|
69300
|
+
const domainDir = join10(dirname9(specPath), ".domain");
|
|
69171
69301
|
const reader = new SiftEventStreamReader();
|
|
69172
69302
|
const readResult = reader.read(domainDir);
|
|
69173
69303
|
if (readResult.eventsProcessed === 0 && readResult.errors.length > 0) return 2;
|
|
@@ -69209,7 +69339,7 @@ function categoryToOutcome(category) {
|
|
|
69209
69339
|
return "APPLIED";
|
|
69210
69340
|
}
|
|
69211
69341
|
function writeReconcileEvent(projectDir, outcome, category) {
|
|
69212
|
-
const eventDir =
|
|
69342
|
+
const eventDir = join10(projectDir, ".complai", "events", "moment");
|
|
69213
69343
|
mkdirSync4(eventDir, { recursive: true });
|
|
69214
69344
|
const event = {
|
|
69215
69345
|
eventId: `evt-reconcile-${Date.now()}`,
|
|
@@ -69223,19 +69353,19 @@ function writeReconcileEvent(projectDir, outcome, category) {
|
|
|
69223
69353
|
payload: { reconcileResult: outcome, cascadeCategory: category }
|
|
69224
69354
|
};
|
|
69225
69355
|
const fileName = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-") + ".jsonl";
|
|
69226
|
-
writeFileSync5(
|
|
69356
|
+
writeFileSync5(join10(eventDir, fileName), JSON.stringify(event) + "\n");
|
|
69227
69357
|
}
|
|
69228
69358
|
function updateFingerprint(domainDir, projectDir) {
|
|
69229
|
-
const fpDir =
|
|
69230
|
-
const fpPath =
|
|
69359
|
+
const fpDir = join10(projectDir, ".moment");
|
|
69360
|
+
const fpPath = join10(fpDir, ".upstream-fingerprint.json");
|
|
69231
69361
|
const hash = createHash4("sha256");
|
|
69232
69362
|
const { readdirSync: readdirSync3 } = __require("node:fs");
|
|
69233
69363
|
const files = readdirSync3(domainDir).filter((f) => f.endsWith(".jsonl")).sort();
|
|
69234
69364
|
for (const file of files) {
|
|
69235
|
-
hash.update(readFileSync19(
|
|
69365
|
+
hash.update(readFileSync19(join10(domainDir, file), "utf-8"));
|
|
69236
69366
|
}
|
|
69237
69367
|
const contentHash = hash.digest("hex");
|
|
69238
|
-
if (
|
|
69368
|
+
if (existsSync18(fpPath)) {
|
|
69239
69369
|
try {
|
|
69240
69370
|
const existing = JSON.parse(readFileSync19(fpPath, "utf-8"));
|
|
69241
69371
|
if (existing.sift?.contentHash === contentHash) return;
|
|
@@ -69271,16 +69401,16 @@ function buildResult4(outcome, category, asJson) {
|
|
|
69271
69401
|
}
|
|
69272
69402
|
|
|
69273
69403
|
// src/commands/simulate.ts
|
|
69274
|
-
import { readFileSync as readFileSync20,
|
|
69275
|
-
import { resolve as
|
|
69404
|
+
import { readFileSync as readFileSync20, writeFileSync as writeFileSync6, existsSync as existsSync19, mkdirSync as mkdirSync5 } from "node:fs";
|
|
69405
|
+
import { resolve as resolve23, join as join11 } from "node:path";
|
|
69276
69406
|
import { parseArgs as parseArgs18 } from "node:util";
|
|
69277
69407
|
var EMPTY13 = [];
|
|
69278
69408
|
function fail16(message) {
|
|
69279
69409
|
return { success: false, message, diagnostics: EMPTY13 };
|
|
69280
69410
|
}
|
|
69281
69411
|
function readMomentFile(filePath) {
|
|
69282
|
-
const resolvedPath =
|
|
69283
|
-
if (!
|
|
69412
|
+
const resolvedPath = resolve23(filePath);
|
|
69413
|
+
if (!existsSync19(resolvedPath)) return fail16(`Error: File not found: ${resolvedPath}`);
|
|
69284
69414
|
try {
|
|
69285
69415
|
return readFileSync20(resolvedPath, "utf-8");
|
|
69286
69416
|
} catch (err) {
|
|
@@ -69310,8 +69440,13 @@ ${lines.join("\n\n")}`,
|
|
|
69310
69440
|
scenarios
|
|
69311
69441
|
};
|
|
69312
69442
|
}
|
|
69443
|
+
function writeSafe(baseDir, filename, content) {
|
|
69444
|
+
const fullPath = join11(baseDir, filename);
|
|
69445
|
+
assertPathWithin(fullPath, baseDir);
|
|
69446
|
+
writeFileSync6(fullPath, content, "utf-8");
|
|
69447
|
+
}
|
|
69313
69448
|
function writeOutputFiles3(groups, ir, outDir) {
|
|
69314
|
-
const resolvedDir =
|
|
69449
|
+
const resolvedDir = resolve23(outDir);
|
|
69315
69450
|
mkdirSync5(resolvedDir, { recursive: true });
|
|
69316
69451
|
const topoEmitter = new TopologyEmitter();
|
|
69317
69452
|
const manifestFlows = [];
|
|
@@ -69321,15 +69456,11 @@ function writeOutputFiles3(groups, ir, outDir) {
|
|
|
69321
69456
|
const flowSlug = kebab3(group.flow.name);
|
|
69322
69457
|
const topology = topoEmitter.emit(ir, group.flow);
|
|
69323
69458
|
const topologyFile = `topology-${flowSlug}.json`;
|
|
69324
|
-
|
|
69325
|
-
join10(resolvedDir, topologyFile),
|
|
69326
|
-
JSON.stringify(topology, null, 2) + "\n",
|
|
69327
|
-
"utf-8"
|
|
69328
|
-
);
|
|
69459
|
+
writeSafe(resolvedDir, topologyFile, JSON.stringify(topology, null, 2) + "\n");
|
|
69329
69460
|
const manifestScenarios = [];
|
|
69330
69461
|
for (const scenario of group.scenarios) {
|
|
69331
69462
|
const fileName = `${scenario.scenarioId}.json`;
|
|
69332
|
-
|
|
69463
|
+
writeSafe(resolvedDir, fileName, JSON.stringify(scenario, null, 2) + "\n");
|
|
69333
69464
|
totalScenarios++;
|
|
69334
69465
|
totalEvents += scenario.events.length;
|
|
69335
69466
|
manifestScenarios.push({
|
|
@@ -69353,11 +69484,7 @@ function writeOutputFiles3(groups, ir, outDir) {
|
|
|
69353
69484
|
}
|
|
69354
69485
|
const artifacts = writeArtifacts(ir, resolvedDir);
|
|
69355
69486
|
const manifest = { flows: manifestFlows, artifacts };
|
|
69356
|
-
|
|
69357
|
-
join10(resolvedDir, "manifest.json"),
|
|
69358
|
-
JSON.stringify(manifest, null, 2) + "\n",
|
|
69359
|
-
"utf-8"
|
|
69360
|
-
);
|
|
69487
|
+
writeSafe(resolvedDir, "manifest.json", JSON.stringify(manifest, null, 2) + "\n");
|
|
69361
69488
|
return {
|
|
69362
69489
|
success: true,
|
|
69363
69490
|
message: `Wrote ${groups.length} topology file(s), ${totalScenarios} scenario file(s), ${Object.keys(artifacts).length} artifact(s), manifest.json to ${resolvedDir} (${totalEvents} total events)`,
|
|
@@ -69368,29 +69495,33 @@ function writeArtifacts(ir, outDir) {
|
|
|
69368
69495
|
const files = {};
|
|
69369
69496
|
const catalog = generateEventCatalog(ir);
|
|
69370
69497
|
files.eventCatalog = "event-catalog.json";
|
|
69371
|
-
|
|
69498
|
+
writeSafe(outDir, files.eventCatalog, JSON.stringify(catalog, null, 2) + "\n");
|
|
69372
69499
|
const impact = generateImpactAnalysis(ir);
|
|
69373
69500
|
files.impactAnalysis = "impact-analysis.json";
|
|
69374
|
-
|
|
69375
|
-
join10(outDir, files.impactAnalysis),
|
|
69376
|
-
JSON.stringify(impact, null, 2) + "\n",
|
|
69377
|
-
"utf-8"
|
|
69378
|
-
);
|
|
69501
|
+
writeSafe(outDir, files.impactAnalysis, JSON.stringify(impact, null, 2) + "\n");
|
|
69379
69502
|
const sagas = generateSagaStateMachines(ir);
|
|
69380
69503
|
files.sagaStateMachines = "saga-state-machines.json";
|
|
69381
|
-
|
|
69382
|
-
join10(outDir, files.sagaStateMachines),
|
|
69383
|
-
JSON.stringify(sagas, null, 2) + "\n",
|
|
69384
|
-
"utf-8"
|
|
69385
|
-
);
|
|
69504
|
+
writeSafe(outDir, files.sagaStateMachines, JSON.stringify(sagas, null, 2) + "\n");
|
|
69386
69505
|
const asyncapi = generateAsyncApiSpec(ir);
|
|
69387
69506
|
files.asyncApi = "asyncapi.yaml";
|
|
69388
|
-
|
|
69507
|
+
writeSafe(outDir, files.asyncApi, asyncapi);
|
|
69389
69508
|
return files;
|
|
69390
69509
|
}
|
|
69391
69510
|
function kebab3(s) {
|
|
69392
69511
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
69393
69512
|
}
|
|
69513
|
+
function runOutDirWrite(flows, ir, outDir, includeAll) {
|
|
69514
|
+
const groups = flows.map((flow) => ({
|
|
69515
|
+
flow,
|
|
69516
|
+
scenarios: includeAll ? [...generateAllScenarios(ir, flow), ...deriveNegativeScenarios(ir, flow)] : [generateSimulationScenario(ir, flow)]
|
|
69517
|
+
}));
|
|
69518
|
+
try {
|
|
69519
|
+
return writeOutputFiles3(groups, ir, outDir);
|
|
69520
|
+
} catch (err) {
|
|
69521
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
69522
|
+
return fail16(msg);
|
|
69523
|
+
}
|
|
69524
|
+
}
|
|
69394
69525
|
async function runSimulate(argv) {
|
|
69395
69526
|
const { values: values2, positionals } = parseArgs18({
|
|
69396
69527
|
args: argv,
|
|
@@ -69417,11 +69548,11 @@ async function runSimulate(argv) {
|
|
|
69417
69548
|
success: false,
|
|
69418
69549
|
message: `Parse failed with ${parseResult.diagnostics.length} diagnostic(s)`,
|
|
69419
69550
|
diagnostics: parseResult.diagnostics,
|
|
69420
|
-
filePath:
|
|
69551
|
+
filePath: resolve23(filePath)
|
|
69421
69552
|
};
|
|
69422
69553
|
}
|
|
69423
69554
|
const ir = parseResult.ir;
|
|
69424
|
-
updateManifestFromIr(
|
|
69555
|
+
updateManifestFromIr(resolve23(filePath), ir);
|
|
69425
69556
|
if (ir.flows.length === 0) {
|
|
69426
69557
|
return fail16("No flows found. Simulation requires at least one flow.");
|
|
69427
69558
|
}
|
|
@@ -69431,11 +69562,7 @@ async function runSimulate(argv) {
|
|
|
69431
69562
|
}
|
|
69432
69563
|
const outDir = values2["out-dir"];
|
|
69433
69564
|
if (outDir) {
|
|
69434
|
-
|
|
69435
|
-
flow,
|
|
69436
|
-
scenarios: values2.all ? [...generateAllScenarios(ir, flow), ...deriveNegativeScenarios(ir, flow)] : [generateSimulationScenario(ir, flow)]
|
|
69437
|
-
}));
|
|
69438
|
-
return writeOutputFiles3(groups, ir, outDir);
|
|
69565
|
+
return runOutDirWrite(targetFlows, ir, outDir, values2.all === true);
|
|
69439
69566
|
}
|
|
69440
69567
|
const scenarios = values2.all ? targetFlows.flatMap((flow) => [
|
|
69441
69568
|
...generateAllScenarios(ir, flow),
|
|
@@ -69516,18 +69643,18 @@ async function pollForToken(deviceCode, interval, expiresIn, callbacks) {
|
|
|
69516
69643
|
throw new Error("Device code expired. Please try again.");
|
|
69517
69644
|
}
|
|
69518
69645
|
function sleep2(ms) {
|
|
69519
|
-
return new Promise((
|
|
69646
|
+
return new Promise((resolve24) => setTimeout(resolve24, ms));
|
|
69520
69647
|
}
|
|
69521
69648
|
|
|
69522
69649
|
// src/auth/token-storage.ts
|
|
69523
|
-
import { readFile as
|
|
69524
|
-
import { dirname as
|
|
69650
|
+
import { readFile as readFile10, writeFile, mkdir, unlink, stat as stat4, chmod } from "node:fs/promises";
|
|
69651
|
+
import { dirname as dirname10, join as join12 } from "node:path";
|
|
69525
69652
|
import { homedir } from "node:os";
|
|
69526
|
-
var MOMENT_DIR =
|
|
69527
|
-
var CREDENTIALS_PATH =
|
|
69653
|
+
var MOMENT_DIR = join12(homedir(), ".moment");
|
|
69654
|
+
var CREDENTIALS_PATH = join12(MOMENT_DIR, "credentials.json");
|
|
69528
69655
|
async function storeToken(token, tokenType, scope, credentialsPath) {
|
|
69529
69656
|
const filePath = credentialsPath ?? CREDENTIALS_PATH;
|
|
69530
|
-
const dir =
|
|
69657
|
+
const dir = dirname10(filePath);
|
|
69531
69658
|
await mkdir(dir, { recursive: true, mode: 448 });
|
|
69532
69659
|
const stored = {
|
|
69533
69660
|
token,
|
|
@@ -69550,7 +69677,7 @@ async function readStoredTokenResult(credentialsPath) {
|
|
|
69550
69677
|
if ((mode & 63) !== 0) {
|
|
69551
69678
|
return { status: "insecure", path: filePath };
|
|
69552
69679
|
}
|
|
69553
|
-
const raw = await
|
|
69680
|
+
const raw = await readFile10(filePath, "utf-8");
|
|
69554
69681
|
const stored = JSON.parse(raw);
|
|
69555
69682
|
if (!stored.token) return { status: "missing" };
|
|
69556
69683
|
return { status: "ok", credentials: stored };
|