specguard 0.1.2 → 0.1.3

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.
@@ -44,11 +44,13 @@ export function parseCommand(command) {
44
44
  if (current.length > 0) {
45
45
  args.push(current);
46
46
  }
47
- if (args.length === 0) {
48
- return { cmd: '', args: [] };
47
+ // Requirement: Ensure no empty string arguments
48
+ const filteredArgs = args.filter(arg => arg.length > 0);
49
+ if (filteredArgs.length === 0) {
50
+ throw new Error(`Invalid tool command: "${command}"`);
49
51
  }
50
52
  return {
51
- cmd: args[0],
52
- args: args.slice(1)
53
+ cmd: filteredArgs[0],
54
+ args: filteredArgs.slice(1)
53
55
  };
54
56
  }
@@ -132,6 +132,15 @@ export async function runToolChecks(spec, repoRoot) {
132
132
  }
133
133
  }
134
134
  }
135
+ // B) Tool runner safety
136
+ // 4) Assertions and filtering
137
+ if (!finalCmd) {
138
+ throw new Error('Command cannot be empty');
139
+ }
140
+ if (!Array.isArray(finalArgs)) {
141
+ throw new Error('Arguments must be an array');
142
+ }
143
+ finalArgs = finalArgs.filter(Boolean);
135
144
  const res = await runSpawn(finalCmd, finalArgs, cwd, env, tool.timeout_seconds, shell);
136
145
  const duration = Date.now() - startTime;
137
146
  // Redact output
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specguard",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Production-grade SpecGuard validator",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,4 +34,4 @@
34
34
  "@types/node": "^20.11.0",
35
35
  "vitest": "^4.0.18"
36
36
  }
37
- }
37
+ }