Skip to content

Commit 8249fcb

Browse files
committed
Merge branch 'main' into cmd_pkg_score
2 parents 22ffec6 + a457552 commit 8249fcb

File tree

191 files changed

+5476
-2999
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+5476
-2999
lines changed

.dep-stats.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"@pnpm/lockfile.detect-dep-types": "^1001.0.5",
66
"@socketregistry/hyrious__bun.lockb": "1.0.16",
77
"@socketregistry/indent-string": "1.0.12",
8-
"@socketregistry/is-interactive": "1.0.4",
8+
"@socketregistry/is-interactive": "1.0.5",
99
"@socketregistry/packageurl-js": "1.0.4",
1010
"@socketsecurity/config": "2.1.3",
11-
"@socketsecurity/registry": "1.0.133",
12-
"@socketsecurity/sdk": "1.4.11",
11+
"@socketsecurity/registry": "1.0.135",
12+
"@socketsecurity/sdk": "1.4.16",
1313
"blessed": "0.1.81",
1414
"blessed-contrib": "4.11.0",
1515
"browserslist": "4.24.4",

knip.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
{
2-
"entry": ["scripts/**/*.js", "src/**/*.ts", "test/**/*.test.ts"],
3-
"project": ["scripts/**/*", "src/**/*", "test/**/*"],
4-
"ignore": ["dist/**/*"]
2+
"entry": [
3+
".config/*.{js,mjs}",
4+
"bin/*.js",
5+
"scripts/**/*.js",
6+
"shadow-bin/**",
7+
"src/**/*.ts",
8+
"test/**/*.test.ts",
9+
"*.js"
10+
],
11+
"project": [
12+
".config/**",
13+
"bin/**",
14+
"scripts/**",
15+
"shadow-bin/**",
16+
"src/**",
17+
"test/**"
18+
],
19+
"ignore": ["dist/**"]
520
}

package-lock.json

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

package.json

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "socket",
3-
"version": "0.14.64",
3+
"version": "0.14.67",
44
"description": "CLI tool for Socket.dev",
55
"homepage": "https://github.com/SocketDev/socket-cli",
66
"license": "MIT",
@@ -76,11 +76,11 @@
7676
"@pnpm/lockfile.detect-dep-types": "^1001.0.5",
7777
"@socketregistry/hyrious__bun.lockb": "1.0.16",
7878
"@socketregistry/indent-string": "1.0.12",
79-
"@socketregistry/is-interactive": "1.0.4",
79+
"@socketregistry/is-interactive": "1.0.5",
8080
"@socketregistry/packageurl-js": "1.0.4",
8181
"@socketsecurity/config": "2.1.3",
82-
"@socketsecurity/registry": "1.0.133",
83-
"@socketsecurity/sdk": "1.4.11",
82+
"@socketsecurity/registry": "1.0.135",
83+
"@socketsecurity/sdk": "1.4.16",
8484
"blessed": "0.1.81",
8585
"blessed-contrib": "4.11.0",
8686
"browserslist": "4.24.4",
@@ -110,12 +110,12 @@
110110
"@babel/plugin-transform-export-namespace-from": "^7.25.9",
111111
"@babel/plugin-transform-runtime": "^7.26.10",
112112
"@babel/preset-env": "^7.26.9",
113-
"@babel/preset-typescript": "^7.26.0",
114-
"@babel/runtime": "^7.26.10",
113+
"@babel/preset-typescript": "^7.27.0",
114+
"@babel/runtime": "^7.27.0",
115115
"@biomejs/biome": "^1.9.4",
116116
"@cyclonedx/cdxgen": "^11.2.2",
117117
"@eslint/compat": "^1.2.7",
118-
"@eslint/js": "^9.22.0",
118+
"@eslint/js": "^9.23.0",
119119
"@rollup/plugin-commonjs": "^28.0.3",
120120
"@rollup/plugin-json": "^6.1.0",
121121
"@rollup/plugin-node-resolve": "^16.0.1",
@@ -126,20 +126,17 @@
126126
"@types/common-tags": "^1.8.4",
127127
"@types/micromatch": "^4.0.9",
128128
"@types/mock-fs": "^4.13.4",
129-
"@types/node": "^22.13.10",
129+
"@types/node": "^22.13.13",
130130
"@types/npmcli__arborist": "^6.3.0",
131-
"@types/npmcli__promise-spawn": "^6.0.3",
132131
"@types/proc-log": "^3.0.4",
133132
"@types/semver": "^7.5.8",
134-
"@types/update-notifier": "^6.0.8",
135133
"@types/which": "^3.0.4",
136134
"@types/yargs-parser": "^21.0.3",
137-
"@typescript-eslint/eslint-plugin": "^8.27.0",
138-
"@typescript-eslint/parser": "^8.27.0",
135+
"@typescript-eslint/parser": "^8.28.0",
139136
"@vitest/coverage-v8": "3.0.9",
140137
"cross-env": "^7.0.3",
141138
"del-cli": "^6.0.0",
142-
"eslint": "^9.22.0",
139+
"eslint": "^9.23.0",
143140
"eslint-import-resolver-oxc": "^0.13.1",
144141
"eslint-plugin-import-x": "^4.9.1",
145142
"eslint-plugin-n": "^17.16.2",
@@ -153,14 +150,14 @@
153150
"mock-fs": "^5.5.0",
154151
"nock": "^14.0.1",
155152
"npm-run-all2": "^7.0.2",
156-
"oxlint": "0.16.1",
153+
"oxlint": "0.16.2",
157154
"read-package-up": "^11.0.0",
158-
"rollup": "4.36.0",
155+
"rollup": "4.37.0",
159156
"rollup-plugin-ts": "^3.4.5",
160157
"synp": "^1.9.14",
161158
"type-coverage": "^2.29.7",
162159
"typescript": "5.4.5",
163-
"typescript-eslint": "^8.27.0",
160+
"typescript-eslint": "^8.28.0",
164161
"unplugin-purge-polyfills": "^0.0.7",
165162
"vitest": "3.0.9"
166163
},
@@ -189,7 +186,7 @@
189186
"tiny-colors": "$yoctocolors-cjs",
190187
"typedarray": "npm:@socketregistry/typedarray@^1",
191188
"undici": "^6.21.1",
192-
"vite": "^6.2.0",
189+
"vite": "^6.2.3",
193190
"xml2js": "^0.5.0",
194191
"yaml": "2.7.0"
195192
},

