Skip to content

About

OMP tools: project_format and project_test — auto-detect Rust/TS and run the right formatter and test runner

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

omp-project-tools

Custom Oh My Pi tools that let the agent format and test the current project without needing project-specific instructions baked into a skill or system prompt.

Tools

project_format

Runs the project's code formatter.

  • Rust (Cargo.toml present): cargo fmt.
  • TypeScript/JS (package.json present, no Cargo.toml): runs the first matching package.json script, in this order: format, fmt, lint:fix, lint, prettier, biome:fix, biome:check. The package manager is detected from the lockfile (pnpm-lock.yaml → pnpm, bun.lockb → bun, yarn.lock → yarn, else npm).
  • Otherwise: reports that no formatter is configured.

Returns the exact command run, its exit code, and the captured output (tail, capped at 4000 chars).

project_test

Runs the project's build/typecheck step followed by its test suite.

  • Rust: cargo nextest run, optionally scoped with a filter argument (cargo nextest run <filter>).
  • TypeScript/JS: runs the first matching build/typecheck script — build, typecheck, type-check, check — then the test script if present (<pm> run test, or <pm> run test -- <filter> when a filter argument is given). Package manager detection matches project_format.
  • Otherwise: reports that no test runner is configured.

Returns each command run, its exit code, and captured output (tail, capped at 3000 chars per step).

Project kind detection (lib/project-kind.ts) is shared between both tools: Rust wins if Cargo.toml exists, else TypeScript if package.json exists, else "other" (no runner configured).

How it works

Each tool is a single file that default-exports an Oh My Pi CustomToolFactory: a function (pi) => ({ name, label, description, parameters, approval, execute }). Oh My Pi discovers tool files by loading every file in ~/.omp/agent/tools/ (user) or <project>/.omp/tools/ (project) individually — there is no bundler step, so imports must use explicit .ts extensions and resolve on disk exactly as written.

Both tools use pi.cwd for the working directory, pi.zod for parameter schemas, and pi.exec to run subprocesses — all provided by the host pi object at load time. No third-party dependency is required beyond what the host provides.

Install

omp plugin install github:gyoz-ai/omp-project-tools

This runs bun install against ~/.omp/plugins, symlinks the package into node_modules, and registers project-format.ts and project-test.ts as tools from the same manifest.

Local development (symlink)

Oh My Pi loads each tool file independently, so symlink each file into ~/.omp/agent/tools/ individually:

ln -s "$(pwd)/project-format.ts" ~/.omp/agent/tools/project-format.ts
ln -s "$(pwd)/project-test.ts" ~/.omp/agent/tools/project-test.ts

The lib/project-kind.ts helper is imported by relative path from both files and does not need a separate symlink — it resolves alongside the repo checkout through the symlink target.

To install for a single project instead, symlink into <project>/.omp/tools/ the same way.

To remove a symlink-based install, delete the symlinks (the repo checkout itself is untouched):

rm ~/.omp/agent/tools/project-format.ts ~/.omp/agent/tools/project-test.ts

Development

Verify the tools compile standalone:

bun build project-format.ts project-test.ts --external @oh-my-pi/pi-ai --target bun --outdir /tmp/omp-build-check-project-tools

About

OMP tools: project_format and project_test — auto-detect Rust/TS and run the right formatter and test runner

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages