-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathcommands.mts
More file actions
executable file
·235 lines (230 loc) · 7.4 KB
/
Copy pathcommands.mts
File metadata and controls
executable file
·235 lines (230 loc) · 7.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#!/usr/bin/env node
import { cmdAnalytics } from './command/analytics/cmd-analytics.mts'
import { cmdAsk } from './command/ask/cmd-ask.mts'
import { cmdAuditLog } from './command/audit-log/cmd-audit-log.mts'
import { cmdBundler } from './command/bundler/cmd-bundler.mts'
import { cmdCargo } from './command/cargo/cmd-cargo.mts'
import { cmdCI } from './command/ci/cmd-ci.mts'
import { cmdConfig } from './command/config/cmd-config.mts'
import { cmdDoctor } from './command/doctor/cmd-doctor.mts'
import { cmdFix } from './command/fix/cmd-fix.mts'
import { cmdGem } from './command/gem/cmd-gem.mts'
import { cmdGo } from './command/go/cmd-go.mts'
import { cmdInstall } from './command/install/cmd-install.mts'
import { cmdJson } from './command/json/cmd-json.mts'
import { cmdLogin } from './command/login/cmd-login.mts'
import { cmdLogout } from './command/logout/cmd-logout.mts'
import { cmdManifest } from './command/manifest/cmd-manifest.mts'
import { cmdMcp } from './command/mcp/cmd-mcp.mts'
import { cmdNpm } from './command/npm/cmd-npm.mts'
import { cmdNpx } from './command/npx/cmd-npx.mts'
import { cmdNuget } from './command/nuget/cmd-nuget.mts'
import { cmdOops } from './command/oops/cmd-oops.mts'
import { cmdOptimize } from './command/optimize/cmd-optimize.mts'
import { cmdOrganizationDependencies } from './command/organization/cmd-organization-dependencies.mts'
import { cmdOrganizationPolicyLicense } from './command/organization/cmd-organization-policy-license.mts'
import { cmdOrganizationPolicySecurity } from './command/organization/cmd-organization-policy-security.mts'
import { cmdOrganization } from './command/organization/cmd-organization.mts'
import { cmdPackage } from './command/package/cmd-package.mts'
import { cmdPatch } from './command/patch/cmd-patch.mts'
import { cmdPip } from './command/pip/cmd-pip.mts'
import { cmdPnpm } from './command/pnpm/cmd-pnpm.mts'
import { cmdPyCli } from './command/pycli/cmd-pycli.mts'
import { cmdRawNpm } from './command/raw-npm/cmd-raw-npm.mts'
import { cmdRawNpx } from './command/raw-npx/cmd-raw-npx.mts'
import { cmdRepository } from './command/repository/cmd-repository.mts'
import { cmdSbom } from './command/sbom/cmd-sbom.mts'
import { cmdScan } from './command/scan/cmd-scan.mts'
import { cmdSfw } from './command/sfw/cmd-sfw.mts'
import { cmdThreatFeed } from './command/threat-feed/cmd-threat-feed.mts'
import { cmdUninstall } from './command/uninstall/cmd-uninstall.mts'
import { cmdUv } from './command/uv/cmd-uv.mts'
import { cmdWhoami } from './command/whoami/cmd-whoami.mts'
import { cmdWrapper } from './command/wrapper/cmd-wrapper.mts'
import { cmdYarn } from './command/yarn/cmd-yarn.mts'
export const rootCommands = {
analytics: cmdAnalytics,
ask: cmdAsk,
'audit-log': cmdAuditLog,
bundler: cmdBundler,
cargo: cmdCargo,
ci: cmdCI,
config: cmdConfig,
dependencies: cmdOrganizationDependencies,
doctor: cmdDoctor,
fix: cmdFix,
gem: cmdGem,
go: cmdGo,
install: cmdInstall,
json: cmdJson,
license: cmdOrganizationPolicyLicense,
login: cmdLogin,
logout: cmdLogout,
manifest: cmdManifest,
mcp: cmdMcp,
npm: cmdNpm,
npx: cmdNpx,
nuget: cmdNuget,
oops: cmdOops,
optimize: cmdOptimize,
organization: cmdOrganization,
package: cmdPackage,
patch: cmdPatch,
pip: cmdPip,
pnpm: cmdPnpm,
pycli: cmdPyCli,
'raw-npm': cmdRawNpm,
'raw-npx': cmdRawNpx,
repository: cmdRepository,
sbom: cmdSbom,
scan: cmdScan,
security: cmdOrganizationPolicySecurity,
sfw: cmdSfw,
'threat-feed': cmdThreatFeed,
uninstall: cmdUninstall,
uv: cmdUv,
whoami: cmdWhoami,
wrapper: cmdWrapper,
yarn: cmdYarn,
}
/**
* Bucket assignments for the `socket --help` layout.
*
* Each public command can opt into one of four display buckets, or stay
* unbucketed (registered + reachable, but not surfaced in the top-level help
* text — useful for ecosystem-specific commands that are documented elsewhere
* or experimental commands not yet ready for prominent placement).
*
* The help builder reads this map to render the bucketed sections. Adding a new
* public command = (a) register it in `rootCommands`, (b) optionally add a
* bucket here. No parallel hand-maintained list to drift.
*
* Drift is impossible-by-construction: - A command in this map but not in
* `rootCommands` would be a compile error (TypeScript narrows the keys). - A
* command in `rootCommands` but not here = unbucketed, which is a valid state.
*/
export type RootCommandBucket = 'main' | 'api' | 'tools' | 'config'
// Grouped by help-display bucket (main/api/tools/config), not alphabetical.
export const rootCommandBuckets: Readonly<
Partial<Record<keyof typeof rootCommands, RootCommandBucket>>
// oxlint-disable-next-line socket/sort-object-literal-properties -- buckets
> = {
// Main commands — the "hero" actions surfaced first in `socket --help`.
fix: 'main',
optimize: 'main',
doctor: 'main',
ci: 'main',
sbom: 'main',
// Socket API — commands that hit the Socket.dev REST API.
analytics: 'api',
'audit-log': 'api',
organization: 'api',
package: 'api',
repository: 'api',
scan: 'api',
'threat-feed': 'api',
// Local tools — commands that wrap a local toolchain (npm, pip, …)
// or operate on the local filesystem without API calls.
manifest: 'tools',
npm: 'tools',
npx: 'tools',
pycli: 'tools',
'raw-npm': 'tools',
'raw-npx': 'tools',
sfw: 'tools',
// CLI configuration — login / logout / install / etc.
config: 'config',
install: 'config',
login: 'config',
logout: 'config',
uninstall: 'config',
whoami: 'config',
wrapper: 'config',
}
export const rootAliases = {
audit: {
description: `${cmdAuditLog.description} (alias)`,
hidden: false,
argv: ['audit-log'],
},
'audit-logs': {
description: cmdAuditLog.description,
hidden: true,
argv: ['audit-log'],
},
auditLog: {
description: cmdAuditLog.description,
hidden: true,
argv: ['audit-log'],
},
auditLogs: {
description: cmdAuditLog.description,
hidden: true,
argv: ['audit-log'],
},
deps: {
description: `${cmdOrganizationDependencies.description} (alias)`,
hidden: false,
argv: ['dependencies'],
},
feed: {
description: `${cmdThreatFeed.description} (alias)`,
hidden: false,
argv: ['threat-feed'],
},
firewall: {
description: `${cmdSfw.description} (alias)`,
hidden: false,
argv: ['sfw'],
},
org: {
description: `${cmdOrganization.description} (alias)`,
hidden: false,
argv: ['organization'],
},
organisation: {
description: cmdOrganization.description,
hidden: true,
argv: ['organization'],
},
organisations: {
description: cmdOrganization.description,
hidden: true,
argv: ['organization'],
},
organizations: {
description: cmdOrganization.description,
hidden: true,
argv: ['organization'],
},
orgs: {
description: cmdOrganization.description,
hidden: true,
argv: ['organization'],
},
pip3: {
description: `${cmdPip.description} (alias)`,
hidden: true,
argv: ['pip'],
},
pkg: {
description: `${cmdPackage.description} (alias)`,
hidden: false,
argv: ['package'],
},
repo: {
description: `${cmdRepository.description} (alias)`,
hidden: false,
argv: ['repository'],
},
repos: {
description: cmdRepository.description,
hidden: true,
argv: ['repository'],
},
repositories: {
description: cmdRepository.description,
hidden: true,
argv: ['repository'],
},
}