#53 [Feature]: Add interactive .env import to dopbase init
Originally created by: thomijasir
Feature description
Add an interactive zero-argument mode to dopbase init. When run from an application directory, the command should find ./.env, summarize its variables, create a new project and first environment, import the values, and offer to delete the source file.
The existing explicit form must remain available for scripts and other supported file formats:
dopbase init payment-service/development --from .env
Problem and motivation
The current command requires users to know the complete target and file syntax before they can import an existing .env. A guided path would make first-time setup quicker while preserving the explicit interface for automation.
Proposed solution
Running dopbase init in a terminal should:
- Check the configured server and validate the saved login. Prompt for login when needed.
- Read and validate
./.env. - Show the total variable count and an informational sensitive/non-sensitive split based on key names. Values must never be printed.
- Ask for import confirmation.
- Prompt for a new
project/environmenttarget and retry when the format is invalid or the project already exists. - Create the project, first environment, and encrypted secrets through the existing atomic endpoint.
- Ask whether to delete
.env, defaulting to Yes. The file must not be deleted if it changed after scanning. - Print the matching
dopbase runcommand.
The interactive flow must not update .gitignore.
Acceptance criteria
- [ ]
dopbase initstarts the guided flow in an interactive terminal. - [ ] The current explicit form, stdin support, JSON/YAML input,
--format, and--jsonkeep working. - [ ] Partial explicit arguments fail with useful command help.
- [ ] Missing, empty, or invalid
.envfiles fail before server state changes. - [ ] Variable values never appear in terminal output or error messages.
- [ ] Existing project names and race-time conflicts return to the target prompt.
- [ ] Import remains atomic and uses the current server-side encryption path.
- [ ] Declining deletion keeps
.env; changed files are never deleted. - [ ] CLI documentation, examples, and the changelog describe both init modes.
- [ ] Rust tests cover parsing, classification, target retry, import, and cleanup behavior.
Alternatives considered
The explicit command remains the right interface for automation, stdin, and non-dotenv formats. Importing into an existing project remains a separate dopbase env create and dopbase import workflow.
Additional context
This does not replace directory-scoped environment selection from issue [#15] and requires no database or public HTTP API change.
Ticket changed by: dopbase