Skip to content

feat(create): guided wizard with use-case and language filters - #1278

Merged
l2ysho merged 19 commits into
masterfrom
1236-guided-apify-create-wizard-use-case-language-best-match-template
Aug 3, 2026
Merged

feat(create): guided wizard with use-case and language filters#1278
l2ysho merged 19 commits into
masterfrom
1236-guided-apify-create-wizard-use-case-language-best-match-template

Conversation

@l2ysho

@l2ysho l2ysho commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Closes #1236.

TL;DRapify create becomes a guided wizard: use case → language → best-match template, plus apify templates ls for discovery. Local scaffold only; the git-sourced flow is #1237 and --json/--origin is #1238.

What changed

  • Wizard — asks "What do you want to build?" then the language, then shows one scrollable, fit-ranked template list: exact matches first (top preselected), a separator, then the closest alternatives.
  • New flags -u/--use-case, -l/--language. -t/--template stays authoritative and skips the wizard; -u/-l are ignored when it's passed.
  • Language aliases js / ts / py. No other option — every template has a language.
  • New command apify templates ls [--json]; --json emits the full template objects, including useCases[].
  • Ported getTemplateRecommendation from apify-core, with two CLI changes: per-template isExactMatch and no result limit.

Flag → manifest mapping

--use-case manifest tag --language (+ alias) category
web-scraper WEB_SCRAPING javascript / js javascript
ai-agent AI typescript / ts typescript
data-pipeline INTEGRATION python / py python
browser-automation AUTOMATION

"Any use case" and "Any language" both mean no filter (ANY_TEMPLATE_USE_CASE / ANY_TEMPLATE_LANGUAGE — symmetric by design).

Tests

Unit tests for getTemplateRecommendation (tiers, dedup, any-language, no-exact), buildTemplateChoiceList (separator, labels, hint), and the flag→tag mappings; create covers --template precedence. build / lint / format clean, docs/ regenerated, wizard driven end-to-end in a terminal.

🤖 Generated with Claude Code

Reshape `apify create` into a guided wizard: prompt for what the user
wants to build (use case) and the language, then present a single
fit-ranked template list (exact matches first, top preselected, a
non-selectable separator, then the closest alternatives).

- Add `-u/--use-case` and `-l/--language` filter flags; `-t/--template`
  stays authoritative and bypasses the wizard.
- Add `apify templates ls [--json]`, exposing each template's
  useCases[] so agents can discover the enum values.
- Port apify-core's getTemplateRecommendation tier algorithm, with a
  per-template isExactMatch flag (no aggregate) and no result limit;
  a skipped use case and "any language" both mean "no filter".

Refs #1236

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the 145th sprint - Tooling team milestone Jul 16, 2026
@github-actions github-actions Bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Jul 16, 2026
- Assert `--use-case` / `--language` are ignored when `--template` is
  provided: a TypeScript template scaffolds unchanged despite conflicting
  python/ai filters.
- Unit-test the flag→id mappings (useCaseFlagToId, USE_CASE/LANGUAGE
  flag choices, labels), including that STARTER is never exposed.

Refs #1236

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@l2ysho l2ysho added t-builders Issues owned by the Builders team. and removed t-tooling Issues with this label are in the ownership of the tooling team. labels Jul 16, 2026
@l2ysho
l2ysho marked this pull request as ready for review July 16, 2026 10:56
Comment thread src/commands/create.ts Outdated
Comment thread docs/reference.md Outdated
Comment thread docs/reference.md Outdated
Comment thread src/lib/templates/consts.ts
Comment thread src/lib/templates/consts.ts Outdated
Comment thread src/lib/templates/consts.ts Outdated
Comment thread src/lib/templates/consts.ts
Comment thread src/lib/templates/getTemplateRecommendation.ts Outdated
Comment thread src/lib/templates/getTemplateRecommendation.ts Outdated
Comment thread src/lib/templates/getTemplateRecommendation.ts Outdated
l2ysho and others added 7 commits July 28, 2026 21:57
Co-authored-by: Edyta <142720610+szaganek@users.noreply.github.com>
Address PR review: `web-scraper` reads as an Actor identity (like
`ai-agent`), and `data-pipeline` matches Console's "API & data pipeline"
better than `api-pipeline`. Prompt labels are unchanged.

Refs #1236

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Document each TEMPLATE_USE_CASES tag (per-key JSDoc).
- Rename option fields to cliFlag / templateTag and derive UseCaseOption
  and LanguageOption from the `as const` option arrays.
- Correct the --use-case flag description ("by use case", not category).
- Simplify matchesUseCase to `!!...includes(...)`.

Refs #1236

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Accept `js`/`ts`/`py` as aliases for `--language`, resolved to the
  manifest category via a new `languageFlagToTag`.
- Drop the `other` (BYO-Docker) language value: no template matches it,
  and language becomes inherent once templates turn into Actors.

Refs #1236

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Replace the `undefined` "skip use case" sentinel with an
  ANY_TEMPLATE_USE_CASE marker, mirroring ANY_TEMPLATE_LANGUAGE.
- Give LanguageOption a `cliFlag` alongside `templateTag` so it mirrors
  UseCaseOption's shape.

Refs #1236

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: David Hanuš <david.hanus@apify.com>
The committed #14 suggestion used `matchesUseCase` (a function) in the
guard condition — TS2774 build failure. Use the `hasUseCaseFilter`
boolean so the exact-match tier is skipped only when no filter is
active, letting the show-all path lead with curated templates.

Refs #1236

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@l2ysho
l2ysho requested a review from DaveHanns July 28, 2026 21:20
Comment thread src/commands/create.ts
Comment thread src/lib/create-utils.ts Outdated

@DaveHanns DaveHanns left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments, otherwise LGTM.

The main things are the drop of other option of --language flag and unification of "skip / no preference / any" language and use case.

l2ysho and others added 3 commits July 29, 2026 15:23
…copy

Update `interactiveNote` and `examples` to describe the use-case/language
wizard and the -u/-l filter flags, and unify the use-case prompt's "skip"
copy with the language prompt ("Any use case" ↔ "Any language").

Addresses PR #1278 review comments r3672018996, r3672030798, r3672045202.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The use-case prompt label changed to "Any use case"; update the
getTemplateRecommendation doc comment to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@l2ysho
l2ysho requested review from DaveHanns and szaganek July 29, 2026 13:36
Comment thread src/lib/templates/consts.ts Outdated
* the fallback tiers.
*/
export const USE_CASE_OPTIONS = [
{ cliFlag: 'web-scraper', templateTag: TEMPLATE_USE_CASES.WEB_SCRAPING, label: 'Web scraping' },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: lets go with Web scraper label to match the Console.

@DaveHanns DaveHanns left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One additional suggestion. Otherwise looks great 🚀

Comment thread src/lib/templates/consts.ts Outdated
export const USE_CASE_FLAG_CHOICES: string[] = USE_CASE_OPTIONS.map((option) => option.cliFlag);

/** Maps a `--use-case` flag value to its manifest tag, or `undefined` when unknown. */
export function useCaseFlagToId(flag: string): string | undefined {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function useCaseFlagToId(flag: string): string | undefined {
export function useCaseFlagToTag(flag: string): string | undefined {

The function returns a manifest `useCases[]` tag, not an id, and its
language counterpart is already named `languageFlagToTag`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@l2ysho
l2ysho merged commit 84647b9 into master Aug 3, 2026
24 checks passed
@l2ysho
l2ysho deleted the 1236-guided-apify-create-wizard-use-case-language-best-match-template branch August 3, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-builders Issues owned by the Builders team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guided apify create wizard: use-case → language → best-match template

4 participants