@clavis.nexus/setup 1.0.2 → 3.0.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 +87 -23
- package/dist/cli.js +1159 -463
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +114 -13
- package/dist/index.js +847 -370
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +972 -390
- package/dist/mcp.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# `@clavis.nexus/setup`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CLI and MCP for starting an Org and an App on developers.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A person handles the passkey, the card checkout and publishing DNS, in a browser or on their infrastructure. An agent handles order, drafts and reading status. The steps follow the Quickstart (CLI and agents) on [docs.clavis.nexus](https://docs.clavis.nexus).
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install -g @clavis.nexus/setup
|
|
11
11
|
clavis status
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
To run it once without installing, use `npx -y @clavis.nexus/setup status`.
|
|
15
15
|
|
|
16
|
-
MCP
|
|
16
|
+
Example MCP configuration (Cursor and similar):
|
|
17
17
|
|
|
18
18
|
```json
|
|
19
19
|
{
|
|
@@ -31,7 +31,7 @@ MCP(Cursor 等)の例:
|
|
|
31
31
|
}
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
`clavis mcp`
|
|
34
|
+
`clavis mcp` starts the same process.
|
|
35
35
|
|
|
36
36
|
## CLI
|
|
37
37
|
|
|
@@ -41,36 +41,96 @@ export CLAVIS_ID_ORIGIN=https://id.clavis.nexus
|
|
|
41
41
|
export CLAVIS_DEVELOPERS_ORIGIN=https://developers.clavis.nexus
|
|
42
42
|
|
|
43
43
|
clavis login
|
|
44
|
-
#
|
|
45
|
-
#
|
|
44
|
+
# After the passkey in the browser, paste the JSON from developers /setup/login
|
|
45
|
+
# Non-interactive: clavis login --bridge-json-file ./bridge.json
|
|
46
|
+
# Keep the token off the command line
|
|
46
47
|
clavis status
|
|
47
|
-
clavis org-anchor-plan example.com "Example Org"
|
|
48
|
-
#
|
|
48
|
+
clavis org-anchor-plan example.com "Example Org" --incorporation JP --accept-customer-terms
|
|
49
|
+
# passkey, then org-anchor-finish, then publish DNS, then org-verify-anchor
|
|
50
|
+
clavis org-verify-anchor --domain example.com --nonce <nonce> --incorporation JP --accept-customer-terms
|
|
49
51
|
clavis card-checkout <orgId>
|
|
52
|
+
# Show the customer the consent statement in human.message, and continue only after they consent
|
|
53
|
+
clavis card-checkout <orgId> --consent-billing-data
|
|
50
54
|
clavis app-register --org <orgId> --host app.example.com --name "My App"
|
|
51
55
|
clavis app-host-plan <orgId> <appId>
|
|
52
56
|
clavis app-verify-host <orgId> <appId>
|
|
53
|
-
clavis declaration-set --org <orgId> --app <appId> --end-users "
|
|
57
|
+
clavis declaration-set --org <orgId> --app <appId> --end-users "People on our team" --use signature="Approve"
|
|
54
58
|
clavis emit-env --app <appId>
|
|
59
|
+
# optional: narrow the regions that accept new connections
|
|
60
|
+
clavis app-regions-set <orgId> <appId> --regions JP
|
|
55
61
|
```
|
|
56
62
|
|
|
57
|
-
`app-register
|
|
63
|
+
After `app-register`, the operate private key is saved at `~/.config/clavis/apps/<appId>/operate-private.jwk.json` (mode 0600). CLI and MCP JSON carry that file path.
|
|
58
64
|
|
|
59
|
-
`emit-env`
|
|
65
|
+
`emit-env` writes `app.env` (mode 0600) in the same directory, and the response returns `env_file` and `shell` (for `source`). Set `CLAVIS_TRUST_ROOT` to Clavis's Master public JWK. The value is on docs.clavis.nexus. `emit-env` checks, with the verifier, that the trust documents on the trust surface chain to that key, then writes `CLAVIS_TRUST_ROOT` into `app.env` for `@clavis.nexus/app`'s `trustRoot`.
|
|
60
66
|
|
|
61
|
-
|
|
67
|
+
The session file is `~/.config/clavis/session.json` (`CLAVIS_SESSION_PATH` changes the path).
|
|
62
68
|
|
|
63
|
-
###
|
|
69
|
+
### Login (paste)
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
The browser does not POST the token to localhost. `clavis login` opens developers at `/developers/setup/login?state=…` and takes the page's JSON (`state` and `accessToken`) on stdin or with `--bridge-json-file`. Keep the access token and the operate private key off command-line arguments. MCP `clavis_login` opens the browser on the first call and takes `bridge_json` on the second. The operate key is read from the file `app-register` wrote.
|
|
66
72
|
|
|
67
|
-
###
|
|
73
|
+
### Creating an Org (place of incorporation and the organisation agreement)
|
|
68
74
|
|
|
69
|
-
-
|
|
70
|
-
- `clavis card-checkout` が開くのは、署名のカードの Checkout です。WASM と台帳のカードは developers で購読します。
|
|
71
|
-
- `declaration-set` の `--use` には `signature`、`wasm`、`ledger` を渡せます。CLI は 1 回に 1 つで、その申告が前の申告を置き換えます。1 つの App で複数の機能を申告するときは、MCP の `uses` 配列か developers で書きます。
|
|
75
|
+
`org-anchor-plan` and `org-verify-anchor` both take the following. In MCP the fields are `incorporation` and `accept_customer_terms`.
|
|
72
76
|
|
|
73
|
-
|
|
77
|
+
- `--incorporation`: the Org's place of incorporation. One of `JP`, `GB-EAW` (England and Wales), an EEA country code (for example `DE`), or `US-XX` (for example `US-DE`).
|
|
78
|
+
- `--accept-customer-terms`: records that the customer has agreed to the Customer Terms and the Data Processing Agreement (DPA) for this Org. Whether to agree is the customer's decision. Pass it after they agree. The CLI and MCP leave agreement off by default. An agent asks a person and does not set the flag itself. A response without it carries `needs_human: terms`.
|
|
79
|
+
|
|
80
|
+
A place of incorporation closed to new declarations right now (`closed_incorporations` on `GET /orgs/regions`) is refused by `org-anchor-plan` before the passkey. When the API returns 403 `REGION_CLOSED`, the response's `error` starts with `region_closed`.
|
|
81
|
+
|
|
82
|
+
### Declaring the place of incorporation again
|
|
83
|
+
|
|
84
|
+
After the Customer Terms and the DPA move to a new version, declare the place of incorporation again before a purchase.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
clavis incorporation-set <orgId> --incorporation JP --accept-customer-terms
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- A declaration binds to the Customer Terms and DPA versions current at that time. When the versions are newer, `incorporation.terms_current` in `clavis status` is `false`.
|
|
91
|
+
- Agreement to the new versions needs `--accept-customer-terms` (MCP: `clavis_incorporation_set`).
|
|
92
|
+
- Declaring the current place again continues even when that region is closed.
|
|
93
|
+
|
|
94
|
+
### Buying the signature card
|
|
95
|
+
|
|
96
|
+
After the passkey, signature-card checkout opens in the browser. A person enters the card.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
clavis card-checkout <orgId>
|
|
100
|
+
# Show the customer the consent statement in human.message, and continue only after they consent
|
|
101
|
+
clavis card-checkout <orgId> --consent-billing-data
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- The place of incorporation must already be declared against the current versions. When it is missing, `error` is `incorporation_required` or `incorporation_stale`.
|
|
105
|
+
- Payment and billing need the customer's own consent to provide their Clavis account identifier, the Org ID, the feature being purchased, and, after purchase, usage of that feature (counts and times) to Polar Software Inc. in the United States. Run the command once without `--consent-billing-data`. The response's `human.message` (`needs_human: terms`) carries the consent statement and the Customer Terms and DPA versions. Show that statement to the customer, and run again with `--consent-billing-data` (MCP: `consent_billing_data: true`) only after they consent. An agent does not set the flag itself.
|
|
106
|
+
- `--lang ja` shows the consent statement in Japanese (the default is English). The purchase record is tied to the statement in the language that was shown.
|
|
107
|
+
- `--offer bundle` buys the monthly bundle. The default is metered (`meter`).
|
|
108
|
+
|
|
109
|
+
### Regions an app accepts
|
|
110
|
+
|
|
111
|
+
Each app can narrow the countries and regions it takes new connections from. The setting is optional.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
clavis app-regions-set <orgId> <appId> --regions JP,US
|
|
115
|
+
# back to every region Clavis accepts
|
|
116
|
+
clavis app-regions-set <orgId> <appId> --all
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- The regions are `JP`, `US`, `GB` and `EEA`. In MCP, pass `regions` or `all: true` to `clavis_app_regions_set`.
|
|
120
|
+
- The choice is limited to regions Clavis accepts right now (`app_regions` on `GET /orgs/regions`). Any other region is refused before the passkey, and `error` starts with `region_not_open`.
|
|
121
|
+
- The region is the country the connection comes from. A connection whose country cannot be determined counts as outside the chosen regions.
|
|
122
|
+
- People who are already connected keep using the app. What stops is a new agreement, a first app connection, an account link, and a signature whose request names no signer.
|
|
123
|
+
- When the same regions are already saved, the command returns `unchanged: true` and does not open a passkey.
|
|
124
|
+
- An Org owner or admin can change the list. A stopped app cannot be changed.
|
|
125
|
+
|
|
126
|
+
### What this CLI covers
|
|
127
|
+
|
|
128
|
+
- `clavis status` returns the Org, apps, host confirmation, the use declaration, the app's accepted regions (`accepted_regions` only when the list is narrowed), the signature card (`signature_card_blockers` is what holds it back) and the place of incorporation. Check the ledger subscription on developers.
|
|
129
|
+
- `clavis card-checkout` opens checkout for the signature card. Subscribe to the ledger card on developers.
|
|
130
|
+
- `--use` on `declaration-set` accepts `signature` and `ledger`. The CLI takes one per run, and that declaration replaces the previous one. To declare more than one feature for one app, use the `uses` array in MCP, or developers.
|
|
131
|
+
- `clavis policy-bootstrap <orgId>` creates the Org policy, with a passkey. `app-register` runs it for you, so you need it on its own only when the policy is missing. A policy already in place returns `already_active: true` and opens no passkey.
|
|
132
|
+
|
|
133
|
+
## Library
|
|
74
134
|
|
|
75
135
|
```ts
|
|
76
136
|
import { createSetupClient } from "@clavis.nexus/setup";
|
|
@@ -79,6 +139,10 @@ const setup = createSetupClient();
|
|
|
79
139
|
const status = await setup.status();
|
|
80
140
|
```
|
|
81
141
|
|
|
82
|
-
|
|
142
|
+
When a tool response carries `needs_human: passkey | payment | dns | login | terms`, a person has to act. `terms` is an agreement only the customer can give: the Customer Terms, or providing data for a card checkout.
|
|
143
|
+
|
|
144
|
+
Registering a signature request and reading its completion are [`@clavis.nexus/app`](https://www.npmjs.com/package/@clavis.nexus/app).
|
|
145
|
+
|
|
146
|
+
## License
|
|
83
147
|
|
|
84
|
-
|
|
148
|
+
MIT. Copyright (c) 2026 DeepDive, Inc.
|