@wrongstack/plugins 0.257.2 → 0.264.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.
@@ -164,9 +164,10 @@ var plugin = {
164
164
  const includeModel = input["includeModel"] ?? true;
165
165
  if (format === "csv") {
166
166
  const header = includeModel ? "model,timestamp,prompt_tokens,completion_tokens,total_tokens,cost_usd" : "timestamp,prompt_tokens,completion_tokens,total_tokens,cost_usd";
167
- const rows = sessionCost.requests.map(
168
- (r) => includeModel ? `${r.model},${r.timestamp},${r.promptTokens},${r.completionTokens},${r.totalTokens},${r.costUsd ?? 0}` : `${r.timestamp},${r.promptTokens},${r.completionTokens},${r.totalTokens},${r.costUsd ?? 0}`
169
- );
167
+ const rows = sessionCost.requests.map((r) => {
168
+ const cost = r.costUsd ?? 0;
169
+ return includeModel ? `${r.model},${r.timestamp},${r.promptTokens},${r.completionTokens},${r.totalTokens},${cost}` : `${r.timestamp},${r.promptTokens},${r.completionTokens},${r.totalTokens},${cost}`;
170
+ });
170
171
  return {
171
172
  ok: true,
172
173
  format: "csv",
@@ -273,6 +273,7 @@ ${stagedDiff}
273
273
  hash: String(hash),
274
274
  commitType: type,
275
275
  scope: String(scope ?? ""),
276
+ /* v8 ignore next -- staged is always an array here; the : [] fallback is defensive. */
276
277
  files: Array.isArray(staged) ? staged : [],
277
278
  warning: warning ?? null
278
279
  });
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import { isAbsolute, join } from 'path';
5
5
  import { expectDefined, deepMerge as deepMerge$1, isPrivateIPv4, isPrivateIPv6 } from '@wrongstack/core';
6
6
  import { lookup } from 'dns/promises';
7
7
  import { isIPv4, isIPv6 } from 'net';
8
+ import { toErrorMessage } from '@wrongstack/core/utils';
8
9
 
9
10
  // src/auto-doc/index.ts
10
11
  var AUTO_DOC_API_VERSION = "^0.1.10";
@@ -514,6 +515,7 @@ ${stagedDiff}
514
515
  hash: String(hash),
515
516
  commitType: type,
516
517
  scope: String(scope ?? ""),
518
+ /* v8 ignore next -- staged is always an array here; the : [] fallback is defensive. */
517
519
  files: Array.isArray(staged) ? staged : [],
518
520
  warning: warning ?? null
519
521
  });
@@ -681,13 +683,8 @@ function runShellCheck(files, severity, cwd) {
681
683
  info: "info",
682
684
  style: "style"
683
685
  };
684
- const args = [
685
- "-f",
686
- "json",
687
- "-S",
688
- levelMap[severity] ?? "warning",
689
- ...files
690
- ];
686
+ const severityFlag = levelMap[severity] ?? "warning";
687
+ const args = ["-f", "json", "-S", severityFlag, ...files];
691
688
  let raw;
