@claypi/cli 0.0.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/README.md +70 -0
- package/dist/index.js +26448 -0
- package/dist/index.js.map +1 -0
- package/package.json +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# `@claypi/cli`
|
|
2
|
+
|
|
3
|
+
> The Clay command-line interface — the `clay` binary.
|
|
4
|
+
|
|
5
|
+
JSON-first, agent-first. Every command emits structured JSON on stdout for success and a typed error envelope on stderr; there is no human-formatted output mode. End-user-facing docs live in `clay --help` and `clay <command> --help`. The authoring guide for new commands is [`AGENTS.md`](./AGENTS.md).
|
|
6
|
+
|
|
7
|
+
## Local Development
|
|
8
|
+
|
|
9
|
+
This package lives under `apps/cli/` in the `clay-base` monorepo. Top-level setup (`yarn install`, etc.) is covered in the repo's root `AGENTS.md`.
|
|
10
|
+
|
|
11
|
+
### Build, test, lint
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn workspace @claypi/cli build # bundle the binary into dist/
|
|
15
|
+
yarn workspace @claypi/cli dev # tsup --watch (rebuilds on save)
|
|
16
|
+
yarn workspace @claypi/cli tsc # type-check
|
|
17
|
+
yarn workspace @claypi/cli lint
|
|
18
|
+
yarn workspace @claypi/cli format:check
|
|
19
|
+
yarn workspace @claypi/cli test # unit + e2e (e2e requires `build` first)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Running the locally built CLI
|
|
23
|
+
|
|
24
|
+
After `build`, the entry point is `dist/index.js`. Invoke it directly with `node`:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# From this package (apps/cli):
|
|
28
|
+
node dist/index.js --help
|
|
29
|
+
node dist/index.js whoami
|
|
30
|
+
node dist/index.js tools list --limit 5
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Point at a non-prod backend with `CLAY_BASE_URL`, and isolate your config so it doesn't clobber your real `~/.config/clay/`:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Talk to local API + use a throwaway config dir
|
|
37
|
+
CLAY_BASE_URL=http://localhost:3001 \
|
|
38
|
+
CLAY_CONFIG_HOME=/tmp/clay-dev \
|
|
39
|
+
node dist/index.js login --stdin <<< "$LOCAL_API_KEY"
|
|
40
|
+
|
|
41
|
+
CLAY_BASE_URL=http://localhost:3001 \
|
|
42
|
+
CLAY_CONFIG_HOME=/tmp/clay-dev \
|
|
43
|
+
node dist/index.js whoami
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`CLAY_CONFIG_HOME` makes the CLI write to `<that-dir>/clay/config.json` instead of `~/.config/clay/config.json`, so you can keep prod and dev credentials separate.
|
|
47
|
+
|
|
48
|
+
If you want to use the iteration loop with `dev`/watch mode, run `dev` in one terminal and invoke `node dist/index.js ...` in another — each run reads the freshly rebuilt bundle.
|
|
49
|
+
|
|
50
|
+
### Optional: link the binary as `clay`
|
|
51
|
+
|
|
52
|
+
If you want the literal `clay` command in your shell pointing at your local build:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# From apps/cli/
|
|
56
|
+
yarn build
|
|
57
|
+
npm link # registers `clay` -> dist/index.js
|
|
58
|
+
clay whoami
|
|
59
|
+
npm unlink -g @claypi/cli # when you're done
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
(Use sparingly — it shadows any globally installed `@claypi/cli`.)
|
|
63
|
+
|
|
64
|
+
### E2E tests
|
|
65
|
+
|
|
66
|
+
The e2e tests spawn the built binary against a mock server (`tests/e2e/helpers/mock-api.ts`); they skip themselves with a console warning if `dist/` is missing, so run `build` first.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
For everything else — output contract, error model, exit-code categories, command-authoring conventions, progressive disclosure, and the evolution rules — see [`AGENTS.md`](./AGENTS.md).
|