@moxxy/cli 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1407,6 +1407,10 @@ var init_process_manager = __esm({
1407
1407
  env: process.env,
1408
1408
  stdio: ["pipe", "pipe", "pipe"]
1409
1409
  });
1410
+ if (options.message) {
1411
+ proc.stdin.write(options.message);
1412
+ }
1413
+ proc.stdin.end();
1410
1414
  const claudeProc = {
1411
1415
  sessionKey: options.sessionKey,
1412
1416
  process: proc,
@@ -1447,9 +1451,6 @@ var init_process_manager = __esm({
1447
1451
  if (workingDir) {
1448
1452
  args.push("--add-dir", workingDir);
1449
1453
  }
1450
- if (options.message) {
1451
- args.push(options.message);
1452
- }
1453
1454
  return args;
1454
1455
  }
1455
1456
  /**
@@ -1934,15 +1935,28 @@ var init_cli = __esm({
1934
1935
  }
1935
1936
  }
1936
1937
  /**
1937
- * Collect full stdout from a child process as a string
1938
+ * Collect full stdout from a child process as a string.
1939
+ * Also captures stderr — if the process exits with no stdout, throws with stderr.
1938
1940
  */
1939
1941
  collectStdout(proc) {
1940
1942
  return new Promise((resolve, reject) => {
1941
- const chunks = [];
1942
- proc.stdout?.on("data", (chunk) => chunks.push(chunk));
1943
- proc.stdout?.on("end", () => resolve(Buffer.concat(chunks).toString("utf-8").trim()));
1943
+ const stdoutChunks = [];
1944
+ const stderrChunks = [];
1945
+ proc.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
1946
+ proc.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
1944
1947
  proc.stdout?.on("error", reject);
1945
1948
  proc.on("error", reject);
1949
+ proc.on("close", (code) => {
1950
+ const stdout = Buffer.concat(stdoutChunks).toString("utf-8").trim();
1951
+ const stderr = Buffer.concat(stderrChunks).toString("utf-8").trim();
1952
+ if (stdout) {
1953
+ resolve(stdout);
1954
+ } else if (code !== 0 || stderr) {
1955
+ reject(new Error(`Claude CLI exited with code ${code}${stderr ? `: ${stderr}` : ""}`));
1956
+ } else {
1957
+ resolve("");
1958
+ }
1959
+ });
1946
1960
  });
1947
1961
  }
1948
1962
  /**
@@ -3549,7 +3563,7 @@ var init_dist2 = __esm({
3549
3563
  if (event.message?.content) {
3550
3564
  const content = event.message.content;
3551
3565
  if (Array.isArray(content)) {
3552
- fullResponse = content.map((c) => c.text || "").join("");
3566
+ fullResponse = content.map((c2) => c2.text || "").join("");
3553
3567
  } else if (typeof content === "string") {
3554
3568
  fullResponse = content;
3555
3569
  }
@@ -5574,7 +5588,7 @@ var require_logger = __commonJS({
5574
5588
  return level;
5575
5589
  },
5576
5590
  // Can be overridden in the host environment
5577
- log: function log3(level) {
5591
+ log: function log4(level) {
5578
5592
  level = logger.lookupLevel(level);
5579
5593
  if (typeof console !== "undefined" && logger.lookupLevel(logger.level) <= level) {
5580
5594
  var method = logger.methodMap[level];
@@ -5768,8 +5782,8 @@ var require_base = __commonJS({
5768
5782
  _internalProtoAccess.resetLoggedProperties();
5769
5783
  }
5770
5784
  };
5771
- var log3 = _logger2["default"].log;
5772
- exports2.log = log3;
5785
+ var log4 = _logger2["default"].log;
5786
+ exports2.log = log4;
5773
5787
  exports2.createFrame = _utils.createFrame;
5774
5788
  exports2.logger = _logger2["default"];
5775
5789
  }
@@ -6675,8 +6689,8 @@ var require_parser = __commonJS({
6675
6689
  },
6676
6690
  showPosition: function showPosition() {
6677
6691
  var pre = this.pastInput();
6678
- var c = new Array(pre.length + 1).join("-");
6679
- return pre + this.upcomingInput() + "\n" + c + "^";
6692
+ var c2 = new Array(pre.length + 1).join("-");
6693
+ return pre + this.upcomingInput() + "\n" + c2 + "^";
6680
6694
  },
6681
6695
  next: function next() {
6682
6696
  if (this.done) {
@@ -8799,8 +8813,8 @@ var require_source_map_consumer = __commonJS({
8799
8813
  }
8800
8814
  });
8801
8815
  SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
8802
- var c = aStr.charAt(index);
8803
- return c === ";" || c === ",";
8816
+ var c2 = aStr.charAt(index);
8817
+ return c2 === ";" || c2 === ",";
8804
8818
  };
8805
8819
  SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
8806
8820
  throw new Error("Subclasses must implement _parseMappings");
@@ -10485,19 +10499,19 @@ var require_javascript_compiler = __commonJS({
10485
10499
  }
10486
10500
  },
10487
10501
  replaceStack: function replaceStack(callback) {
10488
- var prefix = ["("], stack = void 0, createdStack = void 0, usedLiteral = void 0;
10502
+ var prefix2 = ["("], stack = void 0, createdStack = void 0, usedLiteral = void 0;
10489
10503
  if (!this.isInline()) {
10490
10504
  throw new _exception2["default"]("replaceStack on non-inline");
10491
10505
  }
10492
10506
  var top = this.popStack(true);
10493
10507
  if (top instanceof Literal) {
10494
10508
  stack = [top.value];
10495
- prefix = ["(", stack];
10509
+ prefix2 = ["(", stack];
10496
10510
  usedLiteral = true;
10497
10511
  } else {
10498
10512
  createdStack = true;
10499
10513
  var _name = this.incrStack();
10500
- prefix = ["((", this.push(_name), " = ", top, ")"];
10514
+ prefix2 = ["((", this.push(_name), " = ", top, ")"];
10501
10515
  stack = this.topStack();
10502
10516
  }
10503
10517
  var item = callback.call(this, stack);
@@ -10507,7 +10521,7 @@ var require_javascript_compiler = __commonJS({
10507
10521
  if (createdStack) {
10508
10522
  this.stackSlot--;
10509
10523
  }
10510
- this.push(prefix.concat(item, ")"));
10524
+ this.push(prefix2.concat(item, ")"));
10511
10525
  },
10512
10526
  incrStack: function incrStack() {
10513
10527
  this.stackSlot++;
@@ -11040,22 +11054,22 @@ function formatArgs(args) {
11040
11054
  return String(arg);
11041
11055
  }).join(" ");
11042
11056
  }
11043
- function formatLogMessage(level, prefix, message, args, category = "agent") {
11057
+ function formatLogMessage(level, prefix2, message, args, category = "agent") {
11044
11058
  const { reset, dim, blue, gray } = ANSI_COLORS;
11045
11059
  const levelColor = LEVEL_COLORS[level];
11046
11060
  const levelName = LEVEL_NAMES[level];
11047
11061
  const time = `${dim}${formatTime5()}${reset}`;
11048
11062
  const levelStr = `${levelColor}${levelName}${reset}`;
11049
- const ctx = `${blue}[${prefix}]${reset}`;
11063
+ const ctx = `${blue}[${prefix2}]${reset}`;
11050
11064
  const cat = `${gray}[${category}]${reset}`;
11051
11065
  const argsStr = args.length > 0 ? ` ${dim}${formatArgs(args)}${reset}` : "";
11052
11066
  return `${time} ${levelStr} ${ctx}${cat} ${message}${argsStr}`;
11053
11067
  }
11054
- function createAgentLogger(prefix, category = "agent") {
11055
- return new ConsoleLogger(prefix, category);
11068
+ function createAgentLogger(prefix2, category = "agent") {
11069
+ return new ConsoleLogger(prefix2, category);
11056
11070
  }
11057
- function log(level, prefix, message, ...args) {
11058
- const formatted = formatLogMessage(level, prefix, message, args);
11071
+ function log(level, prefix2, message, ...args) {
11072
+ const formatted = formatLogMessage(level, prefix2, message, args);
11059
11073
  switch (level) {
11060
11074
  case "debug":
11061
11075
  console.debug(formatted);
@@ -11109,11 +11123,11 @@ function createCustomAgent(type, id) {
11109
11123
  function formatTime6() {
11110
11124
  return (/* @__PURE__ */ new Date()).toTimeString().slice(0, 8);
11111
11125
  }