692
689
  try {
693
690
  raw = execFileSync("shellcheck", args, {
@@ -1054,9 +1051,10 @@ var plugin4 = {
1054
1051
  const includeModel = input["includeModel"] ?? true;
1055
1052
  if (format === "csv") {
1056
1053
  const header = includeModel ? "model,timestamp,prompt_tokens,completion_tokens,total_tokens,cost_usd" : "timestamp,prompt_tokens,completion_tokens,total_tokens,cost_usd";
1057
- const rows = sessionCost.requests.map(
1058
- (r) => includeModel ? `${r.model},${r.timestamp},${r.promptTokens},${r.completionTokens},${r.totalTokens},${r.costUsd ?? 0}` : `${r.timestamp},${r.promptTokens},${r.completionTokens},${r.totalTokens},${r.costUsd ?? 0}`
1059
- );
1054
+ const rows = sessionCost.requests.map((r) => {
1055
+ const cost = r.costUsd ?? 0;
1056
+ return includeModel ? `${r.model},${r.timestamp},${r.promptTokens},${r.completionTokens},${r.totalTokens},${cost}` : `${r.timestamp},${r.promptTokens},${r.completionTokens},${r.totalTokens},${cost}`;
1057
+ });
1060
1058
  return {
1061
1059
  ok: true,
1062
1060
  format: "csv",
@@ -1550,7 +1548,8 @@ var plugin6 = {
1550
1548
  }
1551
1549
  const deduplicated = [];
1552
1550
  for (const r of rawResults) {
1553
- const normalized = (r.url.split("?")[0] ?? r.url).split("#")[0] ?? r.url;
1551
+ const noQuery = r.url.split("?")[0] ?? r.url;
1552
+ const normalized = noQuery.split("#")[0] ?? r.url;
1554
1553
  if (!seenUrls.has(normalized) && r.url.startsWith("http")) {
1555
1554
  seenUrls.add(normalized);
1556
1555
  deduplicated.push(r);
@@ -1675,6 +1674,7 @@ function jmespathSearch(data, query) {
1675
1674
  return Number(itemVal) >= Number(cmpVal);
1676
1675
  case "<=":
1677
1676
  return Number(itemVal) <= Number(cmpVal);
1677
+ /* v8 ignore next -- op is constrained to the six operators by the filter regex; default is unreachable. */
1678
1678
  default:
1679
1679
  return true;
1680
1680
  }
@@ -1701,6 +1701,7 @@ function jmespathSearch(data, query) {
1701
1701
  if (data === null) return "null";
1702
1702
  if (Array.isArray(data)) return "array";
1703
1703
  return typeof data;
1704
+ /* v8 ignore next 2 -- fn is constrained to the four names by the function regex; default is unreachable. */
1704
1705
  default:
1705
1706
  return null;
1706
1707
  }
@@ -1743,7 +1744,9 @@ function validateJsonSchema(data, schema) {
1743
1744
  errors.push(`${path2}: above maximum ${s["maximum"]}`);
1744
1745
  }
1745
1746
  if (Array.isArray(value) && s["items"] && Array.isArray(s["items"])) {
1746
- value.forEach((item, i) => check(item, s["items"], `${path2}[${i}]`));
1747
+ for (let i = 0; i < value.length; i++) {
1748
+ check(value[i], s["items"], `${path2}[${i}]`);
1749
+ }
1747
1750
  }
1748
1751
  if (typeof value === "object" && value !== null && !Array.isArray(value) && s["properties"]) {
1749
1752
  const props = s["properties"];
@@ -2584,7 +2587,7 @@ var plugin10 = {
2584
2587
  try {
2585
2588
  commits = getRecentCommits(lastTag, cwd);
2586
2589
  } catch (err) {
2587
- const msg = err instanceof Error ? err.message : String(err);
2590
+ const msg = toErrorMessage(err);
2588
2591
  return { ok: false, error: `Git error: ${msg}`, bumpPart: "patch" };
2589
2592
  }
2590
2593
  bumpPart = determineBump(commits);
@@ -2615,7 +2618,7 @@ var plugin10 = {
2615
2618
  windowsHide: true
2616
2619
  });
2617
2620
  } catch (err) {
2618
- const msg = err instanceof Error ? err.message : String(err);
2621
+ const msg = toErrorMessage(err);
2619
2622
  return { ok: false, error: `bump script failed: ${msg}` };
2620
2623
  }
2621
2624
  for (const rel of ["package.json", "package-lock.json", "src/lib/utils.ts", "index.html"]) {
package/dist/json-path.js CHANGED
@@ -61,6 +61,7 @@ function jmespathSearch(data, query) {
61
61
  return Number(itemVal) >= Number(cmpVal);
62
62
  case "<=":
63
63
  return Number(itemVal) <= Number(cmpVal);
64
+ /* v8 ignore next -- op is constrained to the six operators by the filter regex; default is unreachable. */
64
65
  default:
65
66
  return true;
66
67
  }
@@ -87,6 +88,7 @@ function jmespathSearch(data, query) {
87
88
  if (data === null) return "null";
88
89
  if (Array.isArray(data)) return "array";
89
90
  return typeof data;
91
+ /* v8 ignore next 2 -- fn is constrained to the four names by the function regex; default is unreachable. */
90
92
  default:
91
93
  return null;
92
94
  }
@@ -129,7 +131,9 @@ function validateJsonSchema(data, schema) {
129
131
  errors.push(`${path}: above maximum ${s["maximum"]}`);
130
132
  }
131
133
  if (Array.isArray(value) && s["items"] && Array.isArray(s["items"])) {
132
- value.forEach((item, i) => check(item, s["items"], `${path}[${i}]`));
134
+ for (let i = 0; i < value.length; i++) {
135
+ check(value[i], s["items"], `${path}[${i}]`);
136
+ }
133
137
  }
134
138
  if (typeof value === "object" && value !== null && !Array.isArray(value) && s["properties"]) {
135
139
  const props = s["properties"];
@@ -1,4 +1,5 @@
1
1
  import { expectDefined } from '@wrongstack/core';
2
+ import { toErrorMessage } from '@wrongstack/core/utils';
2
3
  import { execFileSync } from 'child_process';
3
4
  import { existsSync, readFileSync, writeFileSync, readdirSync } from 'fs';
4
5
  import { join } from 'path';
@@ -197,7 +198,7 @@ var plugin = {
197
198
  try {
198
199
  commits = getRecentCommits(lastTag, cwd);
199
200
  } catch (err) {
200
- const msg = err instanceof Error ? err.message : String(err);
201
+ const msg = toErrorMessage(err);
201
202
  return { ok: false, error: `Git error: ${msg}`, bumpPart: "patch" };
202
203
  }
203
204
  bumpPart = determineBump(commits);
@@ -228,7 +229,7 @@ var plugin = {
228
229
  windowsHide: true
229
230
  });
230
231
  } catch (err) {
231
- const msg = err instanceof Error ? err.message : String(err);
232
+ const msg = toErrorMessage(err);
232
233
  return { ok: false, error: `bump script failed: ${msg}` };
233
234
  }
234
235
  for (const rel of ["package.json", "package-lock.json", "src/lib/utils.ts", "index.html"]) {
@@ -18,13 +18,8 @@ function runShellCheck(files, severity, cwd) {
18
18
  info: "info",
19
19
  style: "style"
20
20
  };
21
- const args = [
22
- "-f",
23
- "json",
24
- "-S",
25
- levelMap[severity] ?? "warning",
26
- ...files
27
- ];
21
+ const severityFlag = levelMap[severity] ?? "warning";
22
+ const args = ["-f", "json", "-S", severityFlag, ...files];
28
23
  let raw;
29
24
  try {
30
25
  raw = execFileSync("shellcheck", args, {
@@ -190,7 +190,8 @@ var plugin = {
190
190
  }
191
191
  const deduplicated = [];
192
192
  for (const r of rawResults) {
193
- const normalized = (r.url.split("?")[0] ?? r.url).split("#")[0] ?? r.url;
193
+ const noQuery = r.url.split("?")[0] ?? r.url;
194
+ const normalized = noQuery.split("#")[0] ?? r.url;
194
195
  if (!seenUrls.has(normalized) && r.url.startsWith("http")) {
195
196
  seenUrls.add(normalized);
196
197
  deduplicated.push(r);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/plugins",
3
- "version": "0.257.2",
3
+ "version": "0.264.0",
4
4
  "description": "Official WrongStack plugin collection — auto-doc, git-autocommit, shell-check, cost-tracker, file-watcher, web-search, json-path, cron, template-engine, semver-bump",
5
5
  "license": "MIT",
6
6
  "author": "ECOSTACK TECHNOLOGY OÜ",
@@ -63,7 +63,7 @@
63
63
  "vitest": "^4.1.8"
64
64
  },
65
65
  "dependencies": {
66
- "@wrongstack/core": "0.257.2"
66
+ "@wrongstack/core": "0.264.0"
67
67
  },
68
68
  "scripts": {
69
69
  "build": "tsup",