diff --git a/.claude/agents/code-reviewer.md b/.claude/agents/code-reviewer.md index 1e05e099..c30d6aa7 100644 --- a/.claude/agents/code-reviewer.md +++ b/.claude/agents/code-reviewer.md @@ -1,3 +1,9 @@ +--- +name: code-reviewer +description: Reviews code in socket-sdk-js against CLAUDE.md rules and reports style violations, logic bugs, and test gaps. Spawned by the quality-scan skill or invoked directly on a diff. +tools: Read, Grep, Glob, Bash(git:*), Bash(rg:*), Bash(grep:*), Bash(find:*), Bash(ls:*), Bash(wc:*), Bash(cat:*), Bash(head:*), Bash(tail:*) +--- + You are a code reviewer for a Node.js/TypeScript monorepo (socket-sdk-js). Apply the rules from CLAUDE.md sections listed below. Reference the full section in CLAUDE.md for details — these are summaries, not the complete rules. diff --git a/.claude/agents/refactor-cleaner.md b/.claude/agents/refactor-cleaner.md index ee62c149..ea507d4e 100644 --- a/.claude/agents/refactor-cleaner.md +++ b/.claude/agents/refactor-cleaner.md @@ -1,3 +1,9 @@ +--- +name: refactor-cleaner +description: Refactor specialist for socket-sdk-js. 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. +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:*) +--- + You are a refactoring specialist for a Node.js/TypeScript monorepo (socket-sdk-js). Apply these rules from CLAUDE.md exactly: diff --git a/.claude/agents/security-reviewer.md b/.claude/agents/security-reviewer.md index a5625045..1d35eabd 100644 --- a/.claude/agents/security-reviewer.md +++ b/.claude/agents/security-reviewer.md @@ -1,10 +1,16 @@ +--- +name: security-reviewer +description: Reviews findings from AgentShield + zizmor against socket-sdk-js's CLAUDE.md security rules and grades the result A-F. Spawned by the security-scan skill after the static scans run. +tools: Read, Grep, Glob, Bash(git:*), Bash(rg:*), Bash(grep:*), Bash(find:*), Bash(ls:*), Bash(pnpm exec agentshield:*), Bash(zizmor:*), Bash(command -v:*), Bash(cat:*), Bash(head:*), Bash(tail:*) +--- + You are a security reviewer for Socket Security Node.js repositories. Apply these rules from CLAUDE.md exactly: **Safe File Operations**: Use safeDelete()/safeDeleteSync() from @socketsecurity/lib/fs. NEVER fs.rm(), fs.rmSync(), or rm -rf. Use os.tmpdir() + fs.mkdtemp() for temp dirs. NEVER use fetch() — use httpJson/httpText/httpRequest from @socketsecurity/lib/http-request. -**Absolute Rules**: NEVER use npx, pnpm dlx, or yarn dlx. Use pnpm exec or pnpm run with pinned devDeps. +**Absolute Rules**: NEVER use npx, pnpm dlx, or yarn dlx. Use pnpm exec or pnpm run with pinned devDeps. # zizmor: documentation-prohibition **Work Safeguards**: Scripts modifying multiple files must have backup/rollback. Git operations that rewrite history require explicit confirmation. @@ -12,7 +18,7 @@ Apply these rules from CLAUDE.md exactly: 1. **Secrets**: Hardcoded API keys, passwords, tokens, private keys in code or config 2. **Injection**: Command injection via shell: true or string interpolation in spawn/exec. Path traversal in file operations. -3. **Dependencies**: npx/dlx usage. Unpinned versions (^ or ~). Missing minimumReleaseAge bypass justification. +3. **Dependencies**: npx/dlx usage. Unpinned versions (^ or ~). Missing minimumReleaseAge bypass justification. # zizmor: documentation-checklist 4. **File operations**: fs.rm without safeDelete. process.chdir usage. fetch() usage (must use lib's httpRequest). 5. **GitHub Actions**: Unpinned action versions (must use full SHA). Secrets outside env blocks. Template injection from untrusted inputs. 6. **Error handling**: Sensitive data in error messages. Stack traces exposed to users. diff --git a/.claude/settings.json b/.claude/settings.json index ac130fc1..6ff9cfe0 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -11,5 +11,18 @@ ] } ] + }, + "permissions": { + "deny": [ + "Bash(gh release create:*)", + "Bash(gh release delete:*)", + "Bash(gh workflow dispatch:*)", + "Bash(gh workflow run:*)", + "Bash(git push --force:*)", + "Bash(git push -f:*)", + "Bash(npm publish:*)", + "Bash(pnpm publish:*)", + "Bash(yarn publish:*)" + ] } } diff --git a/.claude/skills/quality-scan/SKILL.md b/.claude/skills/quality-scan/SKILL.md index d204ca29..909dd584 100644 --- a/.claude/skills/quality-scan/SKILL.md +++ b/.claude/skills/quality-scan/SKILL.md @@ -1,6 +1,7 @@ --- name: quality-scan description: Runs comprehensive quality scans across the codebase using specialized agents to identify critical bugs, logic errors, caching issues, and workflow problems. Use when improving code quality, before releases, or investigating issues. +allowed-tools: Task, Skill, Read, Edit, Grep, Glob, AskUserQuestion, Bash(pnpm run check:*), Bash(pnpm run test:*), Bash(pnpm test:*), Bash(pnpm run fix:*), Bash(git status:*), Bash(git diff:*), Bash(git log:*), Bash(git add:*), Bash(git commit:*), Bash(rg:*), Bash(grep:*), Bash(find:*), Bash(ls:*) --- # quality-scan diff --git a/.claude/skills/security-scan/SKILL.md b/.claude/skills/security-scan/SKILL.md index 7f2fd77e..10a3ac3f 100644 --- a/.claude/skills/security-scan/SKILL.md +++ b/.claude/skills/security-scan/SKILL.md @@ -2,6 +2,7 @@ name: security-scan description: Runs a multi-tool security scan — AgentShield for Claude config, zizmor for GitHub Actions, and optionally Socket CLI for dependency scanning. Produces an A-F graded security report. Use after modifying `.claude/` config, hooks, agents, or GitHub Actions workflows, and before releases. user-invocable: true +allowed-tools: Task, Read, Bash(pnpm exec agentshield:*), Bash(zizmor:*), Bash(command -v:*), Bash(find .cache/external-tools/zizmor:*) --- # Security Scan diff --git a/.claude/skills/updating/SKILL.md b/.claude/skills/updating/SKILL.md index f97d5548..159199ec 100644 --- a/.claude/skills/updating/SKILL.md +++ b/.claude/skills/updating/SKILL.md @@ -2,7 +2,7 @@ name: updating description: Updates all npm dependencies to their latest versions. Triggers when user asks to "update dependencies", "update packages", or prepare for a release. user-invocable: true -allowed-tools: Bash, Read, Grep, Glob, Edit +allowed-tools: Read, Edit, Bash(pnpm run:*), Bash(pnpm test:*), Bash(git status:*), Bash(git diff:*), Bash(git add:*), Bash(git commit:*), Bash(git log:*) --- # updating diff --git a/.config/tsconfig.check.json b/.config/tsconfig.check.json index 92fbca1e..02e43cd6 100644 --- a/.config/tsconfig.check.json +++ b/.config/tsconfig.check.json @@ -11,5 +11,5 @@ "verbatimModuleSyntax": false }, "include": ["../**/*.ts", "../**/*.mts"], - "exclude": ["../**/node_modules/**/*"] + "exclude": ["../**/.cache/**", "../**/node_modules/**/*"] } diff --git a/.gitignore b/.gitignore index bdcf878e..0aac7108 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,9 @@ desktop.ini # store scratch dirs — cleared by pnpm install automatically). node_modules **/node_modules +# Defensive cache ignore — Node compile-cache, corepack, and other +# tools occasionally drop scratch dirs into a project-local .cache/. +**/.cache/ # Misc temporary/generated files Do diff --git a/CLAUDE.md b/CLAUDE.md index 550a72dd..a59e46aa 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,21 +29,72 @@ - **REQUIRED for staging**: surgical `git add […]` with explicit paths. Never `-A` / `.`. - **If you need a quick WIP save**: commit on a new branch from inside a worktree, not a stash. +- **NEVER revert files you didn't touch.** If `git status` shows files you didn't modify, those belong to another session, an upstream pull, or a hook side-effect — leave them alone. Specifically: do not run `git checkout -- ` to "clean up" the diff before committing, and do not include unrelated paths in `git add`. Stage only the explicit files you edited. The umbrella rule: never run a git command that mutates state belonging to a path other than the file you just edited. ## 📚 SHARED STANDARDS - Commits: [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) `(): ` — NO AI attribution +- **Open PRs:** when adding commits to an OPEN PR, ALWAYS update the PR title and description to match the new scope. A title like `chore: foo` after you've added security-fix and docs commits to it is now a lie. Use `gh pr edit --title "..." --body "..."` (or `--body-file`) and rewrite the body so it reflects every commit on the branch, grouped by theme. The reviewer should be able to read the PR description and know what's in it without scrolling commits. - Scripts: Prefer `pnpm run foo --flag` over `foo:bar` scripts - Dependencies: After `package.json` edits, run `pnpm install` - Backward Compatibility: 🚨 FORBIDDEN to maintain — actively remove when encountered - 🚨 **NEVER use `npx`, `pnpm dlx`, or `yarn dlx`** — use `pnpm exec ` or `pnpm run