11112
- function log2(level, prefix, message) {
11126
+ function log2(level, prefix2, message) {
11113
11127
  const time = `${colors5.dim}${formatTime6()}${colors5.reset}`;
11114
11128
  const levelColor = level === "ERROR" ? colors5.red : colors5.cyan;
11115
11129
  const levelStr = `${levelColor}${level === "INFO" ? "INFO " : "ERROR"}${colors5.reset}`;
11116
- const ctx = `${colors5.blue}[${prefix}]${colors5.reset}`;
11130
+ const ctx = `${colors5.blue}[${prefix2}]${colors5.reset}`;
11117
11131
  const consoleFn = level === "ERROR" ? console.error : console.info;
11118
11132
  consoleFn(`${time} ${levelStr} ${ctx}${colors5.gray}[agent]${colors5.reset} ${message}`);
11119
11133
  }
@@ -11902,7 +11916,7 @@ Return the authentication confirmation.`;
11902
11916
  prompt: `Please redo the previous work. Reason: ${reason}
11903
11917
 
11904
11918
  ${constraints.length > 0 ? `Constraints:
11905
- ${constraints.map((c) => `- ${c}`).join("\n")}` : ""}`
11919
+ ${constraints.map((c2) => `- ${c2}`).join("\n")}` : ""}`
11906
11920
  };
11907
11921
  }
11908
11922
  /**
@@ -13436,8 +13450,8 @@ git stash drop
13436
13450
  * @param prefix - Context prefix (e.g., agent name)
13437
13451
  * @param category - Log category (default: 'agent')
13438
13452
  */
13439
- constructor(prefix, category = "agent") {
13440
- this.prefix = prefix;
13453
+ constructor(prefix2, category = "agent") {
13454
+ this.prefix = prefix2;
13441
13455
  this.category = category;
13442
13456
  }
13443
13457
  category;
@@ -13881,7 +13895,7 @@ ${code}
13881
13895
  parts.push(...this.sections);
13882
13896
  if (this.constraints.length > 0) {
13883
13897
  parts.push("## Constraints\n");
13884
- parts.push(this.constraints.map((c) => `- ${c}`).join("\n"));
13898
+ parts.push(this.constraints.map((c2) => `- ${c2}`).join("\n"));
13885
13899
  }
13886
13900
  if (this.outputFormats.length > 0) {
13887
13901
  parts.push("\n## Expected Output\n");
@@ -16536,8 +16550,8 @@ Your PRDs should include:
16536
16550
  }
16537
16551
  };
16538
16552
  LoggingHook = class {
16539
- constructor(prefix = "Agent") {
16540
- this.prefix = prefix;
16553
+ constructor(prefix2 = "Agent") {
16554
+ this.prefix = prefix2;
16541
16555
  }
16542
16556
  async beforeInitialize(agent) {
16543
16557
  log2("INFO", this.prefix, `Initializing agent: ${agent.name}`);
@@ -17436,6 +17450,122 @@ var init_repo = __esm({
17436
17450
  }
17437
17451
  });
17438
17452
 
17453
+ // src/utils/pipeline-logger.ts
17454
+ function formatDuration(ms) {
17455
+ if (ms < 1e3) return `${ms}ms`;
17456
+ const seconds = ms / 1e3;
17457
+ if (seconds < 60) return `${seconds.toFixed(1)}s`;
17458
+ const minutes = Math.floor(seconds / 60);
17459
+ const remainingSeconds = Math.floor(seconds % 60);
17460
+ return `${minutes}m ${remainingSeconds}s`;
17461
+ }
17462
+ function prefix(issueKey) {
17463
+ return `${import_chalk3.default.magenta("[Pipeline]")} ${import_chalk3.default.cyan(issueKey)}`;
17464
+ }
17465
+ var import_chalk3, import_ora2, STAGE_LABELS, SpinnerPipelineLogger;
17466
+ var init_pipeline_logger = __esm({
17467
+ "src/utils/pipeline-logger.ts"() {
17468
+ "use strict";
17469
+ import_chalk3 = __toESM(require("chalk"));
17470
+ import_ora2 = __toESM(require("ora"));
17471
+ STAGE_LABELS = {
17472
+ triage: "Classifying issue",
17473
+ research: "Researching codebase",
17474
+ inspect: "Inspecting files",
17475
+ plan: "Planning implementation",
17476
+ implement: "Implementing changes"
17477
+ };
17478
+ SpinnerPipelineLogger = class {
17479
+ spinner = null;
17480
+ stageIndex = 0;
17481
+ totalStages = 0;
17482
+ pipelineStart(issueKey, title, stages, skipped) {
17483
+ this.stageIndex = 0;
17484
+ this.totalStages = stages.length;
17485
+ console.log();
17486
+ console.log(
17487
+ `${prefix(issueKey)} ${import_chalk3.default.bold("Pipeline started")} \u2014 ${title}`
17488
+ );
17489
+ const flow = stages.map((s) => import_chalk3.default.bold(s)).join(import_chalk3.default.dim(" \u2192 "));
17490
+ const skipNote = skipped.length ? import_chalk3.default.dim(` (skipped: ${skipped.join(", ")})`) : "";
17491
+ console.log(`${prefix(issueKey)} ${flow}${skipNote}`);
17492
+ }
17493
+ stageStart(issueKey, stage) {
17494
+ this.stageIndex++;
17495
+ const label = STAGE_LABELS[stage] || stage;
17496
+ const progress = import_chalk3.default.dim(`[${this.stageIndex}/${this.totalStages}]`);
17497
+ if (this.spinner) {
17498
+ this.spinner.stop();
17499
+ this.spinner = null;
17500
+ }
17501
+ this.spinner = (0, import_ora2.default)({
17502
+ text: `${prefix(issueKey)} ${progress} ${label}...`,
17503
+ color: "cyan"
17504
+ }).start();
17505
+ }
17506
+ stageSkip(issueKey, stage) {
17507
+ console.log(
17508
+ `${prefix(issueKey)} ${import_chalk3.default.gray("SKIP")} ${import_chalk3.default.dim(stage)} \u2014 using defaults`
17509
+ );
17510
+ }
17511
+ stageComplete(issueKey, stage, durationMs) {
17512
+ const duration = import_chalk3.default.dim(`(${formatDuration(durationMs)})`);
17513
+ if (this.spinner) {
17514
+ this.spinner.succeed(
17515
+ `${prefix(issueKey)} ${import_chalk3.default.bold(stage)} ${import_chalk3.default.green("completed")} ${duration}`
17516
+ );
17517
+ this.spinner = null;
17518
+ } else {
17519
+ console.log(
17520
+ `${prefix(issueKey)} ${import_chalk3.default.green("\u2714")} ${import_chalk3.default.bold(stage)} completed ${duration}`
17521
+ );
17522
+ }
17523
+ }
17524
+ stageFail(issueKey, stage, error2, durationMs) {
17525
+ const duration = import_chalk3.default.dim(`(${formatDuration(durationMs)})`);
17526
+ if (this.spinner) {
17527
+ this.spinner.fail(
17528
+ `${prefix(issueKey)} ${import_chalk3.default.bold(stage)} ${import_chalk3.default.red("failed")} ${duration} \u2014 ${error2}`
17529
+ );
17530
+ this.spinner = null;
17531
+ } else {
17532
+ console.log(
17533
+ `${prefix(issueKey)} ${import_chalk3.default.red("\u2716")} ${import_chalk3.default.bold(stage)} failed ${duration} \u2014 ${error2}`
17534
+ );
17535
+ }
17536
+ }
17537
+ info(issueKey, message) {
17538
+ const wasSpinning = this.spinner?.isSpinning;
17539
+ if (wasSpinning) this.spinner.stop();
17540
+ console.log(`${prefix(issueKey)} ${import_chalk3.default.dim(message)}`);
17541
+ if (wasSpinning) this.spinner.start();
17542
+ }
17543
+ pipelineComplete(issueKey, durationMs, prNumber, branch) {
17544
+ if (this.spinner) {
17545
+ this.spinner.stop();
17546
+ this.spinner = null;
17547
+ }
17548
+ console.log();
17549
+ console.log(
17550
+ `${prefix(issueKey)} ${import_chalk3.default.green.bold("\u2714 Pipeline completed")} in ${import_chalk3.default.bold(formatDuration(durationMs))} \u2014 PR ${import_chalk3.default.cyan(`#${prNumber}`)} on ${import_chalk3.default.cyan(branch)}`
17551
+ );
17552
+ console.log();
17553
+ }
17554
+ pipelineFail(issueKey, durationMs, error2) {
17555
+ if (this.spinner) {
17556
+ this.spinner.stop();
17557
+ this.spinner = null;
17558
+ }
17559
+ console.log();
17560
+ console.log(
17561
+ `${prefix(issueKey)} ${import_chalk3.default.red.bold("\u2716 Pipeline failed")} after ${import_chalk3.default.bold(formatDuration(durationMs))} \u2014 ${error2}`
17562
+ );
17563
+ console.log();
17564
+ }
17565
+ };
17566
+ }
17567
+ });
17568
+
17439
17569
  // ../integration-base/dist/index.mjs
17440
17570
  var dist_exports3 = {};
17441
17571
  __export(dist_exports3, {
@@ -17900,8 +18030,8 @@ function encodeReserved(str) {
17900
18030
  }).join("");
17901
18031
  }
17902
18032
  function encodeUnreserved(str) {
17903
- return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
17904
- return "%" + c.charCodeAt(0).toString(16).toUpperCase();
18033
+ return encodeURIComponent(str).replace(/[!'()*]/g, function(c2) {
18034
+ return "%" + c2.charCodeAt(0).toString(16).toUpperCase();
17905
18035
  });
17906
18036
  }
17907
18037
  function encodeValue(operator, value, key) {
@@ -18277,7 +18407,7 @@ async function fetchWrapper(requestOptions) {
18277
18407
  "fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
18278
18408
  );
18279
18409
  }
18280
- const log3 = requestOptions.request?.log || console;
18410
+ const log4 = requestOptions.request?.log || console;
18281
18411
  const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
18282
18412
  const body = isPlainObject2(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body;
18283
18413
  const requestHeaders = Object.fromEntries(
@@ -18335,7 +18465,7 @@ async function fetchWrapper(requestOptions) {
18335
18465
  if ("deprecation" in responseHeaders) {
18336
18466
  const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
18337
18467
  const deprecationLink = matches && matches.pop();
18338
- log3.warn(
18468
+ log4.warn(
18339
18469
  `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
18340
18470
  );
18341
18471
  }
@@ -22103,7 +22233,7 @@ var init_html = __esm({
22103
22233
  } else {
22104
22234
  buffer = [str];
22105
22235
  }
22106
- const resStr = Promise.all(callbacks.map((c) => c({ phase, buffer, context }))).then(
22236
+ const resStr = Promise.all(callbacks.map((c2) => c2({ phase, buffer, context }))).then(
22107
22237
  (res) => Promise.all(
22108
22238
  res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context, buffer))
22109
22239
  ).then(() => buffer[0])
@@ -22564,16 +22694,16 @@ var init_hono_base = __esm({
22564
22694
  init_router();
22565
22695
  init_constants2();
22566
22696
  init_url();
22567
- notFoundHandler = (c) => {
22568
- return c.text("404 Not Found", 404);
22697
+ notFoundHandler = (c2) => {
22698
+ return c2.text("404 Not Found", 404);
22569
22699
  };
22570
- errorHandler = (err, c) => {
22700
+ errorHandler = (err, c2) => {
22571
22701
  if ("getResponse" in err) {
22572
22702
  const res = err.getResponse();
22573
- return c.newResponse(res.body, res);
22703
+ return c2.newResponse(res.body, res);
22574
22704
  }
22575
22705
  console.error(err);
22576
- return c.text("Internal Server Error", 500);
22706
+ return c2.text("Internal Server Error", 500);
22577
22707
  };
22578
22708
  Hono = class _Hono {
22579
22709
  get;
@@ -22675,7 +22805,7 @@ var init_hono_base = __esm({
22675
22805
  if (app.errorHandler === errorHandler) {
22676
22806
  handler2 = r.handler;
22677
22807
  } else {
22678
- handler2 = async (c, next) => (await compose([], app.errorHandler)(c, () => r.handler(c, next))).res;
22808
+ handler2 = async (c2, next) => (await compose([], app.errorHandler)(c2, () => r.handler(c2, next))).res;
22679
22809
  handler2[COMPOSED_HANDLER] = r.handler;
22680
22810
  }
22681
22811
  subApp.#addRoute(r.method, r.path, handler2);
@@ -22786,16 +22916,16 @@ var init_hono_base = __esm({
22786
22916
  }
22787
22917
  }
22788
22918
  }
22789
- const getOptions = optionHandler ? (c) => {
22790
- const options2 = optionHandler(c);
22919
+ const getOptions = optionHandler ? (c2) => {
22920
+ const options2 = optionHandler(c2);
22791
22921
  return Array.isArray(options2) ? options2 : [options2];
22792
- } : (c) => {
22922
+ } : (c2) => {
22793
22923
  let executionContext = void 0;
22794
22924
  try {
22795
- executionContext = c.executionCtx;
22925
+ executionContext = c2.executionCtx;
22796
22926
  } catch {
22797
22927
  }
22798
- return [c.env, executionContext];
22928
+ return [c2.env, executionContext];
22799
22929
  };
22800
22930
  replaceRequest ||= (() => {
22801
22931
  const mergedPath = mergePath(this._basePath, path);
@@ -22806,8 +22936,8 @@ var init_hono_base = __esm({
22806
22936
  return new Request(url, request2);
22807
22937
  };
22808
22938
  })();
22809
- const handler2 = async (c, next) => {
22810
- const res = await applicationHandler(replaceRequest(c.req.raw), ...getOptions(c));
22939
+ const handler2 = async (c2, next) => {
22940
+ const res = await applicationHandler(replaceRequest(c2.req.raw), ...getOptions(c2));
22811
22941
  if (res) {
22812
22942
  return res;
22813
22943
  }
@@ -22823,9 +22953,9 @@ var init_hono_base = __esm({
22823
22953
  this.router.add(method, path, [handler2, r]);
22824
22954
  this.routes.push(r);
22825
22955
  }
22826
- #handleError(err, c) {
22956
+ #handleError(err, c2) {
22827
22957
  if (err instanceof Error) {
22828
- return this.errorHandler(err, c);
22958
+ return this.errorHandler(err, c2);
22829
22959
  }
22830
22960
  throw err;
22831
22961
  }
@@ -22835,7 +22965,7 @@ var init_hono_base = __esm({
22835
22965
  }
22836
22966
  const path = this.getPath(request2, { env });
22837
22967
  const matchResult = this.router.match(method, path);
22838
- const c = new Context(request2, {
22968
+ const c2 = new Context(request2, {
22839
22969
  path,
22840
22970
  matchResult,
22841
22971
  env,
@@ -22845,20 +22975,20 @@ var init_hono_base = __esm({
22845
22975
  if (matchResult[0].length === 1) {
22846
22976
  let res;
22847
22977
  try {
22848
- res = matchResult[0][0][0][0](c, async () => {
22849
- c.res = await this.#notFoundHandler(c);
22978
+ res = matchResult[0][0][0][0](c2, async () => {
22979
+ c2.res = await this.#notFoundHandler(c2);
22850
22980
  });
22851
22981
  } catch (err) {
22852
- return this.#handleError(err, c);
22982
+ return this.#handleError(err, c2);
22853
22983
  }
22854
22984
  return res instanceof Promise ? res.then(
22855
- (resolved) => resolved || (c.finalized ? c.res : this.#notFoundHandler(c))
22856
- ).catch((err) => this.#handleError(err, c)) : res ?? this.#notFoundHandler(c);
22985
+ (resolved) => resolved || (c2.finalized ? c2.res : this.#notFoundHandler(c2))
22986
+ ).catch((err) => this.#handleError(err, c2)) : res ?? this.#notFoundHandler(c2);
22857
22987
  }
22858
22988
  const composed = compose(matchResult[0], this.errorHandler, this.#notFoundHandler);
22859
22989
  return (async () => {
22860
22990
  try {
22861
- const context = await composed(c);
22991
+ const context = await composed(c2);
22862
22992
  if (!context.finalized) {
22863
22993
  throw new Error(
22864
22994
  "Context is not finalized. Did you forget to return a Response object or `await next()`?"
@@ -22866,7 +22996,7 @@ var init_hono_base = __esm({
22866
22996
  }
22867
22997
  return context.res;
22868
22998
  } catch (err) {
22869
- return this.#handleError(err, c);
22999
+ return this.#handleError(err, c2);
22870
23000
  }
22871
23001
  })();
22872
23002
  }
@@ -23060,8 +23190,8 @@ var init_node = __esm({
23060
23190
  buildRegExpStr() {
23061
23191
  const childKeys = Object.keys(this.#children).sort(compareKey);
23062
23192
  const strList = childKeys.map((k) => {
23063
- const c = this.#children[k];
23064
- return (typeof c.#varIndex === "number" ? `(${k})@${c.#varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + c.buildRegExpStr();
23193
+ const c2 = this.#children[k];
23194
+ return (typeof c2.#varIndex === "number" ? `(${k})@${c2.#varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + c2.buildRegExpStr();
23065
23195
  });
23066
23196
  if (typeof this.#index === "number") {
23067
23197
  strList.unshift(`#${this.#index}`);
@@ -24218,6 +24348,7 @@ var init_dist6 = __esm({
24218
24348
  // ../integration-github/dist/index.mjs
24219
24349
  var dist_exports4 = {};
24220
24350
  __export(dist_exports4, {
24351
+ ConsolePipelineLogger: () => ConsolePipelineLogger,
24221
24352
  GitHubAuthError: () => GitHubAuthError,
24222
24353
  GitHubClient: () => GitHubClient,
24223
24354
  GitHubError: () => GitHubError,
@@ -24232,7 +24363,7 @@ __export(dist_exports4, {
24232
24363
  parseIssuePayload: () => parseIssuePayload,
24233
24364
  verifyWebhookSignature: () => verifyWebhookSignature
24234
24365
  });
24235
- function formatDuration(ms) {
24366
+ function formatDuration2(ms) {
24236
24367
  if (ms < 1e3) return `${ms}ms`;
24237
24368
  const seconds = ms / 1e3;
24238
24369
  if (seconds < 60) return `${seconds.toFixed(1)}s`;
@@ -24253,7 +24384,7 @@ function statusIcon(status) {
24253
24384
  }
24254
24385
  }
24255
24386
  function buildStartComment(payload, enabledStages) {
24256
- const stageFlow = enabledStages.map((s) => STAGE_LABELS[s]).join(" \u2192 ");
24387
+ const stageFlow = enabledStages.map((s) => STAGE_LABELS2[s]).join(" \u2192 ");
24257
24388
  return [
24258
24389
  `> **Moxxy** is working on this issue`,
24259
24390
  "",
@@ -24271,16 +24402,16 @@ function buildSuccessComment(run2, _payload) {
24271
24402
  lines.push(`> **Moxxy** has completed this issue`);
24272
24403
  lines.push("");
24273
24404
  if (run2.classification) {
24274
- const c = run2.classification;
24405
+ const c2 = run2.classification;
24275
24406
  lines.push("| | |");
24276
24407
  lines.push("|---|---|");
24277
- lines.push(`| **Type** | ${c.type} |`);
24278
- lines.push(`| **Priority** | ${c.priority} |`);
24279
- lines.push(`| **Complexity** | ${c.complexity} |`);
24280
- lines.push(`| **Confidence** | ${(c.confidence * 100).toFixed(0)}% |`);
24408
+ lines.push(`| **Type** | ${c2.type} |`);
24409
+ lines.push(`| **Priority** | ${c2.priority} |`);
24410
+ lines.push(`| **Complexity** | ${c2.complexity} |`);
24411
+ lines.push(`| **Confidence** | ${(c2.confidence * 100).toFixed(0)}% |`);
24281
24412
  lines.push("");
24282
- if (c.reasoning) {
24283
- lines.push(`> ${c.reasoning}`);
24413
+ if (c2.reasoning) {
24414
+ lines.push(`> ${c2.reasoning}`);
24284
24415
  lines.push("");
24285
24416
  }
24286
24417
  }
@@ -24288,8 +24419,8 @@ function buildSuccessComment(run2, _payload) {
24288
24419
  lines.push("|-------|--------|----------|");
24289
24420
  for (const stage of run2.stages) {
24290
24421
  const icon = statusIcon(stage.status);
24291
- const duration = stage.duration_ms != null ? formatDuration(stage.duration_ms) : "\u2014";
24292
- lines.push(`| ${STAGE_LABELS[stage.stage]} | ${icon} ${stage.status} | ${duration} |`);
24422
+ const duration = stage.duration_ms != null ? formatDuration2(stage.duration_ms) : "\u2014";
24423
+ lines.push(`| ${STAGE_LABELS2[stage.stage]} | ${icon} ${stage.status} | ${duration} |`);
24293
24424
  }
24294
24425
  lines.push("");
24295
24426
  if (run2.prNumber) {
@@ -24308,8 +24439,8 @@ function buildFailureComment(run2, error2) {
24308
24439
  lines.push("|-------|--------|----------|");
24309
24440
  for (const stage of run2.stages) {
24310
24441
  const icon = statusIcon(stage.status);
24311
- const duration = stage.duration_ms != null ? formatDuration(stage.duration_ms) : "\u2014";
24312
- lines.push(`| ${STAGE_LABELS[stage.stage]} | ${icon} ${stage.status} | ${duration} |`);
24442
+ const duration = stage.duration_ms != null ? formatDuration2(stage.duration_ms) : "\u2014";
24443
+ lines.push(`| ${STAGE_LABELS2[stage.stage]} | ${icon} ${stage.status} | ${duration} |`);
24313
24444
  }
24314
24445
  lines.push("");
24315
24446
  }
@@ -24321,6 +24452,21 @@ function buildFailureComment(run2, error2) {
24321
24452
  lines.push("<sub>Automated by Moxxy</sub>");
24322
24453
  return lines.join("\n");
24323
24454
  }
24455
+ function formatTime7() {
24456
+ return (/* @__PURE__ */ new Date()).toTimeString().slice(0, 8);
24457
+ }
24458
+ function log3(level, issueKey, message) {
24459
+ const time = `${c.dim}${formatTime7()}${c.reset}`;
24460
+ const tag = `${c.magenta}[Pipeline]${c.reset}`;
24461
+ const issue = `${c.cyan}${issueKey}${c.reset}`;
24462
+ const levels = {
24463
+ info: `${c.blue}INFO ${c.reset}`,
24464
+ ok: `${c.green}OK ${c.reset}`,
24465
+ fail: `${c.red}FAIL ${c.reset}`,
24466
+ skip: `${c.gray}SKIP ${c.reset}`
24467
+ };
24468
+ console.log(`${time} ${levels[level]}${tag} ${issue} ${message}`);
24469
+ }
24324
24470
  async function implementIssue(supervisor, agentId, payload, workflow) {
24325
24471
  const instruction = {
24326
24472
  prompt: `Execute this workflow for issue #${payload.issueNumber}: ${payload.title}
@@ -24549,7 +24695,7 @@ Automated by Moxxy.`,
24549
24695
  base: defaultBranch
24550
24696
  });
24551
24697
  }
24552
- var import_crypto4, GitHubError, GitHubAuthError, GitHubWebhookError, GitHubPipelineError, GitHubClient, STAGE_LABELS, DEFAULT_CLASSIFICATION, DEFAULT_RESEARCH, DEFAULT_INSPECT, IssuePipeline, WebhookServer, GitHubIntegration;
24698
+ var import_crypto4, GitHubError, GitHubAuthError, GitHubWebhookError, GitHubPipelineError, GitHubClient, STAGE_LABELS2, c, ConsolePipelineLogger, DEFAULT_CLASSIFICATION, DEFAULT_RESEARCH, DEFAULT_INSPECT, IssuePipeline, WebhookServer, GitHubIntegration;
24553
24699
  var init_dist7 = __esm({
24554
24700
  "../integration-github/dist/index.mjs"() {
24555
24701
  "use strict";
@@ -24652,13 +24798,53 @@ var init_dist7 = __esm({
24652
24798
  return data;
24653
24799
  }
24654
24800
  };
24655
- STAGE_LABELS = {
24801
+ STAGE_LABELS2 = {
24656
24802
  triage: "Triage",
24657
24803
  research: "Research",
24658
24804
  inspect: "Inspect",
24659
24805
  plan: "Plan",
24660
24806
  implement: "Implement"
24661
24807
  };
24808
+ c = {
24809
+ reset: "\x1B[0m",
24810
+ bold: "\x1B[1m",
24811
+ dim: "\x1B[2m",
24812
+ red: "\x1B[31m",
24813
+ green: "\x1B[32m",
24814
+ yellow: "\x1B[33m",
24815
+ blue: "\x1B[34m",
24816
+ magenta: "\x1B[35m",
24817
+ cyan: "\x1B[36m",
24818
+ gray: "\x1B[90m"
24819
+ };
24820
+ ConsolePipelineLogger = class {
24821
+ pipelineStart(issueKey, title, stages, skipped) {
24822
+ log3("info", issueKey, `${c.bold}Pipeline started${c.reset} \u2014 ${title}`);
24823
+ const skipNote = skipped.length ? ` ${c.dim}(skipped: ${skipped.join(", ")})${c.reset}` : "";
24824
+ log3("info", issueKey, `Stages: ${stages.join(" \u2192 ")}${skipNote}`);
24825
+ }
24826
+ stageStart(issueKey, stage) {
24827
+ log3("info", issueKey, `Stage ${c.bold}${stage}${c.reset} starting...`);
24828
+ }
24829
+ stageSkip(issueKey, stage) {
24830
+ log3("skip", issueKey, `Stage ${stage} skipped \u2014 using defaults`);
24831
+ }
24832
+ stageComplete(issueKey, stage, durationMs) {
24833
+ log3("ok", issueKey, `Stage ${c.bold}${stage}${c.reset} completed in ${formatDuration2(durationMs)}`);
24834
+ }
24835
+ stageFail(issueKey, stage, error2, durationMs) {
24836
+ log3("fail", issueKey, `Stage ${c.bold}${stage}${c.reset} failed in ${formatDuration2(durationMs)} \u2014 ${error2}`);
24837
+ }
24838
+ info(issueKey, message) {
24839
+ log3("info", issueKey, message);
24840
+ }
24841
+ pipelineComplete(issueKey, durationMs, prNumber, branch) {
24842
+ log3("ok", issueKey, `${c.bold}Pipeline completed${c.reset} in ${formatDuration2(durationMs)} \u2014 PR #${prNumber} on branch ${branch}`);
24843
+ }
24844
+ pipelineFail(issueKey, durationMs, error2) {
24845
+ log3("fail", issueKey, `${c.bold}Pipeline failed${c.reset} after ${formatDuration2(durationMs)} \u2014 ${error2}`);
24846
+ }
24847
+ };
24662
24848
  DEFAULT_CLASSIFICATION = {
24663
24849
  type: "feature",
24664
24850
  priority: "medium",
@@ -24679,7 +24865,7 @@ var init_dist7 = __esm({
24679
24865
  estimatedChanges: []
24680
24866
  };
24681
24867
  IssuePipeline = class {
24682
- constructor(supervisor, moltAgentId, github, enabledStages) {
24868
+ constructor(supervisor, moltAgentId, github, enabledStages, logger) {
24683
24869
  this.supervisor = supervisor;
24684
24870
  this.moltAgentId = moltAgentId;
24685
24871
  this.github = github;
@@ -24687,8 +24873,10 @@ var init_dist7 = __esm({
24687
24873
  if (!stages.includes("plan")) stages.push("plan");
24688
24874
  if (!stages.includes("implement")) stages.push("implement");
24689
24875
  this.enabledStages = new Set(stages);
24876
+ this.logger = logger ?? new ConsolePipelineLogger();
24690
24877
  }
24691
24878
  enabledStages;
24879
+ logger;
24692
24880
  async run(payload) {
24693
24881
  const pipelineRun = {
24694
24882
  id: `pipeline-${Date.now()}`,
@@ -24699,8 +24887,12 @@ var init_dist7 = __esm({
24699
24887
  createdAt: Date.now(),
24700
24888
  updatedAt: Date.now()
24701
24889
  };
24890
+ const issueKey = `#${payload.issueNumber}`;
24702
24891
  const activeStages = PIPELINE_STAGES.filter((s) => this.enabledStages.has(s));
24892
+ const skippedStages = PIPELINE_STAGES.filter((s) => !this.enabledStages.has(s));
24893
+ this.logger.pipelineStart(issueKey, payload.title, activeStages, skippedStages);
24703
24894
  let commentId;
24895
+ const pipelineStart = Date.now();
24704
24896
  try {
24705
24897
  commentId = await this.github.commentOnIssue(
24706
24898
  payload.repo.owner,
@@ -24710,60 +24902,75 @@ var init_dist7 = __esm({
24710
24902
  );
24711
24903
  let classification;
24712
24904
  if (this.enabledStages.has("triage")) {
24905
+ this.logger.stageStart(issueKey, "triage");
24713
24906
  const triageResult = await this.runStage(
24714
24907
  "triage",
24715
24908
  () => triageIssue(this.supervisor, this.moltAgentId, payload)
24716
24909
  );
24717
24910
  pipelineRun.stages.push(triageResult);
24911
+ this.logStageResult(issueKey, triageResult);
24718
24912
  if (triageResult.status === "failed")
24719
24913
  throw new Error(`Triage failed: ${triageResult.error}`);
24720
24914
  classification = triageResult.output;
24915
+ this.logger.info(issueKey, `Classification: ${classification.type} / ${classification.priority} priority / ${classification.complexity} complexity (confidence: ${classification.confidence})`);
24721
24916
  } else {
24917
+ this.logger.stageSkip(issueKey, "triage");
24722
24918
  classification = DEFAULT_CLASSIFICATION;
24723
24919
  }
24724
24920
  pipelineRun.classification = classification;
24725
24921
  let researchOutput;
24726
24922
  if (this.enabledStages.has("research")) {
24923
+ this.logger.stageStart(issueKey, "research");
24727
24924
  const researchResult = await this.runStage(
24728
24925
  "research",
24729
24926
  () => researchIssue(this.supervisor, this.moltAgentId, payload, classification)
24730
24927
  );
24731
24928
  pipelineRun.stages.push(researchResult);
24929
+ this.logStageResult(issueKey, researchResult);
24732
24930
  if (researchResult.status === "failed")
24733
24931
  throw new Error(`Research failed: ${researchResult.error}`);
24734
24932
  researchOutput = researchResult.output;
24735
24933
  } else {
24934
+ this.logger.stageSkip(issueKey, "research");
24736
24935
  researchOutput = DEFAULT_RESEARCH;
24737
24936
  }
24738
24937
  let inspectOutput;
24739
24938
  if (this.enabledStages.has("inspect")) {
24939
+ this.logger.stageStart(issueKey, "inspect");
24740
24940
  const inspectResult = await this.runStage(
24741
24941
  "inspect",
24742
24942
  () => inspectIssue(this.supervisor, this.moltAgentId, payload, researchOutput)
24743
24943
  );
24744
24944
  pipelineRun.stages.push(inspectResult);
24945
+ this.logStageResult(issueKey, inspectResult);
24745
24946
  if (inspectResult.status === "failed")
24746
24947
  throw new Error(`Inspect failed: ${inspectResult.error}`);
24747
24948
  inspectOutput = inspectResult.output;
24748
24949
  } else {
24950
+ this.logger.stageSkip(issueKey, "inspect");
24749
24951
  inspectOutput = DEFAULT_INSPECT;
24750
24952
  }
24953
+ this.logger.stageStart(issueKey, "plan");
24751
24954
  const planResult = await this.runStage(
24752
24955
  "plan",
24753
24956
  () => planIssue(this.supervisor, this.moltAgentId, payload, inspectOutput)
24754
24957
  );
24755
24958
  pipelineRun.stages.push(planResult);
24959
+ this.logStageResult(issueKey, planResult);
24756
24960
  if (planResult.status === "failed") throw new Error(`Plan failed: ${planResult.error}`);
24757
24961
  const branchName = `moxxy/issue-${payload.issueNumber}`;
24758
24962
  const workflow = buildWorkflow(payload, planResult.output, branchName);
24963
+ this.logger.stageStart(issueKey, "implement");
24759
24964
  const implementResult = await this.runStage(
24760
24965
  "implement",
24761
24966
  () => implementIssue(this.supervisor, this.moltAgentId, payload, workflow)
24762
24967
  );
24763
24968
  pipelineRun.stages.push(implementResult);
24969
+ this.logStageResult(issueKey, implementResult);
24764
24970
  if (implementResult.status === "failed")
24765
24971
  throw new Error(`Implement failed: ${implementResult.error}`);
24766
24972
  pipelineRun.branchName = branchName;
24973
+ this.logger.info(issueKey, "Creating pull request...");
24767
24974
  const classificationNote = pipelineRun.classification ? `
24768
24975
 
24769
24976
  **Classification:** ${pipelineRun.classification.type} (${pipelineRun.classification.priority} priority, ${pipelineRun.classification.complexity} complexity)` : "";
@@ -24778,6 +24985,7 @@ Automated implementation by Moxxy.${classificationNote}`,
24778
24985
  pipelineRun.prNumber = prNumber;
24779
24986
  pipelineRun.status = "completed";
24780
24987
  pipelineRun.updatedAt = Date.now();
24988
+ this.logger.pipelineComplete(issueKey, Date.now() - pipelineStart, prNumber, branchName);
24781
24989
  if (commentId) {
24782
24990
  await this.github.updateComment(
24783
24991
  payload.repo.owner,
@@ -24790,6 +24998,8 @@ Automated implementation by Moxxy.${classificationNote}`,
24790
24998
  } catch (error2) {
24791
24999
  pipelineRun.status = "failed";
24792
25000
  pipelineRun.updatedAt = Date.now();
25001
+ const errMsg = error2 instanceof Error ? error2.message : String(error2);
25002
+ this.logger.pipelineFail(issueKey, Date.now() - pipelineStart, errMsg);
24793
25003
  if (commentId) {
24794
25004
  await this.github.updateComment(
24795
25005
  payload.repo.owner,
@@ -24802,6 +25012,13 @@ Automated implementation by Moxxy.${classificationNote}`,
24802
25012
  return pipelineRun;
24803
25013
  }
24804
25014
  }
25015
+ logStageResult(issueKey, result) {
25016
+ if (result.status === "completed") {
25017
+ this.logger.stageComplete(issueKey, result.stage, result.duration_ms ?? 0);
25018
+ } else {
25019
+ this.logger.stageFail(issueKey, result.stage, result.error ?? "Unknown error", result.duration_ms ?? 0);
25020
+ }
25021
+ }
24805
25022
  async runStage(stage, fn) {
24806
25023
  const start = Date.now();
24807
25024
  try {
@@ -24832,23 +25049,23 @@ Automated implementation by Moxxy.${classificationNote}`,
24832
25049
  this.setupRoutes();
24833
25050
  }
24834
25051
  setupRoutes() {
24835
- this.app.get("/health", (c) => {
24836
- return c.json({ status: "ok", timestamp: Date.now() });
25052
+ this.app.get("/health", (c2) => {
25053
+ return c2.json({ status: "ok", timestamp: Date.now() });
24837
25054
  });
24838
- this.app.post(this.config.path, async (c) => {
25055
+ this.app.post(this.config.path, async (c2) => {
24839
25056
  try {
24840
- const rawBody = await c.req.text();
25057
+ const rawBody = await c2.req.text();
24841
25058
  if (this.config.secret) {
24842
- const signature = c.req.header("x-hub-signature-256") || "";
25059
+ const signature = c2.req.header("x-hub-signature-256") || "";
24843
25060
  if (!signature) {
24844
- return c.json({ error: "Missing signature" }, 401);
25061
+ return c2.json({ error: "Missing signature" }, 401);
24845
25062
  }
24846
25063
  if (!verifyWebhookSignature(rawBody, signature, this.config.secret)) {
24847
- return c.json({ error: "Invalid signature" }, 401);
25064
+ return c2.json({ error: "Invalid signature" }, 401);
24848
25065
  }
24849
25066
  }
24850
25067
  const body = JSON.parse(rawBody);
24851
- const event = c.req.header("x-github-event") || "";
25068
+ const event = c2.req.header("x-github-event") || "";
24852
25069
  if (event === "issues") {
24853
25070
  const payload = parseIssuePayload(body);
24854
25071
  if (payload) {
@@ -24857,7 +25074,7 @@ Automated implementation by Moxxy.${classificationNote}`,
24857
25074
  });
24858
25075
  }
24859
25076
  }
24860
- return c.json({ received: true });
25077
+ return c2.json({ received: true });
24861
25078
  } catch (error2) {
24862
25079
  const message = error2 instanceof Error ? error2.message : String(error2);
24863
25080
  throw new GitHubWebhookError(
@@ -24913,7 +25130,8 @@ Automated implementation by Moxxy.${classificationNote}`,
24913
25130
  this.config.supervisor,
24914
25131
  this.config.moltAgentId,
24915
25132
  this.client,
24916
- this.config.enabledStages
25133
+ this.config.enabledStages,
25134
+ this.config.pipelineLogger
24917
25135
  );
24918
25136
  await this.client.verifyAuth();
24919
25137
  this.webhookServer = new WebhookServer({
@@ -25066,7 +25284,8 @@ function registerStartCommand(program) {
25066
25284
  sdk,
25067
25285
  supervisor,
25068
25286
  moltAgentId: agentId || "",
25069
- enabledStages: config.pipeline?.enabledStages
25287
+ enabledStages: config.pipeline?.enabledStages,
25288
+ pipelineLogger: new SpinnerPipelineLogger()
25070
25289
  });
25071
25290
  webhookSpinner.succeed(
25072
25291
  `Webhook server listening on ${import_chalk.default.cyan(`${webhookConfig.host}:${webhookConfig.port}${webhookConfig.path}`)}`
@@ -25111,6 +25330,7 @@ var init_start = __esm({
25111
25330
  "use strict";
25112
25331
  init_config_manager();
25113
25332
  init_logger();
25333
+ init_pipeline_logger();
25114
25334
  SDK_NAMES2 = {
25115
25335
  molt: "Molt Gateway",
25116
25336
  claude: "Claude CLI"
@@ -25206,7 +25426,7 @@ __export(cli_exports, {
25206
25426
  });
25207
25427
  function createProgram() {
25208
25428
  const program = new import_commander.Command();
25209
- program.name("moxxy").description("Moxxy - Agent orchestration platform").version("0.0.8");
25429
+ program.name("moxxy").description("Moxxy - Agent orchestration platform").version("0.0.10");
25210
25430
  registerStartCommand(program);
25211
25431
  registerRepoCommand(program);
25212
25432
  registerConfigCommand(program);