zernio-cli 0.4.0
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 +145 -0
- package/SKILL.md +98 -0
- package/claude/plugin.json +23 -0
- package/claude/skills/zernio/SKILL.md +83 -0
- package/claude/skills/zernio/references/zernio-api-surface.md +48 -0
- package/claude/skills/zernio/references/zernio-best-practices.md +33 -0
- package/claude/skills/zernio/references/zernio-workflows.md +58 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.js +14 -0
- package/dist/commands/accounts.d.ts +3 -0
- package/dist/commands/accounts.js +53 -0
- package/dist/commands/analytics.d.ts +3 -0
- package/dist/commands/analytics.js +85 -0
- package/dist/commands/api.d.ts +2 -0
- package/dist/commands/api.js +108 -0
- package/dist/commands/auth.d.ts +3 -0
- package/dist/commands/auth.js +138 -0
- package/dist/commands/automations.d.ts +5 -0
- package/dist/commands/automations.js +139 -0
- package/dist/commands/broadcasts.d.ts +5 -0
- package/dist/commands/broadcasts.js +184 -0
- package/dist/commands/contacts.d.ts +6 -0
- package/dist/commands/contacts.js +198 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +51 -0
- package/dist/commands/inbox.d.ts +6 -0
- package/dist/commands/inbox.js +222 -0
- package/dist/commands/media.d.ts +3 -0
- package/dist/commands/media.js +76 -0
- package/dist/commands/platforms.d.ts +2 -0
- package/dist/commands/platforms.js +27 -0
- package/dist/commands/posts.d.ts +3 -0
- package/dist/commands/posts.js +129 -0
- package/dist/commands/profiles.d.ts +3 -0
- package/dist/commands/profiles.js +82 -0
- package/dist/commands/sequences.d.ts +5 -0
- package/dist/commands/sequences.js +178 -0
- package/dist/generated/openapi-catalog.d.ts +8961 -0
- package/dist/generated/openapi-catalog.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +61 -0
- package/dist/utils/api-request.d.ts +31 -0
- package/dist/utils/api-request.js +115 -0
- package/dist/utils/argument-parsing.d.ts +3 -0
- package/dist/utils/argument-parsing.js +27 -0
- package/dist/utils/config.d.ts +27 -0
- package/dist/utils/config.js +111 -0
- package/dist/utils/errors.d.ts +5 -0
- package/dist/utils/errors.js +12 -0
- package/dist/utils/openapi-catalog.d.ts +16 -0
- package/dist/utils/openapi-catalog.js +58 -0
- package/dist/utils/output.d.ts +9 -0
- package/dist/utils/output.js +24 -0
- package/docs/architecture.md +37 -0
- package/docs/cli.md +99 -0
- package/docs/code-standards.md +11 -0
- package/docs/contributing.md +34 -0
- package/docs/development-roadmap.md +32 -0
- package/docs/openapi/zernio-api-openapi.yaml +30967 -0
- package/docs/project-changelog.md +15 -0
- package/docs/project-overview-pdr.md +25 -0
- package/docs/system-architecture.md +28 -0
- package/package.json +82 -0
package/docs/cli.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# CLI Reference
|
|
2
|
+
|
|
3
|
+
## Output
|
|
4
|
+
|
|
5
|
+
All commands output JSON by default. Use `--pretty` for indented JSON.
|
|
6
|
+
|
|
7
|
+
Generic API calls return:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"ok": true,
|
|
12
|
+
"status": 200,
|
|
13
|
+
"statusText": "OK",
|
|
14
|
+
"rateLimit": {
|
|
15
|
+
"limit": "600",
|
|
16
|
+
"remaining": "599",
|
|
17
|
+
"reset": "1760000000",
|
|
18
|
+
"retryAfter": null
|
|
19
|
+
},
|
|
20
|
+
"data": {}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Errors use JSON and never include secrets:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{"ok":false,"error":true,"message":"No API key configured.","status":401}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Agent-Friendly Commands
|
|
31
|
+
|
|
32
|
+
| Command | Purpose |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| `zernio doctor` | Redacted config and runtime diagnostics |
|
|
35
|
+
| `zernio doctor --connection` | Verify API connectivity without printing secrets |
|
|
36
|
+
| `zernio platforms:list` | Platform identifiers plus docs source |
|
|
37
|
+
| `zernio api:catalog` | Search generated OpenAPI catalog |
|
|
38
|
+
| `zernio api:describe <operation>` | Inspect endpoint params and body metadata |
|
|
39
|
+
| `zernio api:call <operation>` | Call any endpoint from the catalog |
|
|
40
|
+
|
|
41
|
+
## Generic API Caller
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
zernio api:call listPosts --query limit=10
|
|
45
|
+
zernio api:call getPost --path postId=post_123
|
|
46
|
+
zernio api:call createPost --body-file ./post.json
|
|
47
|
+
zernio api:call createPost --body-file ./post.json --request-id req_123
|
|
48
|
+
zernio api:call createStandaloneAd --body-file ./ad.json --idempotency-key ad_req_123
|
|
49
|
+
zernio api:call uploadWhatsAppNumberKycDocument --header X-Filename=kyc.pdf --content-type application/octet-stream --raw-body-file ./kyc.pdf
|
|
50
|
+
zernio api:call "GET /v1/posts" --query page=1 --query limit=20
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Options:
|
|
54
|
+
- `--path key=value` path parameter, repeatable
|
|
55
|
+
- `--query key=value` query parameter, repeatable
|
|
56
|
+
- `--header key=value` request header, repeatable; dry-run redacts non-trivial values
|
|
57
|
+
- `--body-json <json>` JSON request body
|
|
58
|
+
- `--body-file <file>` JSON request body file
|
|
59
|
+
- `--raw-body-file <file>` raw request body file
|
|
60
|
+
- `--content-type <type>` body content type override
|
|
61
|
+
- `--request-id <id>` set `x-request-id` for endpoints that document safe retries
|
|
62
|
+
- `--idempotency-key <key>` set `Idempotency-Key` for endpoints that document safe retries
|
|
63
|
+
- `--form key=value` form field, repeatable
|
|
64
|
+
- `--file key=/path` multipart file field, repeatable
|
|
65
|
+
- `--dry-run` print URL/body presence without sending
|
|
66
|
+
- `--api-key <key>` one-off secret override, never printed
|
|
67
|
+
- `--base-url <url>` one-off API base URL override
|
|
68
|
+
|
|
69
|
+
The CLI refuses to send a saved `~/.zernio/config.json` key to a custom non-Zernio API URL unless that URL was also saved in config. For one-off custom hosts, pass both `--api-key` and `--base-url`.
|
|
70
|
+
|
|
71
|
+
## Auth Commands
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
zernio auth:login
|
|
75
|
+
zernio auth:set --key "sk_..."
|
|
76
|
+
zernio auth:check
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For automation, prefer `ZERNIO_API_KEY`. For local use, `auth:login` is easier.
|
|
80
|
+
|
|
81
|
+
The global CLI does not automatically load cwd `.env` files. In this repository, use `ZERNIO_CLI_LOAD_ENV=1` for explicit local test runs.
|
|
82
|
+
|
|
83
|
+
## Media
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
zernio media:upload ./photo.jpg
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The command implements Zernio's two-step upload: presign, direct PUT, then return public URL. Use that URL in `posts:create` or `api:call createPost`.
|
|
90
|
+
|
|
91
|
+
## Queue Scheduling
|
|
92
|
+
|
|
93
|
+
Use `queuedFromProfile` and optional `queueId` in create-post payloads. Do not use `queue/next-slot` as the scheduled time; it is preview-only.
|
|
94
|
+
|
|
95
|
+
## Release Channels
|
|
96
|
+
|
|
97
|
+
- `main` publishes stable releases.
|
|
98
|
+
- `dev` publishes beta prereleases.
|
|
99
|
+
- Version bumps and changelog are generated from conventional commits.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Code Standards
|
|
2
|
+
|
|
3
|
+
- TypeScript ESM.
|
|
4
|
+
- Node 20+.
|
|
5
|
+
- yargs for command routing.
|
|
6
|
+
- JSON output by default.
|
|
7
|
+
- `src/generated/openapi-catalog.ts` is generated only.
|
|
8
|
+
- Keep new code files focused and under 200 lines where practical.
|
|
9
|
+
- Use plain HTTP helpers for generic OpenAPI calls.
|
|
10
|
+
- Use `@zernio/node` for curated SDK workflows.
|
|
11
|
+
- Do not log API keys, tokens, or full Authorization headers.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Local Loop
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm ci
|
|
7
|
+
npm run generate:openapi
|
|
8
|
+
npm run typecheck
|
|
9
|
+
npm test
|
|
10
|
+
npm run build
|
|
11
|
+
npm audit --omit=optional
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Code Rules
|
|
15
|
+
|
|
16
|
+
- Keep command adapters thin.
|
|
17
|
+
- Put reusable parsing/request logic in `src/utils/`.
|
|
18
|
+
- Do not print secrets.
|
|
19
|
+
- Prefer JSON envelopes for agent-facing commands.
|
|
20
|
+
- Add tests for new command behavior.
|
|
21
|
+
- Do not hand-edit `src/generated/openapi-catalog.ts`.
|
|
22
|
+
|
|
23
|
+
## Commits
|
|
24
|
+
|
|
25
|
+
Use conventional commits:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
feat: add api catalog command
|
|
29
|
+
fix: redact config source
|
|
30
|
+
test: cover api request builder
|
|
31
|
+
release: 1.2.3
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`main` is stable. `dev` is beta.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Development Roadmap
|
|
2
|
+
|
|
3
|
+
## Phase 1 - Bootstrap
|
|
4
|
+
|
|
5
|
+
Status: Complete
|
|
6
|
+
|
|
7
|
+
- Attach local checkout to `mrgoonie/zernio-cli`.
|
|
8
|
+
- Preserve existing curated commands.
|
|
9
|
+
- Rename package to `zernio-cli`.
|
|
10
|
+
|
|
11
|
+
## Phase 2 - Agent API Coverage
|
|
12
|
+
|
|
13
|
+
Status: Complete
|
|
14
|
+
|
|
15
|
+
- Generate endpoint catalog from OpenAPI.
|
|
16
|
+
- Add `api:catalog`, `api:describe`, `api:call`.
|
|
17
|
+
- Add `doctor` and `platforms:list`.
|
|
18
|
+
|
|
19
|
+
## Phase 3 - Release Automation
|
|
20
|
+
|
|
21
|
+
Status: Complete
|
|
22
|
+
|
|
23
|
+
- CI workflow.
|
|
24
|
+
- Semantic-release stable/beta workflow.
|
|
25
|
+
- NPM token based publish.
|
|
26
|
+
|
|
27
|
+
## Phase 4 - Follow-Up
|
|
28
|
+
|
|
29
|
+
Status: Planned
|
|
30
|
+
|
|
31
|
+
- Enable GitHub Issues if `ck:vibe` issue tracking is required.
|
|
32
|
+
- Add more curated commands for high-use endpoints discovered through real usage.
|