@c4a/server-cli 0.4.12-alpha.1 → 0.4.12-alpha.3

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/index.js CHANGED
@@ -40160,7 +40160,7 @@ var init_serverConfig = __esm(() => {
40160
40160
  DEFAULT_SERVER_CONFIG = {
40161
40161
  server: {
40162
40162
  port: 5100,
40163
- host: "0.0.0.0"
40163
+ host: "::"
40164
40164
  },
40165
40165
  doc_db: {
40166
40166
  provider: "sqlite",
@@ -40168,7 +40168,7 @@ var init_serverConfig = __esm(() => {
40168
40168
  path: "./data/c4a.db"
40169
40169
  },
40170
40170
  mongodb: {
40171
- uri: "mongodb://localhost:27017/c4a",
40171
+ uri: "mongodb://localhost:27017/c4a?directConnection=true",
40172
40172
  database: "c4a"
40173
40173
  }
40174
40174
  },
@@ -44779,6 +44779,32 @@ var init_utils = __esm(() => {
44779
44779
  // ../core/src/constants.ts
44780
44780
  var DEFAULT_USER_ID = "user_admin", DEFAULT_USER_NAME = "admin", DEFAULT_WORKSPACE_ID = "ws_default", DEFAULT_WORKSPACE_NAME = "默认大脑", DEFAULT_CLOUD_LIBRARY_ID = "lib_cloud_default", DEFAULT_CLOUD_LIBRARY_NAME = "个人云", DAEMON_OFFLINE_THRESHOLD = 60000;
44781
44781
 
44782
+ // ../core/src/fileTypes.ts
44783
+ function getFileExtension(name) {
44784
+ const dot = name.lastIndexOf(".");
44785
+ return dot >= 0 ? name.slice(dot).toLowerCase() : "";
44786
+ }
44787
+ var INDEXABLE_CODE_EXTENSIONS, INDEXABLE_DOC_EXTENSIONS, INDEXABLE_EXTENSIONS, UPLOAD_ALLOWED_EXTENSIONS, TEXT_EXTENSIONS, UPLOAD_MAX_FILE_SIZE, UPLOAD_MAX_FILES = 10;
44788
+ var init_fileTypes = __esm(() => {
44789
+ INDEXABLE_CODE_EXTENSIONS = new Set([".ts", ".tsx"]);
44790
+ INDEXABLE_DOC_EXTENSIONS = new Set([".md"]);
44791
+ INDEXABLE_EXTENSIONS = new Set([
44792
+ ...INDEXABLE_CODE_EXTENSIONS,
44793
+ ...INDEXABLE_DOC_EXTENSIONS
44794
+ ]);
44795
+ UPLOAD_ALLOWED_EXTENSIONS = new Set([
44796
+ ".md",
44797
+ ".doc",
44798
+ ".docx",
44799
+ ".pdf",
44800
+ ".ppt",
44801
+ ".pptx",
44802
+ ".txt"
44803
+ ]);
44804
+ TEXT_EXTENSIONS = new Set([".md", ".txt"]);
44805
+ UPLOAD_MAX_FILE_SIZE = 5 * 1024 * 1024;
44806
+ });
44807
+
44782
44808
  // ../core/src/wsEvents.ts
44783
44809
  var WS_DAEMON_CONNECTED = "ws:daemon:connected", WS_DAEMON_STATUS = "ws:daemon:status";
44784
44810
 
@@ -44788,6 +44814,7 @@ var init_src = __esm(() => {
44788
44814
  init_schemas();
44789
44815
  init_errors2();
44790
44816
  init_utils();
44817
+ init_fileTypes();
44791
44818
  });
44792
44819
 
44793
44820
  // ../../node_modules/.bun/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-context.js
@@ -176375,7 +176402,7 @@ var {
176375
176402
  } = import__.default;
176376
176403
 
176377
176404
  // src/index.ts
176378
- import { existsSync as existsSync9, realpathSync } from "node:fs";
176405
+ import { existsSync as existsSync9, realpathSync, statSync as statSync2 } from "node:fs";
176379
176406
  import path20 from "node:path";
176380
176407
  import { fileURLToPath as fileURLToPath3 } from "node:url";
176381
176408
 
@@ -182018,7 +182045,8 @@ var menuTree = [
182018
182045
  { id: "settings:graphdb", label: "图数据库", description: "Neo4j / NebulaGraph" },
182019
182046
  { id: "settings:vectordb", label: "向量数据库", description: "Qdrant / Milvus / LanceDB" },
182020
182047
  { id: "settings:llm", label: "LLM 服务", description: "OpenAI / Anthropic / Google" },
182021
- { id: "settings:embedding", label: "Embedding 服务", description: "本地模型配置" }
182048
+ { id: "settings:embedding", label: "Embedding 服务", description: "本地模型配置" },
182049
+ { id: "settings:server", label: "接入设置", description: "Host / Port" }
182022
182050
  ]
182023
182051
  },
182024
182052
  { id: "install", label: "服务安装", description: "检测并安装服务" },
@@ -182055,6 +182083,7 @@ var helpDescriptions = {
182055
182083
  "settings:vectordb": "配置 Qdrant / Milvus / LanceDB。",
182056
182084
  "settings:llm": "配置 LLM Provider(OpenAI/Anthropic/Google)。",
182057
182085
  "settings:embedding": "配置 Embedding 模型与缓存路径。",
182086
+ "settings:server": "配置服务监听地址(host)和端口(port)。",
182058
182087
  install: "检测并安装所需服务(Docker / 模型下载)。",
182059
182088
  ops: "按 → 展开子菜单。管理服务状态、启停与日志。",
182060
182089
  "ops:status": "查看服务状态。",
@@ -182107,6 +182136,8 @@ function getConfigSummary(commandId, config) {
182107
182136
  const model = config.embedding[p].model_id;
182108
182137
  return `当前:${p} 模型 ${model}`;
182109
182138
  }
182139
+ case "settings:server":
182140
+ return `当前:${config.server.host}:${config.server.port}`;
182110
182141
  default:
182111
182142
  return null;
182112
182143
  }
@@ -212635,10 +212666,31 @@ function buildDockerComposeObject(config2, options = {}) {
212635
212666
  image: "mongo:8",
212636
212667
  container_name: containerName,
212637
212668
  restart: "unless-stopped",
212669
+ command: "mongod --replSet rs0",
212638
212670
  ports: [hp(27017, offset)],
212639
212671
  volumes: [`${volumeName}:/data/db`],
212640
212672
  healthcheck: healthCheck(`mongosh --eval 'db.adminCommand("ping")'`)
212641
212673
  }, networkName);
212674
+ const initScript = [
212675
+ `try { rs.initiate({ _id: "rs0", members: [{ _id: 0, host: "localhost:27017" }] }); print("rs initiated") }`,
212676
+ `catch(e) {`,
212677
+ ` if (e.codeName !== "AlreadyInitialized") throw e;`,
212678
+ ` var cfg = rs.conf();`,
212679
+ ` if (cfg.members[0].host !== "localhost:27017") {`,
212680
+ ` cfg.members[0].host = "localhost:27017";`,
212681
+ ` cfg.version++;`,
212682
+ ` rs.reconfig(cfg, {force:true});`,
212683
+ ` print("rs reconfig to localhost:27017")`,
212684
+ ` } else { print("rs already initialized") }`,
212685
+ `}`
212686
+ ].join(" ");
212687
+ services["mongodb-init"] = withNetwork({
212688
+ image: "mongo:8",
212689
+ container_name: `${prefix}-mongodb-init`,
212690
+ depends_on: { mongodb: { condition: "service_healthy" } },
212691
+ restart: "no",
212692
+ entrypoint: ["mongosh", "--host", "mongodb", "--eval", initScript]
212693
+ }, networkName);
212642
212694
  volumes[volumeName] = {};
212643
212695
  specs.push({ serviceName: "mongodb", containerName });
212644
212696
  }
@@ -213766,6 +213818,37 @@ async function dockerComposeRun(composePath, service, projectName) {
213766
213818
  });
213767
213819
  });
