@uidu/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/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # @uidu/cli
2
+
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [22d268a]
8
+ - @uidu/client@3.1.1
9
+
10
+ ## 0.1.0
11
+
12
+ ### Minor Changes
13
+
14
+ - 8c8d021: Introduce `@uidu/cli` and a full authoring surface — the uidu SDK is now driveable as an AI connector.
15
+ - **`@uidu/cli`** (`uidu`): read a workspace, scaffold an app, and provision content from the terminal or an AI coding agent. `uidu login` (OAuth Authorization Code + PKCE browser flow, with a password-grant fallback for CI/agents); uniform entity verbs `list | get | create | update | delete`; CMS + workspace provisioning; `uidu create` scaffolding; `--json` output throughout.
16
+ - **`@uidu/client`**: add authoring mutations (`create` / `update` / `delete`) across events, stories, donations, courses, forms, contacts, deals, kb-collections, kb-articles, channel, tasks, notes, spaces, plus CMS (page/block/field) and workspace/project provisioning + `generateWorkspaceApiCredentials`. Reads use the public token (browser-safe); writes require the account Bearer (server-side / CLI only).
17
+ - **`@uidu/skills`**: the `uidu` skill now covers the CLI and the read-vs-write authoring model, not just SDK reads.
18
+ - **`@uidu/react`**: order the `types` condition before `default` in package `exports` (removes a dead-condition warning).
19
+ - **`create-uidu-app`**: bump templates off the `3.0.0-alpha.0` pin to `^3.0.0`.
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [8c8d021]
24
+ - @uidu/client@3.1.0
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # @uidu/cli
2
+
3
+ The uidu command-line tool. Built to be driven by humans **and** AI coding agents
4
+ (Claude Code): read a workspace, scaffold an app, and — soon — provision content.
5
+
6
+ > Status: read, scaffold, authoring, and `login` are implemented. `login` needs a
7
+ > registered OAuth client (below). See [`plans/ai-connector.md`](../../plans/ai-connector.md).
8
+
9
+ ## Login
10
+
11
+ `uidu login` opens your browser and signs in via **OAuth 2.0 Authorization Code + PKCE**
12
+ (public client) against the uidu doorkeeper provider (`https://me.uidu.org/oauth`), then
13
+ stores the Bearer token as `apiKey`. A loopback server on `http://localhost:4123/callback`
14
+ (override with `--port`) receives the redirect.
15
+
16
+ **One-time backend prereqs** (migration + rails console):
17
+
18
+ ```bash
19
+ # 1. Enable PKCE on doorkeeper (adds code_challenge columns), then migrate + deploy
20
+ bin/rails generate doorkeeper:pkce
21
+ bin/rails db:migrate
22
+ ```
23
+
24
+ ```ruby
25
+ # 2. Register ONE shared public application for the CLI
26
+ app = Doorkeeper::Application.create!(
27
+ name: 'uidu CLI',
28
+ redirect_uri: 'http://localhost:4123/callback',
29
+ confidential: false, # public client -> PKCE, no secret
30
+ scopes: 'public',
31
+ )
32
+ puts app.uid # -> UIDU_CLIENT_ID (bake into the CLI or set via env)
33
+ ```
34
+
35
+ Then:
36
+
37
+ ```bash
38
+ UIDU_CLIENT_ID=<uid> uidu login --workspace <slug> # opens browser
39
+ ```
40
+
41
+ **Non-interactive (CI / AI agents, no browser)** — password grant fallback:
42
+
43
+ ```bash
44
+ UIDU_CLIENT_ID=<uid> UIDU_PASSWORD=... uidu login --email you@uidu.org --password-grant
45
+ ```
46
+
47
+ > Tokens are short-lived (~2h) and the provider issues no refresh token today —
48
+ > re-run `uidu login` when it expires (or enable `use_refresh_token` in doorkeeper).
49
+
50
+ ## Install
51
+
52
+ ```bash
53
+ npm install -g @uidu/cli
54
+ # or, per-project
55
+ npx @uidu/cli --help
56
+ ```
57
+
58
+ ## Auth
59
+
60
+ Config resolves in order: **CLI flags → env vars → `~/.uidu/config.json`**.
61
+
62
+ | Env | Purpose |
63
+ |---|---|
64
+ | `UIDU_WORKSPACE` | Workspace slug (required) |
65
+ | `UIDU_PUBLIC_TOKEN` | Read-only token (safe to expose) |
66
+ | `UIDU_API_KEY` | Bearer/doorkeeper token for authoring |
67
+ | `UIDU_ENDPOINT` | Override GraphQL endpoint |
68
+ | `UIDU_PROJECT_ID` | Default project for CMS reads |
69
+
70
+ ## Commands
71
+
72
+ ```bash
73
+ uidu whoami
74
+ uidu pages list --project <id> --json
75
+ uidu page get home --project <id> --json
76
+ uidu events list --json
77
+ uidu form get <id> --json
78
+
79
+ uidu create my-app -t events # scaffold (delegates to create-uidu-app)
80
+
81
+ uidu login --email you@uidu.org # OAuth (needs UIDU_CLIENT_ID)
82
+
83
+ # authoring (needs a Bearer token from login, or UIDU_API_KEY):
84
+ uidu workspace create --name "Acme"
85
+ uidu page create --name Home --slug home --attributes '{"projectId":"..."}'
86
+ uidu space create --name "Team"
87
+ uidu task create --name "Do the thing"
88
+ uidu note create --attributes '{"body":"..."}'
89
+ uidu workspace credentials # rotate/get api key+secret
90
+ ```
91
+
92
+ The `--json` flag emits machine-readable output only on stdout — this is what
93
+ agents should parse.
94
+
95
+ ## Why a CLI (not MCP)
96
+
97
+ The primary consumer is Claude Code, which has a shell. A CLI is lighter, works
98
+ as a human tool too, and is deterministic to evaluate. See the plan for the full
99
+ rationale and the two-mode auth model (public-token reads vs Bearer authoring
100
+ against the same GraphQL endpoint).