create-warlock 5.31.0 → 5.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +78 -25
  3. package/esm/commands/create-new-app/index.mjs +2 -2
  4. package/esm/commands/create-new-app/index.mjs.map +1 -1
  5. package/esm/commands/create-new-app/types.d.mts +14 -9
  6. package/esm/commands/create-warlock-app/index.mjs +1 -1
  7. package/esm/commands/create-warlock-app/index.mjs.map +1 -1
  8. package/esm/features/agent-kit-targets.mjs +1 -1
  9. package/esm/features/agent-kit-targets.mjs.map +1 -1
  10. package/esm/features/database-drivers.mjs +1 -1
  11. package/esm/features/features-map.mjs +1 -1
  12. package/esm/flags/assert-package-manager.mjs +1 -1
  13. package/esm/flags/definitions.mjs +3 -3
  14. package/esm/flags/definitions.mjs.map +1 -1
  15. package/esm/flags/seed-from-flags.mjs +2 -2
  16. package/esm/flags/seed-from-flags.mjs.map +1 -1
  17. package/esm/helpers/app.mjs +34 -12
  18. package/esm/helpers/app.mjs.map +1 -1
  19. package/esm/helpers/exec.mjs +1 -1
  20. package/esm/helpers/insert-import.mjs +1 -1
  21. package/esm/helpers/insert-import.mjs.map +1 -1
  22. package/esm/helpers/paths.mjs.map +1 -1
  23. package/esm/helpers/warlock-versions.mjs +1 -1
  24. package/esm/index.d.mts +3 -5
  25. package/esm/index.mjs +1 -3
  26. package/esm/index.mjs.map +1 -1
  27. package/esm/prompts/ask-lint-toolchain.mjs +2 -2
  28. package/esm/prompts/ask-lint-toolchain.mjs.map +1 -1
  29. package/esm/summary.mjs +2 -2
  30. package/esm/summary.mjs.map +1 -1
  31. package/esm/ui/banner.mjs +1 -1
  32. package/llms-full.txt +79 -10
  33. package/package.json +2 -2
  34. package/skills/create-a-warlock-project/SKILL.md +79 -10
  35. package/templates/toolchains/oxc/.oxfmtignore +2 -0
  36. package/templates/toolchains/oxc/.oxfmtrc.json +4 -1
  37. package/templates/warlock/.prettierrc.json +3 -1
  38. package/templates/warlock/README.md +13 -0
  39. package/templates/warlock/package.json +4 -4
  40. package/templates/warlock/skills/code-standards/SKILL.md +1 -1
  41. package/templates/warlock/src/app/auth/controllers/login.controller.ts +1 -1
  42. package/templates/warlock/src/app/contact/controllers/contact.controller.ts +1 -1
  43. package/templates/warlock/src/app/locale/controllers/locale.controller.ts +1 -1
  44. package/templates/warlock/src/app/posts/controllers/create-new-post.controller.ts +1 -1
  45. package/templates/warlock/src/app/posts/controllers/update-post.controller.ts +1 -1
  46. package/templates/warlock/src/app/posts/models/post/post.model.ts +1 -1
  47. package/templates/warlock/src/app/posts/schema/create-post.schema.ts +1 -1
  48. package/templates/warlock/src/app/posts/schema/update-post.schema.ts +1 -1
  49. package/templates/warlock/src/app/users/controllers/create-new-user.controller.ts +1 -1
  50. package/templates/warlock/src/app/users/controllers/list-users.controller.ts +1 -1
  51. package/templates/warlock/src/app/users/models/user/user.model.ts +1 -1
  52. package/templates/warlock/src/app/users/schema/create-user.schema.ts +1 -1
  53. package/templates/warlock/src/app/users/schema/list-users.schema.ts +1 -1
  54. package/templates/warlock/src/config/storage.ts +1 -1
  55. package/templates/warlock/src/web/assets.d.ts +2 -0
  56. package/templates/warlock/src/web/home/components/contact-form-controls.tsx +1 -1
  57. package/templates/warlock/src/web/home/components/hero-section.tsx +1 -0
  58. package/templates/warlock/tsconfig.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,30 @@ All notable changes to `create-warlock` are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
6
6
 
7
+ ## 5.33.0 - 2026-10-19
8
+
9
+ ### Changed
10
+
11
+ - Label the explicit ESLint/Prettier prompt choice, flag help and docs as deprecated; retain TypeScript 6.0.3 compatibility and explicitly enable its dev-server checker. Package development scripts use root Oxlint/Oxfmt, and the template formatting gate defaults to Oxfmt. Oxc scripts explicitly select `.oxfmtignore`.
12
+
13
+ ### Deprecated
14
+
15
+ - `--lint=eslint` prints a clear removal warning for 5.34.0, recommends `--lint=oxc` and names the existing-app migration command. Explicit Prettier compatibility scripts also warn.
16
+
17
+ ## 5.32.0 - 2026-10-18
18
+
19
+ ### Changed
20
+
21
+ - **BREAKING:** the default scaffold toolchain is now Oxlint + Oxfmt (`--lint=oxc`) with TypeScript 7.0.2. Explicit `--lint=eslint` retains ESLint + Prettier with TypeScript 6.0.3 so npm, pnpm and yarn can satisfy typescript-eslint's peer range. The wizard, help and headless defaults agree.
22
+ - ESLint selection prints one compatibility notice explaining the TypeScript 6.0.3 pin and planned deprecation in 5.33 / removal in 5.34. The scaffold gate accepts `--lint` and `--pm` to verify both toolchains with npm, pnpm or yarn; CI exercises Oxc by default.
23
+ - Replace the Prettier import organizer with `@ianvs/prettier-plugin-sort-imports` so import sorting works with TypeScript 7. Keep built-ins, packages, internal aliases and relative imports in one block, with separate type imports; align Oxfmt’s internal-alias groups with the same template source. Formatters retain unused imports; ESLint or Oxlint reports them.
24
+ - **BREAKING:** scaffold the default Oxlint/Oxfmt mode with TypeScript 7.0.2 using the native `tsc` command, supported tsconfig options and explicit Node types. Existing apps must remove `baseUrl`, rebase `paths`, and replace classic Node module resolution.
25
+ - Document the optional ESLint parser's dependence on the removed JavaScript compiler API; keep its compiler isolated in the monorepo's development tooling so ESLint specs remain executable while the default scaffold uses TS7.
26
+
27
+ ### Upgrading
28
+
29
+ - Omit `--lint` for Oxlint + Oxfmt and TypeScript 7.0.2. Pass `--lint=eslint` explicitly to retain ESLint + Prettier on TypeScript 6.0.3. Existing apps keep their chosen tools; both modes use relative `paths`, no `baseUrl` and bundler module resolution.
30
+
7
31
  ## 5.31.0 - 2026-10-18
8
32
 
9
33
  ### Added
package/README.md CHANGED
@@ -34,22 +34,22 @@ answered that choice. The stack is the only choice that changes the generated
34
34
  app's shape. Everything else below is a flag with a default; a summary of what
35
35
  was decided prints after scaffolding, along with how to change each one.
36
36
 
37
- | Flag | Description | Default |
38
- | ------------------------------ | -------------------------------------------------------------------- | ------------------------------------------------------------------------ |
39
- | `--name=<name>` | Project name (or the first positional arg) | required — prompted with a TTY, otherwise fails naming this flag |
40
- | `--stack=<api\|web>` | API-only or full-stack web; the structural choice | `api` |
41
- | `--db=<driver>` / `--no-db` | Database driver (`postgres`, `mongodb`, …), or skip one entirely | `mongodb` |
42
- | `--features=<list>` | Comma-separated feature keys (e.g. `test,herald`) | none (or `["web"]` when `--stack=web` and `--features` is not given) |
43
- | `--lint=<oxc\|eslint>` | Development lint/format toolchain: Oxlint/Oxfmt or ESLint/Prettier | `eslint` |
44
- | `--ai=<list>` | Comma-separated AI provider keys (e.g. `openai,anthropic`) | none |
45
- | `--pm=<manager>` | Package manager (`npm`, `yarn`, `pnpm`, `bun`) | inferred from the invoking agent (`npm_config_user_agent`) or the system |
46
- | `--agents=<list>` | Comma-separated [agent-kit](https://mongez.js.org/agent-kit) targets | `claude` |
47
- | `--git` / `--no-git` | Force-enable or force-disable git initialization | `false` |
48
- | `--jwt` / `--no-jwt` | Force-enable or force-disable JWT secret generation | `false` |
49
- | `-y`, `--yes` | Skip every prompt and take defaults for anything unset | `false` |
50
- | `--interactive`, `--customize` | Restore the full long-form interactive wizard | `false` |
51
- | `-h`, `--help` | Print usage (every flag + its default) and exit | — |
52
- | `-v`, `--version` | Print the installed version and exit | — |
37
+ | Flag | Description | Default |
38
+ | ------------------------------ | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
39
+ | `--name=<name>` | Project name (or the first positional arg) | required — prompted with a TTY, otherwise fails naming this flag |
40
+ | `--stack=<api\|web>` | API-only or full-stack web; the structural choice | `api` |
41
+ | `--db=<driver>` / `--no-db` | Database driver (`postgres`, `mongodb`, …), or skip one entirely | `mongodb` |
42
+ | `--features=<list>` | Comma-separated feature keys (e.g. `test,herald`) | none (or `["web"]` when `--stack=web` and `--features` is not given) |
43
+ | `--lint=<oxc\|eslint>` | Development lint/format toolchain: Oxlint/Oxfmt or ESLint/Prettier (deprecated) | `oxc` |
44
+ | `--ai=<list>` | Comma-separated AI provider keys (e.g. `openai,anthropic`) | none |
45
+ | `--pm=<manager>` | Package manager (`npm`, `yarn`, `pnpm`, `bun`) | inferred from the invoking agent (`npm_config_user_agent`) or the system |
46
+ | `--agents=<list>` | Comma-separated [agent-kit](https://mongez.js.org/agent-kit) targets | `claude` |
47
+ | `--git` / `--no-git` | Force-enable or force-disable git initialization | `false` |
48
+ | `--jwt` / `--no-jwt` | Force-enable or force-disable JWT secret generation | `false` |
49
+ | `-y`, `--yes` | Skip every prompt and take defaults for anything unset | `false` |
50
+ | `--interactive`, `--customize` | Restore the full long-form interactive wizard | `false` |
51
+ | `-h`, `--help` | Print usage (every flag + its default) and exit | — |
52
+ | `-v`, `--version` | Print the installed version and exit | — |
53
53
 
54
54
  ```bash
55
55
  create-warlock my-app --db=postgres --features=test,herald --yes
@@ -174,15 +174,19 @@ The decisions overview shows the total selected feature/AI count and up to six
174
174
  keys, followed by `+N more` for longer selections. The final success screen lists
175
175
  all selected feature keys.
176
176
 
177
- ### Optional Oxc tooling
177
+ ### Default Oxc tooling
178
178
 
179
- Pass `--lint=oxc` (or `--lint oxc`) to scaffold with Oxlint **1.88.0** and Oxfmt
180
- **0.73.0**. The full `--customize` wizard offers the same choice and preselects
181
- any supplied flag. The default is `--lint=eslint`, which keeps ESLint/Prettier.
179
+ New projects default to `--lint=oxc` (also `--lint oxc`), with Oxlint **1.88.0**
180
+ and Oxfmt **0.73.0**. The full `--customize` wizard offers the same choice and
181
+ preselects any supplied flag. Pass `--lint=eslint` to opt in to ESLint/Prettier.
182
182
  Unknown or missing `--lint` values fail before copying the project.
183
183
 
184
184
  ```bash
185
- npm create warlock@latest my-app -- --lint=oxc --yes
185
+ # Default: Oxlint + Oxfmt, TypeScript 7.0.2
186
+ npm create warlock@latest my-app -- --yes
187
+
188
+ # Explicit opt-in: ESLint + Prettier, TypeScript 6.0.3
189
+ npm create warlock@latest my-eslint-app -- --lint=eslint --yes
186
190
  ```
187
191
 
188
192
  Oxc projects receive `.oxlintrc.json` and `.oxfmtrc.json`, replace the template's
@@ -192,15 +196,64 @@ checker while retaining TypeScript checks. Both choices provide `lint`, `format`
192
196
  Oxc projects also receive VS Code format-on-save settings and an extension
193
197
  recommendation for [Oxc](https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode).
194
198
  Its formatter is `oxc.oxc-vscode` and lint fixes use `source.fixAll.oxc`;
195
- ESLint/Prettier editor settings remain the default for the ESLint toolchain.
199
+ ESLint projects retain their Prettier/ESLint editor settings.
196
200
 
197
201
  The Oxlint config preserves the template's unused-variable/import checks,
198
202
  explicit class accessibility and type-import style. Oxfmt uses the same 100-column,
199
203
  double-quote, semicolon and trailing-comma settings, and sorts imports with
200
- `"sortImports": { "newlinesBetween": false }` — built-ins, packages, then relative
201
- paths, in one block like `prettier-plugin-organize-imports`. Oxfmt does not delete
202
- unused imports; Oxlint reports them. Every generated script calls the local binary
204
+ `"sortImports": { "newlinesBetween": false, "internalPattern": ["app/", "web/", "@shared/"] }` — built-ins, packages, internal aliases, then relative
205
+ paths, in one block like `@ianvs/prettier-plugin-sort-imports` in the Prettier
206
+ toolchain. The Prettier config also groups internal aliases before relatives and
207
+ keeps type imports separate. Its Babel parser works with TypeScript 7 without
208
+ using the compiler API. Neither formatter deletes unused imports; ESLint’s
209
+ `unused-imports/no-unused-imports` or Oxlint’s `no-unused-vars` reports them. Every generated script calls the local binary
203
210
  (`eslint`, `oxlint`, `prettier`, `oxfmt`, `tsc`) rather than `npx`. See the
204
211
  [Oxlint config reference](https://oxc.rs/docs/guide/usage/linter/config-file-reference)
205
212
  and [Oxfmt config reference](https://oxc.rs/docs/guide/usage/formatter/config-file-reference)
206
213
  when adding project rules.
214
+
215
+ ## TypeScript 7 in 5.32
216
+
217
+ Default Oxlint/Oxfmt projects pin `typescript` to `7.0.2`; `tsc` is the native Go compiler.
218
+ The template uses `module: "ESNext"`, `moduleResolution: "bundler"`, explicit
219
+ Node types, and `paths` relative to its tsconfig, without `baseUrl`.
220
+ Existing apps must remove `baseUrl`, rebase alias targets, and replace
221
+ `moduleResolution: "node"` / `"node10"` before typechecking.
222
+
223
+ Explicit `--lint=eslint` projects pin `typescript` to **6.0.3**, the newest version
224
+ supported by typescript-eslint. Its parser requires the JavaScript compiler API
225
+ removed in TypeScript 7, and its declared peer range is `>=4.8.4 <6.1.0`
226
+ ([parser package metadata](https://registry.npmjs.org/@typescript-eslint/parser/8.71.2)).
227
+ Both modes use the same tsconfig settings above, which are valid in TypeScript 6.
228
+ ESLint mode prints a deprecation warning naming removal in 5.34.0 and the Oxc migration command. Both modes install with npm, pnpm and yarn.
229
+
230
+ ## Migrate to Oxlint and Oxfmt in 5.33
231
+
232
+ ESLint + Prettier are deprecated in 5.33.0 and will be removed in **5.34.0**.
233
+ New apps should use `--lint=oxc`. To migrate an existing app, install the new
234
+ core release and `ts-morph`, then run:
235
+
236
+ ```bash
237
+ npx warlock upgrade --from 5.32 --to 5.33.0 --dry-run
238
+ npx warlock upgrade --from 5.32 --to 5.33.0
239
+ npm install
240
+ npm run format
241
+ npm run lint:check
242
+ npx warlock check
243
+ ```
244
+
245
+ Review every reported `file:line`: customized configs are preserved and need
246
+ manual translation before removal. The codemod installs the template's Oxlint
247
+ and Oxfmt versions and pins TypeScript to 7.0.2. It replaces standard lint/format
248
+ scripts, removes legacy dependencies, and deletes only recognized generated
249
+ configs. A generated `.prettierignore` becomes `.oxfmtignore`. Existing Oxc
250
+ configs are preserved. `--dry-run --json` reports the same planned changes
251
+ without writing files.
252
+
253
+ Explicit deprecated ESLint scaffolds set `devServer.healthCheckers.eslint: true`;
254
+ existing apps must set this themselves to retain background ESLint checking.
255
+
256
+ Oxc formatting scripts explicitly read `.gitignore` and `.oxfmtignore`. Oxfmt
257
+ 0.73 otherwise defaults to `.prettierignore` (`oxfmt --help`); the explicit
258
+ paths make migrated ignore rules effective. The package template format gate
259
+ also defaults to Oxfmt; `--lint=eslint` is its deprecated compatibility mode.
@@ -213,7 +213,7 @@ async function scaffold(appDetails) {
213
213
  * before any file is written.
214
214
  */
215
215
  function resolveNonInteractiveOptions(cli) {
216
- const lint = cli.lint ?? "eslint";
216
+ const lint = cli.lint ?? "oxc";
217
217
  if (lint !== "eslint" && lint !== "oxc") throw new Error(`Unknown lint toolchain "${lint}". Use --lint=eslint or --lint=oxc.`);
218
218
  const databaseDriver = cli.db ?? "mongodb";
219
219
  const noDatabase = isNoDatabase(databaseDriver);
@@ -289,5 +289,5 @@ async function createNonInteractive(cli) {
289
289
  }
290
290
 
291
291
  //#endregion
292
- export { createNewApp as default };
292
+ export { createNewApp as default, resolveAppOptions, resolveNonInteractiveOptions };
293
293
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../packages/create-warlock/src/commands/create-new-app/index.ts"],"sourcesContent":["import { cancel, confirm, isCancel, select } from \"@clack/prompts\";\nimport { colors } from \"@mongez/copper\";\nimport { getJsonFile } from \"@warlock.js/fs\";\nimport { resolveAgentTargets } from \"../../features/agent-kit-targets\";\nimport {\n getDatabaseDriver,\n getDatabaseDriverOptions,\n isNoDatabase,\n} from \"../../features/database-drivers\";\nimport {\n getAiPackageOptions,\n getAiProviderOptions,\n getAllFeatureKeys,\n} from \"../../features/features-map\";\nimport { assertFlagCombinations } from \"../../flags/assert-flag-combinations\";\nimport { assertPackageManagerAvailable } from \"../../flags/assert-package-manager\";\nimport { seedFromFlags } from \"../../flags/seed-from-flags\";\nimport { App } from \"../../helpers/app\";\nimport {\n detectPackageManagers,\n getPackageManager,\n getPreferredPackageManager,\n getSystemPackageManagers,\n setPackageManager,\n} from \"../../helpers/package-manager\";\nimport { packageRoot } from \"../../helpers/paths\";\nimport { hasInteractiveStdin } from \"../../helpers/tty\";\nimport { askAgentTargets } from \"../../prompts/ask-agent-targets\";\nimport { askAiFeatures } from \"../../prompts/ask-ai-features\";\nimport { askFeatures } from \"../../prompts/ask-features\";\nimport { askLintToolchain } from \"../../prompts/ask-lint-toolchain\";\nimport { askProjectName } from \"../../prompts/ask-project-name\";\nimport { askStack } from \"../../prompts/ask-stack\";\nimport { showIntroBanner } from \"../../ui/banner\";\nimport { createWarlockApp } from \"../create-warlock-app\";\nimport getAppPath from \"./get-app-path\";\nimport { AppOptions, App as AppType, CliFlags, SetupChoice, Stack } from \"./types\";\n\nexport default async function createNewApp(cli: CliFlags = {}) {\n // Start detecting package managers in the background to avoid delay later\n const pmDetectionPromise = detectPackageManagers();\n\n // Get version from package.json\n const packageJson: any = getJsonFile(packageRoot(\"package.json\"));\n const createWarlockVersion = packageJson.version;\n\n // Show the intro banner\n showIntroBanner(createWarlockVersion);\n\n console.log(colors.cyan(\"Let's create something magical! \\n\"));\n\n // Validate Node.js version (minimum 22.15: the warlock CLI uses module.registerHooks)\n const [major = 0, minor = 0] = process.versions.node.split(\".\").map(Number);\n if (major < 22 || (major === 22 && minor < 15)) {\n cancel(`Node.js 22.15.0 or newer is required (found ${process.versions.node}).`);\n process.exit(0);\n }\n\n // Refuse contradictory flag combinations LOUDLY, before anything else looks\n // at them — `--customize --yes` used to drop `--customize` without a word.\n assertFlagCombinations(cli);\n\n // Non-interactive path: build everything from flags and skip the prompts.\n //\n // Triggered by --yes, OR automatically the moment stdin has no TTY — CI, a\n // script, an agent harness. This check MUST run before the first prompt\n // call: attempting `text()`/`select()` on a non-TTY stdin does not fail\n // cleanly, it crashes with a libuv internal (\"TTY initialization failed:\n // uv_tty_init returned EBADF\") before any app directory exists, no matter\n // how the run was invoked.\n //\n // Prompting is the fallback, not the precondition: a project name is the\n // only answer with no sane default, so when a name is already available\n // (positional arg or --name) the run proceeds exactly as --yes would, TTY\n // or not. When the name is ALSO missing and there is no TTY to ask for one,\n // createNonInteractive fails loudly — naming --yes and every non-interactive\n // flag — instead of ever reaching a prompt. Every other prompt already has a\n // default; see resolveNonInteractiveOptions below for the full table.\n if (cli.yes || !hasInteractiveStdin()) {\n await createNonInteractive(cli);\n return;\n }\n\n // `--interactive` (alias `--customize`) restores the full long-form wizard\n // below. Everyone else with a TTY falls through to the default path, which\n // asks the preset plus database choice — see createDefaultInteractive.\n if (cli.interactive) {\n await createFullWizard(cli, pmDetectionPromise);\n return;\n }\n\n await createDefaultInteractive(cli, pmDetectionPromise);\n}\n\n/**\n * The full long-form wizard (`--interactive` / `--customize`): every prompt,\n * one after another. This is the ORIGINAL default flow, preserved verbatim —\n * only its trigger moved from \"any TTY\" to an explicit opt-in flag, per the\n * rule that a reversible choice never prompts by default.\n */\nasync function createFullWizard(cli: CliFlags, pmDetectionPromise: Promise<void>) {\n // Step 1: Project name — but only when it is not already known. It arrives\n // answered from `--name`/the positional arg, and from the default path when\n // the user picked \"Customize\" AFTER being asked for a name. Re-asking for an\n // answer we already hold is the double-prompt this branch exists to avoid.\n const appName = cli.name ?? (await askProjectName());\n\n const appPath = getAppPath(appName);\n if (!appPath) return;\n\n // A flag passed alongside --customize is an answer given early, not a\n // contradiction: it pre-selects the matching prompt instead of being\n // dropped. Validate the ones that CAN be wrong through the same function\n // the non-interactive path uses, so an unknown driver or feature key fails\n // here rather than showing a prompt that quietly ignores it.\n try {\n resolveNonInteractiveOptions(cli);\n } catch (error) {\n cancel((error as Error).message);\n process.exit(1);\n }\n\n const seeds = seedFromFlags(cli);\n\n // Step 2: Package Manager selection\n await pmDetectionPromise; // Ensure detection is complete\n\n // Only now can availability be judged: detection is what fills\n // getSystemPackageManagers(), and the prompt below is built from it.\n assertPackageManagerAvailable(cli.pm);\n\n const packageManager = await select({\n message: \"Which package manager do you want to use?\",\n options: getSystemPackageManagers().map((pm) => ({\n value: pm,\n label: pm,\n })),\n initialValue: seeds.packageManager,\n });\n\n if (isCancel(packageManager)) {\n cancel(\"Package manager selection cancelled\");\n process.exit(0);\n }\n\n setPackageManager(packageManager as string);\n\n const lint = await askLintToolchain(seeds.lint);\n if (isCancel(lint)) {\n cancel(\"Toolchain selection cancelled\");\n process.exit(0);\n }\n\n // Step 3: Database driver selection\n const databaseDriver = await select({\n message: \"Choose your database driver\",\n options: getDatabaseDriverOptions(),\n initialValue: seeds.databaseDriver,\n });\n\n if (isCancel(databaseDriver)) {\n cancel(\"Database selection cancelled\");\n process.exit(0);\n }\n\n const selectedDriver = getDatabaseDriver(databaseDriver as string);\n\n // Step 4: Edit optional features in paged groups.\n const selectedFeatures = await askFeatures(seeds.features);\n\n if (isCancel(selectedFeatures)) {\n cancel(\"Feature selection cancelled\");\n process.exit(0);\n }\n\n // Step 4b: AI providers + capability packages — selecting any pulls\n // @warlock.js/ai automatically. The result still flows through the\n // `selectedAiProviders` → `aiProviders` pipeline, which now also carries the\n // capability packages (ai-tools / ai-panoptic / ai-workspace).\n const selectedAiProviders = await askAiFeatures(seeds.aiProviders);\n\n if (isCancel(selectedAiProviders)) {\n cancel(\"AI provider selection cancelled\");\n process.exit(0);\n }\n\n // Step 5: Git initialization\n const useGit =\n (await confirm({\n message: \"Initialize a Git repository?\",\n initialValue: seeds.useGit,\n })) === true;\n\n if (isCancel(useGit)) {\n cancel(\"Setup cancelled\");\n process.exit(0);\n }\n\n // Step 6: JWT secret generation\n const useJWT =\n (await confirm({\n message: \"Generate JWT secret keys?\",\n initialValue: seeds.useJWT,\n })) === true;\n\n if (isCancel(useJWT)) {\n cancel(\"Setup cancelled\");\n process.exit(0);\n }\n\n // Step 7: agent-kit targets. Asked here rather than left to --agents,\n // because Customize means every choice is offered (owner ruling, seq 1028).\n // --agents pre-ticks the selection, like every other flag.\n const agents = await askAgentTargets(cli.agents);\n\n // Build app details\n const appDetails: Required<AppType> = {\n appName: appName,\n appType: \"warlock\",\n appPath: appPath,\n pkgManager: getPackageManager(),\n options: {\n databaseDriver: databaseDriver as string,\n databasePort: selectedDriver?.defaultPort || 27017,\n features: selectedFeatures as string[],\n aiProviders: selectedAiProviders as string[],\n useGit,\n useJWT,\n agents,\n lint,\n },\n };\n\n // Create the app\n await scaffold(appDetails);\n}\n\n/**\n * The default TTY path: neither `--yes` nor `--interactive` was given, but a\n * terminal is available. Asks the project name when missing (a required\n * answer with no sane default — same treatment as the non-interactive path)\n * plus the preset's database choice when `--db`/`--no-db` was not supplied.\n * Every other choice is resolved exactly like `createNonInteractive` — flags,\n * with defaults, never a prompt.\n */\nasync function createDefaultInteractive(cli: CliFlags, pmDetectionPromise: Promise<void>) {\n const appName = cli.name ?? (await askProjectName());\n\n const appPath = getAppPath(appName);\n if (!appPath) return;\n\n const choice: SetupChoice = cli.stack ?? (await askStack());\n\n // \"Customize\" is not a third stack — it is the wizard, chosen from the menu\n // instead of from a flag nobody was told about. Hand over the name we just\n // collected so the wizard starts at its SECOND question.\n if (choice === \"customize\") {\n await createFullWizard({ ...cli, name: appName }, pmDetectionPromise);\n return;\n }\n\n const stack: Stack = choice;\n\n await pmDetectionPromise;\n\n const packageManager = cli.pm ?? getPreferredPackageManager();\n\n assertPackageManagerAvailable(cli.pm);\n\n setPackageManager(packageManager);\n\n const databaseDriver =\n cli.db ??\n (await select({\n message: \"Choose your database driver\",\n options: getDatabaseDriverOptions(),\n initialValue: \"mongodb\",\n }));\n\n if (isCancel(databaseDriver)) {\n cancel(\"Database selection cancelled\");\n process.exit(0);\n }\n\n let options: AppOptions;\n\n try {\n options = await resolveAppOptions({ ...cli, stack, db: databaseDriver });\n } catch (error) {\n cancel((error as Error).message);\n process.exit(1);\n }\n\n const appDetails: Required<AppType> = {\n appName,\n appType: \"warlock\",\n appPath,\n pkgManager: getPackageManager(),\n options,\n };\n\n await scaffold(appDetails);\n}\n\n/**\n * Run the scaffold and make the process's exit code tell the truth: anything\n * the user asked for that did not happen leaves the shell with a non-zero\n * status, so scripts and CI cannot mistake a half-built project for a finished\n * one. The problems themselves are printed by the scaffolder.\n */\nasync function scaffold(appDetails: Required<AppType>) {\n const outcome = await createWarlockApp(new App(appDetails));\n\n if (outcome && !outcome.ok) {\n process.exitCode = 1;\n }\n}\n\n/** Everything {@link resolveNonInteractiveOptions} can resolve without the network. */\nexport type SyncAppOptions = Omit<AppOptions, \"agents\">;\n\n/**\n * Resolve every flag-or-default `AppOptions` field EXCEPT `agents` from parsed\n * CLI flags — applying the non-interactive defaults, validating the database\n * driver and feature/provider keys, and handling the `none` (no database)\n * selection. `agents` is resolved separately by {@link resolveAppOptions}\n * because it can require a network fetch; this function stays synchronous so\n * the rest of the flag → app mapping remains trivially unit-testable.\n *\n * `--stack=web` (or the equivalent wizard answer) seeds the `web` feature by\n * default — the one structural choice — but an explicit `--features` always\n * wins, so a user who spells out the feature list is never second-guessed.\n *\n * Throws on an unknown driver, feature, or AI key so the caller can fail fast\n * before any file is written.\n */\nexport function resolveNonInteractiveOptions(cli: CliFlags): SyncAppOptions {\n const lint = cli.lint ?? \"eslint\";\n if (lint !== \"eslint\" && lint !== \"oxc\") {\n throw new Error(`Unknown lint toolchain \"${lint}\". Use --lint=eslint or --lint=oxc.`);\n }\n const databaseDriver = cli.db ?? \"mongodb\";\n const noDatabase = isNoDatabase(databaseDriver);\n const driver = noDatabase ? undefined : getDatabaseDriver(databaseDriver);\n\n if (!noDatabase && !driver) {\n throw new Error(`Unknown database driver \"${databaseDriver}\"`);\n }\n\n const stack: Stack = cli.stack ?? \"api\";\n const features = cli.features ?? (stack === \"web\" ? [\"web\"] : []);\n const aiProviders = cli.ai ?? [];\n\n const allowedKeys = getAllFeatureKeys();\n const invalidFeatureKeys = features.filter((key) => !allowedKeys.includes(key));\n const errors: string[] = [];\n\n if (invalidFeatureKeys.length > 0) {\n errors.push(`Unknown feature(s): ${invalidFeatureKeys.join(\",\")}`);\n }\n\n const aiFeatureKeys = [...getAiProviderOptions(), ...getAiPackageOptions()].map(\n (option) => option.value,\n );\n const invalidAiKeys = aiProviders.filter((key) => !aiFeatureKeys.includes(key));\n\n if (invalidAiKeys.length > 0) {\n errors.push(\n `Unknown AI feature(s): ${invalidAiKeys.join(\",\")}. ` +\n `Valid AI choices: ${aiFeatureKeys.join(\", \")}`,\n );\n }\n\n if (errors.length > 0) {\n throw new Error(errors.join(\"\\n\"));\n }\n\n return {\n databaseDriver,\n databasePort: driver?.defaultPort ?? 27017,\n features,\n aiProviders,\n lint,\n useGit: cli.git ?? false,\n useJWT: cli.jwt ?? false,\n };\n}\n\n/**\n * Resolve the FULL `AppOptions` — {@link resolveNonInteractiveOptions} plus\n * the validated `agents` list. Async because a non-default `--agents`\n * selection may need {@link resolveAgentTargets}'s network fetch; the default\n * (`claude`) never does.\n */\nexport async function resolveAppOptions(cli: CliFlags): Promise<AppOptions> {\n const options = resolveNonInteractiveOptions(cli);\n const agents = await resolveAgentTargets(cli.agents);\n\n return { ...options, agents };\n}\n\n/**\n * Non-interactive scaffold path for `--yes`. Builds the app from flags with\n * sensible defaults and skips every prompt — a single command scaffolds the\n * entire app. Validation lives in `resolveNonInteractiveOptions`; a typo fails\n * fast here instead of mid-install.\n */\nasync function createNonInteractive(cli: CliFlags) {\n const appName = (cli.name ?? \"\").trim();\n\n if (!appName) {\n // Reached either because --yes was passed with no name, or because stdin\n // has no TTY to prompt for one — either way, nothing is left to fall back\n // to. Name --yes AND every non-interactive flag so a CI log is enough to\n // fix the invocation without hunting for docs.\n cancel(\n \"A project name is required and no terminal is available to ask for one. \" +\n \"Pass it as the first argument or --name=<name>. Non-interactive flags: \" +\n \"--yes, --pm=<npm|yarn|pnpm|bun>, --db=<driver>|--no-db, --features=<list>, \" +\n \"--ai=<list>, --lint=<oxc|eslint>, --git|--no-git, --jwt|--no-jwt.\",\n );\n process.exit(1);\n }\n\n const appPath = getAppPath(appName);\n\n if (!appPath) return;\n\n await detectPackageManagers();\n\n const packageManager = cli.pm ?? getPreferredPackageManager();\n\n assertPackageManagerAvailable(cli.pm);\n\n setPackageManager(packageManager);\n\n let options: AppOptions;\n\n try {\n options = await resolveAppOptions(cli);\n } catch (error) {\n cancel((error as Error).message);\n process.exit(1);\n }\n\n const appDetails: Required<AppType> = {\n appName,\n appType: \"warlock\",\n appPath,\n pkgManager: getPackageManager(),\n options,\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,IAAI,CAAC,SAAS;CAEd,MAAM,sBAAsB;CAE5B,MAAM,iBAAiB,IAAI,MAAM,2BAA2B;CAE5D,8BAA8B,IAAI,EAAE;CAEpC,kBAAkB,cAAc;CAEhC,IAAI;CAEJ,IAAI;EACF,UAAU,MAAM,kBAAkB,GAAG;CACvC,SAAS,OAAO;EACd,OAAQ,MAAgB,OAAO;EAC/B,QAAQ,KAAK,CAAC;CAChB;CAUA,MAAM,SAAS;EAPb;EACA,SAAS;EACT;EACA,YAAY,kBAAkB;EAC9B;CAGsB,CAAC;AAC3B"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../packages/create-warlock/src/commands/create-new-app/index.ts"],"sourcesContent":["import { cancel, confirm, isCancel, select } from \"@clack/prompts\";\nimport { colors } from \"@mongez/copper\";\nimport { getJsonFile } from \"@warlock.js/fs\";\nimport { resolveAgentTargets } from \"../../features/agent-kit-targets\";\nimport {\n getDatabaseDriver,\n getDatabaseDriverOptions,\n isNoDatabase,\n} from \"../../features/database-drivers\";\nimport {\n getAiPackageOptions,\n getAiProviderOptions,\n getAllFeatureKeys,\n} from \"../../features/features-map\";\nimport { assertFlagCombinations } from \"../../flags/assert-flag-combinations\";\nimport { assertPackageManagerAvailable } from \"../../flags/assert-package-manager\";\nimport { seedFromFlags } from \"../../flags/seed-from-flags\";\nimport { App } from \"../../helpers/app\";\nimport {\n detectPackageManagers,\n getPackageManager,\n getPreferredPackageManager,\n getSystemPackageManagers,\n setPackageManager,\n} from \"../../helpers/package-manager\";\nimport { packageRoot } from \"../../helpers/paths\";\nimport { hasInteractiveStdin } from \"../../helpers/tty\";\nimport { askAgentTargets } from \"../../prompts/ask-agent-targets\";\nimport { askAiFeatures } from \"../../prompts/ask-ai-features\";\nimport { askFeatures } from \"../../prompts/ask-features\";\nimport { askLintToolchain } from \"../../prompts/ask-lint-toolchain\";\nimport { askProjectName } from \"../../prompts/ask-project-name\";\nimport { askStack } from \"../../prompts/ask-stack\";\nimport { showIntroBanner } from \"../../ui/banner\";\nimport { createWarlockApp } from \"../create-warlock-app\";\nimport getAppPath from \"./get-app-path\";\nimport { AppOptions, App as AppType, CliFlags, SetupChoice, Stack } from \"./types\";\n\nexport default async function createNewApp(cli: CliFlags = {}) {\n // Start detecting package managers in the background to avoid delay later\n const pmDetectionPromise = detectPackageManagers();\n\n // Get version from package.json\n const packageJson: any = getJsonFile(packageRoot(\"package.json\"));\n const createWarlockVersion = packageJson.version;\n\n // Show the intro banner\n showIntroBanner(createWarlockVersion);\n\n console.log(colors.cyan(\"Let's create something magical! \\n\"));\n\n // Validate Node.js version (minimum 22.15: the warlock CLI uses module.registerHooks)\n const [major = 0, minor = 0] = process.versions.node.split(\".\").map(Number);\n if (major < 22 || (major === 22 && minor < 15)) {\n cancel(`Node.js 22.15.0 or newer is required (found ${process.versions.node}).`);\n process.exit(0);\n }\n\n // Refuse contradictory flag combinations LOUDLY, before anything else looks\n // at them — `--customize --yes` used to drop `--customize` without a word.\n assertFlagCombinations(cli);\n\n // Non-interactive path: build everything from flags and skip the prompts.\n //\n // Triggered by --yes, OR automatically the moment stdin has no TTY — CI, a\n // script, an agent harness. This check MUST run before the first prompt\n // call: attempting `text()`/`select()` on a non-TTY stdin does not fail\n // cleanly, it crashes with a libuv internal (\"TTY initialization failed:\n // uv_tty_init returned EBADF\") before any app directory exists, no matter\n // how the run was invoked.\n //\n // Prompting is the fallback, not the precondition: a project name is the\n // only answer with no sane default, so when a name is already available\n // (positional arg or --name) the run proceeds exactly as --yes would, TTY\n // or not. When the name is ALSO missing and there is no TTY to ask for one,\n // createNonInteractive fails loudly — naming --yes and every non-interactive\n // flag — instead of ever reaching a prompt. Every other prompt already has a\n // default; see resolveNonInteractiveOptions below for the full table.\n if (cli.yes || !hasInteractiveStdin()) {\n await createNonInteractive(cli);\n return;\n }\n\n // `--interactive` (alias `--customize`) restores the full long-form wizard\n // below. Everyone else with a TTY falls through to the default path, which\n // asks the preset plus database choice — see createDefaultInteractive.\n if (cli.interactive) {\n await createFullWizard(cli, pmDetectionPromise);\n return;\n }\n\n await createDefaultInteractive(cli, pmDetectionPromise);\n}\n\n/**\n * The full long-form wizard (`--interactive` / `--customize`): every prompt,\n * one after another. This is the ORIGINAL default flow, preserved verbatim —\n * only its trigger moved from \"any TTY\" to an explicit opt-in flag, per the\n * rule that a reversible choice never prompts by default.\n */\nasync function createFullWizard(cli: CliFlags, pmDetectionPromise: Promise<void>) {\n // Step 1: Project name — but only when it is not already known. It arrives\n // answered from `--name`/the positional arg, and from the default path when\n // the user picked \"Customize\" AFTER being asked for a name. Re-asking for an\n // answer we already hold is the double-prompt this branch exists to avoid.\n const appName = cli.name ?? (await askProjectName());\n\n const appPath = getAppPath(appName);\n if (!appPath) return;\n\n // A flag passed alongside --customize is an answer given early, not a\n // contradiction: it pre-selects the matching prompt instead of being\n // dropped. Validate the ones that CAN be wrong through the same function\n // the non-interactive path uses, so an unknown driver or feature key fails\n // here rather than showing a prompt that quietly ignores it.\n try {\n resolveNonInteractiveOptions(cli);\n } catch (error) {\n cancel((error as Error).message);\n process.exit(1);\n }\n\n const seeds = seedFromFlags(cli);\n\n // Step 2: Package Manager selection\n await pmDetectionPromise; // Ensure detection is complete\n\n // Only now can availability be judged: detection is what fills\n // getSystemPackageManagers(), and the prompt below is built from it.\n assertPackageManagerAvailable(cli.pm);\n\n const packageManager = await select({\n message: \"Which package manager do you want to use?\",\n options: getSystemPackageManagers().map((pm) => ({\n value: pm,\n label: pm,\n })),\n initialValue: seeds.packageManager,\n });\n\n if (isCancel(packageManager)) {\n cancel(\"Package manager selection cancelled\");\n process.exit(0);\n }\n\n setPackageManager(packageManager as string);\n\n const lint = await askLintToolchain(seeds.lint);\n if (isCancel(lint)) {\n cancel(\"Toolchain selection cancelled\");\n process.exit(0);\n }\n\n // Step 3: Database driver selection\n const databaseDriver = await select({\n message: \"Choose your database driver\",\n options: getDatabaseDriverOptions(),\n initialValue: seeds.databaseDriver,\n });\n\n if (isCancel(databaseDriver)) {\n cancel(\"Database selection cancelled\");\n process.exit(0);\n }\n\n const selectedDriver = getDatabaseDriver(databaseDriver as string);\n\n // Step 4: Edit optional features in paged groups.\n const selectedFeatures = await askFeatures(seeds.features);\n\n if (isCancel(selectedFeatures)) {\n cancel(\"Feature selection cancelled\");\n process.exit(0);\n }\n\n // Step 4b: AI providers + capability packages — selecting any pulls\n // @warlock.js/ai automatically. The result still flows through the\n // `selectedAiProviders` → `aiProviders` pipeline, which now also carries the\n // capability packages (ai-tools / ai-panoptic / ai-workspace).\n const selectedAiProviders = await askAiFeatures(seeds.aiProviders);\n\n if (isCancel(selectedAiProviders)) {\n cancel(\"AI provider selection cancelled\");\n process.exit(0);\n }\n\n // Step 5: Git initialization\n const useGit =\n (await confirm({\n message: \"Initialize a Git repository?\",\n initialValue: seeds.useGit,\n })) === true;\n\n if (isCancel(useGit)) {\n cancel(\"Setup cancelled\");\n process.exit(0);\n }\n\n // Step 6: JWT secret generation\n const useJWT =\n (await confirm({\n message: \"Generate JWT secret keys?\",\n initialValue: seeds.useJWT,\n })) === true;\n\n if (isCancel(useJWT)) {\n cancel(\"Setup cancelled\");\n process.exit(0);\n }\n\n // Step 7: agent-kit targets. Asked here rather than left to --agents,\n // because Customize means every choice is offered (owner ruling, seq 1028).\n // --agents pre-ticks the selection, like every other flag.\n const agents = await askAgentTargets(cli.agents);\n\n // Build app details\n const appDetails: Required<AppType> = {\n appName: appName,\n appType: \"warlock\",\n appPath: appPath,\n pkgManager: getPackageManager(),\n options: {\n databaseDriver: databaseDriver as string,\n databasePort: selectedDriver?.defaultPort || 27017,\n features: selectedFeatures as string[],\n aiProviders: selectedAiProviders as string[],\n useGit,\n useJWT,\n agents,\n lint,\n },\n };\n\n // Create the app\n await scaffold(appDetails);\n}\n\n/**\n * The default TTY path: neither `--yes` nor `--interactive` was given, but a\n * terminal is available. Asks the project name when missing (a required\n * answer with no sane default — same treatment as the non-interactive path)\n * plus the preset's database choice when `--db`/`--no-db` was not supplied.\n * Every other choice is resolved exactly like `createNonInteractive` — flags,\n * with defaults, never a prompt.\n */\nasync function createDefaultInteractive(cli: CliFlags, pmDetectionPromise: Promise<void>) {\n const appName = cli.name ?? (await askProjectName());\n\n const appPath = getAppPath(appName);\n if (!appPath) return;\n\n const choice: SetupChoice = cli.stack ?? (await askStack());\n\n // \"Customize\" is not a third stack — it is the wizard, chosen from the menu\n // instead of from a flag nobody was told about. Hand over the name we just\n // collected so the wizard starts at its SECOND question.\n if (choice === \"customize\") {\n await createFullWizard({ ...cli, name: appName }, pmDetectionPromise);\n return;\n }\n\n const stack: Stack = choice;\n\n await pmDetectionPromise;\n\n const packageManager = cli.pm ?? getPreferredPackageManager();\n\n assertPackageManagerAvailable(cli.pm);\n\n setPackageManager(packageManager);\n\n const databaseDriver =\n cli.db ??\n (await select({\n message: \"Choose your database driver\",\n options: getDatabaseDriverOptions(),\n initialValue: \"mongodb\",\n }));\n\n if (isCancel(databaseDriver)) {\n cancel(\"Database selection cancelled\");\n process.exit(0);\n }\n\n let options: AppOptions;\n\n try {\n options = await resolveAppOptions({ ...cli, stack, db: databaseDriver });\n } catch (error) {\n cancel((error as Error).message);\n process.exit(1);\n }\n\n const appDetails: Required<AppType> = {\n appName,\n appType: \"warlock\",\n appPath,\n pkgManager: getPackageManager(),\n options,\n };\n\n await scaffold(appDetails);\n}\n\n/**\n * Run the scaffold and make the process's exit code tell the truth: anything\n * the user asked for that did not happen leaves the shell with a non-zero\n * status, so scripts and CI cannot mistake a half-built project for a finished\n * one. The problems themselves are printed by the scaffolder.\n */\nasync function scaffold(appDetails: Required<AppType>) {\n const outcome = await createWarlockApp(new App(appDetails));\n\n if (outcome && !outcome.ok) {\n process.exitCode = 1;\n }\n}\n\n/** Everything {@link resolveNonInteractiveOptions} can resolve without the network. */\nexport type SyncAppOptions = Omit<AppOptions, \"agents\">;\n\n/**\n * Resolve every flag-or-default `AppOptions` field EXCEPT `agents` from parsed\n * CLI flags — applying the non-interactive defaults, validating the database\n * driver and feature/provider keys, and handling the `none` (no database)\n * selection. `agents` is resolved separately by {@link resolveAppOptions}\n * because it can require a network fetch; this function stays synchronous so\n * the rest of the flag → app mapping remains trivially unit-testable.\n *\n * `--stack=web` (or the equivalent wizard answer) seeds the `web` feature by\n * default — the one structural choice — but an explicit `--features` always\n * wins, so a user who spells out the feature list is never second-guessed.\n *\n * Throws on an unknown driver, feature, or AI key so the caller can fail fast\n * before any file is written.\n */\nexport function resolveNonInteractiveOptions(cli: CliFlags): SyncAppOptions {\n const lint = cli.lint ?? \"oxc\";\n if (lint !== \"eslint\" && lint !== \"oxc\") {\n throw new Error(`Unknown lint toolchain \"${lint}\". Use --lint=eslint or --lint=oxc.`);\n }\n const databaseDriver = cli.db ?? \"mongodb\";\n const noDatabase = isNoDatabase(databaseDriver);\n const driver = noDatabase ? undefined : getDatabaseDriver(databaseDriver);\n\n if (!noDatabase && !driver) {\n throw new Error(`Unknown database driver \"${databaseDriver}\"`);\n }\n\n const stack: Stack = cli.stack ?? \"api\";\n const features = cli.features ?? (stack === \"web\" ? [\"web\"] : []);\n const aiProviders = cli.ai ?? [];\n\n const allowedKeys = getAllFeatureKeys();\n const invalidFeatureKeys = features.filter((key) => !allowedKeys.includes(key));\n const errors: string[] = [];\n\n if (invalidFeatureKeys.length > 0) {\n errors.push(`Unknown feature(s): ${invalidFeatureKeys.join(\",\")}`);\n }\n\n const aiFeatureKeys = [...getAiProviderOptions(), ...getAiPackageOptions()].map(\n (option) => option.value,\n );\n const invalidAiKeys = aiProviders.filter((key) => !aiFeatureKeys.includes(key));\n\n if (invalidAiKeys.length > 0) {\n errors.push(\n `Unknown AI feature(s): ${invalidAiKeys.join(\",\")}. ` +\n `Valid AI choices: ${aiFeatureKeys.join(\", \")}`,\n );\n }\n\n if (errors.length > 0) {\n throw new Error(errors.join(\"\\n\"));\n }\n\n return {\n databaseDriver,\n databasePort: driver?.defaultPort ?? 27017,\n features,\n aiProviders,\n lint,\n useGit: cli.git ?? false,\n useJWT: cli.jwt ?? false,\n };\n}\n\n/**\n * Resolve the FULL `AppOptions` — {@link resolveNonInteractiveOptions} plus\n * the validated `agents` list. Async because a non-default `--agents`\n * selection may need {@link resolveAgentTargets}'s network fetch; the default\n * (`claude`) never does.\n */\nexport async function resolveAppOptions(cli: CliFlags): Promise<AppOptions> {\n const options = resolveNonInteractiveOptions(cli);\n const agents = await resolveAgentTargets(cli.agents);\n\n return { ...options, agents };\n}\n\n/**\n * Non-interactive scaffold path for `--yes`. Builds the app from flags with\n * sensible defaults and skips every prompt — a single command scaffolds the\n * entire app. Validation lives in `resolveNonInteractiveOptions`; a typo fails\n * fast here instead of mid-install.\n */\nasync function createNonInteractive(cli: CliFlags) {\n const appName = (cli.name ?? \"\").trim();\n\n if (!appName) {\n // Reached either because --yes was passed with no name, or because stdin\n // has no TTY to prompt for one — either way, nothing is left to fall back\n // to. Name --yes AND every non-interactive flag so a CI log is enough to\n // fix the invocation without hunting for docs.\n cancel(\n \"A project name is required and no terminal is available to ask for one. \" +\n \"Pass it as the first argument or --name=<name>. Non-interactive flags: \" +\n \"--yes, --pm=<npm|yarn|pnpm|bun>, --db=<driver>|--no-db, --features=<list>, \" +\n \"--ai=<list>, --lint=<oxc|eslint>, --git|--no-git, --jwt|--no-jwt.\",\n );\n process.exit(1);\n }\n\n const appPath = getAppPath(appName);\n\n if (!appPath) return;\n\n await detectPackageManagers();\n\n const packageManager = cli.pm ?? getPreferredPackageManager();\n\n assertPackageManagerAvailable(cli.pm);\n\n setPackageManager(packageManager);\n\n let options: AppOptions;\n\n try {\n options = await resolveAppOptions(cli);\n } catch (error) {\n cancel((error as Error).message);\n process.exit(1);\n }\n\n const appDetails: Required<AppType> = {\n appName,\n appType: \"warlock\",\n appPath,\n pkgManager: getPackageManager(),\n options,\n };\n\n await scaffold(appDetails);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsCA,eAA8B,aAAa,MAAgB,CAAC,GAAG;CAE7D,MAAM,qBAAqB,sBAAsB;CAIjD,MAAM,uBADm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IAAI;EACF,UAAU,MAAM,kBAAkB,GAAG;CACvC,SAAS,OAAO;EACd,OAAQ,MAAgB,OAAO;EAC/B,QAAQ,KAAK,CAAC;CAChB;CAUA,MAAM,SAAS;EAPb;EACA,SAAS;EACT;EACA,YAAY,kBAAkB;EAC9B;CAGsB,CAAC;AAC3B"}
@@ -1,26 +1,31 @@
1
1
  //#region ../../packages/create-warlock/src/commands/create-new-app/types.d.ts
2
2
  /** The one structural fork that changes the generated app's shape. */
3
- type Stack = "api" | "web";
3
+ export type Stack = "api" | "web";
4
4
  /**
5
5
  * Flags parsed from the command line for non-interactive scaffolding
6
6
  * (`create-warlock my-app --db=postgres --features=test,herald --ai=ai-openai --yes`).
7
7
  */
8
- type CliFlags = {
8
+ export type CliFlags = {
9
9
  yes?: boolean;
10
- name?: string; /** The one structural question the default path asks: API-only or full-stack web. */
10
+ name?: string;
11
+ /** The one structural question the default path asks: API-only or full-stack web. */
11
12
  stack?: Stack;
12
13
  db?: string;
13
14
  features?: string[];
14
15
  ai?: string[];
15
- pm?: string; /** `--lint=eslint|oxc`; validated before scaffolding. */
16
- lint?: string; /** `agent-kit` targets for `--agents`. Comma-separated on the CLI. */
16
+ pm?: string;
17
+ /** `--lint=eslint|oxc`; validated before scaffolding. */
18
+ lint?: string;
19
+ /** `agent-kit` targets for `--agents`. Comma-separated on the CLI. */
17
20
  agents?: string[];
18
21
  git?: boolean;
19
- jwt?: boolean; /** `--interactive` / `--customize` — restore the full long-form prompt flow. */
20
- interactive?: boolean; /** `-h` / `--help` — print usage and exit before any scaffolding runs. */
21
- help?: boolean; /** `-v` / `--version` — print the installed version and exit. */
22
+ jwt?: boolean;
23
+ /** `--interactive` / `--customize` — restore the full long-form prompt flow. */
24
+ interactive?: boolean;
25
+ /** `-h` / `--help` — print usage and exit before any scaffolding runs. */
26
+ help?: boolean;
27
+ /** `-v` / `--version` — print the installed version and exit. */
22
28
  version?: boolean;
23
29
  };
24
30
  //#endregion
25
- export { CliFlags };
26
31
  //# sourceMappingURL=types.d.mts.map
@@ -44,7 +44,7 @@ async function createWarlockApp(application) {
44
44
  });
45
45
  }
46
46
  templateSpinner.stop(spinnerMessages.templateCopied);
47
- showNotes(notes);
47
+ showNotes([...notes, ...options.lint === "eslint" ? ["Deprecated: ESLint + Prettier support will be removed in 5.34.0. Use --lint=oxc for new apps; migrate existing apps with npx warlock upgrade --from 5.32 --to 5.33.0. ESLint mode uses TypeScript 6.0.3 because typescript-eslint does not support TypeScript 7 yet."] : []]);
48
48
  const installSpinner = spinner();
49
49
  installSpinner.start(spinnerMessages.installingDeps);
50
50
  const baseInstall = application.install();
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../packages/create-warlock/src/commands/create-warlock-app/index.ts"],"sourcesContent":["import { getDatabaseLabel, isNoDatabase } from \"../../features/database-drivers\";\nimport { App } from \"../../helpers/app\";\nimport { CommandResult, takeLastCommandOutput } from \"../../helpers/exec\";\nimport { getPackageManager, runPackageManagerCommand } from \"../../helpers/package-manager\";\nimport { resolveWarlockVersions } from \"../../helpers/warlock-versions\";\nimport { printDecisionsSummary } from \"../../summary\";\nimport { showSuccessScreen } from \"../../ui/banner\";\nimport {\n failFatally,\n installFailureHints,\n Problem,\n showNotes,\n showPartialScreen,\n showProblems,\n} from \"../../ui/report\";\nimport { spinner } from \"../../ui/spinner\";\nimport { spinnerMessages } from \"../../ui/spinners\";\n\n/**\n * What the scaffold actually achieved. `ok` is false when ANY step the user\n * asked for did not happen; the caller turns that into a non-zero exit code so\n * a script never mistakes a half-built project for a finished one.\n */\nexport type ScaffoldOutcome = {\n ok: boolean;\n problems: Problem[];\n};\n\n/** One-line \"why did this fail\" pulled out of a captured command. */\nfunction reasonFrom(result: CommandResult | undefined): string {\n if (!result) return \"the command reported a failure (no output captured)\";\n\n if (result.error) {\n return result.error.message || String(result.error);\n }\n\n const lastLine = `${result.stderr}\\n${result.stdout}`\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .filter(Boolean)\n .pop();\n\n const status =\n result.code === null\n ? `killed by ${result.signal ?? \"an unknown signal\"}`\n : `exit code ${result.code}`;\n\n return lastLine ? `${status} — ${lastLine}` : status;\n}\n\nexport async function createWarlockApp(application: App): Promise<ScaffoldOutcome> {\n const options = application.options;\n const { useGit, useJWT, features, aiProviders, databaseDriver } = options;\n const noDatabase = isNoDatabase(databaseDriver);\n const problems: Problem[] = [];\n\n // Resolve the versions to pin BEFORE anything is written. The scaffolder's\n // own version is only used when the registry confirms it exists — see\n // helpers/warlock-versions.ts for why an unverified pin broke every install.\n const { versions, notes } = await resolveWarlockVersions();\n\n // Step 1: Initialize and copy template\n const templateSpinner = spinner();\n templateSpinner.start(spinnerMessages.copyingTemplate);\n\n try {\n application.init().use(\"warlock\").updatePackageJson(versions).updateDotEnv();\n\n // Wire the chosen database driver into .env — or, when the user opted out,\n // strip the database config entirely so the app boots with no database.\n if (noDatabase) {\n application.removeDatabaseConfig();\n } else {\n application.configureDatabaseEnv(databaseDriver);\n application.configureDatabaseConfig(databaseDriver);\n }\n\n application.configureWebStarter(features.includes(\"web\"));\n application.configureLintToolchain();\n application.configureAgentKitTargets(options.agents ?? [\"claude\"]);\n } catch (error) {\n templateSpinner.stop(spinnerMessages.templateFailed);\n\n failFatally({\n step: \"Template copy\",\n detail: `The project files could not be written: ${(error as Error).message}`,\n hints: [\n \"Check that the target directory is writable and that no file is locked by another process.\",\n ],\n });\n }\n\n templateSpinner.stop(spinnerMessages.templateCopied);\n\n showNotes(notes);\n\n // Step 2: Install base dependencies (so the `warlock` binary is available).\n // Nothing downstream works without this, so a failure ends the run — loudly,\n // with the command, its exit code and its output.\n const installSpinner = spinner();\n installSpinner.start(spinnerMessages.installingDeps);\n\n const baseInstall = application.install();\n const baseInstalled = await baseInstall.install;\n const baseInstallResult = await baseInstall.result;\n\n if (!baseInstalled) {\n installSpinner.stop(spinnerMessages.depsFailed);\n\n failFatally({\n step: \"Dependency install\",\n detail: \"The project's dependencies were not installed.\",\n result: baseInstallResult,\n hints: installFailureHints(baseInstallResult),\n });\n }\n\n installSpinner.stop(spinnerMessages.depsInstalled);\n\n // Step 3: Add features via `warlock add --no-install`, then one batched install.\n // The DB driver, optional features, and AI providers all go through the single\n // source of truth (core's feature map) so versions never drift. When no\n // database was chosen, the driver is omitted (there is no `none` feature).\n const selectedFeatures = [...(noDatabase ? [] : [databaseDriver]), ...features, ...aiProviders];\n\n // Features the user asked for that are not in the project when we finish.\n const failedFeatures: { feature: string; reason: string }[] = [];\n let featureDependencyInstallFailed = false;\n\n if (selectedFeatures.length > 0) {\n const featuresSpinner = spinner();\n featuresSpinner.start(spinnerMessages.addingFeatures);\n\n let addedFeatures = selectedFeatures;\n\n if (!(await application.installFeatures(selectedFeatures))) {\n // The batch is all-or-nothing, so it cannot say WHICH feature broke it.\n // Retry them one at a time: every feature that can be added still gets\n // added, and every one that cannot gets its own reason.\n const batchFailure = takeLastCommandOutput();\n\n addedFeatures = [];\n\n for (const feature of selectedFeatures) {\n if (await application.installFeatures([feature])) {\n addedFeatures.push(feature);\n } else {\n failedFeatures.push({\n feature,\n reason: reasonFrom(takeLastCommandOutput() ?? batchFailure),\n });\n }\n }\n }\n\n let featureInstall: CommandResult | undefined;\n\n if (addedFeatures.length > 0) {\n // `warlock add` records the feature dependencies but does not reconcile\n // them with each other. The `web` feature brings `vite` while the\n // template always brings `vitest`, whose own vite range resolves to a\n // different major — two copies, and yarn 1 aborts the whole link phase\n // on them. Pin one copy BEFORE the batched install, not after.\n application.pinViteResolution();\n application.approveSelectedFeatureBuilds(addedFeatures);\n\n const install = application.install();\n const installed = await install.install;\n\n featureInstall = await install.result;\n\n if (!installed) {\n // The dependencies were recorded but never fetched — the features are\n // not usable, so they are failures, not successes.\n const reason = `their packages were not installed (${reasonFrom(featureInstall)})`;\n\n for (const feature of addedFeatures) {\n failedFeatures.push({ feature, reason });\n }\n\n addedFeatures = [];\n featureDependencyInstallFailed = true;\n }\n }\n\n if (failedFeatures.length === 0) {\n featuresSpinner.stop(spinnerMessages.featuresAdded);\n } else {\n featuresSpinner.stop(\n addedFeatures.length > 0 ? spinnerMessages.featuresPartial : spinnerMessages.featuresFailed,\n );\n\n problems.push({\n step: \"Features\",\n detail: failedFeatures\n .map(({ feature, reason }) => `${feature}: ${reason}`)\n .join(\"\\n \"),\n result: featureInstall?.ok === false ? featureInstall : undefined,\n hints: [\n `Retry inside the project with: npx warlock add ${failedFeatures\n .map(({ feature }) => feature)\n .join(\" \")}`,\n ],\n });\n }\n }\n\n // Step 4: Initialize Git repository if requested\n if (useGit) {\n const gitSpinner = spinner();\n gitSpinner.start(spinnerMessages.initializingGit);\n\n const initialized = await application.git();\n\n gitSpinner.stop(initialized ? spinnerMessages.gitInitialized : spinnerMessages.gitFailed);\n\n if (!initialized) {\n const failure = takeLastCommandOutput();\n\n problems.push({\n step: \"Git repository\",\n detail: `The repository was not initialized: ${reasonFrom(failure)}`,\n result: failure,\n hints: [\n \"Check that git is installed and that user.name / user.email are configured, then run `git init` yourself.\",\n ],\n });\n }\n }\n\n // Step 5: Generate JWT or warm cache\n if (useJWT && featureDependencyInstallFailed) {\n problems.push({\n step: \"JWT secrets\",\n detail: \"Skipped because the selected feature dependencies did not install.\",\n hints: [\n `Install the failed feature dependencies, then run \\`${runPackageManagerCommand(\"jwt\")}\\` inside the project.`,\n ],\n });\n } else if (useJWT) {\n const jwtSpinner = spinner();\n jwtSpinner.start(spinnerMessages.generatingJwt);\n\n const command = runPackageManagerCommand(\"jwt\");\n const generated = await application.exec(command);\n\n jwtSpinner.stop(generated ? spinnerMessages.jwtGenerated : spinnerMessages.jwtFailed);\n\n if (!generated) {\n const failure = takeLastCommandOutput();\n\n problems.push({\n step: \"JWT secrets\",\n detail: `No JWT secrets were written to .env: ${reasonFrom(failure)}`,\n result: failure,\n hints: [`Run \\`${command}\\` inside the project before starting it.`],\n });\n }\n } else {\n // The warm cache is a start-up optimisation, not something the user asked\n // for: report it, but it does not make the scaffold a failure.\n const warmSpinner = spinner();\n warmSpinner.start(spinnerMessages.warmingCache);\n\n const warmed = await application.exec(\"npx warlock --warm-cache\");\n\n warmSpinner.stop(warmed ? spinnerMessages.cacheWarmed : spinnerMessages.cacheWarmFailed);\n\n if (!warmed) takeLastCommandOutput();\n }\n\n // Step 6: Report what actually happened — the summary may only advertise\n // features that are really in the project.\n const requestedFeatures = [...features, ...aiProviders];\n const missingFeatures = failedFeatures\n .map(({ feature }) => feature)\n .filter((feature) => requestedFeatures.includes(feature));\n const installedFeatures = requestedFeatures.filter(\n (feature) => !missingFeatures.includes(feature),\n );\n\n if (problems.length > 0) {\n showProblems(problems);\n\n showPartialScreen({\n projectName: application.name,\n database: getDatabaseLabel(databaseDriver),\n features: installedFeatures,\n missingFeatures,\n packageManager: getPackageManager(),\n });\n\n printDecisionsSummary({ packageManager: getPackageManager(), options });\n\n return { ok: false, problems };\n }\n\n showSuccessScreen({\n projectName: application.name,\n database: getDatabaseLabel(databaseDriver),\n features: installedFeatures,\n packageManager: getPackageManager(),\n });\n\n printDecisionsSummary({ packageManager: getPackageManager(), options });\n\n return { ok: true, problems };\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,SAAS,WAAW,QAA2C;CAC7D,IAAI,CAAC,QAAQ,OAAO;CAEpB,IAAI,OAAO,OACT,OAAO,OAAO,MAAM,WAAW,OAAO,OAAO,KAAK;CAGpD,MAAM,WAAW,GAAG,OAAO,OAAO,IAAI,OAAO,SAC1C,MAAM,OAAO,CAAC,CACd,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,OAAO,OAAO,CAAC,CACf,IAAI;CAEP,MAAM,SACJ,OAAO,SAAS,OACZ,aAAa,OAAO,UAAU,wBAC9B,aAAa,OAAO;CAE1B,OAAO,WAAW,GAAG,OAAO,KAAK,aAAa;AAChD;AAEA,eAAsB,iBAAiB,aAA4C;CACjF,MAAM,UAAU,YAAY;CAC5B,MAAM,EAAE,QAAQ,QAAQ,UAAU,aAAa,mBAAmB;CAClE,MAAM,aAAa,aA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,YAAY;GACzB,UAAU,iBAAiB,cAAc;GACzC,UAAU;GACV;GACA,gBAAgB,kBAAkB;EACpC,CAAC;EAED,sBAAsB;GAAE,gBAAgB,kBAAkB;GAAG;EAAQ,CAAC;EAEtE,OAAO;GAAE,IAAI;GAAO;EAAS;CAC/B;CAEA,kBAAkB;EAChB,aAAa,YAAY;EACzB,UAAU,iBAAiB,cAAc;EACzC,UAAU;EACV,gBAAgB,kBAAkB;CACpC,CAAC;CAED,sBAAsB;EAAE,gBAAgB,kBAAkB;EAAG;CAAQ,CAAC;CAEtE,OAAO;EAAE,IAAI;EAAM;CAAS;AAC9B"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../packages/create-warlock/src/commands/create-warlock-app/index.ts"],"sourcesContent":["import { getDatabaseLabel, isNoDatabase } from \"../../features/database-drivers\";\nimport { App } from \"../../helpers/app\";\nimport { CommandResult, takeLastCommandOutput } from \"../../helpers/exec\";\nimport { getPackageManager, runPackageManagerCommand } from \"../../helpers/package-manager\";\nimport { resolveWarlockVersions } from \"../../helpers/warlock-versions\";\nimport { printDecisionsSummary } from \"../../summary\";\nimport { showSuccessScreen } from \"../../ui/banner\";\nimport {\n failFatally,\n installFailureHints,\n Problem,\n showNotes,\n showPartialScreen,\n showProblems,\n} from \"../../ui/report\";\nimport { spinner } from \"../../ui/spinner\";\nimport { spinnerMessages } from \"../../ui/spinners\";\n\n/**\n * What the scaffold actually achieved. `ok` is false when ANY step the user\n * asked for did not happen; the caller turns that into a non-zero exit code so\n * a script never mistakes a half-built project for a finished one.\n */\nexport type ScaffoldOutcome = {\n ok: boolean;\n problems: Problem[];\n};\n\n/** One-line \"why did this fail\" pulled out of a captured command. */\nfunction reasonFrom(result: CommandResult | undefined): string {\n if (!result) return \"the command reported a failure (no output captured)\";\n\n if (result.error) {\n return result.error.message || String(result.error);\n }\n\n const lastLine = `${result.stderr}\\n${result.stdout}`\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .filter(Boolean)\n .pop();\n\n const status =\n result.code === null\n ? `killed by ${result.signal ?? \"an unknown signal\"}`\n : `exit code ${result.code}`;\n\n return lastLine ? `${status} — ${lastLine}` : status;\n}\n\nexport async function createWarlockApp(application: App): Promise<ScaffoldOutcome> {\n const options = application.options;\n const { useGit, useJWT, features, aiProviders, databaseDriver } = options;\n const noDatabase = isNoDatabase(databaseDriver);\n const problems: Problem[] = [];\n\n // Resolve the versions to pin BEFORE anything is written. The scaffolder's\n // own version is only used when the registry confirms it exists — see\n // helpers/warlock-versions.ts for why an unverified pin broke every install.\n const { versions, notes } = await resolveWarlockVersions();\n\n // Step 1: Initialize and copy template\n const templateSpinner = spinner();\n templateSpinner.start(spinnerMessages.copyingTemplate);\n\n try {\n application.init().use(\"warlock\").updatePackageJson(versions).updateDotEnv();\n\n // Wire the chosen database driver into .env — or, when the user opted out,\n // strip the database config entirely so the app boots with no database.\n if (noDatabase) {\n application.removeDatabaseConfig();\n } else {\n application.configureDatabaseEnv(databaseDriver);\n application.configureDatabaseConfig(databaseDriver);\n }\n\n application.configureWebStarter(features.includes(\"web\"));\n application.configureLintToolchain();\n application.configureAgentKitTargets(options.agents ?? [\"claude\"]);\n } catch (error) {\n templateSpinner.stop(spinnerMessages.templateFailed);\n\n failFatally({\n step: \"Template copy\",\n detail: `The project files could not be written: ${(error as Error).message}`,\n hints: [\n \"Check that the target directory is writable and that no file is locked by another process.\",\n ],\n });\n }\n\n templateSpinner.stop(spinnerMessages.templateCopied);\n\n showNotes([\n ...notes,\n ...(options.lint === \"eslint\"\n ? [\n \"Deprecated: ESLint + Prettier support will be removed in 5.34.0. Use --lint=oxc for new apps; migrate existing apps with npx warlock upgrade --from 5.32 --to 5.33.0. ESLint mode uses TypeScript 6.0.3 because typescript-eslint does not support TypeScript 7 yet.\",\n ]\n : []),\n ]);\n\n // Step 2: Install base dependencies (so the `warlock` binary is available).\n // Nothing downstream works without this, so a failure ends the run — loudly,\n // with the command, its exit code and its output.\n const installSpinner = spinner();\n installSpinner.start(spinnerMessages.installingDeps);\n\n const baseInstall = application.install();\n const baseInstalled = await baseInstall.install;\n const baseInstallResult = await baseInstall.result;\n\n if (!baseInstalled) {\n installSpinner.stop(spinnerMessages.depsFailed);\n\n failFatally({\n step: \"Dependency install\",\n detail: \"The project's dependencies were not installed.\",\n result: baseInstallResult,\n hints: installFailureHints(baseInstallResult),\n });\n }\n\n installSpinner.stop(spinnerMessages.depsInstalled);\n\n // Step 3: Add features via `warlock add --no-install`, then one batched install.\n // The DB driver, optional features, and AI providers all go through the single\n // source of truth (core's feature map) so versions never drift. When no\n // database was chosen, the driver is omitted (there is no `none` feature).\n const selectedFeatures = [...(noDatabase ? [] : [databaseDriver]), ...features, ...aiProviders];\n\n // Features the user asked for that are not in the project when we finish.\n const failedFeatures: { feature: string; reason: string }[] = [];\n let featureDependencyInstallFailed = false;\n\n if (selectedFeatures.length > 0) {\n const featuresSpinner = spinner();\n featuresSpinner.start(spinnerMessages.addingFeatures);\n\n let addedFeatures = selectedFeatures;\n\n if (!(await application.installFeatures(selectedFeatures))) {\n // The batch is all-or-nothing, so it cannot say WHICH feature broke it.\n // Retry them one at a time: every feature that can be added still gets\n // added, and every one that cannot gets its own reason.\n const batchFailure = takeLastCommandOutput();\n\n addedFeatures = [];\n\n for (const feature of selectedFeatures) {\n if (await application.installFeatures([feature])) {\n addedFeatures.push(feature);\n } else {\n failedFeatures.push({\n feature,\n reason: reasonFrom(takeLastCommandOutput() ?? batchFailure),\n });\n }\n }\n }\n\n let featureInstall: CommandResult | undefined;\n\n if (addedFeatures.length > 0) {\n // `warlock add` records the feature dependencies but does not reconcile\n // them with each other. The `web` feature brings `vite` while the\n // template always brings `vitest`, whose own vite range resolves to a\n // different major — two copies, and yarn 1 aborts the whole link phase\n // on them. Pin one copy BEFORE the batched install, not after.\n application.pinViteResolution();\n application.approveSelectedFeatureBuilds(addedFeatures);\n\n const install = application.install();\n const installed = await install.install;\n\n featureInstall = await install.result;\n\n if (!installed) {\n // The dependencies were recorded but never fetched — the features are\n // not usable, so they are failures, not successes.\n const reason = `their packages were not installed (${reasonFrom(featureInstall)})`;\n\n for (const feature of addedFeatures) {\n failedFeatures.push({ feature, reason });\n }\n\n addedFeatures = [];\n featureDependencyInstallFailed = true;\n }\n }\n\n if (failedFeatures.length === 0) {\n featuresSpinner.stop(spinnerMessages.featuresAdded);\n } else {\n featuresSpinner.stop(\n addedFeatures.length > 0 ? spinnerMessages.featuresPartial : spinnerMessages.featuresFailed,\n );\n\n problems.push({\n step: \"Features\",\n detail: failedFeatures\n .map(({ feature, reason }) => `${feature}: ${reason}`)\n .join(\"\\n \"),\n result: featureInstall?.ok === false ? featureInstall : undefined,\n hints: [\n `Retry inside the project with: npx warlock add ${failedFeatures\n .map(({ feature }) => feature)\n .join(\" \")}`,\n ],\n });\n }\n }\n\n // Step 4: Initialize Git repository if requested\n if (useGit) {\n const gitSpinner = spinner();\n gitSpinner.start(spinnerMessages.initializingGit);\n\n const initialized = await application.git();\n\n gitSpinner.stop(initialized ? spinnerMessages.gitInitialized : spinnerMessages.gitFailed);\n\n if (!initialized) {\n const failure = takeLastCommandOutput();\n\n problems.push({\n step: \"Git repository\",\n detail: `The repository was not initialized: ${reasonFrom(failure)}`,\n result: failure,\n hints: [\n \"Check that git is installed and that user.name / user.email are configured, then run `git init` yourself.\",\n ],\n });\n }\n }\n\n // Step 5: Generate JWT or warm cache\n if (useJWT && featureDependencyInstallFailed) {\n problems.push({\n step: \"JWT secrets\",\n detail: \"Skipped because the selected feature dependencies did not install.\",\n hints: [\n `Install the failed feature dependencies, then run \\`${runPackageManagerCommand(\"jwt\")}\\` inside the project.`,\n ],\n });\n } else if (useJWT) {\n const jwtSpinner = spinner();\n jwtSpinner.start(spinnerMessages.generatingJwt);\n\n const command = runPackageManagerCommand(\"jwt\");\n const generated = await application.exec(command);\n\n jwtSpinner.stop(generated ? spinnerMessages.jwtGenerated : spinnerMessages.jwtFailed);\n\n if (!generated) {\n const failure = takeLastCommandOutput();\n\n problems.push({\n step: \"JWT secrets\",\n detail: `No JWT secrets were written to .env: ${reasonFrom(failure)}`,\n result: failure,\n hints: [`Run \\`${command}\\` inside the project before starting it.`],\n });\n }\n } else {\n // The warm cache is a start-up optimisation, not something the user asked\n // for: report it, but it does not make the scaffold a failure.\n const warmSpinner = spinner();\n warmSpinner.start(spinnerMessages.warmingCache);\n\n const warmed = await application.exec(\"npx warlock --warm-cache\");\n\n warmSpinner.stop(warmed ? spinnerMessages.cacheWarmed : spinnerMessages.cacheWarmFailed);\n\n if (!warmed) takeLastCommandOutput();\n }\n\n // Step 6: Report what actually happened — the summary may only advertise\n // features that are really in the project.\n const requestedFeatures = [...features, ...aiProviders];\n const missingFeatures = failedFeatures\n .map(({ feature }) => feature)\n .filter((feature) => requestedFeatures.includes(feature));\n const installedFeatures = requestedFeatures.filter(\n (feature) => !missingFeatures.includes(feature),\n );\n\n if (problems.length > 0) {\n showProblems(problems);\n\n showPartialScreen({\n projectName: application.name,\n database: getDatabaseLabel(databaseDriver),\n features: installedFeatures,\n missingFeatures,\n packageManager: getPackageManager(),\n });\n\n printDecisionsSummary({ packageManager: getPackageManager(), options });\n\n return { ok: false, problems };\n }\n\n showSuccessScreen({\n projectName: application.name,\n database: getDatabaseLabel(databaseDriver),\n features: installedFeatures,\n packageManager: getPackageManager(),\n });\n\n printDecisionsSummary({ packageManager: getPackageManager(), options });\n\n return { ok: true, problems };\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,SAAS,WAAW,QAA2C;CAC7D,IAAI,CAAC,QAAQ,OAAO;CAEpB,IAAI,OAAO,OACT,OAAO,OAAO,MAAM,WAAW,OAAO,OAAO,KAAK;CAGpD,MAAM,WAAW,GAAG,OAAO,OAAO,IAAI,OAAO,SAC1C,MAAM,OAAO,CAAC,CACd,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,OAAO,OAAO,CAAC,CACf,IAAI;CAEP,MAAM,SACJ,OAAO,SAAS,OACZ,aAAa,OAAO,UAAU,wBAC9B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AAW;CACtD,MAAM,kBAAkB,eACrB,KAAK,EAAE,cAAc,OAAO,CAAC,CAC7B,QAAQ,YAAY,kBAAkB,SAAS,OAAO,CAAC;CAC1D,MAAM,oBAAoB,kBAAkB,QACzC,YAAY,CAAC,gBAAgB,SAAS,OAAO,CAChD;CAEA,IAAI,SAAS,SAAS,GAAG;EACvB,aAAa,QAAQ;EAErB,kBAAkB;GAChB,aAAa,YAAY;GACzB,UAAU,iBAAiB,cAAc;GACzC,UAAU;GACV;GACA,gBAAgB,kBAAkB;EACpC,CAAC;EAED,sBAAsB;GAAE,gBAAgB,kBAAkB;GAAG;EAAQ,CAAC;EAEtE,OAAO;GAAE,IAAI;GAAO;EAAS;CAC/B;CAEA,kBAAkB;EAChB,aAAa,YAAY;EACzB,UAAU,iBAAiB,cAAc;EACzC,UAAU;EACV,gBAAgB,kBAAkB;CACpC,CAAC;CAED,sBAAsB;EAAE,gBAAgB,kBAAkB;EAAG;CAAQ,CAAC;CAEtE,OAAO;EAAE,IAAI;EAAM;CAAS;AAC9B"}
@@ -161,5 +161,5 @@ async function resolveAgentTargets(requested, fetchImpl = fetch) {
161
161
  }
162
162
 
163
163
  //#endregion
164
- export { BUILTIN_AGENT_KIT_TARGETS, DEFAULT_AGENT_KIT_TARGET, getValidAgentKitTargets, resolveAgentTargets };
164
+ export { AGENT_KIT_FETCH_TIMEOUT_MS, BUILTIN_AGENT_KIT_TARGETS, DEFAULT_AGENT_KIT_TARGET, fetchRemoteAgentKitTargets, getValidAgentKitTargets, resolveAgentTargets, withTimeout };
165
165
  //# sourceMappingURL=agent-kit-targets.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-kit-targets.mjs","names":[],"sources":["../../../../../../../packages/create-warlock/src/features/agent-kit-targets.ts"],"sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { homedir, tmpdir } from \"node:os\";\nimport path from \"node:path\";\n\nconst requireFromHere = createRequire(import.meta.url);\n\n/**\n * `agent-kit` target selection for the scaffolder's `--agents` flag.\n *\n * The valid target list is NOT hardcoded here as a literal source of truth —\n * it is derived, in order of preference, from:\n *\n * 1. The `@mongez/agent-kit` package installed alongside `create-warlock`\n * itself, when its own metadata exposes a target list.\n * 2. A runtime fetch of https://mongez.js.org/agent-kit/llms.txt, cached\n * locally so repeated runs do not refetch.\n *\n * The one exception is `claude`, the default target: it MUST work fully\n * offline, so it is a tiny built-in fallback rather than something that ever\n * depends on a successful network call.\n */\n\n/** The only target guaranteed valid with no network access and no cache. */\nexport const BUILTIN_AGENT_KIT_TARGETS: readonly string[] = [\"claude\"];\n\n/** The default `--agents` value when the flag is not passed. */\nexport const DEFAULT_AGENT_KIT_TARGET = \"claude\";\n\nconst AGENT_KIT_LLMS_URL = \"https://mongez.js.org/agent-kit/llms.txt\";\n\n/**\n * How long the whole remote lookup may take.\n *\n * An unbounded `fetch` does not fail on a stalled network — it WAITS, and a\n * caller that only handles rejection never gets to run its fallback. The\n * scaffolder's wizard asks this question six answers in, so \"hangs forever\"\n * is strictly worse than \"gives up and offers the built-ins\".\n *\n * Each request carries an abort signal so the socket is actually torn down,\n * and {@link getValidAgentKitTargets} additionally races the whole operation,\n * because an injected `fetchImpl` is under no obligation to honour a signal.\n */\nexport const AGENT_KIT_FETCH_TIMEOUT_MS = 5_000;\n\n/** Local cache of the last successfully fetched/derived target list. */\nfunction cacheFilePath(): string {\n const base = process.env.XDG_CACHE_HOME ?? path.join(homedir(), \".cache\");\n return path.join(base, \"create-warlock\", \"agent-kit-targets.json\");\n}\n\nfunction readCache(): string[] | undefined {\n try {\n const raw = readFileSync(cacheFilePath(), \"utf8\");\n const parsed = JSON.parse(raw) as { targets?: unknown };\n if (Array.isArray(parsed.targets)) {\n return parsed.targets.filter((value): value is string => typeof value === \"string\");\n }\n return undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction writeCache(targets: string[]): void {\n try {\n const filePath = cacheFilePath();\n mkdirSync(path.dirname(filePath), { recursive: true });\n writeFileSync(\n filePath,\n JSON.stringify({ targets, fetchedAt: new Date().toISOString() }),\n \"utf8\",\n );\n } catch {\n // The cache is a best-effort convenience — a read-only filesystem must\n // never turn a successful fetch into a failed run.\n }\n}\n\n/**\n * Best-effort read of the installed `@mongez/agent-kit` package's own\n * declared target list, when it publishes one. Returns `undefined` (never\n * throws) when the package is not installed or exposes no such metadata —\n * the caller falls back to the network source.\n */\nfunction readInstalledPackageTargets(): string[] | undefined {\n for (const base of [process.cwd(), tmpdir()]) {\n try {\n const packageJsonPath = requireFromHere.resolve(\"@mongez/agent-kit/package.json\", {\n paths: [base],\n });\n const pkg = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as {\n agentKit?: { targets?: unknown };\n };\n if (Array.isArray(pkg.agentKit?.targets)) {\n return pkg.agentKit.targets.filter((value): value is string => typeof value === \"string\");\n }\n } catch {\n // Not installed, or no metadata — try the next base / fall through.\n }\n }\n return undefined;\n}\n\n/**\n * Pull the agent-integrations doc's raw `--target <slug>` occurrences out of\n * `agent-kit`'s own llms.txt index (following the link it documents for\n * itself), so the concrete slug list is parsed from the source rather than\n * retyped here.\n */\nexport async function fetchRemoteAgentKitTargets(\n fetchImpl: typeof fetch = fetch,\n timeoutMs: number = AGENT_KIT_FETCH_TIMEOUT_MS,\n): Promise<string[]> {\n const indexResponse = await fetchImpl(AGENT_KIT_LLMS_URL, {\n signal: AbortSignal.timeout(timeoutMs),\n });\n if (!indexResponse.ok) {\n throw new Error(`agent-kit llms.txt request failed with HTTP ${indexResponse.status}`);\n }\n const index = await indexResponse.text();\n\n const rawLinkMatch = index.match(\n /\\[Agent integrations\\]\\((https:\\/\\/[^)]+agent-integrations[^)]*)\\)/,\n );\n\n const docUrl = rawLinkMatch?.[1]\n ?.replace(\"github.com\", \"raw.githubusercontent.com\")\n .replace(\"/blob/\", \"/\");\n\n const targets = new Set<string>();\n\n if (docUrl) {\n const docResponse = await fetchImpl(docUrl, {\n signal: AbortSignal.timeout(timeoutMs),\n });\n if (docResponse.ok) {\n const doc = await docResponse.text();\n for (const match of doc.matchAll(/--target[= ]([a-z][a-z0-9-]*)/gi)) {\n const target = match[1];\n\n if (target) targets.add(target.toLowerCase());\n }\n }\n }\n\n if (targets.size === 0) {\n throw new Error(\"Could not parse any agent-kit target names out of the fetched docs\");\n }\n\n return [...targets];\n}\n\n/**\n * Resolve the full list of valid `agent-kit` targets, trying the installed\n * package first, then the cache-backed network fetch.\n *\n * Throws when neither source succeeds — the caller only reaches this for an\n * explicitly requested NON-default target, where a silent fallback to a\n * stale or guessed list would be worse than a clear failure.\n */\nexport async function getValidAgentKitTargets(\n fetchImpl: typeof fetch = fetch,\n timeoutMs: number = AGENT_KIT_FETCH_TIMEOUT_MS,\n): Promise<string[]> {\n const installed = readInstalledPackageTargets();\n if (installed && installed.length > 0) {\n return dedupe([...BUILTIN_AGENT_KIT_TARGETS, ...installed]);\n }\n\n try {\n const fetched = await withTimeout(fetchRemoteAgentKitTargets(fetchImpl, timeoutMs), timeoutMs);\n writeCache(fetched);\n return dedupe([...BUILTIN_AGENT_KIT_TARGETS, ...fetched]);\n } catch (fetchError) {\n const cached = readCache();\n if (cached && cached.length > 0) {\n return dedupe([...BUILTIN_AGENT_KIT_TARGETS, ...cached]);\n }\n throw new Error(\n `Could not determine the valid agent-kit targets (fetch failed and no cache exists): ${\n (fetchError as Error).message\n }`,\n );\n }\n}\n\n/**\n * Reject if `work` has not settled within `timeoutMs`.\n *\n * The abort signals on each request cover the real network; this covers the\n * case they cannot — a `fetchImpl` that ignores its signal, or a promise that\n * simply never settles. Without it \"bounded\" would be a property of the\n * happy path only.\n */\nexport async function withTimeout<T>(work: Promise<T>, timeoutMs: number): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n try {\n return await Promise.race([\n work,\n new Promise<never>((_resolve, reject) => {\n timer = setTimeout(\n () => reject(new Error(`agent-kit target lookup timed out after ${timeoutMs}ms`)),\n timeoutMs,\n );\n }),\n ]);\n } finally {\n if (timer) clearTimeout(timer);\n }\n}\n\nfunction dedupe(values: string[]): string[] {\n return [...new Set(values)];\n}\n\n/**\n * Resolve and validate the `--agents` selection.\n *\n * An unset or empty selection resolves to `[DEFAULT_AGENT_KIT_TARGET]`\n * without touching the disk or the network. A selection made entirely of\n * built-in targets (today, just `claude`) is likewise resolved offline. Only\n * an explicit NON-default target triggers {@link getValidAgentKitTargets},\n * and an invalid one throws, naming every valid target it found.\n */\nexport async function resolveAgentTargets(\n requested: string[] | undefined,\n fetchImpl: typeof fetch = fetch,\n): Promise<string[]> {\n const targets = requested && requested.length > 0 ? requested : [DEFAULT_AGENT_KIT_TARGET];\n\n const needsValidation = targets.some((target) => !BUILTIN_AGENT_KIT_TARGETS.includes(target));\n\n if (!needsValidation) {\n return targets;\n }\n\n const valid = await getValidAgentKitTargets(fetchImpl);\n const invalid = targets.filter((target) => !valid.includes(target));\n\n if (invalid.length > 0) {\n throw new Error(\n `Unknown agent-kit target(s): ${invalid.join(\", \")} — valid targets: ${valid\n .slice()\n .sort()\n .join(\", \")}`,\n );\n }\n\n return targets;\n}\n"],"mappings":";;;;;;AAKA,MAAM,kBAAkB,cAAc,OAAO,KAAK,GAAG;;;;;;;;;;;;;;;;;AAmBrD,MAAa,4BAA+C,CAAC,QAAQ;;AAGrE,MAAa,2BAA2B;AAExC,MAAM,qBAAqB;;;;;;;;;;;;;AAc3B,MAAa,6BAA6B;;AAG1C,SAAS,gBAAwB;CAC/B,MAAM,OAAO,QAAQ,IAAI,kBAAkB,KAAK,KAAK,QAAQ,GAAG,QAAQ;CACxE,OAAO,KAAK,KAAK,MAAM,kBAAkB,wBAAwB;AACnE;AAEA,SAAS,YAAkC;CACzC,IAAI;EACF,MAAM,MAAM,aAAa,cAAc,GAAG,MAAM;EAChD,MAAM,SAAS,KAAK,MAAM,GAAG;EAC7B,IAAI,MAAM,QAAQ,OAAO,OAAO,GAC9B,OAAO,OAAO,QAAQ,QAAQ,UAA2B,OAAO,UAAU,QAAQ;EAE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BAA0B,SAAS,MAAM,CAExE,GACjB,OAAO;CAGT,MAAM,QAAQ,MAAM,wBAAwB,SAAS;CACrD,MAAM,UAAU,QAAQ,QAAQ,WAAW,CAAC,MAAM,SAAS,MAAM,CAAC;CAElE,IAAI,QAAQ,SAAS,GACnB,MAAM,IAAI,MACR,gCAAgC,QAAQ,KAAK,IAAI,EAAE,oBAAoB,MACpE,MAAM,CAAC,CACP,KAAK,CAAC,CACN,KAAK,IAAI,GACd;CAGF,OAAO;AACT"}
1
+ {"version":3,"file":"agent-kit-targets.mjs","names":[],"sources":["../../../../../../../packages/create-warlock/src/features/agent-kit-targets.ts"],"sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { homedir, tmpdir } from \"node:os\";\nimport path from \"node:path\";\n\nconst requireFromHere = createRequire(import.meta.url);\n\n/**\n * `agent-kit` target selection for the scaffolder's `--agents` flag.\n *\n * The valid target list is NOT hardcoded here as a literal source of truth —\n * it is derived, in order of preference, from:\n *\n * 1. The `@mongez/agent-kit` package installed alongside `create-warlock`\n * itself, when its own metadata exposes a target list.\n * 2. A runtime fetch of https://mongez.js.org/agent-kit/llms.txt, cached\n * locally so repeated runs do not refetch.\n *\n * The one exception is `claude`, the default target: it MUST work fully\n * offline, so it is a tiny built-in fallback rather than something that ever\n * depends on a successful network call.\n */\n\n/** The only target guaranteed valid with no network access and no cache. */\nexport const BUILTIN_AGENT_KIT_TARGETS: readonly string[] = [\"claude\"];\n\n/** The default `--agents` value when the flag is not passed. */\nexport const DEFAULT_AGENT_KIT_TARGET = \"claude\";\n\nconst AGENT_KIT_LLMS_URL = \"https://mongez.js.org/agent-kit/llms.txt\";\n\n/**\n * How long the whole remote lookup may take.\n *\n * An unbounded `fetch` does not fail on a stalled network — it WAITS, and a\n * caller that only handles rejection never gets to run its fallback. The\n * scaffolder's wizard asks this question six answers in, so \"hangs forever\"\n * is strictly worse than \"gives up and offers the built-ins\".\n *\n * Each request carries an abort signal so the socket is actually torn down,\n * and {@link getValidAgentKitTargets} additionally races the whole operation,\n * because an injected `fetchImpl` is under no obligation to honour a signal.\n */\nexport const AGENT_KIT_FETCH_TIMEOUT_MS = 5_000;\n\n/** Local cache of the last successfully fetched/derived target list. */\nfunction cacheFilePath(): string {\n const base = process.env.XDG_CACHE_HOME ?? path.join(homedir(), \".cache\");\n return path.join(base, \"create-warlock\", \"agent-kit-targets.json\");\n}\n\nfunction readCache(): string[] | undefined {\n try {\n const raw = readFileSync(cacheFilePath(), \"utf8\");\n const parsed = JSON.parse(raw) as { targets?: unknown };\n if (Array.isArray(parsed.targets)) {\n return parsed.targets.filter((value): value is string => typeof value === \"string\");\n }\n return undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction writeCache(targets: string[]): void {\n try {\n const filePath = cacheFilePath();\n mkdirSync(path.dirname(filePath), { recursive: true });\n writeFileSync(\n filePath,\n JSON.stringify({ targets, fetchedAt: new Date().toISOString() }),\n \"utf8\",\n );\n } catch {\n // The cache is a best-effort convenience — a read-only filesystem must\n // never turn a successful fetch into a failed run.\n }\n}\n\n/**\n * Best-effort read of the installed `@mongez/agent-kit` package's own\n * declared target list, when it publishes one. Returns `undefined` (never\n * throws) when the package is not installed or exposes no such metadata —\n * the caller falls back to the network source.\n */\nfunction readInstalledPackageTargets(): string[] | undefined {\n for (const base of [process.cwd(), tmpdir()]) {\n try {\n const packageJsonPath = requireFromHere.resolve(\"@mongez/agent-kit/package.json\", {\n paths: [base],\n });\n const pkg = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as {\n agentKit?: { targets?: unknown };\n };\n if (Array.isArray(pkg.agentKit?.targets)) {\n return pkg.agentKit.targets.filter((value): value is string => typeof value === \"string\");\n }\n } catch {\n // Not installed, or no metadata — try the next base / fall through.\n }\n }\n return undefined;\n}\n\n/**\n * Pull the agent-integrations doc's raw `--target <slug>` occurrences out of\n * `agent-kit`'s own llms.txt index (following the link it documents for\n * itself), so the concrete slug list is parsed from the source rather than\n * retyped here.\n */\nexport async function fetchRemoteAgentKitTargets(\n fetchImpl: typeof fetch = fetch,\n timeoutMs: number = AGENT_KIT_FETCH_TIMEOUT_MS,\n): Promise<string[]> {\n const indexResponse = await fetchImpl(AGENT_KIT_LLMS_URL, {\n signal: AbortSignal.timeout(timeoutMs),\n });\n if (!indexResponse.ok) {\n throw new Error(`agent-kit llms.txt request failed with HTTP ${indexResponse.status}`);\n }\n const index = await indexResponse.text();\n\n const rawLinkMatch = index.match(\n /\\[Agent integrations\\]\\((https:\\/\\/[^)]+agent-integrations[^)]*)\\)/,\n );\n\n const docUrl = rawLinkMatch?.[1]\n ?.replace(\"github.com\", \"raw.githubusercontent.com\")\n .replace(\"/blob/\", \"/\");\n\n const targets = new Set<string>();\n\n if (docUrl) {\n const docResponse = await fetchImpl(docUrl, {\n signal: AbortSignal.timeout(timeoutMs),\n });\n if (docResponse.ok) {\n const doc = await docResponse.text();\n for (const match of doc.matchAll(/--target[= ]([a-z][a-z0-9-]*)/gi)) {\n const target = match[1];\n\n if (target) targets.add(target.toLowerCase());\n }\n }\n }\n\n if (targets.size === 0) {\n throw new Error(\"Could not parse any agent-kit target names out of the fetched docs\");\n }\n\n return [...targets];\n}\n\n/**\n * Resolve the full list of valid `agent-kit` targets, trying the installed\n * package first, then the cache-backed network fetch.\n *\n * Throws when neither source succeeds — the caller only reaches this for an\n * explicitly requested NON-default target, where a silent fallback to a\n * stale or guessed list would be worse than a clear failure.\n */\nexport async function getValidAgentKitTargets(\n fetchImpl: typeof fetch = fetch,\n timeoutMs: number = AGENT_KIT_FETCH_TIMEOUT_MS,\n): Promise<string[]> {\n const installed = readInstalledPackageTargets();\n if (installed && installed.length > 0) {\n return dedupe([...BUILTIN_AGENT_KIT_TARGETS, ...installed]);\n }\n\n try {\n const fetched = await withTimeout(fetchRemoteAgentKitTargets(fetchImpl, timeoutMs), timeoutMs);\n writeCache(fetched);\n return dedupe([...BUILTIN_AGENT_KIT_TARGETS, ...fetched]);\n } catch (fetchError) {\n const cached = readCache();\n if (cached && cached.length > 0) {\n return dedupe([...BUILTIN_AGENT_KIT_TARGETS, ...cached]);\n }\n throw new Error(\n `Could not determine the valid agent-kit targets (fetch failed and no cache exists): ${\n (fetchError as Error).message\n }`,\n );\n }\n}\n\n/**\n * Reject if `work` has not settled within `timeoutMs`.\n *\n * The abort signals on each request cover the real network; this covers the\n * case they cannot — a `fetchImpl` that ignores its signal, or a promise that\n * simply never settles. Without it \"bounded\" would be a property of the\n * happy path only.\n */\nexport async function withTimeout<T>(work: Promise<T>, timeoutMs: number): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n try {\n return await Promise.race([\n work,\n new Promise<never>((_resolve, reject) => {\n timer = setTimeout(\n () => reject(new Error(`agent-kit target lookup timed out after ${timeoutMs}ms`)),\n timeoutMs,\n );\n }),\n ]);\n } finally {\n if (timer) clearTimeout(timer);\n }\n}\n\nfunction dedupe(values: string[]): string[] {\n return [...new Set(values)];\n}\n\n/**\n * Resolve and validate the `--agents` selection.\n *\n * An unset or empty selection resolves to `[DEFAULT_AGENT_KIT_TARGET]`\n * without touching the disk or the network. A selection made entirely of\n * built-in targets (today, just `claude`) is likewise resolved offline. Only\n * an explicit NON-default target triggers {@link getValidAgentKitTargets},\n * and an invalid one throws, naming every valid target it found.\n */\nexport async function resolveAgentTargets(\n requested: string[] | undefined,\n fetchImpl: typeof fetch = fetch,\n): Promise<string[]> {\n const targets = requested && requested.length > 0 ? requested : [DEFAULT_AGENT_KIT_TARGET];\n\n const needsValidation = targets.some((target) => !BUILTIN_AGENT_KIT_TARGETS.includes(target));\n\n if (!needsValidation) {\n return targets;\n }\n\n const valid = await getValidAgentKitTargets(fetchImpl);\n const invalid = targets.filter((target) => !valid.includes(target));\n\n if (invalid.length > 0) {\n throw new Error(\n `Unknown agent-kit target(s): ${invalid.join(\", \")} — valid targets: ${valid\n .slice()\n .sort()\n .join(\", \")}`,\n );\n }\n\n return targets;\n}\n"],"mappings":";;;;;;AAKA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AACF;;;;;;;;;AAUA,eAAsB,YAAe,MAAkB,WAA+B;CACpF,IAAI;CAEJ,IAAI;EACF,OAAO,MAAM,QAAQ,KAAK,CACxB,MACA,IAAI,SAAgB,UAAU,WAAW;GACvC,QAAQ,iBACA,uBAAO,IAAI,MAAM,2CAA2C,UAAU,GAAG,CAAC,GAChF,SACF;EACF,CAAC,CACH,CAAC;CACH,UAAU;EACR,IAAI,OAAO,aAAa,KAAK;CAC/B;AACF;AAEA,SAAS,OAAO,QAA4B;CAC1C,OAAO,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC;AAC5B;;;;;;;;;;AAWA,eAAsB,oBACpB,WACA,YAA0B,OACP;CACnB,MAAM,UAAU,aAAa,UAAU,SAAS,IAAI,YAAY,CAAC,wBAAwB;CAIzF,IAAI,CAFoB,QAAQ,MAAM,WAAW,CAAC,0BAA0B,SAAS,MAAM,CAExE,GACjB,OAAO;CAGT,MAAM,QAAQ,MAAM,wBAAwB,SAAS;CACrD,MAAM,UAAU,QAAQ,QAAQ,WAAW,CAAC,MAAM,SAAS,MAAM,CAAC;CAElE,IAAI,QAAQ,SAAS,GACnB,MAAM,IAAI,MACR,gCAAgC,QAAQ,KAAK,IAAI,EAAE,oBAAoB,MACpE,MAAM,CAAC,CACP,KAAK,CAAC,CACN,KAAK,IAAI,GACd;CAGF,OAAO;AACT"}
@@ -74,5 +74,5 @@ function getDatabaseLabel(value) {
74
74
  }
