itworksbut 0.7.0 → 0.7.1

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": "itworksbut",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Static CI checks for common security, repo, dependency, build, and deployment risks in JavaScript vibe coding projects.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,7 +13,7 @@
13
13
  "itworksbut.config.json"
14
14
  ],
15
15
  "engines": {
16
- "node": ">=20"
16
+ "node": ">=26"
17
17
  },
18
18
  "scripts": {
19
19
  "test": "node --test",
@@ -36,7 +36,10 @@
36
36
  ],
37
37
  "license": "MIT",
38
38
  "dependencies": {
39
- "artillery": "^2.0.30",
39
+ "@smithy/config-resolver": "4.5.3",
40
+ "@smithy/node-config-provider": "4.4.3",
41
+ "@smithy/property-provider": "4.2.3",
42
+ "artillery": "2.0.30",
40
43
  "boxen": "^8.0.1",
41
44
  "chalk": "^5.6.2",
42
45
  "cli-table3": "^0.6.5",
@@ -36,9 +36,10 @@ export async function runStressCommand(args, options = {}) {
36
36
 
37
37
  export async function runStress(options, runnerOptions = {}) {
38
38
  const startedAt = new Date();
39
- const discovery = await discoverEndpoints(options.rootPath);
39
+ const discovery = withExplicitTargetEndpoint(await discoverEndpoints(options.rootPath), options.targetPath);
40
40
  const baseDetails = {
41
41
  target: options.target,
42
+ artilleryTarget: options.artilleryTarget || options.target,
42
43
  duration: options.duration,
43
44
  arrivalRate: options.arrivalRate,
44
45
  maxVusers: options.maxVusers,
@@ -77,7 +78,7 @@ export async function runStress(options, runnerOptions = {}) {
77
78
  }
78
79
 
79
80
  const config = createArtilleryConfig({
80
- target: options.target,
81
+ target: options.artilleryTarget || options.target,
81
82
  duration: options.duration,
82
83
  arrivalRate: options.arrivalRate,
83
84
  maxVusers: options.maxVusers,
@@ -112,3 +113,30 @@ function stressResult(result) {
112
113
  ...result
113
114
  };
114
115
  }
116
+
117
+ function withExplicitTargetEndpoint(discovery, targetPath) {
118
+ if (!targetPath) return discovery;
119
+ if (discovery.endpoints.some((endpoint) => endpoint.method === "GET" && endpoint.path === targetPath)) {
120
+ return discovery;
121
+ }
122
+
123
+ const explicitEndpoint = {
124
+ method: "GET",
125
+ path: targetPath,
126
+ source: "--target",
127
+ type: "explicit-target",
128
+ dynamic: false,
129
+ status: "selected"
130
+ };
131
+
132
+ return {
133
+ status: "pass",
134
+ endpoints: sortEndpoints([...discovery.endpoints, explicitEndpoint]),
135
+ safeEndpoints: sortEndpoints([...discovery.safeEndpoints, explicitEndpoint]),
136
+ skippedEndpoints: discovery.skippedEndpoints
137
+ };
138
+ }
139
+
140
+ function sortEndpoints(endpoints) {
141
+ return [...endpoints].sort((a, b) => `${a.method} ${a.path}`.localeCompare(`${b.method} ${b.path}`));
142
+ }
@@ -15,6 +15,8 @@ export const STRESS_LIMITS = {
15
15
 
16
16
  export function validateStressOptions(args = {}) {
17
17
  const target = normalizeTarget(args.target || STRESS_DEFAULTS.target);
18
+ const parsedTarget = new URL(target);
19
+ const targetPath = getExplicitTargetPath(parsedTarget);
18
20
  const duration = parsePositiveNumber(args.duration, STRESS_DEFAULTS.duration, "duration");
19
21
  const arrivalRate = parsePositiveNumber(args.arrivalRate, STRESS_DEFAULTS.arrivalRate, "arrival-rate");
20
22
  const maxVusers = parsePositiveInteger(args.maxVusers, STRESS_DEFAULTS.maxVusers, "max-vusers");
@@ -32,6 +34,8 @@ export function validateStressOptions(args = {}) {
32
34
 
33
35
  return {
34
36
  target,
37
+ artilleryTarget: targetPath ? parsedTarget.origin : target,
38
+ targetPath,
35
39
  duration,
36
40
  arrivalRate,
37
41
  maxVusers,
@@ -66,6 +70,12 @@ function normalizeTarget(value) {
66
70
  return parsed.toString().replace(/\/$/, "");
67
71
  }
68
72
 
73
+ function getExplicitTargetPath(parsed) {
74
+ const pathname = parsed.pathname.replace(/\/$/, "") || "/";
75
+ if (pathname === "/" && !parsed.search) return null;
76
+ return `${pathname}${parsed.search}`;
77
+ }
78
+
69
79
  function parsePositiveNumber(value, fallback, label) {
70
80
  if (value === undefined || value === null || value === "") return fallback;
71
81
  const number = Number(value);