@rashidee/co2 1.3.7 → 1.3.9

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.
Files changed (77) hide show
  1. package/dist/.co2-dat/app.db +0 -0
  2. package/dist/.co2-dat/app.db-shm +0 -0
  3. package/dist/.co2-dat/app.db-wal +0 -0
  4. package/dist/index.js +204 -75
  5. package/package.json +41 -41
  6. package/plugin/skills/conductor-feature-develop/SKILL.md +1384 -1383
  7. package/plugin/skills/conductor-feature-develop/references/playwright-setup.md +225 -224
  8. package/plugin/skills/mockgen-shadcn/SKILL.md +1073 -1067
  9. package/plugin/skills/mockgen-shadcn/references/admin-layout-template.md +5 -3
  10. package/plugin/skills/mockgen-shadcn/references/mockup-hub-template.md +631 -498
  11. package/plugin/skills/mockgen-shadcn/references/mockup-index-template.md +2 -2
  12. package/plugin/skills/mockgen-tailwind/SKILL.md +913 -904
  13. package/plugin/skills/mockgen-tailwind/references/admin-layout-template.md +722 -720
  14. package/plugin/skills/mockgen-tailwind/references/mockup-hub-template.md +631 -498
  15. package/plugin/skills/mockgen-tailwind/references/mockup-index-template.md +190 -190
  16. package/static/assets/{abnfDiagram-VRR7QNED-CsyqZblo.js → abnfDiagram-VRR7QNED-C0CrqPXX.js} +1 -1
  17. package/static/assets/{arc-it3yvCvj.js → arc-BFSRYIcI.js} +1 -1
  18. package/static/assets/{architectureDiagram-ZJ3FMSHR-sjNv2MOQ.js → architectureDiagram-ZJ3FMSHR-DuwTK2W9.js} +1 -1
  19. package/static/assets/{blockDiagram-677ZJIJ3-DW9ZjtwO.js → blockDiagram-677ZJIJ3-Bn9tAB0n.js} +1 -1
  20. package/static/assets/{c4Diagram-LMCZKHZV-DP3gJkhN.js → c4Diagram-LMCZKHZV-CDiCEjY7.js} +1 -1
  21. package/static/assets/channel-CZGeGYqv.js +1 -0
  22. package/static/assets/{chunk-2Q5K7J3B-ByxTr7KB.js → chunk-2Q5K7J3B-BMwS7NgW.js} +1 -1
  23. package/static/assets/{chunk-32BRIVSS-vNETwpX4.js → chunk-32BRIVSS-8l0XBCjq.js} +1 -1
  24. package/static/assets/{chunk-5VM5RSS4-DbdsRtpE.js → chunk-5VM5RSS4-C6Cv-67E.js} +1 -1
  25. package/static/assets/{chunk-EX3LRPZG-DPkDGikN.js → chunk-EX3LRPZG-DjWs4lB9.js} +1 -1
  26. package/static/assets/{chunk-JWPE2WC7-Ccpx-Rog.js → chunk-JWPE2WC7-DuK_Mu9c.js} +1 -1
  27. package/static/assets/{chunk-MOJQB5TN-CnRPtHb3.js → chunk-MOJQB5TN-K-bFFmpr.js} +1 -1
  28. package/static/assets/{chunk-RYQCIY6F-C--_KRGR.js → chunk-RYQCIY6F-B-b4TyDb.js} +1 -1
  29. package/static/assets/{chunk-V7JOEXUC-BJQ5fwNa.js → chunk-V7JOEXUC-BZRKjyVr.js} +1 -1
  30. package/static/assets/{chunk-VR4S4FIN-BPcVRYqJ.js → chunk-VR4S4FIN-BcvbM_n3.js} +1 -1
  31. package/static/assets/{chunk-XXDRQBXY-BoC3DCKQ.js → chunk-XXDRQBXY-Z2nhcpRg.js} +1 -1
  32. package/static/assets/classDiagram-OUVF2IWQ-DV5beYlE.js +1 -0
  33. package/static/assets/classDiagram-v2-EOCWNBFH-DV5beYlE.js +1 -0
  34. package/static/assets/{cose-bilkent-JH36ORCC-DlKrOw_E.js → cose-bilkent-JH36ORCC-CPBw8Z2X.js} +1 -1
  35. package/static/assets/{cynefin-VYW2F7L2-CZQhaPM1.js → cynefin-VYW2F7L2-DeJ1X-1F.js} +1 -1
  36. package/static/assets/{cynefinDiagram-TSTJHNR4-cZP74_0I.js → cynefinDiagram-TSTJHNR4-BPs3jIZR.js} +1 -1
  37. package/static/assets/{dagre-VKFMJZFB-tB2cBd_e.js → dagre-VKFMJZFB-Bn5Xp63O.js} +1 -1
  38. package/static/assets/{diagram-FQU43EPY-QwoADT9c.js → diagram-FQU43EPY-DWIlVMUR.js} +1 -1
  39. package/static/assets/{diagram-G47NLZAW-Bjz2rwUz.js → diagram-G47NLZAW-BWxpunVI.js} +1 -1
  40. package/static/assets/{diagram-NH7WQ7WH-DS9j6K7F.js → diagram-NH7WQ7WH-CpoAYUis.js} +1 -1
  41. package/static/assets/{diagram-OA4YK3LP-CUPwlGEi.js → diagram-OA4YK3LP-Dv1XfQGK.js} +1 -1
  42. package/static/assets/{diagram-WEI45ONY-iejOZOdV.js → diagram-WEI45ONY-DSk6wZtO.js} +1 -1
  43. package/static/assets/{ebnfDiagram-CCIWWBDH-Bg3puNXE.js → ebnfDiagram-CCIWWBDH-DIDhI2dD.js} +1 -1
  44. package/static/assets/{erDiagram-Q63AITRT-DTxdGEtK.js → erDiagram-Q63AITRT-CGO6ep6G.js} +1 -1
  45. package/static/assets/{flowDiagram-23GEKE2U-CRl-AJlj.js → flowDiagram-23GEKE2U-D8nzLjfG.js} +1 -1
  46. package/static/assets/{ganttDiagram-NO4QXBWP-wCOJ8cfC.js → ganttDiagram-NO4QXBWP-Usz8f26d.js} +1 -1
  47. package/static/assets/{gitGraphDiagram-IHSO6WYX-CnVtKot-.js → gitGraphDiagram-IHSO6WYX-WEJUXa7P.js} +1 -1
  48. package/static/assets/{index-xLqMMC0F.css → index-CM4GfOLV.css} +1 -1
  49. package/static/assets/{index-DAL1vVaa.js → index-j3pCmOym.js} +194 -194
  50. package/static/assets/{infoDiagram-FWYZ7A6U-DmvEl4fi.js → infoDiagram-FWYZ7A6U-BRPwqRvz.js} +1 -1
  51. package/static/assets/{ishikawaDiagram-FXEZZL3T-CjKerAXn.js → ishikawaDiagram-FXEZZL3T-CrntEiqz.js} +1 -1
  52. package/static/assets/{journeyDiagram-5HDEW3XC-Bmc4ARKl.js → journeyDiagram-5HDEW3XC-BmhRsz4F.js} +1 -1
  53. package/static/assets/{kanban-definition-HUTT4EX6-BZ9I3imN.js → kanban-definition-HUTT4EX6-CWxUXdc3.js} +1 -1
  54. package/static/assets/{linear-CrHKLpp_.js → linear-BGjzqzT6.js} +1 -1
  55. package/static/assets/{mindmap-definition-LN4V7U3C-SUk59XXF.js → mindmap-definition-LN4V7U3C-CoVNmO4b.js} +1 -1
  56. package/static/assets/{pegDiagram-2B236MQR-CknFYdh_.js → pegDiagram-2B236MQR-hBHOzL7x.js} +1 -1
  57. package/static/assets/{pieDiagram-ENE6RG2P-B3VlLXXT.js → pieDiagram-ENE6RG2P-Cpv7VZPG.js} +1 -1
  58. package/static/assets/{quadrantDiagram-ABIIQ3AL-BUkZjvW_.js → quadrantDiagram-ABIIQ3AL-BIQAB21D.js} +1 -1
  59. package/static/assets/{railroadDiagram-RFXS5EU6-LklmPimD.js → railroadDiagram-RFXS5EU6-DX6hST3S.js} +1 -1
  60. package/static/assets/{requirementDiagram-TGXJPOKE-DnRFaZbz.js → requirementDiagram-TGXJPOKE-Gas2cE_l.js} +1 -1
  61. package/static/assets/{sankeyDiagram-HTMAVEWB-D242DUlQ.js → sankeyDiagram-HTMAVEWB-BpwoyJDe.js} +1 -1
  62. package/static/assets/{sequenceDiagram-DBY2YBRQ-DmiiStqo.js → sequenceDiagram-DBY2YBRQ-CzBxna5k.js} +1 -1
  63. package/static/assets/{sizeCapture-X5ZJPWSS-cbMvR047.js → sizeCapture-X5ZJPWSS-Cn-5NsLr.js} +1 -1
  64. package/static/assets/{stateDiagram-2N3HPSRC-YIIylI9N.js → stateDiagram-2N3HPSRC-BiW03iCW.js} +1 -1
  65. package/static/assets/stateDiagram-v2-6OUMAXLB-CmQ_Kjkj.js +1 -0
  66. package/static/assets/{swimlanes-5IMT3BWC-Ba309Ysu.js → swimlanes-5IMT3BWC-3jPuufWt.js} +2 -2
  67. package/static/assets/swimlanesDiagram-G3AALYLV-OaMW2HRF.js +8 -0
  68. package/static/assets/{timeline-definition-FHXFAJF6-BdpW3kGY.js → timeline-definition-FHXFAJF6-CzThWt1O.js} +1 -1
  69. package/static/assets/{vennDiagram-L72KCM5P-BiSgQ9Lf.js → vennDiagram-L72KCM5P-D1Axj0CM.js} +1 -1
  70. package/static/assets/{wardleyDiagram-EHGQE667-Clr8YWGW.js → wardleyDiagram-EHGQE667-mKj7UT6Q.js} +1 -1
  71. package/static/assets/{xychartDiagram-FW5EYKEG-LsC066MO.js → xychartDiagram-FW5EYKEG-CSAkvAer.js} +1 -1
  72. package/static/index.html +2 -2
  73. package/static/assets/channel-C_J_aLZ7.js +0 -1
  74. package/static/assets/classDiagram-OUVF2IWQ-yUfBrCjx.js +0 -1
  75. package/static/assets/classDiagram-v2-EOCWNBFH-yUfBrCjx.js +0 -1
  76. package/static/assets/stateDiagram-v2-6OUMAXLB-m0MSGh0v.js +0 -1
  77. package/static/assets/swimlanesDiagram-G3AALYLV-DY_J_ih_.js +0 -8
