Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 2.86 KB

File metadata and controls

46 lines (29 loc) · 2.86 KB

CLAUDE.md

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.

Install size

The CLI is installed globally by many users and in Actors, so keep the npm install footprint lean. Always look for opportunities to shrink it:

  • Prefer Node.js built-ins over dependencies, and prefer dependencies already in the tree over new ones.
  • Before adding a dependency, check what it drags in: npm install <pkg> in an empty temp dir, then du -sh node_modules. Mention the install-size impact in the PR description.
  • When touching code that uses a dependency, check whether the dependency is still pulling its weight — a single small helper from a large package is a candidate for replacement or removal.
  • To measure the CLI's own footprint, run node scripts/report-install-size.mjs — it packs the current tree and compares tarball, unpacked, and full-install sizes against the latest published version. The release workflows run it and embed the report in the GitHub release notes.

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.

Pull requests

Keep PR descriptions concise: what changed and why, key numbers, follow-ups. Short bullet points over narration; don't restate the diff or describe the process.

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.