Skip to content

d1vai/d1v-cli

Repository files navigation

D1V CLI

Experimental CLI for d1v.ai.

ci workflow

English简体中文

Commands

Run d1v --help for all available commands.

Install

Recommended:

curl -fsSL https://d1v.ai/install/d1v-cli.sh | bash

Install page:

https://d1v.ai/cli-install

Alternatives:

brew install d1v-ai/tap/d1v
cargo binstall d1v-cli
cargo install --locked d1v-cli

After install:

d1v auth login
d1v project list
d1v github status

Upgrade later:

d1v upgrade
d1v upgrade --version v0.1.4
d1v uninstall

Global Options

Option Description Default
--format Output format (text, json) text
--color Color output auto
--lang Display language System / Config
-v Increase log verbosity warn

Environment Variables

Variable Description
D1V_AUTH_TOKEN Auth token
D1V_BASE_URL API base URL
D1V_FORMAT Output format
D1V_LANG Display language
D1V_LOG_FILE Log file path
D1V_RECORD_FILE HTTP recording file
NO_COLOR Disable color output
RUST_LOG Log filter

Authentication

Command Description
d1v auth login Log in
d1v auth logout Log out
d1v auth status Show auth status

Configuration

Command Description
d1v config show Show current configuration
d1v config get Get a config value
d1v config set Set a config value
d1v config list List available config keys
d1v config path Print config file path
d1v config reset Reset configuration to defaults
d1v config edit Open config file in editor

Available config keys:

Key Description
base_url API base URL
language Display language override

User

Command Description
d1v user info Show current user info
d1v user update Update user info
d1v user get Get a public user
d1v user list List all users

Password

Command Description
d1v user password set Set a password
d1v user password reset Reset password

Email

Command Description
d1v user email bind Bind an email
d1v user email change Change email

Invitation & Onboarding

Command Description
d1v user invitation accept Accept an invitation
d1v user invitation list List invited users
d1v user onboard Mark onboarding as complete

Activity

Command Description
d1v user activity View prompt daily activity

Diagnostics

Command Description
d1v debug Show debug information
d1v upgrade Check for updates and self-upgrade
d1v uninstall Remove the current d1v executable

Project Workflows

These commands require authentication. Start with:

d1v auth status
d1v auth login

Core Resources

Area Commands
Projects `d1v project list
Sessions `d1v session run
Deploys `d1v deploy preview
GitHub `d1v github status
Database `d1v db schema

GitHub Handoff

Use CLI first, then jump to web only when setup is required:

d1v github status
d1v github bind
d1v github installations
d1v github repos --installation-id 123456

If GitHub App installation or OAuth binding is incomplete, d1v github bind opens the correct handoff page, including https://d1v.ai/setting?tab=github when needed.

Database And Migration Smoke Checklist

After logging in and choosing a project id, the smallest end-to-end validation flow is:

d1v db token issue <project_id> --scopes db:read,migrate
d1v db schema <project_id>
d1v db rows list <project_id> --schema public --table your_table
d1v db migrate plan <project_id> --sql 'CREATE TABLE IF NOT EXISTS smoke_cli(id serial primary key);'

Useful follow-up commands:

d1v db migrate validate <plan_id>
d1v db migrate approve <plan_id>
d1v db migrate auto-review <approval_id>

Development

Prerequisites

Build

cargo build

Test

cargo test

Run

cargo run

Install

cargo install --path d1v-cli

Debugging

Environment

Check version, config path, and token status:

d1v debug

Logging

Daily log files are written to ~/.d1v/d1v.YYYY-MM-DD.log, keeping the last 7 days.

Increase stderr verbosity with -v (-v info, -vv debug, -vvv trace):

d1v -vv auth login

RUST_LOG is also supported when -v is not set:

RUST_LOG=debug d1v auth login

Write logs to a custom file:

d1v --log-file trace.log auth login

HTTP Recording

Capture HTTP traffic to a JSON file for inspection.

Enable the record feature:

cargo install --path d1v-cli --features record

Run with recording:

d1v --record trace.json auth login

Config keys available with the record feature:

Key Description
record.enabled Enable recording by default
record.dir Directory to write recording files into

About

Experimental CLI for d1v.ai

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors