Skip to content

Commit be81a40

Browse files
committed
docs: update documentation to use stub terminology
- Rename BOOTSTRAP_UPDATE_FLOW.md to STUB_EXECUTION_FLOW.md - Update all references from bootstrap to stub - Clarify that binaries use yao-pkg, not Node.js native SEA - Update flow diagrams to reflect stub architecture
1 parent da54a75 commit be81a40

File tree

2 files changed

+18
-27
lines changed

2 files changed

+18
-27
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Bootstrap Node.js Juggling & Update Flow
1+
# Stub Execution & Update Flow
22

3-
This document describes the complete flow of Socket CLI's bootstrap mechanism, including Node.js runtime selection, update checking logic, and permission handling.
3+
This document describes the complete flow of Socket CLI's stub execution mechanism, including Node.js runtime selection, update checking logic, and permission handling.
44

55
## Directory Structure
66

@@ -32,13 +32,13 @@ This document describes the complete flow of Socket CLI's bootstrap mechanism, i
3232
└── tmp/ # Temporary files
3333
```
3434

35-
## 1. Bootstrap Startup - Node.js Decision Tree
35+
## 1. Stub Startup - Node.js Decision Tree
3636

3737
```
3838
User runs: /usr/local/bin/socket scan
3939
4040
┌──────────────────────────────────────────────────────────────────────┐
41-
Bootstrap Stub (embedded in SEA binary)
41+
│ Stub Binary (yao-pkg executable)
4242
│ Checks: ~/.socket/_cli/package/package.json exists? │
4343
└──────────────────────────────────────────────────────────────────────┘
4444
↓ No ↓ Yes
@@ -99,7 +99,7 @@ User runs: /usr/local/bin/socket scan
9999
### Node.js Detection Logic
100100

101101
```typescript
102-
// In src/sea/bootstrap.mts
102+
// In src/sea/stub.mts
103103
async function detectSystemNode(): Promise<string | null> {
104104
try {
105105
const nodeCmd = process.platform === 'win32' ? 'node.exe' : 'node'

docs/STUB_PACKAGE_FLOW.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ This document describes how Socket CLI handles platform-specific binary distribu
55
## Overview
66

77
The Socket CLI uses a two-tier distribution model:
8-
1. **`socket` npm package**: Lightweight stub that downloads platform-specific binaries
8+
1. **`socket` npm package**: Lightweight npm package that downloads platform-specific binaries
99
2. **`@socketsecurity/cli` npm package**: Full CLI implementation (JavaScript/TypeScript)
1010

11+
The binaries are built using yao-pkg (enhanced fork of vercel/pkg), not Node.js native SEA.
12+
1113
## Architecture Components
1214

1315
```
@@ -67,30 +69,19 @@ matrix:
6769
6870
Each platform build follows these steps:
6971
70-
1. **Build Bootstrap**: Compile TypeScript bootstrap to CommonJS
72+
1. **Build Stub**: Compile TypeScript stub to CommonJS
7173
```bash
72-
pnpm run build:sea:internal:bootstrap
73-
# Outputs: dist/sea/bootstrap.cjs
74-
```
75-
76-
2. **Generate SEA Blob**: Create Node.js SEA configuration
77-
```javascript
78-
// sea-config.json
79-
{
80-
"main": "dist/sea/bootstrap.cjs",
81-
"output": "dist/sea/sea-prep.blob",
82-
"disableExperimentalSEAWarning": true,
83-
"useSnapshot": false, // Snapshots not stable across Node versions
84-
"useCodeCache": true // Improve startup performance
85-
}
74+
pnpm run build:sea:stub
75+
# Outputs: dist/sea/stub.cjs
8676
```
8777

88-
3. **Inject into Node Binary**: Platform-specific binary creation
89-
- Download Node.js binary for target platform
90-
- Inject SEA blob using Node's `--experimental-sea-config`
91-
- Apply platform-specific post-processing
78+
2. **Package with yao-pkg**: Create single executable
79+
- Uses yao-pkg (enhanced fork of vercel/pkg)
80+
- Not Node.js 24's native SEA feature
81+
- Embeds Node.js runtime + stub code
82+
- Configures platform-specific settings
9283

93-
4. **Platform Post-Processing**:
84+
3. **Platform Post-Processing**:
9485
- **Windows**: Sign with certificate (if available)
9586
- **macOS**: Remove quarantine attributes, ad-hoc sign
9687
- **Linux**: Set executable permissions
@@ -262,7 +253,7 @@ $ socket scan
262253
┌──────────────────────────────────────────┐
263254
│ Platform Binary (socket-linux-x64) │
264255
│ │
265-
│ 1. SEA Bootstrap Executes │
256+
│ 1. Stub Code Executes
266257
│ 2. Check ~/.socket/_cli/package/ │
267258
│ 3. Download @socketsecurity/cli if needed │
268259
│ 4. Spawn Node.js with CLI │

0 commit comments

Comments
 (0)