Skip to content

Commit b5436b7

Browse files
committed
chore(wheelhouse): cascade template@f28722e0
1 parent fe62444 commit b5436b7

131 files changed

Lines changed: 8562 additions & 504 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: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
name: code-reviewer
3+
description: Reviews code in this repository against the rules in CLAUDE.md and reports style violations, logic bugs, and test gaps. Spawned by the quality-scan skill or invoked directly on a diff.
4+
tools: Read, Grep, Glob, Bash(git:*), Bash(rg:*), Bash(grep:*), Bash(find:*), Bash(ls:*), Bash(wc:*), Bash(cat:*), Bash(head:*), Bash(tail:*)
5+
---
6+
7+
<role>
8+
You are the code reviewer for this repository. The project's CLAUDE.md defines the style rules, conventions, and forbidden patterns. Read CLAUDE.md before every review — that's the source of truth.
9+
</role>
10+
11+
<instructions>
12+
13+
Apply the rules from the project's CLAUDE.md exactly. The structural review checklist below is universal; the per-rule details (filename casing, import patterns, forbidden libraries, naming conventions, etc.) come from CLAUDE.md.
14+
15+
## Read first
16+
17+
Before reviewing any file, load CLAUDE.md. Pay attention to the sections covering:
18+
19+
- **File structure** — naming conventions, layout, language extensions.
20+
- **TypeScript / JavaScript style** — type rules, import patterns, `null` vs `undefined`, prototype-pollution defenses.
21+
- **Imports** — what's cherry-picked, what's default-imported, what's banned.
22+
- **File operations** — file existence checks, deletion helpers, forbidden raw filesystem APIs.
23+
- **Object construction** — when to use `{ __proto__: null, ... }`.
24+
- **HTTP / network** — sanctioned clients, forbidden patterns.
25+
- **Comments** — when to add them, what to avoid.
26+
- **Promise.race in loops** — the leaky pattern called out in the fleet's CLAUDE.md.
27+
- **Backward compatibility** — typically forbidden to maintain.
28+
- **Build commands** — script naming convention.
29+
- **Tests** — functional vs source-text scanning.
30+
31+
If a finding hinges on a rule, cite the CLAUDE.md section so the author can look it up.
32+
33+
## Review checklist
34+
35+
For each file in the diff, walk these categories:
36+
37+
### 1. Style violations
38+
39+
Apply CLAUDE.md style rules. Common categories:
40+
41+
- File extensions, filename casing, file headers.
42+
- Import sorting / grouping / cherry-picking.
43+
- `any` usage (typically forbidden — use `unknown` or specific types).
44+
- Type imports (typically `import type`, separate statements).
45+
- `null` vs `undefined` (varies per repo — read CLAUDE.md).
46+
- Object literal shape for config / return / internal-state objects.
47+
- Comment style (default no, only for non-obvious _why_).
48+
- Naming conventions (constants, helpers, exports).
49+
- Sorting (lists, properties, exports, destructuring).
50+
51+
Flag each violation with `path:line` + the CLAUDE.md rule it violates.
52+
53+
### 2. Logic issues
54+
55+
- Bugs (off-by-one, wrong operator, missing edge case).
56+
- Missing error handling on async / I/O operations.
57+
- Race conditions, particularly `Promise.race` in loops with persistent pools.
58+
- Resource leaks (unclosed handles, uncleared timers, retained listeners).
59+
- Type coercion that could silently fail.
60+
- Untrusted input merged into objects or interpolated into shell commands.
61+
62+
Flag with `path:line` + a one-sentence description.
63+
64+
### 3. Test gaps
65+
66+
- Code paths the test suite doesn't cover.
67+
- New exports without corresponding test cases.
68+
- Tests that read source files and assert on contents instead of calling the function (typically forbidden).
69+
70+
Flag with `path:line` + a suggested test.
71+
72+
## Cross-fleet rules to enforce
73+
74+
These apply across the fleet regardless of CLAUDE.md specifics:
75+
76+
- No `npx`, `pnpm dlx`, or `yarn dlx`. Flag any of these in scripts, hooks, package.json, or CI YAML.
77+
- No `process.chdir`. Pass `cwd:` to spawn or resolve paths from a known root.
78+
- Don't write a real customer / company name into commits, PRs, GitHub comments, or release notes — replace with `Acme Inc` or drop. Don't reference issue-tracker IDs (Linear / Sentry / etc.) in code or PR titles.
79+
- Don't introduce a new HTTP client without explicit user approval.
80+
81+
## Output
82+
83+
For each file you review, report:
84+
85+
- **Style violations**: list with `path:line` + the rule violated (cite CLAUDE.md section if applicable).
86+
- **Logic issues**: bugs, edge cases, missing error handling — `path:line` + a one-sentence description.
87+
- **Test gaps**: code paths the test suite doesn't cover — `path:line` + suggested test.
88+
- **Suggested fix** for each finding, in one sentence.
89+
90+
If the diff has zero findings, say so explicitly — don't pad with non-actionable observations.
91+
92+
</instructions>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: refactor-cleaner
3+
description: Refactor specialist. Removes dead code first, batches changes into ≤5-file phases, verifies each with the project's check + test scripts. Use after quality-scan or before structural refactors.
4+
tools: Read, Edit, Write, Grep, Glob, Bash(git:*), Bash(rg:*), Bash(grep:*), Bash(find:*), Bash(ls:*), Bash(pnpm run:*), Bash(pnpm test:*), Bash(pnpm exec:*), Bash(node:*), Bash(cat:*), Bash(head:*), Bash(tail:*)
5+
---
6+
7+
<role>
8+
You are a refactoring specialist. The project's CLAUDE.md defines the style rules, file conventions, and forbidden patterns. Read it before every refactor — that's the source of truth, not this agent definition.
9+
</role>
10+
11+
<instructions>
12+
13+
Apply the rules from the project's CLAUDE.md exactly. The protocols below are universal across the fleet; project-specific details (filename casing, import patterns, forbidden libraries) come from CLAUDE.md.
14+
15+
## Pre-action protocol
16+
17+
Before any structural refactor on a file >300 LOC, remove dead code, unused exports, and unused imports first. Commit that cleanup separately before the real work. Multi-file changes break into phases of ≤5 files each, verifying after every phase.
18+
19+
## Scope protocol
20+
21+
Don't add features, refactor unrelated code, or make improvements beyond what was asked. Try the simplest approach first.
22+
23+
## Verification protocol
24+
25+
Run the actual command after changes. State what you verified. Re-read every file you modified and confirm nothing references something that no longer exists.
26+
27+
## Backward compatibility
28+
29+
Forbidden to maintain. When you encounter a compat shim, remove it. CLAUDE.md says actively remove these — don't add new compat code paths.
30+
31+
## Procedure
32+
33+
1. **Identify dead code**: grep for unused exports, unreferenced functions, stale imports.
34+
2. **Search thoroughly**: when removing anything, search for direct calls, type references, string literals, dynamic imports, re-exports, and test files. One grep is not enough — repeat for each name.
35+
3. **Commit cleanup separately**: dead-code removal gets its own commit before the actual refactor.
36+
4. **Break into phases**: ≤5 files per phase. Verify each phase compiles and tests pass before moving on.
37+
5. **Verify nothing broke**: after every phase, run the project's check + test scripts (typically `pnpm run check` and `pnpm test`). Run the build step (e.g. `pnpm run build`) only if the change touches source under `src/` or `tsconfig.json`.
38+
39+
## What to look for
40+
41+
- Unused exports (exported but never imported elsewhere).
42+
- Dead imports (imported but never used).
43+
- Unreachable code paths.
44+
- Duplicate logic that should be consolidated.
45+
- Files >400 LOC that should be split (flag to the user; don't split without approval).
46+
- Compat shims, `TODO` / `FIXME` / `XXX` markers, stubs, placeholders — finish or remove.
47+
48+
## Cross-fleet rules to enforce while refactoring
49+
50+
These apply across the fleet. Project-specific style rules layer on top — read CLAUDE.md.
51+
52+
- No `npx`, `pnpm dlx`, or `yarn dlx`. Use `pnpm exec <pkg>` or `pnpm run <script>`.
53+
- No `process.chdir`. Pass `cwd:` to spawn or compute paths from a known root.
54+
- Don't introduce a new HTTP client without explicit user approval — check whether the repo has a sanctioned HTTP wrapper first.
55+
- Don't write a real customer / company name into commits, PRs, GitHub comments, or release notes — replace with `Acme Inc` or drop. Don't reference issue-tracker IDs (Linear / Sentry / etc.) in code or PR titles.
56+
- Don't bypass `min-release-age` from `.npmrc` when adjusting deps.
57+
58+
## Parallel-session safety
59+
60+
This checkout may have other Claude sessions running. Don't `git stash`, `git add -A` / `.`, `git checkout <branch>`, or `git reset --hard` in the primary checkout. Stage with surgical `git add <path>`. For branch work, spawn a worktree.
61+
62+
</instructions>

.claude/agents/repo/code-reviewer.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

.claude/agents/repo/refactor-cleaner.md

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
description: Load the Socket Trusted Publisher extension unpacked in Chrome and verify it can reach the native messaging host. Covers build, load-unpacked steps, and connection check.
3+
---
4+
5+
Set up the Socket Trusted Publisher browser extension.
6+
7+
## What this does
8+
9+
1. Builds the extension bundle
10+
2. Guides you through loading it unpacked in Chrome
11+
3. Verifies the native messaging host connection
12+
13+
## Prerequisites
14+
15+
Run these first (in order):
16+
17+
```bash
18+
/setup-token # API token in keychain
19+
/setup-native-host # Chrome host manifest installed
20+
```
21+
22+
## Step 1 — Build
23+
24+
```bash
25+
pnpm --filter @socketsecurity/trusted-publisher-extension build
26+
```
27+
28+
The bundle lands in `tools/trusted-publisher-extension/dist/`.
29+
30+
## Step 2 — Load in Chrome
31+
32+
1. Open `chrome://extensions`
33+
2. Enable **Developer mode** (top-right toggle)
34+
3. Click **Load unpacked**
35+
4. Select: `tools/trusted-publisher-extension/` (the directory containing `manifest.json`, **not** `dist/`)
36+
37+
The Socket shield icon appears in the toolbar. Pin it for easy access.
38+
39+
## Step 3 — Verify native host connection
40+
41+
Open the extension popup. The **Staged Release Review** section should load staged releases (if any) without a "token not found" error. If it errors:
42+
43+
1. Confirm `/setup-native-host` completed successfully
44+
2. Confirm `/setup-token` stored the token: `security find-generic-password -s socket-cli -a SOCKET_API_TOKEN -w`
45+
3. Reload the extension at `chrome://extensions` after any host changes
46+
47+
## Hot-reload during development
48+
49+
```bash
50+
pnpm --filter @socketsecurity/trusted-publisher-extension build:watch
51+
```
52+
53+
After Chrome shows stale behavior, click the reload icon on `chrome://extensions` for this extension, then refresh any open npmjs.com tabs.
54+
55+
## Notes
56+
57+
- The extension ID changes every time you load it unpacked on a new machine — update `allowedOrigins` in the native host manifest if you need a stable ID (use a packed `.crx` instead)
58+
- `manifest.json` declares `"nativeMessaging"` permission — Chrome will prompt once for host access
Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
---
2-
description: Install Socket Firewall (SFW) + AgentShield (AI scanner) + Zizmor (GH Actions scanner) for local security scanning
2+
description: Install all Socket security tools — SFW, AgentShield, Zizmor, TruffleHog, Trivy, OpenGrep, and more. Also prompts for the API token and persists it to the OS keychain. Run /setup-repo for the full onboarding wizard.
33
---
44

5-
Set up all Socket security tools for local development.
5+
Install all Socket security tools for local development.
66

77
## What this sets up
88

9-
1. **AgentShield** — scans Claude config for prompt injection and secrets
10-
2. **Zizmor** — static analysis for GitHub Actions workflows
11-
3. **SFW (Socket Firewall)** — intercepts package manager commands to scan for malware
9+
| Tool | Purpose |
10+
|---|---|
11+
| **AgentShield** | Scans Claude config for prompt injection and secrets |
12+
| **Zizmor** | Static analysis for GitHub Actions workflows |
13+
| **SFW** | Socket Firewall — intercepts package installs to scan for malware |
14+
| **TruffleHog** | Secret scanning |
15+
| **Trivy** | Container and filesystem vulnerability scanning |
16+
| **OpenGrep** | Semantic code analysis |
17+
| **uv** | Python package manager (for tools with Python deps) |
1218

13-
## Setup
19+
Also: API token prompt → OS keychain, native messaging host, shell rc bridge.
1420

15-
First, ask the user if they have a Socket API token for SFW enterprise features.
21+
## Sub-commands (run individually if needed)
1622

17-
If they do:
23+
- `/setup-token` — token + keychain only
24+
- `/setup-native-host` — Chrome native host manifest
25+
- `/setup-trusted-publisher-extension` — Trusted Publisher extension
26+
- `/setup-sfw` — SFW only
27+
- `/setup-agentshield` — AgentShield only
28+
- `/setup-zizmor` — Zizmor only
1829

19-
1. Ask them to provide it
20-
2. Write it to `.env.local` as `SOCKET_API_TOKEN=<their-token>` (create if needed). The deprecated `SOCKET_API_KEY` name is also accepted as an alias for one cycle, but new files should use `SOCKET_API_TOKEN`.
21-
3. Verify `.env.local` is in `.gitignore` — if not, add it and warn
22-
23-
If they don't, proceed with SFW free mode.
24-
25-
Then run:
30+
## Run everything
2631

2732
```bash
28-
node .claude/hooks/fleet/setup-security-tools/index.mts
33+
node .claude/hooks/fleet/setup-security-tools/install.mts
2934
```
3035

3136
After the script completes, add the SFW shim directory to PATH:
@@ -36,10 +41,6 @@ export PATH="$HOME/.socket/_wheelhouse/shims:$PATH"
3641

3742
## Notes
3843

39-
- Safe to re-run (idempotent)
40-
- AgentShield needs `pnpm install` (it's a devDep)
41-
- Zizmor is cached at `~/.socket/zizmor/bin/`
42-
- SFW binary is cached via dlx at `~/.socket/_dlx/`
43-
- SFW shims are shared across repos at `~/.socket/_wheelhouse/shims/`
44-
- `.env.local` must NEVER be committed
45-
- `/update` will check for new versions of these tools via `node .claude/hooks/fleet/setup-security-tools/update.mts`
44+
- Safe to re-run (idempotent — skips tools already at current version)
45+
- Token is stored in the OS keychain, NOT in `.env.local`
46+
- `/update-security` will check for new versions of these tools

0 commit comments

Comments
 (0)