Canonical guidance for AI agents working in this repository.
This repository contains a GitHub Action that evaluates the current checkout with Promptfoo when monitored files change. Pull request runs post the results as PR comments; push and manual runs write workflow summaries.
The repository also includes a local copy of Promptfoo source under /promptfoo/ for development/reference. That copy is not included in the distributed action package.
npm run build- Compile TypeScript to JavaScriptnpm run build:watch- Compile in watch modenpm run package- Bundle the action with@vercel/nccnpm run all- Run build, lint, package, and tests
npm run lint- Run Biome lintnpm run format- Format with Biomenpm run biome- Run format and lint
npm test- Run all tests with coveragenpm test -- __tests__/main.test.ts- Run one test filenpm test -- --watch- Run tests in watch mode
src/main.ts:
- Parses inputs from
action.yml - Loads
.envfiles if requested - Determines whether the event is a pull request, push, or manual run
- Detects changed files from the event payload or a configured git comparison
- Filters for changed prompt/config files
- Runs Promptfoo evaluation on those files
- Posts a PR comment with the results
src/main.ts- Action entry point and orchestrationsrc/utils/git.ts- Git diff and ref handlingsrc/utils/promptfoo.ts- Promptfoo evaluation wrappersrc/utils/github.ts- GitHub API / PR comment logicsrc/utils/env.ts- Environment loading
- Validate all git refs before using them in shell commands.
- Mask API keys with
core.setSecret(). - Validate path inputs to avoid directory traversal issues.
- Strict mode is enabled; avoid
any. - Source lives in
/src/; compiled output goes to/lib/. - Target ES6 and CommonJS output.
- Biome formatting: 2 spaces, single quotes, trailing commas.
- Line width: 80 characters.
- Prefer
constand arrow functions. - Remove unused imports and variables.
- Vitest is used for tests.
- Mock external boundaries such as GitHub, filesystem, and git execution.
- Coverage output is written to
/coverage/.
Use Conventional Commits format:
<type>(<optional-scope>): <short description>.
- Begin with a lowercase conventional type such as
feat,fix,docs,test,refactor,build,ci, orchore. - Do not add agent or tool prefixes such as
[codex]. This repository rule overrides generic publishing templates. - Describe the primary change, for example:
docs: add security policy.
- Make changes and test locally
- Run
npm run all - Commit both source changes and generated
/dist/ - Tag releases using semantic versioning
When merging main into a feature branch:
git checkout feature/branch-name
git pull origin feature/branch-name
git merge mainConflict-resolution notes:
action.yml: keep all input additions and preserve alphabetical ordersrc/main.ts: preserve logic from both branches__tests__/main.test.ts: keep test coverage for both branchesREADME.md: preserve docs for all featuresdist/: regenerate after conflict resolution
After resolving conflicts:
git add .
git commit
npm ci
npm run build
npm run package
git add dist/
git commit -m "fix: rebuild dist files after merge"
git push origin feature/branch-namecheck-distfailure: regeneratedist/after merges- Test failures: verify test suites from both branches were preserved
- Formatting failures: run
npm run format
- The action runs on the Node 24 runtime (see
action.yml). - Bundle size is around 1.5 MB; avoid unnecessary growth.
- Review
TODO.mdbefore planning larger improvements.