@mmmnt/cli 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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: sep2, value } = collItem;
3997
+ const { start, key, sep: sep3, value } = collItem;
3998
3998
  const keyProps = resolveProps.resolveProps(start, {
3999
3999
  indicator: "explicit-key-ind",
4000
- next: key ?? sep2?.[0],
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 && !sep2) {
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(sep2 ?? [], {
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, sep2, null, valueProps, onError);
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 sep2 = "";
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 += sep2 + cb;
4160
- sep2 = "";
4159
+ comment += sep3 + cb;
4160
+ sep3 = "";
4161
4161
  break;
4162
4162
  }
4163
4163
  case "newline":
4164
4164
  if (comment)
4165
- sep2 += source;
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: sep2, value } = collItem;
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 ?? sep2?.[0],
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 && !sep2 && !value) {
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 && !sep2 && !props.found) {
4274
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep2, null, props, onError);
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(sep2 ?? [], {
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 (sep2)
4298
- for (const st of sep2) {
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, sep2, null, valueProps, onError) : null;
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 sep2 = "";
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 += sep2 + indent.slice(trimIndent) + content;
4513
- sep2 = "\n";
4512
+ value += sep3 + indent.slice(trimIndent) + content;
4513
+ sep3 = "\n";
4514
4514
  } else if (indent.length > trimIndent || content[0] === " ") {
4515
- if (sep2 === " ")
4516
- sep2 = "\n";
4517
- else if (!prevMoreIndented && sep2 === "\n")
4518
- sep2 = "\n\n";
4519
- value += sep2 + indent.slice(trimIndent) + content;
4520
- sep2 = "\n";
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 (sep2 === "\n")
4523
+ if (sep3 === "\n")
4524
4524
  value += "\n";
4525
4525
  else
4526
- sep2 = "\n";
4526
+ sep3 = "\n";
4527
4527
  } else {
4528
- value += sep2 + content;
4529
- sep2 = " ";
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 sep2 = " ";
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 (sep2 === "\n")
4717
- res += sep2;
4716
+ if (sep3 === "\n")
4717
+ res += sep3;
4718
4718
  else
4719
- sep2 = "\n";
4719
+ sep3 = "\n";
4720
4720
  } else {
4721
- res += sep2 + match[1];
4722
- sep2 = " ";
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 + sep2 + (match?.[1] ?? "");
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: sep2, value }) {
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 (sep2)
5543
- for (const st of sep2)
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 sep2;
6693
+ let sep3;
6694
6694
  if (scalar.end) {
6695
- sep2 = scalar.end;
6696
- sep2.push(this.sourceToken);
6695
+ sep3 = scalar.end;
6696
+ sep3.push(this.sourceToken);
6697
6697
  delete scalar.end;
6698
6698
  } else
6699
- sep2 = [this.sourceToken];
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: sep2 }]
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 sep2 = it.sep;
6858
- sep2.push(this.sourceToken);
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: sep2 }]
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 sep2 = fc.end.splice(1, fc.end.length);
7060
- sep2.push(this.sourceToken);
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: sep2 }]
7065
+ items: [{ start, key: fc, sep: sep3 }]
7066
7066
  };
7067
7067
  this.onKeyLine = true;
7068
7068
  this.stack[this.stack.length - 1] = map2;
@@ -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 join12(...args2) {
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(join12(gitdir, key), `${value.trim()}
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(join12(gitdir, ref), `${value.trim()}
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(join12(gitdir, ref), `ref: ${value.trim()}
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(join12(gitdir, ref))));
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(join12(gitdir, "objects/pack"));
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(join12(filepath, entry2.path), entry2);
27617
+ map2.set(join13(filepath, entry2.path), entry2);
27618
27618
  }
27619
- return tree.entries().map((entry2) => join12(filepath, entry2.path));
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(join12(dir, filepath));
27710
+ const names = await fs2.readdir(join13(dir, filepath));
27711
27711
  if (names === null) return null;
27712
- return names.map((name) => join12(filepath, 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 = join12(filepath, entry);
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);
@@ -28235,7 +28235,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
28235
28235
  if (isAbsolute4(submoduleGitdir)) {
28236
28236
  return submoduleGitdir;
28237
28237
  }
28238
- const gitdir = join12(dirname12(dotgit), submoduleGitdir);
28238
+ const gitdir = join13(dirname12(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 = join12(dir, ".git"),
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 = join12(dir, ".git"), filepath }) {
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 = join12(gitdir, "info", "exclude");
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: join12(dir, ".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: join12(dir, folder, ".gitignore"),
28360
+ gitignore: join13(dir, folder, ".gitignore"),
28361
28361
  filepath: file
28362
28362
  });
28363
28363
  }
@@ -28444,7 +28444,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
28444
28444
  async function add({
28445
28445
  fs: _fs,
28446
28446
  dir,
28447
- gitdir = join12(dir, ".git"),
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(join12(dir, currentFilepath));
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(join12(dir, currentFilepath));
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: [join12(currentFilepath, child)],
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: [join12(currentFilepath, child)],
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(join12(dir, currentFilepath)).then(posixifyPathBuffer) : await fs2.read(join12(dir, currentFilepath), { autocrlf });
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, filepath);
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(join12(dir, filepath))
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 = join12(dir, op.filepath);
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 = join12(dir, ".git"),
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, sep2, expected) {
30708
- const split = line.trim().split(sep2);
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 = join12(gitdir, "shallow");
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 = join12(gitdir, "shallow");
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(join12(gitdir, "objects/pack"));
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}`;
@@ -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 = join12(gitdir, res.packfile);
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 : join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"), ref }) {
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 = join12(dir, ".git"),
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 = join12(dir, ".git"), ref }) {
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(join12(gitdir, "objects/pack"));
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 = join12(dir, ".git"),
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 = join12(dir, ".git"), ref }) {
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
32387
+ gitdir = join13(dir, ".git"),
32388
32388
  oids,
32389
32389
  cache = {}
32390
32390
  }) {
@@ -32406,7 +32406,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
32406
32406
  }
32407
32407
  }
32408
32408
  async function _findRoot({ fs: fs2, filepath }) {
32409
- if (await fs2.exists(join12(filepath, ".git"))) {
32409
+ if (await fs2.exists(join13(filepath, ".git"))) {
32410
32410
  return filepath;
32411
32411
  } else {
32412
32412
  const parent = dirname12(filepath);
@@ -32426,7 +32426,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
32426
32426
  throw err;
32427
32427
  }
32428
32428
  }
32429
- async function getConfig({ fs: fs2, dir, gitdir = join12(dir, ".git"), path }) {
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 = join12(dir, ".git"),
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 = join12(dir, 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 = join12(dir, ".git"),
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 : join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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: join12(prefix, entry.path)
32879
+ prefix: join13(prefix, entry.path)
32880
32880
  });
32881
32881
  } else {
32882
- filenames.push(join12(prefix, entry.path));
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git") }) {
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 = join12(dir, ".git") }) {
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 = join12(parentPath, entry.path);
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: join12(parentPath, entry.path)
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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(join12(gitdir, `objects/pack/${filename}`), packfile);
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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(join12(dir, filepath));
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(join12(dir, filepath));
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git") }) {
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 join12(this.gitdir, _GitStashManager.refStash);
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 join12(this.gitdir, _GitStashManager.refLogsStash);
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 = join12(dir, ".git"),
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) => join12(updatedGitdir, f)).forEach(async (folder) => {
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 = join12(dir, ".git"),
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(join12(dir, filepath));
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(join12(dir, filepath));
34998
+ const object = await fs2.read(join13(dir, filepath));
34999
34999
  const workdirOid = await hashObject$1({
35000
35000
  gitdir: updatedGitdir,
35001
35001
  type: "blob",
@@ -35086,7 +35086,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
35086
35086
  async function statusMatrix({
35087
35087
  fs: _fs,
35088
35088
  dir,
35089
- gitdir = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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(join12(dir, filepath));
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(join12(dir, filepath));
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(join12(dir, filepath)) : await fs2.read(join12(dir, filepath));
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 = join12(dir, ".git"),
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 = join12(dir, ".git"), blob }) {
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"),
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 = join12(dir, ".git"), tag: tag2 }) {
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 = join12(dir, ".git"), tree }) {
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);
@@ -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 sep2 = tokenRef(atn, rule, repetition2.separator, repetition2);
48485
- return star(atn, rule, repetition2, handle, sep2);
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 sep2 = tokenRef(atn, rule, repetition2.separator, repetition2);
48502
- return plus(atn, rule, repetition2, handle, sep2);
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, sep2) {
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, sep2 ? "RepetitionMandatoryWithSeparator" : "RepetitionMandatory", plus2.idx)] = loop;
48543
+ atn.decisionMap[buildATNKey(rule, sep3 ? "RepetitionMandatoryWithSeparator" : "RepetitionMandatory", plus2.idx)] = loop;
48544
48544
  epsilon(blkEnd, loop);
48545
- if (sep2 === void 0) {
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, sep2.left);
48551
- epsilon(sep2.right, blkStart);
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, sep2) {
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 (sep2 !== void 0) {
48576
+ if (sep3 !== void 0) {
48577
48577
  epsilon(loop, loopEnd);
48578
- epsilon(loop, sep2.left);
48579
- epsilon(sep2.right, start);
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, sep2 ? "RepetitionWithSeparator" : "Repetition", star2.idx)] = entry;
48583
+ atn.decisionMap[buildATNKey(rule, sep3 ? "RepetitionWithSeparator" : "Repetition", star2.idx)] = entry;
48584
48584
  return {
48585
48585
  left: entry,
48586
48586
  right: loopEnd
@@ -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 readFileSync4, existsSync as existsSync4, watch as watch2 } from "node:fs";
62733
- import { resolve as resolve8 } from "node:path";
62732
+ import { readFileSync as readFileSync4, 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
 
@@ -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(readFileSync4(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 { success: false, message: "Usage: moment serve <file.moment> [--port 4321] [--all]" };
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: File not found: ${resolvedPath}` };
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 runPipeline(resolvedPath, includeAll);
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(`Serving ${resolvedPath} on ws://localhost:${port}`);
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 = setupFileWatcher(
64196
- resolvedPath,
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 {
@@ -67755,7 +67955,7 @@ var LocalGitArtifactStore = class {
67755
67955
 
67756
67956
  // ../sync/dist/services/sift-event-stream-reader.js
67757
67957
  import { readFileSync as readFileSync11, readdirSync as readdirSync2, existsSync as existsSync11 } from "node:fs";
67758
- import { join as join6 } from "node:path";
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 = join6(domainDir, file);
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);
@@ -68796,7 +68996,7 @@ function buildResult2(issues, hasParseErrors, asJson) {
68796
68996
 
68797
68997
  // src/commands/import-from-sift.ts
68798
68998
  import { readFileSync as readFileSync17, writeFileSync as writeFileSync4, existsSync as existsSync17, mkdirSync as mkdirSync3 } from "node:fs";
68799
- import { resolve as resolve21, dirname as dirname8, join as join7 } from "node:path";
68999
+ import { resolve as resolve21, dirname as dirname8, join as join8 } from "node:path";
68800
69000
  import { parseArgs as parseArgs15 } from "node:util";
68801
69001
  import { createHash as createHash3 } from "node:crypto";
68802
69002
  var EMPTY12 = [];
@@ -68850,10 +69050,10 @@ function assertPathWithin2(filePath, baseDir) {
68850
69050
  }
68851
69051
  function writeOutputFiles2(importer, input, outDir) {
68852
69052
  let count = 0;
68853
- const momentDir = join7(outDir, ".moment");
69053
+ const momentDir = join8(outDir, ".moment");
68854
69054
  for (const block2 of input.buildingBlocks) {
68855
69055
  const fileName = sanitizeFileName(block2.contextName);
68856
- const filePath = join7(momentDir, "contexts", `${fileName}.moment`);
69056
+ const filePath = join8(momentDir, "contexts", `${fileName}.moment`);
68857
69057
  assertPathWithin2(filePath, momentDir);
68858
69058
  mkdirSync3(dirname8(filePath), { recursive: true });
68859
69059
  writeFileSync4(filePath, importer.generateContextFile(block2));
@@ -68863,8 +69063,8 @@ function writeOutputFiles2(importer, input, outDir) {
68863
69063
  }
68864
69064
  function writeFingerprint(siftInput, importResult, domainDir, outDir) {
68865
69065
  const contentHash = computeDomainHash(domainDir);
68866
- const fpDir = join7(outDir, ".moment");
68867
- const fpPath = join7(fpDir, ".upstream-fingerprint.json");
69066
+ const fpDir = join8(outDir, ".moment");
69067
+ const fpPath = join8(fpDir, ".upstream-fingerprint.json");
68868
69068
  if (existsSync17(fpPath)) {
68869
69069
  try {
68870
69070
  const existing = JSON.parse(readFileSync17(fpPath, "utf-8"));
@@ -68890,7 +69090,7 @@ function computeDomainHash(domainDir) {
68890
69090
  const files = readdirSync3(domainDir).filter((f) => f.endsWith(".jsonl")).sort();
68891
69091
  const hash = createHash3("sha256");
68892
69092
  for (const file of files) {
68893
- hash.update(readFileSync17(join7(domainDir, file), "utf-8"));
69093
+ hash.update(readFileSync17(join8(domainDir, file), "utf-8"));
68894
69094
  }
68895
69095
  return hash.digest("hex");
68896
69096
  }
@@ -68923,7 +69123,7 @@ function buildResult3(importResult, filesWritten, eventsProcessed, filesRead, as
68923
69123
 
68924
69124
  // src/commands/status.ts
68925
69125
  import { readFileSync as readFileSync18, existsSync as existsSync18 } from "node:fs";
68926
- import { resolve as resolve22, dirname as dirname9, join as join8 } from "node:path";
69126
+ import { resolve as resolve22, dirname as dirname9, join as join9 } from "node:path";
68927
69127
  import { parseArgs as parseArgs16 } from "node:util";
68928
69128
  function fail14(message) {
68929
69129
  return { success: false, hasDrift: false, message, sections: [] };
@@ -69027,8 +69227,8 @@ function buildSchemaSection(ir) {
69027
69227
  }
69028
69228
  function buildUpstreamSection(resolvedPath) {
69029
69229
  const projectDir = dirname9(resolvedPath);
69030
- const domainDir = join8(projectDir, ".domain");
69031
- const fpPath = join8(projectDir, ".moment", ".upstream-fingerprint.json");
69230
+ const domainDir = join9(projectDir, ".domain");
69231
+ const fpPath = join9(projectDir, ".moment", ".upstream-fingerprint.json");
69032
69232
  if (!existsSync18(domainDir)) {
69033
69233
  return { label: "Upstream Source", state: "ok", summary: "No upstream source configured" };
69034
69234
  }
@@ -69050,7 +69250,7 @@ function buildUpstreamSection(resolvedPath) {
69050
69250
  function findGitRoot2(startDir) {
69051
69251
  let dir = resolve22(startDir);
69052
69252
  while (dir !== dirname9(dir)) {
69053
- if (existsSync18(join8(dir, ".git"))) return dir;
69253
+ if (existsSync18(join9(dir, ".git"))) return dir;
69054
69254
  dir = dirname9(dir);
69055
69255
  }
69056
69256
  return void 0;
@@ -69080,7 +69280,7 @@ function formatOutput(sections, hasDrift, values2) {
69080
69280
 
69081
69281
  // src/commands/reconcile.ts
69082
69282
  import { readFileSync as readFileSync19, writeFileSync as writeFileSync5, existsSync as existsSync19, mkdirSync as mkdirSync4 } from "node:fs";
69083
- import { resolve as resolve23, dirname as dirname10, join as join9 } from "node:path";
69283
+ import { resolve as resolve23, dirname as dirname10, join as join10 } from "node:path";
69084
69284
  import { parseArgs as parseArgs17 } from "node:util";
69085
69285
  import { createHash as createHash4 } from "node:crypto";
69086
69286
  function fail15(message) {
@@ -69128,7 +69328,7 @@ async function parseSpec(resolvedPath) {
69128
69328
  }
69129
69329
  function reconcileLocal(ir, specPath, asJson) {
69130
69330
  const projectDir = dirname10(specPath);
69131
- const domainDir = join9(projectDir, ".domain");
69331
+ const domainDir = join10(projectDir, ".domain");
69132
69332
  if (!existsSync19(domainDir)) {
69133
69333
  return buildNoChangesResult(asJson);
69134
69334
  }
@@ -69167,7 +69367,7 @@ function validateAffectedElements(value) {
69167
69367
  }
69168
69368
  function classifyDrift(ir, specPath) {
69169
69369
  try {
69170
- const domainDir = join9(dirname10(specPath), ".domain");
69370
+ const domainDir = join10(dirname10(specPath), ".domain");
69171
69371
  const reader = new SiftEventStreamReader();
69172
69372
  const readResult = reader.read(domainDir);
69173
69373
  if (readResult.eventsProcessed === 0 && readResult.errors.length > 0) return 2;
@@ -69209,7 +69409,7 @@ function categoryToOutcome(category) {
69209
69409
  return "APPLIED";
69210
69410
  }
69211
69411
  function writeReconcileEvent(projectDir, outcome, category) {
69212
- const eventDir = join9(projectDir, ".complai", "events", "moment");
69412
+ const eventDir = join10(projectDir, ".complai", "events", "moment");
69213
69413
  mkdirSync4(eventDir, { recursive: true });
69214
69414
  const event = {
69215
69415
  eventId: `evt-reconcile-${Date.now()}`,
@@ -69223,16 +69423,16 @@ function writeReconcileEvent(projectDir, outcome, category) {
69223
69423
  payload: { reconcileResult: outcome, cascadeCategory: category }
69224
69424
  };
69225
69425
  const fileName = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-") + ".jsonl";
69226
- writeFileSync5(join9(eventDir, fileName), JSON.stringify(event) + "\n");
69426
+ writeFileSync5(join10(eventDir, fileName), JSON.stringify(event) + "\n");
69227
69427
  }
69228
69428
  function updateFingerprint(domainDir, projectDir) {
69229
- const fpDir = join9(projectDir, ".moment");
69230
- const fpPath = join9(fpDir, ".upstream-fingerprint.json");
69429
+ const fpDir = join10(projectDir, ".moment");
69430
+ const fpPath = join10(fpDir, ".upstream-fingerprint.json");
69231
69431
  const hash = createHash4("sha256");
69232
69432
  const { readdirSync: readdirSync3 } = __require("node:fs");
69233
69433
  const files = readdirSync3(domainDir).filter((f) => f.endsWith(".jsonl")).sort();
69234
69434
  for (const file of files) {
69235
- hash.update(readFileSync19(join9(domainDir, file), "utf-8"));
69435
+ hash.update(readFileSync19(join10(domainDir, file), "utf-8"));
69236
69436
  }
69237
69437
  const contentHash = hash.digest("hex");
69238
69438
  if (existsSync19(fpPath)) {
@@ -69272,7 +69472,7 @@ function buildResult4(outcome, category, asJson) {
69272
69472
 
69273
69473
  // src/commands/simulate.ts
69274
69474
  import { readFileSync as readFileSync20, existsSync as existsSync20, writeFileSync as writeFileSync6, mkdirSync as mkdirSync5 } from "node:fs";
69275
- import { resolve as resolve24, join as join10 } from "node:path";
69475
+ import { resolve as resolve24, join as join11 } from "node:path";
69276
69476
  import { parseArgs as parseArgs18 } from "node:util";
69277
69477
  var EMPTY13 = [];
69278
69478
  function fail16(message) {
@@ -69322,14 +69522,14 @@ function writeOutputFiles3(groups, ir, outDir) {
69322
69522
  const topology = topoEmitter.emit(ir, group.flow);
69323
69523
  const topologyFile = `topology-${flowSlug}.json`;
69324
69524
  writeFileSync6(
69325
- join10(resolvedDir, topologyFile),
69525
+ join11(resolvedDir, topologyFile),
69326
69526
  JSON.stringify(topology, null, 2) + "\n",
69327
69527
  "utf-8"
69328
69528
  );
69329
69529
  const manifestScenarios = [];
69330
69530
  for (const scenario of group.scenarios) {
69331
69531
  const fileName = `${scenario.scenarioId}.json`;
69332
- writeFileSync6(join10(resolvedDir, fileName), JSON.stringify(scenario, null, 2) + "\n", "utf-8");
69532
+ writeFileSync6(join11(resolvedDir, fileName), JSON.stringify(scenario, null, 2) + "\n", "utf-8");
69333
69533
  totalScenarios++;
69334
69534
  totalEvents += scenario.events.length;
69335
69535
  manifestScenarios.push({
@@ -69354,7 +69554,7 @@ function writeOutputFiles3(groups, ir, outDir) {
69354
69554
  const artifacts = writeArtifacts(ir, resolvedDir);
69355
69555
  const manifest = { flows: manifestFlows, artifacts };
69356
69556
  writeFileSync6(
69357
- join10(resolvedDir, "manifest.json"),
69557
+ join11(resolvedDir, "manifest.json"),
69358
69558
  JSON.stringify(manifest, null, 2) + "\n",
69359
69559
  "utf-8"
69360
69560
  );
@@ -69368,24 +69568,24 @@ function writeArtifacts(ir, outDir) {
69368
69568
  const files = {};
69369
69569
  const catalog = generateEventCatalog(ir);
69370
69570
  files.eventCatalog = "event-catalog.json";
69371
- writeFileSync6(join10(outDir, files.eventCatalog), JSON.stringify(catalog, null, 2) + "\n", "utf-8");
69571
+ writeFileSync6(join11(outDir, files.eventCatalog), JSON.stringify(catalog, null, 2) + "\n", "utf-8");
69372
69572
  const impact = generateImpactAnalysis(ir);
69373
69573
  files.impactAnalysis = "impact-analysis.json";
69374
69574
  writeFileSync6(
69375
- join10(outDir, files.impactAnalysis),
69575
+ join11(outDir, files.impactAnalysis),
69376
69576
  JSON.stringify(impact, null, 2) + "\n",
69377
69577
  "utf-8"
69378
69578
  );
69379
69579
  const sagas = generateSagaStateMachines(ir);
69380
69580
  files.sagaStateMachines = "saga-state-machines.json";
69381
69581
  writeFileSync6(
69382
- join10(outDir, files.sagaStateMachines),
69582
+ join11(outDir, files.sagaStateMachines),
69383
69583
  JSON.stringify(sagas, null, 2) + "\n",
69384
69584
  "utf-8"
69385
69585
  );
69386
69586
  const asyncapi = generateAsyncApiSpec(ir);
69387
69587
  files.asyncApi = "asyncapi.yaml";
69388
- writeFileSync6(join10(outDir, files.asyncApi), asyncapi, "utf-8");
69588
+ writeFileSync6(join11(outDir, files.asyncApi), asyncapi, "utf-8");
69389
69589
  return files;
69390
69590
  }
69391
69591
  function kebab3(s) {
@@ -69521,10 +69721,10 @@ function sleep2(ms) {
69521
69721
 
69522
69722
  // src/auth/token-storage.ts
69523
69723
  import { readFile as readFile11, writeFile, mkdir, unlink, stat as stat4, chmod } from "node:fs/promises";
69524
- import { dirname as dirname11, join as join11 } from "node:path";
69724
+ import { dirname as dirname11, join as join12 } from "node:path";
69525
69725
  import { homedir } from "node:os";
69526
- var MOMENT_DIR = join11(homedir(), ".moment");
69527
- var CREDENTIALS_PATH = join11(MOMENT_DIR, "credentials.json");
69726
+ var MOMENT_DIR = join12(homedir(), ".moment");
69727
+ var CREDENTIALS_PATH = join12(MOMENT_DIR, "credentials.json");
69528
69728
  async function storeToken(token, tokenType, scope, credentialsPath) {
69529
69729
  const filePath = credentialsPath ?? CREDENTIALS_PATH;
69530
69730
  const dir = dirname11(filePath);