Skip to content

Commit cf02a12

Browse files
mtorpjdalton
andauthored
Rename --dont-apply-fixes to --no-apply-fixes (#743)
* use --no-apply-fixes instead of --dont-apply-fixes for consistency with other flags * fix merge --------- Co-authored-by: John-David Dalton <jdalton@users.noreply.github.com>
1 parent fcc8f65 commit cf02a12

File tree

5 files changed

+24
-15
lines changed

5 files changed

+24
-15
lines changed

src/commands/fix/cmd-fix.mts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ const generalFlags: MeowFlags = {
5252
'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',
5353
)} for managing auto-merge for pull requests in your repository.`,
5454
},
55-
dontApplyFixes: {
55+
applyFixes: {
5656
aliases: ['onlyCompute'],
5757
type: 'boolean',
58-
default: false,
58+
default: true,
5959
description:
6060
'Compute fixes only, do not apply them. Logs what upgrades would be applied. If combined with --output-file, the output file will contain the upgrades that would be applied.',
61+
// Hidden to allow custom documenting of the negated `--no-apply-fixes` variant.
62+
hidden: true,
6163
},
6264
id: {
6365
type: 'string',
@@ -182,7 +184,14 @@ async function run(
182184
${getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME}`)}
183185
184186
Options
185-
${getFlagListOutput(config.flags)}
187+
${getFlagListOutput({
188+
...config.flags,
189+
// Explicitly document the negated --no-apply-fixes variant.
190+
noApplyFixes: {
191+
...config.flags['applyFixes'],
192+
hidden: false,
193+
} as MeowFlag,
194+
})}
186195
187196
Environment Variables (for CI/PR mode)
188197
CI Set to enable CI mode
@@ -208,8 +217,8 @@ async function run(
208217
)
209218

210219
const {
220+
applyFixes,
211221
autopilot,
212-
dontApplyFixes,
213222
glob,
214223
json,
215224
limit,
@@ -223,7 +232,7 @@ async function run(
223232
unknownFlags = [],
224233
} = cli.flags as {
225234
autopilot: boolean
226-
dontApplyFixes: boolean
235+
applyFixes: boolean
227236
glob: string
228237
limit: number
229238
json: boolean
@@ -292,7 +301,7 @@ async function run(
292301

293302
await handleFix({
294303
autopilot,
295-
dontApplyFixes,
304+
applyFixes,
296305
cwd,
297306
ghsas,
298307
glob,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ describe('socket fix', async () => {
172172
Options
173173
--autopilot Enable auto-merge for pull requests that Socket opens.
174174
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.
175-
--dont-apply-fixes Compute fixes only, do not apply them. Logs what upgrades would be applied. If combined with --output-file, the output file will contain the upgrades that would be applied.
176175
--id Provide a list of vulnerability identifiers to compute fixes for:
177176
- GHSA IDs (https://docs.github.com/en/code-security/security-advisories/working-with-global-security-advisories-from-the-github-advisory-database/about-the-github-advisory-database#about-ghsa-ids) (e.g., GHSA-xxxx-xxxx-xxxx)
178177
- CVE IDs (https://cve.mitre.org/cve/identifiers/) (e.g., CVE-2025-1234) - automatically converted to GHSA
@@ -181,6 +180,7 @@ describe('socket fix', async () => {
181180
--json Output as JSON
182181
--limit The number of fixes to attempt at a time (default 10)
183182
--markdown Output as Markdown
183+
--no-apply-fixes Compute fixes only, do not apply them. Logs what upgrades would be applied. If combined with --output-file, the output file will contain the upgrades that would be applied.
184184
--output-file Path to store upgrades as a JSON file at this path.
185185
--range-style Define how dependency version ranges are updated in package.json (default 'preserve').
186186
Available styles:

src/commands/fix/coana-fix.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ export async function coanaFix(
4343
fixConfig: FixConfig,
4444
): Promise<CResult<{ fixed: boolean }>> {
4545
const {
46+
applyFixes,
4647
autopilot,
4748
cwd,
48-
dontApplyFixes,
4949
ghsas,
5050
glob,
5151
limit,
@@ -106,7 +106,7 @@ export async function coanaFix(
106106

107107
if (!shouldOpenPrs) {
108108
// Inform user about local mode when fixes will be applied.
109-
if (!dontApplyFixes && ghsas.length) {
109+
if (applyFixes && ghsas.length) {
110110
const envCheck = checkCiEnvVars()
111111
if (envCheck.present.length) {
112112
// Some CI vars are set but not all - show what's missing.
@@ -143,7 +143,7 @@ export async function coanaFix(
143143
? ['--range-style', fixConfig.rangeStyle]
144144
: []),
145145
...(glob ? ['--glob', glob] : []),
146-
...(dontApplyFixes ? [FLAG_DRY_RUN] : []),
146+
...(!applyFixes ? [FLAG_DRY_RUN] : []),
147147
...(outputFile ? ['--output-file', outputFile] : []),
148148
...fixConfig.unknownFlags,
149149
],

src/commands/fix/handle-fix.mts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const CVE_FORMAT_REGEXP = /^CVE-\d{4}-\d{4,}$/
1616

1717
export type HandleFixConfig = Remap<
1818
FixConfig & {
19-
dontApplyFixes: boolean
19+
applyFixes: boolean
2020
ghsas: string[]
2121
glob: string
2222
orgSlug: string
@@ -98,9 +98,9 @@ export async function convertIdsToGhsas(ids: string[]): Promise<string[]> {
9898
}
9999

100100
export async function handleFix({
101+
applyFixes,
101102
autopilot,
102103
cwd,
103-
dontApplyFixes,
104104
ghsas,
105105
glob,
106106
limit,
@@ -121,7 +121,7 @@ export async function handleFix({
121121
glob,
122122
limit,
123123
minSatisfying,
124-
dontApplyFixes,
124+
applyFixes,
125125
outputFile,
126126
outputKind,
127127
prCheck,
@@ -132,7 +132,7 @@ export async function handleFix({
132132
await outputFixResult(
133133
await coanaFix({
134134
autopilot,
135-
dontApplyFixes,
135+
applyFixes,
136136
cwd,
137137
// Convert mixed CVE/GHSA/PURL inputs to GHSA IDs only
138138
ghsas: await convertIdsToGhsas(ghsas),

src/commands/fix/types.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Spinner } from '@socketsecurity/registry/lib/spinner'
33

44
export type FixConfig = {
55
autopilot: boolean
6-
dontApplyFixes: boolean
6+
applyFixes: boolean
77
cwd: string
88
ghsas: string[]
99
glob: string

0 commit comments

Comments
 (0)