name: setup-verify-restruct description: Discover lint/typecheck/test/build commands in the current project and write them to .restruct/verify.yaml so Claude Code automatically runs them on task completion.
Scan the project to discover what verification commands should run when Claude
completes a task. This generates .restruct/verify.yaml which enforces lint,
typecheck, build, and test rules automatically.
Discovery process
- Read CLAUDE.md (or AGENTS.md) for an "After Every Change" section — extract any commands listed there.
- Look for
package.json— check for scripts:test,lint,build,typecheck,check,tsc.- Determine the package manager (
pnpm,npm,yarn) from lock files. - For monorepos with workspace filters, use the appropriate
--filtersyntax.
- Determine the package manager (
- Look for
go.mod— addgo vet ./...andgo test ./.... - Look for
Cargo.toml— addcargo check,cargo clippy(if available),cargo test. - Look for
MakefileorJustfile— check forlint,test,checktargets. - For each discovered command, verify it actually works by running it (or
--help). - Assign glob filters based on language/ecosystem:
- TypeScript/JavaScript: match against the source directory (e.g.,
web/**/*.ts,src/**/*.tsx). - Go:
**/*.go(or scoped to the Go module directory likecli/**/*.go). - Rust:
**/*.rs. - Commands without a clear language scope (like
pnpm testorpnpm build) get no globs — they run on any file change.
- TypeScript/JavaScript: match against the source directory (e.g.,
Write the config
Create .restruct/verify.yaml with the discovered checks. Example format:
checks:
- name: test
command: "pnpm test"
- name: build
command: "pnpm build"
- name: typecheck
command: "pnpm --filter web exec tsc --noEmit"
globs:
- "web/**/*.ts"
- "web/**/*.tsx"
- name: go-vet
command: "pnpm --filter @restruct/cli exec go vet ./..."
globs:
- "cli/**/*.go"
Confirm with the user
Show the user the discovered checks and ask if they want to adjust anything before finalizing.
If .restruct/verify.yaml already exists, show a diff and ask before overwriting.