Binary file
Binary file
Binary file
package/dist/index.js CHANGED
@@ -6809,7 +6809,7 @@ var {
6809
6809
  // package.json
6810
6810
  var package_default = {
6811
6811
  name: "@rashidee/co2",
6812
- version: "1.3.7",
6812
+ version: "1.3.9",
6813
6813
  description: "Compound Context Studio \u2014 self-hosted team context authoring for CO2 projects",
6814
6814
  type: "module",
6815
6815
  license: "MIT",
@@ -19258,8 +19258,13 @@ var mockupHubStatusSchema = external_exports.object({
19258
19258
  // HTTP probe on the hub port succeeded
19259
19259
  port: external_exports.number().int().nullable(),
19260
19260
  // resolved port (null when hub absent)
19261
- url: external_exports.string().nullable()
19261
+ url: external_exports.string().nullable(),
19262
19262
  // client-facing URL (request host + hub port)
19263
+ // Prefill for the Mockup page's port input: the configured/running port when known,
19264
+ // else the first unused port starting from 4000.
19265
+ suggestedPort: external_exports.number().int(),
19266
+ // True while the hub process was spawned by (and is stoppable from) co2-cli itself.
19267
+ spawned: external_exports.boolean()
19263
19268
  });
19264
19269
 
19265
19270
  // ../core/src/schemas/notification.ts
@@ -19747,12 +19752,14 @@ var zValidator = (target, schema, hook) => (
19747
19752
 
19748
19753
  // ../server/src/features/artifact/mockup-hub.ts
19749
19754
  import { spawn } from "child_process";
19750
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
19755
+ import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
19751
19756
  import { request as httpRequest } from "http";
19757
+ import { connect, createServer } from "net";
19752
19758
  import { join as join2 } from "path";
19753
19759
  function svcError(code, status) {
19754
19760
  return Object.assign(new Error(code), { code, status });
19755
19761
  }
19762
+ var HUB_PORT_SCAN_START = 4e3;
19756
19763
  var spawnedHubs = /* @__PURE__ */ new Map();
19757
19764
  function killSpawnedHubs() {
19758
19765
  for (const [, child] of spawnedHubs) {
@@ -19775,14 +19782,14 @@ function resolveHub(db, workspacePath, projectId) {
19775
19782
  const hubDir = [join2(projectDir2, "mockup"), join2(projectDir2, "source", "mockup")].find(
19776
19783
  (d) => existsSync2(join2(d, "server.js"))
19777
19784
  );
19778
- if (!hubDir) return { hubDir: join2(projectDir2, "mockup"), present: false, port: 3e3 };
19779
- let port = 3e3;
19785
+ if (!hubDir) return { hubDir: join2(projectDir2, "mockup"), present: false, configPort: null };
19786
+ let configPort = null;
19780
19787
  try {
19781
19788
  const config = JSON.parse(readFileSync2(join2(hubDir, "mockup.config.json"), "utf8"));
19782
- if (typeof config.port === "number") port = config.port;
19789
+ if (typeof config.port === "number") configPort = config.port;
19783
19790
  } catch {
19784
19791
  }
19785
- return { hubDir, present: true, port };
19792
+ return { hubDir, present: true, configPort };
19786
19793
  }
19787
19794
  function probeHub(port, timeoutMs = 1e3) {
19788
19795
  return new Promise((resolve5) => {
@@ -19801,40 +19808,112 @@ function probeHub(port, timeoutMs = 1e3) {
19801
19808
  req.end();
19802
19809
  });
19803
19810
  }
19804
- function toStatus(location, running, requestHost) {
19811
+ function tcpBusy(port, timeoutMs = 400) {
19812
+ return new Promise((resolve5) => {
19813
+ const sock = connect({ host: "127.0.0.1", port, timeout: timeoutMs });
19814
+ sock.once("connect", () => {
19815
+ sock.destroy();
19816
+ resolve5(true);
19817
+ });
19818
+ sock.once("timeout", () => {
19819
+ sock.destroy();
19820
+ resolve5(false);
19821
+ });
19822
+ sock.once("error", () => resolve5(false));
19823
+ });
19824
+ }
19825
+ async function isPortFree(port) {
19826
+ if (await tcpBusy(port)) return false;
19827
+ return new Promise((resolve5) => {
19828
+ const probe2 = createServer();
19829
+ probe2.once("error", () => resolve5(false));
19830
+ probe2.listen(port, "0.0.0.0", () => {
19831
+ probe2.close(() => resolve5(true));
19832
+ });
19833
+ });
19834
+ }
19835
+ async function findUnusedPort(start = HUB_PORT_SCAN_START) {
19836
+ for (let port = start; port < start + 100; port++) {
19837
+ if (await isPortFree(port)) return port;
19838
+ }
19839
+ return start;
19840
+ }
19841
+ async function detectHub(location) {
19842
+ if (!location.present || !location.configPort) {
19843
+ return { location, running: false, activePort: null };
19844
+ }
19845
+ const running = await probeHub(location.configPort);
19846
+ return { location, running, activePort: location.configPort };
19847
+ }
19848
+ async function toStatus(state, requestHost, projectId) {
19805
19849
  const hostname = requestHost.replace(/:\d+$/, "") || "localhost";
19850
+ const { location, running, activePort } = state;
19851
+ const suggestedPort = activePort ?? await findUnusedPort();
19852
+ const child = spawnedHubs.get(projectId);
19806
19853
  return {
19807
19854
  present: location.present,
19808
19855
  running,
19809
- port: location.present ? location.port : null,
19810
- url: location.present ? `http://${hostname}:${location.port}/` : null
19856
+ port: location.present ? activePort : null,
19857
+ url: location.present && activePort ? `http://${hostname}:${activePort}/` : null,
19858
+ suggestedPort,
19859
+ spawned: running && child != null && child.exitCode === null
19811
19860
  };
19812
19861
  }
19813
19862
  async function getMockupHubStatus(db, workspacePath, projectId, requestHost) {
19814
19863
  const location = resolveHub(db, workspacePath, projectId);
19815
- const running = location.present ? await probeHub(location.port) : false;
19816
- return toStatus(location, running, requestHost);
19864
+ return toStatus(await detectHub(location), requestHost, projectId);
19817
19865
  }
19818
- async function startMockupHub(db, workspacePath, projectId, requestHost) {
19866
+ async function startMockupHub(db, workspacePath, projectId, requestHost, port) {
19819
19867
  const location = resolveHub(db, workspacePath, projectId);
19820
19868
  if (!location.present) throw svcError("MOCKUP_HUB_MISSING", 404);
19821
- if (await probeHub(location.port)) return toStatus(location, true, requestHost);
19869
+ const targetPort = port ?? location.configPort ?? await findUnusedPort();
19870
+ if (await probeHub(targetPort)) {
19871
+ return toStatus({ location, running: true, activePort: targetPort }, requestHost, projectId);
19872
+ }
19873
+ if (targetPort !== location.configPort) {
19874
+ try {
19875
+ writeFileSync(
19876
+ join2(location.hubDir, "mockup.config.json"),
19877
+ `${JSON.stringify({ port: targetPort }, null, 2)}
19878
+ `
19879
+ );
19880
+ location.configPort = targetPort;
19881
+ } catch {
19882
+ }
19883
+ }
19822
19884
  const existing = spawnedHubs.get(projectId);
19823
- if (!existing || existing.exitCode !== null) {
19824
- const child = spawn(process.execPath, ["server.js"], {
19825
- cwd: location.hubDir,
19826
- stdio: "ignore",
19827
- env: { ...process.env, PORT: String(location.port) }
19828
- });
19829
- child.on("error", () => spawnedHubs.delete(projectId));
19830
- child.on("exit", () => spawnedHubs.delete(projectId));
19831
- spawnedHubs.set(projectId, child);
19885
+ if (existing && existing.exitCode === null) {
19886
+ try {
19887
+ existing.kill();
19888
+ } catch {
19889
+ }
19890
+ spawnedHubs.delete(projectId);
19832
19891
  }
19892
+ const child = spawn(process.execPath, ["server.js"], {
19893
+ cwd: location.hubDir,
19894
+ stdio: "ignore",
19895
+ env: { ...process.env, PORT: String(targetPort) }
19896
+ });
19897
+ child.on("error", () => spawnedHubs.delete(projectId));
19898
+ child.on("exit", () => spawnedHubs.delete(projectId));
19899
+ spawnedHubs.set(projectId, child);
19833
19900
  for (let attempt = 0; attempt < 20; attempt++) {
19834
- if (await probeHub(location.port, 500)) return toStatus(location, true, requestHost);
19901
+ if (await probeHub(targetPort, 500)) {
19902
+ return toStatus({ location, running: true, activePort: targetPort }, requestHost, projectId);
19903
+ }
19835
19904
  await new Promise((r) => setTimeout(r, 250));
19836
19905
  }
19837
- return toStatus(location, false, requestHost);
19906
+ return toStatus({ location, running: false, activePort: targetPort }, requestHost, projectId);
19907
+ }
19908
+ function stopMockupHub(projectId) {
19909
+ const child = spawnedHubs.get(projectId);
19910
+ if (!child) return false;
19911
+ try {
19912
+ child.kill();
19913
+ } catch {
19914
+ }
19915
+ spawnedHubs.delete(projectId);
19916
+ return true;
19838
19917
  }
19839
19918
 
19840
19919
  // ../server/src/features/artifact/service.ts
@@ -20089,19 +20168,39 @@ function artifactRoutes(db, workspacePath) {
20089
20168
  return errorResponse(c, e);
20090
20169
  }
20091
20170
  });
20092
- app.post("/mockup-hub/start", zValidator("json", hubQuerySchema), async (c) => {
20171
+ const hubStartSchema = hubQuerySchema.extend({
20172
+ port: external_exports.coerce.number().int().min(1024).max(65535).optional()
20173
+ });
20174
+ app.post("/mockup-hub/start", zValidator("json", hubStartSchema), async (c) => {
20093
20175
  try {
20176
+ const { projectId, port } = c.req.valid("json");
20094
20177
  const status = await startMockupHub(
20095
20178
  db,
20096
20179
  workspacePath,
20097
- c.req.valid("json").projectId,
20098
- c.req.header("host") ?? "localhost"
20180
+ projectId,
20181
+ c.req.header("host") ?? "localhost",
20182
+ port
20099
20183
  );
20100
20184
  return c.json(status);
20101
20185
  } catch (e) {
20102
20186
  return errorResponse(c, e);
20103
20187
  }
20104
20188
  });
20189
+ app.post("/mockup-hub/stop", zValidator("json", hubQuerySchema), async (c) => {
20190
+ try {
20191
+ const { projectId } = c.req.valid("json");
20192
+ const host = c.req.header("host") ?? "localhost";
20193
+ const stopped = stopMockupHub(projectId);
20194
+ let status = await getMockupHubStatus(db, workspacePath, projectId, host);
20195
+ for (let attempt = 0; stopped && status.running && attempt < 8; attempt++) {
20196
+ await new Promise((r) => setTimeout(r, 250));
20197
+ status = await getMockupHubStatus(db, workspacePath, projectId, host);
20198
+ }
20199
+ return c.json({ stopped, status });
20200
+ } catch (e) {
20201
+ return errorResponse(c, e);
20202
+ }
20203
+ });
20105
20204
  app.get("/:id/content", (c) => {
20106
20205
  const id = Number(c.req.param("id"));
20107
20206
  if (Number.isNaN(id)) return c.json({ code: "INVALID_ID" }, 400);
@@ -20116,7 +20215,7 @@ function artifactRoutes(db, workspacePath) {
20116
20215
  }
20117
20216
 
20118
20217
  // ../server/src/features/brainstorm/service.ts
20119
- import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
20218
+ import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
20120
20219
  import { join as join8 } from "path";
20121
20220
 
20122
20221
  // ../server/src/features/notification/service.ts
@@ -20172,11 +20271,11 @@ function filterClause(userId, filter) {
20172
20271
  import { join as join7 } from "path";
20173
20272
 
20174
20273
  // ../server/src/features/context-authoring/prd-file.ts
20175
- import { existsSync as existsSync5, readFileSync as readFileSync4, readdirSync as readdirSync2, writeFileSync as writeFileSync2 } from "fs";
20274
+ import { existsSync as existsSync5, readFileSync as readFileSync4, readdirSync as readdirSync2, writeFileSync as writeFileSync3 } from "fs";
20176
20275
  import { join as join5 } from "path";
20177
20276
 
20178
20277
  // ../server/src/features/context-authoring/service.ts
20179
- import { existsSync as existsSync4, mkdirSync, writeFileSync } from "fs";
20278
+ import { existsSync as existsSync4, mkdirSync, writeFileSync as writeFileSync2 } from "fs";
20180
20279
  import { join as join4 } from "path";
20181
20280
  function svcError3(code, status) {
20182
20281
  return Object.assign(new Error(code), { code, status });
@@ -20322,7 +20421,7 @@ Run in the Workspace Terminal:
20322
20421
 
20323
20422
  /util-updprd "${description.trim().replace(/"/g, '\\"')}"
20324
20423
  `;
20325
- writeFileSync(abs, body, "utf-8");
20424
+ writeFileSync2(abs, body, "utf-8");
20326
20425
  const relative3 = join4(project.folder, "execution", "prd_updates", fileName).replace(/\\/g, "/");
20327
20426
  return { markdownPath: relative3 };
20328
20427
  }
@@ -20726,7 +20825,7 @@ function writeFacetToDisk(db, workspacePath, projectId, moduleId, prdVersionId,
20726
20825
  ...newBody,
20727
20826
  ""
20728
20827
  );
20729
- writeFileSync2(target.prdPath, lines.join("\n"), "utf8");
20828
+ writeFileSync3(target.prdPath, lines.join("\n"), "utf8");
20730
20829
  return;
20731
20830
  }
20732
20831
  let facetStart = -1;
@@ -20746,7 +20845,7 @@ function writeFacetToDisk(db, workspacePath, projectId, moduleId, prdVersionId,
20746
20845
  while (insertAt > moduleStart + 1 && (!lines[insertAt - 1].trim() || /^-{3,}$/.test(lines[insertAt - 1].trim())))
20747
20846
  insertAt--;
20748
20847
  lines.splice(insertAt, 0, "", `### ${FACET_HEADING[facet]}`, ...newBody);
20749
- writeFileSync2(target.prdPath, lines.join("\n"), "utf8");
20848
+ writeFileSync3(target.prdPath, lines.join("\n"), "utf8");
20750
20849
  return;
20751
20850
  }
20752
20851
  let end = facetEnd;
@@ -20796,7 +20895,7 @@ function writeFacetToDisk(db, workspacePath, projectId, moduleId, prdVersionId,
20796
20895
  rebuilt.push(...blockLines);
20797
20896
  }
20798
20897
  lines.splice(facetStart, end - facetStart, ...rebuilt);
20799
- writeFileSync2(target.prdPath, lines.join("\n"), "utf8");
20898
+ writeFileSync3(target.prdPath, lines.join("\n"), "utf8");
20800
20899
  }
20801
20900
  function resolveSectionPrdPath(db, workspacePath, projectId, applicationId) {
20802
20901
  const project = db.select().from(projects).where(eq(projects.id, projectId)).limit(1).get();
@@ -20838,7 +20937,7 @@ function writeSectionToDisk(db, workspacePath, projectId, applicationId, section
20838
20937
  while (end > sectionStart + 1 && (!lines[end - 1].trim() || /^-{3,}$/.test(lines[end - 1].trim())))
20839
20938
  end--;
20840
20939
  lines.splice(sectionStart, end - sectionStart, `# ${PRD_SECTION_HEADING[sectionType]}`, ...body);
20841
- writeFileSync2(prdPath, lines.join("\n"), "utf8");
20940
+ writeFileSync3(prdPath, lines.join("\n"), "utf8");
20842
20941
  return;
20843
20942
  }
20844
20943
  const laterSections = new Set(PRD_SECTION_ORDER.slice(PRD_SECTION_ORDER.indexOf(sectionType) + 1));
@@ -20859,7 +20958,7 @@ function writeSectionToDisk(db, workspacePath, projectId, applicationId, section
20859
20958
  } else {
20860
20959
  lines.splice(insertAt, 0, ...block, "", "---", "");
20861
20960
  }
20862
- writeFileSync2(prdPath, lines.join("\n"), "utf8");
20961
+ writeFileSync3(prdPath, lines.join("\n"), "utf8");
20863
20962
  }
20864
20963
 
20865
20964
  // ../server/src/features/workflow/git-service.ts
@@ -21444,7 +21543,7 @@ function createSession(db, workspacePath, projectId, userId, username, title) {
21444
21543
  createdAt: nowIso,
21445
21544
  updatedAt: nowIso
21446
21545
  }).returning().get();
21447
- writeFileSync3(
21546
+ writeFileSync4(
21448
21547
  sessionAbsPath(workspacePath, project.folder, brainstormFilePath),
21449
21548
  template,
21450
21549
  "utf-8"
@@ -21519,7 +21618,7 @@ function updateSession(db, workspacePath, projectId, sessionId, patch) {
21519
21618
  if (patch.ideaMarkdown !== void 0 && session.brainstormFilePath) {
21520
21619
  const abs = sessionAbsPath(workspacePath, project.folder, session.brainstormFilePath);
21521
21620
  mkdirSync2(join8(abs, ".."), { recursive: true });
21522
- writeFileSync3(abs, patch.ideaMarkdown, "utf-8");
21621
+ writeFileSync4(abs, patch.ideaMarkdown, "utf-8");
21523
21622
  }
21524
21623
  }
21525
21624
  function addReference(db, workspacePath, projectId, sessionId, file) {
@@ -21532,7 +21631,7 @@ function addReference(db, workspacePath, projectId, sessionId, file) {
21532
21631
  const safeName = safeSegment(file.name);
21533
21632
  const storageRel = `${folderRel}/${safeName}`;
21534
21633
  mkdirSync2(sessionAbsPath(workspacePath, project.folder, folderRel), { recursive: true });
21535
- writeFileSync3(sessionAbsPath(workspacePath, project.folder, storageRel), file.bytes);
21634
+ writeFileSync4(sessionAbsPath(workspacePath, project.folder, storageRel), file.bytes);
21536
21635
  const now = (/* @__PURE__ */ new Date()).toISOString();
21537
21636
  const inserted = db.insert(brainstormReferences).values({
21538
21637
  brainstormSessionId: session.id,
@@ -21799,7 +21898,7 @@ import { existsSync as existsSync10 } from "fs";
21799
21898
  import { join as join11 } from "path";
21800
21899
 
21801
21900
  // ../server/src/features/prd-wizard/service.ts
21802
- import { existsSync as existsSync9, mkdirSync as mkdirSync3, statSync as statSync2, writeFileSync as writeFileSync4 } from "fs";
21901
+ import { existsSync as existsSync9, mkdirSync as mkdirSync3, statSync as statSync2, writeFileSync as writeFileSync5 } from "fs";
21803
21902
  import { join as join10 } from "path";
21804
21903
  function svcError7(code, status) {
21805
21904
  return Object.assign(new Error(code), { code, status });
@@ -21877,7 +21976,7 @@ function generatePrdWizardMarkdown(db, workspacePath, requestId, targetModule) {
21877
21976
  `execution/${filename}`,
21878
21977
  targetModule
21879
21978
  );
21880
- writeFileSync4(filePath, markdown, "utf8");
21979
+ writeFileSync5(filePath, markdown, "utf8");
21881
21980
  db.update(prdWizardRequests).set({
21882
21981
  generatedMarkdownPath: filePath,
21883
21982
  status: "generated",
@@ -22114,7 +22213,7 @@ function evaluateBuildGuard(db, workspacePath, projectId, versionId) {
22114
22213
  }
22115
22214
 
22116
22215
  // ../server/src/features/cicd/service.ts
22117
- import { appendFileSync, existsSync as existsSync12, mkdirSync as mkdirSync4, statSync as statSync4, writeFileSync as writeFileSync5 } from "fs";
22216
+ import { appendFileSync, existsSync as existsSync12, mkdirSync as mkdirSync4, statSync as statSync4, writeFileSync as writeFileSync6 } from "fs";
22118
22217
  import { join as join13 } from "path";
22119
22218
 
22120
22219
  // ../server/src/features/batch-job/constants.ts
@@ -22257,7 +22356,7 @@ function requestPlan(db, workspacePath, projectId, userId) {
22257
22356
  const filename = `cicd-plan-${setup.id}-${Date.now()}.md`;
22258
22357
  const filePath = join13(executionDir, filename);
22259
22358
  const relative3 = `execution/${filename}`;
22260
- writeFileSync5(
22359
+ writeFileSync6(
22261
22360
  filePath,
22262
22361
  buildPlanRequestMarkdown(
22263
22362
  project.name,
@@ -22567,11 +22666,11 @@ function cicdGuardRoutes(db, workspacePath) {
22567
22666
  }
22568
22667
 
22569
22668
  // ../server/src/features/project/service.ts
22570
- import { existsSync as existsSync14, mkdirSync as mkdirSync6, readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
22669
+ import { existsSync as existsSync14, mkdirSync as mkdirSync6, readFileSync as readFileSync9, writeFileSync as writeFileSync8 } from "fs";
22571
22670
  import { join as join16 } from "path";
22572
22671
 
22573
22672
  // ../server/src/features/project-config/service.ts
22574
- import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync6 } from "fs";
22673
+ import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync7 } from "fs";
22575
22674
  import { join as join15 } from "path";
22576
22675
  function svcError9(code, status) {
22577
22676
  return Object.assign(new Error(code), { code, status });
@@ -22595,7 +22694,7 @@ function resolveImportedByName(db, importedBy) {
22595
22694
  function writeProjectFile(workspacePath, folder, fileName, content) {
22596
22695
  const dir = join15(workspacePath, folder);
22597
22696
  mkdirSync5(dir, { recursive: true });
22598
- writeFileSync6(join15(dir, fileName), content, "utf8");
22697
+ writeFileSync7(join15(dir, fileName), content, "utf8");
22599
22698
  }
22600
22699
  function toDto5(db, row, field) {
22601
22700
  return {
@@ -22741,8 +22840,8 @@ function scaffoldProjectFolder(workspacePath, folderName, name, baseIdea) {
22741
22840
  "# Feedback",
22742
22841
  "<!-- Human answers appear here -->"
22743
22842
  ].join("\n");
22744
- writeFileSync7(join16(projectDir2, `${folderName}.brainstorm.md`), template, "utf8");
22745
- writeFileSync7(
22843
+ writeFileSync8(join16(projectDir2, `${folderName}.brainstorm.md`), template, "utf8");
22844
+ writeFileSync8(
22746
22845
  join16(projectDir2, "context", "references", "brainstorm-protocol.md"),
22747
22846
  "# Brainstorm Protocol\n\n[Installed by the co2 plugin]\n",
22748
22847
  "utf8"
@@ -22780,7 +22879,7 @@ function updateBrainstormMd(db, workspacePath, projectId, content) {
22780
22879
  project.workspaceFolderName,
22781
22880
  `${project.workspaceFolderName}.brainstorm.md`
22782
22881
  );
22783
- writeFileSync7(filePath, content, "utf8");
22882
+ writeFileSync8(filePath, content, "utf8");
22784
22883
  }
22785
22884
  function listProjects(db, archived) {
22786
22885
  return db.select({
@@ -22903,7 +23002,7 @@ function regenerateCO2Files(db, workspacePath, projectId) {
22903
23002
  const projectDir2 = join16(workspacePath, project.workspaceFolderName);
22904
23003
  mkdirSync6(projectDir2, { recursive: true });
22905
23004
  const apps = db.select().from(applications).where(and(eq(applications.projectId, projectId), eq(applications.isDeleted, 0))).all();
22906
- writeFileSync7(
23005
+ writeFileSync8(
22907
23006
  join16(projectDir2, "CLAUDE.md"),
22908
23007
  project.rawClaudeMd ?? buildClaudeMd(project.name, apps),
22909
23008
  "utf8"
@@ -22920,7 +23019,7 @@ function regenerateCO2Files(db, workspacePath, projectId) {
22920
23019
  const appRel = resolveAppFolderName(projectDir2, app.name);
22921
23020
  const appDir = join16(projectDir2, appRel, "context");
22922
23021
  mkdirSync6(appDir, { recursive: true });
22923
- writeFileSync7(
23022
+ writeFileSync8(
22924
23023
  join16(appDir, "PRD.md"),
22925
23024
  prdSnapshot[String(app.id)] ?? buildPrdMd(app.name, mods, loadPrdSections(db, app.id)),
22926
23025
  "utf8"
@@ -23313,7 +23412,7 @@ function dashboardRoutes(db) {
23313
23412
  }
23314
23413
 
23315
23414
  // ../server/src/features/defect/service.ts
23316
- import { existsSync as existsSync15, mkdirSync as mkdirSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "fs";
23415
+ import { existsSync as existsSync15, mkdirSync as mkdirSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "fs";
23317
23416
  import { join as join17 } from "path";
23318
23417
 
23319
23418
  // ../server/src/features/project-import/bug-md.ts
@@ -23745,7 +23844,7 @@ function writeBugMdFile(db, workspacePath, app, projectFolderName) {
23745
23844
  const appRel = resolveAppFolderName(projectDir2, app.name);
23746
23845
  const appContextDir = join17(projectDir2, appRel, "context");
23747
23846
  mkdirSync7(appContextDir, { recursive: true });
23748
- writeFileSync8(join17(appContextDir, "BUG.md"), content, "utf8");
23847
+ writeFileSync9(join17(appContextDir, "BUG.md"), content, "utf8");
23749
23848
  return { content, bugCount: bugs.length };
23750
23849
  }
23751
23850
  function syncBugStatusesFromMaster(db, trackingFilePath, applicationId) {
@@ -23789,7 +23888,7 @@ function syncBugMdToDisk(db, workspacePath, applicationId, bugId, mode = "replac
23789
23888
  ).all().find((m) => m.name.toLowerCase() === bug.module?.toLowerCase())?.category : void 0) ?? null;
23790
23889
  const merged = mergeBugIntoBugMd(readFileSync10(file, "utf8"), bug, semver, category, mode);
23791
23890
  if (merged !== null) {
23792
- writeFileSync8(file, merged, "utf8");
23891
+ writeFileSync9(file, merged, "utf8");
23793
23892
  return;
23794
23893
  }
23795
23894
  }
@@ -23923,7 +24022,7 @@ function defectRoutes(db, workspacePath) {
23923
24022
  }
23924
24023
 
23925
24024
  // ../server/src/features/document/service.ts
23926
- import { existsSync as existsSync16, mkdirSync as mkdirSync8, readFileSync as readFileSync11, writeFileSync as writeFileSync9 } from "fs";
24025
+ import { existsSync as existsSync16, mkdirSync as mkdirSync8, readFileSync as readFileSync11, writeFileSync as writeFileSync10 } from "fs";
23927
24026
  import { join as join18 } from "path";
23928
24027
  function svcError12(code, status) {
23929
24028
  return Object.assign(new Error(code), { code, status });
@@ -23936,7 +24035,7 @@ function uploadDocument(db, dataDir, projectId, file) {
23936
24035
  mkdirSync8(dir, { recursive: true });
23937
24036
  const safeName = file.name.replace(/[^a-zA-Z0-9._-]/g, "_");
23938
24037
  const stamped = `${Date.now()}_${safeName}`;
23939
- writeFileSync9(join18(dir, stamped), file.bytes);
24038
+ writeFileSync10(join18(dir, stamped), file.bytes);
23940
24039
  const relativePath = `${projectId}/${stamped}`;
23941
24040
  const now = (/* @__PURE__ */ new Date()).toISOString();
23942
24041
  const inserted = db.insert(documents).values({
@@ -24023,7 +24122,7 @@ function documentRoutes(db, dataDir) {
24023
24122
 
24024
24123
  // ../server/src/features/git/service.ts
24025
24124
  import { execFileSync as execFileSync3 } from "child_process";
24026
- import { existsSync as existsSync17, readFileSync as readFileSync12, rmSync, writeFileSync as writeFileSync10 } from "fs";
24125
+ import { existsSync as existsSync17, readFileSync as readFileSync12, rmSync, writeFileSync as writeFileSync11 } from "fs";
24027
24126
  import { join as join19 } from "path";
24028
24127
  var GitServiceError = class extends Error {
24029
24128
  code;
@@ -24207,7 +24306,18 @@ function readWorking(dir, path) {
24207
24306
  return null;
24208
24307
  }
24209
24308
  }
24210
- function commitChanges(db, workspacePath, projectId, input) {
24309
+ function identityArgs(db, userId) {
24310
+ if (!userId) return [];
24311
+ const user = db.select({ gitName: users.gitName, gitEmail: users.gitEmail }).from(users).where(eq(users.id, userId)).get();
24312
+ const args = [];
24313
+ if (user?.gitName) args.push("-c", `user.name=${user.gitName}`);
24314
+ if (user?.gitEmail) args.push("-c", `user.email=${user.gitEmail}`);
24315
+ return args;
24316
+ }
24317
+ function withIdentityHint(message) {
24318
+ return /Author identity unknown|Please tell me who you are|empty ident name/i.test(message) ? `${message} \u2014 set your Git name/email on your co2 Profile page, or configure git user.name/user.email for the service account on this host.` : message;
24319
+ }
24320
+ function commitChanges(db, workspacePath, projectId, input, userId) {
24211
24321
  const dir = projectDir(db, workspacePath, projectId);
24212
24322
  if (!existsSync17(dir) || !isGitRepo(dir)) {
24213
24323
  throw new GitServiceError("NO_GIT_REPO", 404, "No git repository for this project");
@@ -24225,9 +24335,9 @@ function commitChanges(db, workspacePath, projectId, input) {
24225
24335
  if (e instanceof GitServiceError) throw e;
24226
24336
  }
24227
24337
  try {
24228
- git3(dir, ["commit", "-m", input.message]);
24338
+ git3(dir, [...identityArgs(db, userId), "commit", "-m", input.message]);
24229
24339
  } catch (e) {
24230
- throw new GitServiceError("GIT_COMMIT_FAILED", 409, detail(e));
24340
+ throw new GitServiceError("GIT_COMMIT_FAILED", 409, withIdentityHint(detail(e)));
24231
24341
  }
24232
24342
  const branch = safe(() => git3(dir, ["branch", "--show-current"])) ?? "";
24233
24343
  const commitHash = safe(() => git3(dir, ["rev-parse", "--short", "HEAD"])) ?? "";
@@ -24263,7 +24373,7 @@ function resolveConflict(db, workspacePath, projectId, input) {
24263
24373
  if (input.content === void 0) {
24264
24374
  throw new GitServiceError("CONTENT_REQUIRED", 400, "Manual resolution requires content");
24265
24375
  }
24266
- writeFileSync10(join19(dir, input.path), input.content, "utf8");
24376
+ writeFileSync11(join19(dir, input.path), input.content, "utf8");
24267
24377
  } else {
24268
24378
  git3(dir, ["checkout", `--${input.resolution}`, "--", input.path]);
24269
24379
  }
@@ -24289,7 +24399,7 @@ function safe(fn) {
24289
24399
  function errorResponse7(c, e) {
24290
24400
  const err = e;
24291
24401
  const status = err.status ?? 500;
24292
- return c.json({ code: err.code ?? "INTERNAL_ERROR" }, status);
24402
+ return c.json({ code: err.code ?? "INTERNAL_ERROR", message: err.message }, status);
24293
24403
  }
24294
24404
  function gitRoutes(db, workspacePath) {
24295
24405
  const app = new Hono2();
@@ -24318,7 +24428,7 @@ function gitRoutes(db, workspacePath) {
24318
24428
  if (Number.isNaN(projectId)) return c.json({ code: "INVALID_ID" }, 400);
24319
24429
  try {
24320
24430
  const body = c.req.valid("json");
24321
- return c.json(commitChanges(db, workspacePath, projectId, body));
24431
+ return c.json(commitChanges(db, workspacePath, projectId, body, c.get("user")?.id));
24322
24432
  } catch (e) {
24323
24433
  return errorResponse7(c, e);
24324
24434
  }
@@ -24947,7 +25057,7 @@ function scanProject(db, workspacePath, folderName) {
24947
25057
  import { join as join22, relative as relative2 } from "path";
24948
25058
 
24949
25059
  // ../server/src/features/workflow/service.ts
24950
- import { existsSync as existsSync19, mkdirSync as mkdirSync9, readFileSync as readFileSync14, writeFileSync as writeFileSync11 } from "fs";
25060
+ import { existsSync as existsSync19, mkdirSync as mkdirSync9, readFileSync as readFileSync14, writeFileSync as writeFileSync12 } from "fs";
24951
25061
  import { join as join21, relative, resolve as resolve2, sep } from "path";
24952
25062
  var ACTIVE_RUN_STATUSES = ["pending", "in_progress"];
24953
25063
  function svcError14(code, status) {
@@ -25174,7 +25284,7 @@ function generateWorkflowMarkdown(db, workspacePath, input, creatingUser, watche
25174
25284
  relPath
25175
25285
  );
25176
25286
  mkdirSync9(join21(projectDir2, "workflow", creatingUser.username), { recursive: true });
25177
- writeFileSync11(join21(projectDir2, relPath), content, "utf8");
25287
+ writeFileSync12(join21(projectDir2, relPath), content, "utf8");
25178
25288
  const now = (/* @__PURE__ */ new Date()).toISOString();
25179
25289
  const wfm = db.insert(workflowMarkdowns).values({
25180
25290
  projectId: input.projectId,
@@ -26018,7 +26128,7 @@ function projectRoutes(db, workspacePath) {
26018
26128
  }
26019
26129
 
26020
26130
  // ../server/src/features/shared-context/service.ts
26021
- import { existsSync as existsSync20, mkdirSync as mkdirSync10, readFileSync as readFileSync15, readdirSync as readdirSync4, statSync as statSync6, writeFileSync as writeFileSync12 } from "fs";
26131
+ import { existsSync as existsSync20, mkdirSync as mkdirSync10, readFileSync as readFileSync15, readdirSync as readdirSync4, statSync as statSync6, writeFileSync as writeFileSync13 } from "fs";
26022
26132
  import { join as join23, resolve as resolve3, sep as sep2 } from "path";
26023
26133
  function svcError16(code, status) {
26024
26134
  return Object.assign(new Error(code), { code, status });
@@ -26109,7 +26219,7 @@ function uploadFile(db, workspacePath, projectId, folder, file) {
26109
26219
  const dir = folder ? safeResolve(root, folder) : root;
26110
26220
  if (folder && !existsSync20(dir)) throw svcError16("FOLDER_NOT_FOUND", 404);
26111
26221
  const safeName = sanitizeSegment(file.name);
26112
- writeFileSync12(join23(dir, safeName), file.bytes);
26222
+ writeFileSync13(join23(dir, safeName), file.bytes);
26113
26223
  return { path: folder ? `${folder}/${safeName}` : safeName };
26114
26224
  }
26115
26225
  function getFileContent(db, workspacePath, projectId, relPath) {
@@ -26124,7 +26234,7 @@ function saveMarkdown(db, workspacePath, projectId, relPath, content) {
26124
26234
  const root = resolveSharedRoot(db, workspacePath, projectId);
26125
26235
  const full = safeResolve(root, relPath);
26126
26236
  if (!existsSync20(full) || !statSync6(full).isFile()) throw svcError16("NOT_FOUND", 404);
26127
- writeFileSync12(full, content, "utf8");
26237
+ writeFileSync13(full, content, "utf8");
26128
26238
  }
26129
26239
 
26130
26240
  // ../server/src/features/shared-context/routes.ts
@@ -27114,7 +27224,7 @@ function workspaceRoutes(_db, config, port, host, workspacePath) {
27114
27224
  }
27115
27225
 
27116
27226
  // ../server/src/lib/config.ts
27117
- import { existsSync as existsSync22, readFileSync as readFileSync17, writeFileSync as writeFileSync13 } from "fs";
27227
+ import { existsSync as existsSync22, readFileSync as readFileSync17, writeFileSync as writeFileSync14 } from "fs";
27118
27228
  import { join as join25 } from "path";
27119
27229
  var configSchema = external_exports.object({
27120
27230
  port: external_exports.number().int().min(1).max(65535).optional(),
@@ -27132,11 +27242,21 @@ function loadConfig(dataDir) {
27132
27242
  }
27133
27243
  }
27134
27244
  function saveConfig(dataDir, config) {
27135
- writeFileSync13(join25(dataDir, "config.json"), JSON.stringify(config, null, 2));
27245
+ writeFileSync14(join25(dataDir, "config.json"), JSON.stringify(config, null, 2));
27136
27246
  }
27137
27247
 
27138
27248
  // ../server/src/lib/logger.ts
27139
27249
  var import_picocolors2 = __toESM(require_picocolors(), 1);
27250
+ async function readErrorBody(res) {
27251
+ try {
27252
+ const body = await res.clone().json();
27253
+ const code = typeof body.code === "string" ? body.code : void 0;
27254
+ const message = typeof body.message === "string" ? body.message : void 0;
27255
+ return code || message ? { code, message } : void 0;
27256
+ } catch {
27257
+ return void 0;
27258
+ }
27259
+ }
27140
27260
  function loggerMiddleware() {
27141
27261
  return async (c, next) => {
27142
27262
  const start = Date.now();
@@ -27145,14 +27265,23 @@ function loggerMiddleware() {
27145
27265
  const { method } = c.req;
27146
27266
  const path = c.req.path;
27147
27267
  const status = c.res.status;
27268
+ const error = status >= 400 ? await readErrorBody(c.res) : void 0;
27148
27269
  if (process.stdout.isTTY) {
27149
27270
  const col = status >= 400 ? import_picocolors2.default.red : status >= 300 ? import_picocolors2.default.yellow : import_picocolors2.default.green;
27271
+ const errorSuffix = error ? ` ${import_picocolors2.default.red(error.code ?? "ERROR")}${error.message ? import_picocolors2.default.dim(` ${error.message}`) : ""}` : "";
27150
27272
  console.log(
27151
- `${import_picocolors2.default.dim((/* @__PURE__ */ new Date()).toISOString())} ${import_picocolors2.default.bold(method.padEnd(6))} ${col(String(status))} ${path} ${import_picocolors2.default.dim(`${ms}ms`)}`
27273
+ `${import_picocolors2.default.dim((/* @__PURE__ */ new Date()).toISOString())} ${import_picocolors2.default.bold(method.padEnd(6))} ${col(String(status))} ${path} ${import_picocolors2.default.dim(`${ms}ms`)}${errorSuffix}`
27152
27274
  );
27153
27275
  } else {
27154
27276
  process.stdout.write(
27155
- `${JSON.stringify({ time: (/* @__PURE__ */ new Date()).toISOString(), method, path, status, ms })}
27277
+ `${JSON.stringify({
27278
+ time: (/* @__PURE__ */ new Date()).toISOString(),
27279
+ method,
27280
+ path,
27281
+ status,
27282
+ ms,
27283
+ ...error ? { error: error.code, errorMessage: error.message } : {}
27284
+ })}
27156
27285
  `
27157
27286
  );
27158
27287
  }
@@ -28151,8 +28280,8 @@ var createAdaptorServer = (options) => {
28151
28280
  overrideGlobalObjects: options.overrideGlobalObjects,
28152
28281
  autoCleanupIncoming: options.autoCleanupIncoming
28153
28282
  });
28154
- const createServer = options.createServer || createServerHTTP;
28155
- const server = createServer(options.serverOptions || {}, requestListener);
28283
+ const createServer2 = options.createServer || createServerHTTP;
28284
+ const server = createServer2(options.serverOptions || {}, requestListener);
28156
28285
  return server;
28157
28286
  };
28158
28287
  var serve = (options, listeningListener) => {