75
75
 
76
76
  //#endregion
77
- export { NO_DATABASE, getDatabaseDriver, getDatabaseDriverOptions, getDatabaseLabel, isNoDatabase };
77
+ export { NO_DATABASE, databaseDrivers, getDatabaseDriver, getDatabaseDriverOptions, getDatabaseLabel, isNoDatabase };
78
78
  //# sourceMappingURL=database-drivers.mjs.map
@@ -249,5 +249,5 @@ function getFeatureGroups() {
249
249
  }
250
250
 
251
251
  //#endregion
252
- export { getAiPackageOptions, getAiProviderOptions, getAllFeatureKeys, getDefaultFeatureKeys, getFeatureGroups };
252
+ export { aiPackages, aiProviders, features, getAiPackageOptions, getAiProviderOptions, getAllFeatureKeys, getDefaultFeatureKeys, getFeatureGroups };
253
253
  //# sourceMappingURL=features-map.mjs.map
@@ -40,5 +40,5 @@ function assertPackageManagerAvailable(requested) {
40
40
  }
41
41
 
42
42
  //#endregion
43
- export { assertPackageManagerAvailable };
43
+ export { assertPackageManagerAllowed, assertPackageManagerAvailable };
44
44
  //# sourceMappingURL=assert-package-manager.mjs.map