src/cli.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { logger } from '@socketsecurity/registry/lib/logger'
1212
import { cmdAnalytics } from './commands/analytics/cmd-analytics'
1313
import { cmdAuditLog } from './commands/audit-log/cmd-audit-log'
1414
import { cmdCdxgen } from './commands/cdxgen/cmd-cdxgen'
15+
import { cmdConfig } from './commands/config/cmd-config'
1516
import { cmdScanCreate } from './commands/dependencies/cmd-dependencies'
1617
import { cmdDiffScan } from './commands/diff-scan/cmd-diff-scan'
1718
import { cmdFix } from './commands/fix/cmd-fix'
@@ -51,6 +52,7 @@ void (async () => {
5152
await meowWithSubcommands(
5253
{
5354
cdxgen: cmdCdxgen,
55+
config: cmdConfig,
5456
fix: cmdFix,
5557
info: cmdInfo,
5658
login: cmdLogin,

src/commands/analytics/cmd-analytics.test.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ describe('socket analytics', async () => {
1111
// Lazily access constants.rootBinPath.
1212
const entryPath = path.join(constants.rootBinPath, `${CLI}.js`)
1313

14-
cmdit(['analytics', '--help'], 'should support --help', async cmd => {
15-
const { code, stderr, stdout } = await invokeNpm(entryPath, cmd)
16-
expect(stdout).toMatchInlineSnapshot(
17-
`
14+
cmdit(
15+
['analytics', '--help', '--config', '{}'],
16+
'should support --help',
17+
async cmd => {
18+
const { code, stderr, stdout } = await invokeNpm(entryPath, cmd)
19+
expect(stdout).toMatchInlineSnapshot(
20+
`
1821
"Look up analytics data
1922
2023
Usage
@@ -38,23 +41,24 @@ describe('socket analytics', async () => {
3841
$ socket analytics --scope=org --time=30
3942
$ socket analytics --scope=repo --repo=test-repo --time=30"
4043
`
41-
)
42-
expect(`\n ${stderr}`).toMatchInlineSnapshot(`
44+
)
45+
expect(`\n ${stderr}`).toMatchInlineSnapshot(`
4346
"
4447
_____ _ _ /---------------
4548
| __|___ ___| |_ ___| |_ | Socket.dev CLI ver <redacted>
4649
|__ | . | _| '_| -_| _| | Node: <redacted>, API token set: <redacted>
4750
|_____|___|___|_,_|___|_|.dev | Command: \`socket analytics\`, cwd: <redacted>"
4851
`)
4952

50-
expect(code, 'help should exit with code 2').toBe(2)
51-
expect(stderr, 'header should include command (without params)').toContain(
52-
'`socket analytics`'
53-
)
54-
})
53+
expect(code, 'help should exit with code 2').toBe(2)
54+
expect(stderr, 'banner includes base command').toContain(
55+
'`socket analytics`'
56+
)
57+
}
58+
)
5559

5660
cmdit(
57-
['analytics', '--dry-run'],
61+
['analytics', '--dry-run', '--config', '{}'],
5862
'should require args with just dry-run',
5963
async cmd => {
6064
const { code, stderr, stdout } = await invokeNpm(entryPath, cmd)

src/commands/analytics/fetch-org-analytics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ export async function fetchOrgAnalyticsData(
1111
spinner: Spinner,
1212
apiToken: string
1313
): Promise<SocketSdkReturnType<'getOrgAnalytics'>['data'] | undefined> {
14-
const socketSdk = await setupSdk(apiToken)
14+
const sockSdk = await setupSdk(apiToken)
1515
const result = await handleApiCall(
16-
socketSdk.getOrgAnalytics(time.toString()),
16+
sockSdk.getOrgAnalytics(time.toString()),
1717
'fetching analytics data'
1818
)
1919

src/commands/analytics/fetch-repo-analytics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export async function fetchRepoAnalyticsData(
1212
spinner: Spinner,
1313
apiToken: string
1414
): Promise<SocketSdkReturnType<'getRepoAnalytics'>['data'] | undefined> {
15-
const socketSdk = await setupSdk(apiToken)
15+
const sockSdk = await setupSdk(apiToken)
1616
const result = await handleApiCall(
17-
socketSdk.getRepoAnalytics(repo, time.toString()),
17+
sockSdk.getRepoAnalytics(repo, time.toString()),
1818
'fetching analytics data'
1919
)
2020

src/commands/audit-log/cmd-audit-log.test.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ describe('socket audit-log', async () => {
1111
// Lazily access constants.rootBinPath.
1212
const entryPath = path.join(constants.rootBinPath, `${CLI}.js`)
1313

14-
cmdit(['audit-log', '--help'], 'should support --help', async cmd => {
15-
const { code, stderr, stdout } = await invokeNpm(entryPath, cmd)
16-
expect(stdout).toMatchInlineSnapshot(
17-
`
14+
cmdit(
15+
['audit-log', '--help', '--config', '{}'],
16+
'should support --help',
17+
async cmd => {
18+
const { code, stderr, stdout } = await invokeNpm(entryPath, cmd)
19+
expect(stdout).toMatchInlineSnapshot(
20+
`
1821
"Look up the audit log for an organization
1922
2023
Usage
@@ -35,23 +38,24 @@ describe('socket audit-log', async () => {
3538
Examples
3639
$ socket audit-log FakeOrg"
3740
`
38-
)
39-
expect(`\n ${stderr}`).toMatchInlineSnapshot(`
41+
)
42+
expect(`\n ${stderr}`).toMatchInlineSnapshot(`
4043
"
4144
_____ _ _ /---------------
4245
| __|___ ___| |_ ___| |_ | Socket.dev CLI ver <redacted>
4346
|__ | . | _| '_| -_| _| | Node: <redacted>, API token set: <redacted>
4447
|_____|___|___|_,_|___|_|.dev | Command: \`socket audit-log\`, cwd: <redacted>"
4548
`)
4649

47-
expect(code, 'help should exit with code 2').toBe(2)
48-
expect(stderr, 'header should include command (without params)').toContain(
49-
'`socket audit-log`'
50-
)
51-
})
50+
expect(code, 'help should exit with code 2').toBe(2)
51+
expect(stderr, 'banner includes base command').toContain(
52+
'`socket audit-log`'
53+
)
54+
}
55+
)
5256

5357
cmdit(
54-
['audit-log', '--dry-run'],
58+
['audit-log', '--dry-run', '--config', '{}'],
5559
'should require args with just dry-run',
5660
async cmd => {
5761
const { code, stderr, stdout } = await invokeNpm(entryPath, cmd)
@@ -73,7 +77,7 @@ describe('socket audit-log', async () => {
7377
)
7478

7579
cmdit(
76-
['audit-log', 'fakeorg', '--dry-run'],
80+
['audit-log', 'fakeorg', '--dry-run', '--config', '{}'],
7781
'should require args with just dry-run',
7882
async cmd => {
7983
const { code, stderr, stdout } = await invokeNpm(entryPath, cmd)

src/commands/audit-log/cmd-audit-log.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import colors from 'yoctocolors-cjs'
33

44
import { logger } from '@socketsecurity/registry/lib/logger'
55

6-
import { getAuditLog } from './get-audit-log'
6+
import { handleAuditLog } from './handle-audit-log'
77
import constants from '../../constants'
88
import { commonFlags, outputFlags } from '../../flags'
9+
import { getConfigValue } from '../../utils/config'
910
import { meowOrExit } from '../../utils/meow-with-subcommands'
1011
import { getFlagListOutput } from '../../utils/output-formatting'
1112

@@ -73,9 +74,10 @@ async function run(
7374
})
7475

7576
const { json, markdown, page, perPage, type } = cli.flags
76-
7777
const logType = String(type || '')
78-
const [orgSlug = ''] = cli.input
78+
79+
const defaultOrgSlug = getConfigValue('defaultOrg')
80+
const orgSlug = defaultOrgSlug || cli.input[0] || ''
7981

8082
if (!orgSlug) {
8183
// Use exit status of 2 to indicate incorrect usage, generally invalid
@@ -96,7 +98,7 @@ async function run(
9698
return
9799
}
98100

99-
await getAuditLog({
101+
await handleAuditLog({
100102
orgSlug,
101103
outputKind: json ? 'json' : markdown ? 'markdown' : 'print',
102104
page: Number(page || 0),

0 commit comments

Comments
 (0)