Skip to content

Commit 8fb5e6e

Browse files
authored
fix(fix): make --ecosystems case-insensitive (#1308)
* fix(fix): make --ecosystems case-insensitive Lowercase --ecosystems input before validation so values like NPM, Npm, and npm are all accepted, mirroring --package-managers behavior. Update help text accordingly and bump patch version. * upgrading coana to version 15.2.4
1 parent 2459583 commit 8fb5e6e

5 files changed

Lines changed: 37 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

7+
## [1.1.93](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.93) - 2026-05-08
8+
9+
### Changed
10+
- `socket fix --ecosystems` now accepts values case-insensitively (e.g. `NPM`, `npm`, and `Npm` are all valid), matching the existing behavior of `--package-managers`.
11+
- Updated the Coana CLI to v `15.2.4`.
12+
713
## [1.1.92](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.92) - 2026-05-05
814

915
### Changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "socket",
3-
"version": "1.1.92",
3+
"version": "1.1.93",
44
"description": "CLI for Socket.dev",
55
"homepage": "https://github.com/SocketDev/socket-cli",
66
"license": "MIT AND OFL-1.1",
@@ -97,7 +97,7 @@
9797
"@babel/preset-typescript": "7.27.1",
9898
"@babel/runtime": "7.28.4",
9999
"@biomejs/biome": "2.2.4",
100-
"@coana-tech/cli": "15.2.2",
100+
"@coana-tech/cli": "15.2.4",
101101
"@cyclonedx/cdxgen": "12.1.2",
102102
"@dotenvx/dotenvx": "1.49.0",
103103
"@eslint/compat": "1.3.2",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/fix/cmd-fix.integration.test.mts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ describe('socket fix', async () => {
168168
See GitHub documentation (https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository) for managing auto-merge for pull requests in your repository.
169169
--debug Enable debug logging in the Coana-based Socket Fix CLI invocation.
170170
--disable-external-tool-checks Disable external tool checks during fix analysis.
171-
--ecosystems Limit fix analysis to specific ecosystems. Can be provided as comma separated values or as multiple flags. Defaults to all ecosystems.
171+
--ecosystems Limit fix analysis to specific ecosystems. Accepts space- or comma-separated values and is case-insensitive. Defaults to all ecosystems.
172172
--exclude Exclude workspaces matching these glob patterns. Can be provided as comma separated values or as multiple flags
173173
--fix-version Override the version of @coana-tech/cli used for fix analysis. Default: <coana-version>.
174174
--id Provide a list of vulnerability identifiers to compute fixes for:
@@ -1109,6 +1109,23 @@ describe('socket fix', async () => {
11091109
},
11101110
)
11111111

1112+
cmdit(
1113+
[
1114+
'fix',
1115+
FLAG_DRY_RUN,
1116+
'--ecosystems',
1117+
'NPM,PyPI',
1118+
FLAG_CONFIG,
1119+
'{"apiToken":"fakeToken"}',
1120+
],
1121+
'should accept --ecosystems case-insensitively',
1122+
async cmd => {
1123+
const { code, stdout } = await spawnSocketCli(binCliPath, cmd)
1124+
expect(stdout).toMatchInlineSnapshot(`"[DryRun]: Not saving"`)
1125+
expect(code, 'should exit with code 0').toBe(0)
1126+
},
1127+
)
1128+
11121129
cmdit(
11131130
[
11141131
'fix',

src/commands/fix/cmd-fix.mts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Available styles:
168168
type: 'string',
169169
default: [],
170170
description:
171-
'Limit fix analysis to specific ecosystems. Can be provided as comma separated values or as multiple flags. Defaults to all ecosystems.',
171+
'Limit fix analysis to specific ecosystems. Accepts space- or comma-separated values and is case-insensitive. Defaults to all ecosystems.',
172172
isMultiple: true,
173173
},
174174
packageManagers: {
@@ -367,7 +367,11 @@ async function run(
367367
const outputKind = getOutputKind(json, markdown)
368368

369369
// Process comma-separated values for ecosystems flag.
370-
const ecosystemsRaw = cmdFlagValueToArray(ecosystems)
370+
// ALL_ECOSYSTEMS is lowercase, so normalize input for a case-insensitive
371+
// match (mirrors --package-managers behavior).
372+
const ecosystemsRaw = cmdFlagValueToArray(ecosystems).map(s =>
373+
s.toLowerCase(),
374+
)
371375

372376
// Validate ecosystem values early, before dry-run check.
373377
const validatedEcosystems: PURL_Type[] = []

0 commit comments

Comments
 (0)