api-to-cli 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,27 +21,49 @@ This means anyone can create a CLI layer for an API, even if the API owner never
21
21
  - JSON error envelope
22
22
  - Env-var auth injection (`header` or `query`)
23
23
 
24
- ## Project Setup
25
- Clone this repository to any local folder and run commands from the repo root.
24
+ ## Install and Run
25
+
26
+ ### Option A: Run with npx (no global install)
27
+
28
+ ```bash
29
+ npx api-to-cli --help
30
+ ```
31
+
32
+ ### Option B: Install globally with npm
33
+
34
+ ```bash
35
+ npm install -g api-to-cli
36
+ api-to-cli --help
37
+ ```
26
38
 
27
39
  ## Core Commands
28
40
 
41
+ Use either `npx api-to-cli` or `api-to-cli` (if globally installed).
42
+
29
43
  ```bash
30
44
  # 1) Validate config only
31
- node ./bin/api-to-cli.js validate \
45
+ npx api-to-cli validate \
32
46
  --config ./examples/trello/api-to-cli.config.js
33
47
 
34
48
  # 2) Generate only the CLI project
35
- node ./bin/api-to-cli.js generate \
49
+ npx api-to-cli generate \
36
50
  --config ./examples/trello/api-to-cli.config.js \
37
51
  --output ./examples/trello/trelloapi-cli
38
52
 
39
53
  # 3) Generate a full agent bundle (CLI + skill + manifest)
40
- node ./bin/api-to-cli.js scaffold \
54
+ npx api-to-cli scaffold \
41
55
  --config ./examples/trello/api-to-cli.config.js \
42
56
  --output ./examples/trello/trelloapi-agent
43
57
  ```
44
58
 
59
+ ## Local Development
60
+
61
+ If you cloned this repo and want to run from source:
62
+
63
+ ```bash
64
+ node ./bin/api-to-cli.js --help
65
+ ```
66
+
45
67
  ## Scaffold Output Layout
46
68
 
