Skip to content

Update CLI site init prompts#1464

Merged
ChiragAgg5k merged 3 commits intomasterfrom
codex/cli-site-init-prompts
Apr 19, 2026
Merged

Update CLI site init prompts#1464
ChiragAgg5k merged 3 commits intomasterfrom
codex/cli-site-init-prompts

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

Summary

  • Ask for site deployment retention in days, keeping 0 as unlimited days.
  • Prompt for the site path during init, defaulting to sites/my-awesome-site for the default site name.
  • Prompt before downloading starter template code and skip repository fetch/extract unless the user opts in.

Type of Change

  • Bug fix

Testing

  • php example.php cli
  • npm run build:types (in examples/cli)
  • composer lint-twig
  • npm exec eslint -- --rule "@typescript-eslint/no-explicit-any: off" lib/questions.ts lib/commands/init.ts (in examples/cli)
  • git diff --check

Related issue: #XXXX

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 19, 2026

Greptile Summary

This PR improves the init site flow by prompting for a user-defined local path (defaulting to sites/<safe-name>), adding an opt-in downloadTemplate confirm (defaulting to false), and consistently removing the deprecated enabled field from schema, pull, push, and config. The cleanup logic for partial failures during template download (removing templatesDir, newly-created siteDir, and empty siteFolder) is thoughtful and handles the main failure scenarios raised in prior review rounds.

Confidence Score: 5/5

Safe to merge; prior P1 concerns about missing cleanup and missing non-empty-dir warning are resolved in this revision.

All remaining findings are P2 or lower. The template-download cleanup try/catch correctly handles the main failure paths, the enabled-field removal is consistent across all call sites, and the new prompts behave correctly relative to process.cwd(). The gap where siteDir is not cleaned up if localConfig.addSite throws is pre-existing and not introduced here.

No files require special attention.

Important Files Changed

Filename Overview
templates/cli/lib/commands/init.ts Core change: site init now uses user-supplied path, guards template download behind a confirm prompt, and adds try/catch cleanup for partial state. Cleanup logic is well-structured but siteDir created outside the try block won't be removed if addSite throws (pre-existing gap, not introduced here).
templates/cli/lib/questions.ts Adds path and downloadTemplate prompts to questionsCreateSite; path defaults via getDefaultSitePath and is validated with validateSitePath; both are implemented correctly relative to process.cwd().
templates/cli/lib/config.ts Adds enabled to pruneDeprecatedSiteFields and removes it inline in getSites() to strip the field from in-memory reads; getSite() now delegates to getSites() for consistent pruning.
templates/cli/lib/commands/config.ts Removes enabled from SiteSchema, consistent with its removal from pull/push/config.
templates/cli/lib/commands/pull.ts Removes enabled from the site object written to local config during pull; consistent with schema and push changes.
templates/cli/lib/commands/push.ts Removes enabled from both updateSite call sites in the push flow; consistent cleanup.

Reviews (3): Last reviewed commit: "Address Greptile site init cleanup notes" | Re-trigger Greptile

Comment thread templates/cli/lib/questions.ts
Comment thread templates/cli/lib/commands/init.ts Outdated
Comment thread templates/cli/lib/commands/init.ts Outdated
@ChiragAgg5k ChiragAgg5k merged commit 9da85da into master Apr 19, 2026
92 of 93 checks passed
@ChiragAgg5k ChiragAgg5k deleted the codex/cli-site-init-prompts branch April 19, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant