Skip to content

Commit c0cfd04

Browse files
authored
Merge pull request #3 from ekaone/clis
Fix and Update resend and vercel
2 parents 55da5b7 + 2c7ba11 commit c0cfd04

18 files changed

Lines changed: 1737 additions & 234 deletions

README.md

Lines changed: 105 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# @ekaone/json-cli
22

3-
AI-powered CLI task runner. Just write in plain English, AI generates a validated JSON command plan, and the runner executes it step by step.
3+
AI-powered CLI task runner. Write plain English goals, get a validated JSON plan, then execute step-by-step.
44

55
## Think safety first
6-
> For safety, `json-cli` will generate the plan and ask for confirmation before running the steps. You can also use the `--dry-run` flag to preview the plan without executing it.
76

7+
For safety, `json-cli`:
8+
- generates a plan first
9+
- validates schema + catalog rules + guardrails
10+
- asks for confirmation before execution
11+
12+
Use `--dry-run` to preview the plan without executing commands.
813

914
## Installation
1015

@@ -22,215 +27,140 @@ yarn global add @ekaone/json-cli
2227

2328
## Setup
2429

30+
Default provider is Claude when `--provider` is not set.
31+
2532
```bash
33+
# Claude
2634
export ANTHROPIC_API_KEY=your_key_here
35+
36+
# OpenAI
37+
export OPENAI_API_KEY=your_key_here
38+
39+
# Ollama
40+
export OLLAMA_BASE_URL=http://localhost:11434
2741
```
2842

29-
> Windows PowerShell: `$env:ANTHROPIC_API_KEY="your_key_here"`
43+
Windows PowerShell:
3044

31-
---
45+
```powershell
46+
$env:ANTHROPIC_API_KEY="your_key_here"
47+
```
3248

3349
## Usage
3450

35-
### Single intent
51+
### Basic
3652

3753
```bash
3854
json-cli "please run tests"
3955
json-cli "please build"
4056
json-cli "check git status"
4157
```
4258

43-
### Multi-intent — the fun part 🔥
44-
45-
Chain multiple commands in plain English using **"then"**, **"and"**, **"after that"**:
59+
### Multi-intent
4660

4761
```bash
4862
json-cli "run tests and then build"
49-
```
50-
51-
```bash
5263
json-cli "run typecheck, test, and then check git status"
64+
json-cli "run tests, check git diff, then git add and commit with message 'fix: catalog types'"
5365
```
5466

55-
```bash
56-
json-cli "please run dev with port 5000"
57-
```
58-
59-
```bash
60-
json-cli "install deps, run tests, then build"
61-
```
62-
63-
### Full release flow in one command 🚀
64-
65-
```bash
66-
json-cli "run tests, build, git add all, commit with message 'release v0.1.0', push, then publish"
67-
```
68-
69-
```
70-
📋 Plan (6 steps):
71-
1. pnpm test → Run test suite
72-
2. pnpm build → Build package
73-
3. git add . → Stage all changes
74-
4. git commit -m "release v0.1.0" → Commit release
75-
5. git push → Push to remote
76-
6. pnpm publish → Publish to npm
77-
78-
Proceed? › y
79-
```
67+
### Vercel + Resend examples
8068

81-
### More crazy examples
69+
> Use `--catalogs` to force specific catalogs (recommended), but you can also let `json-cli` auto-detect them.
8270
8371
```bash
84-
# Full dev startup
85-
json-cli "install deps and run dev on port 3000"
86-
87-
# Audit and fix
88-
json-cli "run npm audit, then update all deps"
89-
90-
# Branch and commit workflow
91-
json-cli "check git status, add all files, commit with message 'feat: add multi-intent support', then push"
92-
93-
# Test everything before shipping
94-
json-cli "run typecheck, run tests, build, then publish"
95-
96-
# Clone and install
97-
json-cli "clone https://github.com/ekaone/json-cli and then install deps"
98-
99-
# Check before commit
100-
json-cli "run tests, check git diff, then git add and commit with message 'fix: catalog types'"
101-
102-
# Full CI-like flow locally
103-
json-cli "install deps, run typecheck, run tests, build, git add, commit with message 'ci: local pipeline passed', push"
72+
json-cli "deploy to vercel production" --catalogs vercel --dry-run --debug
73+
json-cli "send email to ekaone@gmail.com from no-reply@support.com with subject 'Hello' and body 'How are you?'" --catalogs resend --dry-run --debug
74+
json-cli "build app, deploy to vercel production, then send deployment email to ekaone@gmail.com" --catalogs package,vercel,resend --dry-run --debug
10475
```
10576

106-
### More examples
77+
## Options
10778

108-
💡 There are a lot cool examples in the [examples](./examples/README.md) file.
79+
```text
80+
json-cli "<your goal>" [options]
10981
110-
### Options
82+
Alias:
83+
jc "<your goal>" [options]
11184
112-
```bash
113-
json-cli
114-
# or
115-
json-cli --help
116-
```
117-
```
118-
json-cli — AI-powered CLI task runner
119-
120-
Usage
121-
json-cli "<your goal>" [options]
122-
123-
Alias
124-
jc "<your goal>" [options]
125-
126-
Options
127-
--provider <name> AI provider: claude | openai | ollama (default: claude)
128-
--catalogs <list> Force specific catalogs: package,git,docker,fs,shell (comma-separated)
129-
--yes Skip confirmation prompt
130-
--dry-run Show plan without executing
131-
--debug Show system prompt and raw AI response
132-
--resume Resume from last failed step
133-
--history Browse and re-run past commands
134-
--history --clear Clear command history
135-
--help Show this help message
136-
--version, -v Show version
137-
138-
Examples
139-
json-cli "please run tests"
140-
json-cli "run tests and build"
141-
json-cli "run tests and build" --yes
142-
json-cli "git add, commit with message 'fix: bug', push"
143-
json-cli "clone https://github.com/user/repo, install deps, run dev"
144-
json-cli "run tests and publish" --provider openai
145-
json-cli "run tests" --dry-run
146-
json-cli "run tests" --debug
147-
json-cli "run tests" --debug --dry-run
148-
json-cli "deploy to prod" --catalogs docker
149-
json-cli "list files in E:" --catalogs fs
150-
json-cli --resume
151-
json-cli --history
152-
153-
Docs: https://github.com/ekaone/json-cli
85+
Options:
86+
--provider <name> AI provider: claude | openai | ollama (default: claude)
87+
--catalogs <list> Force specific catalogs: package,git,docker,fs,shell,vercel,resend (comma-separated)
88+
--yes Skip confirmation prompt
89+
--dry-run Show plan without executing
90+
--debug Show system prompt and raw AI response
91+
--resume Resume from last failed step
92+
--history Browse and re-run past commands
93+
--history --clear Clear command history
94+
--help Show this help message
95+
--version, -v Show version
15496
```
15597

156-
---
98+
## Catalogs (command whitelists)
15799

158-
## Catalogs (Command Whitelists)
100+
`json-cli` auto-detects active catalogs from project files and prompt intent.
159101

160-
json-cli automatically detects which catalogs to use based on your project structure:
102+
| Catalog | Auto-detected when | Types/commands |
103+
|---|---|---|
104+
| `package` | `package.json` exists | `npm`, `pnpm`, `yarn`, `bun` |
105+
| `git` | `.git/` exists | git commands |
106+
| `docker` | `Dockerfile` / compose file exists | docker commands |
107+
| `fs` | always included | filesystem commands |
108+
| `shell` | always included | any shell command (escape hatch) |
109+
| `vercel` | `.vercel` / `vercel.json` exists or deploy-related intent | vercel commands |
110+
| `resend` | email/resend-related intent | resend commands |
161111

162-
| Catalog | Auto-detected when | Commands |
163-
|---------|-------------------|----------|
164-
| `package` | `package.json` exists | npm, pnpm, yarn, bun |
165-
| `git` | `.git/` folder exists | git init, add, commit, push, pull... |
166-
| `docker` | `Dockerfile` or `docker-compose.yml` exists | docker build, run, compose... |
167-
| `fs` | Always included | mkdir, rm, cp, mv, touch, cat, ls, dir |
168-
| `shell` | Always included | Any command (escape hatch) |
169-
170-
### Force specific catalogs
171-
172-
Use `--catalogs` to override auto-detection:
112+
Force catalogs with `--catalogs`:
173113

174114
```bash
175-
# Only use docker commands, even in a Node.js project
176-
json-cli "deploy to prod" --catalogs docker
177-
178-
# Only filesystem commands
115+
json-cli "deploy to prod" --catalogs vercel
179116
json-cli "list files in E:" --catalogs fs
180-
181-
# Multiple catalogs (comma-separated)
182-
json-cli "build and deploy" --catalogs package,docker
117+
json-cli "build and deploy" --catalogs package,vercel
183118
```
184119

185-
This is useful when you want to:
186-
- Exclude certain tools from the plan
187-
- Ensure only specific command types are used
188-
- Override auto-detection in CI/CD pipelines
189-
190-
---
191-
192120
## How it works
193121

122+
```text
123+
User prompt
124+
-> AI plan (JSON)
125+
-> Schema validation
126+
-> Catalog validation
127+
-> Guardrail validation
128+
-> Targeted repair loop (step-level, when needed)
129+
-> Confirm
130+
-> Execute step-by-step
194131
```
195-
User Prompt (plain English)
196-
197-
198-
AI Provider ← Claude / OpenAI / Ollama
199-
│ extracts ALL intents, sequences them
200-
201-
JSON Plan ← validated by Zod schema (max 10 steps)
202-
203-
204-
Catalog Check ← whitelist prevents hallucinated commands
205-
206-
207-
Confirm (y/n) ← review the full plan before execution
208-
209-
210-
Runner ← executes step by step, streams output live
211-
stops immediately on first failure
212-
```
213132

214-
---
133+
## Targeted repair loop
134+
135+
If one step fails validation, `json-cli` repairs only the failing step (instead of regenerating the whole plan), then re-validates.
215136

216-
## Allowed commands
137+
Flow:
138+
1. detect failing step + exact reason
139+
2. ask AI to repair that step only (catalog-scoped)
140+
3. validate again
141+
4. continue or fail clearly after retry limit
217142

218-
| Type | Commands |
219-
|---------|----------|
220-
| `pnpm` | install, run, build, test, publish, add, remove, update, dlx, why |
221-
| `npm` | install, run, build, test, publish, ci, init, outdated, audit |
222-
| `yarn` | install, run, build, test, publish, add, remove, why, upgrade |
223-
| `bun` | install, run, build, test, publish, add, remove, x, update |
224-
| `git` | init, add, commit, push, pull, clone, status, log, branch, checkout, merge, diff, stash |
225-
| `docker`| build, run, compose, push, pull, exec, logs, ps, stop, start, rm, rmi |
226-
| `fs` | mkdir, rm, cp, mv, touch, cat, ls, dir |
227-
| `shell` | any *(escape hatch — always requires extra confirmation)* |
143+
## Allowed command sets
228144

229-
> **Note:** Flags and arguments are unrestricted, `--port 5000`, `-m "message"`, `--force` etc. are all passed freely. Only the command itself is whitelisted.
145+
| Type | Commands |
146+
|---|---|
147+
| `npm` | install, run, build, test, publish, ci, add, remove |
148+
| `pnpm` | install, run, build, test, publish, ci, add, remove |
149+
| `yarn` | install, run, build, test, publish, ci, add, remove |
150+
| `bun` | install, run, build, test, publish, ci, add, remove |
151+
| `git` | init, add, commit, push, pull, clone, status, diff, log, branch, checkout, merge, stash |
152+
| `docker` | build, run, compose, push, pull, exec, logs, ps, stop, start, rm, rmi |
153+
| `fs` | mkdir, rm, cp, mv, touch, cat, ls, dir |
154+
| `vercel` | deploy, build, dev, pull, env, logs, link, login, logout, list, inspect, promote, domains, project |
155+
| `resend` | emails, domains, api-keys, broadcasts, contacts, audiences, webhooks, templates, login, logout, doctor |
156+
| `shell` | any command (escape hatch) |
230157

231-
---
158+
Notes:
159+
- Commands are whitelisted per catalog.
160+
- Some catalogs enforce required/conflicting/forbidden flags.
161+
- Guardrails block obvious secret leakage and malformed flags.
232162

233-
## AI Providers
163+
## AI providers
234164

235165
```bash
236166
# Claude (default)
@@ -239,48 +169,36 @@ json-cli "run tests and build"
239169
# OpenAI
240170
json-cli "run tests and build" --provider openai
241171

242-
# Ollama (local, no API key needed)
172+
# Ollama
243173
json-cli "run tests and build" --provider ollama
244174
```
245175

246-
## Environment variables
247-
248-
```bash
249-
ANTHROPIC_API_KEY=sk-ant-... # for Claude
250-
OPENAI_API_KEY=sk-... # for OpenAI
251-
```
252-
253-
---
254-
255176
## Local development
256177

257178
```bash
258179
pnpm install
259180
pnpm dev "please run tests"
181+
pnpm typecheck
260182
pnpm test
261183
pnpm build
262184
```
263185

264186
## Pricing
265187

266-
> **Note:** [Pricing](./src/providers/pricing.ts) is based on the lastest rates from each provider. Write an [issue](https://github.com/ekaone/json-cli/issues) if you find any outdated pricing.
267-
268-
| Provider | Input Cost (per 1M tokens) | Output Cost (per 1M tokens) |
269-
|----------|----------------------------|-----------------------------|
270-
| Claude | $3.00 | $15.00 |
271-
| OpenAI | $2.50 | $10.00 |
272-
| Ollama | $0.00 | $0.00 |
188+
Pricing config is in [`src/providers/pricing.ts`](./src/providers/pricing.ts). Open an issue if rates are outdated.
273189

274-
---
190+
| Provider | Input (per 1M tokens) | Output (per 1M tokens) |
191+
|---|---:|---:|
192+
| Claude | $3.00 | $15.00 |
193+
| OpenAI | $2.50 | $10.00 |
194+
| Ollama | $0.00 | $0.00 |
275195

276196
## License
277197

278-
MIT © [Eka Prasetia](https://prasetia.me/)
198+
MIT © [Eka Prasetia](./LICENSE)
279199

280200
## Links
281201

282-
- [npm Package](https://www.npmjs.com/package/@ekaone/json-cli)
283-
- [GitHub Repository](https://github.com/ekaone/json-cli)
284-
- [Issue Tracker](https://github.com/ekaone/json-cli/issues)
285-
286-
⭐ If this library helps you, please consider giving it a star on GitHub!
202+
- [npm package](https://www.npmjs.com/package/@ekaone/json-cli)
203+
- [GitHub repository](https://github.com/ekaone/json-cli)
204+
- [Issue tracker](https://github.com/ekaone/json-cli/issues)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ekaone/json-cli",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "AI-powered CLI task runner with JSON command plans",
55
"keywords": ["ai", "agent", "cli", "task-runner", "llm"],
66
"author": {

0 commit comments

Comments
 (0)