# d1v

Adopt this skill: https://proskills.md/skills/other/d1vai-d1v-cli-skills-d1v

Page: https://proskills.md/skills/other/d1vai-d1v-cli-skills-d1v
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/d1v/SKILL.md
size: 5162
sha: d7759c406684770be51b640b5e85fde20f836510
upstream: https://github.com/d1vai/d1v-cli/blob/main/skills/d1v/SKILL.md

````text
---
name: d1v
description: Operate d1v.ai projects and container workspaces with the d1v CLI. Use when a task involves D1V authentication, project binding, workspace synchronization, container commands, environment metadata, preview deployments, deployment status, or a user-confirmed production release.
---

# d1v CLI

Use the installed `d1v` command. For automation and structured inspection, use
`--format json`; never mix JSON output with an interactive shell.

## Safety

- Never print, log, commit, or add API keys, tokens, environment values, or shell tickets to source files, command output, or repository configuration.
- Inspect authentication and project state before changing anything. Check the command exit code and query resulting state; a submitted request is not proof of success.
- Run `pull --dry-run` or `push --dry-run` before changing a local workspace, then inspect repository instructions and local changes.
- Treat preview and production as separate environments. A production release requires an interactive TTY and explicit user confirmation; do not attempt or imply a non-interactive production release.
- If a deployment fails or times out, preserve its deployment/release ID and use `deploy status` or `deploy history` rather than blindly retrying.

## Authenticate and discover

```bash
d1v auth status --format json
d1v project list --format json
d1v github status --format json
```

If authentication is missing, ask the user to run `d1v auth login`. Do not ask
them to paste a token into chat or a command line. An API key supplied through a
secure standard-input workflow can be used with `d1v auth login --api-key`.

## Bind a local workspace

```bash
d1v project get <project_id> --format json
d1v init . --project-id <project_id>
d1v pull --dry-run --format json
d1v pull
d1v push --dry-run --format json
d1v push
```

`d1v init` writes local workspace metadata. Do not use `--force` unless the
user explicitly approves replacing an existing binding.

## Run commands in a workspace

Use an interactive shell only when a person needs a terminal:

```bash
d1v shell
d1v shell <project_id>
d1v shell --organization-id <organization_id>
```

- With no target, `d1v shell` opens the personal workspace root.
- A project ID opens that project's directory. Do not combine it with `--organization-id`.
- Interactive shells require a TTY and text output. Do not use `--format json` with `d1v shell`.

For automation, Agent actions, CI, or captured exit status, use `d1v exec` and
place the remote argv after `--`:

```bash
d1v exec -- git status --short
d1v exec --project-id <project_id> -- npm test
d1v exec --organization-id <organization_id> -- pwd
d1v --format json exec --project-id <project_id> -- sh -c 'printf ok; printf problem >&2; exit 7'
```

Read `stdout`, `stderr`, `cwd`, and `exit_code`; a non-zero remote exit is a
failed action. Do not wrap commands in `sh -c` unless shell syntax is required.
Shell access uses a short-lived, single-use ticket. Never print, persist,
forward, or reconstruct terminal WebSocket URLs from that ticket.

## Environment metadata

```bash
d1v env list --project <project_id> --format json
d1v env set --project <project_id> KEY=VALUE --sensitive
```

The default list output keeps sensitive values redacted. Do not use `--reveal`,
`env get --reveal`, or `env export` unless the user explicitly asks for the
secret material and has provided a safe destination outside version control.

## Deployments

Create a preview with the explicit command when a project ID is known:

```bash
d1v deploy preview <project_id> --format json
d1v deploy status <project_id> --format json
d1v deploy history <project_id> --environment preview --format json
```

`d1v deploy preview` waits for the deployment's terminal state. Report success
only when it returns READY, and use its `production_url` when present, otherwise
its `vercel_url`. On failure, report the error and deployment ID without
repeating the request automatically.

`d1v --preview` (or `d1v --prev`) is the current-directory shortcut. It may
prompt to select or create a project and write the resulting project binding;
use it only when the user wants that local-directory workflow.

For production, first explain the pending operation and then require a clear
user confirmation in an interactive terminal:

```bash
d1v deploy prod <project_id>
```

