CLAUDE.md

May 4, 2026 · View on GitHub

Guidance for Claude Code working in this repository. Humans should read README.md and CONTRIBUTING.md first.

Entry points

  • apify CLI — src/entrypoints/apify.ts
  • actor CLI — src/entrypoints/actor.ts

Before you push

Run pnpm run lint && pnpm run format && pnpm run build && pnpm run test:local before pushing. Run pnpm run test:api too if you changed anything that touches the Apify API.

If you modified a command's flags, args, description, or added/removed a command, also run pnpm run update-docs and commit the regenerated docs/ output.

Code conventions

  • Package manager: pnpm 10 (via Corepack). Do not use npm or yarn.
  • Use .js import specifiers for local files (e.g. import { foo } from './foo.js'). The .ts source resolves at build time.
  • Commands extend ApifyCommand from src/lib/command-framework/apify-command.ts. Follow the pattern of existing commands: static override name, static override description, static override flags/args, and an async run() method.
  • New commands must be registered in src/commands/_register.ts (or the parent _index.ts for subcommands).
  • Do not add docstrings, comments, or type annotations to code you did not change. Keep diffs tight.

Testing

  • Tests use Vitest. See CONTRIBUTING.md for useAuthSetup and useTempPath hook usage.
  • API tests must include [api] in the test name and live in test/api/.
  • Always import process from 'node:process' in command/lib code — never use globalThis.process. This is required for test cwd mocks to work.

Things to avoid

  • Do not use --no-verify to skip git hooks. Fix the underlying issue.
  • Do not edit docs/ by hand — it is generated by pnpm run update-docs.