Skip to content

Commit f165b8f

Browse files
authored
fix(scan): suppress auto-manifest hint when .socket.facts.json exists (#1337)
* fix(scan): suppress auto-manifest hint when .socket.facts.json exists The "Detected N manifest targets we could try to generate" hint in `socket scan create` nudges users to pass --auto-manifest. Skip it when a `.socket.facts.json` is already present at cwd — that file is the output of `socket manifest auto` (or the per-ecosystem `--facts` mode), the scan already picks it up via handle-create-new-scan, and the suggestion is misleading in that state. * style: swap em-dash for semicolon in auto-manifest hint comment
1 parent c1987a9 commit f165b8f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/commands/scan/cmd-scan-create.mts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { existsSync } from 'node:fs'
12
import path from 'node:path'
23

34
import { joinAnd } from '@socketsecurity/registry/lib/arrays'
@@ -443,7 +444,15 @@ async function run(
443444
}
444445

445446
const detected = await detectManifestActions(sockJson, cwd)
446-
if (detected.count > 0 && !autoManifest) {
447+
// Suppress the --auto-manifest suggestion when a `.socket.facts.json` is
448+
// already present at cwd. That file is the output of `socket manifest auto`
449+
// (and `--facts` mode of the per-ecosystem manifest commands), so suggesting
450+
// to regenerate it would be misleading; the manifest data is already there
451+
// and will be picked up by the scan.
452+
const hasFactsFile = existsSync(
453+
path.join(cwd, constants.DOT_SOCKET_DOT_FACTS_JSON),
454+
)
455+
if (detected.count > 0 && !autoManifest && !hasFactsFile) {
447456
logger.info(
448457
`Detected ${detected.count} manifest targets we could try to generate. Please set the --auto-manifest flag if you want to include languages covered by \`socket manifest auto\` in the Scan.`,
449458
)

0 commit comments

Comments
 (0)