feat: make apps init interactive by default, simplify flow#5112
feat: make apps init interactive by default, simplify flow#5112jamesbroadhead wants to merge 2 commits intomainfrom
Conversation
- Add --interactive flag (default true) replacing implicit flagsMode.
Passing --name or --deploy now pre-fills values while still showing
prompts. Use --interactive=false to skip all prompts.
- Remove the description prompt from the interactive flow (--description
flag still works for explicit use).
- Auto-fill lakebase database branch with "production" instead of
prompting.
- Don't auto-run the app after creation; always print the next-steps
command instead.
- Generate a default project name ("my-app", "my-app-1", etc.) when
--interactive=false and --name is not provided.
Co-authored-by: Isaac
Approval status: pending
|
- Validate required resources in both interactive and non-interactive paths: in interactive mode, --plugins preselection skips the prompt step and previously also skipped validation, so apps could be scaffolded with no warehouse configured. - Reject empty --set values: the prefix check accepted "p.r.id=" as if a value had been supplied. - Error when --interactive is true (default) but the terminal does not support prompts, instead of silently auto-generating "my-app" and using defaults for every other prompted field. - generateProjectName now treats only os.ErrNotExist as "available"; permission/IO errors no longer pick a name that may collide with an inaccessible directory. Bound the loop at 1000 to avoid pathological spins. Co-authored-by: Isaac
pkosiec
left a comment
There was a problem hiding this comment.
A few comments. Adding --interactive flag and removing app description prompt are good additions, same with generating the app name (I'd add it to the interactive flow too) 👍
| @@ -182,56 +159,38 @@ func PromptForProjectName(ctx context.Context, outputDir string) (string, error) | |||
| return name, nil | |||
| } | |||
|
|
|||
| // PromptForDeployAndRun prompts for post-creation deploy and run options. | |||
There was a problem hiding this comment.
Not sure about this: on one hand you're right, it simplifies the flow, on the other, we make the remote bridge option almost impossible to find 🤔
Maybe let's remove the description as you did and keep the run options as they were before?
| @@ -180,8 +170,9 @@ Environment variables: | |||
| cmd.Flags().StringSliceVar(&pluginsFlag, "plugins", nil, "Alias for --features") | |||
| _ = cmd.Flags().MarkHidden("plugins") | |||
| cmd.Flags().BoolVar(&deploy, "deploy", false, "Deploy the app after creation") | |||
| cmd.Flags().StringVar(&run, "run", "", "Run the app after creation (none, dev, dev-remote)") | |||
| cmd.Flags().BoolVar(&autoApprove, "auto-approve", false, "Skip confirmation prompts for optional resources. Optional resources are only configured when their values are provided via --set.") | |||
| cmd.Flags().StringVar(&run, "run", "", "Deprecated: auto-run removed, use 'databricks apps dev' after init") | |||
| _ = cmd.Flags().MarkDeprecated("run", "auto-run has been removed; use 'databricks apps dev' after init") | |||
There was a problem hiding this comment.
As posted already, I'd revert this to keep the run options, mostly to promote the remote bridge option 👍
| } | ||
|
|
||
| // defaultDatabaseBranch is the Lakebase branch used for all new apps. | ||
| const defaultDatabaseBranch = "production" |
There was a problem hiding this comment.
We cannot do this, because not all projects have production branch. Brand-new ones - yes, older - not necessarily. Another reason I'd keep the branch selection as it is - an app might be initialized for a dev/preview environment, which could be a different branch but still the same project.
Also, as a side note, I don't think the changes was tested:
- The branch is a full path, not just a name (that's how the Lakebase API is designed)
- When I built the CLI and tried to select the Lakebase project, nothing shows up.
On this PR:
On latest CLI:
| return err | ||
| if isInteractive { | ||
| // Prompt includes validation for name format AND directory existence | ||
| name, err := prompt.PromptForProjectName(ctx, opts.outputDir) |
| // modes: interactive prompts may have been skipped (e.g. --plugins preselected | ||
| // without --features), and an empty --set value would otherwise pass the |
There was a problem hiding this comment.
I don't think there is a --plugin flag?

Summary
--interactiveflag (defaulttrue) replacing implicit flags-mode.--nameand--deploynow pre-fill values while still showing prompts. Use--interactive=falsefor fully non-interactive mode.--descriptionflag still works).--runflag.my-app,my-app-1, etc.) when--interactive=falseand--namenot provided.Test plan
go test ./cmd/apps/ ./libs/apps/prompt/)--interactiveflag default,generateProjectNamewith suffix bumpingdatabricks apps initshows interactive promptsdatabricks apps init --name fooshows interactive prompts with name pre-filleddatabricks apps init --interactive=falsegenerates project with defaultsThis pull request was AI-assisted by Isaac.