Skip to content

feat(cli): add scaffold command to set up an existing app (3/3)#538

Open
moranshe-max wants to merge 1 commit into
feature/env-token-authfrom
feature/init-command
Open

feat(cli): add scaffold command to set up an existing app (3/3)#538
moranshe-max wants to merge 1 commit into
feature/env-token-authfrom
feature/init-command

Conversation

@moranshe-max

@moranshe-max moranshe-max commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Note

Description

Adds a new base44 scaffold command that sets up a local project directory for an existing Base44 app, rather than minting a new one like create does. The command resolves the target app id from --app-id or the BASE44_APP_ID env var, renders the backend-only template without clobbering pre-existing files, writes the app config, and runs the shared post-scaffold setup (push entities, deploy site, install skills, print summary).

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Add scaffold command (cli/commands/project/scaffold.ts) that scaffolds the current directory for an existing app, resolving the app id from --app-id or BASE44_APP_ID and failing with a helpful hint when neither is present.
  • Register the command in cli/program.ts.
  • Add initProjectFiles() in core/project/create.ts — like createProjectFiles() but skips the createProject() API call since the app already exists, and skips files that already exist so scaffolding never clobbers existing files like .gitignore.
  • Extend renderTemplate() in core/project/template.ts with a skipExisting option; it now returns the destination-relative paths of any skipped files.
  • Document the create/scaffold split and their shared post-scaffold logic in docs/commands.md.
  • Add tests/cli/scaffold.spec.ts covering app-id resolution precedence (flag over env), the missing-app-id error, the no-create-API behavior, and non-destructive scaffolding.

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated docs/ (AGENTS.md) if I made architectural changes

Additional Notes

scaffold reuses the post-scaffold logic shared with create via project/scaffold-shared.ts (completeProjectSetup, getTemplateById, printProjectSummary). It runs non-interactively and skips site deployment by default, supporting --no-skills to opt out of AI agent skills installation.


🤖 Generated by Claude | 2026-06-10 12:46 UTC | f4c963c

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.54-pr.538.f4c963c

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.54-pr.538.f4c963c"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.54-pr.538.f4c963c"
  }
}

Preview published to npm registry — try new features instantly!

@moranshe-max moranshe-max force-pushed the feature/init-command branch from 7a9d632 to 2ec38c9 Compare June 9, 2026 11:23
@moranshe-max moranshe-max force-pushed the feature/env-token-auth branch 2 times, most recently from 8244989 to e286bf4 Compare June 9, 2026 11:31
@moranshe-max moranshe-max force-pushed the feature/init-command branch from 2ec38c9 to afa746c Compare June 9, 2026 11:31
@moranshe-max moranshe-max force-pushed the feature/env-token-auth branch from e286bf4 to 46bf24d Compare June 9, 2026 11:55
@moranshe-max moranshe-max force-pushed the feature/init-command branch from afa746c to 8dbce4c Compare June 9, 2026 11:55
@moranshe-max moranshe-max force-pushed the feature/env-token-auth branch from 46bf24d to dd70d92 Compare June 9, 2026 12:04
@moranshe-max moranshe-max force-pushed the feature/init-command branch 2 times, most recently from 722fd10 to b7f735c Compare June 9, 2026 12:40
@moranshe-max moranshe-max force-pushed the feature/env-token-auth branch 2 times, most recently from e502594 to 48e9697 Compare June 9, 2026 12:52
@moranshe-max moranshe-max force-pushed the feature/init-command branch from b7f735c to b9a7845 Compare June 9, 2026 12:52
@moranshe-max moranshe-max force-pushed the feature/env-token-auth branch from 48e9697 to ab0b4ea Compare June 9, 2026 12:58
@moranshe-max moranshe-max force-pushed the feature/init-command branch 3 times, most recently from 4bf2800 to e68a9cc Compare June 9, 2026 13:56
@moranshe-max moranshe-max force-pushed the feature/env-token-auth branch from ab0b4ea to 54f3fe5 Compare June 9, 2026 13:56
@moranshe-max moranshe-max changed the title feat(cli): add init command for Stripe Projects handoff (3/3) feat(cli): add init command to scaffold an existing app (3/3) Jun 9, 2026
@moranshe-max moranshe-max changed the title feat(cli): add init command to scaffold an existing app (3/3) feat(cli): add init command to scaffold an existing app (3/4) Jun 9, 2026
@moranshe-max moranshe-max force-pushed the feature/init-command branch from e68a9cc to 6ff70b0 Compare June 10, 2026 08:08
@moranshe-max moranshe-max changed the title feat(cli): add init command to scaffold an existing app (3/4) feat(cli): add scaffold command to set up an existing app (3/4) Jun 10, 2026
@moranshe-max moranshe-max changed the title feat(cli): add scaffold command to set up an existing app (3/4) feat(cli): add scaffold command to set up an existing app (3/3) Jun 10, 2026

/**
* Post-scaffold steps shared by `create` and `init`: optionally push the
* Post-scaffold steps shared by `create` and `scaffold`: optionally push the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

clean up comments

Comment on lines +15 to +17
* Resolves the existing app ID from --app-id or the BASE44_APP_ID environment
* variable (e.g. written to `.env` by a CI pipeline or provisioning tool).
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

no need for the comment

name: string | undefined,
options: ScaffoldOptions,
): Promise<RunCommandResult> {
const appId = resolveAppId(options);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Consider checking if we're already inside an existing project? i think we're doing the same for create?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

oh i think you do this check at initProjectFile

Comment on lines +27 to +29
message:
"Or set the BASE44_APP_ID environment variable (e.g. via .env)",
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lets not show this to users yet, this is a feature we want to support in general, so just show the first message

Comment on lines +67 to +71
if (skippedFiles.length > 0) {
log.info(
`Kept existing file${skippedFiles.length > 1 ? "s" : ""}: ${skippedFiles.join(", ")}`,
);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we need this?

Comment thread packages/cli/tests/cli/scaffold.spec.ts Outdated
t.expectResult(result).toContain("BASE44_APP_ID");
});

it("authenticates via env credentials without a stored login", async () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we tested this in the last PR.. not really relevant for scafolding

@kfirstri kfirstri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

noice, small changes

@moranshe-max moranshe-max force-pushed the feature/env-token-auth branch from 54f3fe5 to 8cc7307 Compare June 10, 2026 12:13
@moranshe-max moranshe-max force-pushed the feature/init-command branch 2 times, most recently from f5ecf5c to c952bd2 Compare June 10, 2026 12:24
@moranshe-max moranshe-max force-pushed the feature/env-token-auth branch from 8cc7307 to 9daf582 Compare June 10, 2026 12:32
@moranshe-max moranshe-max force-pushed the feature/init-command branch from c952bd2 to 94b420d Compare June 10, 2026 12:35
@moranshe-max moranshe-max force-pushed the feature/env-token-auth branch from 9daf582 to e2744ae Compare June 10, 2026 12:44
Adds `base44 scaffold`, which sets up a local project for an
already-existing Base44 app (provisioned externally, e.g. via env vars)
without creating a new app. It resolves the app id from `--app-id` or the
`BASE44_APP_ID` environment variable, renders the minimal backend-only
template into the current directory (preserving any existing files), and
runs the shared post-scaffold setup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@moranshe-max moranshe-max force-pushed the feature/init-command branch from 94b420d to 37a9767 Compare June 10, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants