|
1 | | -# yaak-cli |
| 1 | +# Yaak CLI |
2 | 2 |
|
3 | | -Command-line interface for Yaak. |
| 3 | +The `yaak` CLI for publishing plugins and creating/updating/sending requests. |
4 | 4 |
|
5 | | -## Command Overview |
| 5 | +## Installation |
6 | 6 |
|
7 | | -Current top-level commands: |
| 7 | +```sh |
| 8 | +npm install @yaakapp/cli |
| 9 | +``` |
| 10 | + |
| 11 | +## Agentic Workflows |
| 12 | + |
| 13 | +The `yaak` CLI is primarily meant to be used by AI agents, and has the following features: |
| 14 | + |
| 15 | +- `schema` subcommands to get the JSON Schema for any model (eg. `yaak request schema http`) |
| 16 | +- `--json '{...}'` input format to create and update data |
| 17 | +- `--verbose` mode for extracting debug info while sending requests |
| 18 | +- The ability to send entire workspaces and folders (Supports `--parallel` and `--fail-fast`) |
| 19 | + |
| 20 | +### Example Prompts |
| 21 | + |
| 22 | +Use the `yaak` CLI with agents like Claude or Codex to do useful things for you. |
| 23 | + |
| 24 | +Here are some example prompts: |
8 | 25 |
|
9 | 26 | ```text |
10 | | -yaakcli send <request_id> |
11 | | -yaakcli agent-help |
12 | | -yaakcli workspace list |
13 | | -yaakcli workspace schema [--pretty] |
14 | | -yaakcli workspace show <workspace_id> |
15 | | -yaakcli workspace create --name <name> |
16 | | -yaakcli workspace create --json '{"name":"My Workspace"}' |
17 | | -yaakcli workspace create '{"name":"My Workspace"}' |
18 | | -yaakcli workspace update --json '{"id":"wk_abc","description":"Updated"}' |
19 | | -yaakcli workspace delete <workspace_id> [--yes] |
20 | | -yaakcli request list <workspace_id> |
21 | | -yaakcli request show <request_id> |
22 | | -yaakcli request send <request_id> |
23 | | -yaakcli request create <workspace_id> --name <name> --url <url> [--method GET] |
24 | | -yaakcli request create --json '{"workspaceId":"wk_abc","name":"Users","url":"https://api.example.com/users"}' |
25 | | -yaakcli request create '{"workspaceId":"wk_abc","name":"Users","url":"https://api.example.com/users"}' |
26 | | -yaakcli request update --json '{"id":"rq_abc","name":"Users v2"}' |
27 | | -yaakcli request delete <request_id> [--yes] |
28 | | -yaakcli folder list <workspace_id> |
29 | | -yaakcli folder show <folder_id> |
30 | | -yaakcli folder create <workspace_id> --name <name> |
31 | | -yaakcli folder create --json '{"workspaceId":"wk_abc","name":"Auth"}' |
32 | | -yaakcli folder create '{"workspaceId":"wk_abc","name":"Auth"}' |
33 | | -yaakcli folder update --json '{"id":"fl_abc","name":"Auth v2"}' |
34 | | -yaakcli folder delete <folder_id> [--yes] |
35 | | -yaakcli environment list <workspace_id> |
36 | | -yaakcli environment schema [--pretty] |
37 | | -yaakcli environment show <environment_id> |
38 | | -yaakcli environment create <workspace_id> --name <name> |
39 | | -yaakcli environment create --json '{"workspaceId":"wk_abc","name":"Production"}' |
40 | | -yaakcli environment create '{"workspaceId":"wk_abc","name":"Production"}' |
41 | | -yaakcli environment update --json '{"id":"ev_abc","color":"#00ff00"}' |
42 | | -yaakcli environment delete <environment_id> [--yes] |
| 27 | +Scan my API routes and create a workspace (using yaak cli) with |
| 28 | +all the requests needed for me to do manual testing? |
43 | 29 | ``` |
44 | 30 |
|
45 | | -Global options: |
46 | | - |
47 | | -- `--data-dir <path>`: use a custom data directory |
48 | | -- `-e, --environment <id>`: environment to use during request rendering/sending |
49 | | -- `-v, --verbose`: verbose send output (events and streamed response body) |
50 | | -- `--log [level]`: enable CLI logging; optional level is `error|warn|info|debug|trace` |
51 | | - |
52 | | -Notes: |
53 | | - |
54 | | -- `send` is currently a shortcut for sending an HTTP request ID. |
55 | | -- `delete` commands prompt for confirmation unless `--yes` is provided. |
56 | | -- In non-interactive mode, `delete` commands require `--yes`. |
57 | | -- `create` and `update` commands support `--json` and positional JSON shorthand. |
58 | | -- For `create` commands, use one input mode at a time. Example: do not combine `<workspace_id>` with `--json`. |
59 | | -- Template tags use `${[ ... ]}` syntax (for example `${[API_BASE_URL]}`), not `{{ ... }}`. |
60 | | -- `update` uses JSON Merge Patch semantics (RFC 7386) for partial updates. |
61 | | - |
62 | | -## Examples |
63 | | - |
64 | | -```bash |
65 | | -yaakcli workspace list |
66 | | -yaakcli workspace create --name "My Workspace" |
67 | | -yaakcli workspace show wk_abc |
68 | | -yaakcli workspace update --json '{"id":"wk_abc","description":"Team workspace"}' |
69 | | -yaakcli request list wk_abc |
70 | | -yaakcli request show rq_abc |
71 | | -yaakcli request create wk_abc --name "Users" --url "https://api.example.com/users" |
72 | | -yaakcli request update --json '{"id":"rq_abc","name":"Users v2"}' |
73 | | -yaakcli request send rq_abc -e ev_abc |
74 | | -yaakcli request delete rq_abc --yes |
75 | | -yaakcli folder create wk_abc --name "Auth" |
76 | | -yaakcli folder update --json '{"id":"fl_abc","name":"Auth v2"}' |
77 | | -yaakcli environment create wk_abc --name "Production" |
78 | | -yaakcli environment update --json '{"id":"ev_abc","color":"#00ff00"}' |
| 31 | +```text |
| 32 | +Send all the GraphQL requests in my workspace |
79 | 33 | ``` |
80 | 34 |
|
81 | | -## Roadmap |
| 35 | +## Description |
| 36 | + |
| 37 | +Here's the current print of `yaak --help` |
| 38 | + |
| 39 | +```text |
| 40 | +Yaak CLI - API client from the command line |
| 41 | +
|
| 42 | +Usage: yaak [OPTIONS] <COMMAND> |
82 | 43 |
|
83 | | -Planned command expansion (request schema and polymorphic send) is tracked in `PLAN.md`. |
| 44 | +Commands: |
| 45 | + auth Authentication commands |
| 46 | + plugin Plugin development and publishing commands |
| 47 | + send Send a request, folder, or workspace by ID |
| 48 | + workspace Workspace commands |
| 49 | + request Request commands |
| 50 | + folder Folder commands |
| 51 | + environment Environment commands |
84 | 52 |
|
85 | | -When command behavior changes, update this README and verify with: |
| 53 | +Options: |
| 54 | + --data-dir <DATA_DIR> Use a custom data directory |
| 55 | + -e, --environment <ENVIRONMENT> Environment ID to use for variable substitution |
| 56 | + -v, --verbose Enable verbose send output (events and streamed response body) |
| 57 | + --log [<LEVEL>] Enable CLI logging; optionally set level (error|warn|info|debug|trace) [possible values: error, warn, info, debug, trace] |
| 58 | + -h, --help Print help |
| 59 | + -V, --version Print version |
86 | 60 |
|
87 | | -```bash |
88 | | -cargo run -q -p yaak-cli -- --help |
89 | | -cargo run -q -p yaak-cli -- request --help |
90 | | -cargo run -q -p yaak-cli -- workspace --help |
91 | | -cargo run -q -p yaak-cli -- folder --help |
92 | | -cargo run -q -p yaak-cli -- environment --help |
| 61 | +Agent Hints: |
| 62 | + - Template variable syntax is ${[ my_var ]}, not {{ ... }} |
| 63 | + - Template function syntax is ${[ namespace.my_func(a='aaa',b='bbb') ]} |
| 64 | + - View JSONSchema for models before creating or updating (eg. `yaak request schema http`) |
| 65 | + - Deletion requires confirmation (--yes for non-interactive environments) |
93 | 66 | ``` |
0 commit comments