wildcrane-runner 0.6.115 → 0.6.116

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.97 — built by runner/scripts/build.mjs. Do not edit.
2
+ // ai4kanban 0.11.98 — built by runner/scripts/build.mjs. Do not edit.
3
3
  import { createRequire as __ai4kanbanRequire } from 'node:module'
4
4
  const require = __ai4kanbanRequire(import.meta.url)
5
5
  var __create = Object.create;
@@ -10323,7 +10323,7 @@ var require_Scalar = __commonJS({
10323
10323
  var Node = require_Node();
10324
10324
  var toJS = require_toJS();
10325
10325
  var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
10326
- var Scalar = class extends Node.NodeBase {
10326
+ var Scalar2 = class extends Node.NodeBase {
10327
10327
  constructor(value) {
10328
10328
  super(identity.SCALAR);
10329
10329
  this.value = value;
@@ -10335,12 +10335,12 @@ var require_Scalar = __commonJS({
10335
10335
  return String(this.value);
10336
10336
  }
10337
10337
  };
10338
- Scalar.BLOCK_FOLDED = "BLOCK_FOLDED";
10339
- Scalar.BLOCK_LITERAL = "BLOCK_LITERAL";
10340
- Scalar.PLAIN = "PLAIN";
10341
- Scalar.QUOTE_DOUBLE = "QUOTE_DOUBLE";
10342
- Scalar.QUOTE_SINGLE = "QUOTE_SINGLE";
10343
- exports.Scalar = Scalar;
10338
+ Scalar2.BLOCK_FOLDED = "BLOCK_FOLDED";
10339
+ Scalar2.BLOCK_LITERAL = "BLOCK_LITERAL";
10340
+ Scalar2.PLAIN = "PLAIN";
10341
+ Scalar2.QUOTE_DOUBLE = "QUOTE_DOUBLE";
10342
+ Scalar2.QUOTE_SINGLE = "QUOTE_SINGLE";
10343
+ exports.Scalar = Scalar2;
10344
10344
  exports.isScalarValue = isScalarValue;
10345
10345
  }
10346
10346
  });
@@ -10351,7 +10351,7 @@ var require_createNode = __commonJS({
10351
10351
  "use strict";
10352
10352
  var Alias = require_Alias();
10353
10353
  var identity = require_identity();
10354
- var Scalar = require_Scalar();
10354
+ var Scalar2 = require_Scalar();
10355
10355
  var defaultTagPrefix = "tag:yaml.org,2002:";
10356
10356
  function findTagObject(value, tagName, tags) {
10357
10357
  if (tagName) {
@@ -10396,7 +10396,7 @@ var require_createNode = __commonJS({
10396
10396
  value = value.toJSON();
10397
10397
  }
10398
10398
  if (!value || typeof value !== "object") {
10399
- const node3 = new Scalar.Scalar(value);
10399
+ const node3 = new Scalar2.Scalar(value);
10400
10400
  if (ref)
10401
10401
  ref.node = node3;
10402
10402
  return node3;
@@ -10407,7 +10407,7 @@ var require_createNode = __commonJS({
10407
10407
  onTagObj(tagObj);
10408
10408
  delete ctx.onTagObj;
10409
10409
  }
10410
- const node2 = tagObj?.createNode ? tagObj.createNode(ctx.schema, value, ctx) : typeof tagObj?.nodeClass?.from === "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new Scalar.Scalar(value);
10410
+ const node2 = tagObj?.createNode ? tagObj.createNode(ctx.schema, value, ctx) : typeof tagObj?.nodeClass?.from === "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new Scalar2.Scalar(value);
10411
10411
  if (tagName)
10412
10412
  node2.tag = tagName;
10413
10413
  else if (!tagObj.default)
@@ -10720,7 +10720,7 @@ ${indent2}${text4.slice(fold + 1, end3)}`;
10720
10720
  var require_stringifyString = __commonJS({
10721
10721
  "../cli/node_modules/yaml/dist/stringify/stringifyString.js"(exports) {
10722
10722
  "use strict";
10723
- var Scalar = require_Scalar();
10723
+ var Scalar2 = require_Scalar();
10724
10724
  var foldFlowLines = require_foldFlowLines();
10725
10725
  var getFoldOptions = (ctx, isBlock) => ({
10726
10726
  indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
@@ -10863,7 +10863,7 @@ ${indent2}`) + "'";
10863
10863
  return quotedString(value, ctx);
10864
10864
  }
10865
10865
  const indent2 = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? " " : "");
10866
- const literal2 = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar.Scalar.BLOCK_FOLDED ? false : type === Scalar.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, lineWidth, indent2.length);
10866
+ const literal2 = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar2.Scalar.BLOCK_FOLDED ? false : type === Scalar2.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, lineWidth, indent2.length);
10867
10867
  if (!value)
10868
10868
  return literal2 ? "|\n" : ">\n";
10869
10869
  let chomp;
@@ -10918,7 +10918,7 @@ ${indent2}`) + "'";
10918
10918
  const foldedValue = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent2}`);
10919
10919
  let literalFallback = false;
10920
10920
  const foldOptions = getFoldOptions(ctx, true);
10921
- if (blockQuote !== "folded" && type !== Scalar.Scalar.BLOCK_FOLDED) {
10921
+ if (blockQuote !== "folded" && type !== Scalar2.Scalar.BLOCK_FOLDED) {
10922
10922
  foldOptions.onOverflow = () => {
10923
10923
  literalFallback = true;
10924
10924
  };
@@ -10941,7 +10941,7 @@ ${indent2}${start}${value}${end2}`;
10941
10941
  if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
10942
10942
  return implicitKey || inFlow || !value.includes("\n") ? quotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
10943
10943
  }
10944
- if (!implicitKey && !inFlow && type !== Scalar.Scalar.PLAIN && value.includes("\n")) {
10944
+ if (!implicitKey && !inFlow && type !== Scalar2.Scalar.PLAIN && value.includes("\n")) {
10945
10945
  return blockString(item, ctx, onComment, onChompKeep);
10946
10946
  }
10947
10947
  if (containsDocumentMarker(value)) {
@@ -10966,20 +10966,20 @@ ${indent2}`);
10966
10966
  const { implicitKey, inFlow } = ctx;
10967
10967
  const ss = typeof item.value === "string" ? item : Object.assign({}, item, { value: String(item.value) });
10968
10968
  let { type } = item;
10969
- if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
10969
+ if (type !== Scalar2.Scalar.QUOTE_DOUBLE) {
10970
10970
  if (/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value))
10971
- type = Scalar.Scalar.QUOTE_DOUBLE;
10971
+ type = Scalar2.Scalar.QUOTE_DOUBLE;
10972
10972
  }
10973
10973
  const _stringify = (_type) => {
10974
10974
  switch (_type) {
10975
- case Scalar.Scalar.BLOCK_FOLDED:
10976
- case Scalar.Scalar.BLOCK_LITERAL:
10975
+ case Scalar2.Scalar.BLOCK_FOLDED:
10976
+ case Scalar2.Scalar.BLOCK_LITERAL:
10977
10977
  return implicitKey || inFlow ? quotedString(ss.value, ctx) : blockString(ss, ctx, onComment, onChompKeep);
10978
- case Scalar.Scalar.QUOTE_DOUBLE:
10978
+ case Scalar2.Scalar.QUOTE_DOUBLE:
10979
10979
  return doubleQuotedString(ss.value, ctx);
10980
- case Scalar.Scalar.QUOTE_SINGLE:
10980
+ case Scalar2.Scalar.QUOTE_SINGLE:
10981
10981
  return singleQuotedString(ss.value, ctx);
10982
- case Scalar.Scalar.PLAIN:
10982
+ case Scalar2.Scalar.PLAIN:
10983
10983
  return plainString(ss, ctx, onComment, onChompKeep);
10984
10984
  default:
10985
10985
  return null;
@@ -11128,7 +11128,7 @@ var require_stringifyPair = __commonJS({
11128
11128
  "../cli/node_modules/yaml/dist/stringify/stringifyPair.js"(exports) {
11129
11129
  "use strict";
11130
11130
  var identity = require_identity();
11131
- var Scalar = require_Scalar();
11131
+ var Scalar2 = require_Scalar();
11132
11132
  var stringify = require_stringify();
11133
11133
  var stringifyComment = require_stringifyComment();
11134
11134
  function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
@@ -11143,7 +11143,7 @@ var require_stringifyPair = __commonJS({
11143
11143
  throw new Error(msg);
11144
11144
  }
11145
11145
  }
11146
- let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || identity.isCollection(key) || (identity.isScalar(key) ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL : typeof key === "object"));
11146
+ let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || identity.isCollection(key) || (identity.isScalar(key) ? key.type === Scalar2.Scalar.BLOCK_FOLDED || key.type === Scalar2.Scalar.BLOCK_LITERAL : typeof key === "object"));
11147
11147
  ctx = Object.assign({}, ctx, {
11148
11148
  allNullValues: false,
11149
11149
  implicitKey: !explicitKey && (simpleKeys || !allNullValues),
@@ -11283,19 +11283,19 @@ var require_merge = __commonJS({
11283
11283
  "../cli/node_modules/yaml/dist/schema/yaml-1.1/merge.js"(exports) {
11284
11284
  "use strict";
11285
11285
  var identity = require_identity();
11286
- var Scalar = require_Scalar();
11286
+ var Scalar2 = require_Scalar();
11287
11287
  var MERGE_KEY = "<<";
11288
11288
  var merge2 = {
11289
11289
  identify: (value) => value === MERGE_KEY || typeof value === "symbol" && value.description === MERGE_KEY,
11290
11290
  default: "key",
11291
11291
  tag: "tag:yaml.org,2002:merge",
11292
11292
  test: /^<<$/,
11293
- resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {
11293
+ resolve: () => Object.assign(new Scalar2.Scalar(Symbol(MERGE_KEY)), {
11294
11294
  addToJSMap: addMergeToJSMap
11295
11295
  }),
11296
11296
  stringify: () => MERGE_KEY
11297
11297
  };
11298
- var isMergeKey = (ctx, key) => (merge2.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge2.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge2.tag && tag.default);
11298
+ var isMergeKey = (ctx, key) => (merge2.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar2.Scalar.PLAIN) && merge2.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge2.tag && tag.default);
11299
11299
  function addMergeToJSMap(ctx, map3, value) {
11300
11300
  const source2 = resolveAliasValue(ctx, value);
11301
11301
  if (identity.isSeq(source2))
@@ -11602,7 +11602,7 @@ var require_YAMLMap = __commonJS({
11602
11602
  var Collection = require_Collection();
11603
11603
  var identity = require_identity();
11604
11604
  var Pair = require_Pair();
11605
- var Scalar = require_Scalar();
11605
+ var Scalar2 = require_Scalar();
11606
11606
  function findPair(items, key) {
11607
11607
  const k = identity.isScalar(key) ? key.value : key;
11608
11608
  for (const it of items) {
@@ -11669,7 +11669,7 @@ var require_YAMLMap = __commonJS({
11669
11669
  if (prev) {
11670
11670
  if (!overwrite)
11671
11671
  throw new Error(`Key ${_pair.key} already set`);
11672
- if (identity.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))
11672
+ if (identity.isScalar(prev.value) && Scalar2.isScalarValue(_pair.value))
11673
11673
  prev.value.value = _pair.value;
11674
11674
  else
11675
11675
  prev.value = _pair.value;
@@ -11767,7 +11767,7 @@ var require_YAMLSeq = __commonJS({
11767
11767
  var stringifyCollection = require_stringifyCollection();
11768
11768
  var Collection = require_Collection();
11769
11769
  var identity = require_identity();
11770
- var Scalar = require_Scalar();
11770
+ var Scalar2 = require_Scalar();
11771
11771
  var toJS = require_toJS();
11772
11772
  var YAMLSeq = class extends Collection.Collection {
11773
11773
  static get tagName() {
@@ -11824,7 +11824,7 @@ var require_YAMLSeq = __commonJS({
11824
11824
  if (typeof idx !== "number")
11825
11825
  throw new Error(`Expected a valid index, not ${key}.`);
11826
11826
  const prev = this.items[idx];
11827
- if (identity.isScalar(prev) && Scalar.isScalarValue(value))
11827
+ if (identity.isScalar(prev) && Scalar2.isScalarValue(value))
11828
11828
  prev.value = value;
11829
11829
  else
11830
11830
  this.items[idx] = value;
@@ -11920,14 +11920,14 @@ var require_string = __commonJS({
11920
11920
  var require_null = __commonJS({
11921
11921
  "../cli/node_modules/yaml/dist/schema/common/null.js"(exports) {
11922
11922
  "use strict";
11923
- var Scalar = require_Scalar();
11923
+ var Scalar2 = require_Scalar();
11924
11924
  var nullTag = {
11925
11925
  identify: (value) => value == null,
11926
- createNode: () => new Scalar.Scalar(null),
11926
+ createNode: () => new Scalar2.Scalar(null),
11927
11927
  default: true,
11928
11928
  tag: "tag:yaml.org,2002:null",
11929
11929
  test: /^(?:~|[Nn]ull|NULL)?$/,
11930
- resolve: () => new Scalar.Scalar(null),
11930
+ resolve: () => new Scalar2.Scalar(null),
11931
11931
  stringify: ({ source: source2 }, ctx) => typeof source2 === "string" && nullTag.test.test(source2) ? source2 : ctx.options.nullStr
11932
11932
  };
11933
11933
  exports.nullTag = nullTag;
@@ -11938,13 +11938,13 @@ var require_null = __commonJS({
11938
11938
  var require_bool = __commonJS({
11939
11939
  "../cli/node_modules/yaml/dist/schema/core/bool.js"(exports) {
11940
11940
  "use strict";
11941
- var Scalar = require_Scalar();
11941
+ var Scalar2 = require_Scalar();
11942
11942
  var boolTag = {
11943
11943
  identify: (value) => typeof value === "boolean",
11944
11944
  default: true,
11945
11945
  tag: "tag:yaml.org,2002:bool",
11946
11946
  test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
11947
- resolve: (str5) => new Scalar.Scalar(str5[0] === "t" || str5[0] === "T"),
11947
+ resolve: (str5) => new Scalar2.Scalar(str5[0] === "t" || str5[0] === "T"),
11948
11948
  stringify({ source: source2, value }, ctx) {
11949
11949
  if (source2 && boolTag.test.test(source2)) {
11950
11950
  const sv = source2[0] === "t" || source2[0] === "T";
@@ -11989,7 +11989,7 @@ var require_stringifyNumber = __commonJS({
11989
11989
  var require_float = __commonJS({
11990
11990
  "../cli/node_modules/yaml/dist/schema/core/float.js"(exports) {
11991
11991
  "use strict";
11992
- var Scalar = require_Scalar();
11992
+ var Scalar2 = require_Scalar();
11993
11993
  var stringifyNumber = require_stringifyNumber();
11994
11994
  var floatNaN = {
11995
11995
  identify: (value) => typeof value === "number",
@@ -12017,7 +12017,7 @@ var require_float = __commonJS({
12017
12017
  tag: "tag:yaml.org,2002:float",
12018
12018
  test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
12019
12019
  resolve(str5) {
12020
- const node2 = new Scalar.Scalar(parseFloat(str5));
12020
+ const node2 = new Scalar2.Scalar(parseFloat(str5));
12021
12021
  const dot = str5.indexOf(".");
12022
12022
  if (dot !== -1 && str5[str5.length - 1] === "0")
12023
12023
  node2.minFractionDigits = str5.length - dot - 1;
@@ -12108,7 +12108,7 @@ var require_schema = __commonJS({
12108
12108
  var require_schema2 = __commonJS({
12109
12109
  "../cli/node_modules/yaml/dist/schema/json/schema.js"(exports) {
12110
12110
  "use strict";
12111
- var Scalar = require_Scalar();
12111
+ var Scalar2 = require_Scalar();
12112
12112
  var map3 = require_map();
12113
12113
  var seq = require_seq();
12114
12114
  function intIdentify(value) {
@@ -12125,7 +12125,7 @@ var require_schema2 = __commonJS({
12125
12125
  },
12126
12126
  {
12127
12127
  identify: (value) => value == null,
12128
- createNode: () => new Scalar.Scalar(null),
12128
+ createNode: () => new Scalar2.Scalar(null),
12129
12129
  default: true,
12130
12130
  tag: "tag:yaml.org,2002:null",
12131
12131
  test: /^null$/,
@@ -12176,7 +12176,7 @@ var require_binary = __commonJS({
12176
12176
  "../cli/node_modules/yaml/dist/schema/yaml-1.1/binary.js"(exports) {
12177
12177
  "use strict";
12178
12178
  var node_buffer = __require("buffer");
12179
- var Scalar = require_Scalar();
12179
+ var Scalar2 = require_Scalar();
12180
12180
  var stringifyString = require_stringifyString();
12181
12181
  var binary = {
12182
12182
  identify: (value) => value instanceof Uint8Array,
@@ -12220,15 +12220,15 @@ var require_binary = __commonJS({
12220
12220
  } else {
12221
12221
  throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
12222
12222
  }
12223
- type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
12224
- if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
12223
+ type ?? (type = Scalar2.Scalar.BLOCK_LITERAL);
12224
+ if (type !== Scalar2.Scalar.QUOTE_DOUBLE) {
12225
12225
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
12226
12226
  const n = Math.ceil(str5.length / lineWidth);
12227
12227
  const lines = new Array(n);
12228
12228
  for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
12229
12229
  lines[i] = str5.substr(o, lineWidth);
12230
12230
  }
12231
- str5 = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? "\n" : " ");
12231
+ str5 = lines.join(type === Scalar2.Scalar.BLOCK_LITERAL ? "\n" : " ");
12232
12232
  }
12233
12233
  return stringifyString.stringifyString({ comment, type, value: str5 }, ctx, onComment, onChompKeep);
12234
12234
  }
@@ -12243,7 +12243,7 @@ var require_pairs = __commonJS({
12243
12243
  "use strict";
12244
12244
  var identity = require_identity();
12245
12245
  var Pair = require_Pair();
12246
- var Scalar = require_Scalar();
12246
+ var Scalar2 = require_Scalar();
12247
12247
  var YAMLSeq = require_YAMLSeq();
12248
12248
  function resolvePairs(seq, onError) {
12249
12249
  if (identity.isSeq(seq)) {
@@ -12254,7 +12254,7 @@ var require_pairs = __commonJS({
12254
12254
  else if (identity.isMap(item)) {
12255
12255
  if (item.items.length > 1)
12256
12256
  onError("Each pair must have its own sequence indicator");
12257
- const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null));
12257
+ const pair = item.items[0] || new Pair.Pair(new Scalar2.Scalar(null));
12258
12258
  if (item.commentBefore)
12259
12259
  pair.key.commentBefore = pair.key.commentBefore ? `${item.commentBefore}
12260
12260
  ${pair.key.commentBefore}` : item.commentBefore;
@@ -12397,7 +12397,7 @@ var require_omap = __commonJS({
12397
12397
  var require_bool2 = __commonJS({
12398
12398
  "../cli/node_modules/yaml/dist/schema/yaml-1.1/bool.js"(exports) {
12399
12399
  "use strict";
12400
- var Scalar = require_Scalar();
12400
+ var Scalar2 = require_Scalar();
12401
12401
  function boolStringify({ value, source: source2 }, ctx) {
12402
12402
  const boolObj = value ? trueTag : falseTag;
12403
12403
  if (source2 && boolObj.test.test(source2))
@@ -12409,7 +12409,7 @@ var require_bool2 = __commonJS({
12409
12409
  default: true,
12410
12410
  tag: "tag:yaml.org,2002:bool",
12411
12411
  test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
12412
- resolve: () => new Scalar.Scalar(true),
12412
+ resolve: () => new Scalar2.Scalar(true),
12413
12413
  stringify: boolStringify
12414
12414
  };
12415
12415
  var falseTag = {
@@ -12417,7 +12417,7 @@ var require_bool2 = __commonJS({
12417
12417
  default: true,
12418
12418
  tag: "tag:yaml.org,2002:bool",
12419
12419
  test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
12420
- resolve: () => new Scalar.Scalar(false),
12420
+ resolve: () => new Scalar2.Scalar(false),
12421
12421
  stringify: boolStringify
12422
12422
  };
12423
12423
  exports.falseTag = falseTag;
@@ -12429,7 +12429,7 @@ var require_bool2 = __commonJS({
12429
12429
  var require_float2 = __commonJS({
12430
12430
  "../cli/node_modules/yaml/dist/schema/yaml-1.1/float.js"(exports) {
12431
12431
  "use strict";
12432
- var Scalar = require_Scalar();
12432
+ var Scalar2 = require_Scalar();
12433
12433
  var stringifyNumber = require_stringifyNumber();
12434
12434
  var floatNaN = {
12435
12435
  identify: (value) => typeof value === "number",
@@ -12457,7 +12457,7 @@ var require_float2 = __commonJS({
12457
12457
  tag: "tag:yaml.org,2002:float",
12458
12458
  test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
12459
12459
  resolve(str5) {
12460
- const node2 = new Scalar.Scalar(parseFloat(str5.replace(/_/g, "")));
12460
+ const node2 = new Scalar2.Scalar(parseFloat(str5.replace(/_/g, "")));
12461
12461
  const dot = str5.indexOf(".");
12462
12462
  if (dot !== -1) {
12463
12463
  const f = str5.substring(dot + 1).replace(/_/g, "");
@@ -13965,7 +13965,7 @@ var require_compose_collection = __commonJS({
13965
13965
  "../cli/node_modules/yaml/dist/compose/compose-collection.js"(exports) {
13966
13966
  "use strict";
13967
13967
  var identity = require_identity();
13968
- var Scalar = require_Scalar();
13968
+ var Scalar2 = require_Scalar();
13969
13969
  var YAMLMap = require_YAMLMap();
13970
13970
  var YAMLSeq = require_YAMLSeq();
13971
13971
  var resolveBlockMap = require_resolve_block_map();
@@ -14014,7 +14014,7 @@ var require_compose_collection = __commonJS({
14014
14014
  }
14015
14015
  const coll = resolveCollection(CN, ctx, token2, onError, tagName, tag);
14016
14016
  const res = tag.resolve?.(coll, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg), ctx.options) ?? coll;
14017
- const node2 = identity.isNode(res) ? res : new Scalar.Scalar(res);
14017
+ const node2 = identity.isNode(res) ? res : new Scalar2.Scalar(res);
14018
14018
  node2.range = coll.range;
14019
14019
  node2.tag = tagName;
14020
14020
  if (tag?.format)
@@ -14029,13 +14029,13 @@ var require_compose_collection = __commonJS({
14029
14029
  var require_resolve_block_scalar = __commonJS({
14030
14030
  "../cli/node_modules/yaml/dist/compose/resolve-block-scalar.js"(exports) {
14031
14031
  "use strict";
14032
- var Scalar = require_Scalar();
14032
+ var Scalar2 = require_Scalar();
14033
14033
  function resolveBlockScalar(ctx, scalar, onError) {
14034
14034
  const start = scalar.offset;
14035
14035
  const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
14036
14036
  if (!header)
14037
14037
  return { value: "", type: null, comment: "", range: [start, start, start] };
14038
- const type = header.mode === ">" ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;
14038
+ const type = header.mode === ">" ? Scalar2.Scalar.BLOCK_FOLDED : Scalar2.Scalar.BLOCK_LITERAL;
14039
14039
  const lines = scalar.source ? splitLines(scalar.source) : [];
14040
14040
  let chompStart = lines.length;
14041
14041
  for (let i = lines.length - 1; i >= 0; --i) {
@@ -14097,7 +14097,7 @@ var require_resolve_block_scalar = __commonJS({
14097
14097
  onError(offset - content.length - (crlf ? 2 : 1), "BAD_INDENT", message);
14098
14098
  indent2 = "";
14099
14099
  }
14100
- if (type === Scalar.Scalar.BLOCK_LITERAL) {
14100
+ if (type === Scalar2.Scalar.BLOCK_LITERAL) {
14101
14101
  value += sep + indent2.slice(trimIndent) + content;
14102
14102
  sep = "\n";
14103
14103
  } else if (indent2.length > trimIndent || content[0] === " ") {
@@ -14212,7 +14212,7 @@ var require_resolve_block_scalar = __commonJS({
14212
14212
  var require_resolve_flow_scalar = __commonJS({
14213
14213
  "../cli/node_modules/yaml/dist/compose/resolve-flow-scalar.js"(exports) {
14214
14214
  "use strict";
14215
- var Scalar = require_Scalar();
14215
+ var Scalar2 = require_Scalar();
14216
14216
  var resolveEnd = require_resolve_end();
14217
14217
  function resolveFlowScalar(scalar, strict, onError) {
14218
14218
  const { offset, type, source: source2, end: end2 } = scalar;
@@ -14221,15 +14221,15 @@ var require_resolve_flow_scalar = __commonJS({
14221
14221
  const _onError = (rel3, code, msg) => onError(offset + rel3, code, msg);
14222
14222
  switch (type) {
14223
14223
  case "scalar":
14224
- _type = Scalar.Scalar.PLAIN;
14224
+ _type = Scalar2.Scalar.PLAIN;
14225
14225
  value = plainValue(source2, _onError);
14226
14226
  break;
14227
14227
  case "single-quoted-scalar":
14228
- _type = Scalar.Scalar.QUOTE_SINGLE;
14228
+ _type = Scalar2.Scalar.QUOTE_SINGLE;
14229
14229
  value = singleQuotedValue(source2, _onError);
14230
14230
  break;
14231
14231
  case "double-quoted-scalar":
14232
- _type = Scalar.Scalar.QUOTE_DOUBLE;
14232
+ _type = Scalar2.Scalar.QUOTE_DOUBLE;
14233
14233
  value = doubleQuotedValue(source2, _onError);
14234
14234
  break;
14235
14235
  /* istanbul ignore next should not happen */
@@ -14434,7 +14434,7 @@ var require_compose_scalar = __commonJS({
14434
14434
  "../cli/node_modules/yaml/dist/compose/compose-scalar.js"(exports) {
14435
14435
  "use strict";
14436
14436
  var identity = require_identity();
14437
- var Scalar = require_Scalar();
14437
+ var Scalar2 = require_Scalar();
14438
14438
  var resolveBlockScalar = require_resolve_block_scalar();
14439
14439
  var resolveFlowScalar = require_resolve_flow_scalar();
14440
14440
  function composeScalar(ctx, token2, tagToken, onError) {
@@ -14452,11 +14452,11 @@ var require_compose_scalar = __commonJS({
14452
14452
  let scalar;
14453
14453
  try {
14454
14454
  const res = tag.resolve(value, (msg) => onError(tagToken ?? token2, "TAG_RESOLVE_FAILED", msg), ctx.options);
14455
- scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);
14455
+ scalar = identity.isScalar(res) ? res : new Scalar2.Scalar(res);
14456
14456
  } catch (error62) {
14457
14457
  const msg = error62 instanceof Error ? error62.message : String(error62);
14458
14458
  onError(tagToken ?? token2, "TAG_RESOLVE_FAILED", msg);
14459
- scalar = new Scalar.Scalar(value);
14459
+ scalar = new Scalar2.Scalar(value);
14460
14460
  }
14461
14461
  scalar.range = range;
14462
14462
  scalar.source = value;
@@ -16831,7 +16831,7 @@ var require_public_api = __commonJS({
16831
16831
  return docs;
16832
16832
  return Object.assign([], { empty: true }, composer$1.streamInfo());
16833
16833
  }
16834
- function parseDocument3(source2, options = {}) {
16834
+ function parseDocument4(source2, options = {}) {
16835
16835
  const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
16836
16836
  const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
16837
16837
  const composer$1 = new composer.Composer(options);
@@ -16857,7 +16857,7 @@ var require_public_api = __commonJS({
16857
16857
  } else if (options === void 0 && reviver && typeof reviver === "object") {
16858
16858
  options = reviver;
16859
16859
  }
16860
- const doc = parseDocument3(src, options);
16860
+ const doc = parseDocument4(src, options);
16861
16861
  if (!doc)
16862
16862
  return null;
16863
16863
  doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning));
@@ -16893,7 +16893,7 @@ var require_public_api = __commonJS({
16893
16893
  }
16894
16894
  exports.parse = parse4;
16895
16895
  exports.parseAllDocuments = parseAllDocuments;
16896
- exports.parseDocument = parseDocument3;
16896
+ exports.parseDocument = parseDocument4;
16897
16897
  exports.stringify = stringify;
16898
16898
  }
16899
16899
  });
@@ -16909,7 +16909,7 @@ var require_dist = __commonJS({
16909
16909
  var Alias = require_Alias();
16910
16910
  var identity = require_identity();
16911
16911
  var Pair = require_Pair();
16912
- var Scalar = require_Scalar();
16912
+ var Scalar2 = require_Scalar();
16913
16913
  var YAMLMap = require_YAMLMap();
16914
16914
  var YAMLSeq = require_YAMLSeq();
16915
16915
  var cst = require_cst();
@@ -16934,7 +16934,7 @@ var require_dist = __commonJS({
16934
16934
  exports.isScalar = identity.isScalar;
16935
16935
  exports.isSeq = identity.isSeq;
16936
16936
  exports.Pair = Pair.Pair;
16937
- exports.Scalar = Scalar.Scalar;
16937
+ exports.Scalar = Scalar2.Scalar;
16938
16938
  exports.YAMLMap = YAMLMap.YAMLMap;
16939
16939
  exports.YAMLSeq = YAMLSeq.YAMLSeq;
16940
16940
  exports.CST = cst;
@@ -17387,15 +17387,39 @@ function inspect(value, official, { allowLegacyPreviewCopy, allowLegacyLand } =
17387
17387
  }
17388
17388
  return { problems, def, files };
17389
17389
  }
17390
+ function cloneFiles(files, name) {
17391
+ const refused = Object.keys(files).find((file2) => file2 === MCP_FILE || file2.startsWith("skills/"));
17392
+ if (refused) return { refused: refused === MCP_FILE ? MCP_FILE : `${refused.split("/").slice(0, 2).join("/")}/` };
17393
+ const kept2 = Object.fromEntries(Object.entries(files).filter(([file2]) => file2 !== VERSION_FILE && !isAboutFile(file2)));
17394
+ const source2 = kept2[STUDIO_FILE] ?? "";
17395
+ const read5 = parseStudioFile("studio", source2, STUDIO_FILE);
17396
+ if ("problem" in read5) return { files: kept2 };
17397
+ kept2[STUDIO_FILE] = source2.replace(/^---\r?\n([^]*?)\r?\n---(?:\r?\n|$)/, (_front, yaml) => {
17398
+ const document = (0, import_yaml5.parseDocument)(yaml);
17399
+ const quoted = (value) => Object.assign(new import_yaml5.Scalar(value), { type: import_yaml5.Scalar.QUOTE_DOUBLE });
17400
+ document.set("name", quoted(name ?? `${read5.def.name} (copy)`));
17401
+ if (name) document.delete("names");
17402
+ else if (read5.def.names) {
17403
+ for (const [lang, text4] of Object.entries(read5.def.names)) {
17404
+ document.setIn(["names", lang], quoted(lang === "zh" ? `${text4}\uFF08\u526F\u672C\uFF09` : `${text4} (copy)`));
17405
+ }
17406
+ }
17407
+ return `---
17408
+ ${document.toString({ lineWidth: 0 })}---
17409
+ `;
17410
+ });
17411
+ return { files: kept2 };
17412
+ }
17390
17413
  function previewCatalog(files) {
17391
17414
  const read5 = parseStudioFile("studio", files[STUDIO_FILE] ?? "", STUDIO_FILE);
17392
17415
  if ("problem" in read5) throw new Error(read5.problem);
17393
17416
  return read5.def.previews;
17394
17417
  }
17395
- var STUDIO_FILE, MCP_FILE, CARD_TEMPLATE_FILE, RULES_FILE, VERSION_FILE, versionText, KB, FILE_LIMITS, officialId, hashInput, landsOf, SEGMENT, isAboutFile, bytes, isSharedFile, studioFilesProblems;
17418
+ var import_yaml5, STUDIO_FILE, MCP_FILE, CARD_TEMPLATE_FILE, RULES_FILE, VERSION_FILE, versionText, KB, FILE_LIMITS, officialId, hashInput, landsOf, SEGMENT, isAboutFile, bytes, isSharedFile, studioFilesProblems;
17396
17419
  var init_studio_files = __esm({
17397
17420
  "../cli/src/lib/shared/studio-files.ts"() {
17398
17421
  "use strict";
17422
+ import_yaml5 = __toESM(require_dist(), 1);
17399
17423
  init_studio_def();
17400
17424
  init_preview_blocks();
17401
17425
  init_guide_topics();
@@ -40818,8 +40842,8 @@ var init_package = __esm({
40818
40842
  "../cli/package.json"() {
40819
40843
  package_default = {
40820
40844
  name: "wildcrane",
40821
- version: "0.11.97",
40822
- akbContract: 31,
40845
+ version: "0.11.98",
40846
+ akbContract: 32,
40823
40847
  canonicalCommands: true,
40824
40848
  description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
40825
40849
  keywords: [
@@ -42578,8 +42602,8 @@ function validateSpec(file2, text4, id2, context) {
42578
42602
  if (/^\s*<Storyboard\b/.test(line) && (storyboardTag(line) === null || lines[i - 1]?.trim() || lines[i + 1]?.trim())) {
42579
42603
  add2(i + 1, "storyboard-block", 'Put one self-closing <Storyboard src=".assets/<card id>/storyboard.json" /> tag on its own line, with blank lines around it.');
42580
42604
  }
42581
- if (/^\s*<Studio\b/.test(line) && (studioTag(line) === null || !/\blabel="[^"]+"/.test(line) || lines[i - 1]?.trim() || lines[i + 1]?.trim())) {
42582
- add2(i + 1, "studio-block", 'Put one self-closing <Studio src=".assets/<card id>/studio.json" label="..." /> tag on its own line, with blank lines around it.');
42605
+ if (/^\s*<Studio\b/.test(line) && (!studioTag(line) || lines[i - 1]?.trim() || lines[i + 1]?.trim())) {
42606
+ add2(i + 1, "studio-block", 'Put one self-closing <Studio src=".assets/<card id>/studio-review/review.json" /> tag on its own line, with blank lines around it.');
42583
42607
  }
42584
42608
  if (/^\s*<Compare\b/.test(line)) {
42585
42609
  const attrs = compareAttrs(line);
@@ -42717,7 +42741,7 @@ function validateStoryboards(file2, id2, text4) {
42717
42741
  ["Studio", studioTag, "studio-src", "Fix the path or freeze the draft with `akb studio preview <card> --folder <draft> --base <baseline>` and use the returned Studio tag."]
42718
42742
  ]) {
42719
42743
  for (const marker of storyboardMarkers(text4, tagOf)) {
42720
- const named2 = assetName(marker.src, id2, ["json"]);
42744
+ const named2 = assetName(marker.src, id2, ["json"], tag === "Studio");
42721
42745
  const add2 = (message) => errors.push({ file: rel(file2), line: marker.line, rule, message });
42722
42746
  if (!("name" in named2)) add2(`${tag} src is ${named2.actual}; expected ${named2.expected}.`);
42723
42747
  else if (!inside(dir, named2.name)) add2(`${tag} src ${marker.src} names no file in this card's asset folder. ${fix}`);
@@ -56689,7 +56713,7 @@ function resolutionOf(record2, value) {
56689
56713
  if (saved.remote.content === null && saved.base.content !== null && f.content !== null && (numberOfCard(f.path) !== null || f.path.startsWith("triage/"))) refuse(record2, `This path was removed or moved: ${f.path}. Preserve the local draft outside the board.`, "cloud-refused");
56690
56714
  if (numberOfCard(f.path) !== null && f.content !== null) {
56691
56715
  const front = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(f.content)?.[1];
56692
- const parsed = (0, import_yaml10.parseDocument)(front ?? "");
56716
+ const parsed = (0, import_yaml11.parseDocument)(front ?? "");
56693
56717
  const fields2 = parsed.toJS();
56694
56718
  if (!front || parsed.errors.length || !fields2 || typeof fields2.title !== "string" || ["title", "priority", "status", "blocked_by", "related", "modules", "questions"].some((key) => !(key in fields2)) || ["blocked_by", "related", "modules", "questions"].some((key) => !Array.isArray(fields2[key])) || fields2.modules.some((v) => typeof v !== "string") || ["blocked_by", "related"].some((key) => fields2[key].some((v) => !Number.isSafeInteger(v) || Number(v) < 1))) refuse(record2, `Invalid card metadata: ${f.path}`, "invalid-usage");
56695
56719
  const meta3 = parseFrontmatter(f.content).meta;
@@ -56840,11 +56864,11 @@ async function resolveConflict(board, project2, id2, expect, value, transport) {
56840
56864
  return { id: id2, state: r.state, receipt: r.receipt };
56841
56865
  });
56842
56866
  }
56843
- var import_yaml10, digest, folder, fileOf, pendingConflicts, conflictList;
56867
+ var import_yaml11, digest, folder, fileOf, pendingConflicts, conflictList;
56844
56868
  var init_board_conflicts = __esm({
56845
56869
  "../cli/src/lib/shared/board-conflicts.ts"() {
56846
56870
  "use strict";
56847
- import_yaml10 = __toESM(require_dist(), 1);
56871
+ import_yaml11 = __toESM(require_dist(), 1);
56848
56872
  init_shared_memory();
56849
56873
  init_io();
56850
56874
  init_lock();
@@ -57920,7 +57944,12 @@ async function taskRuntime(id2, runtime, location = {}) {
57920
57944
  const runtimeId = await resolveCloudRuntime(runtime);
57921
57945
  const ref = await taskRef(id2, location);
57922
57946
  const task = requireTask(await cloud("PATCH", `/v1/tasks/${enc(ref)}`, { runtime: runtimeId }));
57923
- say(`Updated ${task.key} runtime to ${task.runtime_info?.name ?? runtimeId}.`);
57947
+ if (task.runtime !== runtimeId || task.runtime_info != null && task.runtime_info.id !== runtimeId) {
57948
+ const effective = task.runtime_info == null ? "" : `, effective ${task.runtime_info.id ?? "missing"}`;
57949
+ throw cloudError(invalidResponse(`a matching runtime (requested ${runtimeId}, saved ${task.runtime ?? "missing"}${effective})`));
57950
+ }
57951
+ const name = task.runtime_info?.name;
57952
+ say(`Updated ${task.key} runtime to ${hasText(name) ? name : task.runtime}.`);
57924
57953
  return { ...task };
57925
57954
  }
57926
57955
  async function taskStop(id2, location = {}) {
@@ -58765,7 +58794,7 @@ async function cloudImage(opts, program2) {
58765
58794
  failed: "Could not generate the image.",
58766
58795
  fallback: "Use an existing image or screenshot.",
58767
58796
  // A Cloud without tiers answers no `x-tier`, and generated at standard.
58768
- label: (res) => `${res.headers.get("x-model") ?? "unknown model"}, ${res.headers.get("x-tier") ?? "standard"}`
58797
+ label: (res) => `${res.headers.get("x-tier") ?? "standard"}`
58769
58798
  });
58770
58799
  }
58771
58800
  async function cloudTts(opts, program2) {
@@ -58836,8 +58865,9 @@ async function generate(g) {
58836
58865
  if (res.status === 401) refuse3(problem2, `${CLOUD_ACCESS_HINTS.expired}
58837
58866
  ${problem2.message}`);
58838
58867
  if (problem2.code === "pro_required") refuse3(problem2, g.proRequired);
58868
+ if (problem2.code === "api_balance_insufficient" || problem2.code === "pricing_changed") refuse3(problem2, problem2.message);
58839
58869
  if (problem2.code === "credits_used_up") {
58840
- refuse3(problem2, res.headers.has("retry-after") ? "AI credits are used up. See Settings \u2192 Usage or wait for the next reset." : "Trial AI credits are used up. Get Pro from WildCrane web settings once the trial ends.");
58870
+ refuse3(problem2, res.headers.has("retry-after") ? "AI credits are used up. See Settings \u2192 Usage or wait for the next reset." : "Trial AI credits are used up. Add API balance in Settings \u2192 Usage.");
58841
58871
  }
58842
58872
  if (res.status === 400) refuse3(problem2, `${problem2.message}
58843
58873
  usage: ${g.usage}`, 2);
@@ -58858,7 +58888,8 @@ ${g.fallback}`, retryable: true }, { bare: true, exitCode: 1 });
58858
58888
  const out = g.outFor?.(res, g.out) ?? g.out;
58859
58889
  fs74.mkdirSync(path73.dirname(path73.resolve(out)), { recursive: true });
58860
58890
  fs74.writeFileSync(out, bytes2);
58861
- say(`${out} (${g.label(res)})`);
58891
+ const charge = res.headers.get("x-wildcrane-api-charge-usd");
58892
+ say(`${out} (${g.label(res)}${charge ? `, WildCrane API $${charge}` : ""})`);
58862
58893
  return { out };
58863
58894
  }
58864
58895
  function mediaMatches(contentType, bytes2, image) {
@@ -63885,31 +63916,75 @@ function cmdStudioValidate(folder2) {
63885
63916
  const fingerprint = checked.ok ? crypto7.createHash("sha256").update(hashInput({ ...checked.files, ...files[VERSION_FILE] ? { [VERSION_FILE]: files[VERSION_FILE] } : {} })).digest("hex") : null;
63886
63917
  return { folder: dir, problems, fingerprint };
63887
63918
  }
63888
- async function cmdStudioPull(id2, folder2) {
63919
+ async function currentStudio(id2) {
63889
63920
  const cloudId = cloudIdOf(id2);
63890
63921
  if (!cloudId) {
63891
63922
  const { problem: problem2 } = studioVerification();
63892
63923
  if (problem2) throw cloudError(problem2);
63893
63924
  found(id2);
63894
63925
  }
63895
- const dir = path76.resolve(folder2 ?? id2);
63896
- if (fs76.existsSync(dir) && fs76.readdirSync(dir).length) die(`${folder2 ?? id2} is not empty`, "bad-args");
63897
63926
  const read5 = await call("GET", `/v1/studios/${encodeURIComponent(cloudId)}`);
63898
- const { version: version2, files } = requireResponse(
63927
+ return requireResponse(
63899
63928
  cloudOk(read5, read5.ok || read5.code !== "not_found" ? void 0 : "no-such-studio"),
63900
63929
  "the Studio version and files",
63901
63930
  (value) => value.id === cloudId && isStudioVersion(value.version) && isStudioFiles(value.files)
63902
63931
  );
63903
- for (const [file2, text4] of Object.entries({ ...files, [VERSION_FILE]: versionText(cloudId, version2) })) {
63932
+ }
63933
+ function emptyStudioFolder(dir) {
63934
+ const destination = fs76.lstatSync(dir, { throwIfNoEntry: false });
63935
+ if (!destination) return false;
63936
+ if (!destination.isDirectory()) die(`${dir} is not a directory. Choose a new or empty folder.`, "bad-args");
63937
+ if (fs76.readdirSync(dir).length) die(`${dir} is not empty. Choose a new or empty folder.`, "bad-args");
63938
+ return true;
63939
+ }
63940
+ function writeStudioFiles(dir, files) {
63941
+ for (const [file2, text4] of Object.entries(files)) {
63904
63942
  const full = path76.join(dir, ...file2.split("/"));
63905
63943
  fs76.mkdirSync(path76.dirname(full), { recursive: true });
63906
63944
  const data = isAboutFile(file2) && !file2.endsWith(".md") && /^data:[^;]+;base64,/.exec(text4);
63907
- fs76.writeFileSync(full, data ? Buffer.from(text4.slice(data[0].length), "base64") : text4);
63945
+ fs76.writeFileSync(full, data ? Buffer.from(text4.slice(data[0].length), "base64") : text4, { flag: "wx" });
63908
63946
  }
63947
+ }
63948
+ async function cmdStudioPull(id2, folder2) {
63949
+ const dir = path76.resolve(folder2 ?? id2);
63950
+ emptyStudioFolder(dir);
63951
+ const { id: cloudId, version: version2, files } = await currentStudio(id2);
63952
+ writeStudioFiles(dir, { ...files, [VERSION_FILE]: versionText(cloudId, version2) });
63909
63953
  const shown = folder2 ?? `./${id2}`;
63910
63954
  say(`Pulled ${id2} v${version2} into ${shown}.`);
63911
63955
  return { id: id2, version: version2, folder: dir };
63912
63956
  }
63957
+ async function cmdStudioClone(id2, folder2, name) {
63958
+ const dir = path76.resolve(folder2);
63959
+ emptyStudioFolder(dir);
63960
+ if (name !== void 0 && !name.trim()) die("--name needs a non-blank Studio name.", "bad-args");
63961
+ const { version: version2, files } = await currentStudio(id2);
63962
+ const cloned = cloneFiles(files, name?.trim());
63963
+ if ("refused" in cloned) {
63964
+ die(`Studio "${id2}" uses ${cloned.refused}, which a workspace Studio cannot carry. Use studio pull to inspect it or choose another Studio.`, "studio-not-cloneable");
63965
+ }
63966
+ const checked = checkStudioFiles(cloned.files);
63967
+ if (!checked.ok) die(formatStudioProblem(checked), { kind: "bad-studio", problems: checked.problems });
63968
+ const parent = path76.dirname(dir);
63969
+ fs76.mkdirSync(parent, { recursive: true });
63970
+ const staging = fs76.mkdtempSync(path76.join(parent, ".studio-clone-"));
63971
+ let removedEmpty = false;
63972
+ try {
63973
+ writeStudioFiles(staging, checked.files);
63974
+ if (emptyStudioFolder(dir) && process.platform === "win32") {
63975
+ fs76.rmdirSync(dir);
63976
+ removedEmpty = true;
63977
+ }
63978
+ fs76.renameSync(staging, dir);
63979
+ } catch (error62) {
63980
+ if (removedEmpty) fs76.mkdirSync(dir, { recursive: true });
63981
+ throw error62;
63982
+ } finally {
63983
+ fs76.rmSync(staging, { recursive: true, force: true });
63984
+ }
63985
+ say(`Cloned ${id2} v${version2} into ${folder2}.`);
63986
+ return { source: id2, sourceVersion: version2, folder: dir };
63987
+ }
63913
63988
  function publicationFiles(dir) {
63914
63989
  const checked = checkStudioFiles(readStudioFolder(dir));
63915
63990
  if (!checked.ok) die(formatStudioProblem(checked), { kind: "bad-studio", problems: checked.problems });
@@ -67728,6 +67803,9 @@ function declareRuns(program2, cli) {
67728
67803
  flowWord("pull").argument("<id>", "the studio, from `studio list`").argument("[folder]", "where to write it, empty or new; default ./<id>").summary("write the studio's current version into a folder to edit").action(async function(id2, folder2) {
67729
67804
  await onBoard(this, cli, () => cmdStudioPull(id2, folder2));
67730
67805
  });
67806
+ flowWord("clone").argument("<id>", "the studio, from `studio list`").argument("<folder>", "where to write the draft, empty or new").option("--name <name>", "the draft name; defaults to the source name with a copy suffix").summary("write an independent local draft from a Studio").action(async function(id2, folder2) {
67807
+ await onBoard(this, cli, () => cmdStudioClone(id2, folder2, this.opts().name));
67808
+ });
67731
67809
  flowWord("create").argument("<folder>", "the studio files to create").requiredOption("--request-id <id>", "the publication request, reused on retry").option("--workspace <id>", "the target workspace; otherwise use the linked project").summary("create a workspace studio from a local folder").action(async function(folder2) {
67732
67810
  if (this.opts().workspace) await boardless(this, cli, () => cmdStudioCreate(folder2, this.opts()));
67733
67811
  else await onBoard(this, cli, () => cmdStudioCreate(folder2, this.opts()));