@mmmnt/cli 0.3.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/dist/moment.mjs CHANGED
@@ -8341,8 +8341,8 @@ var require_semaphore = __commonJS({
8341
8341
  this._waiting = [];
8342
8342
  }
8343
8343
  lock(thunk) {
8344
- return new Promise((resolve25, reject2) => {
8345
- this._waiting.push({ thunk, resolve: resolve25, reject: reject2 });
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 (resolve25, reject2) => {
9835
+ return new Promise(async (resolve24, reject2) => {
9836
9836
  const resolveWithCleanup = (r) => {
9837
- resolve25(r);
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((resolve25, reject2) => {
10248
+ return new Promise((resolve24, reject2) => {
10249
10249
  const callback = (error) => {
10250
10250
  if (error === void 0 || error === null) {
10251
- resolve25();
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((resolve25, _reject) => {
10504
- connectResolve = resolve25;
10503
+ const connected = new Promise((resolve24, _reject) => {
10504
+ connectResolve = resolve24;
10505
10505
  });
10506
- return new Promise((resolve25, reject2) => {
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
- resolve25({
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((resolve25, _reject) => {
10537
- connectResolve = resolve25;
10536
+ const connected = new Promise((resolve24, _reject) => {
10537
+ connectResolve = resolve24;
10538
10538
  });
10539
- return new Promise((resolve25, reject2) => {
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
- resolve25({
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(resolve25, reject2) {
17285
- deferredResolve = resolve25;
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(resolve25, reject2) {
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
- resolve25(ret);
17439
+ resolve24(ret);
17440
17440
  }
17441
17441
  });
17442
17442
  } else {
17443
- resolve25(fnx());
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((resolve25, reject2) => {
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
- resolve25(result);
23499
+ resolve24(result);
23500
23500
  }
23501
23501
  } else {
23502
- resolve25(result);
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
- resolve25(result);
23510
+ resolve24(result);
23511
23511
  }
23512
23512
  });
23513
23513
  } else {
23514
- args2.push(resolve25);
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 dirname12(path) {
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(dirname12(name));
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(dirname12(name)),
24895
+ parent: mkdir2(dirname11(name)),
24896
24896
  children: []
24897
24897
  };
24898
24898
  if (file.parent) file.parent.children.push(file);
@@ -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(dirname12(filepath));
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 = dirname12(filepath);
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 = join13(dirname12(dotgit), submoduleGitdir);
28238
+ const gitdir = join13(dirname11(dotgit), submoduleGitdir);
28239
28239
  return gitdir;
28240
28240
  });
28241
28241
  } else {
@@ -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 = dirname12(p.filepath);
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;
@@ -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 resolve25 = this._waiting;
31053
+ const resolve24 = this._waiting;
31054
31054
  this._waiting = null;
31055
- resolve25({ value: chunk });
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 resolve25 = this._waiting;
31063
+ const resolve24 = this._waiting;
31064
31064
  this._waiting = null;
31065
- resolve25({ done: true });
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((resolve25) => {
31085
- this._waiting = resolve25;
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((resolve25, reject2) => {
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) : resolve25({ shallows, unshallows, acks, nak, packfile, progress });
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) : resolve25({ shallows, unshallows, acks, nak, packfile, progress });
31270
+ stream2.error ? reject2(stream2.error) : resolve24({ shallows, unshallows, acks, nak, packfile, progress });
31271
31271
  }
31272
31272
  });
31273
31273
  });
@@ -32409,7 +32409,7 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
32409
32409
  if (await fs2.exists(join13(filepath, ".git"))) {
32410
32410
  return filepath;
32411
32411
  } else {
32412
- const parent = dirname12(filepath);
32412
+ const parent = dirname11(filepath);
32413
32413
  if (parent === filepath) {
32414
32414
  throw new NotFoundError(`git root for ${filepath}`);
32415
32415
  }
@@ -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 dirname13 = path.shift();
35047
+ const dirname12 = path.shift();
35048
35048
  for (const entry of tree) {
35049
- if (entry.path === dirname13) {
35049
+ if (entry.path === dirname12) {
35050
35050
  if (path.length === 0) {
35051
35051
  return entry.oid;
35052
35052
  }
@@ -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 = readFileSync(manifestPath, "utf-8");
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 = readFileSync(manifestPath, "utf-8");
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);
@@ -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((resolve25) => {
51885
+ return new Promise((resolve24) => {
51886
51886
  if (typeof setImmediate === "undefined") {
51887
- setTimeout(resolve25, 0);
51887
+ setTimeout(resolve24, 0);
51888
51888
  } else {
51889
- setImmediate(resolve25);
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((resolve25, reject2) => {
51922
+ this.promise = new Promise((resolve24, reject2) => {
51923
51923
  this.resolve = (arg) => {
51924
- resolve25(arg);
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((resolve25, reject2) => {
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
- resolve25(doc.uri);
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((resolve25, reject2) => {
55089
+ return new Promise((resolve24, reject2) => {
55090
55090
  const buildDisposable = this.onBuildPhase(state, () => {
55091
55091
  buildDisposable.dispose();
55092
55092
  cancelDisposable.dispose();
55093
- resolve25();
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 dirname12 = sp.dirname(file);
61379
+ const dirname11 = sp.dirname(file);
61380
61380
  const basename4 = sp.basename(file);
61381
- const parent = this.fsw._getWatchedDir(dirname12);
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(dirname12, basename4);
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((resolve25, reject2) => {
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
- resolve25(void 0);
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 readFileSync2 } from "node:fs";
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 = readFileSync2(filePath, "utf-8");
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 readFileSync3, existsSync as existsSync3 } from "node:fs";
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 readFileSync3(path, "utf-8");
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,7 +62729,7 @@ 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, statSync, watch as watch2 } from "node:fs";
62732
+ import { readFileSync as readFileSync5, existsSync as existsSync4, statSync, watch as watch2 } from "node:fs";
62733
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";
@@ -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 = readFileSync4(specPath, "utf-8");
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) {
@@ -63982,7 +63982,7 @@ function kebab(s) {
63982
63982
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
63983
63983
  }
63984
63984
  function readJson(path) {
63985
- return JSON.parse(readFileSync4(path, "utf-8"));
63985
+ return JSON.parse(readFileSync5(path, "utf-8"));
63986
63986
  }
63987
63987
  function loadFacetManifest(dir) {
63988
63988
  const manifestPath = join6(dir, "manifest.json");
@@ -64422,9 +64422,9 @@ async function startServerWithRetry(port, log) {
64422
64422
  return null;
64423
64423
  }
64424
64424
  function startServer(port) {
64425
- return new Promise((resolve25, reject2) => {
64425
+ return new Promise((resolve24, reject2) => {
64426
64426
  const wss = new import_websocket_server.default({ port, host: "127.0.0.1" });
64427
- wss.on("listening", () => resolve25(wss));
64427
+ wss.on("listening", () => resolve24(wss));
64428
64428
  wss.on("error", (err) => reject2(err));
64429
64429
  });
64430
64430
  }
@@ -64433,7 +64433,7 @@ function sleep(ms) {
64433
64433
  }
64434
64434
 
64435
64435
  // src/commands/derive.ts
64436
- import { readFileSync as readFileSync5, existsSync as existsSync5 } from "node:fs";
64436
+ import { readFileSync as readFileSync6, existsSync as existsSync5 } from "node:fs";
64437
64437
  import { resolve as resolve9 } from "node:path";
64438
64438
  import { parseArgs as parseArgs4 } from "node:util";
64439
64439
  var EMPTY2 = [];
@@ -64442,7 +64442,7 @@ function fail2(message) {
64442
64442
  }
64443
64443
  function readFile2(path) {
64444
64444
  try {
64445
- return readFileSync5(path, "utf-8");
64445
+ return readFileSync6(path, "utf-8");
64446
64446
  } catch (err) {
64447
64447
  const msg = err instanceof Error ? err.message : String(err);
64448
64448
  return fail2(`Error: Failed to read ${path}: ${msg}`);
@@ -64495,7 +64495,7 @@ async function runDerive(argv) {
64495
64495
  }
64496
64496
 
64497
64497
  // src/commands/generate.ts
64498
- import { readFileSync as readFileSync6, existsSync as existsSync6 } from "node:fs";
64498
+ import { readFileSync as readFileSync7, existsSync as existsSync6 } from "node:fs";
64499
64499
  import { resolve as resolve10 } from "node:path";
64500
64500
  import { parseArgs as parseArgs5 } from "node:util";
64501
64501
 
@@ -66199,7 +66199,7 @@ function fail3(message) {
66199
66199
  }
66200
66200
  function readFile3(path) {
66201
66201
  try {
66202
- return readFileSync6(path, "utf-8");
66202
+ return readFileSync7(path, "utf-8");
66203
66203
  } catch (err) {
66204
66204
  const msg = err instanceof Error ? err.message : String(err);
66205
66205
  return fail3(`Error: Failed to read ${path}: ${msg}`);
@@ -66272,7 +66272,7 @@ Wrote ${filesWritten.length} file(s) to ${outDir}`,
66272
66272
  }
66273
66273
 
66274
66274
  // src/commands/cucumber-json.ts
66275
- import { readFileSync as readFileSync7, existsSync as existsSync7 } from "node:fs";
66275
+ import { readFileSync as readFileSync8, existsSync as existsSync7 } from "node:fs";
66276
66276
  import { resolve as resolve11 } from "node:path";
66277
66277
  import { parseArgs as parseArgs6 } from "node:util";
66278
66278
 
@@ -66470,7 +66470,7 @@ function fail4(message) {
66470
66470
  }
66471
66471
  function readFile4(path) {
66472
66472
  try {
66473
- return readFileSync7(path, "utf-8");
66473
+ return readFileSync8(path, "utf-8");
66474
66474
  } catch (err) {
66475
66475
  const msg = err instanceof Error ? err.message : String(err);
66476
66476
  return fail4(`Error: Failed to read ${path}: ${msg}`);
@@ -66516,7 +66516,7 @@ async function runCucumberJson(argv) {
66516
66516
  }
66517
66517
 
66518
66518
  // src/commands/emit-ts.ts
66519
- import { readFileSync as readFileSync8, existsSync as existsSync8 } from "node:fs";
66519
+ import { readFileSync as readFileSync9, existsSync as existsSync8 } from "node:fs";
66520
66520
  import { resolve as resolve12 } from "node:path";
66521
66521
  import { parseArgs as parseArgs7 } from "node:util";
66522
66522
  var EMPTY5 = [];
@@ -66525,7 +66525,7 @@ function fail5(message) {
66525
66525
  }
66526
66526
  function readFile5(path) {
66527
66527
  try {
66528
- return readFileSync8(path, "utf-8");
66528
+ return readFileSync9(path, "utf-8");
66529
66529
  } catch (err) {
66530
66530
  const msg = err instanceof Error ? err.message : String(err);
66531
66531
  return fail5(`Error: Failed to read ${path}: ${msg}`);
@@ -66602,7 +66602,7 @@ Wrote ${filesWritten.length} file(s) to ${outDir}`,
66602
66602
  }
66603
66603
 
66604
66604
  // src/commands/test.ts
66605
- import { readFileSync as readFileSync9, existsSync as existsSync9 } from "node:fs";
66605
+ import { readFileSync as readFileSync10, existsSync as existsSync9 } from "node:fs";
66606
66606
  import { resolve as resolve13 } from "node:path";
66607
66607
  import { parseArgs as parseArgs8 } from "node:util";
66608
66608
  var EMPTY6 = [];
@@ -66611,7 +66611,7 @@ function fail6(message) {
66611
66611
  }
66612
66612
  function readFile6(path) {
66613
66613
  try {
66614
- return readFileSync9(path, "utf-8");
66614
+ return readFileSync10(path, "utf-8");
66615
66615
  } catch (err) {
66616
66616
  const msg = err instanceof Error ? err.message : String(err);
66617
66617
  return fail6(`Error: Failed to read ${path}: ${msg}`);
@@ -66654,7 +66654,7 @@ async function runTest(argv) {
66654
66654
  }
66655
66655
 
66656
66656
  // src/commands/viz.ts
66657
- import { readFileSync as readFileSync10, existsSync as existsSync10 } from "node:fs";
66657
+ import { readFileSync as readFileSync11, existsSync as existsSync10 } from "node:fs";
66658
66658
  import { resolve as resolve14, basename as basename3 } from "node:path";
66659
66659
  import { parseArgs as parseArgs9 } from "node:util";
66660
66660
 
@@ -66888,7 +66888,7 @@ function fail7(message) {
66888
66888
  }
66889
66889
  function readFile7(path) {
66890
66890
  try {
66891
- return readFileSync10(path, "utf-8");
66891
+ return readFileSync11(path, "utf-8");
66892
66892
  } catch (err) {
66893
66893
  const msg = err instanceof Error ? err.message : String(err);
66894
66894
  return fail7(`Error: Failed to read ${path}: ${msg}`);
@@ -66936,7 +66936,7 @@ async function runViz(argv) {
66936
66936
  }
66937
66937
 
66938
66938
  // src/commands/sync-status.ts
66939
- import { readFileSync as readFileSync12, existsSync as existsSync12 } from "node:fs";
66939
+ import { readFileSync as readFileSync13, existsSync as existsSync12 } from "node:fs";
66940
66940
  import { resolve as resolve16, dirname as dirname4 } from "node:path";
66941
66941
  import { parseArgs as parseArgs10 } from "node:util";
66942
66942
 
@@ -67954,7 +67954,7 @@ var LocalGitArtifactStore = class {
67954
67954
  };
67955
67955
 
67956
67956
  // ../sync/dist/services/sift-event-stream-reader.js
67957
- import { readFileSync as readFileSync11, readdirSync as readdirSync2, existsSync as existsSync11 } from "node:fs";
67957
+ import { readFileSync as readFileSync12, readdirSync as readdirSync2, existsSync as existsSync11 } from "node:fs";
67958
67958
  import { join as join7 } from "node:path";
67959
67959
  var SiftEventStreamReader = class {
67960
67960
  read(domainDir) {
@@ -67984,7 +67984,7 @@ var SiftEventStreamReader = class {
67984
67984
  processFile(filePath, accumulator) {
67985
67985
  let content;
67986
67986
  try {
67987
- content = readFileSync11(filePath, "utf-8");
67987
+ content = readFileSync12(filePath, "utf-8");
67988
67988
  } catch (err) {
67989
67989
  const msg = err instanceof Error ? err.message : String(err);
67990
67990
  return { processed: 0, errors: [`Failed to read ${filePath}: ${msg}`] };
@@ -68124,7 +68124,7 @@ function fail8(message) {
68124
68124
  }
68125
68125
  function readFile8(path) {
68126
68126
  try {
68127
- return readFileSync12(path, "utf-8");
68127
+ return readFileSync13(path, "utf-8");
68128
68128
  } catch (err) {
68129
68129
  const msg = err instanceof Error ? err.message : String(err);
68130
68130
  return fail8(`Error: Failed to read ${path}: ${msg}`);
@@ -68190,7 +68190,7 @@ async function runSyncStatus(argv) {
68190
68190
  }
68191
68191
 
68192
68192
  // src/commands/sync-propose.ts
68193
- import { readFileSync as readFileSync13, existsSync as existsSync13 } from "node:fs";
68193
+ import { readFileSync as readFileSync14, existsSync as existsSync13 } from "node:fs";
68194
68194
  import { resolve as resolve17, dirname as dirname5 } from "node:path";
68195
68195
  import { parseArgs as parseArgs11 } from "node:util";
68196
68196
  var EMPTY9 = [];
@@ -68199,7 +68199,7 @@ function fail9(message) {
68199
68199
  }
68200
68200
  function readFile9(path) {
68201
68201
  try {
68202
- return readFileSync13(path, "utf-8");
68202
+ return readFileSync14(path, "utf-8");
68203
68203
  } catch (err) {
68204
68204
  const msg = err instanceof Error ? err.message : String(err);
68205
68205
  return fail9(`Error: Failed to read ${path}: ${msg}`);
@@ -68215,6 +68215,11 @@ async function runSyncPropose(argv) {
68215
68215
  allowPositionals: true,
68216
68216
  strict: false
68217
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
+ }
68218
68223
  const filePath = positionals[0];
68219
68224
  if (!filePath) return fail9("Usage: moment sync propose <file.moment>");
68220
68225
  const resolvedPath = resolve17(filePath);
@@ -68262,7 +68267,7 @@ async function runSyncPropose(argv) {
68262
68267
  for (const p of proposals) {
68263
68268
  syncState.recordProposal(p);
68264
68269
  }
68265
- const autoAccept = values2["auto-accept"] === true;
68270
+ const autoAccept = false;
68266
68271
  const counts = processProposals(proposals, syncState, autoAccept);
68267
68272
  saga.confirmationComplete(counts.accepted, counts.rejected, counts.skipped);
68268
68273
  saga.recordingComplete(counts.accepted);
@@ -68319,27 +68324,19 @@ function formatProposalSummary(proposals, counts) {
68319
68324
  lines.push(` File: ${p.sourceFile}`);
68320
68325
  }
68321
68326
  lines.push("");
68322
- lines.push(`Accepted: ${counts.accepted}, Rejected: ${counts.rejected}, Skipped: ${counts.skipped}`);
68327
+ lines.push(
68328
+ `Accepted: ${counts.accepted}, Rejected: ${counts.rejected}, Skipped: ${counts.skipped}`
68329
+ );
68323
68330
  return lines.join("\n");
68324
68331
  }
68325
68332
 
68326
68333
  // src/commands/sync-accept.ts
68327
- import { readFileSync as readFileSync14, existsSync as existsSync14 } from "node:fs";
68328
- import { resolve as resolve18, dirname as dirname6 } from "node:path";
68329
68334
  import { parseArgs as parseArgs12 } from "node:util";
68330
68335
  var EMPTY10 = [];
68331
68336
  var USAGE = "Usage: moment sync accept [--all] <file.moment> [<proposal-id>...]";
68332
68337
  function fail10(message) {
68333
68338
  return { success: false, message, diagnostics: EMPTY10, acceptedCount: 0 };
68334
68339
  }
68335
- function readFile10(path) {
68336
- try {
68337
- return readFileSync14(path, "utf-8");
68338
- } catch (err) {
68339
- const msg = err instanceof Error ? err.message : String(err);
68340
- return fail10(`Error: Failed to read ${path}: ${msg}`);
68341
- }
68342
- }
68343
68340
  async function runSyncAccept(argv) {
68344
68341
  const { values: values2, positionals } = parseArgs12({
68345
68342
  args: argv,
@@ -68352,98 +68349,14 @@ async function runSyncAccept(argv) {
68352
68349
  });
68353
68350
  const filePath = positionals[0];
68354
68351
  if (!filePath) return fail10(USAGE);
68355
- const parsed = await parseSpecFile(filePath);
68356
- if (!("ir" in parsed)) return parsed;
68357
- const { ir, resolvedPath } = parsed;
68358
- const proposals = await generateProposals(ir, resolvedPath);
68359
- if (proposals.length === 0) {
68360
- return { success: true, message: "No pending proposals to accept", diagnostics: EMPTY10, acceptedCount: 0 };
68361
- }
68362
- return executeAccept(proposals, values2.all === true, positionals.slice(1), values2.json === true);
68363
- }
68364
- function executeAccept(proposals, acceptAll, proposalIds, asJson) {
68365
- const syncState = new SyncState();
68366
- for (const p of proposals) {
68367
- syncState.recordProposal(p);
68368
- }
68369
- if (!acceptAll && proposalIds.length === 0) {
68370
- return fail10(USAGE);
68371
- }
68372
- const result = acceptAll ? acceptAllProposals(syncState, proposals.map((p) => p.proposalId)) : acceptByIds(syncState, proposalIds, proposals.map((p) => p.proposalId));
68373
- if (!result.success || !asJson) return result;
68374
- const json = JSON.stringify({ accepted: result.acceptedCount }, null, 2);
68375
- return { ...result, message: json, json };
68376
- }
68377
- async function parseSpecFile(filePath) {
68378
- const resolvedPath = resolve18(filePath);
68379
- if (!existsSync14(resolvedPath)) return fail10(`Error: File not found: ${resolvedPath}`);
68380
- const content = readFile10(resolvedPath);
68381
- if (typeof content !== "string") return content;
68382
- const parseResult = await new MomentParser().parseContent(content);
68383
- if (!parseResult.success) {
68384
- return {
68385
- success: false,
68386
- message: `Parse failed with ${parseResult.diagnostics.length} diagnostic(s)`,
68387
- diagnostics: parseResult.diagnostics,
68388
- filePath: resolvedPath,
68389
- acceptedCount: 0
68390
- };
68391
- }
68392
- return { ir: parseResult.ir, resolvedPath };
68393
- }
68394
- async function generateProposals(ir, resolvedPath) {
68395
- const tsOutput = new TypeScriptEmitter().emit(ir, { scope: { level: "system" } });
68396
- const repoRoot = dirname6(resolvedPath);
68397
- const store = new LocalGitArtifactStore(repoRoot);
68398
- const actual = await readActualFiles2(store, [...tsOutput.files.keys()]);
68399
- return new ASTDiffEngine().generateProposals({ expected: tsOutput.files, actual });
68400
- }
68401
- function acceptAllProposals(syncState, allIds) {
68402
- for (const id of allIds) {
68403
- syncState.acceptProposal(id);
68404
- }
68405
- return {
68406
- success: true,
68407
- message: `Accepted ${allIds.length} proposal(s)`,
68408
- diagnostics: EMPTY10,
68409
- acceptedCount: allIds.length
68410
- };
68411
- }
68412
- function acceptByIds(syncState, requestedIds, validIds) {
68413
- const uniqueIds = [...new Set(requestedIds)];
68414
- const validSet = new Set(validIds);
68415
- const invalid = uniqueIds.filter((id) => !validSet.has(id));
68416
- if (invalid.length > 0) {
68417
- return fail10(`Error: Unknown proposal ID(s): ${invalid.join(", ")}`);
68418
- }
68419
- for (const id of uniqueIds) {
68420
- syncState.acceptProposal(id);
68421
- }
68422
- return {
68423
- success: true,
68424
- message: `Accepted ${uniqueIds.length} proposal(s)`,
68425
- diagnostics: EMPTY10,
68426
- acceptedCount: uniqueIds.length
68427
- };
68428
- }
68429
- async function readActualFiles2(store, paths) {
68430
- const actual = /* @__PURE__ */ new Map();
68431
- for (const path of paths) {
68432
- try {
68433
- const content = await store.readArtifact(path);
68434
- actual.set(path, content);
68435
- } catch (err) {
68436
- const msg = err instanceof Error ? err.message : "";
68437
- if (msg.startsWith("Artifact not found")) continue;
68438
- throw err;
68439
- }
68440
- }
68441
- 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
+ );
68442
68355
  }
68443
68356
 
68444
68357
  // src/commands/schema-status.ts
68445
- import { readFileSync as readFileSync15, existsSync as existsSync15 } from "node:fs";
68446
- import { resolve as resolve19 } from "node:path";
68358
+ import { readFileSync as readFileSync15, existsSync as existsSync14 } from "node:fs";
68359
+ import { resolve as resolve18 } from "node:path";
68447
68360
  import { parseArgs as parseArgs13 } from "node:util";
68448
68361
 
68449
68362
  // ../schema/dist/aggregates/schema-registry.js
@@ -68755,7 +68668,7 @@ async function runSchemaStatus(argv) {
68755
68668
  });
68756
68669
  const filePath = positionals[0];
68757
68670
  if (!filePath) return fail11("Usage: moment schema status <file.moment>");
68758
- const parsed = await parseSpecFile2(filePath);
68671
+ const parsed = await parseSpecFile(filePath);
68759
68672
  if (!("ir" in parsed)) return parsed;
68760
68673
  const { ir } = parsed;
68761
68674
  const entries = buildSchemaEntries(ir);
@@ -68846,9 +68759,9 @@ function formatSchemaTable(entries) {
68846
68759
  lines.push(`Total: ${entries.length} field(s)`);
68847
68760
  return lines.join("\n");
68848
68761
  }
68849
- async function parseSpecFile2(filePath) {
68850
- const resolvedPath = resolve19(filePath);
68851
- if (!existsSync15(resolvedPath)) return fail11(`Error: File not found: ${resolvedPath}`);
68762
+ async function parseSpecFile(filePath) {
68763
+ const resolvedPath = resolve18(filePath);
68764
+ if (!existsSync14(resolvedPath)) return fail11(`Error: File not found: ${resolvedPath}`);
68852
68765
  let content;
68853
68766
  try {
68854
68767
  content = readFileSync15(resolvedPath, "utf-8");
@@ -68869,8 +68782,8 @@ async function parseSpecFile2(filePath) {
68869
68782
  }
68870
68783
 
68871
68784
  // src/commands/lint.ts
68872
- import { readFileSync as readFileSync16, existsSync as existsSync16 } from "node:fs";
68873
- import { resolve as resolve20, dirname as dirname7 } from "node:path";
68785
+ import { readFileSync as readFileSync16, existsSync as existsSync15 } from "node:fs";
68786
+ import { resolve as resolve19, dirname as dirname6 } from "node:path";
68874
68787
  import { parseArgs as parseArgs14 } from "node:util";
68875
68788
  var EMPTY_ISSUES = [];
68876
68789
  function fail12(message) {
@@ -68885,8 +68798,8 @@ async function runLint(argv) {
68885
68798
  });
68886
68799
  const filePath = positionals[0];
68887
68800
  if (!filePath) return fail12("Usage: moment lint <file.moment>");
68888
- const resolvedPath = resolve20(filePath);
68889
- if (!existsSync16(resolvedPath)) return fail12(`Error: File not found: ${resolvedPath}`);
68801
+ const resolvedPath = resolve19(filePath);
68802
+ if (!existsSync15(resolvedPath)) return fail12(`Error: File not found: ${resolvedPath}`);
68890
68803
  let content;
68891
68804
  try {
68892
68805
  content = readFileSync16(resolvedPath, "utf-8");
@@ -68917,7 +68830,7 @@ function collectParseDiagnostics(diagnostics, issues) {
68917
68830
  async function collectDriftWarnings(ir, resolvedPath, issues) {
68918
68831
  try {
68919
68832
  const tsOutput = new TypeScriptEmitter().emit(ir, { scope: { level: "system" } });
68920
- const repoRoot = findGitRoot(dirname7(resolvedPath));
68833
+ const repoRoot = findGitRoot(dirname6(resolvedPath));
68921
68834
  const store = new LocalGitArtifactStore(repoRoot);
68922
68835
  const actual = /* @__PURE__ */ new Map();
68923
68836
  for (const path of tsOutput.files.keys()) {
@@ -68938,10 +68851,10 @@ async function collectDriftWarnings(ir, resolvedPath, issues) {
68938
68851
  }
68939
68852
  }
68940
68853
  function findGitRoot(startDir) {
68941
- let dir = resolve20(startDir);
68942
- while (dir !== dirname7(dir)) {
68943
- if (existsSync16(resolve20(dir, ".git"))) return dir;
68944
- dir = dirname7(dir);
68854
+ let dir = resolve19(startDir);
68855
+ while (dir !== dirname6(dir)) {
68856
+ if (existsSync15(resolve19(dir, ".git"))) return dir;
68857
+ dir = dirname6(dir);
68945
68858
  }
68946
68859
  return startDir;
68947
68860
  }
@@ -68995,8 +68908,8 @@ function buildResult2(issues, hasParseErrors, asJson) {
68995
68908
  }
68996
68909
 
68997
68910
  // src/commands/import-from-sift.ts
68998
- import { readFileSync as readFileSync17, writeFileSync as writeFileSync4, existsSync as existsSync17, mkdirSync as mkdirSync3 } from "node:fs";
68999
- import { resolve as resolve21, dirname as dirname8, join as join8 } from "node:path";
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";
69000
68913
  import { parseArgs as parseArgs15 } from "node:util";
69001
68914
  import { createHash as createHash3 } from "node:crypto";
69002
68915
  var EMPTY12 = [];
@@ -69015,8 +68928,8 @@ async function runImportFromSift(argv) {
69015
68928
  });
69016
68929
  const domainDir = positionals[0];
69017
68930
  if (!domainDir) return fail13("Usage: moment import --from-sift <.domain/ directory>");
69018
- const resolvedDir = resolve21(domainDir);
69019
- if (!existsSync17(resolvedDir)) return fail13(`Error: Directory not found: ${resolvedDir}`);
68931
+ const resolvedDir = resolve20(domainDir);
68932
+ if (!existsSync16(resolvedDir)) return fail13(`Error: Directory not found: ${resolvedDir}`);
69020
68933
  return executeImport(resolvedDir, values2["output-dir"], values2.json === true);
69021
68934
  }
69022
68935
  function executeImport(domainDir, outputDir, asJson) {
@@ -69033,29 +68946,36 @@ function executeImport(domainDir, outputDir, asJson) {
69033
68946
  const importResult = importer.import(siftInput);
69034
68947
  if (importResult.diagnostics.some((d) => d.severity === "error")) {
69035
68948
  const errorCount = importResult.diagnostics.filter((d) => d.severity === "error").length;
69036
- return { success: false, message: `Import failed with ${errorCount} error(s)`, diagnostics: importResult.diagnostics, filesWritten: 0, eventsProcessed: readResult.eventsProcessed };
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
+ };
69037
68956
  }
69038
- const outDir = resolve21(outputDir ?? dirname8(domainDir));
68957
+ const outDir = resolve20(outputDir ?? dirname7(domainDir));
69039
68958
  const filesWritten = writeOutputFiles2(importer, siftInput, outDir);
69040
68959
  writeFingerprint(siftInput, importResult, domainDir, outDir);
69041
- return buildResult3(importResult, filesWritten, readResult.eventsProcessed, readResult.filesRead, asJson);
68960
+ return buildResult3(
68961
+ importResult,
68962
+ filesWritten,
68963
+ readResult.eventsProcessed,
68964
+ readResult.filesRead,
68965
+ asJson
68966
+ );
69042
68967
  }
69043
68968
  function sanitizeFileName(name) {
69044
68969
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
69045
68970
  }
69046
- function assertPathWithin2(filePath, baseDir) {
69047
- if (!resolve21(filePath).startsWith(resolve21(baseDir))) {
69048
- throw new Error(`Path traversal detected: ${filePath} escapes ${baseDir}`);
69049
- }
69050
- }
69051
68971
  function writeOutputFiles2(importer, input, outDir) {
69052
68972
  let count = 0;
69053
68973
  const momentDir = join8(outDir, ".moment");
69054
68974
  for (const block2 of input.buildingBlocks) {
69055
68975
  const fileName = sanitizeFileName(block2.contextName);
69056
68976
  const filePath = join8(momentDir, "contexts", `${fileName}.moment`);
69057
- assertPathWithin2(filePath, momentDir);
69058
- mkdirSync3(dirname8(filePath), { recursive: true });
68977
+ assertPathWithin(filePath, momentDir);
68978
+ mkdirSync3(dirname7(filePath), { recursive: true });
69059
68979
  writeFileSync4(filePath, importer.generateContextFile(block2));
69060
68980
  count++;
69061
68981
  }
@@ -69065,7 +68985,7 @@ function writeFingerprint(siftInput, importResult, domainDir, outDir) {
69065
68985
  const contentHash = computeDomainHash(domainDir);
69066
68986
  const fpDir = join8(outDir, ".moment");
69067
68987
  const fpPath = join8(fpDir, ".upstream-fingerprint.json");
69068
- if (existsSync17(fpPath)) {
68988
+ if (existsSync16(fpPath)) {
69069
68989
  try {
69070
68990
  const existing = JSON.parse(readFileSync17(fpPath, "utf-8"));
69071
68991
  if (existing.sift?.contentHash === contentHash) return;
@@ -69098,7 +69018,10 @@ function countAggregates(input) {
69098
69018
  return input.buildingBlocks.reduce((sum, b) => sum + b.aggregates.length, 0);
69099
69019
  }
69100
69020
  function countDomainEvents(input) {
69101
- return input.buildingBlocks.reduce((sum, b) => sum + b.aggregates.reduce((s, a) => s + a.events.length, 0), 0);
69021
+ return input.buildingBlocks.reduce(
69022
+ (sum, b) => sum + b.aggregates.reduce((s, a) => s + a.events.length, 0),
69023
+ 0
69024
+ );
69102
69025
  }
69103
69026
  function buildResult3(importResult, filesWritten, eventsProcessed, filesRead, asJson) {
69104
69027
  const summary = {
@@ -69110,7 +69033,14 @@ function buildResult3(importResult, filesWritten, eventsProcessed, filesRead, as
69110
69033
  };
69111
69034
  if (asJson) {
69112
69035
  const json = JSON.stringify(summary, null, 2);
69113
- return { success: true, message: json, diagnostics: importResult.diagnostics, filesWritten, eventsProcessed, json };
69036
+ return {
69037
+ success: true,
69038
+ message: json,
69039
+ diagnostics: importResult.diagnostics,
69040
+ filesWritten,
69041
+ eventsProcessed,
69042
+ json
69043
+ };
69114
69044
  }
69115
69045
  return {
69116
69046
  success: true,
@@ -69122,8 +69052,8 @@ function buildResult3(importResult, filesWritten, eventsProcessed, filesRead, as
69122
69052
  }
69123
69053
 
69124
69054
  // src/commands/status.ts
69125
- import { readFileSync as readFileSync18, existsSync as existsSync18 } from "node:fs";
69126
- import { resolve as resolve22, dirname as dirname9, join as join9 } from "node:path";
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";
69127
69057
  import { parseArgs as parseArgs16 } from "node:util";
69128
69058
  function fail14(message) {
69129
69059
  return { success: false, hasDrift: false, message, sections: [] };
@@ -69141,8 +69071,8 @@ async function runStatus(argv) {
69141
69071
  });
69142
69072
  const filePath = positionals[0];
69143
69073
  if (!filePath) return fail14("Usage: moment status <file.moment>");
69144
- const resolvedPath = resolve22(filePath);
69145
- if (!existsSync18(resolvedPath)) return fail14(`Error: File not found: ${resolvedPath}`);
69074
+ const resolvedPath = resolve21(filePath);
69075
+ if (!existsSync17(resolvedPath)) return fail14(`Error: File not found: ${resolvedPath}`);
69146
69076
  let content;
69147
69077
  try {
69148
69078
  content = readFileSync18(resolvedPath, "utf-8");
@@ -69174,7 +69104,7 @@ function buildParseSection(parseResult) {
69174
69104
  };
69175
69105
  }
69176
69106
  async function buildDriftSection(ir, resolvedPath) {
69177
- const gitRoot = findGitRoot2(dirname9(resolvedPath));
69107
+ const gitRoot = findGitRoot2(dirname8(resolvedPath));
69178
69108
  if (!gitRoot) {
69179
69109
  return { label: "Implementation Sync", state: "ok", summary: "Not available (no git repository)" };
69180
69110
  }
@@ -69226,13 +69156,13 @@ function buildSchemaSection(ir) {
69226
69156
  };
69227
69157
  }
69228
69158
  function buildUpstreamSection(resolvedPath) {
69229
- const projectDir = dirname9(resolvedPath);
69159
+ const projectDir = dirname8(resolvedPath);
69230
69160
  const domainDir = join9(projectDir, ".domain");
69231
69161
  const fpPath = join9(projectDir, ".moment", ".upstream-fingerprint.json");
69232
- if (!existsSync18(domainDir)) {
69162
+ if (!existsSync17(domainDir)) {
69233
69163
  return { label: "Upstream Source", state: "ok", summary: "No upstream source configured" };
69234
69164
  }
69235
- if (!existsSync18(fpPath)) {
69165
+ if (!existsSync17(fpPath)) {
69236
69166
  return { label: "Upstream Source", state: "drift", summary: ".domain/ exists but no fingerprint \u2014 run moment import --from-sift" };
69237
69167
  }
69238
69168
  try {
@@ -69248,10 +69178,10 @@ function buildUpstreamSection(resolvedPath) {
69248
69178
  }
69249
69179
  }
69250
69180
  function findGitRoot2(startDir) {
69251
- let dir = resolve22(startDir);
69252
- while (dir !== dirname9(dir)) {
69253
- if (existsSync18(join9(dir, ".git"))) return dir;
69254
- dir = dirname9(dir);
69181
+ let dir = resolve21(startDir);
69182
+ while (dir !== dirname8(dir)) {
69183
+ if (existsSync17(join9(dir, ".git"))) return dir;
69184
+ dir = dirname8(dir);
69255
69185
  }
69256
69186
  return void 0;
69257
69187
  }
@@ -69279,8 +69209,8 @@ function formatOutput(sections, hasDrift, values2) {
69279
69209
  }
69280
69210
 
69281
69211
  // src/commands/reconcile.ts
69282
- import { readFileSync as readFileSync19, writeFileSync as writeFileSync5, existsSync as existsSync19, mkdirSync as mkdirSync4 } from "node:fs";
69283
- import { resolve as resolve23, dirname as dirname10, join as join10 } from "node:path";
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";
69284
69214
  import { parseArgs as parseArgs17 } from "node:util";
69285
69215
  import { createHash as createHash4 } from "node:crypto";
69286
69216
  function fail15(message) {
@@ -69299,7 +69229,7 @@ async function runReconcile(argv) {
69299
69229
  });
69300
69230
  const validation = validateArgs(values2, positionals);
69301
69231
  if (validation) return validation;
69302
- const resolvedPath = resolve23(positionals[0]);
69232
+ const resolvedPath = resolve22(positionals[0]);
69303
69233
  const parsed = await parseSpec(resolvedPath);
69304
69234
  if (!("ir" in parsed)) return parsed;
69305
69235
  const asJson = values2.json === true;
@@ -69315,7 +69245,7 @@ function validateArgs(values2, positionals) {
69315
69245
  return null;
69316
69246
  }
69317
69247
  async function parseSpec(resolvedPath) {
69318
- if (!existsSync19(resolvedPath)) return fail15(`Error: File not found: ${resolvedPath}`);
69248
+ if (!existsSync18(resolvedPath)) return fail15(`Error: File not found: ${resolvedPath}`);
69319
69249
  let content;
69320
69250
  try {
69321
69251
  content = readFileSync19(resolvedPath, "utf-8");
@@ -69327,9 +69257,9 @@ async function parseSpec(resolvedPath) {
69327
69257
  return { ir: parseResult.ir };
69328
69258
  }
69329
69259
  function reconcileLocal(ir, specPath, asJson) {
69330
- const projectDir = dirname10(specPath);
69260
+ const projectDir = dirname9(specPath);
69331
69261
  const domainDir = join10(projectDir, ".domain");
69332
- if (!existsSync19(domainDir)) {
69262
+ if (!existsSync18(domainDir)) {
69333
69263
  return buildNoChangesResult(asJson);
69334
69264
  }
69335
69265
  const category = classifyDrift(ir, specPath);
@@ -69341,8 +69271,8 @@ function reconcileLocal(ir, specPath, asJson) {
69341
69271
  return buildResult4(outcome, category, asJson);
69342
69272
  }
69343
69273
  function reconcileFromEvent(ir, specPath, eventPath, asJson) {
69344
- const resolvedEventPath = resolve23(eventPath);
69345
- if (!existsSync19(resolvedEventPath)) return fail15(`Error: Event file not found: ${resolvedEventPath}`);
69274
+ const resolvedEventPath = resolve22(eventPath);
69275
+ if (!existsSync18(resolvedEventPath)) return fail15(`Error: Event file not found: ${resolvedEventPath}`);
69346
69276
  let raw;
69347
69277
  try {
69348
69278
  raw = JSON.parse(readFileSync19(resolvedEventPath, "utf-8"));
@@ -69353,7 +69283,7 @@ function reconcileFromEvent(ir, specPath, eventPath, asJson) {
69353
69283
  const eventPayload = raw;
69354
69284
  const elements = validateAffectedElements(eventPayload.affectedElements);
69355
69285
  if (typeof elements === "string") return fail15(elements);
69356
- const projectDir = dirname10(specPath);
69286
+ const projectDir = dirname9(specPath);
69357
69287
  const category = classifyAffectedElements(ir, elements);
69358
69288
  const outcome = categoryToOutcome(category);
69359
69289
  writeReconcileEvent(projectDir, outcome, category);
@@ -69367,7 +69297,7 @@ function validateAffectedElements(value) {
69367
69297
  }
69368
69298
  function classifyDrift(ir, specPath) {
69369
69299
  try {
69370
- const domainDir = join10(dirname10(specPath), ".domain");
69300
+ const domainDir = join10(dirname9(specPath), ".domain");
69371
69301
  const reader = new SiftEventStreamReader();
69372
69302
  const readResult = reader.read(domainDir);
69373
69303
  if (readResult.eventsProcessed === 0 && readResult.errors.length > 0) return 2;
@@ -69435,7 +69365,7 @@ function updateFingerprint(domainDir, projectDir) {
69435
69365
  hash.update(readFileSync19(join10(domainDir, file), "utf-8"));
69436
69366
  }
69437
69367
  const contentHash = hash.digest("hex");
69438
- if (existsSync19(fpPath)) {
69368
+ if (existsSync18(fpPath)) {
69439
69369
  try {
69440
69370
  const existing = JSON.parse(readFileSync19(fpPath, "utf-8"));
69441
69371
  if (existing.sift?.contentHash === contentHash) return;
@@ -69471,16 +69401,16 @@ function buildResult4(outcome, category, asJson) {
69471
69401
  }
69472
69402
 
69473
69403
  // src/commands/simulate.ts
69474
- import { readFileSync as readFileSync20, existsSync as existsSync20, writeFileSync as writeFileSync6, mkdirSync as mkdirSync5 } from "node:fs";
69475
- import { resolve as resolve24, join as join11 } from "node:path";
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";
69476
69406
  import { parseArgs as parseArgs18 } from "node:util";
69477
69407
  var EMPTY13 = [];
69478
69408
  function fail16(message) {
69479
69409
  return { success: false, message, diagnostics: EMPTY13 };
69480
69410
  }
69481
69411
  function readMomentFile(filePath) {
69482
- const resolvedPath = resolve24(filePath);
69483
- if (!existsSync20(resolvedPath)) return fail16(`Error: File not found: ${resolvedPath}`);
69412
+ const resolvedPath = resolve23(filePath);
69413
+ if (!existsSync19(resolvedPath)) return fail16(`Error: File not found: ${resolvedPath}`);
69484
69414
  try {
69485
69415
  return readFileSync20(resolvedPath, "utf-8");
69486
69416
  } catch (err) {
@@ -69510,8 +69440,13 @@ ${lines.join("\n\n")}`,
69510
69440
  scenarios
69511
69441
  };
69512
69442
  }
69443
+ function writeSafe(baseDir, filename, content) {
69444
+ const fullPath = join11(baseDir, filename);
69445
+ assertPathWithin(fullPath, baseDir);
69446
+ writeFileSync6(fullPath, content, "utf-8");
69447
+ }
69513
69448
  function writeOutputFiles3(groups, ir, outDir) {
69514
- const resolvedDir = resolve24(outDir);
69449
+ const resolvedDir = resolve23(outDir);
69515
69450
  mkdirSync5(resolvedDir, { recursive: true });
69516
69451
  const topoEmitter = new TopologyEmitter();
69517
69452
  const manifestFlows = [];
@@ -69521,15 +69456,11 @@ function writeOutputFiles3(groups, ir, outDir) {
69521
69456
  const flowSlug = kebab3(group.flow.name);
69522
69457
  const topology = topoEmitter.emit(ir, group.flow);
69523
69458
  const topologyFile = `topology-${flowSlug}.json`;
69524
- writeFileSync6(
69525
- join11(resolvedDir, topologyFile),
69526
- JSON.stringify(topology, null, 2) + "\n",
69527
- "utf-8"
69528
- );
69459
+ writeSafe(resolvedDir, topologyFile, JSON.stringify(topology, null, 2) + "\n");
69529
69460
  const manifestScenarios = [];
69530
69461
  for (const scenario of group.scenarios) {
69531
69462
  const fileName = `${scenario.scenarioId}.json`;
69532
- writeFileSync6(join11(resolvedDir, fileName), JSON.stringify(scenario, null, 2) + "\n", "utf-8");
69463
+ writeSafe(resolvedDir, fileName, JSON.stringify(scenario, null, 2) + "\n");
69533
69464
  totalScenarios++;
69534
69465
  totalEvents += scenario.events.length;
69535
69466
  manifestScenarios.push({
@@ -69553,11 +69484,7 @@ function writeOutputFiles3(groups, ir, outDir) {
69553
69484
  }
69554
69485
  const artifacts = writeArtifacts(ir, resolvedDir);
69555
69486
  const manifest = { flows: manifestFlows, artifacts };
69556
- writeFileSync6(
69557
- join11(resolvedDir, "manifest.json"),
69558
- JSON.stringify(manifest, null, 2) + "\n",
69559
- "utf-8"
69560
- );
69487
+ writeSafe(resolvedDir, "manifest.json", JSON.stringify(manifest, null, 2) + "\n");
69561
69488
  return {
69562
69489
  success: true,
69563
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)`,
@@ -69568,29 +69495,33 @@ function writeArtifacts(ir, outDir) {
69568
69495
  const files = {};
69569
69496
  const catalog = generateEventCatalog(ir);
69570
69497
  files.eventCatalog = "event-catalog.json";
69571
- writeFileSync6(join11(outDir, files.eventCatalog), JSON.stringify(catalog, null, 2) + "\n", "utf-8");
69498
+ writeSafe(outDir, files.eventCatalog, JSON.stringify(catalog, null, 2) + "\n");
69572
69499
  const impact = generateImpactAnalysis(ir);
69573
69500
  files.impactAnalysis = "impact-analysis.json";
69574
- writeFileSync6(
69575
- join11(outDir, files.impactAnalysis),
69576
- JSON.stringify(impact, null, 2) + "\n",
69577
- "utf-8"
69578
- );
69501
+ writeSafe(outDir, files.impactAnalysis, JSON.stringify(impact, null, 2) + "\n");
69579
69502
  const sagas = generateSagaStateMachines(ir);
69580
69503
  files.sagaStateMachines = "saga-state-machines.json";
69581
- writeFileSync6(
69582
- join11(outDir, files.sagaStateMachines),
69583
- JSON.stringify(sagas, null, 2) + "\n",
69584
- "utf-8"
69585
- );
69504
+ writeSafe(outDir, files.sagaStateMachines, JSON.stringify(sagas, null, 2) + "\n");
69586
69505
  const asyncapi = generateAsyncApiSpec(ir);
69587
69506
  files.asyncApi = "asyncapi.yaml";
69588
- writeFileSync6(join11(outDir, files.asyncApi), asyncapi, "utf-8");
69507
+ writeSafe(outDir, files.asyncApi, asyncapi);
69589
69508
  return files;
69590
69509
  }
69591
69510
  function kebab3(s) {
69592
69511
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
69593
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
+ }
69594
69525
  async function runSimulate(argv) {
69595
69526
  const { values: values2, positionals } = parseArgs18({
69596
69527
  args: argv,
@@ -69617,11 +69548,11 @@ async function runSimulate(argv) {
69617
69548
  success: false,
69618
69549
  message: `Parse failed with ${parseResult.diagnostics.length} diagnostic(s)`,
69619
69550
  diagnostics: parseResult.diagnostics,
69620
- filePath: resolve24(filePath)
69551
+ filePath: resolve23(filePath)
69621
69552
  };
69622
69553
  }
69623
69554
  const ir = parseResult.ir;
69624
- updateManifestFromIr(resolve24(filePath), ir);
69555
+ updateManifestFromIr(resolve23(filePath), ir);
69625
69556
  if (ir.flows.length === 0) {
69626
69557
  return fail16("No flows found. Simulation requires at least one flow.");
69627
69558
  }
@@ -69631,11 +69562,7 @@ async function runSimulate(argv) {
69631
69562
  }
69632
69563
  const outDir = values2["out-dir"];
69633
69564
  if (outDir) {
69634
- const groups = targetFlows.map((flow) => ({
69635
- flow,
69636
- scenarios: values2.all ? [...generateAllScenarios(ir, flow), ...deriveNegativeScenarios(ir, flow)] : [generateSimulationScenario(ir, flow)]
69637
- }));
69638
- return writeOutputFiles3(groups, ir, outDir);
69565
+ return runOutDirWrite(targetFlows, ir, outDir, values2.all === true);
69639
69566
  }
69640
69567
  const scenarios = values2.all ? targetFlows.flatMap((flow) => [
69641
69568
  ...generateAllScenarios(ir, flow),
@@ -69716,18 +69643,18 @@ async function pollForToken(deviceCode, interval, expiresIn, callbacks) {
69716
69643
  throw new Error("Device code expired. Please try again.");
69717
69644
  }
69718
69645
  function sleep2(ms) {
69719
- return new Promise((resolve25) => setTimeout(resolve25, ms));
69646
+ return new Promise((resolve24) => setTimeout(resolve24, ms));
69720
69647
  }
69721
69648
 
69722
69649
  // src/auth/token-storage.ts
69723
- import { readFile as readFile11, writeFile, mkdir, unlink, stat as stat4, chmod } from "node:fs/promises";
69724
- import { dirname as dirname11, join as join12 } from "node:path";
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";
69725
69652
  import { homedir } from "node:os";
69726
69653
  var MOMENT_DIR = join12(homedir(), ".moment");
69727
69654
  var CREDENTIALS_PATH = join12(MOMENT_DIR, "credentials.json");
69728
69655
  async function storeToken(token, tokenType, scope, credentialsPath) {
69729
69656
  const filePath = credentialsPath ?? CREDENTIALS_PATH;
69730
- const dir = dirname11(filePath);
69657
+ const dir = dirname10(filePath);
69731
69658
  await mkdir(dir, { recursive: true, mode: 448 });
69732
69659
  const stored = {
69733
69660
  token,
@@ -69750,7 +69677,7 @@ async function readStoredTokenResult(credentialsPath) {
69750
69677
  if ((mode & 63) !== 0) {
69751
69678
  return { status: "insecure", path: filePath };
69752
69679
  }
69753
- const raw = await readFile11(filePath, "utf-8");
69680
+ const raw = await readFile10(filePath, "utf-8");
69754
69681
  const stored = JSON.parse(raw);
69755
69682
  if (!stored.token) return { status: "missing" };
69756
69683
  return { status: "ok", credentials: stored };