Skip to content

Commit 8faa892

Browse files
committed
Add env vars to help
1 parent c55878f commit 8faa892

File tree

3 files changed

+72
-32
lines changed

3 files changed

+72
-32
lines changed

README.md

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ socket --help
1616

1717
- `socket npm [args...]` and `socket npx [args...]` - Wraps `npm` and `npx` to
1818
integrate [Socket.dev] and preempt installation of alerted packages using the
19-
builtin resolution of `npm` to precisely determine package installations.
19+
builtin resolution of `npm` to precisely determine package installations
2020

2121
- `socket optimize` - Optimize dependencies with
2222
[`@socketregistry`](https://github.com/SocketDev/socket-registry) overrides
2323
_(👀 [our blog post](https://socket.dev/blog/introducing-socket-optimize))_
2424

25-
- `--pin` - Pin overrides to their latest version.
26-
- `--prod` - Add overrides for only production dependencies.
25+
- `--pin` - Pin overrides to their latest version
26+
- `--prod` - Add overrides for only production dependencies
2727

2828
- `socket cdxgen [command]` - Call out to
2929
[cdxgen](https://cyclonedx.github.io/cdxgen/#/?id=getting-started). See
@@ -34,23 +34,23 @@ socket --help
3434

3535
All aliases support the flags and arguments of the commands they alias.
3636

37-
- `socket ci` - alias for `socket scan create --report` which creates a report for the current directory and quits with an exit code if the result is unhealthy.
37+
- `socket ci` - alias for `socket scan create --report` which creates a report for the current directory and quits with an exit code if the result is unhealthy
3838

3939
## Flags
4040

4141
### Output flags
4242

43-
- `--json` - Outputs result as JSON which can be piped into [`jq`](https://stedolan.github.io/jq/) and other tools.
44-
- `--markdown` - Outputs result as Markdown which can be copied into issues, pull requests, or chats.
43+
- `--json` - Outputs result as JSON which can be piped into [`jq`](https://stedolan.github.io/jq/) and other tools
44+
- `--markdown` - Outputs result as Markdown which can be copied into issues, pull requests, or chats
4545

4646
### Other flags
4747

48-
- `--dry-run` - Run a command without uploading anything.
49-
- `--debug` - Output additional debug.
50-
- `--help` - Prints help documentation for a command.
51-
- `--max-old-space-size` - Set Node's [`--max-old-space-size`](https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-mib) value.
52-
- `--max-semi-space-size` - Set Node's [`--max-semi-space-size`](https://nodejs.org/api/cli.html#--max-semi-space-sizesize-in-mib) value.
53-
- `--version` - Prints the Socket CLI version.
48+
- `--dry-run` - Run a command without uploading anything
49+
- `--debug` - Output additional debug
50+
- `--help` - Prints help documentation for a command
51+
- `--max-old-space-size` - Set Node's [`--max-old-space-size`](https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-mib) value
52+
- `--max-semi-space-size` - Set Node's [`--max-semi-space-size`](https://nodejs.org/api/cli.html#--max-semi-space-sizesize-in-mib) value
53+
- `--version` - Prints the Socket CLI version
5454

5555
## Configuration files
5656

@@ -61,19 +61,19 @@ use of the `projectIgnorePaths` to excludes files when creating a report.
6161

6262
## Environment variables
6363

64-
- `SOCKET_CLI_ACCEPT_RISKS` - Accept risks of a safe-npm and safe-npx run.
65-
- `SOCKET_CLI_API_TOKEN` - Set the Socket API token.
66-
- `SOCKET_CLI_CONFIG` - A JSON stringified Socket configuration object.
67-
- `SOCKET_CLI_GIT_USER_EMAIL` - The git config `user.email` used by Socket CLI.<br>
64+
- `SOCKET_CLI_ACCEPT_RISKS` - Accept risks of a safe-npm or safe-npx run
65+
- `SOCKET_CLI_API_TOKEN` - Set the Socket API token
66+
- `SOCKET_CLI_CONFIG` - A JSON stringified Socket configuration object
67+
- `SOCKET_CLI_GIT_USER_EMAIL` - The git config `user.email` used by Socket CLI<br>
6868
*Defaults:* `github-actions[bot]@users.noreply.github.com`<br>
69-
- `SOCKET_CLI_GIT_USER_NAME` - The git config `user.name` used by Socket CLI.<br>
69+
- `SOCKET_CLI_GIT_USER_NAME` - The git config `user.name` used by Socket CLI<br>
7070
*Defaults:* `github-actions[bot]`<br>
71-
- `SOCKET_CLI_GITHUB_TOKEN` - A classic [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with the "repo" scope or a fine-grained access token with at least read/write permissions set for "Contents" and "Pull Request".<br>
71+
- `SOCKET_CLI_GITHUB_TOKEN` - A classic or fine-grained [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with the "repo" scope or at least read/write permissions set for "Contents" and "Pull Request"<br>
7272
*Aliases:* `GITHUB_TOKEN`<br>
73-
- `SOCKET_CLI_NO_API_TOKEN` - Make the default API token `undefined`.
74-
- `SOCKET_CLI_NPM_PATH` - The absolute location of the npm directory.
75-
- `SOCKET_CLI_ORG_SLUG` - Specify the Socket organization slug.
76-
- `SOCKET_CLI_VIEW_ALL_RISKS` - View all risks of a safe-npm and safe-npx run.
73+
- `SOCKET_CLI_NO_API_TOKEN` - Make the default API token `undefined`
74+
- `SOCKET_CLI_NPM_PATH` - The absolute location of the npm directory
75+
- `SOCKET_CLI_ORG_SLUG` - Specify the Socket organization slug
76+
- `SOCKET_CLI_VIEW_ALL_RISKS` - View all risks of a safe-npm or safe-npx run
7777

7878
## Contributing
7979

@@ -89,23 +89,22 @@ npm exec socket
8989

9090
### Environment variables for development
9191

92-
- `DEBUG` - Enable debug logging based on the [`debug`](https://socket.dev/npm/package/debug) package.
93-
- `SOCKET_CLI_API_BASE_URL` - Change the base URL for all API-calls.<br>
94-
*Defaults:* The "apiBaseUrl" value of socket/settings local app data if present, else `https://api.socket.dev/v0/`.<br>
95-
- `SOCKET_CLI_API_PROXY` - Set the proxy that all requests are routed through.<br>
96-
For example, if set to [`http://127.0.0.1:9090`](https://docs.proxyman.io/troubleshooting/couldnt-see-any-requests-from-3rd-party-network-libraries), then all request are proxied through that proxy.<br>
92+
- `SOCKET_CLI_API_BASE_URL` - Change the base URL for all API-calls<br>
93+
*Defaults:* The "apiBaseUrl" value of socket/settings local app data if present, else `https://api.socket.dev/v0/`<br>
94+
- `SOCKET_CLI_API_PROXY` - Set the proxy that all requests are routed through<br>
95+
For example, if set to [`http://127.0.0.1:9090`](https://docs.proxyman.io/troubleshooting/couldnt-see-any-requests-from-3rd-party-network-libraries), then all request are proxied through that proxy<br>
9796
*Aliases:* `HTTPS_PROXY`, `https_proxy`, `HTTP_PROXY`, and `http_proxy`<br>
98-
- `SOCKET_CLI_DEBUG` - Enable debug logging in Socket CLI.<br>
99-
:bulb: Not needed if `DEBUG` is specified.
97+
- `SOCKET_CLI_DEBUG` - Enable debug logging in Socket CLI
98+
- `DEBUG` - Enable debug logging based on the [`debug`](https://socket.dev/npm/package/debug) package
10099

101100
## Similar projects
102101

103-
- [`@socketsecurity/sdk`](https://github.com/SocketDev/socket-sdk-js) - The SDK used by Socket CLI.
102+
- [`@socketsecurity/sdk`](https://github.com/SocketDev/socket-sdk-js) - The SDK used by Socket CLI
104103

105104
## See also
106105

107106
- [Announcement blog post](https://socket.dev/blog/announcing-socket-cli-preview)
108-
- [Socket API Reference](https://docs.socket.dev/reference) - The API used by Socket CLI.
109-
- [Socket GitHub App](https://github.com/apps/socket-security) - The plug-and-play GitHub App.
107+
- [Socket API Reference](https://docs.socket.dev/reference) - The API used by Socket CLI
108+
- [Socket GitHub App](https://github.com/apps/socket-security) - The plug-and-play GitHub App
110109

111110
[Socket.dev]: https://socket.dev/

src/commands/cli.test.mts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,26 @@ describe('socket root command', async () => {
5353
uninstall Uninstall Socket CLI tab completion
5454
wrapper Enable or disable the Socket npm/npx wrapper
5555
56+
Environment variables
57+
58+
SOCKET_CLI_ACCEPT_RISKS Accept risks of a safe-npm or safe-npx run
59+
SOCKET_CLI_API_TOKEN Set the Socket API token
60+
SOCKET_CLI_CONFIG. A JSON stringified Socket configuration object
61+
SOCKET_CLI_GIT_USER_EMAIL The git config \`user.email\` used by Socket CLI
62+
SOCKET_CLI_GIT_USER_NAME The git config user.name used by Socket CLI
63+
SOCKET_CLI_GITHUB_TOKEN A classic or fine-grained GitHub personal access token (\\u200bhttps://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens\\u200b)
64+
SOCKET_CLI_NO_API_TOKEN Make the default API token \`undefined\`
65+
SOCKET_CLI_NPM_PATH The absolute location of the npm directory
66+
SOCKET_CLI_ORG_SLUG Specify the Socket organization slug
67+
SOCKET_CLI_VIEW_ALL_RISKS View all risks of a safe-npm or safe-npx run
68+
69+
Environment variables for development
70+
71+
SOCKET_CLI_API_BASE_URL Change the base URL for all API-calls
72+
SOCKET_CLI_API_PROXY Set the proxy that all requests are routed through
73+
SOCKET_CLI_DEBUG Enable debug logging in Socket CLI
74+
DEBUG Enable debug logging based on the debug (\\u200bhttps://socket.dev/npm/package/debug\\u200b) package
75+
5676
Options (Note: All CLI commands have these flags even when not displayed in their help)
5777
5878
--config Override the local config with this JSON

src/utils/meow-with-subcommands.mts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import meow from 'meow'
2+
import terminalLink from 'terminal-link'
23

34
import { joinAnd } from '@socketsecurity/registry/lib/arrays'
45
import { logger } from '@socketsecurity/registry/lib/logger'
@@ -354,6 +355,26 @@ export async function meowWithSubcommands(
354355
` logout ${subcommands['logout']?.description}`,
355356
` uninstall ${subcommands['uninstall']?.description}`,
356357
` wrapper ${subcommands['wrapper']?.description}`,
358+
'',
359+
' Environment variables',
360+
'',
361+
' SOCKET_CLI_ACCEPT_RISKS Accept risks of a safe-npm or safe-npx run',
362+
' SOCKET_CLI_API_TOKEN Set the Socket API token',
363+
' SOCKET_CLI_CONFIG. A JSON stringified Socket configuration object',
364+
' SOCKET_CLI_GIT_USER_EMAIL The git config `user.email` used by Socket CLI',
365+
' SOCKET_CLI_GIT_USER_NAME The git config `user.name` used by Socket CLI',
366+
` SOCKET_CLI_GITHUB_TOKEN A classic or fine-grained ${terminalLink('GitHub personal access token', 'https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens')}`,
367+
' SOCKET_CLI_NO_API_TOKEN Make the default API token `undefined`',
368+
' SOCKET_CLI_NPM_PATH The absolute location of the npm directory',
369+
' SOCKET_CLI_ORG_SLUG Specify the Socket organization slug',
370+
' SOCKET_CLI_VIEW_ALL_RISKS View all risks of a safe-npm or safe-npx run',
371+
'',
372+
' Environment variables for development',
373+
'',
374+
' SOCKET_CLI_API_BASE_URL Change the base URL for all API-calls',
375+
' SOCKET_CLI_API_PROXY Set the proxy that all requests are routed through',
376+
' SOCKET_CLI_DEBUG Enable debug logging in Socket CLI',
377+
` DEBUG Enable debug logging based on the ${terminalLink('debug', 'https://socket.dev/npm/package/debug')} package`,
357378
].join('\n')
358379
}
359380

0 commit comments

Comments
 (0)