@topolo/cli 0.1.34 → 0.2.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 +60 -19
- package/dist/index.js +627 -202
- package/package.json +6 -2
- package/skills/codex/AGENTS.md +25 -11
- package/skills/topolo/SKILL.md +70 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/cli",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Command-line interface for Topolo developers, operators, and agents, with internal first-party scaffolding available under the topolo platform namespace.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,10 +11,14 @@
|
|
|
11
11
|
"skills"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
+
"build:sdk": "pnpm --dir ../topolo-sdk build",
|
|
15
|
+
"prebuild": "pnpm run build:sdk",
|
|
14
16
|
"build": "tsup",
|
|
15
17
|
"dev": "tsup --watch",
|
|
18
|
+
"pretypecheck": "pnpm run build:sdk",
|
|
16
19
|
"typecheck": "tsc --noEmit",
|
|
17
20
|
"start": "node dist/index.js",
|
|
21
|
+
"pretest": "pnpm run build:sdk",
|
|
18
22
|
"test": "vitest run",
|
|
19
23
|
"test:watch": "vitest",
|
|
20
24
|
"coverage": "vitest run --coverage"
|
|
@@ -23,7 +27,7 @@
|
|
|
23
27
|
"commander": "^12.1.0"
|
|
24
28
|
},
|
|
25
29
|
"devDependencies": {
|
|
26
|
-
"@topolo/sdk": "
|
|
30
|
+
"@topolo/sdk": "file:../topolo-sdk",
|
|
27
31
|
"@types/node": "^20.12.0",
|
|
28
32
|
"@vitest/coverage-v8": "^2.1.0",
|
|
29
33
|
"tsup": "^8.0.0",
|
package/skills/codex/AGENTS.md
CHANGED
|
@@ -6,11 +6,11 @@ This file teaches an agent how to interact with the Topolo platform via the `top
|
|
|
6
6
|
|
|
7
7
|
Topolo is a multi-app SaaS platform. The CLI and MCP server both use `@topolo/sdk`; bundled app IDs come from the generated registry, and newly registered API/technical services can be resolved from the live Auth catalog.
|
|
8
8
|
|
|
9
|
-
- Use `topolo apps --json` or the MCP `
|
|
9
|
+
- Use `topolo apps --json` or the MCP `topolo_search_applications` tool to discover platform applications, including browser-only Worker apps.
|
|
10
10
|
- Use `topolo apps requirements <application_id> --json` or the MCP `topolo_list_application_requirements` tool before creating or expanding a Topolo app.
|
|
11
11
|
- Use `topolo apps audit <application_id> --json` or the MCP `topolo_audit_applications` tool to inspect current requirement conformance and migration work.
|
|
12
|
-
- Use `topolo services --json` or the MCP `
|
|
13
|
-
- Use `topolo actions --json` or MCP
|
|
12
|
+
- Use `topolo services --json` or the MCP `topolo_search_applications` tool to discover callable app ids and effective URLs.
|
|
13
|
+
- Use `topolo actions --service <app> --json` or MCP `topolo_search_actions` to discover callable operations granted to the current credential; invoke automatic reads with `topolo_read_action` and confirmation-gated operations with `topolo_call_action`.
|
|
14
14
|
- The generic `api` command and MCP `topolo_api_call` tool can reach bundled SDK services and live Auth-catalog API/technical services when no action contract exists yet.
|
|
15
15
|
|
|
16
16
|
Every call is scoped to the organization embedded in the credential. There is no `--org` flag anywhere — attempting to target another org will fail.
|
|
@@ -39,11 +39,12 @@ Exit codes:
|
|
|
39
39
|
|
|
40
40
|
## Setup flow
|
|
41
41
|
|
|
42
|
-
1. Check install: `command -v topolo || npm install -g @topolo/cli` (requires Node ≥ 20).
|
|
42
|
+
1. Check install: `command -v topolo || npm install -g @topolo/cli` (requires Node ≥ 20). To wire the skill + MCP into this agent, run `topolo skills install` (credential-free — the MCP reads the `topolo auth login` credential).
|
|
43
43
|
2. Check credential: `topolo auth status --json`.
|
|
44
44
|
3. For staging work, check credential with `topolo auth status --env staging --json`.
|
|
45
|
-
4. If `source` is `none`, run `topolo auth login
|
|
45
|
+
4. If `source` is `none`, run `topolo auth login` (add `--env staging` for staging) and wait for the user to approve in the browser tab that opens. **No `--client-id` is needed** — the CLI has a built-in first-party client, so any Topolo user can sign in; capabilities are decided by their permissions. (`--client-id=<doac_…>` is only for advanced/self-hosted OAuth clients.) For service-agent / headless installs, use an API key with `topolo auth login --api-key=<key>` or set `TOPOLO_API_KEY` for a single invocation.
|
|
46
46
|
5. Confirm identity once: `topolo whoami --json`. Reference the returned `organization.name` when explaining results to the user.
|
|
47
|
+
6. To act in a different org or personal space: `topolo context ls --json` then `topolo context use <organization-name|personal> --json`. Each context has its own credential; the CLI + MCP run in the active one. This does not change the user's web context, and later web switches do not alter the issued credential.
|
|
47
48
|
|
|
48
49
|
## Command surface
|
|
49
50
|
|
|
@@ -54,10 +55,21 @@ topolo whoami --json
|
|
|
54
55
|
#=> { "user": {...}, "organization": {...}, "kind": "access_token" | "api_key" }
|
|
55
56
|
|
|
56
57
|
topolo auth status --json
|
|
57
|
-
topolo auth login [--
|
|
58
|
+
topolo auth login [--api-key=...] [--client-id=... (advanced)] [--scope="..."]
|
|
58
59
|
topolo auth logout
|
|
59
60
|
```
|
|
60
61
|
|
|
62
|
+
### Contexts (personal + multiple organizations)
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
topolo context ls --json # personal + your orgs; marks the active one
|
|
66
|
+
topolo context use <organization-name|personal> --json # switch the active context (validated server-side)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
There is no `--org` flag — switch context to act in a different organization. `topolo whoami` reflects the active context.
|
|
70
|
+
The switch is local to the CLI/MCP credential store and its token refresh chain;
|
|
71
|
+
it never changes the shared web preference.
|
|
72
|
+
|
|
61
73
|
### Application and service discovery
|
|
62
74
|
|
|
63
75
|
```bash
|
|
@@ -80,17 +92,18 @@ URL and the CLI will refuse `topolo api` calls until a staging override is set.
|
|
|
80
92
|
### Credential-scoped actions
|
|
81
93
|
|
|
82
94
|
```bash
|
|
83
|
-
topolo actions --json
|
|
84
95
|
topolo actions --service mail --json
|
|
85
|
-
topolo actions get
|
|
86
|
-
topolo actions call
|
|
96
|
+
topolo actions get app_topolo_mail.messages.send --json
|
|
97
|
+
topolo actions call app_topolo_mail.messages.send \
|
|
87
98
|
--data '{"mailboxId":"primary","subject":"Hello","text":"..."}' \
|
|
88
99
|
--confirm --json
|
|
89
100
|
```
|
|
90
101
|
|
|
91
102
|
`topolo actions` is the normal agent entrypoint for application-specific
|
|
92
103
|
operations. It is filtered by the signed-in organization and the exact service
|
|
93
|
-
permissions on the credential.
|
|
104
|
+
permissions on the credential. Actions marked `authorizationMode: "runtime"`
|
|
105
|
+
have input-dependent policy and are definitively authorized by the target app
|
|
106
|
+
for the supplied organization, application, and resource at invocation time.
|
|
94
107
|
|
|
95
108
|
### Generic passthrough
|
|
96
109
|
|
|
@@ -136,6 +149,7 @@ Do not batch writes. Do not retry a failed write without re-confirming. The `--c
|
|
|
136
149
|
|
|
137
150
|
## Reference
|
|
138
151
|
|
|
139
|
-
-
|
|
152
|
+
- Documentation: `https://docs.topolo.app` (guides, authentication, API reference).
|
|
153
|
+
- Developers console (register apps / OAuth clients): `https://developers.topolo.app`
|
|
140
154
|
- CLI README: the `README.md` alongside this file.
|
|
141
155
|
- Schemas: `packages/topolo-sdk/src/modules/` in the monorepo.
|
package/skills/topolo/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Read and write Topolo platform data (identity, application/service
|
|
|
5
5
|
|
|
6
6
|
# Topolo platform
|
|
7
7
|
|
|
8
|
-
The `topolo` CLI is the agent-friendly entry point to the Topolo platform. Every command
|
|
8
|
+
The `topolo` CLI is the agent-friendly entry point to the Topolo platform. Every command runs in the **active context** embedded in the current credential — the user's personal space or a specific organization. You cannot bypass the credential or forge a context; to act in a different organization (or personal), switch with `topolo context use` (see Contexts).
|
|
9
9
|
|
|
10
10
|
## When this skill fires
|
|
11
11
|
|
|
@@ -16,7 +16,7 @@ Use `topolo` whenever the user:
|
|
|
16
16
|
- Wants to call an endpoint under a Topolo service from the shell.
|
|
17
17
|
- Mentions a Topolo OAuth client (`doac_…`) or API key.
|
|
18
18
|
|
|
19
|
-
If the user asks a platform question and `topolo` is not installed, install it: `npm install -g @topolo/cli`. Requires Node ≥ 20.
|
|
19
|
+
If the user asks a platform question and `topolo` is not installed, install it: `npm install -g @topolo/cli`. Requires Node ≥ 20. To wire this skill and the MCP server into Claude Code / Codex in one step, run `topolo skills install` (copies the skill file, registers the `topolo` MCP; no API key needed — the MCP reads the same credential `topolo auth login` writes).
|
|
20
20
|
|
|
21
21
|
## Credentials — always check first
|
|
22
22
|
|
|
@@ -32,7 +32,7 @@ or provisioning a staging-only first-party app:
|
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
topolo auth status --env staging --json
|
|
35
|
-
topolo auth login --env staging
|
|
35
|
+
topolo auth login --env staging
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
Possible `source` values:
|
|
@@ -46,14 +46,17 @@ Possible `source` values:
|
|
|
46
46
|
| `config-file` | Token stored in the selected environment profile at `$XDG_CONFIG_HOME/topolo/config.json` |
|
|
47
47
|
| `none` | Not signed in — call `topolo auth login` |
|
|
48
48
|
|
|
49
|
-
If `source: none`, run `topolo auth login
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
If `source: none`, run `topolo auth login` (add `--env staging` for staging) and
|
|
50
|
+
tell the user to approve the device in the browser tab that opens. The CLI uses
|
|
51
|
+
its **built-in first-party client**, so **no `--client-id` is needed** — any
|
|
52
|
+
Topolo user can sign in; what they can then do is decided by their permissions.
|
|
53
|
+
The CLI blocks until they approve, then stores the token in that environment's
|
|
54
|
+
active-context profile. (`--client-id=<doac_…>` is only for advanced/self-hosted
|
|
55
|
+
setups that register their own OAuth client.)
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
For service-agent / headless installs, use an API key with
|
|
58
|
+
`topolo auth login --api-key=<key>` or set `TOPOLO_API_KEY` only for the single
|
|
59
|
+
command that needs it.
|
|
57
60
|
|
|
58
61
|
## Output modes
|
|
59
62
|
|
|
@@ -71,6 +74,22 @@ Returns `{ user: { email, name, role, permissions }, organization: { name, slug
|
|
|
71
74
|
|
|
72
75
|
Use this once at the start of a session to confirm the active user + org — then reference that org context in subsequent explanations so the user doesn't have to re-orient.
|
|
73
76
|
|
|
77
|
+
### Contexts (personal + multiple organizations)
|
|
78
|
+
|
|
79
|
+
A user can act in their **personal** space or in any **organization** they belong to. Each context has its own credential; the CLI and MCP always operate in the **active** one.
|
|
80
|
+
|
|
81
|
+
CLI/MCP context is credential-bound and independent from the user's web
|
|
82
|
+
switcher preference. `topolo context use` does not move the browser session;
|
|
83
|
+
switching in the browser does not alter any issued CLI/MCP token or refresh
|
|
84
|
+
chain. Multiple cached personal/org credentials can therefore coexist safely.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
topolo context ls --json # personal + your orgs, and which is active
|
|
88
|
+
topolo context use <organization-name|personal> --json # switch the active context
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`topolo context use` activates a cached context or exchanges the current credential for a fresh token scoped to the target (membership is validated server-side). After switching, `topolo whoami` and every subsequent command run in that context. There is **no `--org` flag** — switch context instead. If a command returns a permission error, the user may need to switch to the org that owns the resource, or be granted access there.
|
|
92
|
+
|
|
74
93
|
### Application and service discovery
|
|
75
94
|
|
|
76
95
|
```bash
|
|
@@ -79,7 +98,7 @@ topolo apps get <application_id> --json
|
|
|
79
98
|
topolo apps requirements <application_id> --json
|
|
80
99
|
topolo apps audit <application_id> --json
|
|
81
100
|
topolo services --json
|
|
82
|
-
topolo actions --json
|
|
101
|
+
topolo actions --service <application_id_or_slug> --json
|
|
83
102
|
```
|
|
84
103
|
|
|
85
104
|
`topolo apps` returns every cataloged Topolo application, including browser-only
|
|
@@ -95,18 +114,36 @@ before `topolo api` when you are not using a cataloged action.
|
|
|
95
114
|
### Credential-scoped actions
|
|
96
115
|
|
|
97
116
|
```bash
|
|
98
|
-
topolo actions --json
|
|
99
117
|
topolo actions --service mail --json
|
|
100
|
-
topolo actions get
|
|
101
|
-
topolo actions call
|
|
118
|
+
topolo actions get app_topolo_mail.messages.send --json
|
|
119
|
+
topolo actions call app_topolo_mail.messages.send \
|
|
102
120
|
--data '{"mailboxId":"primary","subject":"Hello","text":"..."}' \
|
|
103
121
|
--confirm --json
|
|
104
122
|
```
|
|
105
123
|
|
|
106
|
-
`topolo actions` returns the
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
124
|
+
`topolo actions` returns the credential-scoped action catalog. Static actions
|
|
125
|
+
are filtered by the current organization and permissions. An action with
|
|
126
|
+
`authorizationMode: "runtime"` has input-dependent policy; it remains
|
|
127
|
+
discoverable, and the target app authorizes the concrete organization,
|
|
128
|
+
application, and resource on every call. Prefer catalog actions over `topolo
|
|
129
|
+
api` when the target app has published a machine contract through Topolo
|
|
130
|
+
Developers. Writes require `--confirm`.
|
|
131
|
+
|
|
132
|
+
For an app-local workspace or other resource boundary, pass the resource
|
|
133
|
+
separately from the action input. Resource selection is per invocation: it does
|
|
134
|
+
not switch the personal/organization credential context or the browser session.
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
topolo actions call app_topolo_inventory.dashboard.get \
|
|
138
|
+
--resource-type workspace \
|
|
139
|
+
--resource-id <workspace_id> \
|
|
140
|
+
--data '{}' --json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Use a published workspace-list action to discover IDs when the app has multiple
|
|
144
|
+
workspaces. For a single default workspace, use the active organization ID from
|
|
145
|
+
`topolo whoami --json` when that app defines its workspace as the organization
|
|
146
|
+
boundary. Always provide `--resource-type` and `--resource-id` together.
|
|
110
147
|
|
|
111
148
|
### Generic API passthrough
|
|
112
149
|
|
|
@@ -128,7 +165,7 @@ Examples:
|
|
|
128
165
|
topolo api auth GET /api/me --json
|
|
129
166
|
|
|
130
167
|
# Send mail through a published action (requires confirm)
|
|
131
|
-
topolo actions call
|
|
168
|
+
topolo actions call app_topolo_mail.messages.send \
|
|
132
169
|
--data '{"mailboxId":"primary","subject":"Hello","text":"..."}' \
|
|
133
170
|
--confirm --json
|
|
134
171
|
```
|
|
@@ -152,7 +189,7 @@ Stored OAuth access tokens refresh automatically when the config contains both a
|
|
|
152
189
|
|
|
153
190
|
1. **Never run a mutating `topolo actions call …` or `topolo api … POST|PUT|PATCH|DELETE …` without surfacing the exact body to the user first** and confirming. The `--confirm` flag is a guardrail, not your approval.
|
|
154
191
|
2. **Never write credentials to tracked files.** If a user pastes an API key inline, use it via env var for that invocation (`TOPOLO_API_KEY=… topolo whoami`) rather than committing it.
|
|
155
|
-
3. **Cross-org isolation is built-in** — there is no `--org` flag anywhere
|
|
192
|
+
3. **Cross-org isolation is built-in** — there is no `--org` flag anywhere, and the backend rederives the org from the credential (it ignores org hints in a request body). To act in a different organization, use `topolo context use <org>` to switch the active context — never try to fake one via the passthrough.
|
|
156
193
|
4. Audit headers (`X-Topolo-Client`, `X-Topolo-Request-Id`, optional `X-Topolo-Agent`) are set by the CLI automatically. If `TOPOLO_AGENT_NAME` is already exported in the user's shell, leave it alone — it's the audit trail.
|
|
157
194
|
|
|
158
195
|
## Common flows
|
|
@@ -165,7 +202,7 @@ topolo actions --service mail --json
|
|
|
165
202
|
|
|
166
203
|
**"Send a message through Mail"**
|
|
167
204
|
```bash
|
|
168
|
-
topolo actions call
|
|
205
|
+
topolo actions call app_topolo_mail.messages.send \
|
|
169
206
|
--data '{"mailboxId":"primary","subject":"Hello","text":"..."}' \
|
|
170
207
|
--confirm --json
|
|
171
208
|
```
|
|
@@ -181,25 +218,31 @@ topolo apps --json
|
|
|
181
218
|
topolo apps requirements <application_id> --json
|
|
182
219
|
topolo apps audit <application_id> --json
|
|
183
220
|
topolo services --json
|
|
184
|
-
topolo actions --json
|
|
221
|
+
topolo actions --service mail --json
|
|
185
222
|
```
|
|
186
223
|
|
|
187
224
|
**"Sign me in fresh"**
|
|
188
225
|
```bash
|
|
189
226
|
topolo auth logout
|
|
190
|
-
topolo auth login --client-id
|
|
191
|
-
# Then wait for the user to approve in the browser.
|
|
227
|
+
topolo auth login # no --client-id needed; approve in the browser
|
|
192
228
|
```
|
|
193
229
|
|
|
194
230
|
**"Sign me in to staging"**
|
|
195
231
|
```bash
|
|
196
232
|
topolo auth logout --env staging
|
|
197
|
-
topolo auth login --env staging
|
|
233
|
+
topolo auth login --env staging
|
|
198
234
|
topolo whoami --env staging --json
|
|
199
235
|
```
|
|
200
236
|
|
|
237
|
+
**"Switch to my <Acme> organization" / "work in my personal space"**
|
|
238
|
+
```bash
|
|
239
|
+
topolo context ls --json
|
|
240
|
+
topolo context use acme --json # or: topolo context use personal
|
|
241
|
+
```
|
|
242
|
+
|
|
201
243
|
## Where to learn more
|
|
202
244
|
|
|
203
|
-
- Topolo
|
|
204
|
-
-
|
|
245
|
+
- **Topolo documentation:** https://docs.topolo.app — guides (authentication, quick start), API reference, and per-app docs. (Staging: https://docs.stg.topolo.us)
|
|
246
|
+
- Register apps / OAuth clients: the Developers console at https://developers.topolo.app
|
|
247
|
+
- CLI source (for an undocumented flag): `packages/topolo-cli/src/commands/` in the topolo-platform monorepo.
|
|
205
248
|
- SDK package: `packages/topolo-sdk/src/` — authoritative client, dynamic action catalog, and shared response contracts.
|