@imdeadpool/guardex 7.0.19 → 7.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imdeadpool/guardex",
3
- "version": "7.0.19",
3
+ "version": "7.0.20",
4
4
  "description": "Guardian T-Rex for your multi-agent repo. Isolated worktrees, file locks, and PR-only merges stop parallel Codex & Claude agents from overwriting each other's work. Auto-wires Oh My Codex, Oh My Claude, OpenSpec, and Caveman.",
5
5
  "license": "MIT",
6
6
  "preferGlobal": true,
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "files": [
40
40
  "bin",
41
+ "src",
41
42
  "templates",
42
43
  "README.md",
43
44
  "LICENSE",
@@ -0,0 +1,7 @@
1
+ function parseDoctorArgs(rawArgs, options = {}) {
2
+ return { rawArgs, options };
3
+ }
4
+
5
+ module.exports = {
6
+ parseDoctorArgs,
7
+ };
@@ -0,0 +1,86 @@
1
+ const {
2
+ TOOL_NAME,
3
+ COMMAND_TYPO_ALIASES,
4
+ DEPRECATED_COMMAND_ALIASES,
5
+ SUGGESTIBLE_COMMANDS,
6
+ } = require('../context');
7
+
8
+ function levenshteinDistance(a, b) {
9
+ const rows = a.length + 1;
10
+ const cols = b.length + 1;
11
+ const matrix = Array.from({ length: rows }, () => Array(cols).fill(0));
12
+
13
+ for (let i = 0; i < rows; i += 1) matrix[i][0] = i;
14
+ for (let j = 0; j < cols; j += 1) matrix[0][j] = j;
15
+
16
+ for (let i = 1; i < rows; i += 1) {
17
+ for (let j = 1; j < cols; j += 1) {
18
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
19
+ matrix[i][j] = Math.min(
20
+ matrix[i - 1][j] + 1,
21
+ matrix[i][j - 1] + 1,
22
+ matrix[i - 1][j - 1] + cost,
23
+ );
24
+ }
25
+ }
26
+ return matrix[a.length][b.length];
27
+ }
28
+
29
+ function maybeSuggestCommand(command) {
30
+ let best = null;
31
+ let bestDistance = Number.POSITIVE_INFINITY;
32
+
33
+ for (const candidate of SUGGESTIBLE_COMMANDS) {
34
+ const dist = levenshteinDistance(command, candidate);
35
+ if (dist < bestDistance) {
36
+ bestDistance = dist;
37
+ best = candidate;
38
+ }
39
+ }
40
+
41
+ if (best && bestDistance <= 2) {
42
+ return best;
43
+ }
44
+
45
+ return null;
46
+ }
47
+
48
+ function normalizeCommandOrThrow(command) {
49
+ if (COMMAND_TYPO_ALIASES.has(command)) {
50
+ const mapped = COMMAND_TYPO_ALIASES.get(command);
51
+ console.log(`[${TOOL_NAME}] Interpreting '${command}' as '${mapped}'.`);
52
+ return mapped;
53
+ }
54
+ return command;
55
+ }
56
+
57
+ function warnDeprecatedAlias(aliasName) {
58
+ const entry = DEPRECATED_COMMAND_ALIASES.get(aliasName);
59
+ if (!entry) return;
60
+ console.error(
61
+ `[${TOOL_NAME}] '${aliasName}' is deprecated and will be removed in a future major release. ` +
62
+ `Use: ${entry.hint}`,
63
+ );
64
+ }
65
+
66
+ function extractFlag(args, ...names) {
67
+ const flagSet = new Set(names);
68
+ let found = false;
69
+ const remaining = [];
70
+ for (const arg of args) {
71
+ if (flagSet.has(arg)) {
72
+ found = true;
73
+ } else {
74
+ remaining.push(arg);
75
+ }
76
+ }
77
+ return { found, remaining };
78
+ }
79
+
80
+ module.exports = {
81
+ levenshteinDistance,
82
+ maybeSuggestCommand,
83
+ normalizeCommandOrThrow,
84
+ warnDeprecatedAlias,
85
+ extractFlag,
86
+ };