Menu ▾ ▴

#53 [Feature]: Add interactive .env import to dopbase init

closed
nobody
2026-09-20
2026-09-20
Anonymous
No

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:

  1. Check the configured server and validate the saved login. Prompt for login when needed.
  2. Read and validate ./.env.
  3. Show the total variable count and an informational sensitive/non-sensitive split based on key names. Values must never be printed.
  4. Ask for import confirmation.
  5. Prompt for a new project/environment target and retry when the format is invalid or the project already exists.
  6. Create the project, first environment, and encrypted secrets through the existing atomic endpoint.
  7. Ask whether to delete .env, defaulting to Yes. The file must not be deleted if it changed after scanning.
  8. Print the matching dopbase run command.

The interactive flow must not update .gitignore.

Acceptance criteria

  • [ ] dopbase init starts the guided flow in an interactive terminal.
  • [ ] The current explicit form, stdin support, JSON/YAML input, --format, and --json keep working.
  • [ ] Partial explicit arguments fail with useful command help.
  • [ ] Missing, empty, or invalid .env files 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.

Related

Tickets: #15
Tickets: #54

Discussion

  • Anonymous

    Anonymous - 2026-09-20

    Ticket changed by: dopbase

    • status: open --> closed
     

Log in to post a comment.