Skip to content

Commit cdbbcf2

Browse files
committed
fix(lint): revert colocate work in packages/cli/src — fleet rule requires export
I incorrectly colocated 89 functions across 52 files in earlier 'drop unused export' commits, not realizing the fleet rule socket/export-top- level-functions enforces `export function …` for testability. The companion rule socket/sort-source-methods then complained about ordering. Run `pnpm exec oxlint --config .config/oxlintrc.json` to verify: all 141 violations introduced by the colocate work are gone after this revert. tsc --noEmit also passes. This restores `export` on every flagged function. Files touched are strictly the ones lint flagged — no other behavioral changes.
1 parent 8de9e3e commit cdbbcf2

52 files changed

Lines changed: 89 additions & 89 deletions

Some content is hidden

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

packages/cli/src/bootstrap/node.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const logger = getDefaultLogger()
3636
* Download CLI using npm pack command. This delegates to npm which handles
3737
* downloading and extracting the latest version.
3838
*/
39-
async function downloadCli(): Promise<void> {
39+
export async function downloadCli(): Promise<void> {
4040
const packageName = getCliPackageName()
4141
const dlxDir = getDlxDir()
4242
const cliDir = getCliPackageDir()
@@ -112,7 +112,7 @@ async function downloadCli(): Promise<void> {
112112
/**
113113
* Check if CLI is installed.
114114
*/
115-
function isCliInstalled(): boolean {
115+
export function isCliInstalled(): boolean {
116116
const entryPoint = getCliEntryPoint()
117117
const packageJson = `${getCliPackageDir()}/package.json`
118118
return existsSync(entryPoint) && existsSync(packageJson)

packages/cli/src/bootstrap/shared/node-flags.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ export function getNodeDisableSigusr1Flags(): string[] {
1414
/**
1515
* Get Node major version number.
1616
*/
17-
function getNodeMajorVersion(): number {
17+
export function getNodeMajorVersion(): number {
1818
return Number.parseInt(process.version.slice(1).split('.')[0] || '0', 10)
1919
}
2020

2121
/**
2222
* Get Node minor version number.
2323
*/
24-
function getNodeMinorVersion(): number {
24+
export function getNodeMinorVersion(): number {
2525
return Number.parseInt(process.version.slice(1).split('.')[1] || '0', 10)
2626
}
2727

2828
/**
2929
* Check if --disable-sigusr1 flag is supported. Supported in v22.14.0+,
3030
* v23.7.0+, v24.8.0+ (stable in v22.20.0+, v24.8.0+).
3131
*/
32-
function supportsDisableSigusr1(): boolean {
32+
export function supportsDisableSigusr1(): boolean {
3333
const major = getNodeMajorVersion()
3434
const minor = getNodeMinorVersion()
3535

packages/cli/src/cli-dispatch.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { waitForBootstrapHandshake } from './util/sea/boot.mjs'
2222
const logger = getDefaultLogger()
2323

2424
// Detect how this binary was invoked.
25-
function getInvocationMode(): string {
25+
export function getInvocationMode(): string {
2626
// Check environment variable first (for explicit mode).
2727
const envMode = process.env['SOCKET_CLI_MODE']
2828
if (envMode) {

packages/cli/src/cli-entry.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ setupTelemetryExitHandlers()
8989
* Write manifest entry for CLI installed via bootstrap. Bootstrap passes spec
9090
* and cache dir via environment variables.
9191
*/
92-
async function writeBootstrapManifestEntry(): Promise<void> {
92+
export async function writeBootstrapManifestEntry(): Promise<void> {
9393
const spec = getSocketCliBootstrapSpec()
9494
const cacheDir = getSocketCliBootstrapCacheDir()
9595

packages/cli/src/commands/audit-log/AuditLogRenderer.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export function displayAuditLogWithIocraft({
154154
/**
155155
* Format audit log entry as JSON with compact payload.
156156
*/
157-
function formatEntry(entry: AuditLogEntry): string {
157+
export function formatEntry(entry: AuditLogEntry): string {
158158
const obj = { ...entry, payload: 'REPLACEME' }
159159
const json = JSON.stringify(obj, null, 2).replace(
160160
/"payload": "REPLACEME"/,

packages/cli/src/commands/config/discover-config-value.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export async function discoverConfigValue(
128128
}
129129
}
130130

131-
async function getDefaultOrgFromToken(): Promise<
131+
export async function getDefaultOrgFromToken(): Promise<
132132
string[] | string | undefined
133133
> {
134134
const orgsCResult = await fetchOrganization()
@@ -147,7 +147,7 @@ async function getDefaultOrgFromToken(): Promise<
147147
return slugs
148148
}
149149

150-
async function getEnforceableOrgsFromToken(): Promise<
150+
export async function getEnforceableOrgsFromToken(): Promise<
151151
string[] | undefined
152152
> {
153153
const orgsCResult = await fetchOrganization()

packages/cli/src/commands/fix/env-helpers.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function checkCiEnvVars(): MissingEnvVars {
4242
return { missing, present }
4343
}
4444

45-
function ciRepoInfo(): RepoInfo | undefined {
45+
export function ciRepoInfo(): RepoInfo | undefined {
4646
if (!GITHUB_REPOSITORY) {
4747
debug('miss: GITHUB_REPOSITORY env var')
4848
return undefined

packages/cli/src/commands/fix/pull-request.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ type ContextualPrMatch = {
205205
match: PrMatch
206206
}
207207

208-
async function getSocketFixPrsWithContext(
208+
export async function getSocketFixPrsWithContext(
209209
owner: string,
210210
repo: string,
211211
options?: SocketPrsOptions | undefined,

packages/cli/src/commands/install/setup-tab-completion.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const require = createRequire(import.meta.url)
2121

2222
import type { CResult } from '../../types.mts'
2323

24-
function getTabCompletionScriptRaw(): CResult<string> {
24+
export function getTabCompletionScriptRaw(): CResult<string> {
2525
// Resolve the @socketsecurity/cli package root to find the data directory.
2626
// This works whether running from source, installed globally, or via npx/dlx.
2727
let sourcePath: string

packages/cli/src/commands/logout/cmd-logout.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ const hidden = false
2626

2727
// Helper functions.
2828

29-
function applyLogout(): void {
29+
export function applyLogout(): void {
3030
updateConfigValue(CONFIG_KEY_API_TOKEN, undefined)
3131
updateConfigValue(CONFIG_KEY_API_BASE_URL, undefined)
3232
updateConfigValue(CONFIG_KEY_API_PROXY, undefined)
3333
updateConfigValue(CONFIG_KEY_ENFORCED_ORGS, undefined)
3434
invalidateDefaultApiToken()
3535
}
3636

37-
function attemptLogout(): void {
37+
export function attemptLogout(): void {
3838
try {
3939
applyLogout()
4040
logger.success('Successfully logged out')

0 commit comments

Comments
 (0)