Skip to content

Commit 2da0a1a

Browse files
committed
Initial commit
0 parents  commit 2da0a1a

File tree

999 files changed

+222897
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

999 files changed

+222897
-0
lines changed

.claude/commands/bake-fresh.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Clean the kitchen, bake from scratch, taste test.
2+
3+
```bash
4+
pnpm --filter node-smol-builder clean
5+
pnpm --filter node-smol-builder build
6+
pnpm --filter node-smol-builder test
7+
```
8+
9+
Report: build time, binary size, test results, any failures.

.claude/commands/quality-loop.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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 them all
7+
3. Run quality-scan again
8+
4. Repeat until zero issues or 5 iterations
9+
5. Commit fixes:
10+
- If repo has only 1 commit: amend that commit
11+
- Otherwise: new commit "fix: resolve quality scan issues (iteration N)"
12+
6. Run tests after fixes to verify nothing broke

.claude/commands/regen-patches.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Regenerate patches from pristine upstream source using the `regenerating-patches` skill.
2+
3+
## Usage
4+
5+
- `/regen-patches` - Regenerate all patches (Node.js + iocraft)
6+
- `/regen-patches node` - Node.js patches only
7+
- `/regen-patches iocraft` - iocraft patches only
8+
9+
Use the Skill tool to invoke `regenerating-patches`, passing the argument to scope which patches to regenerate.

.claude/commands/squash-history.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Squash all commits on main branch to single "Initial commit" using the squashing-history skill.
2+
3+
Creates backup branch, soft resets, verifies code integrity, gets confirmation, force pushes.

.claude/commands/update-cacache.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# update-cacache — Update the C/C++ cacache implementation
2+
3+
Update `socket_cacache.h` to match the `@socketsecurity/lib` cacache spec.
4+
Run when the cacache format changes or cross-platform behavior needs updating.
5+
6+
## What This Updates
7+
8+
| File | Location |
9+
|------|----------|
10+
| `socket_cacache.h` | `packages/build-infra/src/socketsecurity/build-infra/socket_cacache.h` |
11+
12+
## Process
13+
14+
1. **Read the reference spec** from `@socketsecurity/lib`:
15+
- Path resolution: `../socket-sdk-js/node_modules/@socketsecurity/lib/dist/paths/socket.js`
16+
- Cacache wrapper: `../socket-sdk-js/node_modules/@socketsecurity/lib/dist/cacache.js`
17+
- Also check ultrathink implementations for consistency:
18+
- Rust: `../ultrathink/packages/acorn/lang/rust/src/socket_cacache.rs`
19+
- Go: `../ultrathink/packages/acorn/lang/go/pkg/acorn/socket_cacache.go`
20+
21+
2. **Update `socket_cacache.h`** to match:
22+
- Path resolution: env var priority (SOCKET_CACACHE_DIR > SOCKET_HOME > HOME/USERPROFILE > tmpdir)
23+
- Index: `index-v5/{sha256(key)[0:2]}/{sha256(key)[2:4]}/{sha256(key)[4:]}`
24+
- Lines: `{sha1(json)}\t{json}\n`
25+
- Content: `content-v2/sha512/{sha512_hex[0:2]}/{sha512_hex[2:4]}/{sha512_hex[4:]}`
26+
- Integrity: `sha512-{base64_with_padding(sha512(data))}`
27+
- Deletion: append `"integrity":null` (soft delete, not file delete)
28+
- Metadata: always present as `{}` (never null, never omitted)
29+
30+
3. **Cross-platform validation**:
31+
- macOS: HOME → getenv("HOME"), crypto via CommonCrypto
32+
- Linux: HOME → getenv("HOME"), crypto via OpenSSL
33+
- Windows: USERPROFILE → getenv("USERPROFILE"), crypto via CryptoAPI
34+
- Fallback: TEMP/TMP (Windows) or /tmp (Unix)
35+
36+
4. **Compile test**:
37+
```bash
38+
# macOS
39+
cc -Wall -Wextra -I. test.c -o test -framework Security
40+
41+
# Linux
42+
cc -Wall -Wextra -I. test.c -o test -lssl -lcrypto
43+
```
44+
45+
5. **Cross-language verification**:
46+
```bash
47+
# C writes, Node.js reads
48+
./test_write
49+
node -e "require('cacache').get('~/.socket/_cacache', 'key').then(r => console.log(r.data))"
50+
```
51+
52+
6. **Run Codex sanity check** — ask Codex to validate against spec.
53+
54+
7. **Commit** with: `fix(build-infra): update socket_cacache.h to match @socketsecurity/lib vX.Y.Z`
55+
56+
## Key Constraints
57+
58+
- Header-only C (static functions) — no .c file needed
59+
- `extern "C"` wrappers for C++ inclusion
60+
- No external deps beyond platform crypto
61+
- Self-contained file I/O helpers (no file_utils.h dependency)
62+
- Internal functions prefixed `scache_` to avoid namespace collisions
63+
- Must produce entries readable by Node.js `cacache@20`
64+
65+
## Reference Docs
66+
67+
- Shared cache guide: `../ultrathink/packages/build-infra/docs/shared-cache.md`
68+
- Platform dirs: `../ultrathink/packages/build-infra/lib/platform-dirs.mjs`

.claude/commands/update.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# update - Update dependencies
2+
3+
Invoke the `updating-$ARGUMENTS` skill to update a dependency.
4+
5+
Usage: `/update <name>` (e.g., `/update node` invokes `updating-node`)
6+
7+
## Available Names
8+
9+
- `all` - Update everything (npm + all upstreams)
10+
- `node` - Node.js submodule + patch regeneration
11+
- `curl` - curl and mbedtls submodules
12+
- `lief` - LIEF binary manipulation library
13+
- `stubs` - Self-extracting stub binaries
14+
- `binsuite` - Orchestrate LIEF + stubs updates
15+
- `cjson` - cJSON library
16+
- `libdeflate` - libdeflate compression library
17+
- `lzfse` - LZFSE Apple compression library
18+
- `onnxruntime` - ONNX Runtime ML engine
19+
- `ink` - ink TUI framework
20+
- `iocraft` - iocraft TUI library
21+
- `yoga` - Yoga layout library
22+
- `fast-webstreams` - Vendor fast-webstreams from npm
23+
- `checksums` - Sync SHA-256 checksums from releases
24+
25+
## Routing
26+
27+
- `/update all` invokes the `updating` skill (no suffix)
28+
- All others invoke `updating-<name>`
29+
- Empty argument: list names and ask
30+
- Unknown name: suggest closest match
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# .gitmodules Version Comment Format
2+
3+
**MANDATORY**: All submodule version comments in `.gitmodules` MUST follow this exact format.
4+
5+
## Format Rules
6+
7+
1. **Position**: Version comment appears on the line IMMEDIATELY BEFORE the `[submodule "path"]` line
8+
2. **Format**: `# package-X.Y.Z` where:
9+
- `package` is the package name (lowercase)
10+
- `X.Y.Z` is the semantic version using DOTS (never underscores)
11+
- NO `v` prefix (use `1.0.0`, NOT `v1.0.0`)
12+
3. **Consistency**: ALL submodules use the same format - no exceptions
13+
14+
## Example
15+
16+
```gitmodules
17+
# curl-8.18.0
18+
[submodule "packages/curl-builder/upstream/curl"]
19+
path = packages/curl-builder/upstream/curl
20+
url = https://github.com/curl/curl.git
21+
# mbedtls-3.6.5
22+
[submodule "packages/curl-builder/upstream/mbedtls"]
23+
path = packages/curl-builder/upstream/mbedtls
24+
url = https://github.com/Mbed-TLS/mbedtls.git
25+
# lief-0.17.0
26+
[submodule "packages/lief-builder/upstream/lief"]
27+
path = packages/lief-builder/upstream/lief
28+
url = https://github.com/lief-project/LIEF.git
29+
```
30+
31+
## Why This Matters
32+
33+
- **Build scripts** use `getSubmoduleVersion()` which expects `# package-X.Y.Z\n[submodule ...]`
34+
- **CI workflows** use `grep -B 1` to extract versions from the line before the submodule
35+
- **Consistency** prevents bugs and makes version extraction reliable
36+
37+
## Forbidden Patterns
38+
39+
❌ `# v0.17.0` - NO v prefix
40+
❌ `# curl-8_18_0` - NO underscores (use dots)
41+
❌ Comment after URL line - MUST be before `[submodule ...]`
42+
❌ Different formats for different submodules - ALL must match
43+
44+
## Validation
45+
46+
When adding or updating submodules:
47+
1. Add version comment BEFORE `[submodule ...]` line
48+
2. Use format: `# package-VERSION` with dots
49+
3. Run `grep -B 1 'submodule-path' .gitmodules` to verify it can be extracted
50+
4. Check that build scripts can parse it with `getSubmoduleVersion()`
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
name: quality-scan
3+
description: Scans the codebase for bugs, logic errors, caching issues, and workflow problems using specialized agents. Use when preparing for release, investigating quality issues, or running pre-merge checks.
4+
user-invocable: true
5+
allowed-tools: Task, Bash, Read, Grep, Glob, AskUserQuestion
6+
---
7+
8+
# quality-scan
9+
10+
Perform comprehensive quality analysis across the codebase using specialized agents. Clean up junk files first, then scan and generate a prioritized report with actionable fixes.
11+
12+
## Scan Types
13+
14+
1. **critical** - Crashes, security vulnerabilities, resource leaks, data corruption
15+
2. **logic** - Algorithm errors, edge cases, type guards, off-by-one errors
16+
3. **cache** - Cache staleness, race conditions, invalidation bugs
17+
4. **workflow** - Build scripts, CI issues, cross-platform compatibility
18+
5. **workflow-optimization** - CI optimization (build-required conditions on cached builds)
19+
6. **security** - GitHub Actions workflow security (zizmor scanner)
20+
7. **documentation** - README accuracy, outdated docs, missing documentation
21+
8. **patch-format** - Patch file format validation
22+
23+
Agent prompts for each scan type are in `reference.md`.
24+
25+
## Process
26+
27+
### Phase 1: Validate Environment
28+
29+
```bash
30+
git status
31+
```
32+
33+
Warn about uncommitted changes but continue (scanning is read-only).
34+
35+
### Phase 2: Update Dependencies
36+
37+
```bash
38+
pnpm run update
39+
```
40+
41+
Only update the current repository. Continue even if update fails.
42+
43+
### Phase 3: Install zizmor
44+
45+
Install zizmor for GitHub Actions security scanning, respecting the `minimumReleaseAge` from `.pnpmrc` (default 10080 minutes = 7 days). Query GitHub releases, find the latest stable release older than the threshold, and install via pipx/uvx. Skip the security scan if no release meets the age requirement.
46+
47+
### Phase 4: Repository Cleanup
48+
49+
Find and remove junk files (with user confirmation via AskUserQuestion):
50+
- SCREAMING_TEXT.md files outside `.claude/` and `docs/`
51+
- Test files in wrong locations
52+
- Temp files (`.tmp`, `.DS_Store`, `*~`, `*.swp`, `*.bak`)
53+
- Log files in root/package directories
54+
55+
### Phase 5: Structural Validation
56+
57+
```bash
58+
node scripts/check-consistency.mjs
59+
```
60+
61+
Report errors as Critical findings. Warnings are Low findings.
62+
63+
### Phase 6: Determine Scan Scope
64+
65+
Ask user which scans to run using AskUserQuestion (multiSelect). Default: all scans.
66+
67+
### Phase 7: Execute Scans
68+
69+
For each enabled scan type, spawn a Task agent with the corresponding prompt from `reference.md`. Run sequentially in priority order: critical, logic, cache, workflow, then others.
70+
71+
Each agent reports findings as:
72+
- File: path:line
73+
- Issue, Severity, Pattern, Trigger, Fix, Impact
74+
75+
### Phase 8: Aggregate and Report
76+
77+
- Deduplicate findings across scan types
78+
- Sort by severity: Critical > High > Medium > Low
79+
- Generate markdown report with file:line references, suggested fixes, and coverage metrics
80+
- Offer to save to `reports/quality-scan-YYYY-MM-DD.md`
81+
82+
### Phase 9: Summary
83+
84+
Report final metrics: dependency updates, structural validation results, cleanup stats, scan counts, and total findings by severity.

0 commit comments

Comments
 (0)