Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .claude/skills/bump-bundled-tools/SKILL.md

This file was deleted.

15 changes: 15 additions & 0 deletions .claude/skills/bump-cli-tools/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: bump-cli-tools
description: Route Socket CLI tool updates to their release workflows. Use when a request spans tools or the tool's packaging path is unclear.
allowed-tools: Read, Edit, Write, Bash, Glob
user-invocable: true
---

# Update CLI tools

Take the requested tool names and exact upstream versions as `$ARGUMENTS`. Ask
only for missing values. Read [the tool inventory](references/cli-tools.md),
then follow each matching `bump-*` skill.

For multiple tools, follow each workflow and keep separate changes in separate
PRs unless the user asks to combine them.
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Tools bundled in the native CLI
# Pinned CLI tools

| Tool and type | Pin | Staging path | Target and status | Skill |
| Tool | Pin | Delivery | Notes | Skill |
| --- | --- | --- | --- | --- |
| `socket-patch` executable | `dependencies.@socketsecurity/socket-patch` in `package.json` | `src/sea/build-sea.mts` → `resources/socket-patch` | Built for targets with a matching locked platform package; the manifest records its digest. | [bump-socket-patch](../../bump-socket-patch/SKILL.md) |
| Coana CLI | `COANA_CLI_VERSION` in `src/constants.mts` | Downloaded from the Socket API on first use and cached by the CLI. | Not part of the native executable. | [bump-coana](../../bump-coana/SKILL.md) |
| Socket Patch executable | `dependencies.@socketsecurity/socket-patch` in `package.json` | `src/sea/build-sea.mts` → `resources/socket-patch` | Built for targets with a matching locked platform package; the manifest records its digest. | [bump-socket-patch](../../bump-socket-patch/SKILL.md) |
| `uv` executable | `src/sea/stage/uv-pins.json` | `src/sea/stage/uv.mts` → `tools/uv` | Target archives are checksum-verified; the manifest records each binary digest. | [bump-uv](../../bump-uv/SKILL.md) |
| `cdxgen` JavaScript API | `devDependencies.@cyclonedx/cdxgen` in `package.json` | `.config/rollup.cdxgen-sea.config.mjs` and `src/sea/build-sea.mts` → `tools/cdxgen` | `darwin-arm64` only; capability stays disabled until provenance and notices are resolved. | [bump-cdxgen](../../bump-cdxgen/SKILL.md) |
| `synp` JavaScript package | `devDependencies.synp` in `package.json` | `src/sea/stage/synp.mts` → `tools/synp` | `darwin-arm64` only; Yarn Classic stays disabled until provenance and notices are resolved. | [bump-synp](../../bump-synp/SKILL.md) |

Node is the SEA runtime; use [bump-node-sea](../../bump-node-sea/SKILL.md).
Coana runs from a Socket API download; use [bump-coana](../../bump-coana/SKILL.md).
The .NET facts helper is built from source and requires a compatible .NET SDK.
Socket Python CLI has no version pin or VFS staging step in this repo.
2 changes: 2 additions & 0 deletions .claude/skills/bump-coana/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ user-invocable: true

# Bump the Coana CLI

For a new release, check for the Socket CLI PR created by Coana's `Publish CLI` workflow (`publish-cli.yml`). It normally opens the PR and refreshes `src/vendor/coana-cache.mjs`. Continue on that PR instead of opening a duplicate. Use these steps for a manual bump.

Take the exact Coana version as `$ARGUMENTS` in `X.Y.Z` form; ask if it is
missing. Read [the pin and snapshot notes](references/pin-and-snapshots.md).

Expand Down
10 changes: 9 additions & 1 deletion .config/rollup.dist.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function relativeBlessedPath(filepath) {
)
}

