create-warlock 5.29.0 → 5.30.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 (67) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/esm/commands/create-new-app/get-app-path.mjs +1 -1
  3. package/esm/commands/create-new-app/get-app-path.mjs.map +1 -1
  4. package/esm/commands/create-new-app/index.mjs +6 -3
  5. package/esm/commands/create-new-app/index.mjs.map +1 -1
  6. package/esm/commands/create-new-app/types.d.mts +1 -1
  7. package/esm/commands/create-warlock-app/index.mjs +1 -1
  8. package/esm/commands/create-warlock-app/index.mjs.map +1 -1
  9. package/esm/features/agent-kit-targets.mjs +1 -1
  10. package/esm/features/agent-kit-targets.mjs.map +1 -1
  11. package/esm/features/database-drivers.mjs +1 -1
  12. package/esm/features/database-drivers.mjs.map +1 -1
  13. package/esm/features/features-map.mjs +1 -1
  14. package/esm/features/features-map.mjs.map +1 -1
  15. package/esm/flags/assert-flag-combinations.mjs +1 -1
  16. package/esm/flags/assert-flag-combinations.mjs.map +1 -1
  17. package/esm/flags/assert-package-manager.mjs +1 -1
  18. package/esm/flags/assert-package-manager.mjs.map +1 -1
  19. package/esm/flags/definitions.mjs +1 -1
  20. package/esm/flags/definitions.mjs.map +1 -1
  21. package/esm/flags/seed-from-flags.mjs +1 -1
  22. package/esm/flags/seed-from-flags.mjs.map +1 -1
  23. package/esm/helpers/app.mjs +28 -6
  24. package/esm/helpers/app.mjs.map +1 -1
  25. package/esm/helpers/exec.mjs +1 -1
  26. package/esm/helpers/exec.mjs.map +1 -1
  27. package/esm/helpers/insert-import.mjs +1 -1
  28. package/esm/helpers/insert-import.mjs.map +1 -1
  29. package/esm/helpers/package-manager.mjs +22 -2
  30. package/esm/helpers/package-manager.mjs.map +1 -1
  31. package/esm/helpers/paths.mjs +1 -1
  32. package/esm/helpers/paths.mjs.map +1 -1
  33. package/esm/helpers/pnpm-build-approvals.mjs +58 -3
  34. package/esm/helpers/pnpm-build-approvals.mjs.map +1 -1
  35. package/esm/helpers/project-builder-helpers.mjs +1 -1
  36. package/esm/helpers/project-builder-helpers.mjs.map +1 -1
  37. package/esm/helpers/tty.mjs +1 -1
  38. package/esm/helpers/tty.mjs.map +1 -1
  39. package/esm/helpers/warlock-versions.mjs +1 -1
  40. package/esm/helpers/warlock-versions.mjs.map +1 -1
  41. package/esm/index.d.mts +1 -1
  42. package/esm/index.mjs +1 -1
  43. package/esm/index.mjs.map +1 -1
  44. package/esm/prompts/ask-agent-targets.mjs +4 -2
  45. package/esm/prompts/ask-agent-targets.mjs.map +1 -1
  46. package/esm/prompts/ask-ai-features.mjs +5 -3
  47. package/esm/prompts/ask-ai-features.mjs.map +1 -1
  48. package/esm/prompts/ask-project-name.mjs +1 -1
  49. package/esm/prompts/ask-project-name.mjs.map +1 -1
  50. package/esm/prompts/ask-stack.mjs +1 -1
  51. package/esm/prompts/ask-stack.mjs.map +1 -1
  52. package/esm/prompts/fit-to-terminal.mjs +46 -0
  53. package/esm/prompts/fit-to-terminal.mjs.map +1 -0
  54. package/esm/summary.mjs +1 -1
  55. package/esm/summary.mjs.map +1 -1
  56. package/esm/ui/banner.mjs +1 -1
  57. package/esm/ui/banner.mjs.map +1 -1
  58. package/esm/ui/report.mjs +1 -1
  59. package/esm/ui/report.mjs.map +1 -1
  60. package/esm/ui/spinner.mjs +1 -1
  61. package/esm/ui/spinner.mjs.map +1 -1
  62. package/esm/ui/spinners.mjs +1 -1
  63. package/esm/ui/spinners.mjs.map +1 -1
  64. package/llms-full.txt +7 -3
  65. package/package.json +5 -4
  66. package/skills/create-a-warlock-project/SKILL.md +7 -3
  67. package/templates/warlock/src/web/root.tsx +5 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ 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.30.0 - 2026-10-16
8
+
9
+ ### Fixed
10
+
11
+ - New apps get the viewport tag from `<Head />` (`@warlock.js/web` 5.30.0), so phones lay pages out at device width and responsive CSS applies; the scaffolded `src/web/root.tsx` says so and does not hand-write a second one (FW-03).
12
+ - **pnpm before 10.5 could not install a new app** (`ERROR packages field missing or empty`): pnpm 7–9 and 10.0–10.4 reject the settings-only `pnpm-workspace.yaml`. The scaffold now reads `pnpm --version` and writes approvals where that version reads them: no workspace file and `pnpm.onlyBuiltDependencies` in `package.json` before 10.5; the workspace file plus `onlyBuiltDependencies` on 10.5–10.25 (which ignore `allowBuilds`); the unchanged `allowBuilds` file on 10.26+, 11 and 12. It does not add `packages: ["."]`, which fails every later `pnpm add` on those versions (`ERR_PNPM_ADDING_TO_ROOT`). Feature approvals (sharp) follow the same rule; apps inside an existing workspace still get neither.
13
+ - **The feature multiselect no longer prints stacked copies of itself** in a short or narrow terminal: the 22-option list pages to the terminal's height, and each row's hint is shortened to fit one line (a wrapped row made clack redraw below the previous frame). The AI and agent-target multiselects use the same sizing. `@clack/prompts` is now `^0.8.2`, the first version whose multiselect pages.
14
+
15
+ ### Changed
16
+
17
+ - Selecting notifications scaffolds the smaller, convention-following `src/app/notifications` module that `warlock add notifications` now writes (FW-09; see `@warlock.js/core`).
18
+
7
19
  ## 5.29.0 - 2026-10-01
8
20
 
9
21
  ### Changed
@@ -2,7 +2,7 @@ import { directoryExists } from "@warlock.js/fs";
2
2
  import { colors } from "@mongez/copper";
3
3
  import * as path$1 from "path";
4
4
 
