@@ -55,7 +55,7 @@ Common characteristics to look for:
5555
5656<instructions>
5757Scan all code files for these critical bug patterns:
58- - [IF monorepo ] TypeScript/JavaScript: packages/*/ scripts/**/*.{mjs,mts}, packages/*/ src/**/*.{mjs,mts}
58+ - [IF single package ] TypeScript/JavaScript: scripts/**/*.{mjs,mts}, src/**/*.{mjs,mts}
5959- [IF single package] TypeScript/JavaScript: src/**/*.{ts,mts,mjs,js}, lib/**/*.{ts,mts,mjs,js}
6060- [IF C/C++ code exists] C/C++: src/**/*.{c,cc,cpp,h}
6161- Focus on:
@@ -178,13 +178,12 @@ beforeAll(async () => {
178178})
179179```
180180
181- ** [ SOCKET-BTM SPECIFIC] Where to check:**
182- - packages/binpress/test/* .test.mts
183- - packages/binflate/test/* .test.mts
184- - packages/binject/test/* .test.mts
185- - Any test that uses ` BINPRESS ` , ` BINFLATE ` , or ` BINJECT ` as compression input
181+ ** Where to check:**
182+ - test/** /* .test.ts
183+ - test/** /* .test.mts
184+ - Any test that uses external binaries or performs heavy I/O operations
186185
187- ** Impact:** Tests using binsuite tools as input cause Linux CI timeouts (180-360 seconds)
186+ ** Impact:** Tests performing intensive operations can cause CI timeouts
188187</pattern >
189188
190189For each bug found, think through:
@@ -427,17 +426,15 @@ Your task is to analyze caching implementation for correctness, staleness bugs,
427426<context >
428427** [ SOCKET-BTM SPECIFIC - Adapt for your repository's caching strategy] **
429428
430- socket-btm uses a multi-stage checkpoint system to speed up builds:
431- - ** Checkpoint stages** : source-copied, source-patched, configured, compiled, stripped, compressed, final
432- - ** Storage** : tar.gz archives stored in build/checkpoints/{platform}-{arch}/
433- - ** Invalidation** : Based on cache keys (hashes of patches, config, source version)
434- - ** Progressive builds** : Can restore from any checkpoint and continue
435- - ** Cross-platform** : Must work on Windows, macOS, Linux (ARM64, x64)
436- - ** Critical** : Stale checkpoints cause incorrect builds that are hard to debug
437-
438- Caching locations:
439- - packages/node-smol-builder/scripts/common/shared/checkpoints.mjs
440- - packages/node-smol-builder/build/checkpoints/
429+ This project may use caching for build artifacts or API responses:
430+ - ** Storage** : Cache files or API response caching
431+ - ** Invalidation** : Based on cache keys (content hashes, timestamps, versions)
432+ - ** Cross-platform** : Must work on Windows, macOS, Linux
433+ - ** Critical** : Stale cache can cause incorrect behavior that's hard to debug
434+
435+ Caching locations (if applicable):
436+ - Build cache directories
437+ - API response caching (nock fixtures for tests)
441438- Cache key generation and validation logic
442439</context >
443440
@@ -463,10 +460,8 @@ Checkpoint key generation correctness:
463460- Additions: Are build-infra/binject changes invalidating checkpoints?
464461- Environment: Are env vars (NODE_OPTIONS, etc.) affecting builds included?
465462
466- ** [ SOCKET-BTM SPECIFIC] ** NOTE: SOURCE_PATCHED and SOURCE_COPIED checkpoints intentionally omit platform/arch/libc
467- because source patching is platform-agnostic - the same patches apply regardless of
468- target platform. Only binary compilation stages (COMPILED, STRIPPED, COMPRESSED, FINALIZED)
469- need platform-specific cache keys. Do NOT flag this as an issue.
463+ ** NOTE** : Platform-agnostic operations may share cache keys across platforms,
464+ while platform-specific operations should include platform/arch in cache keys.
470465</pattern >
471466
472467<pattern name =" checkpoint_corruption " >
@@ -515,7 +510,7 @@ Think through each issue:
515510<output_format>
516511For each finding, report:
517512
518- File: packages/node-smol-builder/scripts/common/shared/checkpoints.mjs : lineNumber
513+ File: src/path/to/cache-module.ts : lineNumber
519514Issue: [ One-line description]
520515Severity: High | Medium
521516Scenario: [ Step-by-step sequence showing how bug manifests]
@@ -524,8 +519,8 @@ Fix: [Specific code change]
524519Impact: [ Observable effect - wrong output, performance, crash]
525520
526521Example:
527- File: packages/node-smol-builder/scripts/common/shared/checkpoints.mjs :145
528- Issue: Cache key missing patch content hashes
522+ File: src/path/to/cache-module.ts :145
523+ Issue: Cache key missing content hashes
529524Severity: High
530525Scenario: 1) Build with patch v1, creates checkpoint. 2) Patch file modified to v2 (same filename). 3) Build restores v1 checkpoint. 4) Produces binary with v1 patches but v2 expected
531526Pattern: ` const cacheKey = \ ` \$ {nodeVersion}-\$ {platform}-\$ {arch}\` `
@@ -558,7 +553,7 @@ Your task is to identify issues in socket-btm's development workflows, build scr
558553
559554<context >
560555socket-btm is a pnpm monorepo with:
561- - ** Build scripts** : packages/ * / scripts/** /* .{mjs,mts} (ESM, cross-platform Node.js)
556+ - ** Build scripts** : scripts/** /* .{mjs,mts} (ESM, cross-platform Node.js)
562557- ** Package manager** : pnpm workspaces with scripts in each package.json
563558- ** Git hooks** : .git-hooks/* for pre-commit, pre-push validation
564559- ** CI** : GitHub Actions (.github/workflows/)
@@ -716,8 +711,8 @@ buildBinSuitePackage({
716711 - Fix: Use bin-infra/lib/builder for consistent behavior
717712
718713** Check these files:**
719- - packages/ * / scripts/build.mjs - Must use buildBinSuitePackage
720- - packages/ * /Makefile. * - Should not be invoked directly (only via build.mjs)
714+ - scripts/build.mjs - Build orchestration script
715+ - Build scripts should be cross-platform compatible
721716- README.md files - Should document ` pnpm run build ` , not direct make
722717</pattern >
723718
@@ -1453,39 +1448,39 @@ Severity Guidelines:
14531448- Low : Minor inaccuracies or missing non-critical information
14541449
14551450Example :
1456- File : packages/binject/ README.md:46
1457- Issue : Incorrect description of NODE_SEA section compression format
1451+ File : README.md:46
1452+ Issue : Incorrect description of API method behavior
14581453Severity : High
1459- Pattern : " NODE_SEA - Compressed application code (Brotli, ~70-80% reduction) "
1460- Actual : NODE_SEA contains uncompressed blobs generated by Node.js itself , not Brotli-compressed data
1461- Fix : Change to: "NODE_SEA - Single Executable Application code (generated by Node.js) "
1462- Impact : Misleads developers about the actual format, causing confusion when inspecting binaries
1454+ Pattern : " getFullReport() - Returns comprehensive security analysis "
1455+ Actual : Method only returns issues data , not full report with metadata
1456+ Fix : Change to: "getFullReport() - Returns security issues with scores and alerts "
1457+ Impact : Misleads developers about the actual return value structure
14631458
14641459Example :
14651460File : README.md:25
1466- Issue : Incorrect package name in build command
1461+ Issue : Incorrect package name in installation command
14671462Severity : High
1468- Pattern : " pnpm --filter @socketbin/node-smol-builder run build "
1469- Actual : package.json shows "name": "node-smol-builder" without @socketbin scope
1470- Fix : Change to: "pnpm --filter node-smol-builder run build "
1471- Impact : Command will fail with "No projects matched" error
1463+ Pattern : " npm install @socket/sdk-js "
1464+ Actual : package.json shows "name": "@socketsecurity/sdk"
1465+ Fix : Change to: "npm install @socketsecurity/sdk "
1466+ Impact : Installation command will fail with package not found error
14721467
14731468Example :
1474- File : packages/build-infra/ README.md:14
1475- Issue : References non-existent module name
1469+ File : README.md:14
1470+ Issue : References non-existent export name
14761471Severity : Medium
1477- Pattern : " paths - Standard directory structure "
1478- Actual : Module is exported as "path-builder" in package.json exports
1479- Fix : Change to: "path-builder - Standard directory structure "
1480- Impact : Developers looking for "paths" module will not find it
1472+ Pattern : " import { SocketClient } from '@socketsecurity/sdk' "
1473+ Actual : Module exports as "SocketSdk" not "SocketClient" in package.json
1474+ Fix : Change to: "import { SocketSdk } from '@socketsecurity/sdk' "
1475+ Impact : Import will fail with module not found error
14811476
14821477Example :
1483- File : packages/binject/ README.md:227
1484- Issue : Incorrect config size documented
1478+ File : README.md:87
1479+ Issue : Incorrect API response size documented
14851480Severity : Low
1486- Pattern : " Config stored in binary format (1112 bytes) "
1487- Actual : Config is 1176 bytes (verified in source code)
1488- Fix : Change to: "Config stored in binary format (1176 bytes) "
1481+ Pattern : " Response payload limited to 1MB "
1482+ Actual : API limits responses to 5MB (verified in source code)
1483+ Fix : Change to: "Response payload limited to 5MB "
14891484Impact : Minor inaccuracy in technical specification
14901485
14911486**Junior Developer Friendliness Examples:**
@@ -1494,46 +1489,46 @@ Example:
14941489File : README.md:1-50
14951490Issue : Missing beginner-friendly introduction explaining project purpose
14961491Severity : High
1497- Pattern : Jumps directly to technical architecture without explaining what socket-btm is or why it exists
1498- Actual : Junior devs need context: "What is BTM ?", "Why custom Node.js ?", "When would I use this ?"
1499- Fix : Add "What is Socket BTM ?" section explaining: (1) Custom Node.js with Socket Security patches , (2) Minimal builds for production , (3) Use cases (CLI tools, serverless, containers )
1492+ Pattern : Jumps directly to API documentation without explaining what the SDK does
1493+ Actual : Junior devs need context: "What does this SDK do ?", "When should I use it ?", "How does it help ?"
1494+ Fix : Add "What is Socket SDK ?" section explaining: (1) Programmatic access to Socket.dev API , (2) Security analysis for packages , (3) Use cases (CI/CD, automated scanning, custom tooling )
15001495Impact : Junior devs confused about project purpose, may not understand if they need it
15011496
15021497Example :
1503- File : packages/binject/ README.md:15
1504- Issue : Assumes knowledge of Node.js SEA without explanation
1498+ File : README.md:15
1499+ Issue : Assumes knowledge of Socket.dev API without explanation
15051500Severity : Medium
1506- Pattern : " Injects SEA blobs into Node.js binaries "
1507- Actual : Junior devs don't know what SEA is or why injection is needed
1508- Fix : Add: "Single Executable Application (SEA) - bundles your app into a standalone binary. binject handles the low-level binary manipulation to embed your code into Node.js executables ."
1509- Impact : Technical jargon barrier prevents junior devs from understanding tool purpose
1501+ Pattern : " Queries Socket.dev security API for package analysis "
1502+ Actual : Junior devs don't know what Socket.dev is or what security data it provides
1503+ Fix : Add: "Socket.dev API - provides security analysis for npm packages including supply chain risk detection, malware scanning, and vulnerability tracking. This SDK provides programmatic access to all Socket.dev features ."
1504+ Impact : Technical jargon barrier prevents junior devs from understanding SDK purpose
15101505
15111506Example :
1512- File : packages/node-smol-builder/ README.md:80
1513- Issue : No troubleshooting section for common build errors
1507+ File : README.md:80
1508+ Issue : No troubleshooting section for common API errors
15141509Severity : Medium
15151510Pattern : Documentation shows happy path but no error handling guidance
1516- Actual : Junior devs hit errors like "Patch failed to apply " or "Checkpoint extraction failed " with no guidance
1517- Fix : Add "Troubleshooting" section covering: (1) Patch application failures → check upstream version , (2) Checkpoint errors → run clean , (3) Build timeouts → increase TIMEOUT_MS
1511+ Actual : Junior devs hit errors like "401 Unauthorized " or "Rate limit exceeded " with no guidance
1512+ Fix : Add "Troubleshooting" section covering: (1) Authentication failures → check API token , (2) Rate limits → implement retry logic , (3) Timeout errors → increase timeout setting
15181513Impact : Junior devs stuck when errors occur, need hand-holding for common issues
15191514
15201515Example :
15211516File : CLAUDE.md:125
1522- Issue : Complex "Source of Truth Architecture" without visual diagram or simple explanation
1517+ Issue : Complex architecture explanation without visual diagram or simple explanation
15231518Severity : Medium
1524- Pattern : Dense text explaining package relationships and sync direction
1525- Actual : Junior devs need visual representation and concrete examples to understand data flow
1526- Fix : Add ASCII diagram showing: packages/build-infra → additions/source-patched (one-way sync) , plus example: "When you fix a bug in build-infra/debug_common.h, you must sync it to node-smol-builder/additions/ "
1527- Impact : Junior contributors may edit wrong files, creating wasted work
1519+ Pattern : Dense text explaining module relationships and data flow
1520+ Actual : Junior devs need visual representation and concrete examples to understand architecture
1521+ Fix : Add ASCII diagram showing: API Request → HTTP Client → Response Parser → Type Validation → Return , plus example: "When you call getFullReport(), the SDK makes a GET request to /v0/report/... endpoint "
1522+ Impact : Junior contributors may struggle to understand internal architecture
15281523
15291524Example :
1530- File : packages/binpress/ README.md:1-100
1525+ File : README.md:1-100
15311526Issue : Missing "Getting Started" section with minimal working example
15321527Severity : High
15331528Pattern : Extensive API documentation but no simple end-to-end example
1534- Actual : Junior devs need: "How do I compress my first binary ? Step 1, Step 2, Step 3"
1535- Fix : Add "Quick Start" section: "(1) Build binpress: pnpm run build , (2) Compress a binary: ./build/dev/out/Final/binpress input.exe output.exe , (3) Verify: ls -lh output.exe "
1536- Impact : Without concrete starting point, juniors struggle to use tool effectively
1529+ Actual : Junior devs need: "How do I scan my first package ? Step 1, Step 2, Step 3"
1530+ Fix : Add "Quick Start" section: "(1) Install: npm install @socketsecurity/sdk , (2) Create client: const sdk = new SocketSdk('your-api-key') , (3) Scan package: const report = await sdk.getIssuesByNPMPackage('lodash', '4.17.21') "
1531+ Impact : Without concrete starting point, juniors struggle to use SDK effectively
15371532</output_format>
15381533
15391534<quality_guidelines>
@@ -1560,63 +1555,63 @@ Scan all README.md files in the repository and report all documentation inaccura
15601555### High Severity - 3 issues
15611556
15621557#### README.md:25
1563- - ** Issue** : Incorrect package name in build command
1564- - ** Pattern** : ` pnpm --filter @socketbin/node-smol-builder run build `
1565- - ** Actual** : package.json shows ` "name": "node-smol-builder" ` without scope
1566- - ** Fix** : Change to: ` pnpm --filter node-smol-builder run build `
1567- - ** Impact** : Command fails with "No projects matched" error
1568-
1569- #### packages/binject/ README.md:100
1570- - ** Issue** : Documents obsolete --update-config flag
1571- - ** Pattern** : ` binject inject -e ./node-smol -o ./my-app --sea app.blob --update-config update-config.json `
1572- - ** Actual** : Flag was removed, config now embedded via sea-config.json smol.update section
1573- - ** Fix** : Remove --update-config example, document sea-config.json approach instead
1574- - ** Impact** : Users will get "unknown flag" error, approach no longer works
1575-
1576- #### packages/build-infra/ README.md:12
1577- - ** Issue** : Documents non-existent "c-package" builder
1578- - ** Pattern** : "* -builder - Build strategies (cmake, rust, emscripten, c-package) "
1579- - ** Actual** : No c-package-builder.mjs exists; actual builders are: cmake, rust, emscripten, docker, clean
1580- - ** Fix** : List actual builders : "cmake, rust, emscripten, docker, clean "
1581- - ** Impact** : Users looking for c-package builder will be confused
1558+ - ** Issue** : Incorrect package name in installation command
1559+ - ** Pattern** : ` npm install @socket/sdk-js `
1560+ - ** Actual** : package.json shows ` "name": "@socketsecurity/sdk" `
1561+ - ** Fix** : Change to: ` npm install @socketsecurity/sdk `
1562+ - ** Impact** : Installation fails with package not found error
1563+
1564+ #### README.md:100
1565+ - ** Issue** : Documents obsolete method name
1566+ - ** Pattern** : ` sdk.getReport(packageName, version) `
1567+ - ** Actual** : Method was renamed to ` getFullReport() ` in v2.0
1568+ - ** Fix** : Update all examples to use ` getFullReport() `
1569+ - ** Impact** : Users will get method not found error
1570+
1571+ #### README.md:12
1572+ - ** Issue** : Documents non-existent export
1573+ - ** Pattern** : "Import { SocketClient } from ' @ socketsecurity/sdk ' "
1574+ - ** Actual** : Export is named "SocketSdk" not "SocketClient"
1575+ - ** Fix** : Change to : "import { SocketSdk } from ' @ socketsecurity/sdk ' "
1576+ - ** Impact** : Import will fail with module not found error
15821577
15831578### Medium Severity - 3 issues
15841579
1585- #### packages/binject/ README.md:62
1586- - ** Issue** : Output path missing build mode variants
1587- - ** Pattern** : "Outputs to ` build/prod/ out/Final/binject ` "
1588- - ** Actual** : Build system supports both dev and prod modes: ` build/{dev|prod}/out/Final/binject `
1589- - ** Fix** : Change to: "Outputs to ` build/{dev|prod}/out/Final/binject ` "
1590- - ** Impact** : Confusing for developers doing dev builds
1591-
1592- #### packages/node-smol-builder/ README.md:182
1593- - ** Issue** : Incorrect patch count
1594- - ** Pattern** : "Applies 15 patches to Node.js source "
1595- - ** Actual** : Only 12 patches in patches/source-patched/ directory
1596- - ** Fix** : Change to: "Applies 12 patches to Node.js source "
1597- - ** Impact** : Minor discrepancy in technical details
1598-
1599- #### packages/bin-infra/ README.md:1-21
1600- - ** Issue** : Missing 75% of package contents in documentation
1601- - ** Pattern** : Only documents src/ and make/ , omits lib/, test/, scripts/, upstream/, patches/
1602- - ** Actual** : Package has extensive JavaScript API (lib/), test utilities, build scripts, and upstream dependencies
1603- - ** Fix** : Add comprehensive documentation of all 17 C files, 3 JS modules with API examples, test helpers, scripts, and upstream submodules
1604- - ** Impact** : Developers unaware of most package functionality
1580+ #### README.md:62
1581+ - ** Issue** : Build output path incorrect
1582+ - ** Pattern** : "Build outputs to ` build/out/ ` "
1583+ - ** Actual** : Build system outputs to ` dist/ ` directory
1584+ - ** Fix** : Change to: "Build outputs to ` dist/ ` "
1585+ - ** Impact** : Confusing for developers looking for build artifacts
1586+
1587+ #### README.md:182
1588+ - ** Issue** : Incorrect supported Node.js versions
1589+ - ** Pattern** : "Supports Node.js 14, 16, 18 "
1590+ - ** Actual** : Minimum version is Node.js 18.0.0 (verified in package.json engines)
1591+ - ** Fix** : Change to: "Supports Node.js 18+ "
1592+ - ** Impact** : Users may try unsupported Node versions
1593+
1594+ #### README.md:1-21
1595+ - ** Issue** : Missing 75% of API methods in documentation
1596+ - ** Pattern** : Only documents getFullReport() and getIssues() , omits organization, repository, and settings methods
1597+ - ** Actual** : SDK has extensive API covering organizations, repositories, SBOM, npm packages
1598+ - ** Fix** : Add comprehensive API documentation for all 30+ methods with examples
1599+ - ** Impact** : Developers unaware of most SDK functionality
16051600
16061601### Low Severity - 2 issues
16071602
1608- #### packages/binject/ README.md:227
1609- - ** Issue** : Incorrect config size
1610- - ** Pattern** : "1112 bytes "
1611- - ** Actual** : Config is 1176 bytes (verified in source)
1612- - ** Fix** : Change all occurrences to: "1176 bytes "
1603+ #### README.md:227
1604+ - ** Issue** : Incorrect default timeout value
1605+ - ** Pattern** : "Default timeout: 10000ms "
1606+ - ** Actual** : Default is 30000ms (verified in source)
1607+ - ** Fix** : Change to: "Default timeout: 30000ms "
16131608- ** Impact** : Minor technical inaccuracy
16141609
1615- #### packages/binflate/ README.md:18
1616- - ** Issue** : Claims caching functionality
1617- - ** Pattern** : "Uses cache at ~ /.socket/ _ dlx/ "
1618- - ** Actual** : binflate only extracts; self-extracting stubs (not binflate) implement caching
1619- - ** Fix** : Clarify that binflate extracts only, stubs handle caching
1620- - ** Impact** : Confusion about which component caches
1610+ #### README.md:18
1611+ - ** Issue** : Claims automatic retry on rate limit
1612+ - ** Pattern** : "SDK automatically retries on rate limit errors "
1613+ - ** Actual** : SDK does not retry automatically; users must implement retry logic
1614+ - ** Fix** : Remove automatic retry claim, document manual retry approach
1615+ - ** Impact** : Users expect automatic behavior that doesn't exist
16211616```
16221617
0 commit comments