213768
213820
  }
213821
+ async function dockerComposeRm(composePath, services, projectName) {
213822
+ return new Promise((resolve2) => {
213823
+ const args = ["compose"];
213824
+ if (projectName) {
213825
+ args.push("--project-name", projectName);
213826
+ }
213827
+ args.push("-f", composePath, "rm", "-s", "-f", "-v", ...services);
213828
+ const child = spawn3("docker", args, {
213829
+ stdio: ["ignore", "inherit", "inherit"]
213830
+ });
213831
+ let timedOut = false;
213832
+ const timer = setTimeout(() => {
213833
+ timedOut = true;
213834
+ child.kill("SIGKILL");
213835
+ }, 120000);
213836
+ child.on("close", (code) => {
213837
+ clearTimeout(timer);
213838
+ if (timedOut) {
213839
+ resolve2({ ok: false, message: "docker compose rm 超时" });
213840
+ } else if (code !== 0) {
213841
+ resolve2({ ok: false, message: `docker compose rm 失败 (exit ${code})` });
213842
+ } else {
213843
+ resolve2({ ok: true, message: "docker compose rm 完成" });
213844
+ }
213845
+ });
213846
+ child.on("error", (err) => {
213847
+ clearTimeout(timer);
213848
+ resolve2({ ok: false, message: err.message });
213849
+ });
213850
+ });
213851
+ }
213769
213852
  async function dockerComposeDown(composePath, networkName = "c4a-network", projectName) {
213770
213853
  const downResult = await new Promise((resolve2) => {
213771
213854
  const args = ["compose"];
@@ -214275,10 +214358,8 @@ function resolveServerLogPath() {
214275
214358
  }
214276
214359
  function resolveHealthUrl(config2) {
214277
214360
  let host = config2.server.host;
214278
- if (host === "0.0.0.0")
214361
+ if (host === "0.0.0.0" || host === "::")
214279
214362
  host = "127.0.0.1";
214280
- else if (host === "::")
214281
- host = "::1";
214282
214363
  const urlHost = host.includes(":") ? `[${host}]` : host;
214283
214364
  const url2 = `http://${urlHost}:${config2.server.port}/api/v1/health`;
214284
214365
  return { url: url2, host: urlHost, tcpHost: host };
@@ -214728,6 +214809,17 @@ async function resolveContainerConflict(containerName, projectName) {
214728
214809
  return true;
214729
214810
  }
214730
214811
  var NEBULA_SERVICES2 = ["nebula-metad", "nebula-storaged", "nebula-graphd"];
214812
+ async function ensureMongoInit(composePath, startedServices, projectName) {
214813
+ if (!startedServices.includes("mongodb"))
214814
+ return true;
214815
+ console.log("初始化 MongoDB 副本集...");
214816
+ const result = await dockerComposeRun(composePath, "mongodb-init", projectName);
214817
+ if (!result.ok) {
214818
+ console.log(`mongodb-init 失败: ${result.message}`);
214819
+ return false;
214820
+ }
214821
+ return true;
214822
+ }
214731
214823
  async function ensureNebulaInit(composePath, startedServices, projectName) {
214732
214824
  const hasNebula = startedServices.some((name21) => NEBULA_SERVICES2.includes(name21));
214733
214825
  if (!hasNebula)
@@ -214769,6 +214861,9 @@ async function ensureDockerDeps() {
214769
214861
  const ok = await startDockerServices(composePath, services, serviceNames, projectName);
214770
214862
  if (!ok)
214771
214863
  return false;
214864
+ const mongoOk = await ensureMongoInit(composePath, serviceNames, projectName);
214865
+ if (!mongoOk)
214866
+ return false;
214772
214867
  return ensureNebulaInit(composePath, serviceNames, projectName);
214773
214868
  }
214774
214869
  async function runStartCommand(options = {}) {
@@ -214781,6 +214876,9 @@ async function runStartCommand(options = {}) {
214781
214876
  const ok = await startDockerServices(composePath, services, serviceNames, projectName);
214782
214877
  if (!ok)
214783
214878
  return;
214879
+ const mongoInitOk = await ensureMongoInit(composePath, serviceNames, projectName);
214880
+ if (!mongoInitOk)
214881
+ return;
214784
214882
  const initOk = await ensureNebulaInit(composePath, serviceNames, projectName);
214785
214883
  if (!initOk)
214786
214884
  return;
@@ -214811,6 +214909,11 @@ async function runStartCommand(options = {}) {
214811
214909
  await pauseBeforeReturn();
214812
214910
  return;
214813
214911
  }
214912
+ const mongoInitOk = await ensureMongoInit(composePath, serviceNames, projectName);
214913
+ if (!mongoInitOk) {
214914
+ await pauseBeforeReturn();
214915
+ return;
214916
+ }
214814
214917
  const initOk = await ensureNebulaInit(composePath, serviceNames, projectName);
214815
214918
  if (!initOk) {
214816
214919
  await pauseBeforeReturn();
@@ -214837,6 +214940,11 @@ async function runStartCommand(options = {}) {
214837
214940
  await pauseBeforeReturn();
214838
214941
  return;
214839
214942
  }
214943
+ const mongoInitOk = await ensureMongoInit(composePath, [choice2], projectName);
214944
+ if (!mongoInitOk) {
214945
+ await pauseBeforeReturn();
214946
+ return;
214947
+ }
214840
214948
  const initOk = await ensureNebulaInit(composePath, [choice2], projectName);
214841
214949
  if (!initOk) {
214842
214950
  await pauseBeforeReturn();
@@ -214954,7 +215062,7 @@ async function runUninstallCommand(options = {}) {
214954
215062
  const mode = options.mode ?? "interactive";
214955
215063
  const config2 = await loadServerConfig();
214956
215064
  const prefix = process.env.C4A_CONTAINER_PREFIX ?? "c4a";
214957
- const { composePath, projectName } = await getDockerServices(config2);
215065
+ const { composePath, services, projectName } = await getDockerServices(config2);
214958
215066
  const containers = await listC4aContainers(`${prefix}-`, projectName);
214959
215067
  if (containers.length === 0) {
214960
215068
  console.log(`没有发现 C4A 相关的 Docker 容器。
@@ -214963,33 +215071,81 @@ async function runUninstallCommand(options = {}) {
214963
215071
  await pauseBeforeReturn();
214964
215072
  return;
214965
215073
  }
214966
- console.log(`
215074
+ if (mode === "cli") {
215075
+ console.log(`
214967
215076
  ${BOLD3}将要卸载以下 Docker 容器:${RESET6}
214968
215077
  `);
214969
- for (const c of containers) {
214970
- console.log(` - ${c.name} ${DIM5}${c.status}${RESET6}`);
215078
+ for (const c of containers) {
215079
+ console.log(` - ${c.name} ${DIM5}${c.status}${RESET6}`);
215080
+ }
215081
+ console.log(`
215082
+ ${RED3}${BOLD3}此操作将停止并删除所有容器、网络和数据卷,数据不可恢复。${RESET6}
215083
+ `);
215084
+ console.log("");
215085
+ const result = await dockerComposeDown(composePath, `${prefix}-network`, projectName);
215086
+ if (!result.ok) {
215087
+ console.log(`
215088
+ 卸载失败: ${result.message}`);
215089
+ } else {
215090
+ console.log(`
215091
+ 卸载完成,所有容器、网络和数据卷已清除。`);
215092
+ }
215093
+ return;
214971
215094
  }
214972
- console.log(`
215095
+ const optionsList = [
215096
+ { label: "全部卸载", value: "__all__" },
215097
+ ...services.map((svc) => ({ label: svc.serviceName, value: svc.serviceName }))
215098
+ ];
215099
+ const choice2 = await askChoice("选择要卸载的服务", optionsList, "__all__");
215100
+ if (!choice2) {
215101
+ console.log(`已取消卸载。
215102
+ `);
215103
+ return;
215104
+ }
215105
+ if (choice2 === "__all__") {
215106
+ console.log(`
215107
+ ${BOLD3}将要卸载以下 Docker 容器:${RESET6}
215108
+ `);
215109
+ for (const c of containers) {
215110
+ console.log(` - ${c.name} ${DIM5}${c.status}${RESET6}`);
215111
+ }
215112
+ console.log(`
214973
215113
  ${RED3}${BOLD3}此操作将停止并删除所有容器、网络和数据卷,数据不可恢复。${RESET6}
214974
215114
  `);
214975
- if (mode === "interactive") {
214976
- const confirm2 = await askChoice("确认卸载?", [
214977
- { label: "确认卸载", value: "yes" }
214978
- ], "yes", { showCurrent: false });
215115
+ const confirm2 = await askChoice("确认卸载?", [{ label: "确认卸载", value: "yes" }], "yes", { showCurrent: false });
214979
215116
  if (confirm2 !== "yes") {
214980
215117
  console.log(`已取消卸载。
214981
215118
  `);
214982
215119
  return;
214983
215120
  }
214984
- }
214985
- console.log("");
214986
- const result = await dockerComposeDown(composePath, `${prefix}-network`, projectName);
214987
- if (!result.ok) {
214988
- console.log(`
215121
+ console.log("");
215122
+ const result = await dockerComposeDown(composePath, `${prefix}-network`, projectName);
215123
+ if (!result.ok) {
215124
+ console.log(`
214989
215125
  卸载失败: ${result.message}`);
215126
+ } else {
215127
+ console.log(`
215128
+ 卸载完成,所有容器、网络和数据卷已清除。`);
215129
+ }
214990
215130
  } else {
214991
215131
  console.log(`
214992
- 卸载完成,所有容器、网络和数据卷已清除。`);
215132
+ ${RED3}${BOLD3}将停止并删除 ${choice2} 的容器和匿名数据卷。${RESET6}
215133
+ `);
215134
+ const confirm2 = await askChoice(`确认卸载 ${choice2}?`, [{ label: "确认卸载", value: "yes" }], "yes", { showCurrent: false });
215135
+ if (confirm2 !== "yes") {
215136
+ console.log(`已取消卸载。
215137
+ `);
215138
+ return;
215139
+ }
215140
+ console.log("");
215141
+ const result = await dockerComposeRm(composePath, [choice2], projectName);
215142
+ if (!result.ok) {
215143
+ console.log(`
215144
+ 卸载失败: ${result.message}`);
215145
+ } else {
215146
+ console.log(`
215147
+ ${choice2} 已卸载。`);
215148
+ }
214993
215149
  }
214994
215150
  if (mode === "interactive")
214995
215151
  await pauseBeforeReturn();
@@ -220048,6 +220204,10 @@ __legacyDecorateClassTS([
220048
220204
  Property({ type: "string", nullable: true }),
220049
220205
  __legacyMetadataTS("design:type", String)
220050
220206
  ], SourceContentRecord.prototype, "content_hash", undefined);
220207
+ __legacyDecorateClassTS([
220208
+ Property({ type: "string", nullable: true }),
220209
+ __legacyMetadataTS("design:type", String)
220210
+ ], SourceContentRecord.prototype, "content_encoding", undefined);
220051
220211
  __legacyDecorateClassTS([
220052
220212
  Property({ type: "date" }),
220053
220213
  __legacyMetadataTS("design:type", typeof Date === "undefined" ? Object : Date)
@@ -220328,6 +220488,16 @@ class DocStore {
220328
220488
  const orm = this.orm;
220329
220489
  await orm.getSchemaGenerator().updateSchema();
220330
220490
  }
220491
+ async safeFlush() {
220492
+ try {
220493
+ await this.em.flush();
220494
+ } catch (error40) {
220495
+ if (this.docProvider === "mongodb" && error40 instanceof Error && error40.message.includes("Transaction numbers are only allowed")) {
220496
+ throw new C4AError("STORAGE_FAILED" /* STORAGE_FAILED */, "MongoDB 事务失败:单机 MongoDB 不支持事务。请配置 MongoDB 副本集(Replica Set)以启用事务支持。" + "参考:https://www.mongodb.com/docs/manual/tutorial/deploy-replica-set/", { originalError: error40.message });
220497
+ }
220498
+ throw error40;
220499
+ }
220500
+ }
220331
220501
  async save(entity2) {
220332
220502
  DocStore.assertEntity(entity2);
220333
220503
  const existing = await this.em.findOne(EntityRecord, { id: entity2.id });
@@ -220336,7 +220506,7 @@ class DocStore {
220336
220506
  } else {
220337
220507
  this.em.create(EntityRecord, DocStore.toEntityRecord(entity2));
220338
220508
  }
220339
- await this.em.flush();
220509
+ await this.safeFlush();
220340
220510
  return entity2;
220341
220511
  }
220342
220512
  async read(id2) {
@@ -220407,7 +220577,7 @@ class DocStore {
220407
220577
  this.em.create(RelationRecord, DocStore.toRelationRecord(relation2));
220408
220578
  }
220409
220579
  }
220410
- await this.em.flush();
220580
+ await this.safeFlush();
220411
220581
  }
220412
220582
  async deleteRelationsForEntity(entityId) {
220413
220583
  await this.em.nativeDelete(RelationRecord, {
@@ -222185,6 +222355,31 @@ async function configureEmbedding(config2) {
222185
222355
  message: "配置已保存。如有变更请重新执行「服务安装」检测。若服务已启动,建议先停止服务再变更;变更完成后请启动服务。"
222186
222356
  };
222187
222357
  }
222358
+ // src/settings/serverSettings.ts
222359
+ async function configureServer(config2) {
222360
+ printCurrentConfig("当前接入设置", [
222361
+ ["host", config2.server.host],
222362
+ ["port", String(config2.server.port)]
222363
+ ]);
222364
+ const host = await ask("监听地址 (host) ", config2.server.host);
222365
+ let port = config2.server.port;
222366
+ while (true) {
222367
+ const portStr = await ask("监听端口 (port) ", String(config2.server.port));
222368
+ const parsed = Number.parseInt(portStr, 10);
222369
+ if (!Number.isNaN(parsed) && parsed > 0 && parsed <= 65535) {
222370
+ port = parsed;
222371
+ break;
222372
+ }
222373
+ console.log(" 端口必须是 1–65535 之间的整数,请重新输入。");
222374
+ }
222375
+ return {
222376
+ config: {
222377
+ ...config2,
222378
+ server: { host, port }
222379
+ },
222380
+ message: "接入设置已保存。若服务已启动,需重启后生效。"
222381
+ };
222382
+ }
222188
222383
  // src/app.tsx
222189
222384
  var jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
222190
222385
  function App2({ onSelect, config: config2, initialMainIndex = 0, initialSubIndex = 0, initialFocus = "main" }) {
@@ -222409,6 +222604,16 @@ async function executeCommand(commandId) {
222409
222604
  await pauseBeforeReturn();
222410
222605
  }
222411
222606
  break;
222607
+ case "settings:server":
222608
+ {
222609
+ const config2 = await loadServerConfig();
222610
+ const result = await configureServer(config2);
222611
+ await saveServerConfig(result.config);
222612
+ if (result.message)
222613
+ console.log(result.message);
222614
+ await pauseBeforeReturn();
222615
+ }
222616
+ break;
222412
222617
  case "install":
222413
222618
  await runInstallFlow();
222414
222619
  break;
@@ -222632,6 +222837,30 @@ function isWorkspaceDir(dir) {
222632
222837
  }
222633
222838
  function printWorkspaceHint() {
222634
222839
  console.log("当前目录不是 C4A Server 工作区。执行 `c4a-server init` 初始化,或切换到已有工作区目录。");
222840
+ console.log("也可以使用 `-c <path>` 指定工作区路径,例如: c4a-server -c ~/my-workspace start");
222841
+ }
222842
+ function extractConfigAndChdir(args) {
222843
+ const idx = args.findIndex((a) => a === "-c" || a === "--config");
222844
+ if (idx === -1)
222845
+ return args;
222846
+ const value = args[idx + 1];
222847
+ if (!value || value.startsWith("-")) {
222848
+ console.error(`错误: ${args[idx]} 需要一个路径参数`);
222849
+ process.exit(1);
222850
+ }
222851
+ let resolved = path20.resolve(value);
222852
+ if (existsSync9(resolved) && statSync2(resolved).isDirectory()) {
222853
+ resolved = path20.join(resolved, SERVER_CONFIG_NAME2);
222854
+ }
222855
+ const dir = path20.dirname(resolved);
222856
+ if (!existsSync9(dir)) {
222857
+ console.error(`目录不存在: ${dir}`);
222858
+ process.exit(1);
222859
+ }
222860
+ process.chdir(dir);
222861
+ const remaining = [...args];
222862
+ remaining.splice(idx, 2);
222863
+ return remaining;
222635
222864
  }
222636
222865
  function createProgram() {
222637
222866
  const program2 = new Command;
@@ -222733,7 +222962,8 @@ function createProgram() {
222733
222962
  return program2;
222734
222963
  }
222735
222964
  async function runServerCli(args = process.argv.slice(2)) {
222736
- if (args.length === 0) {
222965
+ const effectiveArgs = extractConfigAndChdir(args);
222966
+ if (effectiveArgs.length === 0) {
222737
222967
  if (!isWorkspaceDir(process.cwd())) {
222738
222968
  printWorkspaceHint();
222739
222969
  process.exitCode = 1;
@@ -222743,7 +222973,7 @@ async function runServerCli(args = process.argv.slice(2)) {
222743
222973
  return;
222744
222974
  }
222745
222975
  const program2 = createProgram();
222746
- await program2.parseAsync(["node", "c4a-server", ...args]);
222976
+ await program2.parseAsync(["node", "c4a-server", ...effectiveArgs]);
222747
222977
  }
222748
222978
  function isDirectRun() {
222749
222979
  const currentFile = realpathSync(fileURLToPath3(import.meta.url));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/server-cli",
3
- "version": "0.4.12-alpha.1",
3
+ "version": "0.4.12-alpha.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "c4a-server": "./index.js"