5
- //#region ../create-warlock/src/commands/create-new-app/get-app-path.ts
5
+ //#region ../../packages/create-warlock/src/commands/create-new-app/get-app-path.ts
6
6
  function getAppPath(appName) {
7
7
  const appPath = path$1.resolve(process.cwd(), appName);
8
8
  if (directoryExists(appPath)) {
@@ -1 +1 @@
1
- {"version":3,"file":"get-app-path.mjs","names":["path"],"sources":["../../../../../../../create-warlock/src/commands/create-new-app/get-app-path.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { directoryExists } from \"@warlock.js/fs\";\nimport * as path from \"path\";\n\nexport default function getAppPath(appName: string) {\n const appPath: string = path.resolve(process.cwd(), appName);\n\n if (directoryExists(appPath)) {\n console.log(\n colors.redBright(\n `${process.cwd()} has an existing directory \\`${colors.cyan(\n appName,\n )}\\`, please choose another app name or another directory to run the command from.`,\n ),\n );\n\n process.exit(1);\n }\n\n return appPath;\n}\n"],"mappings":";;;;;AAIA,SAAwB,WAAW,SAAiB;CAClD,MAAM,UAAkBA,OAAK,QAAQ,QAAQ,IAAI,GAAG,OAAO;CAE3D,IAAI,gBAAgB,OAAO,GAAG;EAC5B,QAAQ,IACN,OAAO,UACL,GAAG,QAAQ,IAAI,EAAE,+BAA+B,OAAO,KACrD,OACF,EAAE,iFACJ,CACF;EAEA,QAAQ,KAAK,CAAC;CAChB;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"get-app-path.mjs","names":["path"],"sources":["../../../../../../../../packages/create-warlock/src/commands/create-new-app/get-app-path.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { directoryExists } from \"@warlock.js/fs\";\nimport * as path from \"path\";\n\nexport default function getAppPath(appName: string) {\n const appPath: string = path.resolve(process.cwd(), appName);\n\n if (directoryExists(appPath)) {\n console.log(\n colors.redBright(\n `${process.cwd()} has an existing directory \\`${colors.cyan(\n appName,\n )}\\`, please choose another app name or another directory to run the command from.`,\n ),\n );\n\n process.exit(1);\n }\n\n return appPath;\n}\n"],"mappings":";;;;;AAIA,SAAwB,WAAW,SAAiB;CAClD,MAAM,UAAkBA,OAAK,QAAQ,QAAQ,IAAI,GAAG,OAAO;CAE3D,IAAI,gBAAgB,OAAO,GAAG;EAC5B,QAAQ,IACN,OAAO,UACL,GAAG,QAAQ,IAAI,EAAE,+BAA+B,OAAO,KACrD,OACF,EAAE,iFACJ,CACF;EAEA,QAAQ,KAAK,CAAC;CAChB;CAEA,OAAO;AACT"}
@@ -8,6 +8,7 @@ import { assertPackageManagerAvailable } from "../../flags/assert-package-manage
8
8
  import { seedFromFlags } from "../../flags/seed-from-flags.mjs";
9
9
  import { packageRoot } from "../../helpers/paths.mjs";
10
10
  import { App } from "../../helpers/app.mjs";
11
+ import { fitOptionsToWidth, multiselectMaxItems } from "../../prompts/fit-to-terminal.mjs";
11
12
  import { askAgentTargets } from "../../prompts/ask-agent-targets.mjs";
12
13
  import { askAiFeatures } from "../../prompts/ask-ai-features.mjs";
13
14
  import { askProjectName } from "../../prompts/ask-project-name.mjs";
@@ -19,7 +20,7 @@ import { getJsonFile } from "@warlock.js/fs";
19
20
  import { cancel, confirm, isCancel, multiselect, select } from "@clack/prompts";
20
21
  import { colors } from "@mongez/copper";
21
22
 
22
- //#region ../create-warlock/src/commands/create-new-app/index.ts
23
+ //#region ../../packages/create-warlock/src/commands/create-new-app/index.ts
23
24
  async function createNewApp(cli = {}) {
24
25
  const pmDetectionPromise = detectPackageManagers();
25
26
  const createWarlockVersion = getJsonFile(packageRoot("package.json")).version;
@@ -83,11 +84,13 @@ async function createFullWizard(cli, pmDetectionPromise) {
83
84
  process.exit(0);
84
85
  }
85
86
  const selectedDriver = getDatabaseDriver(databaseDriver);
87
+ const featureOptions = fitOptionsToWidth(getFeatureOptions());
86
88
  const selectedFeatures = await multiselect({
87
89
  message: "Select optional features to include",
88
- options: getFeatureOptions(),
90
+ options: featureOptions,
89
91
  initialValues: seeds.features,
90
- required: false
92
+ required: false,
93
+ maxItems: multiselectMaxItems(featureOptions.length)
91
94
  });
92
95
  if (isCancel(selectedFeatures)) {
93
96
  cancel("Feature selection cancelled");
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../create-warlock/src/commands/create-new-app/index.ts"],"sourcesContent":["import { cancel, confirm, isCancel, multiselect, 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 getFeatureOptions,\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 { 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 {\n AppOptions,\n App as AppType,\n CliFlags,\n SetupChoice,\n Stack,\n} 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 v20)\n const [major] = process.versions.node.split(\".\").map(Number);\n if (major < 20) {\n cancel(\"Node.js version must be at least 20.0.0\");\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(\n cli: CliFlags,\n pmDetectionPromise: Promise<void>,\n) {\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 // 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: Features selection\n const selectedFeatures = await multiselect({\n message: \"Select optional features to include\",\n options: getFeatureOptions(),\n initialValues: seeds.features,\n required: false,\n });\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 },\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(\n cli: CliFlags,\n pmDetectionPromise: Promise<void>,\n) {\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 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 = [\n ...getAiProviderOptions(),\n ...getAiPackageOptions(),\n ].map(option => option.value);\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 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>, --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":";;;;;;;;;;;;;;;;;;;;;;AA2CA,eAA8B,aAAa,MAAgB,CAAC,GAAG;CAE7D,MAAM,qBAAqB,sBAAsB;CAIjD,MAAM,uBADmB,YAAY,YAAY,cAAc,CACxB,CAAC,CAAC;CAGzC,gBAAgB,oBAAoB;CAEpC,QAAQ,IAAI,OAAO,KAAK,oCAAoC,CAAC;CAG7D,MAAM,CAAC,SAAS,QAAQ,SAAS,KAAK,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CAC3D,IAAI,QAAQ,IAAI;EACd,OAAO,yCAAyC;EAChD,QAAQ,KAAK,CAAC;CAChB;CAIA,uBAAuB,GAAG;CAkB1B,IAAI,IAAI,OAAO,CAAC,oBAAoB,GAAG;EACrC,MAAM,qBAAqB,GAAG;EAC9B;CACF;CAKA,IAAI,IAAI,aAAa;EACnB,MAAM,iBAAiB,KAAK,kBAAkB;EAC9C;CACF;CAEA,MAAM,yBAAyB,KAAK,kBAAkB;AACxD;;;;;;;AAQA,eAAe,iBACb,KACA,oBACA;CAKA,MAAM,UAAU,IAAI,QAAS,MAAM,eAAe;CAElD,MAAM,UAAU,WAAW,OAAO;CAClC,IAAI,CAAC,SAAS;CAOd,IAAI;EACF,6BAA6B,GAAG;CAClC,SAAS,OAAO;EACd,OAAQ,MAAgB,OAAO;EAC/B,QAAQ,KAAK,CAAC;CAChB;CAEA,MAAM,QAAQ,cAAc,GAAG;CAG/B,MAAM;CAIN,8BAA8B,IAAI,EAAE;CAEpC,MAAM,iBAAiB,MAAM,OAAO;EAClC,SAAS;EACT,SAAS,yBAAyB,CAAC,C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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, multiselect, 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 getFeatureOptions,\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 { askProjectName } from \"../../prompts/ask-project-name\";\nimport { askStack } from \"../../prompts/ask-stack\";\nimport {\n fitOptionsToWidth,\n multiselectMaxItems,\n} from \"../../prompts/fit-to-terminal\";\nimport { showIntroBanner } from \"../../ui/banner\";\nimport { createWarlockApp } from \"../create-warlock-app\";\nimport getAppPath from \"./get-app-path\";\nimport {\n AppOptions,\n App as AppType,\n CliFlags,\n SetupChoice,\n Stack,\n} 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 v20)\n const [major] = process.versions.node.split(\".\").map(Number);\n if (major < 20) {\n cancel(\"Node.js version must be at least 20.0.0\");\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(\n cli: CliFlags,\n pmDetectionPromise: Promise<void>,\n) {\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 // 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: Features selection\n // 22 options: page them to the terminal's height and keep each row on one\n // line, or every redraw prints the list again below the previous copy.\n const featureOptions = fitOptionsToWidth(getFeatureOptions());\n const selectedFeatures = await multiselect({\n message: \"Select optional features to include\",\n options: featureOptions,\n initialValues: seeds.features,\n required: false,\n maxItems: multiselectMaxItems(featureOptions.length),\n });\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 },\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(\n cli: CliFlags,\n pmDetectionPromise: Promise<void>,\n) {\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 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 = [\n ...getAiProviderOptions(),\n ...getAiPackageOptions(),\n ].map(option => option.value);\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 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>, --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":";;;;;;;;;;;;;;;;;;;;;;;AA+CA,eAA8B,aAAa,MAAgB,CAAC,GAAG;CAE7D,MAAM,qBAAqB,sBAAsB;CAIjD,MAAM,uBADmB,YAAY,YAAY,cAAc,CACxB,CAAC,CAAC;CAGzC,gBAAgB,oBAAoB;CAEpC,QAAQ,IAAI,OAAO,KAAK,oCAAoC,CAAC;CAG7D,MAAM,CAAC,SAAS,QAAQ,SAAS,KAAK,MAAM,GAAG,CA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AgB,YAAY,QAAO,QAAO,CAAC,cAAc,SAAS,GAAG,CAAC;CAE5E,IAAI,cAAc,SAAS,GACzB,OAAO,KACL,0BAA0B,cAAc,KAAK,GAAG,EAAE,sBAC3B,cAAc,KAAK,IAAI,GAChD;CAGF,IAAI,OAAO,SAAS,GAClB,MAAM,IAAI,MAAM,OAAO,KAAK,IAAI,CAAC;CAGnC,OAAO;EACL;EACA,cAAc,QAAQ,eAAe;EACrC;EACA;EACA,QAAQ,IAAI,OAAO;EACnB,QAAQ,IAAI,OAAO;CACrB;AACF;;;;;;;AAQA,eAAsB,kBAAkB,KAAoC;CAC1E,MAAM,UAAU,6BAA6B,GAAG;CAChD,MAAM,SAAS,MAAM,oBAAoB,IAAI,MAAM;CAEnD,OAAO;EAAE,GAAG;EAAS;CAAO;AAC9B;;;;;;;AAQA,eAAe,qBAAqB,KAAe;CACjD,MAAM,WAAW,IAAI,QAAQ,GAAE,CAAE,KAAK;CAEtC,IAAI,CAAC,SAAS;EAKZ,OACE,wQAIF;EACA,QAAQ,KAAK,CAAC;CAChB;CAEA,MAAM,UAAU,WAAW,OAAO;CAElC,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,4 +1,4 @@
1
- //#region ../create-warlock/src/commands/create-new-app/types.d.ts
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
3
  type Stack = "api" | "web";
4
4
  /**
@@ -8,7 +8,7 @@ import { failFatally, installFailureHints, showNotes, showPartialScreen, showPro
8
8
  import { spinner } from "../../ui/spinner.mjs";
9
9
  import { spinnerMessages } from "../../ui/spinners.mjs";
10
10
 
11
- //#region ../create-warlock/src/commands/create-warlock-app/index.ts
11
+ //#region ../../packages/create-warlock/src/commands/create-warlock-app/index.ts
12
12
  /** One-line "why did this fail" pulled out of a captured command. */
13
13
  function reasonFrom(result) {
14
14
  if (!result) return "the command reported a failure (no output captured)";
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../create-warlock/src/commands/create-warlock-app/index.ts"],"sourcesContent":["import {\n getDatabaseLabel,\n isNoDatabase,\n} from \"../../features/database-drivers\";\nimport { App } from \"../../helpers/app\";\nimport { CommandResult, takeLastCommandOutput } from \"../../helpers/exec\";\nimport {\n getPackageManager,\n runPackageManagerCommand,\n} 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(\n application: App,\n): 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\n .init()\n .use(\"warlock\")\n .updatePackageJson(versions)\n .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.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 = [\n ...(noDatabase ? [] : [databaseDriver]),\n ...features,\n ...aiProviders,\n ];\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\n ? spinnerMessages.featuresPartial\n : 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(\n initialized ? spinnerMessages.gitInitialized : spinnerMessages.gitFailed,\n );\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:\n \"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(\n generated ? spinnerMessages.jwtGenerated : spinnerMessages.jwtFailed,\n );\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(\n warmed ? spinnerMessages.cacheWarmed : spinnerMessages.cacheWarmFailed,\n );\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":";;;;;;;;;;;;AAmCA,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,KAAI,SAAQ,KAAK,KAAK,CAAC,CAAC,CACxB,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,iBACpB,aAC0B;CAC1B,MAAM,UAAU,YAAY;CAC5B,MAAM,EAAE,QAAQ,QAAQ,UAAU,aAAa,mBAAmB;CAClE,MAAM,aAAa,aAAa,cAAc;CAC9C,MAAM,WAAsB,CAAC;CAK7B,MAAM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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 {\n getDatabaseLabel,\n isNoDatabase,\n} from \"../../features/database-drivers\";\nimport { App } from \"../../helpers/app\";\nimport { CommandResult, takeLastCommandOutput } from \"../../helpers/exec\";\nimport {\n getPackageManager,\n runPackageManagerCommand,\n} 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(\n application: App,\n): 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\n .init()\n .use(\"warlock\")\n .updatePackageJson(versions)\n .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.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 = [\n ...(noDatabase ? [] : [databaseDriver]),\n ...features,\n ...aiProviders,\n ];\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\n ? spinnerMessages.featuresPartial\n : 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(\n initialized ? spinnerMessages.gitInitialized : spinnerMessages.gitFailed,\n );\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:\n \"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(\n generated ? spinnerMessages.jwtGenerated : spinnerMessages.jwtFailed,\n );\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(\n warmed ? spinnerMessages.cacheWarmed : spinnerMessages.cacheWarmFailed,\n );\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":";;;;;;;;;;;;AAmCA,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,KAAI,SAAQ,KAAK,KAAK,CAAC,CAAC,CACxB,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,iBACpB,aAC0B;CAC1B,MAAM,UAAU,YAAY;CAC5B,MAAM,EAAE,QAAQ,QAAQ,UAAU,aAAa,mBAAmB;CAClE,MAAM,aAAa,aAAa,cAAc;CAC9C,MAAM,WAAsB,CAAC;C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ACpC,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"}
@@ -3,7 +3,7 @@ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { homedir, tmpdir } from "node:os";
4
4
  import path from "node:path";
5
5
 
6
- //#region ../create-warlock/src/features/agent-kit-targets.ts
6
+ //#region ../../packages/create-warlock/src/features/agent-kit-targets.ts
7
7
  const requireFromHere = createRequire(import.meta.url);
8
8
  /**
9
9
  * `agent-kit` target selection for the scaffolder's `--agents` flag.
@@ -1 +1 @@
1
- {"version":3,"file":"agent-kit-targets.mjs","names":[],"sources":["../../../../../../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(\n (value): value is string => typeof value === \"string\",\n );\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(\n \"@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(\n (value): value is string => typeof value === \"string\",\n );\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(\n `agent-kit llms.txt request failed with HTTP ${indexResponse.status}`,\n );\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(\n \"Could not parse any agent-kit target names out of the fetched docs\",\n );\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(\n fetchRemoteAgentKitTargets(fetchImpl, timeoutMs),\n timeoutMs,\n );\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>(\n work: Promise<T>,\n timeoutMs: number,\n): 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 () =>\n reject(\n new Error(\n `agent-kit target lookup timed out after ${timeoutMs}ms`,\n ),\n ),\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 =\n requested && requested.length > 0 ? requested : [DEFAULT_AGENT_KIT_TARGET];\n\n const needsValidation = targets.some(\n target => !BUILTIN_AGENT_KIT_TARGETS.includes(target),\n );\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,QACnB,UAA2B,OAAO,UAAU,QAC/C;EAEF;CACF,QAAQ;EACN;CACF;AACF;AAEA,SAAS,WAAW,SAAyB;CAC3C,IAAI;EACF,MAAM,WAAW,cAAc;EAC/B,UAAU,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;EACrD,cACE,UACA,KAAK,UAAU;GAAE;GAAS,4BAAW,IAAI,KAAK,EAAC,CAAC,YAAY;EAAE,CAAC,GAC/D,MACF;CACF,QAAQ,CAGR;AACF;;;;;;;AAQA,SAAS,8BAAoD;CAC3D,KAAK,MAAM,QAAQ,CAAC,QAAQ,IA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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(\n (value): value is string => typeof value === \"string\",\n );\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(\n \"@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(\n (value): value is string => typeof value === \"string\",\n );\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(\n `agent-kit llms.txt request failed with HTTP ${indexResponse.status}`,\n );\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(\n \"Could not parse any agent-kit target names out of the fetched docs\",\n );\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(\n fetchRemoteAgentKitTargets(fetchImpl, timeoutMs),\n timeoutMs,\n );\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>(\n work: Promise<T>,\n timeoutMs: number,\n): 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 () =>\n reject(\n new Error(\n `agent-kit target lookup timed out after ${timeoutMs}ms`,\n ),\n ),\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 =\n requested && requested.length > 0 ? requested : [DEFAULT_AGENT_KIT_TARGET];\n\n const needsValidation = targets.some(\n target => !BUILTIN_AGENT_KIT_TARGETS.includes(target),\n );\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,MA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CAC1C,OAAO,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC;AAC5B;;;;;;;;;;AAWA,eAAsB,oBACpB,WACA,YAA0B,OACP;CACnB,MAAM,UACJ,aAAa,UAAU,SAAS,IAAI,YAAY,CAAC,wBAAwB;CAM3E,IAAI,CAJoB,QAAQ,MAC9B,WAAU,CAAC,0BAA0B,SAAS,MAAM,CAGnC,GACjB,OAAO;CAGT,MAAM,QAAQ,MAAM,wBAAwB,SAAS;CACrD,MAAM,UAAU,QAAQ,QAAO,WAAU,CAAC,MAAM,SAAS,MAAM,CAAC;CAEhE,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,4 +1,4 @@
1
- //#region ../create-warlock/src/features/database-drivers.ts
1
+ //#region ../../packages/create-warlock/src/features/database-drivers.ts
2
2
  /**
3
3
  * Sentinel `--db` value / select option that means "no database at all".
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"database-drivers.mjs","names":[],"sources":["../../../../../../create-warlock/src/features/database-drivers.ts"],"sourcesContent":["/**\n * Database driver options and configuration\n */\nexport type DatabaseDriver = {\n value: string;\n label: string;\n package: string;\n packageVersion: string;\n defaultPort: number;\n disabled?: boolean;\n hint?: string;\n};\n\n/**\n * Sentinel `--db` value / select option that means \"no database at all\".\n *\n * Picking it wires no driver, pulls no driver package, and deletes the\n * template's `src/config/database.ts` — the framework's database connector is\n * config-gated on that file, so with it gone the app boots with no database.\n */\nexport const NO_DATABASE = \"none\";\n\nexport const databaseDrivers: DatabaseDriver[] = [\n {\n value: \"mongodb\",\n label: \"MongoDB\",\n package: \"mongodb\",\n packageVersion: \"^7.0.0\",\n defaultPort: 27017,\n },\n {\n value: \"postgres\",\n label: \"PostgreSQL\",\n package: \"pg\",\n packageVersion: \"^8.11.0\",\n defaultPort: 5432,\n },\n {\n value: \"mysql\",\n label: \"MySQL (Coming Soon)\",\n package: \"mysql2\",\n packageVersion: \"^3.5.0\",\n defaultPort: 3306,\n disabled: true,\n hint: \"MySQL support coming in a future release\",\n },\n];\n\n/**\n * Get database driver options for the select prompt.\n *\n * The real drivers come first, followed by a \"None\" opt-out so the user can\n * scaffold an app with no database.\n */\nexport function getDatabaseDriverOptions() {\n return [\n ...databaseDrivers.map(driver => ({\n value: driver.value,\n label: driver.label,\n hint: driver.hint,\n disabled: driver.disabled,\n })),\n {\n value: NO_DATABASE,\n label: \"None\",\n hint: \"No database — skips the driver and removes src/config/database.ts\",\n disabled: undefined,\n },\n ];\n}\n\n/**\n * Get database driver config by value\n */\nexport function getDatabaseDriver(value: string): DatabaseDriver | undefined {\n return databaseDrivers.find(driver => driver.value === value);\n}\n\n/**\n * Whether a `--db` value / selection means \"no database\".\n */\nexport function isNoDatabase(value: string | undefined): boolean {\n return value === NO_DATABASE;\n}\n\n/**\n * Human-readable database label for the success screen: `\"None\"` when no\n * database was chosen, otherwise the driver's own label (falling back to the\n * raw value for an unrecognized driver).\n */\nexport function getDatabaseLabel(value: string): string {\n if (isNoDatabase(value)) return \"None\";\n\n return getDatabaseDriver(value)?.label ?? value;\n}\n\n/**\n * Get database driver dependency\n */\nexport function getDatabaseDependency(\n driverValue: string,\n): Record<string, string> {\n const driver = getDatabaseDriver(driverValue);\n if (!driver) return {};\n\n return {\n [driver.package]: driver.packageVersion,\n };\n}\n"],"mappings":";;;;;;;;AAoBA,MAAa,cAAc;AAE3B,MAAa,kBAAoC;CAC/C;EACE,OAAO;EACP,OAAO;EACP,SAAS;EACT,gBAAgB;EAChB,aAAa;CACf;CACA;EACE,OAAO;EACP,OAAO;EACP,SAAS;EACT,gBAAgB;EAChB,aAAa;CACf;CACA;EACE,OAAO;EACP,OAAO;EACP,SAAS;EACT,gBAAgB;EAChB,aAAa;EACb,UAAU;EACV,MAAM;CACR;AACF;;;;;;;AAQA,SAAgB,2BAA2B;CACzC,OAAO,CACL,GAAG,gBAAgB,KAAI,YAAW;EAChC,OAAO,OAAO;EACd,OAAO,OAAO;EACd,MAAM,OAAO;EACb,UAAU,OAAO;CACnB,EAAE,GACF;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,UAAU;CACZ,CACF;AACF;;;;AAKA,SAAgB,kBAAkB,OAA2C;CAC3E,OAAO,gBAAgB,MAAK,WAAU,OAAO,UAAU,KAAK;AAC9D;;;;AAKA,SAAgB,aAAa,OAAoC;CAC/D,OAAO,UAAU;AACnB;;;;;;AAOA,SAAgB,iBAAiB,OAAuB;CACtD,IAAI,aAAa,KAAK,GAAG,OAAO;CAEhC,OAAO,kBAAkB,KAAK,CAAC,EAAE,SAAS;AAC5C"}
1
+ {"version":3,"file":"database-drivers.mjs","names":[],"sources":["../../../../../../../packages/create-warlock/src/features/database-drivers.ts"],"sourcesContent":["/**\n * Database driver options and configuration\n */\nexport type DatabaseDriver = {\n value: string;\n label: string;\n package: string;\n packageVersion: string;\n defaultPort: number;\n disabled?: boolean;\n hint?: string;\n};\n\n/**\n * Sentinel `--db` value / select option that means \"no database at all\".\n *\n * Picking it wires no driver, pulls no driver package, and deletes the\n * template's `src/config/database.ts` — the framework's database connector is\n * config-gated on that file, so with it gone the app boots with no database.\n */\nexport const NO_DATABASE = \"none\";\n\nexport const databaseDrivers: DatabaseDriver[] = [\n {\n value: \"mongodb\",\n label: \"MongoDB\",\n package: \"mongodb\",\n packageVersion: \"^7.0.0\",\n defaultPort: 27017,\n },\n {\n value: \"postgres\",\n label: \"PostgreSQL\",\n package: \"pg\",\n packageVersion: \"^8.11.0\",\n defaultPort: 5432,\n },\n {\n value: \"mysql\",\n label: \"MySQL (Coming Soon)\",\n package: \"mysql2\",\n packageVersion: \"^3.5.0\",\n defaultPort: 3306,\n disabled: true,\n hint: \"MySQL support coming in a future release\",\n },\n];\n\n/**\n * Get database driver options for the select prompt.\n *\n * The real drivers come first, followed by a \"None\" opt-out so the user can\n * scaffold an app with no database.\n */\nexport function getDatabaseDriverOptions() {\n return [\n ...databaseDrivers.map(driver => ({\n value: driver.value,\n label: driver.label,\n hint: driver.hint,\n disabled: driver.disabled,\n })),\n {\n value: NO_DATABASE,\n label: \"None\",\n hint: \"No database — skips the driver and removes src/config/database.ts\",\n disabled: undefined,\n },\n ];\n}\n\n/**\n * Get database driver config by value\n */\nexport function getDatabaseDriver(value: string): DatabaseDriver | undefined {\n return databaseDrivers.find(driver => driver.value === value);\n}\n\n/**\n * Whether a `--db` value / selection means \"no database\".\n */\nexport function isNoDatabase(value: string | undefined): boolean {\n return value === NO_DATABASE;\n}\n\n/**\n * Human-readable database label for the success screen: `\"None\"` when no\n * database was chosen, otherwise the driver's own label (falling back to the\n * raw value for an unrecognized driver).\n */\nexport function getDatabaseLabel(value: string): string {\n if (isNoDatabase(value)) return \"None\";\n\n return getDatabaseDriver(value)?.label ?? value;\n}\n\n/**\n * Get database driver dependency\n */\nexport function getDatabaseDependency(\n driverValue: string,\n): Record<string, string> {\n const driver = getDatabaseDriver(driverValue);\n if (!driver) return {};\n\n return {\n [driver.package]: driver.packageVersion,\n };\n}\n"],"mappings":";;;;;;;;AAoBA,MAAa,cAAc;AAE3B,MAAa,kBAAoC;CAC/C;EACE,OAAO;EACP,OAAO;EACP,SAAS;EACT,gBAAgB;EAChB,aAAa;CACf;CACA;EACE,OAAO;EACP,OAAO;EACP,SAAS;EACT,gBAAgB;EAChB,aAAa;CACf;CACA;EACE,OAAO;EACP,OAAO;EACP,SAAS;EACT,gBAAgB;EAChB,aAAa;EACb,UAAU;EACV,MAAM;CACR;AACF;;;;;;;AAQA,SAAgB,2BAA2B;CACzC,OAAO,CACL,GAAG,gBAAgB,KAAI,YAAW;EAChC,OAAO,OAAO;EACd,OAAO,OAAO;EACd,MAAM,OAAO;EACb,UAAU,OAAO;CACnB,EAAE,GACF;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,UAAU;CACZ,CACF;AACF;;;;AAKA,SAAgB,kBAAkB,OAA2C;CAC3E,OAAO,gBAAgB,MAAK,WAAU,OAAO,UAAU,KAAK;AAC9D;;;;AAKA,SAAgB,aAAa,OAAoC;CAC/D,OAAO,UAAU;AACnB;;;;;;AAOA,SAAgB,iBAAiB,OAAuB;CACtD,IAAI,aAAa,KAAK,GAAG,OAAO;CAEhC,OAAO,kBAAkB,KAAK,CAAC,EAAE,SAAS;AAC5C"}
@@ -1,4 +1,4 @@
1
- //#region ../create-warlock/src/features/features-map.ts
1
+ //#region ../../packages/create-warlock/src/features/features-map.ts
2
2
  /**
3
3
  * Optional features offered in the general multiselect step. The database
4
4
  * driver (its own select) and AI providers + capability packages (their own
@@ -1 +1 @@
1
- {"version":3,"file":"features-map.mjs","names":[],"sources":["../../../../../../create-warlock/src/features/features-map.ts"],"sourcesContent":["/**\n * Presentation manifest for the scaffolder's feature prompts.\n *\n * This file is **display metadata only** — keys, labels, hints, grouping, and\n * default selections. It deliberately holds NO dependency names or versions:\n * the single source of truth for what each feature installs is the `add`\n * command's feature map in `@warlock.js/core`\n * (`src/generations/add-command.action.ts`). The scaffolder collects the\n * selections here and delegates the actual install to `warlock add`, so the\n * two never drift on versions again.\n *\n * Every `key` below MUST exist in core’s `allowedFeatures`. That guard now\n * EXISTS: `builder/scripts/check-feature-parity.ts`, run by every publishing\n * script in `builder/package.json`, so a release aborts before `pkgist` starts.\n * It could not live in this repo: this package deliberately does not depend on\n * `@warlock.js/core`, and our own CI checks out only this repo, so core’s keys\n * are not present here to compare against. `builder` sits above both and\n * imports each by relative path, adding no dependency edge in either direction.\n *\n * A subset assertion ALONE is not enough and has already let a\n * bug ship: `--features=web,tailwind` was rejected with \"Unknown feature(s):\n * tailwind\" because `tailwind` and `shadcn` existed in core and were missing\n * from THIS file — a direction a scaffolder ⊆ core check cannot see. The guard\n * has to run both ways:\n *\n * 1. scaffolder ⊆ core — catches a typo or a key core renamed.\n * 2. core ⊆ scaffolder + an explicit omission list — catches a feature core\n * gained that never became scaffoldable.\n *\n * The two lists are not equal and should not be forced to be. As of this\n * writing core holds 28 keys and this file offers 24; the other four are\n * deliberate and are the entire allow-list direction (2) needs:\n * `mongodb`, `postgres`, `mysql` (the database driver has its own select) and\n * `ai` (pulled automatically by every `ai-*` key's `requires`). Anything beyond\n * those four is a gap, not a decision, and should fail the build.\n */\n\nexport type FeatureGroup =\n | \"Auth & Access\"\n | \"Rendering & Mail\"\n | \"Media\"\n | \"Storage & Cache\"\n | \"Jobs & Messaging\"\n | \"Realtime\"\n | \"API Docs\"\n | \"Tooling\";\n\nexport type FeatureOption = {\n /** Must match a key in core's `add` feature map. */\n key: string;\n label: string;\n hint: string;\n group: FeatureGroup;\n defaultSelected?: boolean;\n};\n\n/**\n * Optional features offered in the general multiselect step. The database\n * driver (its own select) and AI providers + capability packages (their own\n * step) are intentionally NOT here — they have dedicated prompts.\n */\nexport const features: FeatureOption[] = [\n // Auth & Access\n {\n key: \"access\",\n label: \"Access (authorization)\",\n hint: \"RBAC permission checks, ABAC policies, and roles — pairs with auth\",\n group: \"Auth & Access\",\n },\n {\n key: \"auth-google\",\n label: \"Google sign-in\",\n hint: \"Google OAuth sign-in for @warlock.js/auth\",\n group: \"Auth & Access\",\n },\n {\n key: \"auth-passkeys\",\n label: \"Passkey sign-in\",\n hint: \"WebAuthn passkey login for @warlock.js/auth\",\n group: \"Auth & Access\",\n },\n\n // Rendering & Mail\n {\n key: \"web\",\n label: \"Web (SSR React pages)\",\n hint: \"Server-rendered React pages on the same server as your API — scaffolds src/web and registers the connector\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"tailwind\",\n label: \"Tailwind CSS\",\n hint: \"Tailwind v4 for the SSR page layer — creates src/web/app.css (the CSS-first config) and wires it through Vite (pulls web)\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"shadcn\",\n label: \"shadcn/ui prerequisites\",\n hint: \"components.json, cn(), design tokens, and the web/* tsconfig path so `npx shadcn add <component>` works first time (pulls tailwind)\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"sitemap\",\n label: \"Sitemap\",\n hint: \"Runtime sitemap.xml generation from the page registry — requires app.publicUrl or PUBLIC_APP_URL (pulls web)\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"devtools\",\n label: \"Devtools (/__warlock)\",\n hint: \"Development-only dashboard: request timeline, queries + EXPLAIN, N+1 warnings, dev mailbox, logs, cache, routes — installed as a dev dependency, never runs in production\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"react\",\n label: \"React (rendering & mails)\",\n hint: \"React + ReactDOM for non-interactive rendering and HTML/email generation\",\n group: \"Rendering & Mail\",\n defaultSelected: true,\n },\n {\n key: \"react-email\",\n label: \"React Email\",\n hint: \"Build email templates with React + Tailwind (pulls react + mail)\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"mail\",\n label: \"Mail (Nodemailer)\",\n hint: \"Send emails via SMTP\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"ses\",\n label: \"Amazon SES\",\n hint: \"Send emails via the AWS SES API\",\n group: \"Rendering & Mail\",\n },\n\n // Media\n {\n key: \"image\",\n label: \"Image processing (Sharp)\",\n hint: \"Resize, convert, and optimize images\",\n group: \"Media\",\n },\n\n // Storage & Cache\n {\n key: \"s3\",\n label: \"S3 storage\",\n hint: \"AWS S3 for cloud file storage\",\n group: \"Storage & Cache\",\n },\n {\n key: \"redis\",\n label: \"Redis cache\",\n hint: \"Redis driver for the cache layer\",\n group: \"Storage & Cache\",\n },\n\n // Jobs & Messaging\n {\n key: \"scheduler\",\n label: \"Scheduler\",\n hint: \"Background tasks and cron jobs\",\n group: \"Jobs & Messaging\",\n },\n {\n key: \"queue\",\n label: \"Queue (BullMQ)\",\n hint: \"Durable Redis-backed background jobs with retries and workers\",\n group: \"Jobs & Messaging\",\n },\n {\n key: \"bull-board\",\n label: \"Bull Board (queue dashboard)\",\n hint: \"Web dashboard for inspecting queues and jobs — enabled outside production only, and refuses to mount unguarded (pulls queue)\",\n group: \"Jobs & Messaging\",\n },\n {\n key: \"herald\",\n label: \"Herald (RabbitMQ)\",\n hint: \"Message broker for event-driven architecture\",\n group: \"Jobs & Messaging\",\n },\n {\n key: \"notifications\",\n label: \"Notifications\",\n hint: \"Multi-channel notifications — mail + in-app database, preferences, idempotency\",\n group: \"Jobs & Messaging\",\n },\n\n // Realtime\n {\n key: \"socket\",\n label: \"Socket.IO\",\n hint: \"Realtime websocket server\",\n group: \"Realtime\",\n },\n\n // API Docs (swagger / postman / openapi) — not shipped yet; they will arrive\n // together in the unified @warlock.js/api-docs package. Re-add the selection\n // once that package exists. (Removed so the wizard can't offer unbuilt features.)\n\n // Tooling\n {\n key: \"test\",\n label: \"Testing (Vitest)\",\n hint: \"Vitest + coverage + per-worker DB/cache test setup\",\n group: \"Tooling\",\n },\n];\n\nexport type AiProviderOption = {\n /** Must match a provider/package key in core's `add` feature map. */\n key: string;\n label: string;\n hint: string;\n};\n\n/**\n * AI providers offered in the dedicated AI step. Selecting any of these pulls\n * the core `@warlock.js/ai` package automatically via the provider's `requires`\n * in core's feature map — the scaffolder never lists `ai` as a standalone pick.\n *\n * Keys are `ai-`prefixed to mirror core's renamed provider feature keys\n * (`ai-openai` → `@warlock.js/ai-openai`, etc.).\n */\nexport const aiProviders: AiProviderOption[] = [\n { key: \"ai-openai\", label: \"OpenAI\", hint: \"GPT models via the OpenAI API\" },\n {\n key: \"ai-google\",\n label: \"Google (Gemini)\",\n hint: \"Gemini models via Google AI\",\n },\n {\n key: \"ai-anthropic\",\n label: \"Anthropic (Claude)\",\n hint: \"Claude models via the Anthropic API\",\n },\n {\n key: \"ai-bedrock\",\n label: \"AWS Bedrock\",\n hint: \"Foundation models via Amazon Bedrock\",\n },\n { key: \"ai-ollama\", label: \"Ollama\", hint: \"Local models via Ollama\" },\n];\n\n/**\n * AI capability packages offered alongside the providers in the dedicated AI\n * step. These are the satellite packages that sit on top of the core\n * `@warlock.js/ai` toolkit (each pulls the core `ai` package via its `requires`\n * in core's feature map, same as the providers).\n */\nexport const aiPackages: AiProviderOption[] = [\n {\n key: \"ai-tools\",\n label: \"AI Tools\",\n hint: \"Ready-made agent tools (web search, fetch, HTTP, calculator, date-time) + MCP client/server\",\n },\n {\n key: \"ai-panoptic\",\n label: \"AI Observability (Panoptic)\",\n hint: \"Tracing + exporters + a zero-setup local dashboard\",\n },\n {\n key: \"ai-workspace\",\n label: \"AI Workspace\",\n hint: \"Policy-jailed filesystem + shell for coding agents\",\n },\n];\n\n/**\n * Feature options for the multiselect prompt, ordered by group with the group\n * surfaced in the hint (keeps a flat list scannable without group widgets).\n */\nexport function getFeatureOptions() {\n return features.map(feature => ({\n value: feature.key,\n label: feature.label,\n hint: `${feature.group} — ${feature.hint}`,\n }));\n}\n\n/**\n * Keys pre-checked in the feature multiselect.\n */\nexport function getDefaultFeatureKeys(): string[] {\n return features\n .filter(feature => feature.defaultSelected)\n .map(feature => feature.key);\n}\n\n/**\n * AI provider options for the dedicated AI multiselect step.\n */\nexport function getAiProviderOptions() {\n return aiProviders.map(provider => ({\n value: provider.key,\n label: provider.label,\n hint: provider.hint,\n }));\n}\n\n/**\n * AI capability package options for the dedicated AI multiselect step. Offered\n * together with the providers (see `getAiProviderOptions`).\n */\nexport function getAiPackageOptions() {\n return aiPackages.map(pkg => ({\n value: pkg.key,\n label: pkg.label,\n hint: pkg.hint,\n }));\n}\n\n/**\n * Every selectable key the scaffolder knows about (features + AI providers +\n * AI capability packages). Used to validate `--features` / `--ai` flags in\n * non-interactive mode.\n */\nexport function getAllFeatureKeys(): string[] {\n return [\n ...features.map(feature => feature.key),\n ...aiProviders.map(provider => provider.key),\n ...aiPackages.map(pkg => pkg.key),\n ];\n}\n"],"mappings":";;;;;;AA6DA,MAAa,WAA4B;CAEvC;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CAGA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;EACP,iBAAiB;CACnB;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CAGA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CAGA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CAGA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CAGA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CAOA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;AACF;;;;;;;;;AAiBA,MAAa,cAAkC;CAC7C;EAAE,KAAK;EAAa,OAAO;EAAU,MAAM;CAAgC;CAC3E;EACE,KAAK;EACL,OAAO;EACP,MAAM;CACR;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;CACR;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;CACR;CACA;EAAE,KAAK;EAAa,OAAO;EAAU,MAAM;CAA0B;AACvE;;;;;;;AAQA,MAAa,aAAiC;CAC5C;EACE,KAAK;EACL,OAAO;EACP,MAAM;CACR;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;CACR;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;CACR;AACF;;;;;AAMA,SAAgB,oBAAoB;CAClC,OAAO,SAAS,KAAI,aAAY;EAC9B,OAAO,QAAQ;EACf,OAAO,QAAQ;EACf,MAAM,GAAG,QAAQ,MAAM,KAAK,QAAQ;CACtC,EAAE;AACJ;;;;AAKA,SAAgB,wBAAkC;CAChD,OAAO,SACJ,QAAO,YAAW,QAAQ,eAAe,CAAC,CAC1C,KAAI,YAAW,QAAQ,GAAG;AAC/B;;;;AAKA,SAAgB,uBAAuB;CACrC,OAAO,YAAY,KAAI,cAAa;EAClC,OAAO,SAAS;EAChB,OAAO,SAAS;EAChB,MAAM,SAAS;CACjB,EAAE;AACJ;;;;;AAMA,SAAgB,sBAAsB;CACpC,OAAO,WAAW,KAAI,SAAQ;EAC5B,OAAO,IAAI;EACX,OAAO,IAAI;EACX,MAAM,IAAI;CACZ,EAAE;AACJ;;;;;;AAOA,SAAgB,oBAA8B;CAC5C,OAAO;EACL,GAAG,SAAS,KAAI,YAAW,QAAQ,GAAG;EACtC,GAAG,YAAY,KAAI,aAAY,SAAS,GAAG;EAC3C,GAAG,WAAW,KAAI,QAAO,IAAI,GAAG;CAClC;AACF"}
1
+ {"version":3,"file":"features-map.mjs","names":[],"sources":["../../../../../../../packages/create-warlock/src/features/features-map.ts"],"sourcesContent":["/**\n * Presentation manifest for the scaffolder's feature prompts.\n *\n * This file is **display metadata only** — keys, labels, hints, grouping, and\n * default selections. It deliberately holds NO dependency names or versions:\n * the single source of truth for what each feature installs is the `add`\n * command's feature map in `@warlock.js/core`\n * (`src/generations/add-command.action.ts`). The scaffolder collects the\n * selections here and delegates the actual install to `warlock add`, so the\n * two never drift on versions again.\n *\n * Every `key` below MUST exist in core’s `allowedFeatures`. That guard now\n * EXISTS: `builder/scripts/check-feature-parity.ts`, run by every publishing\n * script in `builder/package.json`, so a release aborts before `pkgist` starts.\n * It could not live in this repo: this package deliberately does not depend on\n * `@warlock.js/core`, and our own CI checks out only this repo, so core’s keys\n * are not present here to compare against. `builder` sits above both and\n * imports each by relative path, adding no dependency edge in either direction.\n *\n * A subset assertion ALONE is not enough and has already let a\n * bug ship: `--features=web,tailwind` was rejected with \"Unknown feature(s):\n * tailwind\" because `tailwind` and `shadcn` existed in core and were missing\n * from THIS file — a direction a scaffolder ⊆ core check cannot see. The guard\n * has to run both ways:\n *\n * 1. scaffolder ⊆ core — catches a typo or a key core renamed.\n * 2. core ⊆ scaffolder + an explicit omission list — catches a feature core\n * gained that never became scaffoldable.\n *\n * The two lists are not equal and should not be forced to be. As of this\n * writing core holds 28 keys and this file offers 24; the other four are\n * deliberate and are the entire allow-list direction (2) needs:\n * `mongodb`, `postgres`, `mysql` (the database driver has its own select) and\n * `ai` (pulled automatically by every `ai-*` key's `requires`). Anything beyond\n * those four is a gap, not a decision, and should fail the build.\n */\n\nexport type FeatureGroup =\n | \"Auth & Access\"\n | \"Rendering & Mail\"\n | \"Media\"\n | \"Storage & Cache\"\n | \"Jobs & Messaging\"\n | \"Realtime\"\n | \"API Docs\"\n | \"Tooling\";\n\nexport type FeatureOption = {\n /** Must match a key in core's `add` feature map. */\n key: string;\n label: string;\n hint: string;\n group: FeatureGroup;\n defaultSelected?: boolean;\n};\n\n/**\n * Optional features offered in the general multiselect step. The database\n * driver (its own select) and AI providers + capability packages (their own\n * step) are intentionally NOT here — they have dedicated prompts.\n */\nexport const features: FeatureOption[] = [\n // Auth & Access\n {\n key: \"access\",\n label: \"Access (authorization)\",\n hint: \"RBAC permission checks, ABAC policies, and roles — pairs with auth\",\n group: \"Auth & Access\",\n },\n {\n key: \"auth-google\",\n label: \"Google sign-in\",\n hint: \"Google OAuth sign-in for @warlock.js/auth\",\n group: \"Auth & Access\",\n },\n {\n key: \"auth-passkeys\",\n label: \"Passkey sign-in\",\n hint: \"WebAuthn passkey login for @warlock.js/auth\",\n group: \"Auth & Access\",\n },\n\n // Rendering & Mail\n {\n key: \"web\",\n label: \"Web (SSR React pages)\",\n hint: \"Server-rendered React pages on the same server as your API — scaffolds src/web and registers the connector\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"tailwind\",\n label: \"Tailwind CSS\",\n hint: \"Tailwind v4 for the SSR page layer — creates src/web/app.css (the CSS-first config) and wires it through Vite (pulls web)\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"shadcn\",\n label: \"shadcn/ui prerequisites\",\n hint: \"components.json, cn(), design tokens, and the web/* tsconfig path so `npx shadcn add <component>` works first time (pulls tailwind)\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"sitemap\",\n label: \"Sitemap\",\n hint: \"Runtime sitemap.xml generation from the page registry — requires app.publicUrl or PUBLIC_APP_URL (pulls web)\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"devtools\",\n label: \"Devtools (/__warlock)\",\n hint: \"Development-only dashboard: request timeline, queries + EXPLAIN, N+1 warnings, dev mailbox, logs, cache, routes — installed as a dev dependency, never runs in production\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"react\",\n label: \"React (rendering & mails)\",\n hint: \"React + ReactDOM for non-interactive rendering and HTML/email generation\",\n group: \"Rendering & Mail\",\n defaultSelected: true,\n },\n {\n key: \"react-email\",\n label: \"React Email\",\n hint: \"Build email templates with React + Tailwind (pulls react + mail)\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"mail\",\n label: \"Mail (Nodemailer)\",\n hint: \"Send emails via SMTP\",\n group: \"Rendering & Mail\",\n },\n {\n key: \"ses\",\n label: \"Amazon SES\",\n hint: \"Send emails via the AWS SES API\",\n group: \"Rendering & Mail\",\n },\n\n // Media\n {\n key: \"image\",\n label: \"Image processing (Sharp)\",\n hint: \"Resize, convert, and optimize images\",\n group: \"Media\",\n },\n\n // Storage & Cache\n {\n key: \"s3\",\n label: \"S3 storage\",\n hint: \"AWS S3 for cloud file storage\",\n group: \"Storage & Cache\",\n },\n {\n key: \"redis\",\n label: \"Redis cache\",\n hint: \"Redis driver for the cache layer\",\n group: \"Storage & Cache\",\n },\n\n // Jobs & Messaging\n {\n key: \"scheduler\",\n label: \"Scheduler\",\n hint: \"Background tasks and cron jobs\",\n group: \"Jobs & Messaging\",\n },\n {\n key: \"queue\",\n label: \"Queue (BullMQ)\",\n hint: \"Durable Redis-backed background jobs with retries and workers\",\n group: \"Jobs & Messaging\",\n },\n {\n key: \"bull-board\",\n label: \"Bull Board (queue dashboard)\",\n hint: \"Web dashboard for inspecting queues and jobs — enabled outside production only, and refuses to mount unguarded (pulls queue)\",\n group: \"Jobs & Messaging\",\n },\n {\n key: \"herald\",\n label: \"Herald (RabbitMQ)\",\n hint: \"Message broker for event-driven architecture\",\n group: \"Jobs & Messaging\",\n },\n {\n key: \"notifications\",\n label: \"Notifications\",\n hint: \"Multi-channel notifications — mail + in-app database, preferences, idempotency\",\n group: \"Jobs & Messaging\",\n },\n\n // Realtime\n {\n key: \"socket\",\n label: \"Socket.IO\",\n hint: \"Realtime websocket server\",\n group: \"Realtime\",\n },\n\n // API Docs (swagger / postman / openapi) — not shipped yet; they will arrive\n // together in the unified @warlock.js/api-docs package. Re-add the selection\n // once that package exists. (Removed so the wizard can't offer unbuilt features.)\n\n // Tooling\n {\n key: \"test\",\n label: \"Testing (Vitest)\",\n hint: \"Vitest + coverage + per-worker DB/cache test setup\",\n group: \"Tooling\",\n },\n];\n\nexport type AiProviderOption = {\n /** Must match a provider/package key in core's `add` feature map. */\n key: string;\n label: string;\n hint: string;\n};\n\n/**\n * AI providers offered in the dedicated AI step. Selecting any of these pulls\n * the core `@warlock.js/ai` package automatically via the provider's `requires`\n * in core's feature map — the scaffolder never lists `ai` as a standalone pick.\n *\n * Keys are `ai-`prefixed to mirror core's renamed provider feature keys\n * (`ai-openai` → `@warlock.js/ai-openai`, etc.).\n */\nexport const aiProviders: AiProviderOption[] = [\n { key: \"ai-openai\", label: \"OpenAI\", hint: \"GPT models via the OpenAI API\" },\n {\n key: \"ai-google\",\n label: \"Google (Gemini)\",\n hint: \"Gemini models via Google AI\",\n },\n {\n key: \"ai-anthropic\",\n label: \"Anthropic (Claude)\",\n hint: \"Claude models via the Anthropic API\",\n },\n {\n key: \"ai-bedrock\",\n label: \"AWS Bedrock\",\n hint: \"Foundation models via Amazon Bedrock\",\n },\n { key: \"ai-ollama\", label: \"Ollama\", hint: \"Local models via Ollama\" },\n];\n\n/**\n * AI capability packages offered alongside the providers in the dedicated AI\n * step. These are the satellite packages that sit on top of the core\n * `@warlock.js/ai` toolkit (each pulls the core `ai` package via its `requires`\n * in core's feature map, same as the providers).\n */\nexport const aiPackages: AiProviderOption[] = [\n {\n key: \"ai-tools\",\n label: \"AI Tools\",\n hint: \"Ready-made agent tools (web search, fetch, HTTP, calculator, date-time) + MCP client/server\",\n },\n {\n key: \"ai-panoptic\",\n label: \"AI Observability (Panoptic)\",\n hint: \"Tracing + exporters + a zero-setup local dashboard\",\n },\n {\n key: \"ai-workspace\",\n label: \"AI Workspace\",\n hint: \"Policy-jailed filesystem + shell for coding agents\",\n },\n];\n\n/**\n * Feature options for the multiselect prompt, ordered by group with the group\n * surfaced in the hint (keeps a flat list scannable without group widgets).\n */\nexport function getFeatureOptions() {\n return features.map(feature => ({\n value: feature.key,\n label: feature.label,\n hint: `${feature.group} — ${feature.hint}`,\n }));\n}\n\n/**\n * Keys pre-checked in the feature multiselect.\n */\nexport function getDefaultFeatureKeys(): string[] {\n return features\n .filter(feature => feature.defaultSelected)\n .map(feature => feature.key);\n}\n\n/**\n * AI provider options for the dedicated AI multiselect step.\n */\nexport function getAiProviderOptions() {\n return aiProviders.map(provider => ({\n value: provider.key,\n label: provider.label,\n hint: provider.hint,\n }));\n}\n\n/**\n * AI capability package options for the dedicated AI multiselect step. Offered\n * together with the providers (see `getAiProviderOptions`).\n */\nexport function getAiPackageOptions() {\n return aiPackages.map(pkg => ({\n value: pkg.key,\n label: pkg.label,\n hint: pkg.hint,\n }));\n}\n\n/**\n * Every selectable key the scaffolder knows about (features + AI providers +\n * AI capability packages). Used to validate `--features` / `--ai` flags in\n * non-interactive mode.\n */\nexport function getAllFeatureKeys(): string[] {\n return [\n ...features.map(feature => feature.key),\n ...aiProviders.map(provider => provider.key),\n ...aiPackages.map(pkg => pkg.key),\n ];\n}\n"],"mappings":";;;;;;AA6DA,MAAa,WAA4B;CAEvC;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CAGA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;EACP,iBAAiB;CACnB;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CAGA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CAGA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CAGA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL,OAAO;EACP,MAAM;EACN,OAAO;CACT;CACA;EACE,KAAK;EACL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AC5C,OAAO;EACL,GAAG,SAAS,KAAI,YAAW,QAAQ,GAAG;EACtC,GAAG,YAAY,KAAI,aAAY,SAAS,GAAG;EAC3C,GAAG,WAAW,KAAI,QAAO,IAAI,GAAG;CAClC;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { hasInteractiveStdin } from "../helpers/tty.mjs";
2
2
  import { cancel } from "@clack/prompts";
3
3
 
4
- //#region ../create-warlock/src/flags/assert-flag-combinations.ts
4
+ //#region ../../packages/create-warlock/src/flags/assert-flag-combinations.ts
5
5
  /**
6
6
  * `--customize` asks for the opposite of what `--yes` and a non-TTY stdin
7
7
  * supply, and both contradictions used to resolve in SILENCE: `--yes` simply
@@ -1 +1 @@
1
- {"version":3,"file":"assert-flag-combinations.mjs","names":[],"sources":["../../../../../../create-warlock/src/flags/assert-flag-combinations.ts"],"sourcesContent":["import { cancel } from \"@clack/prompts\";\nimport type { CliFlags } from \"../commands/create-new-app/types\";\nimport { hasInteractiveStdin } from \"../helpers/tty\";\n\n/**\n * `--customize` asks for the opposite of what `--yes` and a non-TTY stdin\n * supply, and both contradictions used to resolve in SILENCE: `--yes` simply\n * won the branch, the wizard never ran, and the run looked like it had\n * succeeded while asking none of the questions the flag was passed for.\n *\n * Every OTHER flag is not a contradiction — it is an answer given early, and\n * the wizard pre-selects it rather than dropping it. See `seedFromFlags`.\n *\n * Called before any prompt and before the non-interactive branch, so a refusal\n * happens with no app directory created.\n */\nexport function assertFlagCombinations(cli: CliFlags): void {\n if (!cli.interactive) return;\n\n if (cli.yes) {\n cancel(\n \"--customize and --yes contradict each other: --customize asks every question, --yes answers them all with defaults. Pass one or the other.\",\n );\n process.exit(1);\n }\n\n if (!hasInteractiveStdin()) {\n cancel(\n \"--customize needs an interactive terminal to ask its questions, and stdin is not a TTY. Either run it in a terminal, or drop --customize and pass the answers as flags — see --help.\",\n );\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAgB,uBAAuB,KAAqB;CAC1D,IAAI,CAAC,IAAI,aAAa;CAEtB,IAAI,IAAI,KAAK;EACX,OACE,4IACF;EACA,QAAQ,KAAK,CAAC;CAChB;CAEA,IAAI,CAAC,oBAAoB,GAAG;EAC1B,OACE,sLACF;EACA,QAAQ,KAAK,CAAC;CAChB;AACF"}
1
+ {"version":3,"file":"assert-flag-combinations.mjs","names":[],"sources":["../../../../../../../packages/create-warlock/src/flags/assert-flag-combinations.ts"],"sourcesContent":["import { cancel } from \"@clack/prompts\";\nimport type { CliFlags } from \"../commands/create-new-app/types\";\nimport { hasInteractiveStdin } from \"../helpers/tty\";\n\n/**\n * `--customize` asks for the opposite of what `--yes` and a non-TTY stdin\n * supply, and both contradictions used to resolve in SILENCE: `--yes` simply\n * won the branch, the wizard never ran, and the run looked like it had\n * succeeded while asking none of the questions the flag was passed for.\n *\n * Every OTHER flag is not a contradiction — it is an answer given early, and\n * the wizard pre-selects it rather than dropping it. See `seedFromFlags`.\n *\n * Called before any prompt and before the non-interactive branch, so a refusal\n * happens with no app directory created.\n */\nexport function assertFlagCombinations(cli: CliFlags): void {\n if (!cli.interactive) return;\n\n if (cli.yes) {\n cancel(\n \"--customize and --yes contradict each other: --customize asks every question, --yes answers them all with defaults. Pass one or the other.\",\n );\n process.exit(1);\n }\n\n if (!hasInteractiveStdin()) {\n cancel(\n \"--customize needs an interactive terminal to ask its questions, and stdin is not a TTY. Either run it in a terminal, or drop --customize and pass the answers as flags — see --help.\",\n );\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAgB,uBAAuB,KAAqB;CAC1D,IAAI,CAAC,IAAI,aAAa;CAEtB,IAAI,IAAI,KAAK;EACX,OACE,4IACF;EACA,QAAQ,KAAK,CAAC;CAChB;CAEA,IAAI,CAAC,oBAAoB,GAAG;EAC1B,OACE,sLACF;EACA,QAAQ,KAAK,CAAC;CAChB;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { ALLOWED_PACKAGE_MANAGERS, getSystemPackageManagers, isValidPackageManager } from "../helpers/package-manager.mjs";
2
2
  import { cancel } from "@clack/prompts";
3
3
 
4
- //#region ../create-warlock/src/flags/assert-package-manager.ts
4
+ //#region ../../packages/create-warlock/src/flags/assert-package-manager.ts
5
5
  /**
6
6
  * Is `--pm` spelled like a package manager we support? Availability validation
7
7
  * calls this first, so an unknown executable is rejected before installation.
@@ -1 +1 @@
1
- {"version":3,"file":"assert-package-manager.mjs","names":[],"sources":["../../../../../../create-warlock/src/flags/assert-package-manager.ts"],"sourcesContent":["import { cancel } from \"@clack/prompts\";\nimport {\n ALLOWED_PACKAGE_MANAGERS,\n getSystemPackageManagers,\n isValidPackageManager,\n} from \"../helpers/package-manager\";\n\n/**\n * Is `--pm` spelled like a package manager we support? Availability validation\n * calls this first, so an unknown executable is rejected before installation.\n */\nexport function assertPackageManagerAllowed(\n requested: string | undefined,\n): void {\n if (!requested) return;\n\n if (!isValidPackageManager(requested)) {\n cancel(\n `Unknown package manager \"${requested}\" — expected one of: ${ALLOWED_PACKAGE_MANAGERS.join(\", \")}`,\n );\n process.exit(1);\n }\n}\n\n/**\n * Is `--pm` spelled right AND actually on this machine? Every CLI path uses\n * this stronger check before it selects a manager or begins scaffolding. The\n * scaffold always installs dependencies; accepting a known-unavailable\n * executable would leave a known partial project behind.\n *\n * `bun` is the case that makes this concrete. It is in\n * {@link ALLOWED_PACKAGE_MANAGERS}, so the spelling check passes.\n *\n * MUST be called after package-manager detection has completed, since\n * detection is what {@link getSystemPackageManagers} reports.\n */\nexport function assertPackageManagerAvailable(\n requested: string | undefined,\n): void {\n if (requested === undefined) return;\n\n if (!requested.trim()) {\n cancel(\n \"The --pm flag requires a package manager value (npm, yarn, pnpm, or bun).\",\n );\n process.exit(1);\n }\n\n assertPackageManagerAllowed(requested);\n\n const available = getSystemPackageManagers();\n\n if (!available.includes(requested)) {\n cancel(\n `Package manager \"${requested}\" was not found on this machine — detected: ${available.join(\", \")}. Install it, or pass one of those to --pm.`,\n );\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;AAWA,SAAgB,4BACd,WACM;CACN,IAAI,CAAC,WAAW;CAEhB,IAAI,CAAC,sBAAsB,SAAS,GAAG;EACrC,OACE,4BAA4B,UAAU,uBAAuB,yBAAyB,KAAK,IAAI,GACjG;EACA,QAAQ,KAAK,CAAC;CAChB;AACF;;;;;;;;;;;;;AAcA,SAAgB,8BACd,WACM;CACN,IAAI,cAAc,QAAW;CAE7B,IAAI,CAAC,UAAU,KAAK,GAAG;EACrB,OACE,2EACF;EACA,QAAQ,KAAK,CAAC;CAChB;CAEA,4BAA4B,SAAS;CAErC,MAAM,YAAY,yBAAyB;CAE3C,IAAI,CAAC,UAAU,SAAS,SAAS,GAAG;EAClC,OACE,oBAAoB,UAAU,8CAA8C,UAAU,KAAK,IAAI,EAAE,4CACnG;EACA,QAAQ,KAAK,CAAC;CAChB;AACF"}
1
+ {"version":3,"file":"assert-package-manager.mjs","names":[],"sources":["../../../../../../../packages/create-warlock/src/flags/assert-package-manager.ts"],"sourcesContent":["import { cancel } from \"@clack/prompts\";\nimport {\n ALLOWED_PACKAGE_MANAGERS,\n getSystemPackageManagers,\n isValidPackageManager,\n} from \"../helpers/package-manager\";\n\n/**\n * Is `--pm` spelled like a package manager we support? Availability validation\n * calls this first, so an unknown executable is rejected before installation.\n */\nexport function assertPackageManagerAllowed(\n requested: string | undefined,\n): void {\n if (!requested) return;\n\n if (!isValidPackageManager(requested)) {\n cancel(\n `Unknown package manager \"${requested}\" — expected one of: ${ALLOWED_PACKAGE_MANAGERS.join(\", \")}`,\n );\n process.exit(1);\n }\n}\n\n/**\n * Is `--pm` spelled right AND actually on this machine? Every CLI path uses\n * this stronger check before it selects a manager or begins scaffolding. The\n * scaffold always installs dependencies; accepting a known-unavailable\n * executable would leave a known partial project behind.\n *\n * `bun` is the case that makes this concrete. It is in\n * {@link ALLOWED_PACKAGE_MANAGERS}, so the spelling check passes.\n *\n * MUST be called after package-manager detection has completed, since\n * detection is what {@link getSystemPackageManagers} reports.\n */\nexport function assertPackageManagerAvailable(\n requested: string | undefined,\n): void {\n if (requested === undefined) return;\n\n if (!requested.trim()) {\n cancel(\n \"The --pm flag requires a package manager value (npm, yarn, pnpm, or bun).\",\n );\n process.exit(1);\n }\n\n assertPackageManagerAllowed(requested);\n\n const available = getSystemPackageManagers();\n\n if (!available.includes(requested)) {\n cancel(\n `Package manager \"${requested}\" was not found on this machine — detected: ${available.join(\", \")}. Install it, or pass one of those to --pm.`,\n );\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;AAWA,SAAgB,4BACd,WACM;CACN,IAAI,CAAC,WAAW;CAEhB,IAAI,CAAC,sBAAsB,SAAS,GAAG;EACrC,OACE,4BAA4B,UAAU,uBAAuB,yBAAyB,KAAK,IAAI,GACjG;EACA,QAAQ,KAAK,CAAC;CAChB;AACF;;;;;;;;;;;;;AAcA,SAAgB,8BACd,WACM;CACN,IAAI,cAAc,QAAW;CAE7B,IAAI,CAAC,UAAU,KAAK,GAAG;EACrB,OACE,2EACF;EACA,QAAQ,KAAK,CAAC;CAChB;CAEA,4BAA4B,SAAS;CAErC,MAAM,YAAY,yBAAyB;CAE3C,IAAI,CAAC,UAAU,SAAS,SAAS,GAAG;EAClC,OACE,oBAAoB,UAAU,8CAA8C,UAAU,KAAK,IAAI,EAAE,4CACnG;EACA,QAAQ,KAAK,CAAC;CAChB;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { getAiPackageOptions, getAiProviderOptions } from "../features/features-map.mjs";
2
2
 
3
- //#region ../create-warlock/src/flags/definitions.ts
3
+ //#region ../../packages/create-warlock/src/flags/definitions.ts
4
4
  const AI_FEATURE_KEYS = [...getAiProviderOptions(), ...getAiPackageOptions()].map(({ value }) => value);
5
5
  const FLAG_DEFINITIONS = [
6
6
  {
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.mjs","names":[],"sources":["../../../../../../create-warlock/src/flags/definitions.ts"],"sourcesContent":["import {\n getAiPackageOptions,\n getAiProviderOptions,\n} 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 = [\n ...getAiProviderOptions(),\n ...getAiPackageOptions(),\n].map(({ value }) => value);\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:\n \"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:\n \"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:\n '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:\n \"inferred from the invoking agent (npm_config_user_agent) or the system\",\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":";;;AAmBA,MAAM,kBAAkB,CACtB,GAAG,qBAAqB,GACxB,GAAG,oBAAoB,CACzB,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK;AAE1B,MAAa,mBAAqC;CAChD;EACE,OAAO;EACP,aAAa;EACb,cACE;CACJ;CACA;EACE,OAAO;EACP,aACE;EACF,cAAc;CAChB;CACA;EACE,OAAO;EACP,aACE;EACF,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cACE;CACJ;CACA;EACE,OAAO;EACP,aAAa,mDAAmD,gBAAgB,KAAK,IAAI,EAAE;EAC3F,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cACE;CACJ;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 {\n getAiPackageOptions,\n getAiProviderOptions,\n} 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 = [\n ...getAiProviderOptions(),\n ...getAiPackageOptions(),\n].map(({ value }) => value);\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:\n \"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:\n \"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:\n '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:\n \"inferred from the invoking agent (npm_config_user_agent) or the system\",\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":";;;AAmBA,MAAM,kBAAkB,CACtB,GAAG,qBAAqB,GACxB,GAAG,oBAAoB,CACzB,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK;AAE1B,MAAa,mBAAqC;CAChD;EACE,OAAO;EACP,aAAa;EACb,cACE;CACJ;CACA;EACE,OAAO;EACP,aACE;EACF,cAAc;CAChB;CACA;EACE,OAAO;EACP,aACE;EACF,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cACE;CACJ;CACA;EACE,OAAO;EACP,aAAa,mDAAmD,gBAAgB,KAAK,IAAI,EAAE;EAC3F,cAAc;CAChB;CACA;EACE,OAAO;EACP,aAAa;EACb,cACE;CACJ;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,7 +1,7 @@
1
1
  import { getDefaultFeatureKeys } from "../features/features-map.mjs";
2
2
  import { getPreferredPackageManager } from "../helpers/package-manager.mjs";
3
3
 
4
- //#region ../create-warlock/src/flags/seed-from-flags.ts
4
+ //#region ../../packages/create-warlock/src/flags/seed-from-flags.ts
5
5
  function seedFromFlags(cli) {
6
6
  return {
7
7
  packageManager: cli.pm ?? getPreferredPackageManager(),
@@ -1 +1 @@
1
- {"version":3,"file":"seed-from-flags.mjs","names":[],"sources":["../../../../../../create-warlock/src/flags/seed-from-flags.ts"],"sourcesContent":["import type { CliFlags } 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};\n\nexport function seedFromFlags(cli: CliFlags): WizardSeeds {\n return {\n packageManager: cli.pm ?? getPreferredPackageManager(),\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":";;;;AA0BA,SAAgB,cAAc,KAA4B;CACxD,OAAO;EACL,gBAAgB,IAAI,MAAM,2BAA2B;EACrD,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 } 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};\n\nexport function seedFromFlags(cli: CliFlags): WizardSeeds {\n return {\n packageManager: cli.pm ?? getPreferredPackageManager(),\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":";;;;AA0BA,SAAgB,cAAc,KAA4B;CACxD,OAAO;EACL,gBAAgB,IAAI,MAAM,2BAA2B;EACrD,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"}