Skip to content

Commit 82a7c4b

Browse files
committed
Initial commit
0 parents  commit 82a7c4b

897 files changed

Lines changed: 199125 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Clean, Rebuild, and Test
2+
3+
Execute a complete validation cycle for node-smol-builder:
4+
5+
1. Clean build artifacts and checkpoints
6+
2. Rebuild with latest changes
7+
3. Run test suite
8+
4. Report: build size, test results, and any failures
9+
10+
Use this after making changes to binpress, binject, or build-infra that affect node-smol-builder.
11+
12+
Usage: `/clean-rebuild-test`
13+
14+
## Success Criteria
15+
16+
- ✅ Build artifacts cleaned successfully
17+
- ✅ Build completes without errors
18+
- ✅ All tests pass (100% pass rate)
19+
- ✅ Binary size reported
20+
- ✅ Build time reported
21+
-`<promise>BUILD_TEST_COMPLETE</promise>` emitted
22+
23+
## Completion Signal
24+
25+
Upon successful completion, emit:
26+
27+
```xml
28+
<promise>BUILD_TEST_COMPLETE</promise>
29+
```
30+
31+
## Edge Cases
32+
33+
**Build fails:**
34+
35+
```bash
36+
# Check build output for errors
37+
pnpm --filter node-smol-builder run build
38+
39+
# Common issues:
40+
# - Missing dependencies: pnpm install
41+
# - Corrupted checkpoints: pnpm run clean && pnpm run build
42+
# - C++ compilation errors: Check compiler version and flags
43+
```
44+
45+
**Tests fail:**
46+
47+
```bash
48+
# Run tests with verbose output
49+
pnpm --filter node-smol-builder test
50+
51+
# Check specific test failures
52+
# Fix issues before proceeding
53+
```
54+
55+
**Clean fails:**
56+
57+
```bash
58+
# Manually remove build artifacts
59+
rm -rf packages/node-smol-builder/build
60+
61+
# Then retry
62+
pnpm --filter node-smol-builder run build
63+
```
64+
65+
## Context
66+
67+
**Related Files:**
68+
69+
- Build package: `packages/node-smol-builder/`
70+
- Build script: `packages/node-smol-builder/scripts/binary-released/`
71+
- Build checkpoints: `packages/node-smol-builder/build/dev/checkpoints/`
72+
- Test directory: `packages/node-smol-builder/test/`
73+
74+
**Related Packages:**
75+
76+
- `binpress` - Binary compression (may affect build)
77+
- `binject` - Binary injection (may affect build)
78+
- `build-infra` - Shared build infrastructure
79+
80+
**Related Commands:**
81+
82+
- `/fix-and-commit` - Quick lint and test cycle with commit
83+
- `/commit-task` - Commit with progress tracking