@@ -35,8 +35,8 @@ const FLAG_DEFINITIONS = [
35
35
  },
36
36
  {
37
37
  usage: "--lint=<oxc|eslint>",
38
- description: "Linter and formatter: Oxlint/Oxfmt or ESLint/Prettier",
39
- defaultValue: "eslint"
38
+ description: "Linter and formatter: Oxlint/Oxfmt or ESLint/Prettier (deprecated; removed in 5.34.0)",
39
+ defaultValue: "oxc"
40
40
  },
41
41
  {
42
42
  usage: "--agents=<list>",
@@ -93,5 +93,5 @@ ${FLAG_DEFINITIONS.map(({ usage, description, defaultValue }) => {
93
93
  }
94
94
 
95
95
  //#endregion
96
- export { buildHelpText };
96
+ export { FLAG_DEFINITIONS, buildHelpText };
97
97
  //# sourceMappingURL=definitions.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.mjs","names":[],"sources":["../../../../../../../packages/create-warlock/src/flags/definitions.ts"],"sourcesContent":["import { getAiPackageOptions, getAiProviderOptions } from \"../features/features-map\";\n\n/**\n * Single source of truth for every CLI flag's help text and default, so\n * `--help` can never drift out of sync with what the parser actually\n * understands (requirement: `--help` lists every flag together with its\n * default value).\n */\nexport type FlagDefinition = {\n /** How the flag reads on the command line, e.g. `--db=<driver>`. */\n usage: string;\n description: string;\n /** Human-readable default, or what happens when it is left unanswered. */\n defaultValue: string;\n};\n\nconst AI_FEATURE_KEYS = [...getAiProviderOptions(), ...getAiPackageOptions()].map(\n ({ value }) => value,\n);\n\nexport const FLAG_DEFINITIONS: FlagDefinition[] = [\n {\n usage: \"--name=<name>\",\n description: \"Project name (or pass it as the first positional arg)\",\n defaultValue: \"required — prompted if a TTY is available, otherwise fails naming this flag\",\n },\n {\n usage: \"--stack=<api|web>\",\n description:\n \"API-only or full-stack web — the one structural choice that changes the app's shape. Customizing everything else is a flow, not a stack: use --customize, where --stack=web arrives as a pre-ticked web feature\",\n defaultValue: \"api\",\n },\n {\n usage: \"--db=<driver> / --no-db\",\n description: \"Database driver (e.g. postgres, mongodb), or skip a database entirely\",\n defaultValue: \"mongodb\",\n },\n {\n usage: \"--features=<list>\",\n description: \"Comma-separated feature keys (e.g. test,herald)\",\n defaultValue: 'none (or [\"web\"] when --stack=web and --features is not given)',\n },\n {\n usage: \"--ai=<list>\",\n description: `Comma-separated AI provider or capability keys (${AI_FEATURE_KEYS.join(\", \")})`,\n defaultValue: \"none\",\n },\n {\n usage: \"--pm=<manager>\",\n description: \"Package manager to use (npm, yarn, pnpm, bun)\",\n defaultValue: \"inferred from the invoking agent (npm_config_user_agent) or the system\",\n },\n {\n usage: \"--lint=<oxc|eslint>\",\n description: \"Linter and formatter: Oxlint/Oxfmt or ESLint/Prettier\",\n defaultValue: \"eslint\",\n },\n {\n usage: \"--agents=<list>\",\n description: \"Comma-separated agent-kit targets to derive docs/skills for\",\n defaultValue: \"claude\",\n },\n {\n usage: \"--git / --no-git\",\n description: \"Force-enable or force-disable git initialization\",\n defaultValue: \"false\",\n },\n {\n usage: \"--jwt / --no-jwt\",\n description: \"Force-enable or force-disable JWT secret generation\",\n defaultValue: \"false\",\n },\n {\n usage: \"-y, --yes\",\n description: \"Skip every prompt and accept defaults for anything unset\",\n defaultValue: \"false\",\n },\n {\n usage: \"--customize, --interactive\",\n description:\n 'Full long-form wizard — every choice asked one by one. Also selectable as \"Customize\" in the \"What are we building?\" menu. Any other flag you pass pre-selects its prompt; --yes is refused',\n defaultValue: \"false\",\n },\n {\n usage: \"-h, --help\",\n description: \"Show this help message and exit\",\n defaultValue: \"n/a\",\n },\n {\n usage: \"-v, --version\",\n description: \"Show the installed create-warlock version and exit\",\n defaultValue: \"n/a\",\n },\n];\n\n/** Render the full `--help` text, one line per flag with its default. */\nexport function buildHelpText(): string {\n const rows = FLAG_DEFINITIONS.map(({ usage, description, defaultValue }) => {\n const label = usage.padEnd(28);\n return ` ${label}${description} (default: ${defaultValue})`;\n }).join(\"\\n\");\n\n return `\n create-warlock — scaffold a new Warlock.js project\n\n Usage\n $ create-warlock [project-name] [options]\n\n Options\n${rows}\n\n Example\n $ create-warlock my-app --db=postgres --features=test,herald --yes\n`;\n}\n"],"mappings":";;;AAgBA,MAAM,kBAAkB,CAAC,GAAG,qBAAqB,GAAG,GAAG,oBAAoB,CAAC,CAAC,CAAC,KAC3E,EAAE,YAAY,KACjB;AAEA,MAAa,mBAAqC;CAChD;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aACE;EACF,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa,mDAAmD,gBAAgB,KAAK,IAAI,EAAE;EAC3F,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aACE;EACF,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;AACF;;AAGA,SAAgB,gBAAwB;CAMtC,OAAO;;;;;;;EALM,iBAAiB,KAAK,EAAE,OAAO,aAAa,mBAAmB;EAE1E,OAAO,OADO,MAAM,OAAO,EACT,IAAI,YAAY,aAAa,aAAa;CAC9D,CAAC,CAAC,CAAC,KAAK,IASL,EAAE;;;;;AAKP"}
1
+ {"version":3,"file":"definitions.mjs","names":[],"sources":["../../../../../../../packages/create-warlock/src/flags/definitions.ts"],"sourcesContent":["import { getAiPackageOptions, getAiProviderOptions } from \"../features/features-map\";\n\n/**\n * Single source of truth for every CLI flag's help text and default, so\n * `--help` can never drift out of sync with what the parser actually\n * understands (requirement: `--help` lists every flag together with its\n * default value).\n */\nexport type FlagDefinition = {\n /** How the flag reads on the command line, e.g. `--db=<driver>`. */\n usage: string;\n description: string;\n /** Human-readable default, or what happens when it is left unanswered. */\n defaultValue: string;\n};\n\nconst AI_FEATURE_KEYS = [...getAiProviderOptions(), ...getAiPackageOptions()].map(\n ({ value }) => value,\n);\n\nexport const FLAG_DEFINITIONS: FlagDefinition[] = [\n {\n usage: \"--name=<name>\",\n description: \"Project name (or pass it as the first positional arg)\",\n defaultValue: \"required — prompted if a TTY is available, otherwise fails naming this flag\",\n },\n {\n usage: \"--stack=<api|web>\",\n description:\n \"API-only or full-stack web — the one structural choice that changes the app's shape. Customizing everything else is a flow, not a stack: use --customize, where --stack=web arrives as a pre-ticked web feature\",\n defaultValue: \"api\",\n },\n {\n usage: \"--db=<driver> / --no-db\",\n description: \"Database driver (e.g. postgres, mongodb), or skip a database entirely\",\n defaultValue: \"mongodb\",\n },\n {\n usage: \"--features=<list>\",\n description: \"Comma-separated feature keys (e.g. test,herald)\",\n defaultValue: 'none (or [\"web\"] when --stack=web and --features is not given)',\n },\n {\n usage: \"--ai=<list>\",\n description: `Comma-separated AI provider or capability keys (${AI_FEATURE_KEYS.join(\", \")})`,\n defaultValue: \"none\",\n },\n {\n usage: \"--pm=<manager>\",\n description: \"Package manager to use (npm, yarn, pnpm, bun)\",\n defaultValue: \"inferred from the invoking agent (npm_config_user_agent) or the system\",\n },\n {\n usage: \"--lint=<oxc|eslint>\",\n description:\n \"Linter and formatter: Oxlint/Oxfmt or ESLint/Prettier (deprecated; removed in 5.34.0)\",\n defaultValue: \"oxc\",\n },\n {\n usage: \"--agents=<list>\",\n description: \"Comma-separated agent-kit targets to derive docs/skills for\",\n defaultValue: \"claude\",\n },\n {\n usage: \"--git / --no-git\",\n description: \"Force-enable or force-disable git initialization\",\n defaultValue: \"false\",\n },\n {\n usage: \"--jwt / --no-jwt\",\n description: \"Force-enable or force-disable JWT secret generation\",\n defaultValue: \"false\",\n },\n {\n usage: \"-y, --yes\",\n description: \"Skip every prompt and accept defaults for anything unset\",\n defaultValue: \"false\",\n },\n {\n usage: \"--customize, --interactive\",\n description:\n 'Full long-form wizard — every choice asked one by one. Also selectable as \"Customize\" in the \"What are we building?\" menu. Any other flag you pass pre-selects its prompt; --yes is refused',\n defaultValue: \"false\",\n },\n {\n usage: \"-h, --help\",\n description: \"Show this help message and exit\",\n defaultValue: \"n/a\",\n },\n {\n usage: \"-v, --version\",\n description: \"Show the installed create-warlock version and exit\",\n defaultValue: \"n/a\",\n },\n];\n\n/** Render the full `--help` text, one line per flag with its default. */\nexport function buildHelpText(): string {\n const rows = FLAG_DEFINITIONS.map(({ usage, description, defaultValue }) => {\n const label = usage.padEnd(28);\n return ` ${label}${description} (default: ${defaultValue})`;\n }).join(\"\\n\");\n\n return `\n create-warlock — scaffold a new Warlock.js project\n\n Usage\n $ create-warlock [project-name] [options]\n\n Options\n${rows}\n\n Example\n $ create-warlock my-app --db=postgres --features=test,herald --yes\n`;\n}\n"],"mappings":";;;AAgBA,MAAM,kBAAkB,CAAC,GAAG,qBAAqB,GAAG,GAAG,oBAAoB,CAAC,CAAC,CAAC,KAC3E,EAAE,YAAY,KACjB;AAEA,MAAa,mBAAqC;CAChD;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aACE;EACF,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa,mDAAmD,gBAAgB,KAAK,IAAI,EAAE;EAC3F,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aACE;EACF,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aACE;EACF,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cAAc;CAChB;AACF;;AAGA,SAAgB,gBAAwB;CAMtC,OAAO;;;;;;;EALM,iBAAiB,KAAK,EAAE,OAAO,aAAa,mBAAmB;EAE1E,OAAO,OADO,MAAM,OAAO,EACT,IAAI,YAAY,aAAa,aAAa;CAC9D,CAAC,CAAC,CAAC,KAAK,IASL,EAAE;;;;;AAKP"}
@@ -5,7 +5,7 @@ import { getPreferredPackageManager } from "../helpers/package-manager.mjs";
5
5
  function seedFromFlags(cli) {
6
6
  return {
7
7
  packageManager: cli.pm ?? getPreferredPackageManager(),
8
- lint: cli.lint === "oxc" ? "oxc" : "eslint",
8
+ lint: cli.lint === "eslint" ? "eslint" : "oxc",
9
9
  databaseDriver: cli.db,
10
10
  features: cli.features ?? defaultFeatures(cli),
11
11
  aiProviders: cli.ai ?? [],
@@ -21,7 +21,7 @@ function seedFromFlags(cli) {
21
21
  function defaultFeatures(cli) {
22
22
  const defaults = getDefaultFeatureKeys();
23
23
  if (cli.stack !== "web") return defaults;
24
- return [...new Set([...defaults, "web"])];
24
+ return [.../* @__PURE__ */ new Set([...defaults, "web"])];
25
25
  }
26
26
 
27
27
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"seed-from-flags.mjs","names":[],"sources":["../../../../../../../packages/create-warlock/src/flags/seed-from-flags.ts"],"sourcesContent":["import type { CliFlags, LintToolchain } from \"../commands/create-new-app/types\";\nimport { getDefaultFeatureKeys } from \"../features/features-map\";\nimport { getPreferredPackageManager } from \"../helpers/package-manager\";\n\n/**\n * The wizard's prompts, pre-selected from whatever the user already spelled\n * out on the command line.\n *\n * Before this existed, `--customize --db=postgres` silently threw the driver\n * away: the wizard asked its own question with its own default and the flag\n * never reached anything. A flag that is accepted and then ignored is the\n * worst of both worlds — the run succeeds, and the answer is wrong.\n *\n * So a flag passed alongside `--customize` is not a contradiction to refuse,\n * it is an answer given early: the prompt opens on that value and the user\n * can still change it.\n */\nexport type WizardSeeds = {\n packageManager: string;\n databaseDriver: string | undefined;\n features: string[];\n aiProviders: string[];\n useGit: boolean;\n useJWT: boolean;\n lint: LintToolchain;\n};\n\nexport function seedFromFlags(cli: CliFlags): WizardSeeds {\n return {\n packageManager: cli.pm ?? getPreferredPackageManager(),\n lint: cli.lint === \"oxc\" ? \"oxc\" : \"eslint\",\n databaseDriver: cli.db,\n features: cli.features ?? defaultFeatures(cli),\n aiProviders: cli.ai ?? [],\n // clack's confirm opens on `true` when nothing is passed, which is the\n // behaviour these two prompts already had.\n useGit: cli.git ?? true,\n useJWT: cli.jwt ?? true,\n };\n}\n\n/**\n * `--stack=web` is the one structural answer, and the wizard has no stack\n * question of its own — it asks for features instead. So the stack arrives as\n * a pre-ticked `web` feature rather than being dropped on the floor.\n */\nfunction defaultFeatures(cli: CliFlags): string[] {\n const defaults = getDefaultFeatureKeys();\n\n if (cli.stack !== \"web\") return defaults;\n\n return [...new Set([...defaults, \"web\"])];\n}\n"],"mappings":";;;;AA2BA,SAAgB,cAAc,KAA4B;CACxD,OAAO;EACL,gBAAgB,IAAI,MAAM,2BAA2B;EACrD,MAAM,IAAI,SAAS,QAAQ,QAAQ;EACnC,gBAAgB,IAAI;EACpB,UAAU,IAAI,YAAY,gBAAgB,GAAG;EAC7C,aAAa,IAAI,MAAM,CAAC;EAGxB,QAAQ,IAAI,OAAO;EACnB,QAAQ,IAAI,OAAO;CACrB;AACF;;;;;;AAOA,SAAS,gBAAgB,KAAyB;CAChD,MAAM,WAAW,sBAAsB;CAEvC,IAAI,IAAI,UAAU,OAAO,OAAO;CAEhC,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,UAAU,KAAK,CAAC,CAAC;AAC1C"}
1
+ {"version":3,"file":"seed-from-flags.mjs","names":[],"sources":["../../../../../../../packages/create-warlock/src/flags/seed-from-flags.ts"],"sourcesContent":["import type { CliFlags, LintToolchain } from \"../commands/create-new-app/types\";\nimport { getDefaultFeatureKeys } from \"../features/features-map\";\nimport { getPreferredPackageManager } from \"../helpers/package-manager\";\n\n/**\n * The wizard's prompts, pre-selected from whatever the user already spelled\n * out on the command line.\n *\n * Before this existed, `--customize --db=postgres` silently threw the driver\n * away: the wizard asked its own question with its own default and the flag\n * never reached anything. A flag that is accepted and then ignored is the\n * worst of both worlds — the run succeeds, and the answer is wrong.\n *\n * So a flag passed alongside `--customize` is not a contradiction to refuse,\n * it is an answer given early: the prompt opens on that value and the user\n * can still change it.\n */\nexport type WizardSeeds = {\n packageManager: string;\n databaseDriver: string | undefined;\n features: string[];\n aiProviders: string[];\n useGit: boolean;\n useJWT: boolean;\n lint: LintToolchain;\n};\n\nexport function seedFromFlags(cli: CliFlags): WizardSeeds {\n return {\n packageManager: cli.pm ?? getPreferredPackageManager(),\n lint: cli.lint === \"eslint\" ? \"eslint\" : \"oxc\",\n databaseDriver: cli.db,\n features: cli.features ?? defaultFeatures(cli),\n aiProviders: cli.ai ?? [],\n // clack's confirm opens on `true` when nothing is passed, which is the\n // behaviour these two prompts already had.\n useGit: cli.git ?? true,\n useJWT: cli.jwt ?? true,\n };\n}\n\n/**\n * `--stack=web` is the one structural answer, and the wizard has no stack\n * question of its own — it asks for features instead. So the stack arrives as\n * a pre-ticked `web` feature rather than being dropped on the floor.\n */\nfunction defaultFeatures(cli: CliFlags): string[] {\n const defaults = getDefaultFeatureKeys();\n\n if (cli.stack !== \"web\") return defaults;\n\n return [...new Set([...defaults, \"web\"])];\n}\n"],"mappings":";;;;AA2BA,SAAgB,cAAc,KAA4B;CACxD,OAAO;EACL,gBAAgB,IAAI,MAAM,2BAA2B;EACrD,MAAM,IAAI,SAAS,WAAW,WAAW;EACzC,gBAAgB,IAAI;EACpB,UAAU,IAAI,YAAY,gBAAgB,GAAG;EAC7C,aAAa,IAAI,MAAM,CAAC;EAGxB,QAAQ,IAAI,OAAO;EACnB,QAAQ,IAAI,OAAO;CACrB;AACF;;;;;;AAOA,SAAS,gBAAgB,KAAyB;CAChD,MAAM,WAAW,sBAAsB;CAEvC,IAAI,IAAI,UAAU,OAAO,OAAO;CAEhC,OAAO,CAAC,mBAAG,IAAI,IAAI,CAAC,GAAG,UAAU,KAAK,CAAC,CAAC;AAC1C"}