@collective-intelligence/cli 0.1.10 → 0.1.11

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.
Files changed (3) hide show
  1. package/README.md +60 -3
  2. package/dist/cli.js +24 -19
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -29,8 +29,9 @@ names the version to install.
29
29
 
30
30
  ## Sign In and Enroll Your App
31
31
 
32
- Interactive developers sign in once; pipelines keep using a token. Every
33
- command accepts either credential.
32
+ Interactive developers sign in once; pipelines keep using a token. Most
33
+ management commands accept either credential. API-key creation, rotation and
34
+ revocation require an Organization Admin or Tenant Admin human session.
34
35
 
35
36
  ```sh
36
37
  # Device login: copy this command from the Dashboard (Organization →
@@ -106,6 +107,50 @@ ci logout
106
107
  - `ci apps list|get|rotate-secret|disable` manage existing applications.
107
108
  `list` and `get` show `primaryRedirectUri` beside `redirectUris`.
108
109
 
110
+ ## Manage Server Credentials and API Keys
111
+
112
+ ```sh
113
+ ci apps credentials upsert <app-fqn-or-id> --name pipeline --env-file .env.server
114
+ ci apps credentials list <app-fqn-or-id>
115
+ ci apps credentials get <app-fqn-or-id> --name pipeline
116
+ ci apps credentials rotate <app-fqn-or-id> --name pipeline --env-file .env.server
117
+ ci apps credentials revoke <app-fqn-or-id> --name pipeline
118
+
119
+ # Sign in as an Organization Admin or Tenant Admin first.
120
+ ci api-keys upsert --principal <principal-fqn> --name pipeline --scopes data_read --env-file .env.pipeline
121
+ ci api-keys list --principal <principal-fqn>
122
+ ci api-keys get --principal <principal-fqn> --name pipeline
123
+ ci api-keys rotate --principal <principal-fqn> --name pipeline --env-file .env.pipeline
124
+ ci api-keys revoke --principal <principal-fqn> --name pipeline
125
+ ```
126
+
127
+ `upsert` requires a name. For Server Credentials, omitting `--server-role`
128
+ restricts the credential to the app's Default Server Role. Repeat `--server-role`
129
+ to supply an explicit role list. API keys require at least one `--scopes` value;
130
+ scopes accept comma- or space-separated values and can repeat. A rerun updates
131
+ only these grants and returns no secret.
132
+ `upsert --rotate` explicitly rotates an existing credential; creating a missing
133
+ credential already issues its first secret. Rotation retains the previous secret
134
+ for the backend's grace period; revocation ends both secrets immediately.
135
+
136
+ Output is JSON. Only creation and rotation include a secret. `list`, `get` and
137
+ `revoke` return metadata. With `--env-file`, the secret goes only to the file;
138
+ `--json` additionally prints metadata. Other env-file lines remain intact.
139
+ Server credential files use `CI_CLIENT_SECRET`; API-key files use
140
+ `CI_MANAGEMENT_TOKEN` and `CI_BACKEND_URL`. Both retain `CI_ISSUER`,
141
+ `CI_CLIENT_ID` (the app client ID or principal ID), and `CI_CREDENTIAL_ID`.
142
+ `--prefix` replaces `CI_`. A rerun keeps the existing secret only when all three
143
+ identity fields match. If no matching secret is saved, use `--rotate`; the CLI
144
+ cannot retrieve a stored secret. Keep these files private.
145
+
146
+ Server Credentials belong to the selected app and its declared Server Roles.
147
+ They are separate from the sign-in credential produced by `ci apps enroll`;
148
+ use separate env files for these two credentials. Organization Admins, Tenant
149
+ Admins, and API keys with `external_apps_manage` can manage Server Credentials.
150
+ API keys belong to an existing service principal selected by its exact FQN;
151
+ only Organization Admins and Tenant Admins can create, rotate or revoke them.
152
+ Backend role and scope checks remain authoritative.
153
+
109
154
  ## Manage Redirect URIs and Trusted Websites
110
155
 
111
156
  An application accepts every registered redirect URI. A sign-in chooses its
@@ -174,6 +219,18 @@ downgrades; targeted package and rollback commands remain available separately.
174
219
  Use `--accept-breaking-changes` only to explicitly acknowledge a breaking change
175
220
  under the Organization's authority.
176
221
 
222
+ A declared service principal with `organization_admin` authority requires
223
+ `--allow-admin-principals` or an affirmative interactive confirmation for each
224
+ such principal. The prompt defaults to refusal; `--non-interactive` never
225
+ prompts and refuses without the flag, naming the principal and parameter.
226
+ For directly declared principals, confirmation happens before publication or
227
+ installation. The Backend also
228
+ checks admin principals in the resolved dependency graph. An interactive run
229
+ prompts when that check reports an admin principal; accepting submits a new
230
+ confirmed operation and saves a new recovery receipt. Refusal leaves the
231
+ original operation unapplied. A non-interactive run requires a fresh deployment
232
+ with `--allow-admin-principals`. This confirmation is independent of `--accept-breaking-changes` and is retained in recovery receipts.
233
+
177
234
  JSON mode emits newline-delimited records with `kind: progress`, `result`, or
178
235
  `error`. An accepted operation is progress, not success. The command follows
179
236
  resumable durable operation streams and exits successfully only after every
@@ -251,7 +308,7 @@ replay, even for the same Organization, because Backend idempotency is scoped to
251
308
  the authenticated principal. The token itself is never stored.
252
309
  The Backend still authorizes the request; a rejected/expired recovery fails and
253
310
  never silently starts another operation. Do not combine `--resume` with
254
- `--declaration`, inputs, variables, Gateway bindings or breaking-change flags.
311
+ `--declaration`, inputs, variables, Gateway bindings, breaking-change flags or `--allow-admin-principals`.
255
312
  A normal deploy without `--resume` always creates a fresh invocation.
256
313
 
257
314
  Receipts are stored under `$XDG_STATE_HOME/ci/deployments`, or