.claude/commands/node-patcher.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
Regenerate Node.js patches from pristine source using the regenerating-node-patches skill.
2+
3+
Usage:
4+
5+
- `/node-patcher` - Regenerate all 16 patches
6+
- `/node-patcher 005` - Regenerate only patch 005
7+
8+
If a patch number is provided (e.g., "005"), use the Skill tool to invoke the `regenerating-node-patches` skill with instructions to ONLY regenerate that specific patch. Skip the backup and cleanup steps for single-patch mode.
9+
10+
If no patch number is provided, regenerate all patches with full workflow:
11+
12+
1. Backup existing patches with timestamp
13+
2. Reset upstream node submodule to SHA in .gitmodules
14+
3. Clean build artifacts and working directory
15+
4. Regenerate all 16 patches from pristine Node.js v25.5.0 source
16+
5. Validate each patch with dry-run before persisting
17+
18+
The skill follows this workflow for each patch:
19+
20+
- Obtain pristine file from Node.js v25.5.0
21+
- Apply modifications based on existing patch
22+
- Generate new patch using `diff -u` (NOT git diff)
23+
- Validate with `patch --dry-run`
24+
- Persist to patches directory
25+
26+
Report back when complete with summary of patches regenerated.
27+
28+
## Parameter Validation
29+
30+
**Valid patch numbers:** 001-014, 016-020
31+
32+
If a patch number is provided, validate it matches the pattern `NNN` where N is a digit:
33+
34+
- 001: common-gypi-lto.patch
35+
- 002: polyfills.patch
36+
- 003: realm-smol-bindings.patch
37+
- 004: node-gyp-smol-sources.patch
38+
- 005: smol-binding-macros.patch
39+
- 006: sea-smol-config.patch
40+
- 007: sea-smol-structs.patch
41+
- 008: sea-binject.patch
42+
- 009: v8-typeindex-macos.patch
43+
- 010: vfs-bootstrap.patch
44+
- 011: vfs-require-resolve.patch
45+
- 012: debug-smol-sea.patch
46+
- 013: sea-silent-exit.patch
47+
- 014: fast-webstreams.patch
48+
- 016: http-server-wire.patch
49+
- 017: http-parser-pool.patch
50+
- 018: smol-builtin-bindings.patch
51+
- 019: configure-postgres-iouring.patch
52+
- 020: smol-external-refs.patch
53+
54+
**Invalid patch number:**
55+
56+
```
57+
Error: Invalid patch number "999"
58+
Valid patch numbers: 001-014, 016-017
59+
```
60+
61+
## Success Criteria
62+
63+
- ✅ Skill `regenerating-node-patches` invoked successfully
64+
- ✅ All requested patches regenerated from pristine source
65+
- ✅ Each patch validated with `patch --dry-run`
66+
- ✅ Patches persisted to `patches/source-patched/` directory
67+
- ✅ No code differences detected (patches apply cleanly)
68+
- ✅ Backup created (full mode only)
69+
-`<promise>PATCH_REGEN_COMPLETE</promise>` emitted
70+
71+
## Completion Signal
72+
73+
Upon successful completion, the `regenerating-node-patches` skill emits:
74+
75+
```xml
76+
<promise>PATCH_REGEN_COMPLETE</promise>
77+
```
78+
79+
This signal indicates:
80+
81+
- All patches regenerated from pristine source
82+
- Each patch validated with dry-run
83+
- Patches persisted to patches directory
84+
- Ready for build testing and commit
85+
86+
## Edge Cases
87+
88+
For comprehensive edge case handling, refer to the `regenerating-node-patches` skill documentation.
89+
90+
**Common issues:**
91+
92+
- **Patch fails to apply**: Context lines don't match pristine file (skill auto-retries with increased context)
93+
- **Build fails after regeneration**: Review build log, check source files in additions/
94+
- **Patch header malformed**: Skill uses `diff -u` (not git diff) to avoid this
95+
- **Submodule not at correct SHA**: Full mode resets to SHA in .gitmodules
96+
97+
## Context
98+
99+
**Related Files:**
100+
101+
- Patches directory: `packages/node-smol-builder/patches/source-patched/`
102+
- Patch list: `packages/node-smol-builder/patches/source-patched/` (001-014, 016-017)
103+
- Node.js submodule: `packages/node-smol-builder/upstream/node/`
104+
- Upstream version: Node.js v25.5.0
105+
106+
**Related Skills:**
107+
108+
- `regenerating-node-patches` - The skill invoked by this command
109+
110+
**Related Commands:**
111+
112+
- `/sync` - Update Node.js and regenerate patches
113+
- `/sync-status` - Check current Node.js version