47
69
  ```text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-to-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Generate AI-agent-friendly CLIs, skills, and manifests from API configs",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -12,9 +12,7 @@
12
12
  "src",
13
13
  "examples",
14
14
  "README.md",
15
- "LICENSE",
16
- "PROJECT_BRIEF.md",
17
- "SPEC.md"
15
+ "LICENSE"
18
16
  ],
19
17
  "engines": {
20
18
  "node": ">=18"
package/PROJECT_BRIEF.md DELETED
@@ -1,65 +0,0 @@
1
- # API-to-CLI Project Brief
2
-
3
- ## Working Name
4
- - Recommended: `AgentBridge`
5
- - NPM package (generator): `api-to-cli`
6
- - Why this split: product name can be brandable, while npm name stays literal and searchable.
7
-
8
- Other viable names:
9
- - `APIBridge`
10
- - `CLIForge`
11
- - `Toolwire`
12
-
13
- ## Problem
14
- Most APIs are not directly usable by AI agents. We want a generator that turns a REST API definition into:
15
- 1. an AI-agent-friendly CLI (JSON-first output), and
16
- 2. an MCP server exposing equivalent tools.
17
-
18
- ## What We Are Building (MVP)
19
- - Input:
20
- - `api-to-cli.config.js` custom config (first)
21
- - OpenAPI support later
22
- - Output:
23
- - Installable Node CLI
24
- - MCP server
25
- - Core behavior:
26
- - JSON output by default
27
- - Consistent JSON error envelope
28
- - Shared auth handling (API key + bearer first)
29
- - Safe-by-default confirmations for destructive methods
30
-
31
- ## Explicit Non-Goals (MVP)
32
- - Full OAuth/device flow in v1
33
- - Every OpenAPI edge case in v1
34
- - Multi-language generators in v1
35
-
36
- ## Demo API Choice (Free + Popular, No First-Party CLI)
37
- Recommended demo target: **Trello REST API**
38
- - Popular real product used by millions
39
- - Free plan available
40
- - Official REST API docs and auth flow
41
- - No first-party Trello CLI from Atlassian (there are community CLIs, which is fine and reinforces the need)
42
-
43
- Key references:
44
- - API reference landing: https://developer.atlassian.com/cloud/trello/rest/
45
- - API introduction (first calls, key + token): https://developer.atlassian.com/cloud/trello/guides/rest-api/api-introduction/
46
- - Authorization details: https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/
47
- - Pricing (Free plan): https://trello.com/pricing
48
-
49
- ## MVP Command Set for Trello Demo
50
- - `trelloapi me`
51
- - `trelloapi list-boards`
52
- - `trelloapi list-cards --board-id <id>`
53
- - `trelloapi create-card --list-id <id> --name <title> --yes`
54
-
55
- ## Build Sequence
56
- 1. Generator from custom config -> CLI output (GET-only)
57
- 2. Add POST/PUT/PATCH/DELETE with `--yes` guard
58
- 3. Generate MCP server from same config
59
- 4. Add OpenAPI parsing layer
60
-
61
- ## Immediate Next Step (Before Coding)
62
- Finalize:
63
- 1. Product name (`AgentBridge` vs alternatives)
64
- 2. Package names (`api-to-cli`, `@randyventures/api-to-cli`, or other)
65
- 3. Trello as first official example API
package/SPEC.md DELETED
@@ -1,99 +0,0 @@
1
- # AgentBridge MVP Spec
2
-
3
- ## Location
4
- - Project folder: repository root (where this project is cloned)
5
- - This project is standalone and not nested inside another repo
6
-
7
- ## Product Identity
8
- - Product name: `AgentBridge`
9
- - Generator package name: `api-to-cli`
10
-
11
- ## Goal
12
- Given a config file describing API endpoints, generate:
13
- 1. a JSON-first CLI, and
14
- 2. an MCP server exposing matching tools.
15
-
16
- ## Demo API (First Example)
17
- - Trello REST API
18
- - Why: popular, free tier, official docs, no first-party Trello CLI from Atlassian
19
-
20
- ## MVP Scope (Current)
21
- - Input:
22
- - `api-to-cli.config.js`
23
- - Generator commands:
24
- - `validate`
25
- - `generate`
26
- - Output:
27
- - generated CLI project
28
- - Endpoint support:
29
- - GET only
30
- - Auth support:
31
- - env-var credentials injected into header or query
32
-
33
- ## CLI Behavior Requirements
34
- - Every command prints valid JSON to stdout on success.
35
- - Every failure prints JSON in this shape:
36
- ```json
37
- {
38
- "error": true,
39
- "code": "REQUEST_FAILED",
40
- "message": "...",
41
- "details": {}
42
- }
43
- ```
44
- - Exit code:
45
- - `0` on success
46
- - non-zero on error
47
-
48
- ## Security Requirements
49
- - Credentials must come from environment variables only.
50
- - Generated code must not write credentials to files.
51
- - Error output must not include auth headers, tokens, or full request URLs.
52
-
53
- ## Generated Project Structure (MVP)
54
- ```text
55
- <name>-cli/
56
- package.json
57
- bin/<name>
58
- commands/*.js
59
- lib/client.js
60
- lib/output.js
61
- ```
62
-
63
- ## Config Shape (MVP)
64
- ```js
65
- module.exports = {
66
- name: "trelloapi",
67
- version: "1.0.0",
68
- apiBase: "https://api.trello.com/1",
69
- auth: {
70
- credentials: [
71
- { envVar: "TRELLO_KEY", in: "query", name: "key" },
72
- { envVar: "TRELLO_TOKEN", in: "query", name: "token" }
73
- ]
74
- },
75
- commands: [
76
- {
77
- name: "get-board",
78
- description: "Get a board by ID",
79
- method: "GET",
80
- path: "/boards/{boardId}",
81
- params: {
82
- boardId: { type: "string", required: true }
83
- }
84
- }
85
- ]
86
- };
87
- ```
88
-
89
- ## Out of Scope for MVP
90
- - OpenAPI parsing
91
- - MCP generation
92
- - POST/PUT/PATCH/DELETE
93
- - confirmation prompts (`--yes`)
94
- - OAuth flow
95
-
96
- ## Success Criteria
97
- - `api-to-cli validate --config <file>` validates and returns summary JSON.
98
- - `api-to-cli generate --config <file> --output <dir>` creates runnable CLI.
99
- - Generated CLI executes GET commands and emits valid JSON success/error output.