The CLI shows release preflight information, prompts for relevant environment
decisions, creates an idempotent release, and waits for its terminal state. It
rejects non-interactive production releases. On failure, report the release
phase, error code, and message. The `d1v --prod` shortcut follows the same
confirmation and release flow for the bound current directory.

## Local runtime

```bash
d1v runtime doctor --format json
d1v agent status --format json
d1v agent pair
d1v agent start
```

Do not silently switch a requested local runtime to cloud when it is
unavailable. Explain the runtime status and ask the user how to proceed.

## References

- https://github.com/d1vai/d1v-cli
- https://www.d1v.ai/cli-install
- https://www.d1v.ai/docs/cli
- https://www.d1v.ai/openapi
````

## File: README.md
upstream: https://github.com/d1vai/d1v-cli/blob/main/README.md

````text
<div align="center">

# D1V CLI

Deploy, inspect, and work inside D1V projects from your terminal.

[![CI](https://github.com/d1vai/d1v-cli/actions/workflows/ci.yaml/badge.svg)](https://github.com/d1vai/d1v-cli/actions/workflows/ci.yaml)
[![Release](https://img.shields.io/github/v/release/d1vai/d1v-cli?display_name=tag)](https://github.com/d1vai/d1v-cli/releases)
[![crates.io](https://img.shields.io/crates/v/d1v-cli)](https://crates.io/crates/d1v-cli)
[![Homebrew](https://img.shields.io/homebrew/v/d1v?tap=d1vai%2Ftap)](https://github.com/d1vai/homebrew-tap)
[![License](https://img.shields.io/github/license/d1vai/d1v-cli)](LICENSE)
[![Stars](https://img.shields.io/github/stars/d1vai/d1v-cli)](https://github.com/d1vai/d1v-cli/stargazers)
[![Rust](https://img.shields.io/badge/rust-1.95%2B-orange)](https://www.rust-lang.org/)

Project-aware by default. Works with Codex and Claude Code. Supports cloud and local runtimes.

<samp>

**[English](README.md)** ┃ **[简体中文](README.zh-Hans.md)**

</samp>

</div>

## Quick Start

Install, authenticate, and deploy the current directory:

```sh
curl -fsSL https://d1v.ai/install/d1v-cli.sh | bash
d1v auth login --browser
d1v --preview   # or: d1v --prev
d1v --prod
```

The CLI reads `D1V_PROJECT_ID` from the current directory's `.env` first, then
from the process environment and `.d1v/project.json`. Explicit project
arguments always win. When no project can be resolved interactively, choose one
from the project picker. Cloud environment variables are merged into `.env`;
local values are kept by default when keys conflict.

Run `d1v --help` for the complete command list.

## Coding Agent Skill

The official, versioned d1v Skill lives at
[`skills/d1v/SKILL.md`](skills/d1v/SKILL.md). It gives Codex and Claude Code
safe instructions for project workspaces, container commands, preview
deployments, and user-confirmed production releases.

The curl installer uses `--install-skill auto` by default. It installs only
for Codex and Claude Code executables already available on `PATH`; it does not
install either coding agent and succeeds without changes when neither is found.
Use the same behavior manually:

```sh
d1v skill install --agent auto
```

Use `--agent codex`, `--agent claude`, or `--agent all` to explicitly choose
targets. Skills are written below `${CODEX_HOME:-~/.codex}/skills/d1v` and
`${CLAUDE_CONFIG_DIR:-~/.claude}/skills/d1v`. An identical Skill is left alone;
a different existing `SKILL.md` is backed up beside it as
`SKILL.md.d1v-backup-<UTC timestamp>` before replacement. The legacy
`https://www.d1v.ai/cli-skill.md` URL remains available and redirects to this
canonical file.

## D1V Mobile App

Pair the terminal workflow with [`d1vai_app`](https://github.com/d1vai/d1vai_app),
the official open-source Flutter client for d1v.ai. Use the CLI for fast local
and CI workflows, and the mobile app to create projects, continue AI sessions,
inspect files, monitor deployments, and manage your workspace away from a desk.

[![d1vai_app Stars](https://img.shields.io/github/stars/d1vai/d1vai_app?label=d1vai_app%20stars)](https://github.com/d1vai/d1vai_app/stargazers)
[![Flutter](https://img.shields.io/badge/Flutter-3.x-02569B?logo=flutter&logoColor=white)](https://flutter.dev/)
[![Mobile](https://img.shields.io/badge/mobile-iOS%20%7C%20Android-16a34a)](https://github.com/d1vai/d1vai_app/releases)

The companion app supports iOS and Android and includes its own screenshots,
release downloads, and developer guide:

- [d1vai_app repository](https://github.com/d1vai/d1vai_app)
- [Mobile releases](https://github.com/d1vai/d1vai_app/releases)
- [d1v.ai documentation](https://www.d1v.ai/docs/overview)

## Local Runtime

D1V supports a local runtime in addition to the existing cloud runtime.

Role split:

- `opcode-api`: the local runtime server
- `d1v-cli`: installer, launcher, supervisor, connector
- `backend_admin`: control plane and runtime router
- `d1vai`: unified frontend

The frontend never connects directly to the user machine. The local agent opens an outbound connection to D1V cloud.

### Local Runtime Quickstart

1. Install and inspect the local runtime:

```sh
d1v runtime doctor
bash scripts/install-opcode-runtime.sh --home ~/d1v-home
```

2. Pair the machine:

```sh
d1v agent pair
```

Or keep using a pairing code generated in the web UI:

```sh
d1v agent pair --code <pairing-code>
```

3. Start the local runtime:

```sh
d1v agent start
```

4. Create or bind local project directories:

```sh
d1v agent project create --project-id <project_id> --name my-app
d1v agent project import --path ~/work/my-app --project-id <project_id>
d1v agent project bind --project-id <project_id> --path ~/work/my-app
```

Backward-compatible entry:

```sh
d1v agent init-runtime --project-id <project_id> --path ~/work/my-app
```

### Local Runtime Behavior

- Runtime switching affects new sessions only.
- Existing sessions stay pinned to the runtime where they started.
- If a project is bound to local runtime and the device is offline, requests return an explicit local-runtime error instead of silently falling back to cloud.
- Project creation/import flows may still use cloud opcode directly before runtime binding exists.

### Public Expose

CLI free expose does not require a running node agent:

```sh
d1v expose 3000
d1v expose list
d1v expose close <binding_id>
```

Platform node ingress stays on a separate command path:

```sh
d1v node expose 3000 --node-id <platform-node-id>
d1v node expose list
d1v node expose close <binding_id>
```

Current expose modes:

- `cli_free_relay`: returns a public `https://*.cli-free.d1v.dev` URL for login-backed temporary CLI relays
- `cloudflare_tunnel`: returns a public `https://*.node.d1v.dev` URL for platform nodes
- `reverse_relay`: internal fallback mode used by local/customer relays behind the CLI-free entry

`d1v expose` currently targets HTTP traffic. Browser terminal and session WebSocket flows still use the existing backend relay path.

### Platform Node

Platform nodes now use a single control origin for runtime-agent ingress. The recommended bootstrap form is:

```sh
d1v node start --key <platform-node-key> --control-origin https://{your-host-or-name}-node.d1v.dev
```

If `--control-origin` is omitted, the runtime-agent falls back to its own public IP detection and control-plane registration flow.

### Privacy Boundary

Current phase:

- paired devices only
- outbound-only relay
- short-lived pairing code
- stored device public key

Current limitation:

- relay traffic is not zero-knowledge
- platform metadata and chat/session records still follow existing D1V persistence behavior

For deeper architecture details, see [docs/d1v-agent-architecture.md](../docs/d1v-agent-architecture.md).

## Install

Recommended:

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

Install page:

```sh
https://d1v.ai/cli-install
```

Alternatives:

```sh
brew install d1vai/tap/d1v
cargo binstall d1v-cli
cargo install --locked d1v-cli
```

After install:

```sh
d1v auth login
d1v project list
d1v github status
```

To authenticate through an existing browser session and save a revocable device
API key, use `d1v auth login --browser`. The browser approves a one-time,
10-minute session; the CLI stores the resulting key in `~/.d1v/config.toml`.

Upgrade later:

```sh
d1v upgrade
d1v upgrade --version v0.1.5
d1v uninstall
```

`d1v upgrade` replaces only the executable. Your login remains in
`~/.d1v/config.toml`; upgrading does not sign you out or copy credentials into
the release archive.

### 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

| Var
````
