Skip to content

Commit f26e7d4

Browse files
jdaltonclaude
andcommitted
fix: correct CLI_DIR constant and requirements.json import
- Changed CLI_DIR from '_cli' to 'cli' to match expected path structure - Moved requirements.json to project root (copied from SDK) - Updated requirements.mts to import local requirements.json instead of SDK export - SDK no longer exports requirements.json via package.json exports field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0a82ad6 commit f26e7d4

File tree

16 files changed

+379
-108
lines changed

16 files changed

+379
-108
lines changed

.config/eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export default [
207207
'test/**/*.{cts,mts,ts}',
208208
'src/test/**/*.{cts,mts,ts}',
209209
'src/utils/test-mocks.mts',
210-
'scripts/**/*.d.{cts,mts,ts}',
210+
'**/*.d.{cts,mts,ts}',
211211
],
212212
...js.configs.recommended,
213213
...importFlatConfigsForModule.typescript,

.config/rollup.sea.config.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import { babel as babelPlugin } from '@rollup/plugin-babel'
1010
import commonjsPlugin from '@rollup/plugin-commonjs'
1111
import { nodeResolve } from '@rollup/plugin-node-resolve'
1212
import replacePlugin from '@rollup/plugin-replace'
13-
import maintainedNodeVersions from '@socketsecurity/registry/lib/constants/maintained-node-versions'
14-
import UnpluginOxc from 'unplugin-oxc/rollup'
1513
import semver from 'semver'
14+
import UnpluginOxc from 'unplugin-oxc/rollup'
15+
16+
import maintainedNodeVersions from '@socketsecurity/registry/lib/constants/maintained-node-versions'
1617

1718
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
1819
const rootDir = path.join(__dirname, '..')
19-
const isProduction = process.env.NODE_ENV === 'production' || process.env.MINIFY === '1'
20+
const isProduction =
21+
process.env.NODE_ENV === 'production' || process.env.MINIFY === '1'
2022

2123
// Get the major version of the current maintained Node.js version (22.x.x -> 22)
2224
const MIN_NODE_VERSION = semver.major(maintainedNodeVersions[2])

.config/vitest.config.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ export default defineConfig({
2525
forks: {
2626
// Use single fork for coverage to reduce memory, parallel otherwise.
2727
singleFork: isCoverageEnabled,
28-
maxForks: isCoverageEnabled ? 1 : undefined,
28+
...(isCoverageEnabled ? { maxForks: 1 } : {}),
2929
// Isolate tests to prevent memory leaks between test files.
3030
isolate: true,
3131
},
3232
threads: {
3333
// Use single thread for coverage to reduce memory, parallel otherwise.
3434
singleThread: isCoverageEnabled,
35-
maxThreads: isCoverageEnabled ? 1 : undefined,
35+
...(isCoverageEnabled ? { maxThreads: 1 } : {}),
3636
},
3737
},
3838
testTimeout: 60_000,

bin/bootstrap.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
1-
#!/usr/bin/env node
21
/**
32
* @fileoverview Bootstrap loader for Socket CLI
43
*
54
* Checks if ~/.socket/_socket exists, delegates to it.
65
* Otherwise downloads and installs Socket CLI there.
76
*/
87

8+
/* eslint-disable n/no-process-exit */
9+
// process.exit() is acceptable in CLI bootstrap scripts
10+
911
'use strict'
1012

13+
const { spawnSync } = require('node:child_process')
1114
const { existsSync } = require('node:fs')
1215
const { homedir } = require('node:os')
1316
const { join } = require('node:path')
14-
const { spawnSync } = require('node:child_process')
1517

1618
const SOCKET_CLI_DIR = join(homedir(), '.socket', '_socket')
1719
const CLI_ENTRY = join(SOCKET_CLI_DIR, 'index.js')
1820

1921
// Check if CLI exists
2022
if (existsSync(CLI_ENTRY)) {
2123
// Delegate to ~/.socket/_socket
22-
const result = spawnSync(process.execPath, [CLI_ENTRY, ...process.argv.slice(2)], {
23-
stdio: 'inherit',
24-
env: { ...process.env, PKG_EXECPATH: process.env.PKG_EXECPATH || 'PKG_INVOKE_NODEJS' }
25-
})
24+
const result = spawnSync(
25+
process.execPath,
26+
[CLI_ENTRY, ...process.argv.slice(2)],
27+
{
28+
stdio: 'inherit',
29+
env: {
30+
...process.env,
31+
PKG_EXECPATH: process.env.PKG_EXECPATH || 'PKG_INVOKE_NODEJS',
32+
},
33+
},
34+
)
2635
process.exit(result.status || 0)
2736
} else {
2837
// Download and install

requirements.json

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
{
2+
"api": {
3+
"batchPackageFetch": {
4+
"quota": 100,
5+
"permissions": ["packages:list"]
6+
},
7+
"batchPackageStream": {
8+
"quota": 100,
9+
"permissions": ["packages:list"]
10+
},
11+
"createDependenciesSnapshot": {
12+
"quota": 100,
13+
"permissions": ["report:write"]
14+
},
15+
"createOrgFullScan": {
16+
"quota": 0,
17+
"permissions": ["full-scans:create"]
18+
},
19+
"createOrgRepo": {
20+
"quota": 0,
21+
"permissions": ["repo:create"]
22+
},
23+
"createScanFromFilepaths": {
24+
"quota": 100,
25+
"permissions": ["report:write"]
26+
},
27+
"deleteOrgFullScan": {
28+
"quota": 0,
29+
"permissions": ["full-scans:delete"]
30+
},
31+
"deleteOrgRepo": {
32+
"quota": 0,
33+
"permissions": ["repo:delete"]
34+
},
35+
"getAuditLogEvents": {
36+
"quota": 10,
37+
"permissions": ["audit-log:list"]
38+
},
39+
"getEnabledEntitlements": {
40+
"quota": 0,
41+
"permissions": []
42+
},
43+
"getEntitlements": {
44+
"quota": 0,
45+
"permissions": []
46+
},
47+
"getIssuesByNpmPackage": {
48+
"quota": 10,
49+
"permissions": []
50+
},
51+
"getOrgAnalytics": {
52+
"quota": 10,
53+
"permissions": ["report:write"]
54+
},
55+
"getOrganizations": {
56+
"quota": 0,
57+
"permissions": []
58+
},
59+
"streamOrgFullScan": {
60+
"quota": 0,
61+
"permissions": ["full-scans:list"]
62+
},
63+
"streamPatchesFromScan": {
64+
"quota": 0,
65+
"permissions": ["patches:list"]
66+
},
67+
"getOrgFullScanBuffered": {
68+
"quota": 0,
69+
"permissions": ["full-scans:list"]
70+
},
71+
"getOrgFullScanList": {
72+
"quota": 0,
73+
"permissions": ["full-scans:list"]
74+
},
75+
"getOrgFullScanMetadata": {
76+
"quota": 0,
77+
"permissions": ["full-scans:list"]
78+
},
79+
"getOrgLicensePolicy": {
80+
"quota": 0,
81+
"permissions": ["settings:read"]
82+
},
83+
"getOrgRepo": {
84+
"quota": 0,
85+
"permissions": ["repo:list"]
86+
},
87+
"getOrgRepoList": {
88+
"quota": 0,
89+
"permissions": ["repo:list"]
90+
},
91+
"getOrgSecurityPolicy": {
92+
"quota": 0,
93+
"permissions": ["settings:read"]
94+
},
95+
"getQuota": {
96+
"quota": 0,
97+
"permissions": []
98+
},
99+
"getRepoAnalytics": {
100+
"quota": 10,
101+
"permissions": ["report:write"]
102+
},
103+
"getScan": {
104+
"quota": 0,
105+
"permissions": ["report:read"]
106+
},
107+
"getScanList": {
108+
"quota": 0,
109+
"permissions": ["report:read"]
110+
},
111+
"getSupportedScanFiles": {
112+
"quota": 0,
113+
"permissions": ["report:read"]
114+
},
115+
"getScoreByNpmPackage": {
116+
"quota": 10,
117+
"permissions": []
118+
},
119+
"postSettings": {
120+
"quota": 0,
121+
"permissions": []
122+
},
123+
"searchDependencies": {
124+
"quota": 100,
125+
"permissions": []
126+
},
127+
"updateOrgRepo": {
128+
"quota": 0,
129+
"permissions": ["repo:update"]
130+
},
131+
"uploadManifestFiles": {
132+
"quota": 100,
133+
"permissions": ["packages:upload"]
134+
},
135+
"viewPatch": {
136+
"quota": 0,
137+
"permissions": ["patches:view"]
138+
},
139+
"deleteReport": {
140+
"quota": 0,
141+
"permissions": ["report:delete"]
142+
},
143+
"exportCDX": {
144+
"quota": 0,
145+
"permissions": ["report:read"]
146+
},
147+
"exportSPDX": {
148+
"quota": 0,
149+
"permissions": ["report:read"]
150+
},
151+
"getAPITokens": {
152+
"quota": 10,
153+
"permissions": ["api-token:list"]
154+
},
155+
"postAPIToken": {
156+
"quota": 10,
157+
"permissions": ["api-token:create"]
158+
},
159+
"postAPITokenUpdate": {
160+
"quota": 10,
161+
"permissions": ["api-token:update"]
162+
},
163+
"postAPITokensRotate": {
164+
"quota": 10,
165+
"permissions": ["api-token:rotate"]
166+
},
167+
"postAPITokensRevoke": {
168+
"quota": 10,
169+
"permissions": ["api-token:revoke"]
170+
},
171+
"updateOrgSecurityPolicy": {
172+
"quota": 0,
173+
"permissions": ["settings:write"]
174+
},
175+
"updateOrgLicensePolicy": {
176+
"quota": 0,
177+
"permissions": ["settings:write"]
178+
},
179+
"getOrgTriage": {
180+
"quota": 0,
181+
"permissions": ["triage:alerts-list"]
182+
},
183+
"updateOrgAlertTriage": {
184+
"quota": 0,
185+
"permissions": ["triage:alerts-update"]
186+
},
187+
"getOrgRepoLabelList": {
188+
"quota": 0,
189+
"permissions": ["repo-label:list"]
190+
},
191+
"createOrgRepoLabel": {
192+
"quota": 0,
193+
"permissions": ["repo-label:create"]
194+
},
195+
"getOrgRepoLabel": {
196+
"quota": 0,
197+
"permissions": ["repo-label:list"]
198+
},
199+
"updateOrgRepoLabel": {
200+
"quota": 0,
201+
"permissions": ["repo-label:update"]
202+
},
203+
"deleteOrgRepoLabel": {
204+
"quota": 0,
205+
"permissions": ["repo-label:delete"]
206+
},
207+
"getDiffScanById": {
208+
"quota": 0,
209+
"permissions": ["diff-scans:list"]
210+
},
211+
"createOrgDiffScanFromIds": {
212+
"quota": 0,
213+
"permissions": ["diff-scans:create"]
214+
},
215+
"listOrgDiffScans": {
216+
"quota": 0,
217+
"permissions": ["diff-scans:list"]
218+
},
219+
"deleteOrgDiffScan": {
220+
"quota": 0,
221+
"permissions": ["diff-scans:delete"]
222+
},
223+
"getApi": {
224+
"quota": 0,
225+
"permissions": []
226+
},
227+
"sendApi": {
228+
"quota": 0,
229+
"permissions": []
230+
}
231+
}
232+
}

scripts/build-yao-pkg-node.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ async function main() {
153153
// Configure Node.js with optimizations
154154
console.log('⚙️ Configuring Node.js...')
155155
console.log(' KEEP: WASM support, SSL/crypto, JIT (required for WASM)')
156-
console.log(' REMOVE: npm, corepack, inspector, amaro, sqlite, ICU, snapshot, code cache')
156+
console.log(
157+
' REMOVE: npm, corepack, inspector, amaro, sqlite, ICU, snapshot, code cache',
158+
)
157159
console.log()
158160

159161
await exec(

0 commit comments

Comments
 (0)