Skip to content

apps init: allow scaffolding into the current directory - #5247

Merged
andrewnester merged 2 commits into
mainfrom
jorge.calvar/apps_init_same_dir
May 13, 2026
Merged

apps init: allow scaffolding into the current directory#5247
andrewnester merged 2 commits into
mainfrom
jorge.calvar/apps_init_same_dir

Conversation

@calvarjorge

Copy link
Copy Markdown
Contributor

What changes

Non-interactive: --name .

  • databricks apps init --name . scaffolds directly into the current
    working directory.
  • The app name is derived from the cwd basename and validated against the
    existing project-name rules ([a-z][a-z0-9-]*, ≤ 26 chars). An invalid
    basename produces an actionable error pointing at renaming the directory.
  • The cwd must be empty other than .git/ and .gitignore, so the common
    mkdir foo && cd foo && git init flow still works while avoiding any
    risk of overwriting existing user files.
  • --name . and --output-dir are mutually exclusive (one already names
    the destination).
  • The cd <name> line in the success / next-steps output is omitted when
    scaffolding in place.

Interactive

When the cwd is eligible for in-place use (empty modulo .git/.gitignore,
valid basename), the user is asked up front:

Where should we create the app?
▸ Create a new subdirectory (default)
Use the current directory ("foo")

The default focused option is "Create a new subdirectory", so anyone who
hits Enter through prompts gets today's behaviour. The in-place option is
opt-in but discoverable. If the cwd isn't eligible, the existing name
prompt runs unchanged.

Test plan

Build the CLI from this branch:

```
go build -o ./cli
```

Then try the new flow:

```

In-place scaffold (non-interactive)

mkdir /tmp/my-app && cd /tmp/my-app
git init
~/path/to/cli apps init --name .
ls -A # files land at the top level, no nested my-app/

In-place scaffold (interactive)

mkdir /tmp/foo && cd /tmp/foo
~/path/to/cli apps init # first prompt is the new selector
```

Unit tests: `go test ./cmd/apps/... ./libs/apps/prompt/...`.

