Skip to content

Add dcli status command#378

Open
srobakidze-dashlane wants to merge 2 commits intomasterfrom
feat/315-add-dcli-status
Open

Add dcli status command#378
srobakidze-dashlane wants to merge 2 commits intomasterfrom
feat/315-add-dcli-status

Conversation

@srobakidze-dashlane
Copy link
Copy Markdown
Collaborator

@srobakidze-dashlane srobakidze-dashlane commented Apr 2, 2026

Add dcli status command

Problem

Users who integrate dcli into scripts (e.g. password autofill in qutebrowser) currently have no lightweight way to check whether the CLI is logged in and whether the vault is unlocked. They resort to running commands like dcli sync or dcli password and parsing their output or exit codes, which results in redundant API calls and can trigger rate limits.

Solution

This MR adds a new top-level dcli status command that reports the current authentication and lock state of the CLI without making any API calls. It only reads from the local SQLite database and the OS keychain.

Example output

~> dcli status
Logged in: yes
Login: user@example.com
Locked: no

If not logged in:

~> dcli status
Logged in: no

How it works

  1. Logged in β€” Checks whether the local database file exists and contains a registered device configuration.
  2. Locked β€” Determines lock state by checking:
    • Whether shouldNotSaveMasterPassword is set (always considered locked β€” user must type password each time).
    • Whether an encrypted master password is stored in the database.
    • Whether the local key can be retrieved from the OS keychain (@napi-rs/keyring).

All checks are purely local β€” no network requests, no authentication prompts, no vault decryption.

Files changed

File Change
src/command-handlers/status.ts New β€” runStatus handler and isVaultLocked helper
src/command-handlers/index.ts Added status module export
src/commands/index.ts Registered dcli status as a top-level command

Testing

  • Run dcli status when logged out β†’ outputs Logged in: no
  • Run dcli status when logged in and unlocked β†’ outputs Logged in: yes, Login: <email>, Locked: no
  • Run dcli lock then dcli status β†’ outputs Locked: yes
  • Verify no network calls are made (e.g. via --debug flag or network monitoring)

Closes: #315

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.

Add dcli status

1 participant