Skip to content

New apify templates command (list + JSON enum/recommendation discovery) #1239

Description

@DaveHanns

Summary

Add an apify templates command to list the available Actor templates and expose their metadata as JSON. No such command exists today; template data is only reachable internally through the @apify/actor-templates manifest (fetchManifest, used in src/lib/create-utils.ts).

Motivation

Both automated callers and the guided apify create flow need to discover the valid template choices, together with their use-cases and recommendations, programmatically rather than scraping --help. A first-class templates command is also useful on its own: it lets anyone inspect what's available before creating an Actor.

Command

apify templates ls [--json] lists the available templates.

  • Human output: a readable table (name, language, description).
  • --json output: the full template list plus, for each template, its language and use-case tags, and which template(s) are recommended.

The framework already provides the --json flag (opt-in via static enableJsonFlag = true) and printJsonToStdout, so this is opt-in plus the output shape.

Shared metadata (likely cross-repo)

useCases[] and recommended need a single source of truth, ideally added to the @apify/actor-templates manifest (repo: apify/actor-templates). Apify Console already encodes use-case and recommendation logic in its creation wizard via getTemplateRecommendation; both should consume the same metadata so results stay identical across Console and CLI.

Notes

  • Register the new command in src/commands/_register.ts (subcommands go through a templates/_index.ts).
  • Update docs after adding it: run pnpm run update-docs and refresh the public CLI reference on docs.apify.com.
  • Current template fetching lives in @apify/actor-templates (fetchManifest, manifestUrl), used by src/lib/create-utils.ts.

Related

Consumed by the guided apify create work in #1153, but shippable independently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request.t-buildersIssues owned by the Builders team.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions