diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 6b30198..d5cde10 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -15,7 +15,7 @@ "name": "devpilot-studio", "source": "./", "description": "Real-time terminal status bar for Claude Code — context window, rate limits, 5-hour/7-day quotas, burn-rate alerts, sparkline history, and preset themes.", - "version": "1.4.0", + "version": "1.5.0", "author": { "name": "Kumuditha Tharinda Liyanage" }, diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 246b8b8..31d5383 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "devpilot-studio", "displayName": "DevPilot Studio", - "version": "1.4.0", + "version": "1.5.0", "description": "Real-time terminal status bar for Claude Code — context window, rate limits, 5-hour/7-day quotas, burn-rate alerts, sparkline history, and preset themes. Zero dependencies. 100% offline.", "author": { "name": "Kumuditha Tharinda Liyanage", diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bca664..089a606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,34 @@ All notable changes to DevPilot Studio are documented here. This project adheres to [Semantic Versioning](https://semver.org/). +## [1.5.0] - 2026-09-01 + +Chat-driven first-run onboarding. + +### Added +- **`dps set `** — non-interactive setter for a single config key. + Validates `` against the same `DPS_CONFIG_KEYS` allowlist used by the + safe parser, writes through the same escaped `_write_config` as `dps config` + and `dps theme` (so every other key keeps its value), and never reads a TTY. + Unknown keys and missing arguments are rejected with exit code 2. + +### Changed +- **`/devpilot-studio:setup` is now chat-driven.** It runs `scripts/setup.sh` + headlessly, then asks the user for a theme, whether to show session cost, and + an optional badge label **in the chat**, applies the answers with `dps set`, + and shows a `dps demo` preview. It no longer points at the TTY-only + `dps config` wizard, which fails when invoked from a slash command. +- README Quick Start and `docs/INSTALL.md` now describe setup accurately: one + slash command, a few chat questions, then a restart — not "automatic". + +### Notes +- `hooks/hooks.json`'s `Setup` event is a valid Claude Code hook event + (verified against Claude Code 2.1.252), but it only fires on + `claude --init` / `--maintenance`, not on `/plugin install`. Manual + `/devpilot-studio:setup` remains the intended first-run path. The hook is + left in place (valid, harmless, useful for `--init` users). +- `cmd_config` (the terminal wizard) is unchanged. + ## [1.4.0] - 2026-09-01 Theme customization and developer attribution. Every new option is off by diff --git a/CLAUDE.md b/CLAUDE.md index e9e6017..4440231 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -11,15 +11,21 @@ burn-rate velocity alerts, session cost, and 7-day usage sparkline history. ## Architecture - **`bin/devpilot`** — Core engine (POSIX Bash). Handles all rendering, stats, - history, config wizard, gallery, themes (`default`/`mono`/`vivid`/`custom`, - optional true-color), named presets (`dps theme save/use/list`), - install/uninstall. The config file is parsed via an allowlist, never sourced. + history, config wizard (`dps config`, needs a TTY), non-interactive per-key + setter (`dps set `, no TTY), gallery, themes + (`default`/`mono`/`vivid`/`custom`, optional true-color), named presets + (`dps theme save/use/list`), install/uninstall. The config file is parsed via + an allowlist, never sourced; `cmd_config`, `dps theme`, and `dps set` all + write through the same escaped `_write_config`. - **`cli.js`** — Node.js entrypoint wrapper for `npx devpilot-studio` installation. - **`scripts/setup.sh`** — Idempotent plugin setup script (platform detection, jq check, binary install, statusLine config). - **`.claude-plugin/`** — Plugin and marketplace manifests. - **`hooks/hooks.json`** — Claude Code lifecycle hooks (Setup event). - **`commands/`** — Slash commands (`setup`, `configure`, `demo`, `uninstall`). + `setup` is chat-driven: it runs `scripts/setup.sh` headlessly, then asks the + user theme / cost / badge questions in chat and applies them via `dps set` + (it never calls the TTY-only `dps config`). ## Key Dependencies diff --git a/README.md b/README.md index 572e2ba..b480317 100644 --- a/README.md +++ b/README.md @@ -97,11 +97,17 @@ For more details, see [docs/INSTALL.md](docs/INSTALL.md). ## 5. Quick Start -1. **Install the Plugin:** From inside Claude Code, run `/plugin install devpilot-studio`. -2. **Setup:** Run `/devpilot-studio:setup` to wire the plugin into your settings. -3. **Configure:** Run `/devpilot-studio:configure` (or `dps config` in a normal shell) to launch the interactive theme wizard. -4. **Restart:** Exit Claude Code (`/exit`) and start a new session (`claude`). -5. **Verify:** You will see the beautiful DevPilot Studio status bar at the bottom of your terminal! +1. **Install the plugin:** From inside Claude Code, run `/plugin install devpilot-studio`. +2. **Run setup:** Run `/devpilot-studio:setup`. This is not fully automatic — it + installs the binary and wires the status line, then **asks you three quick + questions in the chat** (theme, whether to show session cost, an optional + badge label). Answer them in one reply and it applies your choices and shows + a preview. +3. **Restart:** Exit Claude Code (`/exit`) and start a new session (`claude`). +4. **Verify:** The DevPilot Studio status bar appears at the bottom of your terminal. + +Prefer a terminal wizard? From a normal shell you can still run `dps config` +(full interactive setup) or `dps theme ` (quick theme switch) any time. To **Update**, run `/plugin update devpilot-studio`. To **Uninstall**, run `/devpilot-studio:uninstall`. diff --git a/bin/devpilot b/bin/devpilot index 2647541..f830ad1 100755 --- a/bin/devpilot +++ b/bin/devpilot @@ -15,7 +15,8 @@ # dps render Read status JSON on stdin and print the status bar. # dps stats Show an expanded usage panel from the latest render. # dps history Show usage trends from recorded snapshots. -# dps config Run the interactive setup wizard. +# dps config Run the interactive setup wizard (needs a real terminal). +# dps set KEY VALUE Set one config key non-interactively (no TTY needed). # dps theme Switch the color theme (default, mono, vivid, custom). # dps theme save|use|list Save, load, or list named custom presets. # dps gallery Browse preset looks and apply one. @@ -28,7 +29,7 @@ # Home: https://github.com/mr-kumuditha/devpilot-studio # License: MIT (see LICENSE and NOTICE.md) -DPS_VERSION="1.4.0" +DPS_VERSION="1.5.0" # ---------------------------------------------------------------------------- # Configuration & State Paths @@ -1294,6 +1295,32 @@ cmd_theme() { _theme_preview } +# ---------------------------------------------------------------------------- +# set — non-interactive per-key config setter (no TTY required) +# ---------------------------------------------------------------------------- +# Writes exactly one config key. Reuses the same allowlist (_is_config_key) and +# escaped writer (_write_config) built for cmd_config / dps theme, so every +# other key already in the file keeps its value. Never reads a TTY. +cmd_set() { + local key="${1-}" val="${2-}" + + if [ -z "$key" ]; then + _err "usage: dps set " + return 2 + fi + if ! _is_config_key "$key"; then + _err "unknown config key '$key' — not in the DPS_* allowlist (see docs/CONFIGURATION.md)" + return 2 + fi + + load_config # defaults + every key already on disk + printf -v "$key" '%s' "$val" # name is allowlist-vetted; value never eval'd + _write_config # same escaped writer as cmd_config / dps theme + + _say "Set $key=\"$val\" → $CONFIG_FILE" + _say "Start a new session (or /exit and restart) to apply it." +} + # ---------------------------------------------------------------------------- # install / uninstall # ---------------------------------------------------------------------------- @@ -1384,7 +1411,8 @@ Usage: dps render Read status JSON on stdin and print the status bar. dps stats Show expanded usage metrics panel from latest render. dps history Show usage trends & sparklines from recorded snapshots. - dps config Run interactive setup wizard. + dps config Run interactive setup wizard (needs a real terminal). + dps set Set one config key non-interactively (no TTY needed). dps theme Switch color theme (default | mono | vivid | custom) and preview. dps theme save / use / list Manage named custom presets. dps gallery Browse preset looks and apply one. @@ -1411,6 +1439,7 @@ main() { history|hist) cmd_history ;; config|configure|init) cmd_config ;; theme) shift; cmd_theme "$@" ;; + set) shift; cmd_set "$@" ;; gallery|presets) cmd_gallery ;; demo) shift; cmd_demo "$@" ;; install) cmd_install ;; diff --git a/commands/setup.md b/commands/setup.md index a114d73..4f314c9 100644 --- a/commands/setup.md +++ b/commands/setup.md @@ -1,21 +1,69 @@ --- -description: Install DevPilot Studio and wire it into your Claude Code status line +description: Install DevPilot Studio, then set it up by answering a few questions in chat allowed-tools: Bash(bash:*), Bash(dps:*), Bash(devpilot:*) --- Set up the **DevPilot Studio** (`dps` / `devpilot`) status line for the user. -Run the plugin setup script. It detects the platform, checks for `jq`, copies the -`devpilot` script to `~/.local/bin/devpilot`, and wires it into -`~/.claude/settings.json` as the status line — merging with any existing settings -and writing a `.bak` backup first: +This runs in two parts: a headless install script, then a short set of +preference questions **asked in this chat** (the interactive `dps config` +wizard needs a real terminal and cannot run from a slash command, so do +**not** call it here). + +## Step 1 — Run the install script (no questions) + +Run it directly. It detects the platform, checks for `jq`, copies the +`devpilot` binary to `~/.local/bin/devpilot`, and wires it into +`~/.claude/settings.json` as the status line (merging with existing settings, +writing a `.bak` backup first). It does not need a TTY. !bash `"${CLAUDE_PLUGIN_ROOT}/scripts/setup.sh"` -Then tell the user: +If that reports an error (e.g. `jq` missing, or `settings.json` not valid +JSON), relay it to the user and stop — the steps below assume it succeeded. + +## Step 2 — Ask the user three questions, in one message + +Post exactly one chat message containing this numbered list and ask them to +answer all three in a single reply: + +> 1. **Color theme** — `default`, `mono`, or `vivid`? +> 2. **Show session cost** in the status bar — yes or no? +> 3. **Org / badge label** — short text to show at the front of the bar +> (optional; reply "none" to skip). + +Then wait for their reply. Do not guess answers or proceed until they respond. + +## Step 3 — Apply their answers with `dps set` (one call per answer) + +Use the non-interactive setter — it writes one config key at a time and +leaves every other setting alone. No TTY involved. + +- Theme → `!bash `"${CLAUDE_PLUGIN_ROOT}/bin/devpilot" set DPS_THEME `` + (must be one of `default`, `mono`, `vivid`; if they typed something else, + ask again rather than passing it through). +- Cost → map **yes → `1`**, **no → `0`**, then + `!bash `"${CLAUDE_PLUGIN_ROOT}/bin/devpilot" set DPS_SHOW_COST <1-or-0>`` +- Org label → only if they gave one (not blank / not "none"): + `!bash `"${CLAUDE_PLUGIN_ROOT}/bin/devpilot" set DPS_ORG ""`` + Keep the surrounding quotes so a label with spaces is passed as one value. + Skip this call entirely if they chose to skip. + +## Step 4 — Show a preview in chat + +Run the demo and show its output to the user directly in the chat so they +can see what they picked: + +!bash `"${CLAUDE_PLUGIN_ROOT}/bin/devpilot" demo` + +## Step 5 — Tell the user to restart + +Tell them: **start a new Claude Code session** (or `/exit` and restart +`claude`) for the live status bar to appear. Changes to the config do not +take effect in the current session. -- Run `/devpilot-studio:configure` or `dps config` in a terminal to customize the look - (theme, segments, bar style, and optional session-cost / burn-rate display). -- **Start a new Claude Code session** (or restart) for the status line to appear. +Later, from a normal terminal, they can run `dps config` for the full +interactive wizard, or `dps theme ` to switch themes quickly. -Do not modify any files other than what the installer touches. +Do not modify any files other than what the install script and `dps set` +touch. diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 1aedba7..890f098 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -24,10 +24,16 @@ This is the easiest and most seamless installation path. ```bash /plugin install devpilot-studio ``` -4. Wire in the status line (required — this does not happen automatically on install): +4. Run setup (required — nothing runs automatically on `/plugin install`): ```bash /devpilot-studio:setup ``` + This installs the `devpilot` binary and wires the status line headlessly, + then asks you **three questions in the chat** — color theme (`default` / + `mono` / `vivid`), whether to show session cost, and an optional org / badge + label. Answer all three in one reply; it applies them with `dps set` and + prints a preview. (The full `dps config` wizard needs a real terminal and is + not used by this command.) 5. **Restart Claude Code**: Exit the session (`/exit`) and restart `claude`. --- diff --git a/package.json b/package.json index 62f3ed1..248e23d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "devpilot-studio", - "version": "1.4.0", + "version": "1.5.0", "description": "DevPilot Studio — A professional desktop utility for managing Claude Code workflows, AI development sessions, project status, MCP servers, prompts, Git repositories, and developer productivity.", "bin": { "dps": "cli.js", diff --git a/scripts/setup.sh b/scripts/setup.sh index 73b385c..f012ab8 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -18,7 +18,7 @@ set -euo pipefail # -------------------------------------------------------------------------- # Constants # -------------------------------------------------------------------------- -DPS_VERSION="1.4.0" +DPS_VERSION="1.5.0" INSTALL_BIN="$HOME/.local/bin/devpilot" SETTINGS_DIR="$HOME/.claude"