Skip to content

Commit de45c5a

Browse files
Harden TUI input and smoke coverage
1 parent 1fdf29e commit de45c5a

19 files changed

Lines changed: 435 additions & 200 deletions

.env.example

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# This file is for the project being set up, not P-Setup's own AI keys.
2-
# Store P-Setup provider API keys globally with:
1+
# This file is for the project being set up, not Setupr's own AI keys.
2+
# Store Setupr provider API keys globally with:
33
#
4-
# setup auth set-key github
5-
# setup auth set-key minimax
6-
# setup auth set-key moonshot
4+
# setupr auth set-key github
5+
# setupr auth set-key minimax
6+
# setupr auth set-key moonshot
77
#
88
# Project app variables belong here, for example:
99
# DATABASE_URL=postgres://localhost/app
1010
# NEXT_PUBLIC_API_URL=http://localhost:3000
1111

1212
# Optional local override for this project only.
13-
# Prefer `setup auth use <model>` for your global default.
13+
# Prefer `setupr auth use <model>` for your global default.
1414
# P_SETUP_AI_MODEL=openai/gpt-4.1-mini
1515

1616
# Optional logging verbosity: debug, info, warn, error.

ENVREADME.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Setupr AI Provider Keys
44

5-
Setupr provider API keys should be stored globally with `setup auth`, not in a project `.env` file:
5+
Setupr provider API keys should be stored globally with `setupr auth`, not in a project `.env` file:
66

77
```bash
8-
setup auth login
9-
setup auth set-key github
10-
setup auth list
11-
setup auth test
12-
setup auth use openai/gpt-4.1-mini
8+
setupr auth login
9+
setupr auth set-key github
10+
setupr auth list
11+
setupr auth test
12+
setupr auth use openai/gpt-4.1-mini
1313
```
1414

1515
Keys are stored at `~/.setupr/secrets.json` with file permissions `0600`, and Setupr only displays masked values.
@@ -33,15 +33,15 @@ For GitHub Models, use a token that can read GitHub Models. Fine-grained PATs or
3333
Setupr resolves provider keys in this order:
3434

3535
1. Shell environment variables
36-
2. Global auth storage from `setup auth set-key`
36+
2. Global auth storage from `setupr auth set-key`
3737
3. Local `.env.local`
3838
4. Local `.env`
39-
5. Saved model preference from `setup auth use` (for model selection only)
39+
5. Saved model preference from `setupr auth use` (for model selection only)
4040

4141
To migrate old provider keys out of a project `.env`:
4242

4343
```bash
44-
setup auth migrate
44+
setupr auth migrate
4545
```
4646

4747
Project `.env`, `.env.local`, and `.env.example` should primarily describe the app being set up, such as `DATABASE_URL`, `PORT`, or `NEXT_PUBLIC_API_URL`.
@@ -55,7 +55,7 @@ Project `.env`, `.env.local`, and `.env.example` should primarily describe the a
5555

5656
If several provider keys are set, the selected model is deterministic:
5757

58-
1. `P_SETUP_AI_MODEL` or `setup auth use ...` wins.
58+
1. `P_SETUP_AI_MODEL` or `setupr auth use ...` wins.
5959
2. Otherwise Setupr picks the cheapest configured model from its known local pricing table.
6060
3. GitHub Models catalog pricing is treated as unknown, so GitHub is picked automatically only if explicitly selected or if it is the only configured provider.
6161
4. The setup pre-warning and TUI timeline show which model the AI director is using.
@@ -74,31 +74,31 @@ Setupr detects required environment variables by:
7474

7575
```bash
7676
# Open the interactive .env editor TUI
77-
setup env
77+
setupr env
7878

7979
# Create .env from .env.example
80-
setup env init
80+
setupr env init
8181

8282
# Recreate .env from .env.example even if .env already exists.
8383
# If no .env.example exists, --force creates an empty .env with a warning.
84-
setup env init --force
84+
setupr env init --force
8585

8686
# Check for missing variables
87-
setup env check
87+
setupr env check
8888

8989
# Sync .env structure with .env.example (preserves values)
90-
setup env sync
90+
setupr env sync
9191

9292
# Smart analysis: detect issues + interactive fix
93-
setup env smart
93+
setupr env smart
9494
```
9595

9696
### `env` Editor Behavior
9797

98-
- `setup env` opens a TUI editor for the local `.env`
98+
- `setupr env` opens a TUI editor for the local `.env`
9999
- if `.env` is missing but `.env.example` exists, Setupr asks before creating `.env` from the template
100100
- if both `.env` and `.env.example` are missing, Setupr returns `ENV_TEMPLATE_MISSING`
101-
- `setup env --force` creates an empty `.env` when no template exists and explains that no variables were inferred
101+
- `setupr env --force` creates an empty `.env` when no template exists and explains that no variables were inferred
102102
- the editor accepts normal value edits and pasted `KEY=value` lines
103103
- sensitive keys such as API keys, tokens, secrets, and passwords are masked in the editor input
104104

@@ -113,11 +113,11 @@ setup env smart
113113

114114
### Safety Defaults
115115

116-
- `setup env init` never overwrites an existing `.env` unless you pass `--force`
117-
- `setup env init` does not create `.env` when `.env.example` is missing unless you pass `--force`; without force it returns `ENV_TEMPLATE_MISSING`
116+
- `setupr env init` never overwrites an existing `.env` unless you pass `--force`
117+
- `setupr env init` does not create `.env` when `.env.example` is missing unless you pass `--force`; without force it returns `ENV_TEMPLATE_MISSING`
118118
- with `--force`, a missing `.env.example` creates an empty `.env` and reports that no variables were inferred
119-
- `setup` creates a missing `.env` from `.env.example` during the environment step
120-
- `setup env check` exits non-zero when required variables are missing
119+
- `setupr setup` creates a missing `.env` from `.env.example` during the environment step
120+
- `setupr env check` exits non-zero when required variables are missing
121121
- Plain-mode setup stops and exits non-zero if install, env setup, build, or verification fails
122122

123123
### Validation Rules

README.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -143,41 +143,41 @@ GitHub Models tokens need GitHub Models access; fine-grained PATs or app tokens
143143

144144
```bash
145145
# Guided setup for provider API keys
146-
setup auth login
146+
setupr auth login
147147

148148
# Save one provider API key globally
149-
setup auth set-key github
149+
setupr auth set-key github
150150

151151
# View configured providers without printing raw keys
152-
setup auth list
152+
setupr auth list
153153

154154
# Test configured providers with tiny requests
155-
setup auth test
155+
setupr auth test
156156

157157
# View available models
158-
setup auth models
158+
setupr auth models
159159

160160
# Set preferred model
161-
setup auth use openai/gpt-4.1-mini
161+
setupr auth use openai/gpt-4.1-mini
162162
```
163163

164-
Setupr stores provider API keys globally in `~/.setupr/secrets.json` with file permissions `0600`. Raw keys are never printed; `setup auth list` and `setup auth status` show only masked keys.
164+
Setupr stores provider API keys globally in `~/.setupr/secrets.json` with file permissions `0600`. Raw keys are never printed; `setupr auth list` and `setupr auth status` show only masked keys.
165165

166-
`setup auth test` runs configured providers concurrently with short per-provider timeouts. A slow or unavailable provider reports a classified timeout/error without blocking checks for the other configured providers.
166+
`setupr auth test` runs configured providers concurrently with short per-provider timeouts. A slow or unavailable provider reports a classified timeout/error without blocking checks for the other configured providers.
167167

168168
Setupr resolves provider keys in this order:
169169

170170
1. Shell environment variables, useful for CI or temporary overrides
171-
2. Global Setupr auth storage from `setup auth set-key`
171+
2. Global Setupr auth storage from `setupr auth set-key`
172172
3. Project `.env.local` / `.env` for backward compatibility only
173173

174174
The project `.env` file is for the app being set up, not for Setupr's own API keys. To migrate old project-local provider keys into global auth:
175175

176176
```bash
177-
setup auth migrate
177+
setupr auth migrate
178178
```
179179

180-
When multiple provider keys are present, `P_SETUP_AI_MODEL` or `setup auth use <model>` wins. If no model is pinned, Setupr chooses the cheapest configured model from its known local pricing table and shows that choice in the pre-execution warning. GitHub Models catalog/custom pricing is treated as unknown, so GitHub is used automatically only when it is explicitly selected or it is the only configured provider.
180+
When multiple provider keys are present, `P_SETUP_AI_MODEL` or `setupr auth use <model>` wins. If no model is pinned, Setupr chooses the cheapest configured model from its known local pricing table and shows that choice in the pre-execution warning. GitHub Models catalog/custom pricing is treated as unknown, so GitHub is used automatically only when it is explicitly selected or it is the only configured provider.
181181

182182
Setupr still accepts `export KEY=value` syntax in project env files for project variables and backward-compatible provider overrides.
183183

@@ -241,8 +241,8 @@ Every command uses the same error format in plain mode and TUI mode:
241241

242242
Examples:
243243

244-
- `setup env init` stops if `.env.example` is missing, because Setupr cannot infer required variables. `setup env init --force` creates an empty `.env` and explains that no variables were inferred.
245-
- `setup auth list` stops on a corrupt `~/.setupr/secrets.json` instead of pretending keys are missing, so existing secrets are not accidentally overwritten.
244+
- `setupr env init` stops if `.env.example` is missing, because Setupr cannot infer required variables. `setupr env init --force` creates an empty `.env` and explains that no variables were inferred.
245+
- `setupr auth list` stops on a corrupt `~/.setupr/secrets.json` instead of pretending keys are missing, so existing secrets are not accidentally overwritten.
246246
- command failures are classified as install, build, test, network, permission, timeout, or missing-tool errors when possible.
247247
- `--force` skips ordinary prompts, but it does not ignore failed commands, invalid auth storage, missing secrets, or destructive blockers.
248248

@@ -313,26 +313,26 @@ All command-like actions from setup, doctor, start, plugins, and AI steering pas
313313

314314
```bash
315315
# Open the interactive .env editor TUI
316-
setup env
316+
setupr env
317317

318318
# Create .env from .env.example
319-
setup env init
319+
setupr env init
320320

321321
# Overwrite an existing .env from .env.example, or create an empty .env
322322
# when no .env.example exists
323-
setup env init --force
323+
setupr env init --force
324324

325325
# Check for missing variables
326-
setup env check
326+
setupr env check
327327

328328
# Sync structure with .env.example
329-
setup env sync
329+
setupr env sync
330330

331331
# Smart reorganize + auto-fill
332-
setup env smart
332+
setupr env smart
333333
```
334334

335-
Bare `setup env` opens the env editor. If `.env` exists, it opens directly. If only `.env.example` exists, Setupr asks before creating `.env` from the template. If neither file exists, it stops with `ENV_TEMPLATE_MISSING`; `setup env --force` creates an empty `.env` and explains that no variables were inferred.
335+
Bare `setupr env` opens the env editor. If `.env` exists, it opens directly. If only `.env.example` exists, Setupr asks before creating `.env` from the template. If neither file exists, it stops with `ENV_TEMPLATE_MISSING`; `setupr env --force` creates an empty `.env` and explains that no variables were inferred.
336336

337337
### Checkpoint & Resume
338338

@@ -346,11 +346,11 @@ Bare `setup env` opens the env editor. If `.env` exists, it opens directly. If o
346346
### Project Memory
347347

348348
```bash
349-
setup notes add "Use pnpm for installs"
350-
setup notes list
351-
setup history 10
352-
setup context export team-context.json
353-
setup context import team-context.json
349+
setupr notes add "Use pnpm for installs"
350+
setupr notes list
351+
setupr history 10
352+
setupr context export team-context.json
353+
setupr context import team-context.json
354354
```
355355

356356
Notes are saved in `.setupr/notes.json`. History uses `.setupr/history.jsonl`, and context export/import moves a deterministic bundle of notes plus history for team handoff.
@@ -428,15 +428,15 @@ Global config stored at `~/.setupr/config.json`:
428428
}
429429
```
430430

431-
Provider API keys are stored separately at `~/.setupr/secrets.json` and should be managed with `setup auth`.
431+
Provider API keys are stored separately at `~/.setupr/secrets.json` and should be managed with `setupr auth`.
432432

433433
### Help
434434

435435
```bash
436-
setup help
437-
setup help auth
438-
setup auth --help
439-
setup help auth set-key
436+
setupr help
437+
setupr help auth
438+
setupr auth --help
439+
setupr help auth set-key
440440
```
441441

442442
Global help lists every command. Command help shows subcommands, variations, options, and examples for that command.

SETUP.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ After installation, the `setup` command is available globally:
2626

2727
```bash
2828
setup
29-
setup doctor
30-
setup info
29+
setupr doctor
30+
setupr info
3131
```
3232

3333
### Command Discovery
3434

3535
Use the built-in help tree when you are not sure which workflow to run:
3636

3737
```bash
38-
setup help
39-
setup help chat
40-
setup help git
41-
setup help docker
42-
setup workspace --help
38+
setupr help
39+
setupr help chat
40+
setupr help git
41+
setupr help docker
42+
setupr workspace --help
4343
```
4444

4545
The rich help output lists the primary project-control surface, including setup, chat, auth, env, git, CI, Docker, secrets, templates, workspace, health, test, security, fix, release, perf, GitHub, registry, share, plugin, lint, and format commands. Advanced inspection/file-generation commands remain directly runnable for compatibility, but they are not advertised in the primary command index.
@@ -76,21 +76,21 @@ You can steer the agent from the persistent input at the bottom of the TUI. For
7676
To enable AI-powered features, save at least one provider key in global Setupr auth storage:
7777

7878
```bash
79-
setup auth login
80-
# Or: setup auth set-key github
79+
setupr auth login
80+
# Or: setupr auth set-key github
8181
```
8282

8383
Project `.env` files are for the app being set up, not Setupr's own API keys. For model preference:
8484

8585
```bash
86-
setup auth use kimi-k2-turbo-preview
86+
setupr auth use kimi-k2-turbo-preview
8787
# Or temporarily: P_SETUP_AI_MODEL=openai/gpt-4.1 setup
8888
```
8989

9090
Supported model IDs are listed with:
9191

9292
```bash
93-
setup auth models
93+
setupr auth models
9494
```
9595

9696
Without an API key, Setupr works fully — it just uses pattern matching and heuristics instead of AI for step planning and chat responses.
@@ -162,7 +162,7 @@ setupr perf scan --json
162162
For non-interactive environments:
163163

164164
```bash
165-
setup --force --plain
165+
setupr --force --plain
166166
```
167167

168168
This skips safe prompts and outputs plain text (no TUI). Setupr still avoids inventing secrets and should stop for destructive or blocked actions.
@@ -173,15 +173,15 @@ If any setup step fails in plain mode, Setupr stops immediately and returns a no
173173

174174
```bash
175175
# Remove dependency/cache artifacts
176-
setup clean --deps
176+
setupr clean --deps
177177

178178
# Remove local-only files before sharing a project
179-
setup clean --share
179+
setupr clean --share
180180

181181
# Remove dependencies, build output, caches, and local env files
182-
setup clean --all
182+
setupr clean --all
183183
```
184184

185-
The positional forms also work: `setup clean deps`, `setup clean share`, and `setup clean all`.
185+
The positional forms also work: `setupr clean deps`, `setupr clean share`, and `setupr clean all`.
186186

187-
In TUI mode, `setup clean` opens a safety review before deleting anything. Review the target list, protected-file notes, and risk summary, then type `CLEAN` to confirm. `--force` skips the review prompt and starts cleaning after the target scan, while still reporting exactly what was removed or failed.
187+
In TUI mode, `setupr clean` opens a safety review before deleting anything. Review the target list, protected-file notes, and risk summary, then type `CLEAN` to confirm. `--force` skips the review prompt and starts cleaning after the target scan, while still reporting exactly what was removed or failed.

0 commit comments

Comments
 (0)