@wrongstack/plugins 0.77.0 → 0.82.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auto-doc.js CHANGED
@@ -9,41 +9,42 @@ function parseSource(content) {
9
9
  const reType = /^(?:export\s+)?type\s+(\w+)\s*=\s*\{/;
10
10
  const reInterface = /^(?:export\s+)?interface\s+(\w+)/;
11
11
  for (let i = 0; i < lines.length; i++) {
12
- const line = lines[i].trim();
12
+ const line = lines[i]?.trim();
13
+ if (!line) continue;
13
14
  let m = line.match(reFunction);
14
- if (m) {
15
+ if (m?.[1]) {
15
16
  entities.push({
16
17
  kind: "function",
17
18
  name: m[1],
18
19
  startLine: i + 1,
19
- params: m[2] ? m[2].split(",").map((p) => p.trim().split(":")[0].trim()) : [],
20
+ params: m[2] ? m[2].split(",").map((p) => p.trim().split(":")[0]?.trim()).filter((p) => Boolean(p)) : [],
20
21
  returnType: m[3]?.trim()
21
22
  });
22
23
  continue;
23
24
  }
24
25
  m = line.match(reArrowFn);
25
- if (m) {
26
+ if (m?.[1]) {
26
27
  entities.push({
27
28
  kind: "function",
28
29
  name: m[1],
29
30
  startLine: i + 1,
30
- params: m[2] ? m[2].split(",").map((p) => p.trim().split(":")[0].trim()) : [],
31
+ params: m[2] ? m[2].split(",").map((p) => p.trim().split(":")[0]?.trim()).filter((p) => Boolean(p)) : [],
31
32
  returnType: m[3]?.trim()
32
33
  });
33
34
  continue;
34
35
  }
35
36
  m = line.match(reClass);
36
- if (m) {
37
+ if (m?.[1]) {
37
38
  entities.push({ kind: "class", name: m[1], startLine: i + 1 });
38
39
  continue;
39
40
  }
40
41
  m = line.match(reType);
41
- if (m) {
42
+ if (m?.[1]) {
42
43
  entities.push({ kind: "type", name: m[1], startLine: i + 1 });
43
44
  continue;
44
45
  }
45
46
  m = line.match(reInterface);
46
- if (m) {
47
+ if (m?.[1]) {
47
48
  entities.push({ kind: "interface", name: m[1], startLine: i + 1 });
48
49
  }
49
50
  }
@@ -1,4 +1,10 @@
1
1
  // src/cost-tracker/index.ts
2
+ function expectDefined(value) {
3
+ if (value === null || value === void 0) {
4
+ throw new Error("Expected value to be defined");
5
+ }
6
+ return value;
7
+ }
2
8
  var API_VERSION = "^0.1.10";
3
9
  var PRICING = {
4
10
  "gpt-4o": { input: 5, output: 15 },
@@ -71,7 +77,7 @@ var plugin = {
71
77
  if (sessionCost.byModel[model] === void 0) {
72
78
  sessionCost.byModel[model] = { tokens: 0, costUsd: 0, requests: 0 };
73
79
  }
74
- const slot = sessionCost.byModel[model];
80
+ const slot = expectDefined(sessionCost.byModel[model]);
75
81
  slot.tokens += totalTokens;
76
82
  slot.costUsd += costUsd;
77
83
  slot.requests += 1;
@@ -281,7 +281,7 @@ var plugin = {
281
281
  } catch {
282
282
  }
283
283
  try {
284
- recentCommits.push(...getCommitHistory("-3", void 0).map((c) => ({ hash: c.hash.slice(0, 7), message: c.message })));
284
+ recentCommits.push(...getCommitHistory("-3", void 0).map((c) => ({ hash: (c.hash ?? "").slice(0, 7), message: c.message })));
285
285
  } catch {
286
286
  }
287
287
  return {
package/dist/index.js CHANGED
@@ -16,41 +16,42 @@ function parseSource(content) {
16
16
  const reType = /^(?:export\s+)?type\s+(\w+)\s*=\s*\{/;
17
17
  const reInterface = /^(?:export\s+)?interface\s+(\w+)/;
18
18
  for (let i = 0; i < lines.length; i++) {
19
- const line = lines[i].trim();
19
+ const line = lines[i]?.trim();
20
+ if (!line) continue;
20
21
  let m = line.match(reFunction);
21
- if (m) {
22
+ if (m?.[1]) {
22
23
  entities.push({
23
24
  kind: "function",
24
25
  name: m[1],
25
26
  startLine: i + 1,
26
- params: m[2] ? m[2].split(",").map((p) => p.trim().split(":")[0].trim()) : [],
27
+ params: m[2] ? m[2].split(",").map((p) => p.trim().split(":")[0]?.trim()).filter((p) => Boolean(p)) : [],
27
28
  returnType: m[3]?.trim()
28
29
  });
29
30
  continue;
30
31
  }
31
32
  m = line.match(reArrowFn);
32
- if (m) {
33
+ if (m?.[1]) {
33
34
  entities.push({
34
35
  kind: "function",
35
36
  name: m[1],
36
37
  startLine: i + 1,
37
- params: m[2] ? m[2].split(",").map((p) => p.trim().split(":")[0].trim()) : [],
38
+ params: m[2] ? m[2].split(",").map((p) => p.trim().split(":")[0]?.trim()).filter((p) => Boolean(p)) : [],
38
39
  returnType: m[3]?.trim()
39
40
  });
40
41
  continue;
41
42
  }
42
43
  m = line.match(reClass);
43
- if (m) {
44
+ if (m?.[1]) {
44
45
  entities.push({ kind: "class", name: m[1], startLine: i + 1 });
45
46
  continue;
46
47
  }
47
48
  m = line.match(reType);
48
- if (m) {
49
+ if (m?.[1]) {
49
50
  entities.push({ kind: "type", name: m[1], startLine: i + 1 });
50
51
  continue;
51
52
  }
52
53
  m = line.match(reInterface);
53
- if (m) {
54
+ if (m?.[1]) {
54
55
  entities.push({ kind: "interface", name: m[1], startLine: i + 1 });
55
56
  }
56
57
  }
@@ -520,7 +521,7 @@ var plugin2 = {
520
521
  } catch {
521
522
  }
522
523
  try {
523
- recentCommits.push(...getCommitHistory("-3", void 0).map((c) => ({ hash: c.hash.slice(0, 7), message: c.message })));
524
+ recentCommits.push(...getCommitHistory("-3", void 0).map((c) => ({ hash: (c.hash ?? "").slice(0, 7), message: c.message })));
524
525
  } catch {
525
526
  }
526
527
  return {
@@ -675,7 +676,7 @@ var plugin3 = {
675
676
  if (byFile[issue.file] === void 0) {
676
677
  byFile[issue.file] = [];
677
678
  }
678
- byFile[issue.file].push(issue);
679
+ byFile[issue.file]?.push(issue);
679
680
  }
680
681
  const errorCount = issues.filter((i) => i.level === "error").length;
681
682
  const warningCount = issues.filter((i) => i.level === "warning").length;
@@ -744,7 +745,7 @@ var plugin3 = {
744
745
  if (byFile[issue.file] === void 0) {
745
746
  byFile[issue.file] = [];
746
747
  }
747
- byFile[issue.file].push(issue);
748
+ byFile[issue.file]?.push(issue);
748
749
  }
749
750
  return {
750
751
  ok: true,
@@ -766,6 +767,12 @@ var plugin3 = {
766
767
  var shell_check_default = plugin3;
767
768
 
768
769
  // src/cost-tracker/index.ts
770
+ function expectDefined(value) {
771
+ if (value === null || value === void 0) {
772
+ throw new Error("Expected value to be defined");
773
+ }
774
+ return value;
775
+ }
769
776
  var API_VERSION3 = "^0.1.10";
770
777
  var PRICING = {
771
778
  "gpt-4o": { input: 5, output: 15 },
@@ -838,7 +845,7 @@ var plugin4 = {
838
845
  if (sessionCost.byModel[model] === void 0) {
839
846
  sessionCost.byModel[model] = { tokens: 0, costUsd: 0, requests: 0 };
840
847
  }
841
- const slot = sessionCost.byModel[model];
848
+ const slot = expectDefined(sessionCost.byModel[model]);
842
849
  slot.tokens += totalTokens;
843
850
  slot.costUsd += costUsd;
844
851
  slot.requests += 1;
@@ -1504,13 +1511,19 @@ var plugin6 = {
1504
1511
  var web_search_default = plugin6;
1505
1512
 
1506
1513
  // src/json-path/index.ts
1514
+ function expectDefined2(value) {
1515
+ if (value === null || value === void 0) {
1516
+ throw new Error("Expected value to be defined");
1517
+ }
1518
+ return value;
1519
+ }
1507
1520
  var API_VERSION6 = "^0.1.10";
1508
1521
  function jmespathSearch(data, query) {
1509
1522
  if (!query || query === "@") return data;
1510
1523
  if (query === "$") return data;
1511
1524
  const dotMatch = query.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/);
1512
1525
  if (dotMatch) {
1513
- const key = dotMatch[1];
1526
+ const key = expectDefined2(dotMatch[1]);
1514
1527
  const rest = dotMatch[2];
1515
1528
  const val = data?.[key];
1516
1529
  if (rest === void 0) return val;
@@ -1518,7 +1531,7 @@ function jmespathSearch(data, query) {
1518
1531
  }
1519
1532
  const arrMatch = query.match(/^\[(\d+)\](?:\.(.+))?$/);
1520
1533
  if (arrMatch) {
1521
- const idx = Number.parseInt(arrMatch[1], 10);
1534
+ const idx = Number.parseInt(expectDefined2(arrMatch[1]), 10);
1522
1535
  const rest = arrMatch[2];
1523
1536
  const arr = data;
1524
1537
  const val = arr?.[idx];
@@ -1533,7 +1546,7 @@ function jmespathSearch(data, query) {
1533
1546
  }
1534
1547
  const multiMatch = query.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\*\](?:\.(.+))?$/);
1535
1548
  if (multiMatch) {
1536
- const key = multiMatch[1];
1549
+ const key = expectDefined2(multiMatch[1]);
1537
1550
  const rest = multiMatch[2];
1538
1551
  const arr = data?.[key];
1539
1552
  if (!Array.isArray(arr)) return [];
@@ -1542,9 +1555,9 @@ function jmespathSearch(data, query) {
1542
1555
  }
1543
1556
  const filterMatch = query.match(/^\[\\?([a-zA-Z_][a-zA-Z0-9_]*)(==|!=|<|>|<=|>=)(`[^`]+`|'[^']*')\](?:\.(.+))?$/);
1544
1557
  if (filterMatch) {
1545
- const field = filterMatch[1];
1546
- const op = filterMatch[2];
1547
- const rawVal = filterMatch[3];
1558
+ const field = expectDefined2(filterMatch[1]);
1559
+ const op = expectDefined2(filterMatch[2]);
1560
+ const rawVal = expectDefined2(filterMatch[3]);
1548
1561
  const rest = filterMatch[4];
1549
1562
  const cmpVal = JSON.parse(rawVal.slice(1, -1));
1550
1563
  const arr = data;
@@ -1573,7 +1586,7 @@ function jmespathSearch(data, query) {
1573
1586
  }
1574
1587
  const fnMatch = query.match(/^(length|keys|values|type)\(@\)$/);
1575
1588
  if (fnMatch) {
1576
- const fn = fnMatch[1];
1589
+ const fn = expectDefined2(fnMatch[1]);
1577
1590
  switch (fn) {
1578
1591
  case "length":
1579
1592
  if (Array.isArray(data)) return data.length;
@@ -2305,6 +2318,12 @@ var plugin9 = {
2305
2318
  }
2306
2319
  };
2307
2320
  var template_engine_default = plugin9;
2321
+ function expectDefined3(value) {
2322
+ if (value === null || value === void 0) {
2323
+ throw new Error("Expected value to be defined");
2324
+ }
2325
+ return value;
2326
+ }
2308
2327
  var API_VERSION9 = "^0.1.10";
2309
2328
  function runGit2(args, cwd) {
2310
2329
  try {
@@ -2332,7 +2351,7 @@ function getPackageJson(cwd) {
2332
2351
  function parseVersion(v) {
2333
2352
  const m = v.match(/^v?(\d+)\.(\d+)\.(\d+)/);
2334
2353
  if (!m) return [0, 0, 0];
2335
- return [Number.parseInt(m[1]), Number.parseInt(m[2]), Number.parseInt(m[3])];
2354
+ return [Number.parseInt(expectDefined3(m[1])), Number.parseInt(expectDefined3(m[2])), Number.parseInt(expectDefined3(m[3]))];
2336
2355
  }
2337
2356
  function bumpVersion(version, part) {
2338
2357
  let [major, minor, patch] = parseVersion(version);
package/dist/json-path.js CHANGED
@@ -1,11 +1,17 @@
1
1
  // src/json-path/index.ts
2
+ function expectDefined(value) {
3
+ if (value === null || value === void 0) {
4
+ throw new Error("Expected value to be defined");
5
+ }
6
+ return value;
7
+ }
2
8
  var API_VERSION = "^0.1.10";
3
9
  function jmespathSearch(data, query) {
4
10
  if (!query || query === "@") return data;
5
11
  if (query === "$") return data;
6
12
  const dotMatch = query.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(?:\.(.+))?$/);
7
13
  if (dotMatch) {
8
- const key = dotMatch[1];
14
+ const key = expectDefined(dotMatch[1]);
9
15
  const rest = dotMatch[2];
10
16
  const val = data?.[key];
11
17
  if (rest === void 0) return val;
@@ -13,7 +19,7 @@ function jmespathSearch(data, query) {
13
19
  }
14
20
  const arrMatch = query.match(/^\[(\d+)\](?:\.(.+))?$/);
15
21
  if (arrMatch) {
16
- const idx = Number.parseInt(arrMatch[1], 10);
22
+ const idx = Number.parseInt(expectDefined(arrMatch[1]), 10);
17
23
  const rest = arrMatch[2];
18
24
  const arr = data;
19
25
  const val = arr?.[idx];
@@ -28,7 +34,7 @@ function jmespathSearch(data, query) {
28
34
  }
29
35
  const multiMatch = query.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\*\](?:\.(.+))?$/);
30
36
  if (multiMatch) {
31
- const key = multiMatch[1];
37
+ const key = expectDefined(multiMatch[1]);
32
38
  const rest = multiMatch[2];
33
39
  const arr = data?.[key];
34
40
  if (!Array.isArray(arr)) return [];
@@ -37,9 +43,9 @@ function jmespathSearch(data, query) {
37
43
  }
38
44
  const filterMatch = query.match(/^\[\\?([a-zA-Z_][a-zA-Z0-9_]*)(==|!=|<|>|<=|>=)(`[^`]+`|'[^']*')\](?:\.(.+))?$/);
39
45
  if (filterMatch) {
40
- const field = filterMatch[1];
41
- const op = filterMatch[2];
42
- const rawVal = filterMatch[3];
46
+ const field = expectDefined(filterMatch[1]);
47
+ const op = expectDefined(filterMatch[2]);
48
+ const rawVal = expectDefined(filterMatch[3]);
43
49
  const rest = filterMatch[4];
44
50
  const cmpVal = JSON.parse(rawVal.slice(1, -1));
45
51
  const arr = data;
@@ -68,7 +74,7 @@ function jmespathSearch(data, query) {
68
74
  }
69
75
  const fnMatch = query.match(/^(length|keys|values|type)\(@\)$/);
70
76
  if (fnMatch) {
71
- const fn = fnMatch[1];
77
+ const fn = expectDefined(fnMatch[1]);
72
78
  switch (fn) {
73
79
  case "length":
74
80
  if (Array.isArray(data)) return data.length;
@@ -2,6 +2,12 @@ import { execFileSync } from 'child_process';
2
2
  import { existsSync, readFileSync } from 'fs';
3
3
 
4
4
  // src/semver-bump/index.ts
5
+ function expectDefined(value) {
6
+ if (value === null || value === void 0) {
7
+ throw new Error("Expected value to be defined");
8
+ }
9
+ return value;
10
+ }
5
11
  var API_VERSION = "^0.1.10";
6
12
  function runGit(args, cwd) {
7
13
  try {
@@ -29,7 +35,7 @@ function getPackageJson(cwd) {
29
35
  function parseVersion(v) {
30
36
  const m = v.match(/^v?(\d+)\.(\d+)\.(\d+)/);
31
37
  if (!m) return [0, 0, 0];
32
- return [Number.parseInt(m[1]), Number.parseInt(m[2]), Number.parseInt(m[3])];
38
+ return [Number.parseInt(expectDefined(m[1])), Number.parseInt(expectDefined(m[2])), Number.parseInt(expectDefined(m[3]))];
33
39
  }
34
40
  function bumpVersion(version, part) {
35
41
  let [major, minor, patch] = parseVersion(version);
@@ -138,7 +138,7 @@ var plugin = {
138
138
  if (byFile[issue.file] === void 0) {
139
139
  byFile[issue.file] = [];
140
140
  }
141
- byFile[issue.file].push(issue);
141
+ byFile[issue.file]?.push(issue);
142
142
  }
143
143
  const errorCount = issues.filter((i) => i.level === "error").length;
144
144
  const warningCount = issues.filter((i) => i.level === "warning").length;
@@ -207,7 +207,7 @@ var plugin = {
207
207
  if (byFile[issue.file] === void 0) {
208
208
  byFile[issue.file] = [];
209
209
  }
210
- byFile[issue.file].push(issue);
210
+ byFile[issue.file]?.push(issue);
211
211
  }
212
212
  return {
213
213
  ok: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/plugins",
3
- "version": "0.77.0",
3
+ "version": "0.82.6",
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.7"
64
64
  },
65
65
  "dependencies": {
66
- "@wrongstack/core": "0.77.0"
66
+ "@wrongstack/core": "0.82.6"
67
67
  },
68
68
  "scripts": {
69
69
  "build": "tsup",