Skip to content

Commit 7d1b53d

Browse files
committed
Remove non-coana fix code
1 parent cde8649 commit 7d1b53d

10 files changed

Lines changed: 26 additions & 1340 deletions

File tree

src/commands/fix/agent-fix.mts

Lines changed: 0 additions & 709 deletions
This file was deleted.

src/commands/fix/cmd-fix.mts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ async function run(
6161
type: 'boolean',
6262
default: false,
6363
description: `Shorthand for --auto-merge --test`,
64+
hidden: true,
6465
},
6566
ghsa: {
6667
type: 'string',
@@ -89,6 +90,7 @@ async function run(
8990
default: false,
9091
description:
9192
'Constrain dependency updates to the minimum satisfying version',
93+
hidden: true,
9294
},
9395
prCheck: {
9496
type: 'boolean',
@@ -105,6 +107,7 @@ async function run(
105107
)} to compute fixes for, as either a comma separated value or as\nmultiple flags, instead of querying the Socket API`,
106108
isMultiple: true,
107109
shortFlag: 'p',
110+
hidden: true,
108111
},
109112
rangeStyle: {
110113
type: 'string',

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,9 @@ describe('socket fix', async () => {
2525
Options
2626
--auto-merge Enable auto-merge for pull requests that Socket opens.
2727
See GitHub documentation (\\u200bhttps://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\\u200b) for managing auto-merge for pull requests in your repository.
28-
--autopilot Shorthand for --auto-merge --test
2928
--json Output result as json
3029
--limit The number of fixes to attempt at a time (default 10)
3130
--markdown Output result as markdown
32-
--min-satisfying Constrain dependency updates to the minimum satisfying version
33-
--purl Provide a list of PURLs (\\u200bhttps://github.com/package-url/purl-spec?tab=readme-ov-file#purl\\u200b) to compute fixes for, as either a comma separated value or as
34-
multiple flags, instead of querying the Socket API
3531
--range-style Define how dependency version ranges are updated in package.json (default 'preserve').
3632
Available styles:
3733
* caret - Use ^ range for compatible updates (e.g. ^1.2.3)

src/commands/fix/coana-fix.mts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { getPackageFilesForScan } from '../../utils/path-resolve.mts'
2828
import { setupSdk } from '../../utils/sdk.mts'
2929
import { fetchSupportedScanFileNames } from '../scan/fetch-supported-scan-file-names.mts'
3030

31-
import type { FixConfig } from './agent-fix.mts'
31+
import type { FixConfig } from './types.mts'
3232
import type { CResult } from '../../types.mts'
3333

3434
export async function coanaFix(
@@ -81,7 +81,8 @@ export async function coanaFix(
8181
}
8282

8383
const isAll =
84-
ghsas.length === 1 && (ghsas[0] === 'all' || ghsas[0] === 'auto')
84+
!ghsas.length ||
85+
(ghsas.length === 1 && (ghsas[0] === 'all' || ghsas[0] === 'auto'))
8586

8687
const shouldOpenPrs = fixEnv.isCi && fixEnv.repoInfo
8788

src/commands/fix/get-actual-tree.mts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/commands/fix/handle-fix.mts

Lines changed: 2 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
import { debugDir } from '@socketsecurity/registry/lib/debug'
2-
import { logger } from '@socketsecurity/registry/lib/logger'
3-
41
import { coanaFix } from './coana-fix.mts'
5-
import { npmFix } from './npm-fix.mts'
62
import { outputFixResult } from './output-fix-result.mts'
7-
import { pnpmFix } from './pnpm-fix.mts'
8-
import { CMD_NAME } from './shared.mts'
9-
import { detectAndValidatePackageEnvironment } from '../../utils/package-environment.mts'
103

11-
import type { FixConfig } from './agent-fix.mts'
4+
import type { FixConfig } from './types.mts'
125
import type { OutputKind } from '../../types.mts'
136
import type { Remap } from '@socketsecurity/registry/lib/objects'
147

@@ -37,73 +30,8 @@ export async function handleFix({
3730
testScript,
3831
unknownFlags,
3932
}: HandleFixConfig) {
40-
if (ghsas.length) {
41-
await outputFixResult(
42-
await coanaFix({
43-
autoMerge,
44-
cwd,
45-
ghsas,
46-
limit,
47-
minSatisfying,
48-
orgSlug,
49-
prCheck,
50-
purls,
51-
rangeStyle,
52-
spinner,
53-
test,
54-
testScript,
55-
unknownFlags,
56-
}),
57-
outputKind,
58-
)
59-
return
60-
}
61-
62-
const pkgEnvCResult = await detectAndValidatePackageEnvironment(cwd, {
63-
cmdName: CMD_NAME,
64-
logger,
65-
})
66-
if (!pkgEnvCResult.ok) {
67-
await outputFixResult(pkgEnvCResult, outputKind)
68-
return
69-
}
70-
71-
const { data: pkgEnvDetails } = pkgEnvCResult
72-
if (!pkgEnvDetails) {
73-
await outputFixResult(
74-
{
75-
ok: false,
76-
message: 'No package found.',
77-
cause: `No valid package environment found for project path: ${cwd}`,
78-
},
79-
outputKind,
80-
)
81-
return
82-
}
83-
84-
debugDir('inspect', { pkgEnvDetails })
85-
86-
const { agent, agentVersion } = pkgEnvDetails
87-
const isNpm = agent === 'npm'
88-
const isPnpm = agent === 'pnpm'
89-
90-
if (!isNpm && !isPnpm) {
91-
await outputFixResult(
92-
{
93-
ok: false,
94-
message: 'Not supported.',
95-
cause: `${agent} v${agentVersion} is not supported by this command.`,
96-
},
97-
outputKind,
98-
)
99-
return
100-
}
101-
102-
logger.info(`Fixing packages for ${agent} v${agentVersion}.\n`)
103-
104-
const fixer = isNpm ? npmFix : pnpmFix
10533
await outputFixResult(
106-
await fixer(pkgEnvDetails, {
34+
await coanaFix({
10735
autoMerge,
10836
cwd,
10937
ghsas,

src/commands/fix/npm-fix.mts

Lines changed: 0 additions & 219 deletions
This file was deleted.

0 commit comments

Comments
 (0)