@polka-codes/cli 0.9.38 → 0.9.39

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 +156 -242
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -52386,7 +52386,7 @@ var require_createNode2 = __commonJS((exports) => {
52386
52386
  if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
52387
52387
  value = value.valueOf();
52388
52388
  }
52389
- const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;
52389
+ const { aliasDuplicateObjects, onAnchor, onTagObj, schema: schema2, sourceObjects } = ctx;
52390
52390
  let ref = undefined;
52391
52391
  if (aliasDuplicateObjects && value && typeof value === "object") {
52392
52392
  ref = sourceObjects.get(value);
@@ -52400,7 +52400,7 @@ var require_createNode2 = __commonJS((exports) => {
52400
52400
  }
52401
52401
  if (tagName?.startsWith("!!"))
52402
52402
  tagName = defaultTagPrefix + tagName.slice(2);
52403
- let tagObj = findTagObject(value, tagName, schema.tags);
52403
+ let tagObj = findTagObject(value, tagName, schema2.tags);
52404
52404
  if (!tagObj) {
52405
52405
  if (value && typeof value.toJSON === "function") {
52406
52406
  value = value.toJSON();
@@ -52411,7 +52411,7 @@ var require_createNode2 = __commonJS((exports) => {
52411
52411
  ref.node = node2;
52412
52412
  return node2;
52413
52413
  }
52414
- tagObj = value instanceof Map ? schema[identity2.MAP] : (Symbol.iterator in Object(value)) ? schema[identity2.SEQ] : schema[identity2.MAP];
52414
+ tagObj = value instanceof Map ? schema2[identity2.MAP] : (Symbol.iterator in Object(value)) ? schema2[identity2.SEQ] : schema2[identity2.MAP];
52415
52415
  }
52416
52416
  if (onTagObj) {
52417
52417
  onTagObj(tagObj);
@@ -52434,7 +52434,7 @@ var require_Collection2 = __commonJS((exports) => {
52434
52434
  var createNode = require_createNode2();
52435
52435
  var identity2 = require_identity2();
52436
52436
  var Node = require_Node2();
52437
- function collectionFromPath(schema, path, value) {
52437
+ function collectionFromPath(schema2, path, value) {
52438
52438
  let v = value;
52439
52439
  for (let i = path.length - 1;i >= 0; --i) {
52440
52440
  const k = path[i];
@@ -52452,27 +52452,27 @@ var require_Collection2 = __commonJS((exports) => {
52452
52452
  onAnchor: () => {
52453
52453
  throw new Error("This should not happen, please report a bug.");
52454
52454
  },
52455
- schema,
52455
+ schema: schema2,
52456
52456
  sourceObjects: new Map
52457
52457
  });
52458
52458
  }
52459
52459
  var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
52460
52460
 
52461
52461
  class Collection extends Node.NodeBase {
52462
- constructor(type, schema) {
52462
+ constructor(type, schema2) {
52463
52463
  super(type);
52464
52464
  Object.defineProperty(this, "schema", {
52465
- value: schema,
52465
+ value: schema2,
52466
52466
  configurable: true,
52467
52467
  enumerable: false,
52468
52468
  writable: true
52469
52469
  });
52470
52470
  }
52471
- clone(schema) {
52471
+ clone(schema2) {
52472
52472
  const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
52473
- if (schema)
52474
- copy.schema = schema;
52475
- copy.items = copy.items.map((it) => identity2.isNode(it) || identity2.isPair(it) ? it.clone(schema) : it);
52473
+ if (schema2)
52474
+ copy.schema = schema2;
52475
+ copy.items = copy.items.map((it) => identity2.isNode(it) || identity2.isPair(it) ? it.clone(schema2) : it);
52476
52476
  if (this.range)
52477
52477
  copy.range = this.range.slice();
52478
52478
  return copy;
@@ -53404,12 +53404,12 @@ var require_Pair2 = __commonJS((exports) => {
53404
53404
  this.key = key2;
53405
53405
  this.value = value;
53406
53406
  }
53407
- clone(schema) {
53407
+ clone(schema2) {
53408
53408
  let { key: key2, value } = this;
53409
53409
  if (identity2.isNode(key2))
53410
- key2 = key2.clone(schema);
53410
+ key2 = key2.clone(schema2);
53411
53411
  if (identity2.isNode(value))
53412
- value = value.clone(schema);
53412
+ value = value.clone(schema2);
53413
53413
  return new Pair2(key2, value);
53414
53414
  }
53415
53415
  toJSON(_, ctx) {
@@ -53594,13 +53594,13 @@ var require_YAMLMap2 = __commonJS((exports) => {
53594
53594
  static get tagName() {
53595
53595
  return "tag:yaml.org,2002:map";
53596
53596
  }
53597
- constructor(schema) {
53598
- super(identity2.MAP, schema);
53597
+ constructor(schema2) {
53598
+ super(identity2.MAP, schema2);
53599
53599
  this.items = [];
53600
53600
  }
53601
- static from(schema, obj, ctx) {
53601
+ static from(schema2, obj, ctx) {
53602
53602
  const { keepUndefined, replacer } = ctx;
53603
- const map3 = new this(schema);
53603
+ const map3 = new this(schema2);
53604
53604
  const add = (key2, value) => {
53605
53605
  if (typeof replacer === "function")
53606
53606
  value = replacer.call(obj, key2, value);
@@ -53616,8 +53616,8 @@ var require_YAMLMap2 = __commonJS((exports) => {
53616
53616
  for (const key2 of Object.keys(obj))
53617
53617
  add(key2, obj[key2]);
53618
53618
  }
53619
- if (typeof schema.sortMapEntries === "function") {
53620
- map3.items.sort(schema.sortMapEntries);
53619
+ if (typeof schema2.sortMapEntries === "function") {
53620
+ map3.items.sort(schema2.sortMapEntries);
53621
53621
  }
53622
53622
  return map3;
53623
53623
  }
@@ -53710,7 +53710,7 @@ var require_map2 = __commonJS((exports) => {
53710
53710
  onError("Expected a mapping for this tag");
53711
53711
  return map4;
53712
53712
  },
53713
- createNode: (schema, obj, ctx) => YAMLMap2.YAMLMap.from(schema, obj, ctx)
53713
+ createNode: (schema2, obj, ctx) => YAMLMap2.YAMLMap.from(schema2, obj, ctx)
53714
53714
  };
53715
53715
  exports.map = map3;
53716
53716
  });
@@ -53728,8 +53728,8 @@ var require_YAMLSeq2 = __commonJS((exports) => {
53728
53728
  static get tagName() {
53729
53729
  return "tag:yaml.org,2002:seq";
53730
53730
  }
53731
- constructor(schema) {
53732
- super(identity2.SEQ, schema);
53731
+ constructor(schema2) {
53732
+ super(identity2.SEQ, schema2);
53733
53733
  this.items = [];
53734
53734
  }
53735
53735
  add(value) {
@@ -53783,9 +53783,9 @@ var require_YAMLSeq2 = __commonJS((exports) => {
53783
53783
  onComment
53784
53784
  });
53785
53785
  }
53786
- static from(schema, obj, ctx) {
53786
+ static from(schema2, obj, ctx) {
53787
53787
  const { replacer } = ctx;
53788
- const seq = new this(schema);
53788
+ const seq = new this(schema2);
53789
53789
  if (obj && Symbol.iterator in Object(obj)) {
53790
53790
  let i = 0;
53791
53791
  for (let it of obj) {
@@ -53822,7 +53822,7 @@ var require_seq2 = __commonJS((exports) => {
53822
53822
  onError("Expected a sequence for this tag");
53823
53823
  return seq2;
53824
53824
  },
53825
- createNode: (schema, obj, ctx) => YAMLSeq2.YAMLSeq.from(schema, obj, ctx)
53825
+ createNode: (schema2, obj, ctx) => YAMLSeq2.YAMLSeq.from(schema2, obj, ctx)
53826
53826
  };
53827
53827
  exports.seq = seq;
53828
53828
  });
@@ -53997,7 +53997,7 @@ var require_schema4 = __commonJS((exports) => {
53997
53997
  var bool = require_bool3();
53998
53998
  var float = require_float3();
53999
53999
  var int2 = require_int3();
54000
- var schema = [
54000
+ var schema2 = [
54001
54001
  map3.map,
54002
54002
  seq.seq,
54003
54003
  string5.string,
@@ -54010,7 +54010,7 @@ var require_schema4 = __commonJS((exports) => {
54010
54010
  float.floatExp,
54011
54011
  float.float
54012
54012
  ];
54013
- exports.schema = schema;
54013
+ exports.schema = schema2;
54014
54014
  });
54015
54015
 
54016
54016
  // ../../node_modules/yaml/dist/schema/json/schema.js
@@ -54073,8 +54073,8 @@ var require_schema5 = __commonJS((exports) => {
54073
54073
  return str;
54074
54074
  }
54075
54075
  };
54076
- var schema = [map3.map, seq.seq].concat(jsonScalars, jsonError);
54077
- exports.schema = schema;
54076
+ var schema2 = [map3.map, seq.seq].concat(jsonScalars, jsonError);
54077
+ exports.schema = schema2;
54078
54078
  });
54079
54079
 
54080
54080
  // ../../node_modules/yaml/dist/schema/yaml-1.1/binary.js
@@ -54164,9 +54164,9 @@ ${cn.comment}` : item.comment;
54164
54164
  onError("Expected a sequence for this tag");
54165
54165
  return seq;
54166
54166
  }
54167
- function createPairs(schema, iterable, ctx) {
54167
+ function createPairs(schema2, iterable, ctx) {
54168
54168
  const { replacer } = ctx;
54169
- const pairs2 = new YAMLSeq2.YAMLSeq(schema);
54169
+ const pairs2 = new YAMLSeq2.YAMLSeq(schema2);
54170
54170
  pairs2.tag = "tag:yaml.org,2002:pairs";
54171
54171
  let i = 0;
54172
54172
  if (iterable && Symbol.iterator in Object(iterable))
@@ -54245,8 +54245,8 @@ var require_omap2 = __commonJS((exports) => {
54245
54245
  }
54246
54246
  return map3;
54247
54247
  }
54248
- static from(schema, iterable, ctx) {
54249
- const pairs$1 = pairs.createPairs(schema, iterable, ctx);
54248
+ static from(schema2, iterable, ctx) {
54249
+ const pairs$1 = pairs.createPairs(schema2, iterable, ctx);
54250
54250
  const omap2 = new this;
54251
54251
  omap2.items = pairs$1.items;
54252
54252
  return omap2;
@@ -54273,7 +54273,7 @@ var require_omap2 = __commonJS((exports) => {
54273
54273
  }
54274
54274
  return Object.assign(new YAMLOMap, pairs$1);
54275
54275
  },
54276
- createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)
54276
+ createNode: (schema2, iterable, ctx) => YAMLOMap.from(schema2, iterable, ctx)
54277
54277
  };
54278
54278
  exports.YAMLOMap = YAMLOMap;
54279
54279
  exports.omap = omap;
@@ -54437,8 +54437,8 @@ var require_set2 = __commonJS((exports) => {
54437
54437
  var YAMLMap2 = require_YAMLMap2();
54438
54438
 
54439
54439
  class YAMLSet extends YAMLMap2.YAMLMap {
54440
- constructor(schema) {
54441
- super(schema);
54440
+ constructor(schema2) {
54441
+ super(schema2);
54442
54442
  this.tag = YAMLSet.tag;
54443
54443
  }
54444
54444
  add(key2) {
@@ -54478,9 +54478,9 @@ var require_set2 = __commonJS((exports) => {
54478
54478
  else
54479
54479
  throw new Error("Set items must all have null values");
54480
54480
  }
54481
- static from(schema, iterable, ctx) {
54481
+ static from(schema2, iterable, ctx) {
54482
54482
  const { replacer } = ctx;
54483
- const set6 = new this(schema);
54483
+ const set6 = new this(schema2);
54484
54484
  if (iterable && Symbol.iterator in Object(iterable))
54485
54485
  for (let value of iterable) {
54486
54486
  if (typeof replacer === "function")
@@ -54497,7 +54497,7 @@ var require_set2 = __commonJS((exports) => {
54497
54497
  nodeClass: YAMLSet,
54498
54498
  default: false,
54499
54499
  tag: "tag:yaml.org,2002:set",
54500
- createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),
54500
+ createNode: (schema2, iterable, ctx) => YAMLSet.from(schema2, iterable, ctx),
54501
54501
  resolve(map3, onError) {
54502
54502
  if (identity2.isMap(map3)) {
54503
54503
  if (map3.hasAllNullValues(true))
@@ -54610,7 +54610,7 @@ var require_schema6 = __commonJS((exports) => {
54610
54610
  var pairs = require_pairs2();
54611
54611
  var set5 = require_set2();
54612
54612
  var timestamp = require_timestamp2();
54613
- var schema = [
54613
+ var schema2 = [
54614
54614
  map3.map,
54615
54615
  seq.seq,
54616
54616
  string5.string,
@@ -54633,7 +54633,7 @@ var require_schema6 = __commonJS((exports) => {
54633
54633
  timestamp.floatTime,
54634
54634
  timestamp.timestamp
54635
54635
  ];
54636
- exports.schema = schema;
54636
+ exports.schema = schema2;
54637
54637
  });
54638
54638
 
54639
54639
  // ../../node_modules/yaml/dist/schema/tags.js
@@ -54645,7 +54645,7 @@ var require_tags2 = __commonJS((exports) => {
54645
54645
  var bool = require_bool3();
54646
54646
  var float = require_float3();
54647
54647
  var int2 = require_int3();
54648
- var schema = require_schema4();
54648
+ var schema2 = require_schema4();
54649
54649
  var schema$1 = require_schema5();
54650
54650
  var binary = require_binary2();
54651
54651
  var merge5 = require_merge2();
@@ -54655,7 +54655,7 @@ var require_tags2 = __commonJS((exports) => {
54655
54655
  var set5 = require_set2();
54656
54656
  var timestamp = require_timestamp2();
54657
54657
  var schemas3 = new Map([
54658
- ["core", schema.schema],
54658
+ ["core", schema2.schema],
54659
54659
  ["failsafe", [map3.map, seq.seq, string5.string]],
54660
54660
  ["json", schema$1.schema],
54661
54661
  ["yaml11", schema$2.schema],
@@ -54737,9 +54737,9 @@ var require_Schema2 = __commonJS((exports) => {
54737
54737
  var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
54738
54738
 
54739
54739
  class Schema2 {
54740
- constructor({ compat: compat2, customTags, merge: merge5, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
54740
+ constructor({ compat: compat2, customTags, merge: merge5, resolveKnownTags, schema: schema2, sortMapEntries, toStringDefaults }) {
54741
54741
  this.compat = Array.isArray(compat2) ? tags.getTags(compat2, "compat") : compat2 ? tags.getTags(null, compat2) : null;
54742
- this.name = typeof schema === "string" && schema || "core";
54742
+ this.name = typeof schema2 === "string" && schema2 || "core";
54743
54743
  this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
54744
54744
  this.tags = tags.getTags(customTags, this.name, merge5);
54745
54745
  this.toStringOptions = toStringDefaults ?? null;
@@ -56231,11 +56231,11 @@ var require_compose_scalar2 = __commonJS((exports) => {
56231
56231
  scalar.comment = comment;
56232
56232
  return scalar;
56233
56233
  }
56234
- function findScalarTagByName(schema, value, tagName, tagToken, onError) {
56234
+ function findScalarTagByName(schema2, value, tagName, tagToken, onError) {
56235
56235
  if (tagName === "!")
56236
- return schema[identity2.SCALAR];
56236
+ return schema2[identity2.SCALAR];
56237
56237
  const matchWithTest = [];
56238
- for (const tag of schema.tags) {
56238
+ for (const tag of schema2.tags) {
56239
56239
  if (!tag.collection && tag.tag === tagName) {
56240
56240
  if (tag.default && tag.test)
56241
56241
  matchWithTest.push(tag);
@@ -56246,18 +56246,18 @@ var require_compose_scalar2 = __commonJS((exports) => {
56246
56246
  for (const tag of matchWithTest)
56247
56247
  if (tag.test?.test(value))
56248
56248
  return tag;
56249
- const kt = schema.knownTags[tagName];
56249
+ const kt = schema2.knownTags[tagName];
56250
56250
  if (kt && !kt.collection) {
56251
- schema.tags.push(Object.assign({}, kt, { default: false, test: undefined }));
56251
+ schema2.tags.push(Object.assign({}, kt, { default: false, test: undefined }));
56252
56252
  return kt;
56253
56253
  }
56254
56254
  onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
56255
- return schema[identity2.SCALAR];
56255
+ return schema2[identity2.SCALAR];
56256
56256
  }
56257
- function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
56258
- const tag = schema.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema[identity2.SCALAR];
56259
- if (schema.compat) {
56260
- const compat2 = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[identity2.SCALAR];
56257
+ function findScalarTagByTest({ atKey, directives, schema: schema2 }, value, token, onError) {
56258
+ const tag = schema2.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema2[identity2.SCALAR];
56259
+ if (schema2.compat) {
56260
+ const compat2 = schema2.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema2[identity2.SCALAR];
56261
56261
  if (tag.tag !== compat2.tag) {
56262
56262
  const ts = directives.tagString(tag.tag);
56263
56263
  const cs = directives.tagString(compat2.tag);
@@ -58608,7 +58608,7 @@ var {
58608
58608
  Help
58609
58609
  } = import__.default;
58610
58610
  // package.json
58611
- var version = "0.9.38";
58611
+ var version = "0.9.39";
58612
58612
 
58613
58613
  // src/commands/chat.ts
58614
58614
  import { readFile as readFile3 } from "node:fs/promises";
@@ -106618,192 +106618,106 @@ var import_lodash5 = __toESM(require_lodash(), 1);
106618
106618
 
106619
106619
  // src/commandSummarizer.ts
106620
106620
  var prompt3 = `
106621
- System Prompt: Command Output Summarizer
106622
-
106623
- Role
106624
- - You are a coding agent that summarizes command execution results.
106625
- - You receive raw stdout and stderr and must produce a concise, high-signal summary focused on what matters to developers.
106626
-
106627
- Input
106628
- - The input will ALWAYS be provided in this exact format:
106629
- <stdout>
106630
- \${stdout}
106631
- </stdout>
106632
- <stderr>
106633
- \${stderr}
106634
- </stderr>
106635
- - Treat missing or empty sections as empty strings.
106636
-
106637
- Core Objective
106638
- - Extract and report ONLY the key lines that communicate failures, warnings, and actionable issues.
106639
- - Ignore routine noise: progress bars, spinners, timestamps, banners, environment echoes, compilation start/finish messages, and other benign status lines.
106640
- - Prefer brevity and accuracy. Do not ask questions. Do not repeat yourself.
106641
- - Preserve the minimal set of surrounding lines (command headers, "Traceback" prologues, "Caused by" chains) required to fully understand each surfaced error or warning.
106642
-
106643
- General Rules
106644
- 1) Preprocessing
106645
- - Normalize newlines to "
106646
- "; strip ANSI colors/escape codes.
106647
- - Collapse repeated blank lines; trim trailing whitespace.
106648
- - Deduplicate identical lines that appear many times; show one and append " (repeated N times)".
106649
- - Truncate extremely long single lines to a reasonable width while preserving the essential portion (start and end), indicating truncation with "...".
106650
- - Redact obvious secrets (tokens, passwords, keys) by masking the middle with "****", keeping at most the last 4 chars.
106651
-
106652
- 2) Severity and Ordering
106653
- - Prioritize in this order: Errors, Test Failures, Warnings, Important Notes.
106654
- - Preserve original order within each section when helpful for debugging.
106655
- - If an exit code is inferable (e.g., via error footers or phrases like "exit status 1"), include it in the Summary.
106656
-
106657
- 3) Output Format (ASCII only, no tables)
106658
- - Summary: one short line if any issues were found.
106659
- Example: "Summary: exit_code=1; errors=3; warnings=2; failing_tests=4"
106660
- - Then zero or more sections in this order, only if present:
106661
- - Errors:
106662
- - Test Failures:
106663
- - Warnings:
106664
- - Notes:
106665
- - Within each section, use compact bullet points ("- ").
106666
- - Quote key lines verbatim when they carry the signal (file:line:col, codes, rule names, assertion diffs).
106667
- - When a diagnostic spans multiple lines or relies on nearby context (command invocation, "Traceback", "Caused by"), keep the contiguous block together in the bullet. Indent continuation lines with two spaces. Only elide middle lines if the block exceeds ~20 lines; show the start and end with "..." when doing so.
106668
- - Never include unrelated large code blocks; when context is long, limit it to the diagnostic itself and collapse the middle with "..." if needed.
106669
-
106670
- 4) What to Include vs Ignore (by tool/type)
106671
- A) Test Runners (jest, mocha, vitest, pytest, nose, unittest, go test, rspec, junit, maven-surefire, gradle test)
106672
- Include:
106673
- - Names of failing test suites and test cases.
106674
- - Assertion messages, diffs (Expected vs Received / AssertionError messages).
106675
- - First 1-3 relevant stack frames pointing to user code (omit framework internals).
106676
- - Summary counts: failed, skipped (if significant), total time if useful.
106677
- Ignore:
106678
- - Passed tests, pass counts, coverage success lines.
106679
- - Test discovery notices, "OK"/"PASSED" banners, shard routing info.
106680
- Example bullet:
106681
- - tests/math.spec.ts: "adds numbers" FAILED: Expected 3, Received 4 at src/math.ts:12:7
106682
-
106683
- B) Compilers/Build Tools (tsc, vite, webpack, esbuild, babel, gcc/clang, javac, kotlinc, rustc/cargo, go build, dotnet build, swiftc)
106684
- Include:
106685
- - Errors and warnings only (file:line:col if present, diagnostic code).
106686
- - Linker errors and type mismatch details.
106687
- Ignore:
106688
- - Status/progress lines like "Compiling X", "Bundling Y", "Starting dev server...", "Note: some messages have been simplified".
106689
- Example bullets:
106690
- - src/foo.ts:42:13 TS2339 error: Property 'bar' does not exist on type 'Baz'.
106691
- - lib/util.c:88:5 warning: unused variable 'tmp' [-Wunused-variable]
106692
-
106693
- C) Linters/Formatters (eslint, flake8, pylint, rubocop, golangci-lint, stylelint, mypy, black/prettier)
106694
- Include:
106695
- - Violations with file:line:col, rule/id, brief message.
106696
- - mypy type errors (treat as errors).
106697
- Ignore:
106698
- - "All matched files" summaries, formatter no-op messages.
106699
- Example bullet:
106700
- - src/app.tsx:17:9 eslint(no-unused-vars): 'user' is assigned a value but never used.
106701
-
106702
- D) Runtime/Execution Errors (node, python, java, go, ruby, dotnet, shell)
106703
- Include:
106704
- - Error type/name and message.
106705
- - Top 1-3 stack frames in user code; include "Caused by" chains.
106706
- - Non-zero exit status if visible.
106707
- - Immediate context like the command that failed, "Traceback" introductions, and leading log lines that explain the failure.
106708
- Ignore:
106709
- - Long internal/framework stacks unless they are the only frames available.
106710
- Example bullet:
106711
- - RuntimeError: connection refused at services/db.py:54 (exit status 1)
106712
-
106713
- E) Package/Build Systems (npm/yarn/pnpm, pip/pipenv, poetry, cargo, maven, gradle)
106714
- Include:
106715
- - Install/build failures, script failures, postinstall errors.
106716
- - Security advisories at high/critical severity (count + top advisory IDs).
106717
- - Missing/invalid peer dependency errors that break install/build.
106718
- Ignore:
106719
- - Progress bars, fetch logs, cache hits, "up to date" lines.
106720
- Example bullet:
106721
- - npm ERR! test script failed: "jest --runInBand" (code 1)
106722
-
106723
- F) VCS and CI (git, gh, svn; CI logs)
106724
- Include:
106725
- - Merge/rebase conflicts (files and conflict markers).
106726
- - Push rejections (non-fast-forward, auth failures).
106727
- - CI job failures (job name, failing step, error excerpt).
106728
- Ignore:
106729
- - Clean status, branch listings unless indicating a problem.
106730
- Example bullet:
106731
- - Merge conflict: src/index.ts (markers found around lines ~120-145)
106732
-
106733
- G) Containers/Orchestration (docker, podman, kubectl, helm)
106734
- Include:
106735
- - Build failures (failed stages, missing files), run-time exit codes.
106736
- - Kubernetes apply errors and crashloop events with reason.
106737
- Ignore:
106738
- - Layer download progress, pull status noise.
106739
- Example bullet:
106740
- - CrashLoopBackOff: pod api-7f6c... container "api" OOMKilled (restart 3/5)
106741
-
106742
- H) Databases/SQL/Migrations (psql, mysql, sqlite, prisma, liquibase, flyway)
106743
- Include:
106744
- - SQLSTATE/error codes, constraint violations, migration failure details.
106745
- Example bullet:
106746
- - SQLSTATE 23505 unique_violation on users(email) at 2025-09-11T03:22Z
106747
-
106748
- 5) Counts and Grouping
106749
- - If 3+ similar diagnostics occur, summarize with a count and show 1-2 exemplars:
106750
- Example: "Type errors (7): e.g., src/a.ts:10 TS2322: Type 'X' is not assignable to 'Y'."
106751
- - When possible, group by file or rule to reduce noise.
106752
-
106753
- 6) Stack Traces
106754
- - Keep the Traceback/exception header and the topmost relevant frames pointing to project files (e.g., paths under src/, app/, lib/); retain tail frames when they convey the ultimate cause.
106755
- - Omit frames from node:internal, <anonymous>, site-packages/dist-packages unless they are the only frames.
106756
-
106757
- 7) Timeouts/Resource Failures
106758
- - If a timeout/OOM/segfault is detected, surface it prominently under Errors with the best short cause line.
106759
-
106760
- 8) When There Is Nothing Noteworthy
106761
- - If no errors, no warnings, and no failing tests are detected, output a single line:
106762
- "No issues found."
106763
- - Do NOT restate benign status like "build succeeded" or "all tests passed".
106764
-
106765
- 9) Tone and Style
106766
- - Be precise and unemotional.
106767
- - Use short bullets; avoid prose paragraphs.
106768
- - ASCII only; no emojis; no tables.
106769
-
106770
-
106771
- Detection Heuristics (non-exhaustive)
106772
- - Errors: lines containing "error", "ERR!", "E ", "fatal", "Traceback", "Exception", "undefined reference", "cannot find symbol", "not found", "Segmentation fault", "panic:", "stack overflow".
106773
- - Warnings: lines containing "warning", "WARN", "deprecated", "note: this will be removed" (treat "note" as warning only if explicitly labeled).
106774
- - Test failures: lines with "FAIL", "FAILED", "Error", "AssertionError", "expect(", "--- FAIL:", "not ok", "Tests failed", or junit/pytest summaries with non-zero failures.
106775
-
106776
- Output Template
106777
- - Follow this shape; omit empty sections:
106778
-
106779
- Summary: exit_code=<code>; errors=<N>; warnings=<M>; failing_tests=<K>
106780
- Errors:
106781
- - <file:line:col> <diagnostic code if any> <short message>
106782
- - <next...>
106783
-
106784
- Test Failures:
106785
- - <suite or file> "<test name>": <assertion message or diff>; at <file:line[:col]>
106786
- - <next...>
106787
-
106788
- Warnings:
106789
- - <file:line:col> <rule/code>: <short message>
106790
-
106791
- Final Requirements
106792
- - Be concise, avoid repeating the same information.
106793
- - Ensure accuracy; never invent details not present in the input.
106794
- - Do not output tables unless explicitly asked.`;
106621
+ You are a command output summarizer. Analyze the provided command output, which is prefixed with line numbers and the stream name (stdout/stderr). Your task is to identify the most important lines, such as errors, failures, or key results.
106622
+
106623
+ The input is structured as follows:
106624
+ [line_number]: [stream]: [content]
106625
+
106626
+ Your output must be a JSON object containing the line number ranges of the most important lines for each stream. The JSON object should be enclosed in a markdown code block.
106627
+
106628
+ The JSON schema is as follows:
106629
+ {
106630
+ "stdout": [[start_line, end_line], ...],
106631
+ "stderr": [[start_line, end_line], ...]
106632
+ }
106633
+
106634
+ - Only include lines that are important for understanding the outcome of the command.
106635
+ - Group consecutive lines into a single range.
106636
+
106637
+ Example Output:
106638
+ \`\`\`json
106639
+ {
106640
+ "stdout": [[1, 3], [5, 7], [9, 11]],
106641
+ "stderr": [[1, 2], [4, 5]]
106642
+ }
106643
+ `;
106644
+ var schema = exports_external.object({
106645
+ stdout: exports_external.array(exports_external.array(exports_external.number()).length(2)).default([]),
106646
+ stderr: exports_external.array(exports_external.array(exports_external.number()).length(2)).default([])
106647
+ });
106795
106648
  var summarizeOutput = async (model, stdout, stderr) => {
106796
- const resp = await generateText({
106797
- model,
106798
- system: prompt3,
106799
- prompt: `<stdout>
106800
- ${stdout}
106801
- </stdout>
106802
- <stderr>
106803
- ${stderr}
106804
- </stderr>`
106805
- });
106806
- return resp.text;
106649
+ const lines = [];
106650
+ let input = "";
106651
+ let lineNumber = 1;
106652
+ for (const line of stdout.split(`
106653
+ `)) {
106654
+ lines.push(line);
106655
+ input += `[${lineNumber}]: stdout: ${line}
106656
+ `;
106657
+ lineNumber++;
106658
+ }
106659
+ for (const line of stderr.split(`
106660
+ `)) {
106661
+ lines.push(line);
106662
+ input += `[${lineNumber}]: stderr: ${line}
106663
+ `;
106664
+ lineNumber++;
106665
+ }
106666
+ let lastError;
106667
+ let respText = "";
106668
+ let currentPrompt = input;
106669
+ for (let i = 0;i < 3; i++) {
106670
+ const resp = await generateText({
106671
+ model,
106672
+ system: prompt3,
106673
+ prompt: currentPrompt
106674
+ });
106675
+ respText = resp.text;
106676
+ try {
106677
+ const parsed = parseJsonFromMarkdown(respText);
106678
+ const { stdout: stdoutRanges, stderr: stderrRanges } = schema.parse(parsed || {});
106679
+ let summarizedStdout = "";
106680
+ for (const range of stdoutRanges) {
106681
+ const [start, end] = range;
106682
+ for (let i2 = start;i2 <= end; i2++) {
106683
+ summarizedStdout += `${lines[i2 - 1]}
106684
+ `;
106685
+ }
106686
+ }
106687
+ let summarizedStderr = "";
106688
+ for (const range of stderrRanges) {
106689
+ const [start, end] = range;
106690
+ for (let i2 = start;i2 <= end; i2++) {
106691
+ summarizedStderr += `${lines[i2 - 1]}
106692
+ `;
106693
+ }
106694
+ }
106695
+ if (!summarizedStdout && !summarizedStderr) {
106696
+ throw new Error("You must output at least one line of stdout or stderr");
106697
+ }
106698
+ let result = "";
106699
+ if (summarizedStdout) {
106700
+ result += `STDOUT:
106701
+ ${summarizedStdout}`;
106702
+ }
106703
+ if (summarizedStderr) {
106704
+ if (result) {
106705
+ result += `
106706
+
106707
+ `;
106708
+ }
106709
+ result += `STDERR:
106710
+ ${summarizedStderr}`;
106711
+ }
106712
+ return result;
106713
+ } catch (error43) {
106714
+ lastError = error43 instanceof Error ? error43 : new Error(String(error43));
106715
+ currentPrompt = `${input}
106716
+
106717
+ Your previous output was invalid: ${lastError.message}. You MUST output a valid JSON object inside a markdown code block. Please correct it.`;
106718
+ }
106719
+ }
106720
+ throw new Error("Unable to summarize output");
106807
106721
  };
106808
106722
 
106809
106723
  // src/getProviderOptions.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli",
3
- "version": "0.9.38",
3
+ "version": "0.9.39",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",