coelevate-cli 0.2.0__tar.gz
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.
- coelevate_cli-0.2.0/.gitignore +6 -0
- coelevate_cli-0.2.0/CONTRIBUTING.md +7 -0
- coelevate_cli-0.2.0/LICENSE +202 -0
- coelevate_cli-0.2.0/PKG-INFO +291 -0
- coelevate_cli-0.2.0/README.md +280 -0
- coelevate_cli-0.2.0/pyproject.toml +47 -0
- coelevate_cli-0.2.0/src/coelevate_cli/__init__.py +3 -0
- coelevate_cli-0.2.0/src/coelevate_cli/__main__.py +5 -0
- coelevate_cli-0.2.0/src/coelevate_cli/auth.py +169 -0
- coelevate_cli-0.2.0/src/coelevate_cli/cli.py +988 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
We do not accept pull requests or external contributions at this time.
|
|
4
|
+
|
|
5
|
+
Run the tests with `uv run pytest -q`.
|
|
6
|
+
|
|
7
|
+
Issues are disabled. To report a security problem, email **security@coelevate.ai** (this file also ships in the sdist, so it names the address rather than linking a file outside the package).
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: coelevate-cli
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Command-line client for the Coelevate Context Repository public API: read, search, stage changes, and inspect releases.
|
|
5
|
+
Project-URL: Documentation, https://docs.coelevate.ai
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Requires-Dist: httpx>=0.27
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# coelevate
|
|
13
|
+
|
|
14
|
+
Command-line client for the Coelevate Context Repository public API. Read and search
|
|
15
|
+
your key's context, inspect releases, and **stage** asset changes for review. It proposes asset
|
|
16
|
+
changes and has no action that lands one. A **kit** is not an asset: `kit` writes it directly.
|
|
17
|
+
|
|
18
|
+
Requires Python 3.11 or newer. The only dependency is `httpx`.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
The package is published on PyPI as `coelevate-cli`; the command it installs is
|
|
23
|
+
`coelevate`. Pin a version (`0.2.0` below):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# one-off, no install (recommended: pinned, nothing left behind)
|
|
27
|
+
uvx --from coelevate-cli==0.2.0 coelevate --help
|
|
28
|
+
|
|
29
|
+
# isolated tool install
|
|
30
|
+
uv tool install coelevate-cli==0.2.0
|
|
31
|
+
# or
|
|
32
|
+
pipx install coelevate-cli==0.2.0
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
PyPI lists the SHA-256 of every file it serves under the project's **Download files**; compare a
|
|
36
|
+
downloaded wheel or sdist against it before you rely on it (`shasum -a 256 <file>`).
|
|
37
|
+
|
|
38
|
+
## Authentication
|
|
39
|
+
|
|
40
|
+
Credentials and endpoints come from the environment, or from a `.env` file in the folder you
|
|
41
|
+
run the command in (below). A secret is never accepted as a flag.
|
|
42
|
+
|
|
43
|
+
| Variable | Meaning |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `COELEVATE_API_URL` | the public API origin (or `--api-url`) |
|
|
46
|
+
| `COELEVATE_CLIENT_ID` | the API key id |
|
|
47
|
+
| `COELEVATE_CLIENT_SECRET` | the API key secret |
|
|
48
|
+
| `COELEVATE_TOKEN_URL` | optional token endpoint (or `--token-url`); defaults to `<API URL>/oauth/token` |
|
|
49
|
+
| `COELEVATE_PROJECT_ID` | optional pin: the project you expect the key to resolve to (or `--expect-project`) |
|
|
50
|
+
| `COELEVATE_WORKSPACE_URL` | optional Workspace origin for the review link (default: the API host without its `api.` label) |
|
|
51
|
+
| `COELEVATE_ENVIRONMENT` | optional label `whoami` reports (default: derived from the API host) |
|
|
52
|
+
|
|
53
|
+
These are the same variables every Coelevate client reads, so one key and one env file work for every Coelevate API.
|
|
54
|
+
|
|
55
|
+
The key needs the `context:read` scope to read and search, `context:assets` to stage, `context:kits` to write a kit (a `kit` write asks only for `context:kits`; `kit journal` only reads, so it asks for `context:read`) and `context:gaps` to write a gap (a `gap` write asks only for `context:gaps`; `gap list`, `get` and `journal` only read, so they ask for `context:read`).
|
|
56
|
+
There is no default for the API URL or key; a missing one fails immediately and names the variable.
|
|
57
|
+
The CLI never prompts.
|
|
58
|
+
|
|
59
|
+
**The key decides the project.** The key's token names it, and every request goes to
|
|
60
|
+
`<API URL>/context/v1/...` with nothing project-specific in the path; there is no `--project-id`.
|
|
61
|
+
To make sure a session is talking to the project you think it is, pin it: set
|
|
62
|
+
`COELEVATE_PROJECT_ID` (or pass `--expect-project`). If the key resolves to any other
|
|
63
|
+
project, every action refuses with exit code 2 and names both ids, before it reads or
|
|
64
|
+
stages anything. A pin the token cannot confirm is refused the same way.
|
|
65
|
+
|
|
66
|
+
### A `.env` file
|
|
67
|
+
|
|
68
|
+
If the folder you run the CLI in has a `.env` file, the CLI reads it first. Only `COELEVATE_*`
|
|
69
|
+
variables are taken from it (the rest of the file is ignored), a variable already set in the
|
|
70
|
+
real environment wins over the file, and the format is the usual `KEY=value` with an optional
|
|
71
|
+
`export`, optional quotes and `#` comments. Keep the file out of version control.
|
|
72
|
+
|
|
73
|
+
One rule protects your key from a `.env` you did not write: the file's `COELEVATE_TOKEN_URL` and
|
|
74
|
+
`COELEVATE_API_URL` are used only when the same file also sets the client id and secret and your
|
|
75
|
+
real environment sets neither. Otherwise they are ignored, and the CLI says so on stderr (naming
|
|
76
|
+
the keys, never a value).
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
export COELEVATE_CLIENT_ID=<key id>
|
|
80
|
+
read -rs COELEVATE_CLIENT_SECRET; export COELEVATE_CLIENT_SECRET
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
Every action takes `--api-url`, `--token-url` and `--json`.
|
|
86
|
+
|
|
87
|
+
| Action | What it does |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `read --kit-id K` / `read --asset-id A` | read one kit or asset (`--version N`, `--links` for assets) |
|
|
90
|
+
| `search --query Q` | search your key's context (lexical only, never calls a model; `--asset-type T` repeatable, `--max-results N`) |
|
|
91
|
+
| `whoami` | which project, API host, environment, the default token's scopes (`default token scopes`), the scopes this key can obtain (`permits`: any of `context:read`, `context:assets`, `context:kits`, `context:gaps`) and client id this key resolves to (never the secret) |
|
|
92
|
+
| `doctor` | check configuration, token, project pin, scopes and one read, and say what is wrong (exit 0 / 1 / 2) |
|
|
93
|
+
| `assets` | list assets from the index: id, type, label (`--asset-type T` repeatable, `--label L`, `--limit N`, `--offset N`) |
|
|
94
|
+
| `kit VERB` | create or change a kit directly (`create`, `add-members`, `patch`, `remove-member`, `revert`, `retire`, `journal`; see Kits below) |
|
|
95
|
+
| `gap VERB` | list, read, record, edit, close or revert a gap directly (`list`, `get`, `journal`, `create`, `patch`, `retire`, `revert`; see Gaps below) |
|
|
96
|
+
| `kits` | list the kits your key can see: id, title and version (use an id with `read --kit-id`) |
|
|
97
|
+
| `asset-types` | list the asset types your key's context accepts |
|
|
98
|
+
| `changeset` | the open changeset: `revision`, `base_release`, `changeset` |
|
|
99
|
+
| `stage` | stage ops (below) |
|
|
100
|
+
| `tag --name T` | the release currently holding tag `T` |
|
|
101
|
+
| `release` | list releases, or one by `--number` or `--tag` |
|
|
102
|
+
|
|
103
|
+
One example each:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
coelevate whoami
|
|
107
|
+
coelevate doctor
|
|
108
|
+
coelevate assets --asset-type rule
|
|
109
|
+
coelevate kits
|
|
110
|
+
coelevate read --asset-id ast_123 --links
|
|
111
|
+
coelevate read --kit-id kit_123 --version 2
|
|
112
|
+
coelevate search --query "onboarding" --asset-type knowledge_page --max-results 5
|
|
113
|
+
coelevate asset-types
|
|
114
|
+
coelevate changeset
|
|
115
|
+
coelevate stage --op-file op.json
|
|
116
|
+
coelevate stage --remove-op op_123 # un-stage one op
|
|
117
|
+
coelevate tag --name stable
|
|
118
|
+
coelevate release --number 3
|
|
119
|
+
coelevate release --limit 10 --offset 0
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Staging
|
|
123
|
+
|
|
124
|
+
Ops are JSON passed through unchanged; the server validates them and answers 422 for a bad one.
|
|
125
|
+
Which fields an asset type requires comes from `coelevate asset-types --json` and from
|
|
126
|
+
the server's 422 text, not from this README. Every `upsert_asset` declares `base_version`
|
|
127
|
+
(`0` for a create). Authoring metadata (`last_updated`, `last_updated_by`) goes in the op's
|
|
128
|
+
`metadata`; `content` holds the asset's own fields.
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"op": "upsert_asset",
|
|
133
|
+
"asset_type": "knowledge_page",
|
|
134
|
+
"base_version": 0,
|
|
135
|
+
"metadata": {"last_updated": "2026-10-10T18:00:00Z", "last_updated_by": "ai"},
|
|
136
|
+
"content": {"title": "Onboarding", "body": "How we onboard a client.", "owner": "ops"}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Provenance is a JSON object; each source is an object, not a string:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{"rationale": "onboarding", "sources": [{"kind": "external", "title": "handbook.pdf"}]}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# one op
|
|
148
|
+
coelevate stage --op-file op.json
|
|
149
|
+
|
|
150
|
+
# a batch: a JSON array of up to 100 ops, in ONE request
|
|
151
|
+
coelevate stage --ops-file ops.json \
|
|
152
|
+
--provenance '{"rationale":"onboarding","sources":[{"kind":"external","title":"handbook.pdf"}]}' \
|
|
153
|
+
--idempotency-key import-1
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Each batch declares the changeset revision and base release it was written against. By
|
|
157
|
+
default the CLI reads them from the changeset just before staging; override with
|
|
158
|
+
`--expected-revision` and `--expected-release` (when both are given, no read happens and
|
|
159
|
+
only `context:assets` is requested; both are required with `--idempotency-key`). The `stage --json` result reports the `expected_revision`
|
|
160
|
+
and `expected_release` the request actually sent.
|
|
161
|
+
|
|
162
|
+
After staging, `stage` and `changeset` print a `workspace_url` where a person reviews the open
|
|
163
|
+
changeset in the Workspace (`<workspace>/projects/<project id>/context/changes/<changeset id>`).
|
|
164
|
+
The Workspace origin is derived from the API host, or taken from `COELEVATE_WORKSPACE_URL`; the
|
|
165
|
+
field is absent when there is no open changeset or the host gives no Workspace to point at.
|
|
166
|
+
|
|
167
|
+
### Kits
|
|
168
|
+
|
|
169
|
+
A kit is a versioned selection of assets, written directly: no changeset, no review, no release
|
|
170
|
+
(a release never changes a kit). Publish the assets first, then create or update the kits that
|
|
171
|
+
hold them, naming the published ids; a kit can only hold assets that already exist. Every write
|
|
172
|
+
but `create` names the kit version it read (`base_version`), and a kit that has moved since is
|
|
173
|
+
refused with 409 `kit_moved`: re-read it and send the write again.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
coelevate kit create --body '{"title": "Booking", "description": "Use it when a client books or cancels", "members": [{"asset_id": "<id>"}]}'
|
|
177
|
+
coelevate kit add-members --kit-id <kit id> --body '{"base_version": 3, "members": [{"asset_id": "<id>"}]}'
|
|
178
|
+
coelevate kit patch --kit-id <kit id> --body '{"base_version": 4, "description": "..."}'
|
|
179
|
+
coelevate kit remove-member --kit-id <kit id> --asset-id <id> --base-version 4
|
|
180
|
+
coelevate kit revert --kit-id <kit id> --body '{"base_version": 5, "to_version": 3}'
|
|
181
|
+
coelevate kit retire --kit-id <kit id> --base-version 5
|
|
182
|
+
coelevate kit journal --kit-id <kit id>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`--body-file` takes the same request from a JSON file. A kit write is never retried by the client.
|
|
186
|
+
|
|
187
|
+
### Gaps
|
|
188
|
+
|
|
189
|
+
A gap is project-wide context debt, not an asset: it is written directly (no changeset, no review,
|
|
190
|
+
no release) and names no kit. Putting a gap into a kit is `kit add-members`, which needs
|
|
191
|
+
`context:kits`; a `gap create` body that carries `kit_ids` is refused with exit 2 before any request.
|
|
192
|
+
Reads (`list`, `get`, `journal`) need `context:read`; writes (`create`, `patch`, `retire`, `revert`)
|
|
193
|
+
need only `context:gaps`. Every write but `create` names the gap version it read (`base_version`),
|
|
194
|
+
and a gap that has moved since is refused with 409 `gap_moved`: re-read it and send the write again.
|
|
195
|
+
Other refusals the service types: 409 `duplicate_key` (names the gap that already holds the key),
|
|
196
|
+
409 `release_moved`, 422 `gap_is_not_an_asset` (a staged op named a gap).
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
coelevate gap list --state open --kind missing_knowledge --opened-release 2
|
|
200
|
+
coelevate gap get --gap-id <gap id> --version 2
|
|
201
|
+
coelevate gap journal --gap-id <gap id>
|
|
202
|
+
coelevate gap create --body '{"kind": "missing_knowledge", "detail": "Nothing says who signs off a refund.", "evidence": "seen in three sessions"}'
|
|
203
|
+
coelevate gap patch --gap-id <gap id> --body '{"base_version": 3, "evidence": "..."}'
|
|
204
|
+
coelevate gap retire --gap-id <gap id> --body '{"base_version": 3, "covered_by": ["<asset id>"], "rationale": "The refund page now says it."}'
|
|
205
|
+
coelevate gap revert --gap-id <gap id> --body '{"base_version": 4, "to_version": 2}'
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
`--state` is `open` (default), `retired` or `all`; `--closed-release` filters closed gaps.
|
|
209
|
+
`covered_by` is optional on `retire`. A gap write is never retried by the client.
|
|
210
|
+
|
|
211
|
+
### Retrying safely
|
|
212
|
+
|
|
213
|
+
`--idempotency-key` makes a retry deduplicate, but only if the retry is the *same* request,
|
|
214
|
+
so a key requires `--expected-revision` and `--expected-release` too (without them the CLI
|
|
215
|
+
exits with code 2 and sends nothing). Read the values first, then stage with the pins and the
|
|
216
|
+
key; on a retry, pass the same three values and the same ops:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
coelevate changeset --json # note revision and base_release
|
|
220
|
+
coelevate stage --ops-file ops.json --idempotency-key import-1 \
|
|
221
|
+
--expected-revision 7 --expected-release 3
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## JSON output
|
|
225
|
+
|
|
226
|
+
Without `--json` the result is indented JSON on stdout, except for `kits`, which prints one
|
|
227
|
+
tab-separated line per kit (id, title, version), or `no kits` when there are none
|
|
228
|
+
(exit 0). With `--json` every action, `kits` included, prints one compact JSON document on
|
|
229
|
+
stdout (keys sorted). The JSON of `kits`, `read`, `changeset`, `stage`, `release` and `assets` also carries a top-level `project_id`, the project the key resolves to. A `kits` reply without a `kits` list is an error (exit 1), never `no kits`. A failure is a JSON object on stderr, including usage errors:
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
{"error": "<message>", "exit_code": 1}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Without `--json`, a failure is `error: <message>` on stderr. `stage` results also report the
|
|
236
|
+
`expected_revision` and `expected_release` the request actually sent.
|
|
237
|
+
|
|
238
|
+
## Exit codes
|
|
239
|
+
|
|
240
|
+
| Exit code | Meaning |
|
|
241
|
+
|---|---|
|
|
242
|
+
| `0` | success |
|
|
243
|
+
| `1` | the request ran and failed: refused by the service or the token endpoint, or unreachable |
|
|
244
|
+
| `2` | the command could not run: bad usage, missing configuration, an unreadable or invalid input file, or a key that resolves to a different project than the pin |
|
|
245
|
+
|
|
246
|
+
## Using it from a coding agent
|
|
247
|
+
|
|
248
|
+
- **Finding a kit id.** `kits` lists the kits; pass an id from it to `read --kit-id`.
|
|
249
|
+
- **Know the project first.** Run `whoami` (or `doctor`) at the start of a session and confirm the
|
|
250
|
+
project id with the human; set `COELEVATE_PROJECT_ID` so a wrong key refuses instead of acting.
|
|
251
|
+
- **Rules are not in a kit.** List them with `assets --asset-type rule`.
|
|
252
|
+
- **Stage only, for assets.** The CLI proposes asset changes into the open changeset for a human
|
|
253
|
+
to review; it has no action that publishes or lands one. An agent must not look for a way around
|
|
254
|
+
that. Kits are the one thing written directly (`kit`), after the assets they hold are published.
|
|
255
|
+
- **Credentials from the environment only.** Never put the secret in a command line or a prompt.
|
|
256
|
+
- **Retry with pinned values.** Read `changeset --json` first. Stage with `--expected-revision`,
|
|
257
|
+
`--expected-release` and an `--idempotency-key`, and on any retry send exactly the same three
|
|
258
|
+
values and the same ops. If the server answers 409 `idempotency_key_reused`, the key was
|
|
259
|
+
already used for a different request: reuse the first attempt's reported values, or pick a new key.
|
|
260
|
+
- Use `--json` and branch on the exit code (`0` ok, `1` the service refused or was unreachable,
|
|
261
|
+
`2` fix the command or configuration).
|
|
262
|
+
|
|
263
|
+
## Troubleshooting
|
|
264
|
+
|
|
265
|
+
| Message (from the CLI) | What to do |
|
|
266
|
+
|---|---|
|
|
267
|
+
| `missing configuration: <names>. Credentials are read from the environment only, never from a flag.` | set every variable named; the secret has no flag |
|
|
268
|
+
| `project mismatch: this key resolves to project '<a>' but '<b>' is expected` | the key belongs to another project than `COELEVATE_PROJECT_ID` / `--expect-project`; use the right key or fix the pin (exit code 2, nothing was sent) |
|
|
269
|
+
| anything unclear about setup | run `coelevate doctor`: it checks each step and says which one fails |
|
|
270
|
+
| `--idempotency-key requires --expected-revision and --expected-release: ...` | pin both values (see Retrying safely); nothing was sent |
|
|
271
|
+
| `... refused (HTTP 409): ... idempotency_key_reused` + a `hint:` | the key belongs to a different request; pass the first attempt's expected values with the same key, or use a new key |
|
|
272
|
+
| `<token url> refused client '<id>' (HTTP <status>): <error>` | the key id, secret or scope was refused by the token endpoint |
|
|
273
|
+
| `could not reach the token endpoint: ...` / `... failed to connect: ...` | check `COELEVATE_API_URL` / `COELEVATE_TOKEN_URL` and the network (exit code 1) |
|
|
274
|
+
| `... failed to connect: The read operation timed out` (or `timed out`) | the service scales to zero, so the first call after a quiet spell can outlast the client's 30 s timeout while it starts. Reads (`read`, `search`, `kits`, `assets`, `asset-types`, `changeset`, `tag`, `release`) are retried once automatically after a short pause; this message means the retry timed out too (exit code 1). Running a read again is safe. `stage` is never retried by the client: check `changeset --json` before staging again, or reuse an idempotency key (see Retrying safely) |
|
|
275
|
+
| `... refused (HTTP 404)` on every call | `COELEVATE_API_URL` must be the bare API origin: the CLI adds `/context/v1/...` itself, so do not end the URL with a path (one ending in `/context` requests `/context/context/v1/...`). Check the URL, and that the deployment serves the `/context` routes, before suspecting the key. No project id belongs anywhere; the key's token names it |
|
|
276
|
+
| `--ops-file must hold a non-empty JSON array of ops` / `holds N ops; one request takes at most 100` | fix or split the file (exit code 2) |
|
|
277
|
+
| `--op is not valid JSON` / `--provenance must be a JSON object` / `cannot read --ops-file '<path>': ...` | fix the input (exit code 2) |
|
|
278
|
+
| `... refused (HTTP 422): ...` | the server rejected an op; read the detail, and see `asset-types --json` for required fields |
|
|
279
|
+
|
|
280
|
+
Timing can be tuned from the environment: `COELEVATE_HTTP_TIMEOUT` (default 30) and `COELEVATE_RETRY_BACKOFF` (the pause before the one read retry, default 1 second). The timeout applies to each phase of a request (connect, write, read), not to the request as a whole, and every run first exchanges the key for a token, which is attempted once and never retried. A read that times out is then attempted twice, so a caller with its own deadline must leave room for the token exchange, two attempts and the pause: roughly 3 x timeout + pause when the token exchange is slow once, and more when a request spends time in several phases. As a conservative rule, set `timeout <= (deadline - pause - margin) / 3`. There is no hard upper bound on a run's duration.
|
|
281
|
+
|
|
282
|
+
## Security
|
|
283
|
+
|
|
284
|
+
Do not put credentials in command lines, shell history or logs. To report a vulnerability,
|
|
285
|
+
email **security@coelevate.ai**.
|
|
286
|
+
|
|
287
|
+
## License
|
|
288
|
+
|
|
289
|
+
Copyright 2026 Gravity Break. Licensed under Apache-2.0 (see `LICENSE`). Use of the Coelevate API is governed by your Coelevate agreement and Terms of Service, not by this licence; this licence grants no API access, data rights or service level.
|
|
290
|
+
|
|
291
|
+
The CLI is developed in the `cli/` directory of a private repository. External contributions are not accepted at this time (see `CONTRIBUTING.md`).
|