.claude/commands/quality-loop.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Run the quality-scan skill and fix all issues found. Repeat until zero issues remain or 5 iterations complete.
2+
3+
## Process
4+
5+
1. Run quality-scan skill
6+
2. If issues found: fix ALL of them
7+
3. Run quality-scan again
8+
4. Repeat until:
9+
- Zero issues found (success), OR
10+
- 5 iterations completed (stop)
11+
5. Commit all fixes:
12+
- If repo has only 1 commit: **amend** that commit
13+
- Otherwise: create new commit with message "fix: resolve quality scan issues (iteration N)"
14+
15+
## Rules
16+
17+
- Fix every issue, not just "easy" ones
18+
- Do not skip architectural fixes
19+
- Run tests after fixes to verify nothing broke
20+
- Track iteration count and report progress
21+
22+
## Outstanding Architectural Issue (Requires Design Review)
23+
24+
### Checkpoint Cache Invalidation (High Severity)
25+
26+
**Issue**: Source package changes don't invalidate checkpoints properly.
27+
28+
**Root Cause**: Cache keys are computed AFTER `prepareExternalSources()` syncs source packages to additions/. Since cache keys hash files in additions/ (which are now synced), they match the checkpoint even though source packages changed.
29+
30+
**Scenario**:
31+
32+
1. Developer modifies `packages/binject/src/socketsecurity/binject/file.c`
33+
2. Runs `pnpm --filter node-smol-builder clean && pnpm build`
34+
3. `prepareExternalSources()` syncs binject → additions/source-patched/src/socketsecurity/binject/
35+
4. Cache key computed from additions/ files matches old checkpoint
36+
5. Build restores stale checkpoint, skips recompilation
37+
6. **Result**: Binary contains old binject code
38+
39+
**Impact**: Silent build incorrectness when modifying source packages
40+
41+
**Proposed Solutions** (require architectural review):
42+
43+
- Option 1: Include source package mtimes in cache key metadata
44+
- Option 2: Make `prepareExternalSources()` idempotent, always re-sync
45+
46+
**Files Affected**:
47+
48+
- packages/node-smol-builder/scripts/common/shared/build.mjs (collectBuildSourceFiles)
49+
- packages/node-smol-builder/scripts/common/shared/checkpoints.mjs (cache key generation)
50+
51+
**Status**: Documented for architectural review and future implementation

.claude/commands/squash-history.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Squash all commits on main branch to single "Initial commit" using the squashing-history skill.
2+
3+
## What it does
4+
5+
1. Creates timestamped backup branch
6+
2. Soft resets to first commit
7+
3. Creates single "Initial commit" with all code
8+
4. Verifies code integrity (zero differences)
9+
5. Gets user confirmation
10+
6. Force pushes to origin
11+
12+
## Safety
13+
14+
- Backup branch created before any destructive operations
15+
- Code verified byte-for-byte identical before force push
16+
- Explicit user confirmation required
17+
- Rollback possible via backup branch
18+
19+
## Usage
20+
21+
```bash
22+
/squash-history
23+
```
24+
25+
## Rollback (if needed)
26+
27+
```bash
28+
git reset --hard backup-YYYYMMDD-HHMMSS
29+
git push --force origin main
30+
```

.claude/commands/sync-checksums.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Sync SHA-256 checksums from GitHub releases to release-assets.json using the syncing-checksums skill.
2+
3+
## What it does
4+
5+
1. Fetches checksums.txt from latest GitHub releases
6+
2. Updates packages/build-infra/release-assets.json
7+
3. Validates JSON syntax
8+
4. Commits changes (if any)
9+
10+
## Tools synced
11+
12+
- lief - LIEF binary manipulation library
13+
- curl - curl with mbedTLS
14+
- stubs - Self-extracting stub binaries
15+
- libpq - PostgreSQL client library
16+
- binpress - Binary compression tool
17+
- binflate - Binary decompression tool
18+
- binject - Binary injection tool
19+
20+
## Usage
21+
22+
```bash
23+
/sync-checksums
24+
```
25+
26+
## Manual commands
27+
28+
```bash
29+
# Sync all tools
30+
pnpm --filter build-infra sync-checksums
31+
32+
# Sync specific tool
33+
pnpm --filter build-infra sync-checksums --tool=lief
34+
35+
# Dry run
36+
pnpm --filter build-infra sync-checksums --dry-run
37+
```

0 commit comments

Comments
 (0)