api-to-cli 0.1.1
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/LICENSE +21 -0
- package/PROJECT_BRIEF.md +65 -0
- package/README.md +130 -0
- package/SPEC.md +99 -0
- package/bin/api-to-cli.js +5 -0
- package/examples/trello/api-to-cli.config.js +60 -0
- package/examples/trello/trelloapi-agent/README.md +11 -0
- package/examples/trello/trelloapi-agent/agentbridge.manifest.json +68 -0
- package/examples/trello/trelloapi-agent/cli/README.md +25 -0
- package/examples/trello/trelloapi-agent/cli/bin/trelloapi.js +37 -0
- package/examples/trello/trelloapi-agent/cli/commands/get-board.js +41 -0
- package/examples/trello/trelloapi-agent/cli/commands/list-board-lists.js +41 -0
- package/examples/trello/trelloapi-agent/cli/commands/list-list-cards.js +41 -0
- package/examples/trello/trelloapi-agent/cli/lib/client.js +90 -0
- package/examples/trello/trelloapi-agent/cli/lib/output.js +21 -0
- package/examples/trello/trelloapi-agent/cli/package.json +16 -0
- package/examples/trello/trelloapi-agent/skill/SKILL.md +34 -0
- package/examples/trello/trelloapi-cli/README.md +25 -0
- package/examples/trello/trelloapi-cli/bin/trelloapi.js +37 -0
- package/examples/trello/trelloapi-cli/commands/get-board.js +41 -0
- package/examples/trello/trelloapi-cli/commands/list-board-lists.js +41 -0
- package/examples/trello/trelloapi-cli/commands/list-list-cards.js +41 -0
- package/examples/trello/trelloapi-cli/lib/client.js +90 -0
- package/examples/trello/trelloapi-cli/lib/output.js +21 -0
- package/examples/trello/trelloapi-cli/package.json +16 -0
- package/package.json +48 -0
- package/src/commands/generate.js +36 -0
- package/src/commands/scaffold.js +110 -0
- package/src/commands/validate.js +30 -0
- package/src/index.js +92 -0
- package/src/lib/config-utils.js +21 -0
- package/src/lib/generate-cli.js +295 -0
- package/src/lib/generate-manifest.js +51 -0
- package/src/lib/generate-skill.js +50 -0
- package/src/lib/load-config.js +120 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RandyVentures
|
|
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.
|
package/PROJECT_BRIEF.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
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/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# AgentBridge (`api-to-cli`)
|
|
2
|
+
|
|
3
|
+
Generate AI-agent-friendly CLIs from API configs.
|
|
4
|
+
|
|
5
|
+
## What It Does
|
|
6
|
+
AgentBridge takes an API config and generates artifacts that an AI agent can use immediately:
|
|
7
|
+
- A JSON-first CLI project
|
|
8
|
+
- A `SKILL.md` file with usage instructions
|
|
9
|
+
- A machine-readable `agentbridge.manifest.json`
|
|
10
|
+
|
|
11
|
+
This means anyone can create a CLI layer for an API, even if the API owner never ships one.
|
|
12
|
+
|
|
13
|
+
## Current Scope
|
|
14
|
+
- Generator commands:
|
|
15
|
+
- `validate`
|
|
16
|
+
- `generate`
|
|
17
|
+
- `scaffold`
|
|
18
|
+
- Generated CLI support:
|
|
19
|
+
- GET endpoints (MVP)
|
|
20
|
+
- JSON output by default
|
|
21
|
+
- JSON error envelope
|
|
22
|
+
- Env-var auth injection (`header` or `query`)
|
|
23
|
+
|
|
24
|
+
## Project Setup
|
|
25
|
+
Clone this repository to any local folder and run commands from the repo root.
|
|
26
|
+
|
|
27
|
+
## Core Commands
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# 1) Validate config only
|
|
31
|
+
node ./bin/api-to-cli.js validate \
|
|
32
|
+
--config ./examples/trello/api-to-cli.config.js
|
|
33
|
+
|
|
34
|
+
# 2) Generate only the CLI project
|
|
35
|
+
node ./bin/api-to-cli.js generate \
|
|
36
|
+
--config ./examples/trello/api-to-cli.config.js \
|
|
37
|
+
--output ./examples/trello/trelloapi-cli
|
|
38
|
+
|
|
39
|
+
# 3) Generate a full agent bundle (CLI + skill + manifest)
|
|
40
|
+
node ./bin/api-to-cli.js scaffold \
|
|
41
|
+
--config ./examples/trello/api-to-cli.config.js \
|
|
42
|
+
--output ./examples/trello/trelloapi-agent
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Scaffold Output Layout
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
<output>/
|
|
49
|
+
README.md
|
|
50
|
+
agentbridge.manifest.json
|
|
51
|
+
cli/
|
|
52
|
+
package.json
|
|
53
|
+
bin/<name>.js
|
|
54
|
+
commands/*.js
|
|
55
|
+
lib/client.js
|
|
56
|
+
lib/output.js
|
|
57
|
+
README.md
|
|
58
|
+
skill/
|
|
59
|
+
SKILL.md
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Architecture
|
|
63
|
+
|
|
64
|
+
```mermaid
|
|
65
|
+
flowchart LR
|
|
66
|
+
C[api-to-cli.config.js] --> V[validate]
|
|
67
|
+
C --> G[generate]
|
|
68
|
+
C --> S[scaffold]
|
|
69
|
+
G --> CLI[Generated CLI Project]
|
|
70
|
+
S --> CLI2[cli/]
|
|
71
|
+
S --> SK[skill/SKILL.md]
|
|
72
|
+
S --> MF[agentbridge.manifest.json]
|
|
73
|
+
MF --> AG[AI Agent]
|
|
74
|
+
SK --> AG
|
|
75
|
+
AG --> RUN[Run generated CLI commands]
|
|
76
|
+
RUN --> API[Target REST API]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## How AI Agents Use This
|
|
80
|
+
1. Agent reads `agentbridge.manifest.json` to discover commands, params, auth env vars, and install steps.
|
|
81
|
+
2. Agent reads `skill/SKILL.md` for operating rules and command examples.
|
|
82
|
+
3. Agent executes the generated CLI and parses JSON stdout/stderr.
|
|
83
|
+
|
|
84
|
+
## Suggested Usage Flows
|
|
85
|
+
|
|
86
|
+
### Flow A: Local Personal Use (No API Owner Needed)
|
|
87
|
+
1. Write `api-to-cli.config.js` for the target API.
|
|
88
|
+
2. Run `scaffold`.
|
|
89
|
+
3. Set required auth env vars.
|
|
90
|
+
4. Let your agent use the generated CLI locally.
|
|
91
|
+
|
|
92
|
+
### Flow B: Team/Internal Use
|
|
93
|
+
1. Run `scaffold`.
|
|
94
|
+
2. Commit generated output to an internal repo.
|
|
95
|
+
3. Publish generated CLI to private npm registry (optional).
|
|
96
|
+
4. Point team agents to the shared skill + manifest.
|
|
97
|
+
|
|
98
|
+
### Flow C: Public Distribution
|
|
99
|
+
1. Generate CLI from API config.
|
|
100
|
+
2. Validate behavior, docs, and API ToS compliance.
|
|
101
|
+
3. Publish generated CLI package publicly.
|
|
102
|
+
4. Publish skill + manifest so agents can onboard automatically.
|
|
103
|
+
|
|
104
|
+
## Security Model
|
|
105
|
+
- Credentials are read from environment variables only.
|
|
106
|
+
- Generated CLIs do not persist credentials.
|
|
107
|
+
- Generated errors do not include auth headers or full URLs.
|
|
108
|
+
- Do not pass API keys/tokens as CLI flags.
|
|
109
|
+
|
|
110
|
+
## Example Config (Trello)
|
|
111
|
+
See `examples/trello/api-to-cli.config.js` for:
|
|
112
|
+
- query-based auth (`TRELLO_KEY`, `TRELLO_TOKEN`)
|
|
113
|
+
- path parameter endpoints
|
|
114
|
+
- generated command mapping
|
|
115
|
+
|
|
116
|
+
## Smoke Test
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm run test:smoke
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This runs:
|
|
123
|
+
- `validate:trello`
|
|
124
|
+
- `generate:trello`
|
|
125
|
+
- `scaffold:trello`
|
|
126
|
+
|
|
127
|
+
## Notes
|
|
128
|
+
- Generated CLIs depend on `commander`.
|
|
129
|
+
- The generator currently targets CommonJS + Node runtime with `fetch` support.
|
|
130
|
+
- Planned next phases include MCP generation and OpenAPI input support.
|
package/SPEC.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
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.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
name: 'trelloapi',
|
|
3
|
+
version: '1.0.0',
|
|
4
|
+
apiBase: 'https://api.trello.com/1',
|
|
5
|
+
auth: {
|
|
6
|
+
credentials: [
|
|
7
|
+
{
|
|
8
|
+
envVar: 'TRELLO_KEY',
|
|
9
|
+
in: 'query',
|
|
10
|
+
name: 'key'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
envVar: 'TRELLO_TOKEN',
|
|
14
|
+
in: 'query',
|
|
15
|
+
name: 'token'
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
commands: [
|
|
20
|
+
{
|
|
21
|
+
name: 'get-board',
|
|
22
|
+
description: 'Get a board by ID',
|
|
23
|
+
method: 'GET',
|
|
24
|
+
path: '/boards/{boardId}',
|
|
25
|
+
params: {
|
|
26
|
+
boardId: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
required: true,
|
|
29
|
+
description: 'Trello board ID'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'list-board-lists',
|
|
35
|
+
description: 'List lists on a board',
|
|
36
|
+
method: 'GET',
|
|
37
|
+
path: '/boards/{boardId}/lists',
|
|
38
|
+
params: {
|
|
39
|
+
boardId: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
required: true,
|
|
42
|
+
description: 'Trello board ID'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'list-list-cards',
|
|
48
|
+
description: 'List cards in a list',
|
|
49
|
+
method: 'GET',
|
|
50
|
+
path: '/lists/{listId}/cards',
|
|
51
|
+
params: {
|
|
52
|
+
listId: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
required: true,
|
|
55
|
+
description: 'Trello list ID'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0",
|
|
3
|
+
"generatedBy": "AgentBridge",
|
|
4
|
+
"generatedAt": "2026-02-20T00:42:33.467Z",
|
|
5
|
+
"project": {
|
|
6
|
+
"name": "trelloapi",
|
|
7
|
+
"version": "1.0.0"
|
|
8
|
+
},
|
|
9
|
+
"cli": {
|
|
10
|
+
"projectPath": "./cli",
|
|
11
|
+
"packageName": "trelloapi-cli",
|
|
12
|
+
"binary": "trelloapi",
|
|
13
|
+
"install": [
|
|
14
|
+
"npm install",
|
|
15
|
+
"npm link"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"auth": {
|
|
19
|
+
"envVars": [
|
|
20
|
+
"TRELLO_KEY",
|
|
21
|
+
"TRELLO_TOKEN"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"commands": [
|
|
25
|
+
{
|
|
26
|
+
"name": "get-board",
|
|
27
|
+
"description": "Get a board by ID",
|
|
28
|
+
"method": "GET",
|
|
29
|
+
"path": "/boards/{boardId}",
|
|
30
|
+
"params": [
|
|
31
|
+
{
|
|
32
|
+
"name": "boardId",
|
|
33
|
+
"required": true,
|
|
34
|
+
"description": "Trello board ID"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "list-board-lists",
|
|
40
|
+
"description": "List lists on a board",
|
|
41
|
+
"method": "GET",
|
|
42
|
+
"path": "/boards/{boardId}/lists",
|
|
43
|
+
"params": [
|
|
44
|
+
{
|
|
45
|
+
"name": "boardId",
|
|
46
|
+
"required": true,
|
|
47
|
+
"description": "Trello board ID"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "list-list-cards",
|
|
53
|
+
"description": "List cards in a list",
|
|
54
|
+
"method": "GET",
|
|
55
|
+
"path": "/lists/{listId}/cards",
|
|
56
|
+
"params": [
|
|
57
|
+
{
|
|
58
|
+
"name": "listId",
|
|
59
|
+
"required": true,
|
|
60
|
+
"description": "Trello list ID"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"agent": {
|
|
66
|
+
"skillPath": "./skill/SKILL.md"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# trelloapi CLI
|
|
2
|
+
|
|
3
|
+
Generated by AgentBridge (api-to-cli).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
npm link
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Auth
|
|
13
|
+
|
|
14
|
+
Set required environment variables before running commands:
|
|
15
|
+
|
|
16
|
+
- `TRELLO_KEY`
|
|
17
|
+
- `TRELLO_TOKEN`
|
|
18
|
+
|
|
19
|
+
Do not pass secrets as command flags.
|
|
20
|
+
|
|
21
|
+
## Commands
|
|
22
|
+
|
|
23
|
+
- `trelloapi get-board` - Get a board by ID
|
|
24
|
+
- `trelloapi list-board-lists` - List lists on a board
|
|
25
|
+
- `trelloapi list-list-cards` - List cards in a list
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { Command } = require('commander');
|
|
4
|
+
|
|
5
|
+
const cmd0 = require('../commands/get-board');
|
|
6
|
+
const cmd1 = require('../commands/list-board-lists');
|
|
7
|
+
const cmd2 = require('../commands/list-list-cards');
|
|
8
|
+
|
|
9
|
+
const program = new Command();
|
|
10
|
+
|
|
11
|
+
program
|
|
12
|
+
.name('trelloapi')
|
|
13
|
+
.description('trelloapi CLI generated by AgentBridge')
|
|
14
|
+
.version('1.0.0');
|
|
15
|
+
|
|
16
|
+
program
|
|
17
|
+
.command('get-board')
|
|
18
|
+
.description('Get a board by ID')
|
|
19
|
+
.option('--board-id <value>', 'Trello board ID')
|
|
20
|
+
.option('--pretty', 'Pretty-print JSON')
|
|
21
|
+
.action((options) => cmd0.run(options));
|
|
22
|
+
|
|
23
|
+
program
|
|
24
|
+
.command('list-board-lists')
|
|
25
|
+
.description('List lists on a board')
|
|
26
|
+
.option('--board-id <value>', 'Trello board ID')
|
|
27
|
+
.option('--pretty', 'Pretty-print JSON')
|
|
28
|
+
.action((options) => cmd1.run(options));
|
|
29
|
+
|
|
30
|
+
program
|
|
31
|
+
.command('list-list-cards')
|
|
32
|
+
.description('List cards in a list')
|
|
33
|
+
.option('--list-id <value>', 'Trello list ID')
|
|
34
|
+
.option('--pretty', 'Pretty-print JSON')
|
|
35
|
+
.action((options) => cmd2.run(options));
|
|
36
|
+
|
|
37
|
+
program.parse(process.argv);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const { request } = require('../lib/client');
|
|
2
|
+
const output = require('../lib/output');
|
|
3
|
+
|
|
4
|
+
const command = {
|
|
5
|
+
"name": "get-board",
|
|
6
|
+
"description": "Get a board by ID",
|
|
7
|
+
"method": "GET",
|
|
8
|
+
"path": "/boards/{boardId}",
|
|
9
|
+
"params": {
|
|
10
|
+
"boardId": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"required": true,
|
|
13
|
+
"description": "Trello board ID"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
async function getBoard(options) {
|
|
19
|
+
try {
|
|
20
|
+
const data = await request(command, options);
|
|
21
|
+
output.json(data, Boolean(options.pretty));
|
|
22
|
+
} catch (error) {
|
|
23
|
+
output.error(
|
|
24
|
+
{
|
|
25
|
+
code: error.statusCode ? 'HTTP_ERROR' : 'REQUEST_FAILED',
|
|
26
|
+
message: error.message,
|
|
27
|
+
details: {
|
|
28
|
+
statusCode: error.statusCode || null,
|
|
29
|
+
command: command.name
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
Boolean(options.pretty)
|
|
33
|
+
);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = {
|
|
39
|
+
run: getBoard,
|
|
40
|
+
command
|
|
41
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const { request } = require('../lib/client');
|
|
2
|
+
const output = require('../lib/output');
|
|
3
|
+
|
|
4
|
+
const command = {
|
|
5
|
+
"name": "list-board-lists",
|
|
6
|
+
"description": "List lists on a board",
|
|
7
|
+
"method": "GET",
|
|
8
|
+
"path": "/boards/{boardId}/lists",
|
|
9
|
+
"params": {
|
|
10
|
+
"boardId": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"required": true,
|
|
13
|
+
"description": "Trello board ID"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
async function listBoardLists(options) {
|
|
19
|
+
try {
|
|
20
|
+
const data = await request(command, options);
|
|
21
|
+
output.json(data, Boolean(options.pretty));
|
|
22
|
+
} catch (error) {
|
|
23
|
+
output.error(
|
|
24
|
+
{
|
|
25
|
+
code: error.statusCode ? 'HTTP_ERROR' : 'REQUEST_FAILED',
|
|
26
|
+
message: error.message,
|
|
27
|
+
details: {
|
|
28
|
+
statusCode: error.statusCode || null,
|
|
29
|
+
command: command.name
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
Boolean(options.pretty)
|
|
33
|
+
);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = {
|
|
39
|
+
run: listBoardLists,
|
|
40
|
+
command
|
|
41
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const { request } = require('../lib/client');
|
|
2
|
+
const output = require('../lib/output');
|
|
3
|
+
|
|
4
|
+
const command = {
|
|
5
|
+
"name": "list-list-cards",
|
|
6
|
+
"description": "List cards in a list",
|
|
7
|
+
"method": "GET",
|
|
8
|
+
"path": "/lists/{listId}/cards",
|
|
9
|
+
"params": {
|
|
10
|
+
"listId": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"required": true,
|
|
13
|
+
"description": "Trello list ID"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
async function listListCards(options) {
|
|
19
|
+
try {
|
|
20
|
+
const data = await request(command, options);
|
|
21
|
+
output.json(data, Boolean(options.pretty));
|
|
22
|
+
} catch (error) {
|
|
23
|
+
output.error(
|
|
24
|
+
{
|
|
25
|
+
code: error.statusCode ? 'HTTP_ERROR' : 'REQUEST_FAILED',
|
|
26
|
+
message: error.message,
|
|
27
|
+
details: {
|
|
28
|
+
statusCode: error.statusCode || null,
|
|
29
|
+
command: command.name
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
Boolean(options.pretty)
|
|
33
|
+
);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = {
|
|
39
|
+
run: listListCards,
|
|
40
|
+
command
|
|
41
|
+
};
|