`databricks apps init --name .` now scaffolds the AppKit template into
the current working directory instead of always creating a subdirectory.
The app name is derived from the cwd basename and validated against the
existing project-name rules. The directory must be empty modulo `.git/`
and `.gitignore`, which keeps the `mkdir foo && cd foo && git init`
flow working without risking overwrites.
In interactive mode, when the cwd is eligible for in-place use, the
user is asked up front whether to create a new subdirectory (default)
or use the current directory; the existing name prompt is otherwise
unchanged.
Co-authored-by: Isaac
… flow
Three fixes for the in-place scaffolding path:
- Drop .gitignore from the allow-list. The template's _gitignore rename
writes .gitignore via os.WriteFile with no exists-check, so a pre-existing
.gitignore was silently overwritten.
- Reject symlinks named like any allow-listed entry in CheckInPlaceDirectory.
Without this, a symlink named .git (or any future allow-listed dotfile)
let os.WriteFile follow the link and overwrite an arbitrary writable file.
- Skip the interactive in-place offer when --output-dir is set, and reject
"." typed at the prompt in that case. Both interactive paths previously
silently dropped --output-dir; now they return the same sentinel error
the explicit --name . flag uses.
Also factors out validateProjectNameForPrompt so the sentinel + outputDir
rules are unit-testable without a TTY.
Co-authored-by: Isaac
@andrewnester
andrewnester merged commit c659c3c into mainMay 13, 2026
31 of 32 checks passed
@andrewnester
andrewnester deleted the jorge.calvar/apps_init_same_dir branch May 13, 2026 11:47
denik pushed a commit that referenced this pull request May 20, 2026
## What changes
### Non-interactive: `--name .`
- `databricks apps init --name .` scaffolds directly into the current
working directory.
- The app name is derived from the cwd basename and validated against
the
existing project-name rules (`[a-z][a-z0-9-]*`, ≤ 26 chars). An invalid
basename produces an actionable error pointing at renaming the
directory.
- The cwd must be empty other than `.git/` and `.gitignore`, so the
common
`mkdir foo && cd foo && git init` flow still works while avoiding any
risk of overwriting existing user files.
- `--name .` and `--output-dir` are mutually exclusive (one already
names
the destination).
- The `cd <name>` line in the success / next-steps output is omitted
when
scaffolding in place.
### Interactive
When the cwd is eligible for in-place use (empty modulo
`.git`/`.gitignore`,
valid basename), the user is asked up front:
```
Where should we create the app?
▸ Create a new subdirectory (default)
Use the current directory ("foo")
```
The default focused option is "Create a new subdirectory", so anyone who
hits Enter through prompts gets today's behaviour. The in-place option
is
opt-in but discoverable. If the cwd isn't eligible, the existing name
prompt runs unchanged.
## Test plan
Build the CLI from this branch:
\`\`\`
go build -o ./cli
\`\`\`
Then try the new flow:
\`\`\`
# In-place scaffold (non-interactive)
mkdir /tmp/my-app && cd /tmp/my-app
git init
~/path/to/cli apps init --name .
ls -A # files land at the top level, no nested my-app/
# In-place scaffold (interactive)
mkdir /tmp/foo && cd /tmp/foo
~/path/to/cli apps init # first prompt is the new selector
\`\`\`
Unit tests: \`go test ./cmd/apps/... ./libs/apps/prompt/...\`.
TanishqDatabricks pushed a commit to TanishqDatabricks/cli that referenced this pull request May 22, 2026
)
## What changes
### Non-interactive: `--name .`
- `databricks apps init --name .` scaffolds directly into the current
working directory.
- The app name is derived from the cwd basename and validated against
the
existing project-name rules (`[a-z][a-z0-9-]*`, ≤ 26 chars). An invalid
basename produces an actionable error pointing at renaming the
directory.
- The cwd must be empty other than `.git/` and `.gitignore`, so the
common
`mkdir foo && cd foo && git init` flow still works while avoiding any
risk of overwriting existing user files.
- `--name .` and `--output-dir` are mutually exclusive (one already
names
the destination).
- The `cd <name>` line in the success / next-steps output is omitted
when
scaffolding in place.
### Interactive
When the cwd is eligible for in-place use (empty modulo
`.git`/`.gitignore`,
valid basename), the user is asked up front:
```
Where should we create the app?
▸ Create a new subdirectory (default)
Use the current directory ("foo")
```
The default focused option is "Create a new subdirectory", so anyone who
hits Enter through prompts gets today's behaviour. The in-place option
is
opt-in but discoverable. If the cwd isn't eligible, the existing name
prompt runs unchanged.
## Test plan
Build the CLI from this branch:
\`\`\`
go build -o ./cli
\`\`\`
Then try the new flow:
\`\`\`
# In-place scaffold (non-interactive)
mkdir /tmp/my-app && cd /tmp/my-app
git init
~/path/to/cli apps init --name .
ls -A # files land at the top level, no nested my-app/
# In-place scaffold (interactive)
mkdir /tmp/foo && cd /tmp/foo
~/path/to/cli apps init # first prompt is the new selector
\`\`\`
Unit tests: \`go test ./cmd/apps/... ./libs/apps/prompt/...\`.
bjornkpu pushed a commit to bjornkpu/databricks-cli that referenced this pull request Aug 19, 2026
…abricks#6262)
## Changes
Build released binaries with `GOFIPS140=v1.0.0`. This links the FIPS
140-3 validated Go Cryptographic Module into the binary and defaults
FIPS 140-3 mode on, so no runtime flag is needed.
## Why
Regulated environments (FedRAMP, IL5) require cryptography to come from
a validated module. This has to be set at build time: the runtime
`GODEBUG=fips140=on` only toggles the mode on whatever module was
already linked, so without the build variable, there is no validated
module in the binary and no certificate to cite.
Pinned to a frozen version rather than an alias. `v1.0.0` is the version
covered by CMVP certificate `databricks#5247`
This changes behavior for everyone, not just regulated users: the TLS
client offers only FIPS-approved suites (6 instead of 13, dropping
ChaCha20 and CBC)
CI coverage for the FIPS build is added separately in databricks#6193
## Tests
Ran the whole unit and acceptance suite against a FIPS build — no
failures. Also confirmed all six release targets (linux/darwin/windows x
amd64/arm64) cross-compile with the variable set; none of the platforms
Go excludes from FIPS mode are in our matrix.
_This PR was written by Claude Code._
Sign up for freeto 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.

4 participants

@calvarjorge@atilafassina@MarioCadenas@andrewnester