@craftspace/cli 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -36,9 +36,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
36
  mod
37
37
  ));
38
38
 
39
- // ../../../node_modules/commander/lib/error.js
39
+ // ../../../../node_modules/commander/lib/error.js
40
40
  var require_error = __commonJS({
41
- "../../../node_modules/commander/lib/error.js"(exports) {
41
+ "../../../../node_modules/commander/lib/error.js"(exports) {
42
42
  var CommanderError2 = class extends Error {
43
43
  /**
44
44
  * Constructs the CommanderError class
@@ -71,9 +71,9 @@ var require_error = __commonJS({
71
71
  }
72
72
  });
73
73
 
74
- // ../../../node_modules/commander/lib/argument.js
74
+ // ../../../../node_modules/commander/lib/argument.js
75
75
  var require_argument = __commonJS({
76
- "../../../node_modules/commander/lib/argument.js"(exports) {
76
+ "../../../../node_modules/commander/lib/argument.js"(exports) {
77
77
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
78
78
  var Argument2 = class {
79
79
  /**
@@ -199,9 +199,9 @@ var require_argument = __commonJS({
199
199
  }
200
200
  });
201
201
 
202
- // ../../../node_modules/commander/lib/help.js
202
+ // ../../../../node_modules/commander/lib/help.js
203
203
  var require_help = __commonJS({
204
- "../../../node_modules/commander/lib/help.js"(exports) {
204
+ "../../../../node_modules/commander/lib/help.js"(exports) {
205
205
  var { humanReadableArgName } = require_argument();
206
206
  var Help2 = class {
207
207
  constructor() {
@@ -801,9 +801,9 @@ ${itemIndentStr}`);
801
801
  }
802
802
  });
803
803
 
804
- // ../../../node_modules/commander/lib/option.js
804
+ // ../../../../node_modules/commander/lib/option.js
805
805
  var require_option = __commonJS({
806
- "../../../node_modules/commander/lib/option.js"(exports) {
806
+ "../../../../node_modules/commander/lib/option.js"(exports) {
807
807
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
808
808
  var Option2 = class {
809
809
  /**
@@ -1114,9 +1114,9 @@ var require_option = __commonJS({
1114
1114
  }
1115
1115
  });
1116
1116
 
1117
- // ../../../node_modules/commander/lib/suggestSimilar.js
1117
+ // ../../../../node_modules/commander/lib/suggestSimilar.js
1118
1118
  var require_suggestSimilar = __commonJS({
1119
- "../../../node_modules/commander/lib/suggestSimilar.js"(exports) {
1119
+ "../../../../node_modules/commander/lib/suggestSimilar.js"(exports) {
1120
1120
  var maxDistance = 3;
1121
1121
  function editDistance(a, b) {
1122
1122
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -1194,12 +1194,12 @@ var require_suggestSimilar = __commonJS({
1194
1194
  }
1195
1195
  });
1196
1196
 
1197
- // ../../../node_modules/commander/lib/command.js
1197
+ // ../../../../node_modules/commander/lib/command.js
1198
1198
  var require_command = __commonJS({
1199
- "../../../node_modules/commander/lib/command.js"(exports) {
1199
+ "../../../../node_modules/commander/lib/command.js"(exports) {
1200
1200
  var EventEmitter = __require("node:events").EventEmitter;
1201
1201
  var childProcess = __require("node:child_process");
1202
- var path5 = __require("node:path");
1202
+ var path6 = __require("node:path");
1203
1203
  var fs = __require("node:fs");
1204
1204
  var process6 = __require("node:process");
1205
1205
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -2212,9 +2212,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2212
2212
  let launchWithNode = false;
2213
2213
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2214
2214
  function findFile(baseDir, baseName) {
2215
- const localBin = path5.resolve(baseDir, baseName);
2215
+ const localBin = path6.resolve(baseDir, baseName);
2216
2216
  if (fs.existsSync(localBin)) return localBin;
2217
- if (sourceExt.includes(path5.extname(baseName))) return void 0;
2217
+ if (sourceExt.includes(path6.extname(baseName))) return void 0;
2218
2218
  const foundExt = sourceExt.find(
2219
2219
  (ext) => fs.existsSync(`${localBin}${ext}`)
2220
2220
  );
@@ -2232,17 +2232,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
2232
2232
  } catch {
2233
2233
  resolvedScriptPath = this._scriptPath;
2234
2234
  }
2235
- executableDir = path5.resolve(
2236
- path5.dirname(resolvedScriptPath),
2235
+ executableDir = path6.resolve(
2236
+ path6.dirname(resolvedScriptPath),
2237
2237
  executableDir
2238
2238
  );
2239
2239
  }
2240
2240
  if (executableDir) {
2241
2241
  let localFile = findFile(executableDir, executableFile);
2242
2242
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2243
- const legacyName = path5.basename(
2243
+ const legacyName = path6.basename(
2244
2244
  this._scriptPath,
2245
- path5.extname(this._scriptPath)
2245
+ path6.extname(this._scriptPath)
2246
2246
  );
2247
2247
  if (legacyName !== this._name) {
2248
2248
  localFile = findFile(
@@ -2253,7 +2253,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2253
2253
  }
2254
2254
  executableFile = localFile || executableFile;
2255
2255
  }
2256
- launchWithNode = sourceExt.includes(path5.extname(executableFile));
2256
+ launchWithNode = sourceExt.includes(path6.extname(executableFile));
2257
2257
  let proc;
2258
2258
  if (process6.platform !== "win32") {
2259
2259
  if (launchWithNode) {
@@ -3168,7 +3168,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3168
3168
  * @return {Command}
3169
3169
  */
3170
3170
  nameFromFilename(filename) {
3171
- this._name = path5.basename(filename, path5.extname(filename));
3171
+ this._name = path6.basename(filename, path6.extname(filename));
3172
3172
  return this;
3173
3173
  }
3174
3174
  /**
@@ -3182,9 +3182,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3182
3182
  * @param {string} [path]
3183
3183
  * @return {(string|null|Command)}
3184
3184
  */
3185
- executableDir(path6) {
3186
- if (path6 === void 0) return this._executableDir;
3187
- this._executableDir = path6;
3185
+ executableDir(path7) {
3186
+ if (path7 === void 0) return this._executableDir;
3187
+ this._executableDir = path7;
3188
3188
  return this;
3189
3189
  }
3190
3190
  /**
@@ -3440,9 +3440,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3440
3440
  }
3441
3441
  });
3442
3442
 
3443
- // ../../../node_modules/commander/index.js
3443
+ // ../../../../node_modules/commander/index.js
3444
3444
  var require_commander = __commonJS({
3445
- "../../../node_modules/commander/index.js"(exports) {
3445
+ "../../../../node_modules/commander/index.js"(exports) {
3446
3446
  var { Argument: Argument2 } = require_argument();
3447
3447
  var { Command: Command2 } = require_command();
3448
3448
  var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
@@ -3462,9 +3462,9 @@ var require_commander = __commonJS({
3462
3462
  }
3463
3463
  });
3464
3464
 
3465
- // ../../../node_modules/cli-width/index.js
3465
+ // ../../../../node_modules/cli-width/index.js
3466
3466
  var require_cli_width = __commonJS({
3467
- "../../../node_modules/cli-width/index.js"(exports, module) {
3467
+ "../../../../node_modules/cli-width/index.js"(exports, module) {
3468
3468
  "use strict";
3469
3469
  module.exports = cliWidth2;
3470
3470
  function normalizeOpts(options) {
@@ -3505,9 +3505,9 @@ var require_cli_width = __commonJS({
3505
3505
  }
3506
3506
  });
3507
3507
 
3508
- // ../../../node_modules/mute-stream/lib/index.js
3508
+ // ../../../../node_modules/mute-stream/lib/index.js
3509
3509
  var require_lib = __commonJS({
3510
- "../../../node_modules/mute-stream/lib/index.js"(exports, module) {
3510
+ "../../../../node_modules/mute-stream/lib/index.js"(exports, module) {
3511
3511
  var Stream = __require("stream");
3512
3512
  var MuteStream2 = class extends Stream {
3513
3513
  #isTTY = null;
@@ -3627,7 +3627,7 @@ var require_lib = __commonJS({
3627
3627
  }
3628
3628
  });
3629
3629
 
3630
- // ../../../node_modules/commander/esm.mjs
3630
+ // ../../../../node_modules/commander/esm.mjs
3631
3631
  var import_index = __toESM(require_commander(), 1);
3632
3632
  var {
3633
3633
  program,
@@ -3644,7 +3644,7 @@ var {
3644
3644
  Help
3645
3645
  } = import_index.default;
3646
3646
 
3647
- // ../../../node_modules/zod/v4/classic/external.js
3647
+ // ../../../../node_modules/zod/v4/classic/external.js
3648
3648
  var external_exports = {};
3649
3649
  __export(external_exports, {
3650
3650
  $brand: () => $brand,
@@ -3887,7 +3887,7 @@ __export(external_exports, {
3887
3887
  xor: () => xor
3888
3888
  });
3889
3889
 
3890
- // ../../../node_modules/zod/v4/core/index.js
3890
+ // ../../../../node_modules/zod/v4/core/index.js
3891
3891
  var core_exports2 = {};
3892
3892
  __export(core_exports2, {
3893
3893
  $ZodAny: () => $ZodAny,
@@ -4166,7 +4166,7 @@ __export(core_exports2, {
4166
4166
  version: () => version
4167
4167
  });
4168
4168
 
4169
- // ../../../node_modules/zod/v4/core/core.js
4169
+ // ../../../../node_modules/zod/v4/core/core.js
4170
4170
  var _a;
4171
4171
  var NEVER = /* @__PURE__ */ Object.freeze({
4172
4172
  status: "aborted"
@@ -4243,7 +4243,7 @@ function config(newConfig) {
4243
4243
  return globalConfig;
4244
4244
  }
4245
4245
 
4246
- // ../../../node_modules/zod/v4/core/util.js
4246
+ // ../../../../node_modules/zod/v4/core/util.js
4247
4247
  var util_exports = {};
4248
4248
  __export(util_exports, {
4249
4249
  BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
@@ -4410,10 +4410,10 @@ function mergeDefs(...defs) {
4410
4410
  function cloneDef(schema) {
4411
4411
  return mergeDefs(schema._zod.def);
4412
4412
  }
4413
- function getElementAtPath(obj, path5) {
4414
- if (!path5)
4413
+ function getElementAtPath(obj, path6) {
4414
+ if (!path6)
4415
4415
  return obj;
4416
- return path5.reduce((acc, key) => acc?.[key], obj);
4416
+ return path6.reduce((acc, key) => acc?.[key], obj);
4417
4417
  }
4418
4418
  function promiseAllObject(promisesObj) {
4419
4419
  const keys = Object.keys(promisesObj);
@@ -4822,11 +4822,11 @@ function explicitlyAborted(x, startIndex = 0) {
4822
4822
  }
4823
4823
  return false;
4824
4824
  }
4825
- function prefixIssues(path5, issues) {
4825
+ function prefixIssues(path6, issues) {
4826
4826
  return issues.map((iss) => {
4827
4827
  var _a3;
4828
4828
  (_a3 = iss).path ?? (_a3.path = []);
4829
- iss.path.unshift(path5);
4829
+ iss.path.unshift(path6);
4830
4830
  return iss;
4831
4831
  });
4832
4832
  }
@@ -4939,7 +4939,7 @@ var Class = class {
4939
4939
  }
4940
4940
  };
4941
4941
 
4942
- // ../../../node_modules/zod/v4/core/errors.js
4942
+ // ../../../../node_modules/zod/v4/core/errors.js
4943
4943
  var initializer = (inst, def) => {
4944
4944
  inst.name = "$ZodError";
4945
4945
  Object.defineProperty(inst, "_zod", {
@@ -4973,16 +4973,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
4973
4973
  }
4974
4974
  function formatError(error51, mapper = (issue2) => issue2.message) {
4975
4975
  const fieldErrors = { _errors: [] };
4976
- const processError = (error52, path5 = []) => {
4976
+ const processError = (error52, path6 = []) => {
4977
4977
  for (const issue2 of error52.issues) {
4978
4978
  if (issue2.code === "invalid_union" && issue2.errors.length) {
4979
- issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
4979
+ issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
4980
4980
  } else if (issue2.code === "invalid_key") {
4981
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
4981
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
4982
4982
  } else if (issue2.code === "invalid_element") {
4983
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
4983
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
4984
4984
  } else {
4985
- const fullpath = [...path5, ...issue2.path];
4985
+ const fullpath = [...path6, ...issue2.path];
4986
4986
  if (fullpath.length === 0) {
4987
4987
  fieldErrors._errors.push(mapper(issue2));
4988
4988
  } else {
@@ -5009,17 +5009,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
5009
5009
  }
5010
5010
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
5011
5011
  const result = { errors: [] };
5012
- const processError = (error52, path5 = []) => {
5012
+ const processError = (error52, path6 = []) => {
5013
5013
  var _a3, _b;
5014
5014
  for (const issue2 of error52.issues) {
5015
5015
  if (issue2.code === "invalid_union" && issue2.errors.length) {
5016
- issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
5016
+ issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
5017
5017
  } else if (issue2.code === "invalid_key") {
5018
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
5018
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
5019
5019
  } else if (issue2.code === "invalid_element") {
5020
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
5020
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
5021
5021
  } else {
5022
- const fullpath = [...path5, ...issue2.path];
5022
+ const fullpath = [...path6, ...issue2.path];
5023
5023
  if (fullpath.length === 0) {
5024
5024
  result.errors.push(mapper(issue2));
5025
5025
  continue;
@@ -5051,8 +5051,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
5051
5051
  }
5052
5052
  function toDotPath(_path) {
5053
5053
  const segs = [];
5054
- const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
5055
- for (const seg of path5) {
5054
+ const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
5055
+ for (const seg of path6) {
5056
5056
  if (typeof seg === "number")
5057
5057
  segs.push(`[${seg}]`);
5058
5058
  else if (typeof seg === "symbol")
@@ -5078,7 +5078,7 @@ function prettifyError(error51) {
5078
5078
  return lines.join("\n");
5079
5079
  }
5080
5080
 
5081
- // ../../../node_modules/zod/v4/core/parse.js
5081
+ // ../../../../node_modules/zod/v4/core/parse.js
5082
5082
  var _parse = (_Err) => (schema, value, _ctx, _params) => {
5083
5083
  const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
5084
5084
  const result = schema._zod.run({ value, issues: [] }, ctx);
@@ -5166,7 +5166,7 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
5166
5166
  };
5167
5167
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
5168
5168
 
5169
- // ../../../node_modules/zod/v4/core/regexes.js
5169
+ // ../../../../node_modules/zod/v4/core/regexes.js
5170
5170
  var regexes_exports = {};
5171
5171
  __export(regexes_exports, {
5172
5172
  base64: () => base64,
@@ -5325,7 +5325,7 @@ var sha512_hex = /^[0-9a-fA-F]{128}$/;
5325
5325
  var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
5326
5326
  var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
5327
5327
 
5328
- // ../../../node_modules/zod/v4/core/checks.js
5328
+ // ../../../../node_modules/zod/v4/core/checks.js
5329
5329
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
5330
5330
  var _a3;
5331
5331
  inst._zod ?? (inst._zod = {});
@@ -5873,7 +5873,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
5873
5873
  };
5874
5874
  });
5875
5875
 
5876
- // ../../../node_modules/zod/v4/core/doc.js
5876
+ // ../../../../node_modules/zod/v4/core/doc.js
5877
5877
  var Doc = class {
5878
5878
  constructor(args = []) {
5879
5879
  this.content = [];
@@ -5909,14 +5909,14 @@ var Doc = class {
5909
5909
  }
5910
5910
  };
5911
5911
 
5912
- // ../../../node_modules/zod/v4/core/versions.js
5912
+ // ../../../../node_modules/zod/v4/core/versions.js
5913
5913
  var version = {
5914
5914
  major: 4,
5915
5915
  minor: 4,
5916
5916
  patch: 3
5917
5917
  };
5918
5918
 
5919
- // ../../../node_modules/zod/v4/core/schemas.js
5919
+ // ../../../../node_modules/zod/v4/core/schemas.js
5920
5920
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
5921
5921
  var _a3;
5922
5922
  inst ?? (inst = {});
@@ -8009,7 +8009,7 @@ function handleRefineResult(result, payload, input, inst) {
8009
8009
  }
8010
8010
  }
8011
8011
 
8012
- // ../../../node_modules/zod/v4/locales/index.js
8012
+ // ../../../../node_modules/zod/v4/locales/index.js
8013
8013
  var locales_exports = {};
8014
8014
  __export(locales_exports, {
8015
8015
  ar: () => ar_default,
@@ -8066,7 +8066,7 @@ __export(locales_exports, {
8066
8066
  zhTW: () => zh_TW_default
8067
8067
  });
8068
8068
 
8069
- // ../../../node_modules/zod/v4/locales/ar.js
8069
+ // ../../../../node_modules/zod/v4/locales/ar.js
8070
8070
  var error = () => {
8071
8071
  const Sizable = {
8072
8072
  string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
@@ -8173,7 +8173,7 @@ function ar_default() {
8173
8173
  };
8174
8174
  }
8175
8175
 
8176
- // ../../../node_modules/zod/v4/locales/az.js
8176
+ // ../../../../node_modules/zod/v4/locales/az.js
8177
8177
  var error2 = () => {
8178
8178
  const Sizable = {
8179
8179
  string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
@@ -8279,7 +8279,7 @@ function az_default() {
8279
8279
  };
8280
8280
  }
8281
8281
 
8282
- // ../../../node_modules/zod/v4/locales/be.js
8282
+ // ../../../../node_modules/zod/v4/locales/be.js
8283
8283
  function getBelarusianPlural(count, one, few, many) {
8284
8284
  const absCount = Math.abs(count);
8285
8285
  const lastDigit = absCount % 10;
@@ -8436,7 +8436,7 @@ function be_default() {
8436
8436
  };
8437
8437
  }
8438
8438
 
8439
- // ../../../node_modules/zod/v4/locales/bg.js
8439
+ // ../../../../node_modules/zod/v4/locales/bg.js
8440
8440
  var error4 = () => {
8441
8441
  const Sizable = {
8442
8442
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
@@ -8557,7 +8557,7 @@ function bg_default() {
8557
8557
  };
8558
8558
  }
8559
8559
 
8560
- // ../../../node_modules/zod/v4/locales/ca.js
8560
+ // ../../../../node_modules/zod/v4/locales/ca.js
8561
8561
  var error5 = () => {
8562
8562
  const Sizable = {
8563
8563
  string: { unit: "car\xE0cters", verb: "contenir" },
@@ -8666,7 +8666,7 @@ function ca_default() {
8666
8666
  };
8667
8667
  }
8668
8668
 
8669
- // ../../../node_modules/zod/v4/locales/cs.js
8669
+ // ../../../../node_modules/zod/v4/locales/cs.js
8670
8670
  var error6 = () => {
8671
8671
  const Sizable = {
8672
8672
  string: { unit: "znak\u016F", verb: "m\xEDt" },
@@ -8778,7 +8778,7 @@ function cs_default() {
8778
8778
  };
8779
8779
  }
8780
8780
 
8781
- // ../../../node_modules/zod/v4/locales/da.js
8781
+ // ../../../../node_modules/zod/v4/locales/da.js
8782
8782
  var error7 = () => {
8783
8783
  const Sizable = {
8784
8784
  string: { unit: "tegn", verb: "havde" },
@@ -8894,7 +8894,7 @@ function da_default() {
8894
8894
  };
8895
8895
  }
8896
8896
 
8897
- // ../../../node_modules/zod/v4/locales/de.js
8897
+ // ../../../../node_modules/zod/v4/locales/de.js
8898
8898
  var error8 = () => {
8899
8899
  const Sizable = {
8900
8900
  string: { unit: "Zeichen", verb: "zu haben" },
@@ -9003,7 +9003,7 @@ function de_default() {
9003
9003
  };
9004
9004
  }
9005
9005
 
9006
- // ../../../node_modules/zod/v4/locales/el.js
9006
+ // ../../../../node_modules/zod/v4/locales/el.js
9007
9007
  var error9 = () => {
9008
9008
  const Sizable = {
9009
9009
  string: { unit: "\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
@@ -9113,7 +9113,7 @@ function el_default() {
9113
9113
  };
9114
9114
  }
9115
9115
 
9116
- // ../../../node_modules/zod/v4/locales/en.js
9116
+ // ../../../../node_modules/zod/v4/locales/en.js
9117
9117
  var error10 = () => {
9118
9118
  const Sizable = {
9119
9119
  string: { unit: "characters", verb: "to have" },
@@ -9226,7 +9226,7 @@ function en_default() {
9226
9226
  };
9227
9227
  }
9228
9228
 
9229
- // ../../../node_modules/zod/v4/locales/eo.js
9229
+ // ../../../../node_modules/zod/v4/locales/eo.js
9230
9230
  var error11 = () => {
9231
9231
  const Sizable = {
9232
9232
  string: { unit: "karaktrojn", verb: "havi" },
@@ -9336,7 +9336,7 @@ function eo_default() {
9336
9336
  };
9337
9337
  }
9338
9338
 
9339
- // ../../../node_modules/zod/v4/locales/es.js
9339
+ // ../../../../node_modules/zod/v4/locales/es.js
9340
9340
  var error12 = () => {
9341
9341
  const Sizable = {
9342
9342
  string: { unit: "caracteres", verb: "tener" },
@@ -9469,7 +9469,7 @@ function es_default() {
9469
9469
  };
9470
9470
  }
9471
9471
 
9472
- // ../../../node_modules/zod/v4/locales/fa.js
9472
+ // ../../../../node_modules/zod/v4/locales/fa.js
9473
9473
  var error13 = () => {
9474
9474
  const Sizable = {
9475
9475
  string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
@@ -9584,7 +9584,7 @@ function fa_default() {
9584
9584
  };
9585
9585
  }
9586
9586
 
9587
- // ../../../node_modules/zod/v4/locales/fi.js
9587
+ // ../../../../node_modules/zod/v4/locales/fi.js
9588
9588
  var error14 = () => {
9589
9589
  const Sizable = {
9590
9590
  string: { unit: "merkki\xE4", subject: "merkkijonon" },
@@ -9697,7 +9697,7 @@ function fi_default() {
9697
9697
  };
9698
9698
  }
9699
9699
 
9700
- // ../../../node_modules/zod/v4/locales/fr.js
9700
+ // ../../../../node_modules/zod/v4/locales/fr.js
9701
9701
  var error15 = () => {
9702
9702
  const Sizable = {
9703
9703
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -9823,7 +9823,7 @@ function fr_default() {
9823
9823
  };
9824
9824
  }
9825
9825
 
9826
- // ../../../node_modules/zod/v4/locales/fr-CA.js
9826
+ // ../../../../node_modules/zod/v4/locales/fr-CA.js
9827
9827
  var error16 = () => {
9828
9828
  const Sizable = {
9829
9829
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -9931,7 +9931,7 @@ function fr_CA_default() {
9931
9931
  };
9932
9932
  }
9933
9933
 
9934
- // ../../../node_modules/zod/v4/locales/he.js
9934
+ // ../../../../node_modules/zod/v4/locales/he.js
9935
9935
  var error17 = () => {
9936
9936
  const TypeNames = {
9937
9937
  string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" },
@@ -10126,7 +10126,7 @@ function he_default() {
10126
10126
  };
10127
10127
  }
10128
10128
 
10129
- // ../../../node_modules/zod/v4/locales/hr.js
10129
+ // ../../../../node_modules/zod/v4/locales/hr.js
10130
10130
  var error18 = () => {
10131
10131
  const Sizable = {
10132
10132
  string: { unit: "znakova", verb: "imati" },
@@ -10249,7 +10249,7 @@ function hr_default() {
10249
10249
  };
10250
10250
  }
10251
10251
 
10252
- // ../../../node_modules/zod/v4/locales/hu.js
10252
+ // ../../../../node_modules/zod/v4/locales/hu.js
10253
10253
  var error19 = () => {
10254
10254
  const Sizable = {
10255
10255
  string: { unit: "karakter", verb: "legyen" },
@@ -10358,7 +10358,7 @@ function hu_default() {
10358
10358
  };
10359
10359
  }
10360
10360
 
10361
- // ../../../node_modules/zod/v4/locales/hy.js
10361
+ // ../../../../node_modules/zod/v4/locales/hy.js
10362
10362
  function getArmenianPlural(count, one, many) {
10363
10363
  return Math.abs(count) === 1 ? one : many;
10364
10364
  }
@@ -10506,7 +10506,7 @@ function hy_default() {
10506
10506
  };
10507
10507
  }
10508
10508
 
10509
- // ../../../node_modules/zod/v4/locales/id.js
10509
+ // ../../../../node_modules/zod/v4/locales/id.js
10510
10510
  var error21 = () => {
10511
10511
  const Sizable = {
10512
10512
  string: { unit: "karakter", verb: "memiliki" },
@@ -10613,7 +10613,7 @@ function id_default() {
10613
10613
  };
10614
10614
  }
10615
10615
 
10616
- // ../../../node_modules/zod/v4/locales/is.js
10616
+ // ../../../../node_modules/zod/v4/locales/is.js
10617
10617
  var error22 = () => {
10618
10618
  const Sizable = {
10619
10619
  string: { unit: "stafi", verb: "a\xF0 hafa" },
@@ -10723,7 +10723,7 @@ function is_default() {
10723
10723
  };
10724
10724
  }
10725
10725
 
10726
- // ../../../node_modules/zod/v4/locales/it.js
10726
+ // ../../../../node_modules/zod/v4/locales/it.js
10727
10727
  var error23 = () => {
10728
10728
  const Sizable = {
10729
10729
  string: { unit: "caratteri", verb: "avere" },
@@ -10832,7 +10832,7 @@ function it_default() {
10832
10832
  };
10833
10833
  }
10834
10834
 
10835
- // ../../../node_modules/zod/v4/locales/ja.js
10835
+ // ../../../../node_modules/zod/v4/locales/ja.js
10836
10836
  var error24 = () => {
10837
10837
  const Sizable = {
10838
10838
  string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
@@ -10940,7 +10940,7 @@ function ja_default() {
10940
10940
  };
10941
10941
  }
10942
10942
 
10943
- // ../../../node_modules/zod/v4/locales/ka.js
10943
+ // ../../../../node_modules/zod/v4/locales/ka.js
10944
10944
  var error25 = () => {
10945
10945
  const Sizable = {
10946
10946
  string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
@@ -11053,7 +11053,7 @@ function ka_default() {
11053
11053
  };
11054
11054
  }
11055
11055
 
11056
- // ../../../node_modules/zod/v4/locales/km.js
11056
+ // ../../../../node_modules/zod/v4/locales/km.js
11057
11057
  var error26 = () => {
11058
11058
  const Sizable = {
11059
11059
  string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
@@ -11164,12 +11164,12 @@ function km_default() {
11164
11164
  };
11165
11165
  }
11166
11166
 
11167
- // ../../../node_modules/zod/v4/locales/kh.js
11167
+ // ../../../../node_modules/zod/v4/locales/kh.js
11168
11168
  function kh_default() {
11169
11169
  return km_default();
11170
11170
  }
11171
11171
 
11172
- // ../../../node_modules/zod/v4/locales/ko.js
11172
+ // ../../../../node_modules/zod/v4/locales/ko.js
11173
11173
  var error27 = () => {
11174
11174
  const Sizable = {
11175
11175
  string: { unit: "\uBB38\uC790", verb: "to have" },
@@ -11281,7 +11281,7 @@ function ko_default() {
11281
11281
  };
11282
11282
  }
11283
11283
 
11284
- // ../../../node_modules/zod/v4/locales/lt.js
11284
+ // ../../../../node_modules/zod/v4/locales/lt.js
11285
11285
  var capitalizeFirstCharacter = (text) => {
11286
11286
  return text.charAt(0).toUpperCase() + text.slice(1);
11287
11287
  };
@@ -11485,7 +11485,7 @@ function lt_default() {
11485
11485
  };
11486
11486
  }
11487
11487
 
11488
- // ../../../node_modules/zod/v4/locales/mk.js
11488
+ // ../../../../node_modules/zod/v4/locales/mk.js
11489
11489
  var error29 = () => {
11490
11490
  const Sizable = {
11491
11491
  string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
@@ -11595,7 +11595,7 @@ function mk_default() {
11595
11595
  };
11596
11596
  }
11597
11597
 
11598
- // ../../../node_modules/zod/v4/locales/ms.js
11598
+ // ../../../../node_modules/zod/v4/locales/ms.js
11599
11599
  var error30 = () => {
11600
11600
  const Sizable = {
11601
11601
  string: { unit: "aksara", verb: "mempunyai" },
@@ -11703,7 +11703,7 @@ function ms_default() {
11703
11703
  };
11704
11704
  }
11705
11705
 
11706
- // ../../../node_modules/zod/v4/locales/nl.js
11706
+ // ../../../../node_modules/zod/v4/locales/nl.js
11707
11707
  var error31 = () => {
11708
11708
  const Sizable = {
11709
11709
  string: { unit: "tekens", verb: "heeft" },
@@ -11814,7 +11814,7 @@ function nl_default() {
11814
11814
  };
11815
11815
  }
11816
11816
 
11817
- // ../../../node_modules/zod/v4/locales/no.js
11817
+ // ../../../../node_modules/zod/v4/locales/no.js
11818
11818
  var error32 = () => {
11819
11819
  const Sizable = {
11820
11820
  string: { unit: "tegn", verb: "\xE5 ha" },
@@ -11923,7 +11923,7 @@ function no_default() {
11923
11923
  };
11924
11924
  }
11925
11925
 
11926
- // ../../../node_modules/zod/v4/locales/ota.js
11926
+ // ../../../../node_modules/zod/v4/locales/ota.js
11927
11927
  var error33 = () => {
11928
11928
  const Sizable = {
11929
11929
  string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
@@ -12033,7 +12033,7 @@ function ota_default() {
12033
12033
  };
12034
12034
  }
12035
12035
 
12036
- // ../../../node_modules/zod/v4/locales/ps.js
12036
+ // ../../../../node_modules/zod/v4/locales/ps.js
12037
12037
  var error34 = () => {
12038
12038
  const Sizable = {
12039
12039
  string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
@@ -12148,7 +12148,7 @@ function ps_default() {
12148
12148
  };
12149
12149
  }
12150
12150
 
12151
- // ../../../node_modules/zod/v4/locales/pl.js
12151
+ // ../../../../node_modules/zod/v4/locales/pl.js
12152
12152
  var error35 = () => {
12153
12153
  const Sizable = {
12154
12154
  string: { unit: "znak\xF3w", verb: "mie\u0107" },
@@ -12258,7 +12258,7 @@ function pl_default() {
12258
12258
  };
12259
12259
  }
12260
12260
 
12261
- // ../../../node_modules/zod/v4/locales/pt.js
12261
+ // ../../../../node_modules/zod/v4/locales/pt.js
12262
12262
  var error36 = () => {
12263
12263
  const Sizable = {
12264
12264
  string: { unit: "caracteres", verb: "ter" },
@@ -12367,7 +12367,7 @@ function pt_default() {
12367
12367
  };
12368
12368
  }
12369
12369
 
12370
- // ../../../node_modules/zod/v4/locales/ro.js
12370
+ // ../../../../node_modules/zod/v4/locales/ro.js
12371
12371
  var error37 = () => {
12372
12372
  const Sizable = {
12373
12373
  string: { unit: "caractere", verb: "s\u0103 aib\u0103" },
@@ -12487,7 +12487,7 @@ function ro_default() {
12487
12487
  };
12488
12488
  }
12489
12489
 
12490
- // ../../../node_modules/zod/v4/locales/ru.js
12490
+ // ../../../../node_modules/zod/v4/locales/ru.js
12491
12491
  function getRussianPlural(count, one, few, many) {
12492
12492
  const absCount = Math.abs(count);
12493
12493
  const lastDigit = absCount % 10;
@@ -12644,7 +12644,7 @@ function ru_default() {
12644
12644
  };
12645
12645
  }
12646
12646
 
12647
- // ../../../node_modules/zod/v4/locales/sl.js
12647
+ // ../../../../node_modules/zod/v4/locales/sl.js
12648
12648
  var error39 = () => {
12649
12649
  const Sizable = {
12650
12650
  string: { unit: "znakov", verb: "imeti" },
@@ -12754,7 +12754,7 @@ function sl_default() {
12754
12754
  };
12755
12755
  }
12756
12756
 
12757
- // ../../../node_modules/zod/v4/locales/sv.js
12757
+ // ../../../../node_modules/zod/v4/locales/sv.js
12758
12758
  var error40 = () => {
12759
12759
  const Sizable = {
12760
12760
  string: { unit: "tecken", verb: "att ha" },
@@ -12865,7 +12865,7 @@ function sv_default() {
12865
12865
  };
12866
12866
  }
12867
12867
 
12868
- // ../../../node_modules/zod/v4/locales/ta.js
12868
+ // ../../../../node_modules/zod/v4/locales/ta.js
12869
12869
  var error41 = () => {
12870
12870
  const Sizable = {
12871
12871
  string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
@@ -12976,7 +12976,7 @@ function ta_default() {
12976
12976
  };
12977
12977
  }
12978
12978
 
12979
- // ../../../node_modules/zod/v4/locales/th.js
12979
+ // ../../../../node_modules/zod/v4/locales/th.js
12980
12980
  var error42 = () => {
12981
12981
  const Sizable = {
12982
12982
  string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
@@ -13087,7 +13087,7 @@ function th_default() {
13087
13087
  };
13088
13088
  }
13089
13089
 
13090
- // ../../../node_modules/zod/v4/locales/tr.js
13090
+ // ../../../../node_modules/zod/v4/locales/tr.js
13091
13091
  var error43 = () => {
13092
13092
  const Sizable = {
13093
13093
  string: { unit: "karakter", verb: "olmal\u0131" },
@@ -13193,7 +13193,7 @@ function tr_default() {
13193
13193
  };
13194
13194
  }
13195
13195
 
13196
- // ../../../node_modules/zod/v4/locales/uk.js
13196
+ // ../../../../node_modules/zod/v4/locales/uk.js
13197
13197
  var error44 = () => {
13198
13198
  const Sizable = {
13199
13199
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
@@ -13302,12 +13302,12 @@ function uk_default() {
13302
13302
  };
13303
13303
  }
13304
13304
 
13305
- // ../../../node_modules/zod/v4/locales/ua.js
13305
+ // ../../../../node_modules/zod/v4/locales/ua.js
13306
13306
  function ua_default() {
13307
13307
  return uk_default();
13308
13308
  }
13309
13309
 
13310
- // ../../../node_modules/zod/v4/locales/ur.js
13310
+ // ../../../../node_modules/zod/v4/locales/ur.js
13311
13311
  var error45 = () => {
13312
13312
  const Sizable = {
13313
13313
  string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
@@ -13418,7 +13418,7 @@ function ur_default() {
13418
13418
  };
13419
13419
  }
13420
13420
 
13421
- // ../../../node_modules/zod/v4/locales/uz.js
13421
+ // ../../../../node_modules/zod/v4/locales/uz.js
13422
13422
  var error46 = () => {
13423
13423
  const Sizable = {
13424
13424
  string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
@@ -13529,7 +13529,7 @@ function uz_default() {
13529
13529
  };
13530
13530
  }
13531
13531
 
13532
- // ../../../node_modules/zod/v4/locales/vi.js
13532
+ // ../../../../node_modules/zod/v4/locales/vi.js
13533
13533
  var error47 = () => {
13534
13534
  const Sizable = {
13535
13535
  string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
@@ -13638,7 +13638,7 @@ function vi_default() {
13638
13638
  };
13639
13639
  }
13640
13640
 
13641
- // ../../../node_modules/zod/v4/locales/zh-CN.js
13641
+ // ../../../../node_modules/zod/v4/locales/zh-CN.js
13642
13642
  var error48 = () => {
13643
13643
  const Sizable = {
13644
13644
  string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
@@ -13748,7 +13748,7 @@ function zh_CN_default() {
13748
13748
  };
13749
13749
  }
13750
13750
 
13751
- // ../../../node_modules/zod/v4/locales/zh-TW.js
13751
+ // ../../../../node_modules/zod/v4/locales/zh-TW.js
13752
13752
  var error49 = () => {
13753
13753
  const Sizable = {
13754
13754
  string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
@@ -13856,7 +13856,7 @@ function zh_TW_default() {
13856
13856
  };
13857
13857
  }
13858
13858
 
13859
- // ../../../node_modules/zod/v4/locales/yo.js
13859
+ // ../../../../node_modules/zod/v4/locales/yo.js
13860
13860
  var error50 = () => {
13861
13861
  const Sizable = {
13862
13862
  string: { unit: "\xE0mi", verb: "n\xED" },
@@ -13964,7 +13964,7 @@ function yo_default() {
13964
13964
  };
13965
13965
  }
13966
13966
 
13967
- // ../../../node_modules/zod/v4/core/registries.js
13967
+ // ../../../../node_modules/zod/v4/core/registries.js
13968
13968
  var _a2;
13969
13969
  var $output = /* @__PURE__ */ Symbol("ZodOutput");
13970
13970
  var $input = /* @__PURE__ */ Symbol("ZodInput");
@@ -14014,7 +14014,7 @@ function registry() {
14014
14014
  (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
14015
14015
  var globalRegistry = globalThis.__zod_globalRegistry;
14016
14016
 
14017
- // ../../../node_modules/zod/v4/core/api.js
14017
+ // ../../../../node_modules/zod/v4/core/api.js
14018
14018
  // @__NO_SIDE_EFFECTS__
14019
14019
  function _string(Class2, params) {
14020
14020
  return new Class2({
@@ -15053,7 +15053,7 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
15053
15053
  return inst;
15054
15054
  }
15055
15055
 
15056
- // ../../../node_modules/zod/v4/core/to-json-schema.js
15056
+ // ../../../../node_modules/zod/v4/core/to-json-schema.js
15057
15057
  function initializeContext(params) {
15058
15058
  let target = params?.target ?? "draft-2020-12";
15059
15059
  if (target === "draft-4")
@@ -15412,7 +15412,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
15412
15412
  return finalize(ctx, schema);
15413
15413
  };
15414
15414
 
15415
- // ../../../node_modules/zod/v4/core/json-schema-processors.js
15415
+ // ../../../../node_modules/zod/v4/core/json-schema-processors.js
15416
15416
  var formatMap = {
15417
15417
  guid: "uuid",
15418
15418
  url: "uri",
@@ -15956,7 +15956,7 @@ function toJSONSchema(input, params) {
15956
15956
  return finalize(ctx, input);
15957
15957
  }
15958
15958
 
15959
- // ../../../node_modules/zod/v4/core/json-schema-generator.js
15959
+ // ../../../../node_modules/zod/v4/core/json-schema-generator.js
15960
15960
  var JSONSchemaGenerator = class {
15961
15961
  /** @deprecated Access via ctx instead */
15962
15962
  get metadataRegistry() {
@@ -16031,10 +16031,10 @@ var JSONSchemaGenerator = class {
16031
16031
  }
16032
16032
  };
16033
16033
 
16034
- // ../../../node_modules/zod/v4/core/json-schema.js
16034
+ // ../../../../node_modules/zod/v4/core/json-schema.js
16035
16035
  var json_schema_exports = {};
16036
16036
 
16037
- // ../../../node_modules/zod/v4/classic/schemas.js
16037
+ // ../../../../node_modules/zod/v4/classic/schemas.js
16038
16038
  var schemas_exports2 = {};
16039
16039
  __export(schemas_exports2, {
16040
16040
  ZodAny: () => ZodAny,
@@ -16205,7 +16205,7 @@ __export(schemas_exports2, {
16205
16205
  xor: () => xor
16206
16206
  });
16207
16207
 
16208
- // ../../../node_modules/zod/v4/classic/checks.js
16208
+ // ../../../../node_modules/zod/v4/classic/checks.js
16209
16209
  var checks_exports2 = {};
16210
16210
  __export(checks_exports2, {
16211
16211
  endsWith: () => _endsWith,
@@ -16239,7 +16239,7 @@ __export(checks_exports2, {
16239
16239
  uppercase: () => _uppercase
16240
16240
  });
16241
16241
 
16242
- // ../../../node_modules/zod/v4/classic/iso.js
16242
+ // ../../../../node_modules/zod/v4/classic/iso.js
16243
16243
  var iso_exports = {};
16244
16244
  __export(iso_exports, {
16245
16245
  ZodISODate: () => ZodISODate,
@@ -16280,7 +16280,7 @@ function duration2(params) {
16280
16280
  return _isoDuration(ZodISODuration, params);
16281
16281
  }
16282
16282
 
16283
- // ../../../node_modules/zod/v4/classic/errors.js
16283
+ // ../../../../node_modules/zod/v4/classic/errors.js
16284
16284
  var initializer2 = (inst, issues) => {
16285
16285
  $ZodError.init(inst, issues);
16286
16286
  inst.name = "ZodError";
@@ -16320,7 +16320,7 @@ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
16320
16320
  Parent: Error
16321
16321
  });
16322
16322
 
16323
- // ../../../node_modules/zod/v4/classic/parse.js
16323
+ // ../../../../node_modules/zod/v4/classic/parse.js
16324
16324
  var parse2 = /* @__PURE__ */ _parse(ZodRealError);
16325
16325
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
16326
16326
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -16334,7 +16334,7 @@ var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
16334
16334
  var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
16335
16335
  var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
16336
16336
 
16337
- // ../../../node_modules/zod/v4/classic/schemas.js
16337
+ // ../../../../node_modules/zod/v4/classic/schemas.js
16338
16338
  var _installedGroups = /* @__PURE__ */ new WeakMap();
16339
16339
  function _installLazyMethods(inst, group, methods) {
16340
16340
  const proto2 = Object.getPrototypeOf(inst);
@@ -17624,7 +17624,7 @@ function preprocess(fn, schema) {
17624
17624
  });
17625
17625
  }
17626
17626
 
17627
- // ../../../node_modules/zod/v4/classic/compat.js
17627
+ // ../../../../node_modules/zod/v4/classic/compat.js
17628
17628
  var ZodIssueCode = {
17629
17629
  invalid_type: "invalid_type",
17630
17630
  too_big: "too_big",
@@ -17650,7 +17650,7 @@ var ZodFirstPartyTypeKind;
17650
17650
  /* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
17651
17651
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
17652
17652
 
17653
- // ../../../node_modules/zod/v4/classic/from-json-schema.js
17653
+ // ../../../../node_modules/zod/v4/classic/from-json-schema.js
17654
17654
  var z = {
17655
17655
  ...schemas_exports2,
17656
17656
  ...checks_exports2,
@@ -17744,13 +17744,13 @@ function resolveRef(ref, ctx) {
17744
17744
  if (!ref.startsWith("#")) {
17745
17745
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
17746
17746
  }
17747
- const path5 = ref.slice(1).split("/").filter(Boolean);
17748
- if (path5.length === 0) {
17747
+ const path6 = ref.slice(1).split("/").filter(Boolean);
17748
+ if (path6.length === 0) {
17749
17749
  return ctx.rootSchema;
17750
17750
  }
17751
17751
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
17752
- if (path5[0] === defsKey) {
17753
- const key = path5[1];
17752
+ if (path6[0] === defsKey) {
17753
+ const key = path6[1];
17754
17754
  if (!key || !ctx.defs[key]) {
17755
17755
  throw new Error(`Reference not found: ${ref}`);
17756
17756
  }
@@ -18130,7 +18130,7 @@ function fromJSONSchema(schema, params) {
18130
18130
  return convertSchema(normalized, ctx);
18131
18131
  }
18132
18132
 
18133
- // ../../../node_modules/zod/v4/classic/coerce.js
18133
+ // ../../../../node_modules/zod/v4/classic/coerce.js
18134
18134
  var coerce_exports = {};
18135
18135
  __export(coerce_exports, {
18136
18136
  bigint: () => bigint3,
@@ -18155,7 +18155,7 @@ function date4(params) {
18155
18155
  return _coercedDate(ZodDate, params);
18156
18156
  }
18157
18157
 
18158
- // ../../../node_modules/zod/v4/classic/external.js
18158
+ // ../../../../node_modules/zod/v4/classic/external.js
18159
18159
  config(en_default());
18160
18160
 
18161
18161
  // ../../shared/dist/ids.js
@@ -18492,6 +18492,9 @@ var UpdateSpaceBodySchema = external_exports.object({
18492
18492
  slug: SpaceSlugSchema.optional(),
18493
18493
  icon: PageIconSchema.optional()
18494
18494
  }).refine((body) => Object.keys(body).length > 0, "Nothing to update.");
18495
+ function toSpaceSlug(name) {
18496
+ return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/, "");
18497
+ }
18495
18498
 
18496
18499
  // ../../shared/dist/error.js
18497
18500
  var ErrorCode;
@@ -18560,33 +18563,15 @@ var ErrorBody = external_exports.object({
18560
18563
  // ../../shared/dist/gus/gus-runtime.js
18561
18564
  var GusHarness;
18562
18565
  (function(GusHarness2) {
18563
- GusHarness2["Pi"] = "pi";
18564
18566
  GusHarness2["ClaudeCode"] = "claude_code";
18565
18567
  GusHarness2["Codex"] = "codex";
18566
18568
  GusHarness2["OpenCode"] = "opencode";
18567
18569
  })(GusHarness || (GusHarness = {}));
18568
18570
  var GusHarnessSchema = external_exports.nativeEnum(GusHarness);
18569
18571
  var GUS_HARNESSES = [
18570
- {
18571
- id: GusHarness.Pi,
18572
- label: "Pi",
18573
- bridged: false
18574
- },
18575
- {
18576
- id: GusHarness.ClaudeCode,
18577
- label: "Claude Code",
18578
- bridged: true
18579
- },
18580
- {
18581
- id: GusHarness.Codex,
18582
- label: "Codex",
18583
- bridged: true
18584
- },
18585
- {
18586
- id: GusHarness.OpenCode,
18587
- label: "OpenCode",
18588
- bridged: true
18589
- }
18572
+ { id: GusHarness.ClaudeCode, label: "Claude Code" },
18573
+ { id: GusHarness.Codex, label: "Codex" },
18574
+ { id: GusHarness.OpenCode, label: "OpenCode" }
18590
18575
  ];
18591
18576
  var GUS_MODELS = [
18592
18577
  {
@@ -18597,8 +18582,7 @@ var GUS_MODELS = [
18597
18582
  outputUsdPerMillion: 0.6,
18598
18583
  contextWindow: 105e4,
18599
18584
  reasoning: true,
18600
- longPrompt: { overTokens: 272e3, inputUsdPerMillion: 0.2, outputUsdPerMillion: 0.9 },
18601
- harness: GusHarness.OpenCode
18585
+ longPrompt: { overTokens: 272e3, inputUsdPerMillion: 0.2, outputUsdPerMillion: 0.9 }
18602
18586
  },
18603
18587
  {
18604
18588
  id: "openai/gpt-5.6-terra-pro",
@@ -18607,8 +18591,7 @@ var GUS_MODELS = [
18607
18591
  inputUsdPerMillion: 1,
18608
18592
  outputUsdPerMillion: 6,
18609
18593
  contextWindow: 105e4,
18610
- reasoning: true,
18611
- harness: GusHarness.OpenCode
18594
+ reasoning: true
18612
18595
  },
18613
18596
  {
18614
18597
  id: "anthropic/claude-opus-5",
@@ -18617,8 +18600,7 @@ var GUS_MODELS = [
18617
18600
  inputUsdPerMillion: 5,
18618
18601
  outputUsdPerMillion: 25,
18619
18602
  contextWindow: 1e6,
18620
- reasoning: true,
18621
- harness: GusHarness.ClaudeCode
18603
+ reasoning: true
18622
18604
  },
18623
18605
  {
18624
18606
  id: "anthropic/claude-sonnet-5",
@@ -18627,8 +18609,7 @@ var GUS_MODELS = [
18627
18609
  inputUsdPerMillion: 2,
18628
18610
  outputUsdPerMillion: 10,
18629
18611
  contextWindow: 1e6,
18630
- reasoning: true,
18631
- harness: GusHarness.ClaudeCode
18612
+ reasoning: true
18632
18613
  },
18633
18614
  {
18634
18615
  id: "google/gemini-3.8-flash",
@@ -18637,8 +18618,7 @@ var GUS_MODELS = [
18637
18618
  inputUsdPerMillion: 0.75,
18638
18619
  outputUsdPerMillion: 3.75,
18639
18620
  contextWindow: 1048576,
18640
- reasoning: true,
18641
- harness: GusHarness.OpenCode
18621
+ reasoning: true
18642
18622
  },
18643
18623
  {
18644
18624
  id: "meta/muse-spark-1.3",
@@ -18647,8 +18627,7 @@ var GUS_MODELS = [
18647
18627
  inputUsdPerMillion: 1.25,
18648
18628
  outputUsdPerMillion: 4.25,
18649
18629
  contextWindow: 1048576,
18650
- reasoning: true,
18651
- harness: GusHarness.OpenCode
18630
+ reasoning: true
18652
18631
  },
18653
18632
  {
18654
18633
  id: "moonshotai/kimi-k3",
@@ -18657,8 +18636,7 @@ var GUS_MODELS = [
18657
18636
  inputUsdPerMillion: 3,
18658
18637
  outputUsdPerMillion: 15,
18659
18638
  contextWindow: 1048576,
18660
- reasoning: true,
18661
- harness: GusHarness.OpenCode
18639
+ reasoning: true
18662
18640
  },
18663
18641
  {
18664
18642
  id: "z-ai/glm-5.3",
@@ -18667,8 +18645,7 @@ var GUS_MODELS = [
18667
18645
  inputUsdPerMillion: 1.4,
18668
18646
  outputUsdPerMillion: 4.4,
18669
18647
  contextWindow: 1048576,
18670
- reasoning: true,
18671
- harness: GusHarness.ClaudeCode
18648
+ reasoning: true
18672
18649
  },
18673
18650
  {
18674
18651
  id: "z-ai/glm-5.3-flash",
@@ -18677,8 +18654,7 @@ var GUS_MODELS = [
18677
18654
  inputUsdPerMillion: 0.075,
18678
18655
  outputUsdPerMillion: 0.25,
18679
18656
  contextWindow: 1048576,
18680
- reasoning: true,
18681
- harness: GusHarness.ClaudeCode
18657
+ reasoning: true
18682
18658
  },
18683
18659
  {
18684
18660
  id: "qwen/qwen3.8-max",
@@ -18687,8 +18663,7 @@ var GUS_MODELS = [
18687
18663
  inputUsdPerMillion: 2,
18688
18664
  outputUsdPerMillion: 6,
18689
18665
  contextWindow: 1e6,
18690
- reasoning: true,
18691
- harness: GusHarness.OpenCode
18666
+ reasoning: true
18692
18667
  },
18693
18668
  {
18694
18669
  id: "x-ai/grok-4.6",
@@ -18697,8 +18672,7 @@ var GUS_MODELS = [
18697
18672
  inputUsdPerMillion: 2,
18698
18673
  outputUsdPerMillion: 6,
18699
18674
  contextWindow: 5e5,
18700
- reasoning: true,
18701
- harness: GusHarness.OpenCode
18675
+ reasoning: true
18702
18676
  },
18703
18677
  {
18704
18678
  id: "deepseek/deepseek-v4-flash-0731",
@@ -18707,8 +18681,7 @@ var GUS_MODELS = [
18707
18681
  inputUsdPerMillion: 0.08,
18708
18682
  outputUsdPerMillion: 0.18,
18709
18683
  contextWindow: 1048576,
18710
- reasoning: true,
18711
- harness: GusHarness.OpenCode
18684
+ reasoning: true
18712
18685
  },
18713
18686
  {
18714
18687
  id: "deepseek/deepseek-v4.1-flash",
@@ -18717,8 +18690,7 @@ var GUS_MODELS = [
18717
18690
  inputUsdPerMillion: 0.08,
18718
18691
  outputUsdPerMillion: 0.18,
18719
18692
  contextWindow: 1048576,
18720
- reasoning: true,
18721
- harness: GusHarness.OpenCode
18693
+ reasoning: true
18722
18694
  },
18723
18695
  {
18724
18696
  id: "deepseek/deepseek-v4-pro-0813",
@@ -18727,14 +18699,21 @@ var GUS_MODELS = [
18727
18699
  inputUsdPerMillion: 0.44,
18728
18700
  outputUsdPerMillion: 0.87,
18729
18701
  contextWindow: 1048576,
18730
- reasoning: true,
18731
- harness: GusHarness.OpenCode
18702
+ reasoning: true
18732
18703
  }
18733
18704
  ];
18734
18705
  var DEFAULT_GUS_MODEL = "deepseek/deepseek-v4-flash-0731";
18735
18706
  function findGusModel(id) {
18736
18707
  return GUS_MODELS.find((model) => model.id === id);
18737
18708
  }
18709
+ function gusHarnessFor(model) {
18710
+ const name = model.split("/").at(-1) ?? model;
18711
+ if (name.startsWith("gpt-"))
18712
+ return GusHarness.Codex;
18713
+ if (name.startsWith("claude-"))
18714
+ return GusHarness.ClaudeCode;
18715
+ return GusHarness.OpenCode;
18716
+ }
18738
18717
  function gusRuntimeFor(model) {
18739
18718
  const entry = findGusModel(model);
18740
18719
  if (entry === void 0)
@@ -18742,7 +18721,7 @@ function gusRuntimeFor(model) {
18742
18721
  code: ErrorCode.INVALID_REQUEST,
18743
18722
  params: { message: `${model} is not a model Gus runs.` }
18744
18723
  });
18745
- return { harness: entry.harness, model: entry.id };
18724
+ return { harness: gusHarnessFor(entry.id), model: entry.id };
18746
18725
  }
18747
18726
  var DEFAULT_GUS_HARNESS = gusRuntimeFor(DEFAULT_GUS_MODEL).harness;
18748
18727
  var DEFAULT_GUS_RUNTIME = gusRuntimeFor(DEFAULT_GUS_MODEL);
@@ -19001,10 +18980,25 @@ var AUDIT_GROUPS = [
19001
18980
  },
19002
18981
  {
19003
18982
  resource: AuditResource.Tools,
19004
- label: "Tool and MCP calls",
18983
+ label: "MCP calls",
19005
18984
  actions: [AuditAction.McpToolCall, AuditAction.McpRequest]
19006
18985
  }
19007
18986
  ];
18987
+ function auditNamespace(action) {
18988
+ const cut = action.indexOf(".");
18989
+ const head = cut === -1 ? action : action.slice(0, cut);
18990
+ const under = head.indexOf("_");
18991
+ return under === -1 ? head : head.slice(0, under);
18992
+ }
18993
+ var AUDIT_NAMESPACES = AUDIT_GROUPS.flatMap((group) => group.actions).reduce((groups, action) => {
18994
+ const key = auditNamespace(action);
18995
+ const found = groups.find((group) => group.key === key);
18996
+ if (found)
18997
+ found.actions.push(action);
18998
+ else
18999
+ groups.push({ key, actions: [action] });
19000
+ return groups;
19001
+ }, []);
19008
19002
  var AUDIT_RESOURCES = Object.fromEntries(AUDIT_GROUPS.flatMap((group) => group.actions.map((action) => [action, group.resource])));
19009
19003
  var AUDIT_LISTED_ACTIONS = AUDIT_GROUPS.flatMap((group) => group.actions);
19010
19004
  var AUDIT_QUIET_ACTIONS = [AuditAction.McpRequest, AuditAction.PageRead, AuditAction.PageWrite];
@@ -19053,8 +19047,8 @@ var AUDIT_LABELS = {
19053
19047
  [AuditAction.WorkflowPublished]: "Published workflow",
19054
19048
  [AuditAction.WorkflowDeleted]: "Deleted workflow",
19055
19049
  [AuditAction.WorkflowSecretRotated]: "Rotated workflow webhook secret",
19056
- [AuditAction.McpRequest]: "Called MCP method",
19057
- [AuditAction.McpToolCall]: "Called MCP tool",
19050
+ [AuditAction.McpRequest]: "MCP request",
19051
+ [AuditAction.McpToolCall]: "MCP call",
19058
19052
  [AuditAction.PageRead]: "Read page",
19059
19053
  [AuditAction.PageWrite]: "Wrote page"
19060
19054
  };
@@ -19898,7 +19892,7 @@ var SaveWorkstationBodySchema = external_exports.object({
19898
19892
  var WorkstationResponseSchema = external_exports.object({ workstation: WorkstationSchema });
19899
19893
 
19900
19894
  // ../../shared/dist/machines/machine.js
19901
- var CLI_VERSION = "0.8.0";
19895
+ var CLI_VERSION = "0.9.0";
19902
19896
  var CLI_PACKAGE = "@craftspace/cli";
19903
19897
  var CLI_INSTALL = `npm i -g ${CLI_PACKAGE}`;
19904
19898
  var MACHINE_BEAT_INTERVAL_MS = 15e3;
@@ -20033,6 +20027,7 @@ var MachineEnvironmentSchema = external_exports.object({
20033
20027
  });
20034
20028
  var MachineBeatResponseSchema = external_exports.object({
20035
20029
  cli: external_exports.object({ version: external_exports.string(), url: external_exports.string(), sha256: external_exports.string() }).nullable(),
20030
+ organization: external_exports.string(),
20036
20031
  work: external_exports.array(MachineWorkSchema),
20037
20032
  authorizedKeys: external_exports.array(external_exports.string()),
20038
20033
  environment: MachineEnvironmentSchema
@@ -20388,12 +20383,13 @@ var MemberActivityListResponse = external_exports.object({
20388
20383
 
20389
20384
  // dist/machine.js
20390
20385
  import { execFile as execFile3, spawn as spawn2 } from "node:child_process";
20391
- import { mkdir as mkdir2, readFile as readFile2, readdir, rm, writeFile } from "node:fs/promises";
20392
- import os5 from "node:os";
20393
- import path4 from "node:path";
20386
+ import { existsSync as existsSync2 } from "node:fs";
20387
+ import { mkdir as mkdir3, readFile as readFile3, readdir as readdir2, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
20388
+ import os6 from "node:os";
20389
+ import path5 from "node:path";
20394
20390
  import { promisify as promisify2 } from "node:util";
20395
20391
 
20396
- // ../../../node_modules/@inquirer/core/dist/lib/key.js
20392
+ // ../../../../node_modules/@inquirer/core/dist/lib/key.js
20397
20393
  var keybindings = ["emacs", "vim"];
20398
20394
  var keybindingLookup = new Set(keybindings);
20399
20395
  function isKeybinding(value) {
@@ -20422,7 +20418,7 @@ var isTabKey = (key) => key.name === "tab";
20422
20418
  var isNumberKey = (key) => "1234567890".includes(key.name);
20423
20419
  var isEnterKey = (key) => key.name === "enter" || key.name === "return";
20424
20420
 
20425
- // ../../../node_modules/@inquirer/core/dist/lib/errors.js
20421
+ // ../../../../node_modules/@inquirer/core/dist/lib/errors.js
20426
20422
  var AbortPromptError = class extends Error {
20427
20423
  name = "AbortPromptError";
20428
20424
  message = "Prompt was aborted";
@@ -20445,10 +20441,10 @@ var ValidationError = class extends Error {
20445
20441
  name = "ValidationError";
20446
20442
  };
20447
20443
 
20448
- // ../../../node_modules/@inquirer/core/dist/lib/use-state.js
20444
+ // ../../../../node_modules/@inquirer/core/dist/lib/use-state.js
20449
20445
  import { AsyncResource as AsyncResource2 } from "node:async_hooks";
20450
20446
 
20451
- // ../../../node_modules/@inquirer/core/dist/lib/hook-engine.js
20447
+ // ../../../../node_modules/@inquirer/core/dist/lib/hook-engine.js
20452
20448
  import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
20453
20449
  var hookStorage = new AsyncLocalStorage();
20454
20450
  function createStore(rl) {
@@ -20554,7 +20550,7 @@ var effectScheduler = {
20554
20550
  }
20555
20551
  };
20556
20552
 
20557
- // ../../../node_modules/@inquirer/core/dist/lib/use-state.js
20553
+ // ../../../../node_modules/@inquirer/core/dist/lib/use-state.js
20558
20554
  function isFactory(value) {
20559
20555
  return typeof value === "function";
20560
20556
  }
@@ -20580,7 +20576,7 @@ function useState(defaultValue) {
20580
20576
  });
20581
20577
  }
20582
20578
 
20583
- // ../../../node_modules/@inquirer/core/dist/lib/use-effect.js
20579
+ // ../../../../node_modules/@inquirer/core/dist/lib/use-effect.js
20584
20580
  function useEffect(cb, depArray) {
20585
20581
  withPointer((pointer) => {
20586
20582
  const oldDeps = pointer.get();
@@ -20592,10 +20588,10 @@ function useEffect(cb, depArray) {
20592
20588
  });
20593
20589
  }
20594
20590
 
20595
- // ../../../node_modules/@inquirer/core/dist/lib/theme.js
20591
+ // ../../../../node_modules/@inquirer/core/dist/lib/theme.js
20596
20592
  import { styleText } from "node:util";
20597
20593
 
20598
- // ../../../node_modules/@inquirer/figures/dist/index.js
20594
+ // ../../../../node_modules/@inquirer/figures/dist/index.js
20599
20595
  import process3 from "node:process";
20600
20596
  function isUnicodeSupported() {
20601
20597
  if (!process3.platform.startsWith("win")) {
@@ -20888,7 +20884,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
20888
20884
  var dist_default = figures;
20889
20885
  var replacements = Object.entries(specialMainSymbols);
20890
20886
 
20891
- // ../../../node_modules/@inquirer/core/dist/lib/theme.js
20887
+ // ../../../../node_modules/@inquirer/core/dist/lib/theme.js
20892
20888
  var defaultTheme = {
20893
20889
  prefix: {
20894
20890
  idle: styleText("blue", "?"),
@@ -20916,7 +20912,7 @@ function getDefaultTheme() {
20916
20912
  };
20917
20913
  }
20918
20914
 
20919
- // ../../../node_modules/@inquirer/core/dist/lib/make-theme.js
20915
+ // ../../../../node_modules/@inquirer/core/dist/lib/make-theme.js
20920
20916
  function isPlainObject2(value) {
20921
20917
  if (typeof value !== "object" || value === null)
20922
20918
  return false;
@@ -20944,7 +20940,7 @@ function makeTheme(...themes) {
20944
20940
  return deepMerge(...themesToMerge);
20945
20941
  }
20946
20942
 
20947
- // ../../../node_modules/@inquirer/core/dist/lib/use-prefix.js
20943
+ // ../../../../node_modules/@inquirer/core/dist/lib/use-prefix.js
20948
20944
  function usePrefix({ status = "idle", theme }) {
20949
20945
  const [showLoader, setShowLoader] = useState(false);
20950
20946
  const [tick, setTick] = useState(0);
@@ -20975,7 +20971,7 @@ function usePrefix({ status = "idle", theme }) {
20975
20971
  return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
20976
20972
  }
20977
20973
 
20978
- // ../../../node_modules/@inquirer/core/dist/lib/use-memo.js
20974
+ // ../../../../node_modules/@inquirer/core/dist/lib/use-memo.js
20979
20975
  function useMemo(fn, dependencies) {
20980
20976
  return withPointer((pointer) => {
20981
20977
  const prev = pointer.get();
@@ -20988,12 +20984,12 @@ function useMemo(fn, dependencies) {
20988
20984
  });
20989
20985
  }
20990
20986
 
20991
- // ../../../node_modules/@inquirer/core/dist/lib/use-ref.js
20987
+ // ../../../../node_modules/@inquirer/core/dist/lib/use-ref.js
20992
20988
  function useRef(val) {
20993
20989
  return useState({ current: val })[0];
20994
20990
  }
20995
20991
 
20996
- // ../../../node_modules/@inquirer/core/dist/lib/use-keypress.js
20992
+ // ../../../../node_modules/@inquirer/core/dist/lib/use-keypress.js
20997
20993
  function useKeypress(userHandler) {
20998
20994
  const signal = useRef(userHandler);
20999
20995
  signal.current = userHandler;
@@ -21012,10 +21008,10 @@ function useKeypress(userHandler) {
21012
21008
  }, []);
21013
21009
  }
21014
21010
 
21015
- // ../../../node_modules/@inquirer/core/dist/lib/utils.js
21011
+ // ../../../../node_modules/@inquirer/core/dist/lib/utils.js
21016
21012
  var import_cli_width = __toESM(require_cli_width(), 1);
21017
21013
 
21018
- // ../../../node_modules/fast-string-truncated-width/dist/utils.js
21014
+ // ../../../../node_modules/fast-string-truncated-width/dist/utils.js
21019
21015
  var getCodePointsLength = /* @__PURE__ */ (() => {
21020
21016
  const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
21021
21017
  return (input) => {
@@ -21034,7 +21030,7 @@ var isWideNotCJKTNotEmoji = (x) => {
21034
21030
  return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
21035
21031
  };
21036
21032
 
21037
- // ../../../node_modules/fast-string-truncated-width/dist/index.js
21033
+ // ../../../../node_modules/fast-string-truncated-width/dist/index.js
21038
21034
  var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
21039
21035
  var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
21040
21036
  var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
@@ -21132,7 +21128,7 @@ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {})
21132
21128
  };
21133
21129
  var dist_default2 = getStringTruncatedWidth;
21134
21130
 
21135
- // ../../../node_modules/fast-string-width/dist/index.js
21131
+ // ../../../../node_modules/fast-string-width/dist/index.js
21136
21132
  var NO_TRUNCATION2 = {
21137
21133
  limit: Infinity,
21138
21134
  ellipsis: "",
@@ -21143,7 +21139,7 @@ var fastStringWidth = (input, options = {}) => {
21143
21139
  };
21144
21140
  var dist_default3 = fastStringWidth;
21145
21141
 
21146
- // ../../../node_modules/fast-wrap-ansi/lib/main.js
21142
+ // ../../../../node_modules/fast-wrap-ansi/lib/main.js
21147
21143
  var ESC = "\x1B";
21148
21144
  var CSI = "\x9B";
21149
21145
  var END_CODE = 39;
@@ -21351,7 +21347,7 @@ function wrapAnsi(string4, columns, options) {
21351
21347
  return String(string4).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
21352
21348
  }
21353
21349
 
21354
- // ../../../node_modules/@inquirer/core/dist/lib/utils.js
21350
+ // ../../../../node_modules/@inquirer/core/dist/lib/utils.js
21355
21351
  function breakLines(content, width) {
21356
21352
  return content.split("\n").flatMap((line) => wrapAnsi(line, width, { trim: false, wordWrap: false }).split("\n").map((str) => str.trimEnd())).join("\n");
21357
21353
  }
@@ -21359,7 +21355,7 @@ function readlineWidth() {
21359
21355
  return (0, import_cli_width.default)({ defaultWidth: 80, output: readline().output });
21360
21356
  }
21361
21357
 
21362
- // ../../../node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
21358
+ // ../../../../node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
21363
21359
  function usePointerPosition({ active, renderedItems, pageSize, loop }) {
21364
21360
  const state2 = useRef({
21365
21361
  lastPointer: active,
@@ -21448,12 +21444,12 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
21448
21444
  return pageBuffer.filter((line) => typeof line === "string").join("\n");
21449
21445
  }
21450
21446
 
21451
- // ../../../node_modules/@inquirer/core/dist/lib/create-prompt.js
21447
+ // ../../../../node_modules/@inquirer/core/dist/lib/create-prompt.js
21452
21448
  var import_mute_stream = __toESM(require_lib(), 1);
21453
21449
  import * as readline2 from "node:readline";
21454
21450
  import { AsyncResource as AsyncResource3 } from "node:async_hooks";
21455
21451
 
21456
- // ../../../node_modules/signal-exit/dist/mjs/signals.js
21452
+ // ../../../../node_modules/signal-exit/dist/mjs/signals.js
21457
21453
  var signals = [];
21458
21454
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
21459
21455
  if (process.platform !== "win32") {
@@ -21477,7 +21473,7 @@ if (process.platform === "linux") {
21477
21473
  signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
21478
21474
  }
21479
21475
 
21480
- // ../../../node_modules/signal-exit/dist/mjs/index.js
21476
+ // ../../../../node_modules/signal-exit/dist/mjs/index.js
21481
21477
  var processOk = (process6) => !!process6 && typeof process6 === "object" && typeof process6.removeListener === "function" && typeof process6.emit === "function" && typeof process6.reallyExit === "function" && typeof process6.listeners === "function" && typeof process6.kill === "function" && typeof process6.pid === "number" && typeof process6.on === "function";
21482
21478
  var kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
21483
21479
  var global = globalThis;
@@ -21704,10 +21700,10 @@ var {
21704
21700
  unload
21705
21701
  } = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback());
21706
21702
 
21707
- // ../../../node_modules/@inquirer/core/dist/lib/screen-manager.js
21703
+ // ../../../../node_modules/@inquirer/core/dist/lib/screen-manager.js
21708
21704
  import { stripVTControlCharacters } from "node:util";
21709
21705
 
21710
- // ../../../node_modules/@inquirer/ansi/dist/index.js
21706
+ // ../../../../node_modules/@inquirer/ansi/dist/index.js
21711
21707
  var ESC2 = "\x1B[";
21712
21708
  var cursorLeft = ESC2 + "G";
21713
21709
  var cursorHide = ESC2 + "?25l";
@@ -21723,7 +21719,7 @@ var cursorTo = (x, y) => {
21723
21719
  var eraseLine = ESC2 + "2K";
21724
21720
  var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
21725
21721
 
21726
- // ../../../node_modules/@inquirer/core/dist/lib/screen-manager.js
21722
+ // ../../../../node_modules/@inquirer/core/dist/lib/screen-manager.js
21727
21723
  var height = (content) => content.split("\n").length;
21728
21724
  var lastLine = (content) => content.split("\n").pop() ?? "";
21729
21725
  var ScreenManager = class {
@@ -21784,7 +21780,7 @@ var ScreenManager = class {
21784
21780
  }
21785
21781
  };
21786
21782
 
21787
- // ../../../node_modules/@inquirer/core/dist/lib/promise-polyfill.js
21783
+ // ../../../../node_modules/@inquirer/core/dist/lib/promise-polyfill.js
21788
21784
  var PromisePolyfill = class extends Promise {
21789
21785
  // Available starting from Node 22
21790
21786
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
@@ -21799,7 +21795,7 @@ var PromisePolyfill = class extends Promise {
21799
21795
  }
21800
21796
  };
21801
21797
 
21802
- // ../../../node_modules/@inquirer/core/dist/lib/create-prompt.js
21798
+ // ../../../../node_modules/@inquirer/core/dist/lib/create-prompt.js
21803
21799
  import path from "node:path";
21804
21800
  var nativeSetImmediate = globalThis.setImmediate;
21805
21801
  function listenTo(target, event, listener) {
@@ -21917,7 +21913,7 @@ function createPrompt(view) {
21917
21913
  return prompt;
21918
21914
  }
21919
21915
 
21920
- // ../../../node_modules/@inquirer/core/dist/lib/Separator.js
21916
+ // ../../../../node_modules/@inquirer/core/dist/lib/Separator.js
21921
21917
  import { styleText as styleText2 } from "node:util";
21922
21918
  var Separator = class {
21923
21919
  separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
@@ -21932,7 +21928,7 @@ var Separator = class {
21932
21928
  }
21933
21929
  };
21934
21930
 
21935
- // ../../../node_modules/@inquirer/confirm/dist/index.js
21931
+ // ../../../../node_modules/@inquirer/confirm/dist/index.js
21936
21932
  import { styleText as styleText3 } from "node:util";
21937
21933
  var confirmTheme = {
21938
21934
  keywords: {
@@ -22000,7 +21996,7 @@ var dist_default4 = createPrompt((config2, done) => {
22000
21996
  return `${prefix} ${message}${defaultValue} ${formattedValue}`;
22001
21997
  });
22002
21998
 
22003
- // ../../../node_modules/@inquirer/input/dist/index.js
21999
+ // ../../../../node_modules/@inquirer/input/dist/index.js
22004
22000
  var inputTheme = {
22005
22001
  validationFailureMode: "keep"
22006
22002
  };
@@ -22085,7 +22081,7 @@ var dist_default5 = createPrompt((config2, done) => {
22085
22081
  ];
22086
22082
  });
22087
22083
 
22088
- // ../../../node_modules/@inquirer/select/dist/index.js
22084
+ // ../../../../node_modules/@inquirer/select/dist/index.js
22089
22085
  import { styleText as styleText4 } from "node:util";
22090
22086
  var selectTheme = {
22091
22087
  icon: { cursor: dist_default.pointer },
@@ -22257,28 +22253,116 @@ var dist_default6 = createPrompt((config2, done) => {
22257
22253
  return `${lines}${cursorHide}`;
22258
22254
  });
22259
22255
 
22260
- // dist/probe.js
22261
- import net from "node:net";
22262
- import { readFile } from "node:fs/promises";
22256
+ // dist/migrate.js
22257
+ import { existsSync } from "node:fs";
22258
+ import { mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
22263
22259
  import os from "node:os";
22264
22260
  import path2 from "node:path";
22261
+ var migrate = {
22262
+ async toLatest({ home, workDir }) {
22263
+ const done = new Set(await alreadyRan(home));
22264
+ const ran = [];
22265
+ for (const step of STEPS) {
22266
+ if (done.has(step.id))
22267
+ continue;
22268
+ if (!await step.run({ workDir }).catch(() => false))
22269
+ continue;
22270
+ done.add(step.id);
22271
+ ran.push(step.id);
22272
+ }
22273
+ if (ran.length === 0)
22274
+ return ran;
22275
+ await mkdir(home, { recursive: true, mode: 448 });
22276
+ await writeFile(path2.join(home, RAN_FILE), `${JSON.stringify({ ran: [...done] }, null, 2)}
22277
+ `, { mode: 384 });
22278
+ return ran;
22279
+ }
22280
+ };
22281
+ var STEPS = [
22282
+ {
22283
+ id: "0001-work-dir-under-org",
22284
+ async run({ workDir }) {
22285
+ if (workDir === null)
22286
+ return false;
22287
+ const flat = path2.dirname(workDir);
22288
+ const org = path2.basename(workDir);
22289
+ const staged = `${org}${MOVING}`;
22290
+ if (existsSync(path2.join(workDir, ".git")))
22291
+ await rename(workDir, path2.join(flat, staged));
22292
+ const entries = await readdir(flat, { withFileTypes: true }).catch(() => []);
22293
+ const moving = entries.filter((entry) => entry.isDirectory() && path2.join(flat, entry.name) !== workDir);
22294
+ if (moving.length === 0)
22295
+ return true;
22296
+ await mkdir(workDir, { recursive: true });
22297
+ for (const entry of moving) {
22298
+ const to = path2.join(workDir, entry.name === staged ? org : entry.name);
22299
+ await rename(path2.join(flat, entry.name), to).catch(() => void 0);
22300
+ }
22301
+ return true;
22302
+ }
22303
+ },
22304
+ {
22305
+ id: "0002-mcp-out-of-home",
22306
+ async run() {
22307
+ const target = path2.join(os.homedir(), ".mcp.json");
22308
+ const raw = await readFile(target, "utf8").catch(() => null);
22309
+ if (raw === null)
22310
+ return true;
22311
+ const parsed = JSON.parse(raw);
22312
+ const servers = parsed.mcpServers;
22313
+ if (typeof servers !== "object" || servers === null || !("craftspace" in servers))
22314
+ return true;
22315
+ delete servers.craftspace;
22316
+ const emptied = Object.keys(servers).length === 0 && Object.keys(parsed).length === 1;
22317
+ const ours = await readFile(`${target}.craftspace-backup`, "utf8").catch(() => null) === null;
22318
+ if (emptied && ours)
22319
+ await rm(target, { force: true });
22320
+ else
22321
+ await writeFile(target, `${JSON.stringify(parsed, null, 2)}
22322
+ `, { mode: 384 });
22323
+ return true;
22324
+ }
22325
+ }
22326
+ ];
22327
+ async function alreadyRan(home) {
22328
+ const raw = await readFile(path2.join(home, RAN_FILE), "utf8").catch(() => null);
22329
+ if (raw === null)
22330
+ return [];
22331
+ const parsed = RanSchema.safeParse(JSON.parse(raw));
22332
+ return parsed.success ? parsed.data.ran : [];
22333
+ }
22334
+ var RanSchema = external_exports.object({ ran: external_exports.array(external_exports.string()) });
22335
+ var RAN_FILE = "migrations.json";
22336
+ var MOVING = ".craftspace-moving";
22337
+
22338
+ // dist/probe.js
22339
+ import net from "node:net";
22340
+ import { readFile as readFile2 } from "node:fs/promises";
22341
+ import os2 from "node:os";
22342
+ import path3 from "node:path";
22265
22343
  var probe = {
22266
- async tools({ mcpPath = path2.join(os.homedir(), ".mcp.json") } = {}) {
22267
- return Promise.all([brainWired(mcpPath), sshListening()]);
22344
+ async tools({ dirs }) {
22345
+ return Promise.all([brainWired(dirs), sshListening()]);
22268
22346
  }
22269
22347
  };
22270
- async function brainWired(mcpPath) {
22271
- const raw = await readFile(mcpPath, "utf8").catch(() => null);
22348
+ async function brainWired(dirs) {
22349
+ if (dirs.length === 0) {
22350
+ return { id: "brain", ok: false, detail: "no repos cloned here yet, so there is nothing to wire it into" };
22351
+ }
22352
+ const projects = await claudeProjects();
22353
+ const unwired = dirs.filter((dir) => !("craftspace" in mcpServersIn(projects[dir])));
22354
+ return unwired.length === 0 ? { id: "brain", ok: true, detail: `wired into ${dirs.length} repo${dirs.length === 1 ? "" : "s"}` } : { id: "brain", ok: false, detail: `not wired into ${unwired.map(short).join(", ")}`.slice(0, DETAIL_MAX) };
22355
+ }
22356
+ async function claudeProjects() {
22357
+ const raw = await readFile2(path3.join(os2.homedir(), ".claude.json"), "utf8").catch(() => null);
22272
22358
  if (raw === null)
22273
- return { id: "brain", ok: false, detail: `no ${short(mcpPath)} on this machine` };
22359
+ return {};
22274
22360
  const parsed = JSON.parse(raw);
22275
- const servers = parsed?.mcpServers;
22276
- const wired = servers !== void 0 && servers !== null && "craftspace" in servers;
22277
- return {
22278
- id: "brain",
22279
- ok: wired,
22280
- detail: wired ? short(mcpPath) : `${short(mcpPath)} has no craftspace entry`
22281
- };
22361
+ return parsed.projects ?? {};
22362
+ }
22363
+ function mcpServersIn(project) {
22364
+ const servers = project?.mcpServers;
22365
+ return servers ?? {};
22282
22366
  }
22283
22367
  function sshListening() {
22284
22368
  return new Promise((resolve) => {
@@ -22294,13 +22378,14 @@ function sshListening() {
22294
22378
  });
22295
22379
  }
22296
22380
  function short(target) {
22297
- return target.startsWith(os.homedir()) ? `~${target.slice(os.homedir().length)}` : target;
22381
+ return target.startsWith(os2.homedir()) ? `~${target.slice(os2.homedir().length)}` : target;
22298
22382
  }
22299
22383
  var SSH_PROBE_TIMEOUT_MS = 1500;
22384
+ var DETAIL_MAX = 200;
22300
22385
 
22301
22386
  // dist/run.js
22302
22387
  import { spawn } from "node:child_process";
22303
- import os2 from "node:os";
22388
+ import os3 from "node:os";
22304
22389
  var runner = {
22305
22390
  attended(argv) {
22306
22391
  return new Promise((resolve) => {
@@ -22309,7 +22394,7 @@ var runner = {
22309
22394
  child.on("close", (code) => resolve(code ?? 0));
22310
22395
  });
22311
22396
  },
22312
- async unattended({ work, cwd = os2.homedir(), onProgress }) {
22397
+ async unattended({ work, cwd = os3.homedir(), onProgress }) {
22313
22398
  const argv = headlessArgv(work);
22314
22399
  const raw = argv[0] === "script";
22315
22400
  let output = "";
@@ -22437,9 +22522,9 @@ function parseJson(line) {
22437
22522
 
22438
22523
  // dist/setup.js
22439
22524
  import { execFile } from "node:child_process";
22440
- import { mkdir } from "node:fs/promises";
22441
- import os4 from "node:os";
22442
- import path3 from "node:path";
22525
+ import { mkdir as mkdir2 } from "node:fs/promises";
22526
+ import os5 from "node:os";
22527
+ import path4 from "node:path";
22443
22528
 
22444
22529
  // node_modules/chalk/source/vendor/ansi-styles/index.js
22445
22530
  var ANSI_BACKGROUND_OFFSET = 10;
@@ -22629,7 +22714,7 @@ var ansi_styles_default = ansiStyles;
22629
22714
 
22630
22715
  // node_modules/chalk/source/vendor/supports-color/index.js
22631
22716
  import process5 from "node:process";
22632
- import os3 from "node:os";
22717
+ import os4 from "node:os";
22633
22718
  import tty from "node:tty";
22634
22719
  function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process5.argv) {
22635
22720
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
@@ -22694,7 +22779,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
22694
22779
  return min;
22695
22780
  }
22696
22781
  if (process5.platform === "win32") {
22697
- const osRelease = os3.release().split(".");
22782
+ const osRelease = os4.release().split(".");
22698
22783
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
22699
22784
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
22700
22785
  }
@@ -23006,22 +23091,25 @@ var BAR_CELLS = 10;
23006
23091
  // dist/setup.js
23007
23092
  var setup = {
23008
23093
  widenPath() {
23009
- const current = (process.env.PATH ?? "").split(path3.delimiter).filter((entry) => entry !== "");
23094
+ const current = (process.env.PATH ?? "").split(path4.delimiter).filter((entry) => entry !== "");
23010
23095
  const missing = toolDirs().filter((entry) => !current.includes(entry));
23011
23096
  if (missing.length > 0)
23012
- process.env.PATH = [...current, ...missing].join(path3.delimiter);
23097
+ process.env.PATH = [...current, ...missing].join(path4.delimiter);
23098
+ },
23099
+ workDir(organization) {
23100
+ return path4.join(setup.workRoot(), toSpaceSlug(organization) || FALLBACK_ORG);
23013
23101
  },
23014
- workDir() {
23015
- return path3.join(os4.homedir(), WORK_DIR_NAME);
23102
+ workRoot() {
23103
+ return path4.join(os5.homedir(), WORK_DIR_NAME);
23016
23104
  },
23017
- async cloneRepos({ repos, say }) {
23105
+ async cloneRepos({ repos, workDir, say }) {
23018
23106
  if (repos.length === 0)
23019
23107
  return [];
23020
- await mkdir(setup.workDir(), { recursive: true });
23108
+ await mkdir2(workDir, { recursive: true });
23021
23109
  const cloned = [];
23022
23110
  for (const [index, repo] of repos.entries()) {
23023
23111
  say?.(ui.progress({ name: repo.name, done: index, total: repos.length }));
23024
- const at = path3.join(setup.workDir(), repo.name.split("/").pop() ?? repo.name);
23112
+ const at = path4.join(workDir, repo.name.split("/").pop() ?? repo.name);
23025
23113
  const outcome = await checkout(repo, at);
23026
23114
  cloned.push({ name: repo.name, ref: repo.ref, path: at, ...outcome });
23027
23115
  say?.(`${ui.clear()}${outcome.ok ? ui.ok(`${repo.name} \xB7 ${outcome.detail}`) : ui.bad(repo.name, outcome.detail)}`);
@@ -23097,15 +23185,16 @@ function lastLines(output) {
23097
23185
  function toolDirs() {
23098
23186
  const prefix = process.env.npm_config_prefix;
23099
23187
  return [
23100
- path3.dirname(process.execPath),
23101
- ...prefix === void 0 ? [] : [path3.join(prefix, "bin")],
23102
- path3.join(os4.homedir(), ".local", "bin"),
23103
- path3.join(os4.homedir(), ".npm-global", "bin"),
23188
+ path4.dirname(process.execPath),
23189
+ ...prefix === void 0 ? [] : [path4.join(prefix, "bin")],
23190
+ path4.join(os5.homedir(), ".local", "bin"),
23191
+ path4.join(os5.homedir(), ".npm-global", "bin"),
23104
23192
  "/opt/homebrew/bin",
23105
23193
  "/usr/local/bin"
23106
23194
  ];
23107
23195
  }
23108
23196
  var WORK_DIR_NAME = "craftspace";
23197
+ var FALLBACK_ORG = "team";
23109
23198
  var CLONE_DEPTH = 20;
23110
23199
  var CLONE_TIMEOUT_MS = 9e5;
23111
23200
  var STEP_TIMEOUT_MS = 6e5;
@@ -23163,7 +23252,7 @@ var INSTALL_TIMEOUT_MS = 18e4;
23163
23252
  var run2 = promisify2(execFile3);
23164
23253
  var machine = {
23165
23254
  home() {
23166
- return process.env.CRAFTSPACE_CLI_HOME ?? path4.join(os5.homedir(), ".craftspace");
23255
+ return process.env.CRAFTSPACE_CLI_HOME ?? path5.join(os6.homedir(), ".craftspace");
23167
23256
  },
23168
23257
  async login({ token, url: url2, install }) {
23169
23258
  const answer = await call({
@@ -23172,25 +23261,30 @@ var machine = {
23172
23261
  method: "POST",
23173
23262
  path: "/api/machines/login",
23174
23263
  body: {
23175
- name: os5.hostname().split(".")[0] ?? "machine",
23264
+ name: os6.hostname().split(".")[0] ?? "machine",
23176
23265
  platform: `${process.platform}-${process.arch}`,
23177
- sshUser: os5.userInfo().username,
23178
- cores: os5.cpus().length,
23179
- memoryGb: Math.max(1, Math.round(os5.totalmem() / 1024 ** 3)),
23266
+ sshUser: os6.userInfo().username,
23267
+ cores: os6.cpus().length,
23268
+ memoryGb: Math.max(1, Math.round(os6.totalmem() / 1024 ** 3)),
23180
23269
  cli: CLI_VERSION,
23181
23270
  publicKey: await ensureKey()
23182
23271
  },
23183
23272
  schema: MachineLoginResponseSchema
23184
23273
  });
23185
- await mkdir2(machine.home(), { recursive: true, mode: 448 });
23186
- await writeFile(configPath(), JSON.stringify({ url: url2, machineId: answer.machine.id }, null, 2), { mode: 384 });
23187
- await writeFile(tokenPath(), token, { mode: 384 });
23188
- await writeAgentConfigs({ url: url2, token, writes: answer.write });
23274
+ await mkdir3(machine.home(), { recursive: true, mode: 448 });
23275
+ await writeConfig({ url: url2, machineId: answer.machine.id, organization: toSpaceSlug(answer.organizationName) });
23276
+ await writeFile2(tokenPath(), token, { mode: 384 });
23277
+ await writeAgentConfigs({ writes: answer.write });
23278
+ await wireRepos({ url: url2, token, dirs: clonedDirs(await readEnvironment()) });
23189
23279
  await installService();
23190
23280
  if (install)
23191
23281
  await machine.beatOnce(ui.say);
23192
23282
  return answer.machine;
23193
23283
  },
23284
+ async workDir() {
23285
+ const organization = (await readConfig())?.organization;
23286
+ return organization === void 0 ? null : setup.workDir(organization);
23287
+ },
23194
23288
  async controlPlane(override) {
23195
23289
  const where = override ?? process.env.CRAFTSPACE_URL ?? (await readConfig())?.url ?? DEFAULT_URL;
23196
23290
  return where.replace(/\/$/, "");
@@ -23226,7 +23320,7 @@ ${ui.ok(`Signed in as ${signed.ownerName}. This machine is ${ui.name(signed.name
23226
23320
  return { machine: found.value, url: found.auth.url };
23227
23321
  },
23228
23322
  async beatOnce(say) {
23229
- const { url: url2, token } = await requireSignedIn();
23323
+ const { url: url2, token, organization } = await requireSignedIn();
23230
23324
  const built = await readEnvironment();
23231
23325
  const answer = await call({
23232
23326
  url: url2,
@@ -23241,16 +23335,20 @@ ${ui.ok(`Signed in as ${signed.ownerName}. This machine is ${ui.name(signed.name
23241
23335
  tools: await checks(),
23242
23336
  environment: built?.results ?? [],
23243
23337
  templateId: built?.templateId ?? null,
23244
- workDir: setup.workDir(),
23338
+ ...organization === void 0 ? {} : { workDir: setup.workDir(organization) },
23245
23339
  repos: built?.repos ?? [],
23246
- sshUser: os5.userInfo().username
23340
+ sshUser: os6.userInfo().username
23247
23341
  },
23248
23342
  schema: MachineBeatResponseSchema
23249
23343
  });
23250
23344
  if (answer.cli !== null && isNewer(answer.cli.version))
23251
23345
  updateWanted = answer.cli.version;
23346
+ const workDir = setup.workDir(answer.organization);
23347
+ if (answer.organization !== organization)
23348
+ await writeConfig({ organization: answer.organization });
23349
+ await migrate.toLatest({ home: machine.home(), workDir }).catch(() => []);
23252
23350
  await writeAuthorizedKeys(answer.authorizedKeys);
23253
- const building2 = buildEnvironment(answer.environment, say);
23351
+ const building2 = buildEnvironment({ next: answer.environment, workDir, say });
23254
23352
  if (say === void 0)
23255
23353
  void building2.catch(() => void 0);
23256
23354
  else
@@ -23316,7 +23414,7 @@ ${ui.ok(`Signed in as ${signed.ownerName}. This machine is ${ui.name(signed.name
23316
23414
  }
23317
23415
  await removeAgentConfigs();
23318
23416
  await uninstallService();
23319
- await rm(machine.home(), { recursive: true, force: true });
23417
+ await rm2(machine.home(), { recursive: true, force: true });
23320
23418
  }
23321
23419
  };
23322
23420
  async function requireSignedIn() {
@@ -23324,7 +23422,7 @@ async function requireSignedIn() {
23324
23422
  const token = await readToken();
23325
23423
  if (!config2 || !token)
23326
23424
  throw new Error("This machine is not signed in. Run: cs login --token <token>");
23327
- return { url: config2.url, token };
23425
+ return { url: config2.url, token, ...spreadIfDefined({ organization: config2.organization }) };
23328
23426
  }
23329
23427
  async function pick2(machines) {
23330
23428
  return dist_default6({
@@ -23387,18 +23485,19 @@ ${ui.attention("No workstations here yet.")}
23387
23485
  async function checks() {
23388
23486
  if (probed !== null && Date.now() - probed.at < PROBE_EVERY_MS)
23389
23487
  return probed.tools;
23390
- const first = await probe.tools();
23488
+ const dirs = clonedDirs(await readEnvironment());
23489
+ const first = await probe.tools({ dirs });
23391
23490
  const unwired = first.some((tool) => tool.id === "brain" && !tool.ok);
23392
- const found = unwired && installs() ? await rewire().then(() => probe.tools(), () => first) : first;
23491
+ const found = unwired && installs() && dirs.length > 0 ? await rewire(dirs).then(() => probe.tools({ dirs }), () => first) : first;
23393
23492
  probed = { at: Date.now(), tools: found };
23394
23493
  return found;
23395
23494
  }
23396
- async function buildEnvironment(next, say) {
23495
+ async function buildEnvironment({ next, workDir, say }) {
23397
23496
  if (building || !installs() || next.templateId === null)
23398
23497
  return;
23399
23498
  const built = await readEnvironment();
23400
23499
  const buildsSteps = buildIsDue(built, next.templateId);
23401
- const clonesRepos = cloneIsDue(built, next.repos);
23500
+ const clonesRepos = cloneIsDue({ built, wanted: next.repos, workDir });
23402
23501
  if (!buildsSteps && !clonesRepos)
23403
23502
  return;
23404
23503
  building = true;
@@ -23410,26 +23509,31 @@ async function buildEnvironment(next, say) {
23410
23509
  results = await setup.runSteps({ steps: next.steps, say });
23411
23510
  }
23412
23511
  if (clonesRepos) {
23413
- say?.(ui.heading(`Cloning the ${next.repos.length} repos your team works in, into ${setup.workDir()}`));
23414
- repos = await setup.cloneRepos({ repos: next.repos, say });
23415
- await acceptClaudeGates(["craftspace"], repos.filter((repo) => repo.ok).map((repo) => repo.path));
23512
+ say?.(ui.heading(`Cloning the ${next.repos.length} repos your team works in, into ${workDir}`));
23513
+ repos = await setup.cloneRepos({ repos: next.repos, workDir, say });
23514
+ await rewire(repos.filter((repo) => repo.ok).map((repo) => repo.path));
23416
23515
  }
23417
23516
  await writeEnvironment({ templateId: next.templateId, results, repos, at: Date.now() });
23418
23517
  } finally {
23419
23518
  building = false;
23420
23519
  }
23421
23520
  }
23422
- function cloneIsDue(built, wanted) {
23521
+ function cloneIsDue({ built, wanted, workDir }) {
23423
23522
  const cloned = built?.repos ?? [];
23424
23523
  if (wanted.length === 0 && cloned.length === 0)
23425
23524
  return false;
23426
23525
  if (wanted.length !== cloned.length)
23427
23526
  return true;
23428
- const missing = wanted.some((repo) => !cloned.some((seen) => seen.name === repo.name && seen.ref === repo.ref && seen.ok));
23527
+ const missing = wanted.some((repo) => !cloned.some((seen) => isCloned({ seen, repo, workDir })));
23429
23528
  return missing || Date.now() - (built?.at ?? 0) > REBUILD_AFTER_MS;
23430
23529
  }
23530
+ function isCloned({ seen, repo, workDir }) {
23531
+ if (seen.name !== repo.name || seen.ref !== repo.ref || !seen.ok)
23532
+ return false;
23533
+ return path5.dirname(seen.path) === workDir && existsSync2(seen.path);
23534
+ }
23431
23535
  function startIn(built) {
23432
- return built?.repos.find((repo) => repo.ok)?.path ?? os5.homedir();
23536
+ return built?.repos.find((repo) => repo.ok)?.path ?? os6.homedir();
23433
23537
  }
23434
23538
  function buildIsDue(built, templateId) {
23435
23539
  if (built === null || built.templateId !== templateId)
@@ -23439,22 +23543,25 @@ function buildIsDue(built, templateId) {
23439
23543
  return Date.now() - built.at > REBUILD_AFTER_MS;
23440
23544
  }
23441
23545
  async function readEnvironment() {
23442
- const raw = await readFile2(environmentPath(), "utf8").catch(() => null);
23546
+ const raw = await readFile3(environmentPath(), "utf8").catch(() => null);
23443
23547
  if (raw === null)
23444
23548
  return null;
23445
23549
  const parsed = BuiltSchema.safeParse(JSON.parse(raw));
23446
23550
  return parsed.success ? parsed.data : null;
23447
23551
  }
23448
23552
  async function writeEnvironment(built) {
23449
- await mkdir2(machine.home(), { recursive: true, mode: 448 });
23450
- await writeFile(environmentPath(), JSON.stringify(built, null, 2), { mode: 384 });
23553
+ await mkdir3(machine.home(), { recursive: true, mode: 448 });
23554
+ await writeFile2(environmentPath(), JSON.stringify(built, null, 2), { mode: 384 });
23451
23555
  }
23452
23556
  function installs() {
23453
23557
  return process.env.CRAFTSPACE_NO_INSTALL !== "1";
23454
23558
  }
23455
- async function rewire() {
23559
+ async function rewire(dirs) {
23456
23560
  const { url: url2, token } = await requireSignedIn();
23457
- await writeAgentConfigs({ url: url2, token, writes: [] });
23561
+ await wireRepos({ url: url2, token, dirs });
23562
+ }
23563
+ function clonedDirs(built) {
23564
+ return (built?.repos ?? []).filter((repo) => repo.ok).map((repo) => repo.path);
23458
23565
  }
23459
23566
  function report(next) {
23460
23567
  reports.set(next.id, next);
@@ -23518,31 +23625,37 @@ function tokenIn(line) {
23518
23625
  return /cst_[A-Za-z0-9_-]+/.exec(line)?.[0];
23519
23626
  }
23520
23627
  async function ensureKey() {
23521
- const priv = path4.join(machine.home(), "id_ed25519");
23628
+ const priv = path5.join(machine.home(), "id_ed25519");
23522
23629
  const pub = `${priv}.pub`;
23523
- const existing = await readFile2(pub, "utf8").catch(() => null);
23630
+ const existing = await readFile3(pub, "utf8").catch(() => null);
23524
23631
  if (existing !== null)
23525
23632
  return existing.trim();
23526
- await mkdir2(machine.home(), { recursive: true, mode: 448 });
23527
- await run2("ssh-keygen", ["-t", "ed25519", "-N", "", "-q", "-f", priv, "-C", `craftspace-${os5.hostname()}`]);
23528
- return (await readFile2(pub, "utf8")).trim();
23633
+ await mkdir3(machine.home(), { recursive: true, mode: 448 });
23634
+ await run2("ssh-keygen", ["-t", "ed25519", "-N", "", "-q", "-f", priv, "-C", `craftspace-${os6.hostname()}`]);
23635
+ return (await readFile3(pub, "utf8")).trim();
23636
+ }
23637
+ async function writeConfig(next) {
23638
+ const merged = { ...await readConfig(), ...next };
23639
+ await mkdir3(machine.home(), { recursive: true, mode: 448 });
23640
+ await writeFile2(configPath(), `${JSON.stringify(merged, null, 2)}
23641
+ `, { mode: 384 });
23529
23642
  }
23530
23643
  async function readConfig() {
23531
- const raw = await readFile2(configPath(), "utf8").catch(() => null);
23644
+ const raw = await readFile3(configPath(), "utf8").catch(() => null);
23532
23645
  if (raw === null)
23533
23646
  return null;
23534
23647
  return ConfigSchema.parse(JSON.parse(raw));
23535
23648
  }
23536
23649
  async function readToken() {
23537
- const raw = await readFile2(tokenPath(), "utf8").catch(() => null);
23650
+ const raw = await readFile3(tokenPath(), "utf8").catch(() => null);
23538
23651
  return raw === null ? null : raw.trim();
23539
23652
  }
23540
23653
  async function readSessions() {
23541
- const dir = path4.join(machine.home(), "sessions");
23542
- const names = await readdir(dir).catch(() => []);
23654
+ const dir = path5.join(machine.home(), "sessions");
23655
+ const names = await readdir2(dir).catch(() => []);
23543
23656
  const sessions = [];
23544
23657
  for (const name of names.filter((entry) => entry.endsWith(".json"))) {
23545
- const raw = await readFile2(path4.join(dir, name), "utf8").catch(() => null);
23658
+ const raw = await readFile3(path5.join(dir, name), "utf8").catch(() => null);
23546
23659
  if (raw === null)
23547
23660
  continue;
23548
23661
  const parsed = MachineSessionSchema.safeParse(JSON.parse(raw));
@@ -23552,8 +23665,8 @@ async function readSessions() {
23552
23665
  return sessions.slice(0, MAX_REPORTED_SESSIONS);
23553
23666
  }
23554
23667
  async function writeAuthorizedKeys(keys) {
23555
- const target = path4.join(os5.homedir(), ".ssh", "authorized_keys");
23556
- const current = await readFile2(target, "utf8").catch(() => "");
23668
+ const target = path5.join(os6.homedir(), ".ssh", "authorized_keys");
23669
+ const current = await readFile3(target, "utf8").catch(() => "");
23557
23670
  const before = current.split(KEYS_BEGIN)[0] ?? "";
23558
23671
  const after = current.includes(KEYS_END) ? current.split(KEYS_END)[1] ?? "" : "";
23559
23672
  const block = keys.length === 0 ? "" : `${KEYS_BEGIN}
@@ -23563,59 +23676,70 @@ ${KEYS_END}
23563
23676
  const next = `${trimEnd(before)}${trimEnd(before) === "" ? "" : "\n"}${block}${after.replace(/^\n/, "")}`;
23564
23677
  if (next === current)
23565
23678
  return;
23566
- await mkdir2(path4.dirname(target), { recursive: true, mode: 448 });
23567
- await writeFile(target, next, { mode: 384 });
23679
+ await mkdir3(path5.dirname(target), { recursive: true, mode: 448 });
23680
+ await writeFile2(target, next, { mode: 384 });
23568
23681
  }
23569
23682
  function trimEnd(text) {
23570
23683
  return text.replace(/\s+$/, "");
23571
23684
  }
23572
- async function writeAgentConfigs({ url: url2, token, writes }) {
23573
- const planned = writes.length > 0 ? writes : defaultWrites({ url: url2, token });
23574
- const owned = [];
23575
- for (const write of planned) {
23685
+ async function wireRepos({ url: url2, token, dirs }) {
23686
+ if (dirs.length === 0)
23687
+ return;
23688
+ const server = { type: "http", url: `${url2}/mcp`, headers: { Authorization: `Bearer ${token}` } };
23689
+ await editClaudeConfig((projects) => {
23690
+ for (const dir of dirs) {
23691
+ const here2 = isPlainObject3(projects[dir]) ? { ...projects[dir] } : {};
23692
+ const servers = isPlainObject3(here2.mcpServers) ? { ...here2.mcpServers } : {};
23693
+ projects[dir] = { ...here2, hasTrustDialogAccepted: true, mcpServers: { ...servers, craftspace: server } };
23694
+ }
23695
+ });
23696
+ }
23697
+ async function unwireRepos() {
23698
+ await editClaudeConfig((projects) => {
23699
+ for (const [dir, found] of Object.entries(projects)) {
23700
+ if (!isPlainObject3(found) || !isPlainObject3(found.mcpServers))
23701
+ continue;
23702
+ const servers = { ...found.mcpServers };
23703
+ delete servers.craftspace;
23704
+ projects[dir] = { ...found, mcpServers: servers };
23705
+ }
23706
+ });
23707
+ }
23708
+ async function editClaudeConfig(edit) {
23709
+ const target = path5.join(os6.homedir(), CLAUDE_FILE);
23710
+ const raw = await readFile3(target, "utf8").catch(() => null);
23711
+ const parsed = raw === null ? {} : JSON.parse(raw);
23712
+ const projects = isPlainObject3(parsed.projects) ? { ...parsed.projects } : {};
23713
+ const before = JSON.stringify(projects);
23714
+ edit(projects);
23715
+ if (JSON.stringify(projects) === before)
23716
+ return;
23717
+ await writeFile2(target, `${JSON.stringify({ ...parsed, projects }, null, 2)}
23718
+ `, { mode: 384 });
23719
+ }
23720
+ async function writeAgentConfigs({ writes }) {
23721
+ if (writes.length === 0)
23722
+ return;
23723
+ const owned = [...await readOwned()];
23724
+ for (const write of writes) {
23576
23725
  const target = expand(write.path);
23577
- await mkdir2(path4.dirname(target), { recursive: true });
23578
- const current = await readFile2(target, "utf8").catch(() => null);
23726
+ await mkdir3(path5.dirname(target), { recursive: true });
23727
+ const current = await readFile3(target, "utf8").catch(() => null);
23579
23728
  if (current !== null)
23580
- await writeFile(`${target}.craftspace-backup`, current, { flag: "wx" }).catch(() => void 0);
23729
+ await writeFile2(`${target}.craftspace-backup`, current, { flag: "wx" }).catch(() => void 0);
23581
23730
  const merged = mergeInto(current === null ? {} : JSON.parse(current), write.contents);
23582
- await writeFile(target, `${JSON.stringify(merged, null, 2)}
23731
+ await writeFile2(target, `${JSON.stringify(merged, null, 2)}
23583
23732
  `, { mode: 384 });
23584
23733
  owned.push(target);
23585
23734
  }
23586
- await writeFile(ownedPath(), JSON.stringify({ paths: owned }, null, 2));
23587
- await acceptClaudeGates(serversIn(planned));
23588
- }
23589
- function serversIn(writes) {
23590
- return writes.flatMap((write) => isPlainObject3(write.contents.mcpServers) ? Object.keys(write.contents.mcpServers) : []);
23735
+ await writeFile2(ownedPath(), JSON.stringify({ paths: [...new Set(owned)] }, null, 2));
23591
23736
  }
23592
- async function acceptClaudeGates(servers, dirs = [os5.homedir()]) {
23593
- const target = path4.join(os5.homedir(), ".claude.json");
23594
- const raw = await readFile2(target, "utf8").catch(() => null);
23737
+ async function readOwned() {
23738
+ const raw = await readFile3(ownedPath(), "utf8").catch(() => null);
23595
23739
  if (raw === null)
23596
- return;
23597
- const parsed = JSON.parse(raw);
23598
- const projects = isPlainObject3(parsed.projects) ? parsed.projects : {};
23599
- const opened = { ...projects };
23600
- let moved = false;
23601
- for (const dir of dirs) {
23602
- const found = opened[dir];
23603
- const here2 = isPlainObject3(found) ? { ...found } : {};
23604
- const enabled = /* @__PURE__ */ new Set([...asArray(here2.enabledMcpjsonServers), ...servers]);
23605
- if (here2.hasTrustDialogAccepted === true && enabled.size === asArray(here2.enabledMcpjsonServers).length)
23606
- continue;
23607
- here2.hasTrustDialogAccepted = true;
23608
- here2.enabledMcpjsonServers = [...enabled];
23609
- opened[dir] = here2;
23610
- moved = true;
23611
- }
23612
- if (!moved)
23613
- return;
23614
- await writeFile(target, `${JSON.stringify({ ...parsed, projects: opened }, null, 2)}
23615
- `, { mode: 384 });
23616
- }
23617
- function asArray(value) {
23618
- return Array.isArray(value) ? value : [];
23740
+ return [];
23741
+ const parsed = OwnedSchema.safeParse(JSON.parse(raw));
23742
+ return parsed.success ? parsed.data.paths : [];
23619
23743
  }
23620
23744
  function mergeInto(current, incoming) {
23621
23745
  const merged = { ...current };
@@ -23628,17 +23752,10 @@ function mergeInto(current, incoming) {
23628
23752
  function isPlainObject3(value) {
23629
23753
  return typeof value === "object" && value !== null && !Array.isArray(value);
23630
23754
  }
23631
- function defaultWrites({ url: url2, token }) {
23632
- const server = { craftspace: { type: "http", url: `${url2}/mcp`, headers: { Authorization: `Bearer ${token}` } } };
23633
- return [{ path: "~/.mcp.json", contents: { mcpServers: server } }];
23634
- }
23635
23755
  async function removeAgentConfigs() {
23636
- const raw = await readFile2(ownedPath(), "utf8").catch(() => null);
23637
- if (raw === null)
23638
- return;
23639
- const owned = OwnedSchema.parse(JSON.parse(raw));
23640
- for (const target of owned.paths) {
23641
- const current = await readFile2(target, "utf8").catch(() => null);
23756
+ await unwireRepos();
23757
+ for (const target of await readOwned()) {
23758
+ const current = await readFile3(target, "utf8").catch(() => null);
23642
23759
  if (current === null)
23643
23760
  continue;
23644
23761
  const parsed = JSON.parse(current);
@@ -23646,34 +23763,34 @@ async function removeAgentConfigs() {
23646
23763
  if (isPlainObject3(servers))
23647
23764
  delete servers.craftspace;
23648
23765
  if (await weCreated(target)) {
23649
- await rm(target, { force: true });
23766
+ await rm2(target, { force: true });
23650
23767
  continue;
23651
23768
  }
23652
- await writeFile(target, `${JSON.stringify(parsed, null, 2)}
23769
+ await writeFile2(target, `${JSON.stringify(parsed, null, 2)}
23653
23770
  `);
23654
23771
  }
23655
23772
  }
23656
23773
  async function weCreated(target) {
23657
- const backup = await readFile2(`${target}.craftspace-backup`, "utf8").catch(() => null);
23774
+ const backup = await readFile3(`${target}.craftspace-backup`, "utf8").catch(() => null);
23658
23775
  return backup === null;
23659
23776
  }
23660
23777
  async function installService() {
23661
23778
  if (process.env.CRAFTSPACE_NO_SERVICE === "1")
23662
23779
  return;
23663
23780
  if (process.platform === "linux") {
23664
- const dir = path4.join(os5.homedir(), ".config", "systemd", "user");
23665
- await mkdir2(dir, { recursive: true });
23666
- await writeFile(path4.join(dir, `${SERVICE_NAME}.service`), systemdUnit());
23667
- await run2("loginctl", ["enable-linger", os5.userInfo().username]).catch(() => void 0);
23781
+ const dir = path5.join(os6.homedir(), ".config", "systemd", "user");
23782
+ await mkdir3(dir, { recursive: true });
23783
+ await writeFile2(path5.join(dir, `${SERVICE_NAME}.service`), systemdUnit());
23784
+ await run2("loginctl", ["enable-linger", os6.userInfo().username]).catch(() => void 0);
23668
23785
  await run2("systemctl", ["--user", "daemon-reload"]).catch(() => void 0);
23669
23786
  await run2("systemctl", ["--user", "enable", SERVICE_NAME]).catch(() => void 0);
23670
23787
  await run2("systemctl", ["--user", "restart", SERVICE_NAME]).catch(() => void 0);
23671
23788
  return;
23672
23789
  }
23673
23790
  if (process.platform === "darwin") {
23674
- const target = path4.join(os5.homedir(), "Library", "LaunchAgents", `${LAUNCH_LABEL}.plist`);
23675
- await mkdir2(path4.dirname(target), { recursive: true });
23676
- await writeFile(target, launchdPlist());
23791
+ const target = path5.join(os6.homedir(), "Library", "LaunchAgents", `${LAUNCH_LABEL}.plist`);
23792
+ await mkdir3(path5.dirname(target), { recursive: true });
23793
+ await writeFile2(target, launchdPlist());
23677
23794
  await run2("launchctl", ["unload", target]).catch(() => void 0);
23678
23795
  await run2("launchctl", ["load", target]).catch(() => void 0);
23679
23796
  }
@@ -23681,13 +23798,13 @@ async function installService() {
23681
23798
  async function uninstallService() {
23682
23799
  if (process.platform === "linux") {
23683
23800
  await run2("systemctl", ["--user", "disable", "--now", SERVICE_NAME]).catch(() => void 0);
23684
- await rm(path4.join(os5.homedir(), ".config", "systemd", "user", `${SERVICE_NAME}.service`), { force: true });
23801
+ await rm2(path5.join(os6.homedir(), ".config", "systemd", "user", `${SERVICE_NAME}.service`), { force: true });
23685
23802
  return;
23686
23803
  }
23687
23804
  if (process.platform === "darwin") {
23688
- const target = path4.join(os5.homedir(), "Library", "LaunchAgents", `${LAUNCH_LABEL}.plist`);
23805
+ const target = path5.join(os6.homedir(), "Library", "LaunchAgents", `${LAUNCH_LABEL}.plist`);
23689
23806
  await run2("launchctl", ["unload", target]).catch(() => void 0);
23690
- await rm(target, { force: true });
23807
+ await rm2(target, { force: true });
23691
23808
  }
23692
23809
  }
23693
23810
  function systemdUnit() {
@@ -23726,31 +23843,31 @@ async function serviceRunning() {
23726
23843
  return await run2("systemctl", ["--user", "is-active", SERVICE_NAME]).catch(() => null) !== null;
23727
23844
  }
23728
23845
  async function userLingers() {
23729
- const shown = await run2("loginctl", ["show-user", os5.userInfo().username, "-p", "Linger"]).catch(() => null);
23846
+ const shown = await run2("loginctl", ["show-user", os6.userInfo().username, "-p", "Linger"]).catch(() => null);
23730
23847
  return shown?.stdout.includes("Linger=yes") === true;
23731
23848
  }
23732
23849
  function entryPath() {
23733
- return path4.join(path4.dirname(new URL(import.meta.url).pathname), "index.js");
23850
+ return path5.join(path5.dirname(new URL(import.meta.url).pathname), "index.js");
23734
23851
  }
23735
23852
  function expand(target) {
23736
- return target.startsWith("~/") ? path4.join(os5.homedir(), target.slice(2)) : target;
23853
+ return target.startsWith("~/") ? path5.join(os6.homedir(), target.slice(2)) : target;
23737
23854
  }
23738
23855
  function configPath() {
23739
- return path4.join(machine.home(), "config.json");
23856
+ return path5.join(machine.home(), "config.json");
23740
23857
  }
23741
23858
  function tokenPath() {
23742
- return path4.join(machine.home(), "token");
23859
+ return path5.join(machine.home(), "token");
23743
23860
  }
23744
23861
  function ownedPath() {
23745
- return path4.join(machine.home(), "owned.json");
23862
+ return path5.join(machine.home(), "owned.json");
23746
23863
  }
23747
23864
  function environmentPath() {
23748
- return path4.join(machine.home(), "environment.json");
23865
+ return path5.join(machine.home(), "environment.json");
23749
23866
  }
23750
23867
  function load2() {
23751
- const cores = Math.max(1, os5.cpus().length);
23752
- const busy = Math.min(100, (os5.loadavg()[0] ?? 0) / cores * 100);
23753
- const used = (os5.totalmem() - os5.freemem()) / os5.totalmem() * 100;
23868
+ const cores = Math.max(1, os6.cpus().length);
23869
+ const busy = Math.min(100, (os6.loadavg()[0] ?? 0) / cores * 100);
23870
+ const used = (os6.totalmem() - os6.freemem()) / os6.totalmem() * 100;
23754
23871
  return { cpuPercent: Math.round(busy), memoryPercent: Math.round(used) };
23755
23872
  }
23756
23873
  function nextDelayMs(failures, busy = false) {
@@ -23764,7 +23881,7 @@ function nextDelayMs(failures, busy = false) {
23764
23881
  function messageOf(error51) {
23765
23882
  return error51 instanceof Error ? error51.message : String(error51);
23766
23883
  }
23767
- var ConfigSchema = external_exports.object({ url: external_exports.string(), machineId: external_exports.string() });
23884
+ var ConfigSchema = external_exports.object({ url: external_exports.string(), machineId: external_exports.string(), organization: external_exports.string().optional() });
23768
23885
  var BuiltSchema = external_exports.object({
23769
23886
  templateId: external_exports.string(),
23770
23887
  results: external_exports.array(WorkstationStepResultSchema),
@@ -23772,6 +23889,7 @@ var BuiltSchema = external_exports.object({
23772
23889
  at: external_exports.number()
23773
23890
  });
23774
23891
  var OwnedSchema = external_exports.object({ paths: external_exports.array(external_exports.string()) });
23892
+ var CLAUDE_FILE = ".claude.json";
23775
23893
  var SERVICE_NAME = "craftspace";
23776
23894
  var LAUNCH_LABEL = "app.craftspace.machine";
23777
23895
  var REQUEST_TIMEOUT_MS2 = 15e3;
@@ -23797,7 +23915,7 @@ var PORTABLE_TERMS = /* @__PURE__ */ new Set([
23797
23915
  "xterm-color",
23798
23916
  "xterm-256color"
23799
23917
  ]);
23800
- var LINGER_LINE = `sudo loginctl enable-linger ${os5.userInfo().username}`;
23918
+ var LINGER_LINE = `sudo loginctl enable-linger ${os6.userInfo().username}`;
23801
23919
  var DEFAULT_URL = process.env.CRAFTSPACE_URL ?? "https://craftspace.app";
23802
23920
  var PROBE_EVERY_MS = 3e5;
23803
23921
  var REBUILD_AFTER_MS = 216e5;
@@ -23817,7 +23935,9 @@ program2.command("login").description("sign this machine in").option("--token <t
23817
23935
  const daemon = await machine.daemon();
23818
23936
  ui.say(ui.heading(`Signed in as ${signed.ownerName}`));
23819
23937
  ui.say(ui.field("Machine", `${ui.name(signed.name)} ${ui.dim(machineSpecs(signed))}`));
23820
- ui.say(ui.field("MCP wired", "~/.mcp.json"));
23938
+ const workDir = await machine.workDir();
23939
+ ui.say(ui.field("Work dir", workDir === null ? "set on the first beat" : workDir));
23940
+ ui.say(ui.field("MCP wired", "into every repo cloned there, for Claude Code"));
23821
23941
  ui.say(ui.field("Daemon", daemon.ok ? daemon.text : ui.attention(daemon.text)));
23822
23942
  ui.say(`
23823
23943
  ${ui.note(`Listed at ${ui.link(`${where}/workstations`)}`)}