@base44-preview/cli 0.0.54-pr.538.d4fa204 → 0.0.54-pr.539.1da48ad

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.
package/dist/cli/index.js CHANGED
@@ -253152,6 +253152,30 @@ async function executeCreate({
253152
253152
  return await completeProjectSetup({ projectId, name: name2, resolvedPath, deploy: deploy5, skills, isInteractive }, { log, runTask: runTask2 });
253153
253153
  }
253154
253154
  async function createAction({ log, runTask: runTask2, isNonInteractive }, name2, options) {
253155
+ const existingAppId = process.env.BASE44_APP_ID;
253156
+ if (existingAppId) {
253157
+ if (isNonInteractive) {
253158
+ throw new InvalidInputError(`BASE44_APP_ID is set (${existingAppId}) — this environment already has a Base44 app, so \`create\` won't make a new one.`, {
253159
+ hints: [
253160
+ {
253161
+ message: "Run `base44 init` to scaffold a project for the existing app"
253162
+ },
253163
+ {
253164
+ message: "Or unset BASE44_APP_ID to create a new app with `base44 create`"
253165
+ }
253166
+ ]
253167
+ });
253168
+ }
253169
+ const proceed = await Re({
253170
+ message: `BASE44_APP_ID is set (${existingAppId}). This environment already has a Base44 app — \`base44 init\` scaffolds for it, while \`create\` makes a new one. Create a new app anyway?`,
253171
+ initialValue: false
253172
+ });
253173
+ if (Ct(proceed) || !proceed) {
253174
+ return {
253175
+ outroMessage: "Run `base44 init` to scaffold a project for the existing app"
253176
+ };
253177
+ }
253178
+ }
253155
253179
  if (name2 && !options.path) {
253156
253180
  options.path = `./${import_kebabCase.default(name2)}`;
253157
253181
  }
@@ -253284,29 +253308,22 @@ function resolveAppId(options) {
253284
253308
  hints: [
253285
253309
  { message: "Pass it explicitly with --app-id <id>" },
253286
253310
  {
253287
- message: "Or set BASE44_APP_ID (the Stripe Projects CLI writes it to .env via `stripe projects env --pull`)"
253311
+ message: "Or set the BASE44_APP_ID environment variable (e.g. via .env)"
253288
253312
  }
253289
253313
  ]
253290
253314
  });
253291
253315
  }
253292
253316
  return appId;
253293
253317
  }
