Skip to content

Latest commit

 

History

History
95 lines (61 loc) · 4.07 KB

stack-detection.md

File metadata and controls

95 lines (61 loc) · 4.07 KB

Stack Detection

Per-language probe order for finding test, typecheck, and build commands. The goal is zero guessing: read the manifest, prefer scripts the project already defines, never invent.

General rules

  1. Read manifest files first; only fall back to convention if the manifest is silent.
  2. If the project defines a script with the name test, typecheck, lint, or build, prefer it. The project's own script encodes its assumptions (env vars, glob patterns, parallelism).
  3. If two managers seem to coexist (e.g. both package-lock.json and pnpm-lock.yaml), ask the user which is canonical. Do not pick by mtime.
  4. If a gate genuinely doesn't exist for this repo (no tests, no typechecker, no build step), confirm with the user before continuing. Skipped gates must be recorded in slop-applied.md.

JavaScript / TypeScript

Manifest: package.json. Package manager from lockfile:

Lockfile Manager Run prefix
pnpm-lock.yaml pnpm pnpm
yarn.lock yarn yarn
bun.lockb bun bun run
package-lock.json (only) npm npm run

Resolution order for each gate:

  • test: scripts.test → else vitest run if vitest is a dep → else jest if jest is a dep → else ask.
  • typecheck: scripts.typecheck → else scripts.tsc → else tsc --noEmit if typescript is a dep → else none (JS-only project).
  • build: scripts.build → else none (library/script projects often have no build).
  • lint (informational, not a gate): scripts.lint → else eslint . if eslint configured.

Python

Manifest: pyproject.toml (preferred), else setup.py, else requirements.txt.

Runner detection:

  • pyproject.toml with [tool.poetry] → poetry run
  • pyproject.toml with [tool.pdm] → pdm run
  • pyproject.toml with [tool.hatch] → hatch run
  • uv.lock present → uv run
  • Else → bare command (assume active venv)

Gate defaults:

  • test: pytest (the overwhelming default). If a [tool.pytest.ini_options] block exists, that's confirmation.
  • typecheck: mypy . if mypy.ini or [tool.mypy] present → else pyright if pyrightconfig.json present → else none.
  • build: python -m build if the project is a distributable package (has pyproject.toml with [build-system]) → else none (apps and scripts often have no build).

Rust

Manifest: Cargo.toml.

  • test: cargo test
  • typecheck: cargo check
  • build: cargo build

No probing needed; these are universal.

Go

Manifest: go.mod.

  • test: go test ./...
  • typecheck: go vet ./... (closest equivalent)
  • build: go build ./...

Ruby

Manifest: Gemfile.

  • test: bundle exec rspec if spec/ exists → else bundle exec rake test if test/ exists → else ask.
  • typecheck: bundle exec srb tc if Sorbet is in the Gemfile → else none.
  • build: bundle exec rake build if it's a gem (*.gemspec present) → else none.

Java / Kotlin

Manifests: pom.xml (Maven), build.gradle[.kts] (Gradle).

  • Maven: test mvn test, typecheck folded into mvn compile, build mvn package.
  • Gradle: test ./gradlew test, typecheck ./gradlew compileJava (or compileKotlin), build ./gradlew build.

Multi-stack monorepos

If the root has both package.json and pyproject.toml (or similar), ask which subtree the audit should cover. Running gates across a whole monorepo is usually wrong — the safety contract wants fast, scoped runs.

Suggested approach: scope to one workspace package or one Python subpackage at a time. The user can run humanize-code multiple times for different scopes.

When nothing is found

If no manifest matches: ask the user how they run tests, typecheck, and build for this repo. Record their answers in slop-applied.md under a "Manual gate configuration" heading so the run is reproducible.

If the user confirms a gate genuinely doesn't exist:

  • No tests at all → restrict to T1 changes only (per SKILL.md Hard Rule 6).
  • No typecheck → proceed; many languages don't have one.
  • No build → proceed; many projects don't have one.