@tryarcanist/cli 0.1.289 → 0.1.291

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +68 -43
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -634,6 +634,8 @@ var require_Alias = __commonJS({
634
634
  * instance of the `source` anchor before this node.
635
635
  */
636
636
  resolve(doc, ctx) {
637
+ if (ctx?.maxAliasCount === 0)
638
+ throw new ReferenceError("Alias resolution is disabled");
637
639
  let nodes;
638
640
  if (ctx?.aliasResolveCache) {
639
641
  nodes = ctx.aliasResolveCache;
@@ -1706,18 +1708,18 @@ var require_merge = __commonJS({
1706
1708
  };
1707
1709
  var isMergeKey = (ctx, key) => (merge.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
1708
1710
  function addMergeToJSMap(ctx, map, value) {
1709
- value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
1710
- if (identity.isSeq(value))
1711
- for (const it of value.items)
1711
+ const source = resolveAliasValue(ctx, value);
1712
+ if (identity.isSeq(source))
1713
+ for (const it of source.items)
1712
1714
  mergeValue(ctx, map, it);
1713
- else if (Array.isArray(value))
1714
- for (const it of value)
1715
+ else if (Array.isArray(source))
1716
+ for (const it of source)
1715
1717
  mergeValue(ctx, map, it);
1716
1718
  else
1717
- mergeValue(ctx, map, value);
1719
+ mergeValue(ctx, map, source);
1718
1720
  }
1719
1721
  function mergeValue(ctx, map, value) {
1720
- const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
1722
+ const source = resolveAliasValue(ctx, value);
1721
1723
  if (!identity.isMap(source))
1722
1724
  throw new Error("Merge sources must be maps or map aliases");
1723
1725
  const srcMap = source.toJSON(null, ctx, Map);
@@ -1738,6 +1740,9 @@ var require_merge = __commonJS({
1738
1740
  }
1739
1741
  return map;
1740
1742
  }
1743
+ function resolveAliasValue(ctx, value) {
1744
+ return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
1745
+ }
1741
1746
  exports.addMergeToJSMap = addMergeToJSMap;
1742
1747
  exports.isMergeKey = isMergeKey;
1743
1748
  exports.merge = merge;
@@ -2375,7 +2380,7 @@ var require_stringifyNumber = __commonJS({
2375
2380
  if (!isFinite(num))
2376
2381
  return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
2377
2382
  let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
2378
- if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
2383
+ if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
2379
2384
  let i = n.indexOf(".");
2380
2385
  if (i < 0) {
2381
2386
  i = n.length;
@@ -4747,7 +4752,7 @@ var require_resolve_flow_scalar = __commonJS({
4747
4752
  while (next === " " || next === " ")
4748
4753
  next = source[++i + 1];
4749
4754
  } else if (next === "x" || next === "u" || next === "U") {
4750
- const length = { x: 2, u: 4, U: 8 }[next];
4755
+ const length = next === "x" ? 2 : next === "u" ? 4 : 8;
4751
4756
  res += parseCharCode(source, i + 1, length, onError);
4752
4757
  i += length;
4753
4758
  } else {
@@ -4822,12 +4827,13 @@ var require_resolve_flow_scalar = __commonJS({
4822
4827
  const cc = source.substr(offset, length);
4823
4828
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
4824
4829
  const code = ok ? parseInt(cc, 16) : NaN;
4825
- if (isNaN(code)) {
4830
+ try {
4831
+ return String.fromCodePoint(code);
4832
+ } catch {
4826
4833
  const raw = source.substr(offset - 2, length + 2);
4827
4834
  onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
4828
4835
  return raw;
4829
4836
  }
4830
- return String.fromCodePoint(code);
4831
4837
  }
4832
4838
  exports.resolveFlowScalar = resolveFlowScalar;
4833
4839
  }
@@ -5177,8 +5183,10 @@ ${cb}` : comment;
5177
5183
  }
5178
5184
  }
5179
5185
  if (afterDoc) {
5180
- Array.prototype.push.apply(doc.errors, this.errors);
5181
- Array.prototype.push.apply(doc.warnings, this.warnings);
5186
+ for (let i = 0; i < this.errors.length; ++i)
5187
+ doc.errors.push(this.errors[i]);
5188
+ for (let i = 0; i < this.warnings.length; ++i)
5189
+ doc.warnings.push(this.warnings[i]);
5182
5190
  } else {
5183
5191
  doc.errors = this.errors;
5184
5192
  doc.warnings = this.warnings;
@@ -5911,7 +5919,7 @@ var require_lexer = __commonJS({
5911
5919
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
5912
5920
  this.indentNext = this.indentValue + 1;
5913
5921
  this.indentValue += n;
5914
- return yield* this.parseBlockStart();
5922
+ return "block-start";
5915
5923
  }
5916
5924
  return "doc";
5917
5925
  }
@@ -6210,28 +6218,38 @@ var require_lexer = __commonJS({
6210
6218
  return 0;
6211
6219
  }
6212
6220
  *pushIndicators() {
6213
- switch (this.charAt(0)) {
6214
- case "!":
6215
- return (yield* this.pushTag()) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
6216
- case "&":
6217
- return (yield* this.pushUntil(isNotAnchorChar)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
6218
- case "-":
6219
- // this is an error
6220
- case "?":
6221
- // this is an error outside flow collections
6222
- case ":": {
6223
- const inFlow = this.flowLevel > 0;
6224
- const ch1 = this.charAt(1);
6225
- if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
6226
- if (!inFlow)
6227
- this.indentNext = this.indentValue + 1;
6228
- else if (this.flowKey)
6229
- this.flowKey = false;
6230
- return (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
6221
+ let n = 0;
6222
+ loop: while (true) {
6223
+ switch (this.charAt(0)) {
6224
+ case "!":
6225
+ n += yield* this.pushTag();
6226
+ n += yield* this.pushSpaces(true);
6227
+ continue loop;
6228
+ case "&":
6229
+ n += yield* this.pushUntil(isNotAnchorChar);
6230
+ n += yield* this.pushSpaces(true);
6231
+ continue loop;
6232
+ case "-":
6233
+ // this is an error
6234
+ case "?":
6235
+ // this is an error outside flow collections
6236
+ case ":": {
6237
+ const inFlow = this.flowLevel > 0;
6238
+ const ch1 = this.charAt(1);
6239
+ if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
6240
+ if (!inFlow)
6241
+ this.indentNext = this.indentValue + 1;
6242
+ else if (this.flowKey)
6243
+ this.flowKey = false;
6244
+ n += yield* this.pushCount(1);
6245
+ n += yield* this.pushSpaces(true);
6246
+ continue loop;
6247
+ }
6231
6248
  }
6232
6249
  }
6250
+ break loop;
6233
6251
  }
6234
- return 0;
6252
+ return n;
6235
6253
  }
6236
6254
  *pushTag() {
6237
6255
  if (this.charAt(1) === "<") {
@@ -6390,6 +6408,13 @@ var require_parser = __commonJS({
6390
6408
  }
6391
6409
  return prev.splice(i, prev.length);
6392
6410
  }
6411
+ function arrayPushArray(target, source) {
6412
+ if (source.length < 1e5)
6413
+ Array.prototype.push.apply(target, source);
6414
+ else
6415
+ for (let i = 0; i < source.length; ++i)
6416
+ target.push(source[i]);
6417
+ }
6393
6418
  function fixFlowSeqItems(fc) {
6394
6419
  if (fc.start.type === "flow-seq-start") {
6395
6420
  for (const it of fc.items) {
@@ -6399,11 +6424,11 @@ var require_parser = __commonJS({
6399
6424
  delete it.key;
6400
6425
  if (isFlowToken(it.value)) {
6401
6426
  if (it.value.end)
6402
- Array.prototype.push.apply(it.value.end, it.sep);
6427
+ arrayPushArray(it.value.end, it.sep);
6403
6428
  else
6404
6429
  it.value.end = it.sep;
6405
6430
  } else
6406
- Array.prototype.push.apply(it.start, it.sep);
6431
+ arrayPushArray(it.start, it.sep);
6407
6432
  delete it.sep;
6408
6433
  }
6409
6434
  }
@@ -6758,7 +6783,7 @@ var require_parser = __commonJS({
6758
6783
  const prev = map.items[map.items.length - 2];
6759
6784
  const end = prev?.value?.end;
6760
6785
  if (Array.isArray(end)) {
6761
- Array.prototype.push.apply(end, it.start);
6786
+ arrayPushArray(end, it.start);
6762
6787
  end.push(this.sourceToken);
6763
6788
  map.items.pop();
6764
6789
  return;
@@ -6946,7 +6971,7 @@ var require_parser = __commonJS({
6946
6971
  const prev = seq.items[seq.items.length - 2];
6947
6972
  const end = prev?.value?.end;
6948
6973
  if (Array.isArray(end)) {
6949
- Array.prototype.push.apply(end, it.start);
6974
+ arrayPushArray(end, it.start);
6950
6975
  end.push(this.sourceToken);
6951
6976
  seq.items.pop();
6952
6977
  return;
@@ -8525,12 +8550,12 @@ async function egressValidateCommand(path = EGRESS_ALLOWLIST_SOURCE_PATH, option
8525
8550
  }
8526
8551
 
8527
8552
  // src/commands/hades.ts
8528
- async function hadesCommand(options = {}, command) {
8553
+ async function hadesCommand(repo, options = {}, command) {
8529
8554
  assertArcanistSessionMutationAllowed("hades");
8530
8555
  const { config } = resolveBusinessContext(command, options);
8531
8556
  const result = await apiFetch(config, "/api/hades-runs", {
8532
8557
  method: "POST",
8533
- body: "{}"
8558
+ body: JSON.stringify({ repo })
8534
8559
  });
8535
8560
  emit(command, options, result, (payload) => {
8536
8561
  console.log(`Started Hades run ${payload.runId} (${payload.jobId}).`);
@@ -12411,13 +12436,13 @@ The result is posted as a PR comment marked arcanist-anubis:v1.
12411
12436
  Anubis requires a write-scoped CLI token and repository write access.
12412
12437
  `
12413
12438
  ).action((prUrl, options, command) => anubisCommand(prUrl, options, command));
12414
- program.command("hades").description("Start an internal Hades adversarial Zeus probe").addHelpText(
12439
+ program.command("hades <repo>").description("Start an internal Hades adversarial Zeus probe against a Try Arcanist repository").addHelpText(
12415
12440
  "after",
12416
12441
  `
12417
- Hades is internal-only. It creates one proved adversarial patch in tryarcanist/arcanist;
12418
- the control plane opens the draft pull request and triggers Zeus.
12442
+ Hades is internal-only. It creates one proved adversarial patch in the selected
12443
+ tryarcanist repository; the control plane opens the draft pull request and triggers Zeus.
12419
12444
  `
12420
- ).action((options, command) => hadesCommand(options, command));
12445
+ ).action((repo, options, command) => hadesCommand(repo, options, command));
12421
12446
  sessions.command("stop").description("Stop the active run for a session").argument("<session-id>", "Session ID").addHelpText(
12422
12447
  "after",
12423
12448
  `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryarcanist/cli",
3
- "version": "0.1.289",
3
+ "version": "0.1.291",
4
4
  "description": "CLI for Arcanist - create and manage coding agent sessions",
5
5
  "type": "module",
6
6
  "bin": {