DAL CLI Design

Principles: Intuitive, Off/On-chain, AI-forward.


Branding


Help Structure (Use Case First)

Commands are grouped by what users want to do, not implementation:

Section Focus
Get Started new, init, init <stack>, run, test
Build & Develop check, fmt, lint, watch, repl, bench, profile, optimize
AI & Code Assistance ai code, explain, review, audit, test, fix, optimize-gas
Agents & Automation agent create, send, list, mold
Blockchain chain list, gas-price, balance, mint, asset
Data & Infrastructure crypto, db, cloud
Devices & IoT iot register, status, ai-predict
Tools web, convert, doc, completions, serve (with optional --venv <name>)

AI Integration (Current & Future)

Current: ai commands are prominent — code generation, explanation, review, audit, test generation, fixes, gas optimization.

Future-ready:


Project-Type Agnostic

The same help works for:

Quick examples in help cover multiple project types.


Files


Where We Are (Current State)

Implemented and solid

Area Status Notes
clap structure Done Full Commands enum, ChainSubcommand fully typed, global flags (--quiet, --verbose, --no-banner, --color)
Help structure Done Use-case-first sections in cli_design::help_content(); custom print_help (no Phase labels)
Branding Done Banner (box-drawing), tagline, --no-banner / --quiet respected in help/version
Dispatch Done All commands wired in main.rs; chain uses chain_subcommand_to_args
REPL Basic dal repl: read-eval-print loop, help/exit/quit, expression/statement eval; no colors, no history, no multiline
Debug Stub dal debug <file> prints “planned” features (step, inspect, call stack); runs lex/parse only
Watch Done File watch, re-run on change, simple console messages

Init with stack templates (design)

Goal: All dal init variants operate in the current directory and are additive. dal init sets up DAL there; dal init js (or rs, sol) adds that stack’s template files to the current directory so you can mix stacks in one repo.

So: init = add this template here. Users can run dal init then dal init js, or run dal init js in an existing project, to get a mixed stack in one directory.

Always add DAL if not there; protect dal.toml. When adding a stack template (dal init js | rs | sol), if dal.toml does not exist, create a minimal one so the directory is DAL-aware. If dal.toml already exists, do not overwrite it — leave the user's config and content intact. Same for plain dal init: we already fail when dal.toml exists (refuse to overwrite). Rule: ensure dal.toml exists when adding a stack, and never overwrite an existing dal.toml.

Minimum template prints for all. Every init variant (dal init, dal init dal, dal init agent, js, rs, sol) uses minimal console output: one short summary line (e.g. "Initialized DAL project." or "Added js template."). No per-file "Created …" lines. When --quiet is set, suppress the summary as well. Same rule for all templates.

Implementation sketch: Init { template }; for "dal" use current behavior (create dal.toml etc., fail if exists). For "js" | "rs" | "sol", add only that template’s files to the current directory (create dirs like contracts/ or src/ if needed, write or merge package.json / Cargo.toml; avoid overwriting existing files without a flag, or document “adds only missing files”).

Gaps (design & interactivity)

Gap Impact
--color unused ColorChoice is parsed but never passed to output; no colored errors, success, or syntax highlighting
No structured output No --json for scripts/AI; all output is human-oriented prose
REPL is minimal No readline (history, editing), no colors, no multiline input, no ai repl / AI-assisted mode
No TUI / rich prompts No interactive wizards (e.g. dal new with prompts), no progress bars, no tables for list output
Error formatting Errors use eprintln! and reporter formatting; not yet unified with a “pretty” or color-aware pipeline
Subcommand help dal <cmd> --help is clap’s default; not yet aligned with use-case-first wording or examples
No “dal ask” / NL entry Design doc and expansion plan mention it; not implemented

Reference


Next Phases: Comprehensive, User-Friendly, Beautiful Design

Goals: respectful of terminals (color when useful, scriptable when needed), discoverable (help and errors that guide), interactive where it helps (REPL, wizards, progress), consistent (one voice, one style).


Phase A: Output pipeline and color (foundation)

Objective: One place to decide “is this a TTY? do we want color?” and route all CLI output through it.

  1. Use --color everywhere

  2. Central output helpers

  3. Errors

Deliverables: Color-aware output module; --color wired; errors and key commands (e.g. run, check, test) using it.


Phase B: REPL upgrade (discoverable, pleasant)

Objective: Make dal repl a place users want to stay: history, clarity, and a path to AI.

  1. Input UX

  2. Output UX

  3. Future hook

Deliverables: REPL with history and multiline; colored result/error; improved help; doc update.


Phase C: Structured output and scripting

Objective: Scripts and AI tooling can consume output without scraping prose.

  1. --json

  2. Exit codes

  3. Stability

Deliverables: --json on 5–10 high-value commands; exit-code doc; scripting note in docs.


Phase D: Interactive wizards and progress

Objective: First-run and “many steps” flows feel guided, not cryptic.

  1. Wizards

  2. Progress and long operations

  3. Tables

Deliverables: Interactive dal new (and optionally dal init); progress/spinner for 2–3 heavy commands; table formatting for 2–3 list commands.


Phase E: Help and discovery polish

Objective: Every surface (main help, subcommand help, errors) reinforces “what can I do?” and “what’s next?”.

  1. Main help

  2. Subcommand help

  3. Errors

Deliverables: Updated main help text; subcommand examples and use-case blurbs; error suggestions; troubleshooting snippet.


Phase F: Natural language and AI entry points

Objective: Realize the “AI-forward” principle with concrete entry points.

  1. dal ask "<prompt>"

  2. dal "<prompt>" (optional)

  3. ai repl

Deliverables: dal ask "<prompt>"; optional shorthand; design and (if time) stub for ai repl or in-REPL ask.


Phase order and dependencies

Phase Depends on Suggested order
A (color) 1
B (REPL) A 2
C (--json) Can parallel with A
D (wizards, progress) A 3
E (help polish) 4 (can start early)
F (dal ask, AI) C (for --json on ask) 5

Design principles (reminder)