Skip to content

Commit 6b0f23a

Browse files
committed
json-cli commit
0 parents  commit 6b0f23a

File tree

22 files changed

+2817
-0
lines changed

22 files changed

+2817
-0
lines changed

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
paths-ignore:
9+
- '**.md'
10+
- 'docs/**'
11+
- 'LICENSE'
12+
- '.gitignore'
13+
pull_request:
14+
branches:
15+
- main
16+
paths-ignore:
17+
- '**.md'
18+
- 'docs/**'
19+
- 'LICENSE'
20+
- '.gitignore'
21+
22+
jobs:
23+
ci:
24+
runs-on: ubuntu-latest
25+
26+
strategy:
27+
matrix:
28+
node-version: [20, 22]
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Setup pnpm
35+
uses: pnpm/action-setup@v4
36+
with:
37+
version: latest
38+
39+
- name: Setup Node.js ${{ matrix.node-version }}
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: ${{ matrix.node-version }}
43+
cache: pnpm
44+
45+
- name: Install dependencies
46+
run: pnpm install --frozen-lockfile
47+
48+
- name: Type check
49+
run: pnpm typecheck
50+
51+
- name: Run tests
52+
run: pnpm test
53+
54+
- name: Build package
55+
run: pnpm build

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
environment: npm-publish
12+
permissions:
13+
contents: write
14+
id-token: write # required for OIDC + provenance
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup pnpm
21+
uses: pnpm/action-setup@v4
22+
with:
23+
version: latest
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 24 # was 20 — Node 22.14+ required for OIDC
29+
registry-url: https://registry.npmjs.org/
30+
cache: pnpm
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: Run tests
36+
run: pnpm test
37+
38+
- name: Build package
39+
run: pnpm build
40+
41+
- name: Update npm to latest
42+
run: npm install -g npm@latest
43+
44+
- name: Publish to npm
45+
run: pnpm publish --access public --no-git-checks --provenance
46+
47+
- name: Create GitHub Release
48+
uses: softprops/action-gh-release@v2
49+
with:
50+
generate_release_notes: true

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build output
5+
dist/
6+
7+
# Logs
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
pnpm-debug.log*
13+
lerna-debug.log*
14+
15+
# Editor directories and files
16+
.vscode/
17+
.idea/
18+
.DS_Store
19+
*.suo
20+
*.ntvs*
21+
*.njsproj
22+
*.sln
23+
*.sw?
24+
25+
# Testing
26+
coverage/
27+
.nyc_output/
28+
29+
# Misc
30+
.env
31+
.env.local
32+
.env.*.local

.npmignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Dependency
2+
node_modules/
3+
4+
# Source Code
5+
src/
6+
test/
7+
*.test.ts
8+
tsconfig.json
9+
package-lock.json
10+
*.spec.ts
11+
*.config.ts
12+
13+
# Config files
14+
tsconfig.json
15+
tsup.config.ts
16+
vitest.config.ts
17+
18+
# Development files
19+
.git/
20+
.github/
21+
.vscode/
22+
.idea/
23+
24+
# Documentation
25+
docs/
26+
examples/
27+
28+
# .env
29+
.env.*
30+
31+
# Tests
32+
test/
33+
*.test.ts
34+
35+
# Configuration
36+
.gitignore
37+
.npmrc
38+
39+
# Logs
40+
*.log
41+
npm-debug.log*
42+
yarn-error.log*
43+
44+
# Misc
45+
*.tgz
46+
*.log
47+
coverage/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Eka Prasetia <ekaone3033@gmail.com> (https://prasetia.me)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# json-cli
2+
3+
> Under active development - not released yet
4+
5+
AI-powered CLI task runner. Describe your goal in plain English — AI generates a validated JSON command plan — runner executes it step by step.
6+
7+
## Installation
8+
9+
```bash
10+
npm install @ekaone/json-cli
11+
```
12+
13+
```bash
14+
pnpm install @ekaone/json-cli
15+
```
16+
17+
```bash
18+
yarn install @ekaone/json-cli
19+
```
20+
21+
## Usage
22+
23+
```
24+
export ANTHROPIC_API_KEY=your_key_here
25+
```
26+
27+
```bash
28+
json-cli "please run tests"
29+
```
30+
31+
### For local development
32+
33+
```bash
34+
pnpm install
35+
```
36+
37+
### Usage
38+
39+
```bash
40+
# Using Claude (default)
41+
pnpm dev "install deps and run tests"
42+
43+
# Using OpenAI
44+
pnpm dev "run build and publish" --provider openai
45+
46+
# Using Ollama (local)
47+
pnpm dev "start dev server" --provider ollama
48+
```
49+
50+
## How it works
51+
52+
```
53+
User Prompt
54+
55+
56+
AI Provider ← Claude / OpenAI / Ollama
57+
58+
59+
JSON Plan ← validated by Zod schema
60+
61+
62+
Catalog Check ← whitelist prevents hallucinated commands
63+
64+
65+
Confirm (y/n) ← user reviews before execution
66+
67+
68+
Runner ← executes steps, streams output live
69+
```
70+
71+
## Allowed commands
72+
73+
| Type | Commands |
74+
|-------|----------|
75+
| pnpm | install, run, build, test, publish, add, remove |
76+
| npm | install, run, build, test, publish, ci |
77+
| yarn | install, run, build, test, publish, add, remove |
78+
| bun | install, run, build, test, publish, add, remove |
79+
| git | init, add, commit, push, pull, clone, status, log |
80+
| shell | any *(requires extra caution)* |
81+
82+
## Environment variables
83+
84+
```bash
85+
ANTHROPIC_API_KEY=sk-ant-...
86+
OPENAI_API_KEY=sk-...
87+
```
88+
89+
## Run tests
90+
91+
```bash
92+
pnpm test
93+
```
94+
95+
## License
96+
97+
MIT © [Eka Prasetia](https://prasetia.me/)
98+
99+
## Links
100+
101+
- [npm Package](https://www.npmjs.com/package/@ekaone/json-cli)
102+
- [GitHub Repository](https://github.com/ekaone/json-cli)
103+
- [Issue Tracker](https://github.com/ekaone/json-cli/issues)
104+
105+
⭐ If this library helps you, please consider giving it a star on GitHub!

package.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "@ekaone/json-cli",
3+
"version": "0.0.1",
4+
"description": "AI-powered CLI task runner with JSON command plans",
5+
"keywords": ["ai", "agent", "cli", "task-runner", "llm"],
6+
"author": {
7+
"name": "Eka Prasetia",
8+
"email": "ekaone3033@gmail.com",
9+
"url": "https://prasetia.me"
10+
},
11+
"homepage": "https://github.com/ekaone/json-cli",
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/ekaone/json-cli"
15+
},
16+
"license": "MIT",
17+
"type": "module",
18+
"exports": {
19+
".": {
20+
"types": "./dist/index.d.ts",
21+
"import": "./dist/index.js",
22+
"require": "./dist/index.cjs"
23+
}
24+
},
25+
"main": "./dist/index.cjs",
26+
"module": "./dist/index.js",
27+
"types": "./dist/index.d.ts",
28+
"bin": {
29+
"json-cli": "./dist/cli.cjs"
30+
},
31+
"scripts": {
32+
"dev": "tsx src/cli.ts",
33+
"build": "tsup",
34+
"test": "vitest",
35+
"prepublishOnly": "npm run build",
36+
"typecheck": "tsc --noEmit"
37+
},
38+
"dependencies": {
39+
"@anthropic-ai/sdk": "^0.80.0",
40+
"@clack/prompts": "^1.1.0",
41+
"execa": "^9.6.1",
42+
"openai": "^6.32.0",
43+
"zod": "^4.3.6"
44+
},
45+
"devDependencies": {
46+
"@types/node": "^25.5.0",
47+
"tsup": "^8.5.1",
48+
"tsx": "^4.21.0",
49+
"typescript": "^5.9.3",
50+
"vitest": "^4.1.1"
51+
},
52+
"engines": {
53+
"node": ">=18.0.0"
54+
},
55+
"publishConfig": {
56+
"access": "public"
57+
}
58+
}

0 commit comments

Comments
 (0)