Skip to content

Commit bfaf564

Browse files
authored
chore(skills): optimize updating and updating-checksums reference docs (#1136)
1 parent 5032467 commit bfaf564

File tree

5 files changed

+512
-3
lines changed

5 files changed

+512
-3
lines changed

.claude/skills/quality-scan/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,4 +476,4 @@ Apply these socket-cli conventions when scanning and fixing:
476476

477477
See `reference.md` @reference for complete agent prompts and pattern definitions.
478478

479-
**Version**: 1.1.0 (2026-03-24) | Compatible with socket-cli 3.0.0+ | Includes zizmor integration
479+
**Version**: 1.1.0 (2026-03-24)

.claude/skills/quality-scan/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,4 +959,4 @@ All findings follow this structure:
959959
960960
---
961961
962-
**Version**: 1.1.0 (2026-03-24) | Compatible with socket-cli 3.0.0+ | Includes zizmor integration
962+
**Version**: 1.1.0 (2026-03-24)

.claude/skills/updating-checksums/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ node packages/cli/scripts/sync-checksums.mjs
8484
<validation>
8585
**Expected Output:**
8686
```
87-
Syncing checksums for 7 GitHub release tool(s)...
87+
Syncing checksums for 6 GitHub release tool(s)...
8888
8989
[opengrep] opengrep/opengrep @ v1.16.0
9090
Found checksums.txt, downloading...
Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
# updating-checksums Reference Documentation
2+
3+
This document provides detailed information about external tool checksums, the sync script, and troubleshooting for the updating-checksums skill.
4+
5+
## Table of Contents
6+
7+
1. [External Tools Inventory](#external-tools-inventory)
8+
2. [Checksum Sync Script](#checksum-sync-script)
9+
3. [GitHub Release Tools](#github-release-tools)
10+
4. [Checksum Formats](#checksum-formats)
11+
5. [Edge Cases](#edge-cases)
12+
6. [Troubleshooting](#troubleshooting)
13+
14+
---
15+
16+
## External Tools Inventory
17+
18+
### GitHub Release Tools (synced by this skill)
19+
20+
| Tool | Repository | Release Tag Format | Has checksums.txt |
21+
|------|------------|-------------------|-------------------|
22+
| opengrep | opengrep/opengrep | `v*.*.*` | Yes |
23+
| python | astral-sh/python-build-standalone | `*.*.*` | No (computed) |
24+
| socket-patch | SocketDev/socket-patch | `v*.*.*` | Varies |
25+
| sfw | SocketDev/sfw-free | `v*.*.*` | Varies |
26+
| trivy | aquasecurity/trivy | `v*.*.*` | Yes |
27+
| trufflehog | trufflesecurity/trufflehog | `v*.*.*` | Yes |
28+
29+
### Non-GitHub Tools (NOT synced by this skill)
30+
31+
| Tool | Type | Integrity Method |
32+
|------|------|-----------------|
33+
| @coana-tech/cli | npm | SRI integrity hash |
34+
| @cyclonedx/cdxgen | npm | SRI integrity hash |
35+
| synp | npm | SRI integrity hash |
36+
| socketsecurity | pypi | SRI integrity hash |
37+
| socket-basics | github-source | None |
38+
39+
---
40+
41+
## Checksum Sync Script
42+
43+
### Location
44+
45+
`packages/cli/scripts/sync-checksums.mjs`
46+
47+
### How It Works
48+
49+
1. Reads `packages/cli/external-tools.json`
50+
2. Filters tools with `type: "github-release"`
51+
3. For each tool:
52+
a. Fetches the GitHub release by tag
53+
b. Looks for `checksums.txt` asset
54+
c. If found: parses SHA-256 hashes from checksums.txt
55+
d. If not found: downloads each release asset and computes SHA-256 via `crypto.createHash('sha256')`
56+
4. Compares new checksums with existing
57+
5. Writes updated checksums to external-tools.json
58+
59+
### Command Reference
60+
61+
```bash
62+
# Sync all GitHub release tools
63+
node packages/cli/scripts/sync-checksums.mjs
64+
65+
# Sync specific tool only
66+
node packages/cli/scripts/sync-checksums.mjs --tool=opengrep
67+
68+
# Preview changes without writing
69+
node packages/cli/scripts/sync-checksums.mjs --dry-run
70+
71+
# Force update even if unchanged
72+
node packages/cli/scripts/sync-checksums.mjs --force
73+
```
74+
75+
### Expected Output
76+
77+
```
78+
Syncing checksums for N GitHub release tool(s)...
79+
80+
[opengrep] opengrep/opengrep @ v1.16.0
81+
Found checksums.txt, downloading...
82+
Parsed 5 checksums from checksums.txt
83+
Updated: 2 checksums, Unchanged: 3 checksums
84+
85+
[trivy] aquasecurity/trivy @ v0.58.2
86+
Found checksums.txt, downloading...
87+
Parsed 12 checksums from checksums.txt
88+
Unchanged: 12 checksums
89+
90+
Summary: X updated, Y unchanged
91+
```
92+
93+
---
94+
95+
## GitHub Release Tools
96+
97+
### Release Asset Patterns
98+
99+
Each tool has specific asset naming conventions:
100+
101+
**opengrep:**
102+
- `opengrep-core_linux_aarch64.tar.gz`
103+
- `opengrep-core_linux_x86.tar.gz`
104+
- `opengrep-core_osx_aarch64.tar.gz`
105+
- `opengrep-core_osx_x86.tar.gz`
106+
- `opengrep-core_windows_x86.zip`
107+
- Includes `checksums.txt`
108+
109+
**python (python-build-standalone):**
110+
- `cpython-{version}+{buildTag}-{target}-{config}.tar.zst`
111+
- No checksums.txt — hashes computed by downloading each asset
112+
113+
**socket-patch:**
114+
- `socket-patch-aarch64-apple-darwin.tar.gz`
115+
- `socket-patch-x86_64-apple-darwin.tar.gz`
116+
- `socket-patch-aarch64-unknown-linux-gnu.tar.gz`
117+
- `socket-patch-x86_64-unknown-linux-musl.tar.gz`
118+
- `socket-patch-aarch64-pc-windows-msvc.zip`
119+
- `socket-patch-x86_64-pc-windows-msvc.zip`
120+
121+
**sfw (sfw-free):**
122+
- `sfw-free-linux-arm64`
123+
- `sfw-free-linux-x86_64`
124+
- `sfw-free-macos-arm64`
125+
- `sfw-free-macos-x86_64`
126+
- `sfw-free-musl-linux-arm64`
127+
- `sfw-free-musl-linux-x86_64`
128+
- `sfw-free-windows-x86_64.exe`
129+
130+
**trivy:**
131+
- `trivy_{version}_Linux-64bit.tar.gz`
132+
- `trivy_{version}_Linux-ARM64.tar.gz`
133+
- `trivy_{version}_macOS-64bit.tar.gz`
134+
- `trivy_{version}_macOS-ARM64.tar.gz`
135+
- `trivy_{version}_windows-64bit.zip`
136+
- Includes `trivy_{version}_checksums.txt`
137+
138+
**trufflehog:**
139+
- `trufflehog_{version}_linux_amd64.tar.gz`
140+
- `trufflehog_{version}_linux_arm64.tar.gz`
141+
- `trufflehog_{version}_darwin_amd64.tar.gz`
142+
- `trufflehog_{version}_darwin_arm64.tar.gz`
143+
- `trufflehog_{version}_windows_amd64.tar.gz`
144+
- `trufflehog_{version}_windows_arm64.tar.gz`
145+
- Includes checksums in release
146+
147+
### Checksum Storage Format
148+
149+
In `external-tools.json`, checksums are stored as:
150+
151+
```json
152+
{
153+
"checksums": {
154+
"asset-filename.tar.gz": "hex-encoded-sha256-hash",
155+
"asset-filename-2.tar.gz": "hex-encoded-sha256-hash"
156+
}
157+
}
158+
```
159+
160+
---
161+
162+
## Checksum Formats
163+
164+
### checksums.txt Format
165+
166+
Standard format used by most tools:
167+
168+
```
169+
sha256hash filename
170+
sha256hash filename
171+
```
172+
173+
- Two or more spaces between hash and filename
174+
- SHA-256 hex-encoded (64 characters)
175+
- One entry per line
176+
177+
### Computed Checksums
178+
179+
When no checksums.txt is available:
180+
181+
```javascript
182+
// Script computes SHA-256 by streaming the downloaded file
183+
const hash = crypto.createHash('sha256')
184+
const stream = fs.createReadStream(filePath)
185+
stream.pipe(hash)
186+
// Result: hex-encoded SHA-256
187+
```
188+
189+
---
190+
191+
## Edge Cases
192+
193+
### Tool with Dual Configuration (sfw)
194+
195+
The `sfw` tool has both a GitHub release binary (`SocketDev/sfw-free`) and an npm package (`sfw` on npmjs.com). Both are tracked in the same `external-tools.json` entry via `type: "github-release"` for the binary checksums and `npmPackage`/`npmVersion` fields for the npm component. The checksums skill only handles the GitHub release binary checksums; the npm package version is updated separately via `pnpm run update`.
196+
197+
### python-build-standalone
198+
199+
This tool has no checksums.txt in releases. The sync script must:
200+
1. Download each release asset
201+
2. Compute SHA-256 locally
202+
3. This is significantly slower than parsing checksums.txt
203+
204+
### Version Tag Variations
205+
206+
Different tools use different tag formats:
207+
- Most use `v{version}` (e.g., `v1.16.0`)
208+
- python-build-standalone uses bare version (e.g., `3.11.14`)
209+
- The `githubRelease` field in external-tools.json stores the exact tag
210+
211+
### Stale Checksums After Version Bump
212+
213+
If someone updates a tool version in external-tools.json but forgets to sync checksums:
214+
- SEA builds will fail integrity verification
215+
- Always run checksum sync after any version change
216+
217+
---
218+
219+
## Troubleshooting
220+
221+
### GitHub API Rate Limiting
222+
223+
**Symptom:** Script fails with 403 or rate limit error.
224+
225+
**Solution:**
226+
```bash
227+
# Check current rate limit
228+
gh api rate_limit --jq '.rate'
229+
230+
# Ensure authenticated
231+
gh auth status
232+
```
233+
234+
Authenticated requests get 5,000 requests/hour vs 60 for unauthenticated.
235+
236+
### Release Not Found
237+
238+
**Symptom:** Script reports release not found for a tool.
239+
240+
**Cause:** The `githubRelease` tag in external-tools.json doesn't match any release.
241+
242+
**Solution:**
243+
```bash
244+
# Verify release exists
245+
gh release view <tag> --repo <owner/repo>
246+
247+
# List recent releases
248+
gh release list --repo <owner/repo> --limit 5
249+
```
250+
251+
### Checksum Mismatch After Update
252+
253+
**Symptom:** Checksums changed but tool version didn't.
254+
255+
**Cause:** Release assets were re-uploaded (some projects rebuild releases).
256+
257+
**Solution:** This is expected in rare cases. Review the diff to ensure it's a legitimate update, then commit.
258+
259+
### JSON Validation Failure
260+
261+
**Symptom:** Updated external-tools.json is invalid JSON.
262+
263+
**Solution:**
264+
```bash
265+
# Validate JSON
266+
node -e "JSON.parse(require('fs').readFileSync('packages/cli/external-tools.json'))"
267+
268+
# If corrupted, restore and retry
269+
git checkout packages/cli/external-tools.json
270+
node packages/cli/scripts/sync-checksums.mjs
271+
```
272+
273+
### Large Downloads Timeout
274+
275+
**Symptom:** python-build-standalone sync times out (large assets).
276+
277+
**Solution:**
278+
- Sync specific tool: `--tool=python`
279+
- Ensure stable network connection
280+
- The script handles retries for individual assets

0 commit comments

Comments
 (0)