253294
- async function executeInit({
253295
- template: template2,
253296
- name: rawName,
253297
- description,
253298
- appId,
253299
- projectPath,
253300
- deploy: deploy5,
253301
- skills,
253302
- isInteractive
253303
- }, { log, runTask: runTask2 }) {
253304
- const name2 = rawName.trim();
253305
- const resolvedPath = resolve6(projectPath);
253318
+ async function initAction({ log, runTask: runTask2 }, name2, options) {
253319
+ const appId = resolveAppId(options);
253320
+ const resolvedPath = resolve6("./");
253321
+ const projectName = (name2 ?? basename4(resolvedPath)).trim();
253322
+ const template2 = await getTemplateById("backend-only");
253323
+ log.info(`Initializing project at ${resolvedPath}`);
253306
253324
  const { projectId, skippedFiles } = await runTask2("Setting up your project...", async () => {
253307
253325
  return await initProjectFiles({
253308
- name: name2,
253309
- description: description?.trim(),
253326
+ name: projectName,
253310
253327
  path: resolvedPath,
253311
253328
  template: template2,
253312
253329
  appId
@@ -253319,83 +253336,24 @@ async function executeInit({
253319
253336
  log.info(`Kept existing file${skippedFiles.length > 1 ? "s" : ""}: ${skippedFiles.join(", ")}`);
253320
253337
  }
253321
253338
  setAppConfig({ id: projectId, projectRoot: resolvedPath });
253322
- return await completeProjectSetup({ projectId, name: name2, resolvedPath, deploy: deploy5, skills, isInteractive }, { log, runTask: runTask2 });
253323
- }
253324
- async function initInteractive(appId, options, ctx) {
253325
- const templates = await listTemplates();
253326
- const templateOptions = templates.map((t) => ({
253327
- value: t,
253328
- label: t.name,
253329
- hint: t.description
253330
- }));
253331
- const result = await Oe({
253332
- template: () => Je({
253333
- message: "Pick an option",
253334
- options: templateOptions
253335
- }),
253336
- name: () => {
253337
- return options.name ? Promise.resolve(options.name) : Ze({
253338
- message: "What is the name of your project?",
253339
- placeholder: basename4(process.cwd()),
253340
- initialValue: basename4(process.cwd()),
253341
- validate: (value) => {
253342
- if (!value || value.trim().length === 0) {
253343
- return "Every project deserves a name";
253344
- }
253345
- }
253346
- });
253347
- },
253348
- projectPath: () => Ze({
253349
- message: "Where should we set up your project?",
253350
- placeholder: "./",
253351
- initialValue: options.path ?? "./"
253352
- })
253353
- }, {
253354
- onCancel: onPromptCancel
253355
- });
253356
- return await executeInit({
253357
- template: result.template,
253358
- name: result.name,
253359
- appId,
253360
- projectPath: result.projectPath,
253361
- deploy: options.deploy,
253362
- skills: options.skills,
253363
- isInteractive: true
253364
- }, ctx);
253365
- }
253366
- async function initNonInteractive(appId, options, ctx) {
253367
- const projectPath = options.path ?? "./";
253368
- const name2 = options.name ?? basename4(resolve6(projectPath));
253369
- ctx.log.info(`Initializing project at ${resolve6(projectPath)}`);
253370
- const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
253371
- return await executeInit({
253372
- template: template2,
253373
- name: name2,
253374
- appId,
253375
- projectPath,
253376
- deploy: options.deploy,
253339
+ return await completeProjectSetup({
253340
+ projectId,
253341
+ name: projectName,
253342
+ resolvedPath,
253343
+ deploy: false,
253377
253344
  skills: options.skills,
253378
253345
  isInteractive: false
253379
- }, ctx);
253380
- }
253381
- async function initAction({ log, runTask: runTask2, isNonInteractive }, name2, options) {
253382
- const appId = resolveAppId(options);
253383
- const opts = { ...options, name: options.name ?? name2 };
253384
- const ctx = { log, runTask: runTask2 };
253385
- if (isNonInteractive) {
253386
- return await initNonInteractive(appId, opts, ctx);
253387
- }
253388
- return await initInteractive(appId, opts, ctx);
253346
+ }, { log, runTask: runTask2 });
253389
253347
  }
253390
253348
  function getInitCommand() {
253391
253349
  return new Base44Command("init", {
253392
253350
  requireAppConfig: false,
253393
253351
  fullBanner: true
253394
- }).description("Scaffold a local project for an existing Base44 app (e.g. one provisioned by the Stripe Projects CLI)").addArgument(new Argument("name", "Project name").argOptional()).option("--app-id <id>", "Existing Base44 app ID (defaults to the BASE44_APP_ID environment variable)").option("-p, --path <path>", "Path where to set up the project (defaults to the current directory)").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").option("--no-skills", "Skip AI agent skills installation").addHelpText("after", `
253352
+ }).description("Scaffold a local project for an existing Base44 app").addArgument(new Argument("name", "Project name").argOptional()).option("--app-id <id>", "Existing Base44 app ID (defaults to the BASE44_APP_ID environment variable)").option("--no-skills", "Skip AI agent skills installation").addHelpText("after", `
253395
253353
  Examples:
253396
- $ base44 init Scaffolds in the current dir using $BASE44_APP_ID
253397
- $ base44 init --app-id app_123 Scaffolds in the current dir for the given app
253398
- $ base44 init my-app --app-id app_123 Scaffolds in the current dir named "my-app"`).action(initAction);
253354
+ $ base44 init Scaffolds the current dir for $BASE44_APP_ID
253355
+ $ base44 init --app-id app_123 Scaffolds the current dir for the given app
253356
+ $ base44 init my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(initAction);
253399
253357
  }
253400
253358
 
253401
253359
  // src/cli/commands/project/link.ts
@@ -261822,4 +261780,4 @@ export {
261822
261780
  CLIExitError
261823
261781
  };
261824
261782
 
261825
- //# debugId=C760C3B8B75787D664756E2164756E21
261783
+ //# debugId=C659EAC64DBB54EC64756E2164756E21