// The cache script vendored from coana-package-manager, which coana-release.mts
// The cache script vendored from coana-package-manager, which coana/release.mts
// runs with `node`.
async function copyCoanaCache() {
const filepath = path.join(constants.srcPath, 'vendor/coana-cache.mjs')
Expand Down Expand Up @@ -489,6 +489,14 @@ export default async () => {
switch (id) {
case constantsSrcPath:
return CONSTANTS
case normalizePath(path.join(srcPath, 'constants/runtime.mts')):
return 'runtime-constants'
case normalizePath(path.join(utilsSrcPath, 'env.mts')):
return 'env-helpers'
case normalizePath(path.join(utilsSrcPath, 'spawn-sync.mts')):
return 'spawn-sync'
case normalizePath(path.join(utilsSrcPath, 'spinner.mts')):
return 'spinner'
case flagsSrcPath:
return FLAGS
case shadowNpmBinSrcPath:
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,6 @@ jobs:

- *install-dependencies

- name: Build and test the SEA
env:
NODE_OPTIONS: ${{ runner.os == 'macOS' && '--max-old-space-size=4096' || '' }}
shell: bash
run: |
pnpm build:sea
pnpm test:sea

- name: Download the verified launcher
shell: bash
env:
Expand All @@ -326,6 +318,17 @@ jobs:
DIST_DIRECTORY: ${{ runner.temp }}/launcher
run: node .github/scripts/download-release-artifacts.mts

- name: Build and test the SEA
env:
NODE_OPTIONS: ${{ runner.os == 'macOS' && '--max-old-space-size=4096' || '' }}
SOCKET_CLI_API_TOKEN: ${{ startsWith(needs.verify.outputs.version, '2.') && !startsWith(matrix.target, 'win32-') && secrets.SOCKET_API_TOKEN_FOR_CLI_AND_SFW || '' }} # zizmor: ignore[secrets-outside-env]
SOCKET_CLI_COANA_REQUIRED: ${{ startsWith(needs.verify.outputs.version, '2.') && '1' || '0' }}
shell: bash
run: |
pnpm build:sea
unset SOCKET_CLI_API_TOKEN
pnpm test:sea

- name: Pack verified platform binary
shell: bash
env:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,8 @@
!/src/sea/readme-version.mts
!/src/sea/.node-version
!/src/sea/node-version.mts
!/src/sea/paths/
!/src/sea/paths/**
!/src/sea/licenses/cdxgen-third-party/boolbase-1.0.0-ISC.txt
!/src/sea/licenses/cdxgen-third-party/err-code-2.0.3-MIT.txt
!/src/sea/licenses/cdxgen-third-party/imurmurhash-0.1.4-MIT.txt
Expand Down Expand Up @@ -1128,7 +1130,8 @@
!/src/utils/bin.mts
!/src/utils/check-input.mts
!/src/utils/cmd.mts
!/src/utils/coana-release.mts
!/src/utils/coana/
!/src/utils/coana/**
!/src/utils/coana-release.test.mts
!/src/utils/coana.mts
!/src/utils/coana.test.mts
Expand Down
2 changes: 1 addition & 1 deletion src/commands/fix/coana-fix-dynamic-sbom-inference.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const mockGitUntrackedFiles = vi.hoisted(() =>
const mockGitCommit = vi.hoisted(() => vi.fn())
const mockGenerateSocketFactsForFix = vi.hoisted(() => vi.fn())

vi.mock('../../utils/coana-release.mts', () => ({
vi.mock('../../utils/coana/release.mts', () => ({
spawnCoana: mockSpawnCoana,
}))

Expand Down
2 changes: 1 addition & 1 deletion src/commands/fix/coana-fix-pr-files.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const mockGitUnstagedModifiedFiles = vi.hoisted(() => vi.fn())
const mockGitUntrackedFiles = vi.hoisted(() => vi.fn())
const mockGitCommit = vi.hoisted(() => vi.fn())

vi.mock('../../utils/coana-release.mts', () => ({
vi.mock('../../utils/coana/release.mts', () => ({
spawnCoana: mockSpawnCoana,
}))

Expand Down
2 changes: 1 addition & 1 deletion src/commands/fix/coana-fix.mts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from '../../constants.mts'
import { handleApiCall } from '../../utils/api.mts'
import { joinAnd } from '../../utils/arrays.mts'
import { spawnCoana } from '../../utils/coana-release.mts'
import { spawnCoana } from '../../utils/coana/release.mts'
import {
isReachabilityReportPath,
isSocketFactsFile,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/fix/handle-fix-limit.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const mockGitUntrackedFiles = vi.hoisted(() =>
vi.fn(async () => ({ ok: true, data: [] })),
)

vi.mock('../../utils/coana-release.mts', () => ({
vi.mock('../../utils/coana/release.mts', () => ({
spawnCoana: mockSpawnCoana,
}))

Expand Down
2 changes: 1 addition & 1 deletion src/commands/scan/perform-reachability-analysis.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import path from 'node:path'
import { isOmittedReachValue } from './reachability-units.mts'
import constants, { COANA_CLI_VERSION } from '../../constants.mts'
import { handleApiCall } from '../../utils/api.mts'
import { spawnCoana } from '../../utils/coana-release.mts'
import { spawnCoana } from '../../utils/coana/release.mts'
import {
extractTier1ReachabilityScanId,
isReachabilityReportPath,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/scan/perform-reachability-analysis.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ vi.mock('../../utils/organization.mts', () => ({
hasEnterpriseOrgPlan: mockHasEnterpriseOrgPlan,
}))

vi.mock('../../utils/coana-release.mts', () => ({
vi.mock('../../utils/coana/release.mts', () => ({
spawnCoana: mockSpawnCoana,
}))

Expand Down
2 changes: 1 addition & 1 deletion src/sea/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The build stages and embeds the `cdxgen` and `synp` APIs for darwin-arm64, but t

Rollup creates a notice inventory from each bundled dependency graph. Some pinned packages omit their license text from npm; exact package-version entries in `.config/rollup.cdxgen-sea.config.mjs` and `src/sea/rollup-provenance.mjs` supply the missing text. A dependency bump cannot reuse a mismatched entry, so the inventory records a missing-text obligation. README files are not used as license text or shipped as notice documents.

The build does not embed Coana, Python, or a JVM toolchain. It does not add a runtime path to download helper tools. Socket API requests and project inputs keep their existing network behavior.
The 2.x RC embeds Coana's CLI and analyzers for Linux and macOS. Its build needs a Socket API token with Coana artifact access; without access, the build fails. Windows, Python, and JVM capabilities remain unavailable. The runtime does not download helper tools.

## Manifest

Expand Down
4 changes: 3 additions & 1 deletion src/sea/archive-paths.mts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
export function seaArchivePaths({
hasCdxgen,
hasCoana = false,
hasSynp,
hasUv,
rootFiles,
}: {
hasCdxgen: boolean
hasCoana?: boolean
hasSynp: boolean
hasUv: boolean
rootFiles: string[]
Expand All @@ -14,6 +16,6 @@ export function seaArchivePaths({
'external',
...rootFiles,
'resources',
...(hasCdxgen || hasSynp || hasUv ? ['tools'] : []),
...(hasCdxgen || hasCoana || hasSynp || hasUv ? ['tools'] : []),
]
}
28 changes: 28 additions & 0 deletions src/sea/bootstrap.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import os from 'node:os'
import path from 'node:path'
import { Worker } from 'node:worker_threads'

import { SEA_COANA_VFS_PATHS } from './paths/coana.mts'
import { cleanupBundledTool, getBundledTool } from './runtime.mts'
import { digestVfs } from './vfs-digest.mts'

// The builder records its inputs in the bootstrap, outside the archive being tested.
declare const INLINED_SEA_SMOKE_TEST: null | {
digest: string
coanaVersion?: string
coanaNodeVersion?: string
uvVersion?: string
}

Expand Down Expand Up @@ -62,6 +65,31 @@ async function smokeTest(): Promise<void> {
await cleanupBundledTool(uv)
}
}
if (seaSmokeTest.coanaVersion) {
assert.equal(
await fs
.stat(path.join(__dirname, SEA_COANA_VFS_PATHS.cliWrapper))
.then(stat => stat.isFile()),
true,
)
assert.equal(
await fs
.stat(path.join(__dirname, SEA_COANA_VFS_PATHS.analyzers, 'repos'))
.then(stat => stat.isDirectory()),
true,
)
const node = await getBundledTool('coana-node')
try {
const output = execFileSync(node, ['--version'], {
encoding: 'utf8',
timeout: 15_000,
})
assert.equal(output.trim(), `v${seaSmokeTest.coanaNodeVersion}`)
process.stdout.write(output)
} finally {
await cleanupBundledTool(node)
}
}
console.log('VFS smoke test passed')
}

Expand Down
Loading
Loading