tripl 0.1.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.
Files changed (80) hide show
  1. tripl-0.1.0/.gitignore +7 -0
  2. tripl-0.1.0/LICENSE +202 -0
  3. tripl-0.1.0/PKG-INFO +313 -0
  4. tripl-0.1.0/README.md +285 -0
  5. tripl-0.1.0/pyproject.toml +113 -0
  6. tripl-0.1.0/src/tripl_cli/__init__.py +28 -0
  7. tripl-0.1.0/src/tripl_cli/__main__.py +15 -0
  8. tripl-0.1.0/src/tripl_cli/api/__init__.py +65 -0
  9. tripl-0.1.0/src/tripl_cli/api/auth.py +30 -0
  10. tripl-0.1.0/src/tripl_cli/api/branches.py +32 -0
  11. tripl-0.1.0/src/tripl_cli/api/data_sources.py +13 -0
  12. tripl-0.1.0/src/tripl_cli/api/endpoints.py +45 -0
  13. tripl-0.1.0/src/tripl_cli/api/event_types.py +180 -0
  14. tripl-0.1.0/src/tripl_cli/api/events.py +64 -0
  15. tripl-0.1.0/src/tripl_cli/api/monitoring.py +58 -0
  16. tripl-0.1.0/src/tripl_cli/api/projects.py +19 -0
  17. tripl-0.1.0/src/tripl_cli/api/request.py +50 -0
  18. tripl-0.1.0/src/tripl_cli/api/scans.py +176 -0
  19. tripl-0.1.0/src/tripl_cli/api/search.py +24 -0
  20. tripl-0.1.0/src/tripl_cli/api/variables.py +40 -0
  21. tripl-0.1.0/src/tripl_cli/cli.py +122 -0
  22. tripl-0.1.0/src/tripl_cli/client.py +201 -0
  23. tripl-0.1.0/src/tripl_cli/commands/__init__.py +154 -0
  24. tripl-0.1.0/src/tripl_cli/commands/_write.py +122 -0
  25. tripl-0.1.0/src/tripl_cli/commands/doctor.py +149 -0
  26. tripl-0.1.0/src/tripl_cli/commands/drifts.py +416 -0
  27. tripl-0.1.0/src/tripl_cli/commands/install.py +501 -0
  28. tripl-0.1.0/src/tripl_cli/commands/scans.py +501 -0
  29. tripl-0.1.0/src/tripl_cli/commands/status.py +121 -0
  30. tripl-0.1.0/src/tripl_cli/commands/upgrade.py +409 -0
  31. tripl-0.1.0/src/tripl_cli/commands/watch.py +276 -0
  32. tripl-0.1.0/src/tripl_cli/config.py +313 -0
  33. tripl-0.1.0/src/tripl_cli/diagnostics/__init__.py +15 -0
  34. tripl-0.1.0/src/tripl_cli/diagnostics/checks.py +622 -0
  35. tripl-0.1.0/src/tripl_cli/diagnostics/collect.py +566 -0
  36. tripl-0.1.0/src/tripl_cli/diagnostics/endpoints.py +88 -0
  37. tripl-0.1.0/src/tripl_cli/diagnostics/model.py +571 -0
  38. tripl-0.1.0/src/tripl_cli/diagnostics/render.py +287 -0
  39. tripl-0.1.0/src/tripl_cli/diagnostics/report.py +490 -0
  40. tripl-0.1.0/src/tripl_cli/diagnostics/scan_checks.py +584 -0
  41. tripl-0.1.0/src/tripl_cli/errors.py +76 -0
  42. tripl-0.1.0/src/tripl_cli/install/__init__.py +29 -0
  43. tripl-0.1.0/src/tripl_cli/install/docker.py +112 -0
  44. tripl-0.1.0/src/tripl_cli/install/files/compose.yaml +224 -0
  45. tripl-0.1.0/src/tripl_cli/install/files/rabbitmq.conf +21 -0
  46. tripl-0.1.0/src/tripl_cli/install/files.py +482 -0
  47. tripl-0.1.0/src/tripl_cli/install/health.py +134 -0
  48. tripl-0.1.0/src/tripl_cli/install/plan.py +148 -0
  49. tripl-0.1.0/src/tripl_cli/install/render.py +334 -0
  50. tripl-0.1.0/src/tripl_cli/install/secrets.py +93 -0
  51. tripl-0.1.0/src/tripl_cli/install/shell.py +114 -0
  52. tripl-0.1.0/src/tripl_cli/py.typed +0 -0
  53. tripl-0.1.0/src/tripl_cli/runner.py +122 -0
  54. tripl-0.1.0/src/tripl_cli/watch/__init__.py +17 -0
  55. tripl-0.1.0/src/tripl_cli/watch/collect.py +97 -0
  56. tripl-0.1.0/src/tripl_cli/watch/diff.py +470 -0
  57. tripl-0.1.0/src/tripl_cli/watch/loop.py +916 -0
  58. tripl-0.1.0/src/tripl_cli/watch/model.py +566 -0
  59. tripl-0.1.0/src/tripl_cli/watch/render.py +242 -0
  60. tripl-0.1.0/tests/__init__.py +0 -0
  61. tripl-0.1.0/tests/conftest.py +772 -0
  62. tripl-0.1.0/tests/test_api_requests.py +284 -0
  63. tripl-0.1.0/tests/test_checks.py +854 -0
  64. tripl-0.1.0/tests/test_cli.py +188 -0
  65. tripl-0.1.0/tests/test_client.py +146 -0
  66. tripl-0.1.0/tests/test_config.py +361 -0
  67. tripl-0.1.0/tests/test_contract.py +540 -0
  68. tripl-0.1.0/tests/test_docker_detect.py +136 -0
  69. tripl-0.1.0/tests/test_doctor.py +606 -0
  70. tripl-0.1.0/tests/test_drifts_cmd.py +493 -0
  71. tripl-0.1.0/tests/test_install_cmd.py +892 -0
  72. tripl-0.1.0/tests/test_install_files.py +568 -0
  73. tripl-0.1.0/tests/test_output_samples.py +271 -0
  74. tripl-0.1.0/tests/test_runner.py +153 -0
  75. tripl-0.1.0/tests/test_scans_cmd.py +547 -0
  76. tripl-0.1.0/tests/test_status.py +144 -0
  77. tripl-0.1.0/tests/test_upgrade_cmd.py +534 -0
  78. tripl-0.1.0/tests/test_watch.py +1211 -0
  79. tripl-0.1.0/tests/test_watch_diff.py +700 -0
  80. tripl-0.1.0/uv.lock +390 -0
tripl-0.1.0/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ dist/
tripl-0.1.0/LICENSE ADDED
@@ -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 2026 Vladislav Denisov
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.
tripl-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,313 @@
1
+ Metadata-Version: 2.4
2
+ Name: tripl
3
+ Version: 0.1.0
4
+ Summary: Operator CLI for a tripl tracking-plan instance: diagnostics, health and live monitoring
5
+ Project-URL: Homepage, https://vladenisov.github.io/tripl/
6
+ Project-URL: Documentation, https://vladenisov.github.io/tripl/run/cli
7
+ Project-URL: Repository, https://github.com/vladenisov/tripl
8
+ Project-URL: Issues, https://github.com/vladenisov/tripl/issues
9
+ Author: Vladislav Denisov
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: analytics,cli,devops,observability,tracking-plan,tripl
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: OSI Approved :: Apache Software License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Software Development :: Libraries
23
+ Classifier: Topic :: System :: Systems Administration
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.12
26
+ Requires-Dist: httpx<1,>=0.27.0
27
+ Description-Content-Type: text/markdown
28
+
29
+ # tripl (CLI)
30
+
31
+ Operator CLI for a **running tripl instance** — diagnostics, health and live
32
+ monitoring. Like [`tripl-mcp`](../mcp-server), it is a pure HTTP client of the
33
+ tripl REST API (`/api/v1`): it imports no backend code and never touches the
34
+ database.
35
+
36
+ The distribution is **`tripl`**, the console script is **`tripl`**, and the
37
+ import package is **`tripl_cli`**. The last one is deliberate: the service's own
38
+ source package is `backend/src/tripl/`, so a distribution that installed an
39
+ importable `tripl` would shadow it in any environment holding both — a
40
+ contributor's backend venv, for one. The service is packaged as the separate
41
+ `tripl-server` distribution (tripl-ey6j.6), so `tripl` names this CLI alone.
42
+
43
+ This package also owns the **shared async REST client** (`tripl_cli.client`) and
44
+ the **shared request layer** above it (`tripl_cli.api`): every REST path, query
45
+ parameter and response projection either surface uses is spelled once, here.
46
+ `tripl-mcp` depends on `tripl` and imports both rather than carrying a copy, and
47
+ a contract test in each package fails the build if a path literal appears
48
+ anywhere else.
49
+
50
+ ## Install
51
+
52
+ Python 3.12+; the only runtime dependency is `httpx`.
53
+
54
+ > **Not on PyPI.** There is no `tripl` package on the index yet, so a bare
55
+ > `uvx tripl` will not resolve. Install from git or from a checkout.
56
+
57
+ From a local checkout — the form verified against this revision:
58
+
59
+ ```bash
60
+ uv run --project /path/to/tripl/cli tripl --version
61
+ # tripl 0.1.0
62
+ ```
63
+
64
+ From git without a checkout. This package depends only on `httpx`, so it is
65
+ expected to resolve (unlike `tripl-mcp`, which needs the unpublished `tripl`),
66
+ but it is not exercised by CI:
67
+
68
+ ```bash
69
+ uvx --from "git+https://github.com/vladenisov/tripl.git#subdirectory=cli" tripl --version
70
+ ```
71
+
72
+ ## Commands
73
+
74
+ A command acting on the instance as a whole is one word; a command acting on a
75
+ class of objects is `<plural-noun> <verb>`. Every verb takes `--json` and
76
+ `--timeout SECONDS`; the ones that report on many projects also take
77
+ `--project SLUG` (repeatable) and `--include-demo`. The ones that name a single
78
+ object require `--project` **exactly once**. A bare `tripl scans` or
79
+ `tripl drifts` prints that group's help on stderr and exits 2.
80
+
81
+ ```bash
82
+ tripl doctor # check the instance and report what is broken
83
+ tripl doctor --json # one JSON document on stdout, human lines on stderr
84
+ tripl doctor --strict # exit 3 on warnings too (never on skipped checks)
85
+ tripl status # projects, events, scans, signals, coverage
86
+ tripl watch # follow jobs, signals and delivery failures live
87
+ tripl watch --json # JSON Lines on stdout, one object per event
88
+ tripl scans list # scan configs, their schedule, and whether they dispatch
89
+ tripl scans jobs <scan> --project SLUG # recent jobs, newest first
90
+ tripl scans run <scan> --project SLUG # trigger a run now (WRITE)
91
+ tripl scans cancel <scan> <job-id> --project SLUG # cancel an active job (WRITE)
92
+ tripl drifts list # schema drifts; untriaged by default
93
+ tripl drifts dismiss <drift-id> --project SLUG # false_positive or snooze (WRITE)
94
+ tripl install --app-url https://tripl.example.com --version 1.5.0 # provision a stack and start it (HOST)
95
+ tripl install --app-url https://tripl.example.com --dry-run # print the plan, write nothing
96
+ tripl upgrade --to 1.6.0 # move an installed stack to a new image tag (HOST)
97
+ ```
98
+
99
+ `--version` defaults to `latest`; pin a released tag in production so a re-run
100
+ cannot move you onto an image you have not read the notes for. The command says
101
+ so on stderr when you leave it at the default.
102
+
103
+ `doctor`, `status`, `watch`, `scans list`, `scans jobs` and `drifts list` are
104
+ **read-only** — a `tk_r_` key is enough. The three marked WRITE need a `tk_w_`
105
+ key backed by an editor or owner, and the CLI does not pre-judge that: the key
106
+ prefix is derived from the scope's first letter server-side and says nothing
107
+ about the user's role, so the request is sent and the API's own 403 is printed.
108
+
109
+ `scans cancel` and `drifts dismiss` prompt on a terminal and take `--yes`; when
110
+ stdin is **not** a terminal and `--yes` was not given they refuse with exit 2
111
+ rather than hanging a cron job or proceeding silently. `scans run` does not
112
+ prompt and has no `--yes` at all — passing one is exit 2, because a no-op flag
113
+ here is a flag a script author will assume works on the next command too. All
114
+ three writes take `--dry-run`, which resolves everything, prints the exact
115
+ request (method, path, params, body — never a credential) and sends nothing.
116
+
117
+ `install` and `upgrade` are the two marked HOST: they act on a **directory and
118
+ the local Docker daemon**, not on a running instance, so they take neither
119
+ `--url` nor `--api-key` — passing either explicitly is exit 2 rather than a
120
+ silently ignored flag. Both take `--dir` (default `./tripl`, always reported
121
+ absolute), `--wait SECONDS` (default 300, `0` skips), `--dry-run`, `--yes` and
122
+ `--json`, and both are idempotent: `install` re-run converges, and `upgrade` to
123
+ the tag already pinned prints `already at X; nothing to do.` and exits 0.
124
+
125
+ `install` writes `compose.yaml`, `infra/rabbitmq/rabbitmq.conf` and a generated
126
+ **0600** `.env` into `--dir`, then runs `docker compose pull` and
127
+ `docker compose up -d` in it and polls `<--app-url>/health`. It **never
128
+ overwrites an existing `.env`**: that file is created, or appended to with your
129
+ confirmation, or left alone. `--force` reaches `compose.yaml` and
130
+ `rabbitmq.conf` only, and there is no flag that reaches `.env`, because losing
131
+ `ENCRYPTION_KEY` permanently destroys every stored warehouse credential.
132
+ `--no-start` writes the files and runs nothing (and skips the Docker probe
133
+ entirely). Note that the health poll targets the **public** `--app-url`, so on a
134
+ host whose TLS terminator is not up yet, use `--wait 0` and curl
135
+ `http://127.0.0.1:8000/health` from the box.
136
+
137
+ `upgrade --to` is required and a **downgrade is refused outright** with no
138
+ override flag; an unorderable pair (`latest`, `sha-abc1234`, `1.4`) says so and
139
+ demands `--yes`. It pulls, *then* moves the `TRIPL_VERSION` pin in `.env`
140
+ keeping a 0600 `.env.bak.<UTC>` copy, *then* restarts — the pull is first so a
141
+ bad tag leaves `.env` untouched. The `pg_dump` backup command is printed for
142
+ **you** to run and always prompts: a dump this tool invoked and then called
143
+ "your backup" would be a promise it cannot keep, not least because the dump does
144
+ not contain `ENCRYPTION_KEY`. Your database lives in the named volume
145
+ `pgdata18`, not in `--dir`.
146
+
147
+ Neither creates the owner account, connects a warehouse or runs the first scan.
148
+ The first two are unreachable with an API key of any scope — they need an
149
+ interactive owner session — so `install` finishes by reading the instance's real
150
+ bootstrap state from the unauthenticated `/auth/status` and printing the URL to
151
+ open in a browser.
152
+
153
+ `docker compose pull` and `up -d` write straight to your terminal and are never
154
+ captured, so their progress and their errors are live; the exact invocation is
155
+ printed first and is safe to paste. That is why `--json` carries the `argv`, the
156
+ `cwd` and the `returncode` of each command rather than its output. No generated
157
+ secret is ever printed — the document lists `secrets_generated` by **name**.
158
+
159
+ Two operations are deliberately **not** offered here. A bounded metrics replay
160
+ is owner-**session**-only server-side (`deps.get_owner_user` rejects every
161
+ request carrying an API key scope), so no `tripl` command could reach it.
162
+ Accepting a schema drift deletes the field definition on a `missing_field`
163
+ drift — the damage `doctor`'s `schema_field_deleted_by_accept` finding exists to
164
+ report — so that decision stays in the tripl UI.
165
+
166
+ `doctor` runs six checks, always in this order and always exactly once each:
167
+ `connectivity`, `auth`, `projects`, `data_sources`, `scans`, `drifts`.
168
+ Per-project results are findings *inside* a check, so a consumer selects by
169
+ `id` and gets one row.
170
+
171
+ ```text
172
+ tripl doctor - https://tripl.example.com (from $TRIPL_BASE_URL)
173
+
174
+ PASS connectivity Reached https://tripl.example.com (from $TRIPL_BASE_URL); the API and its database are up.
175
+ PASS auth The API key authenticates as an instance-wide key (role: owner).
176
+ PASS projects 1 project selected.
177
+ FAIL data_sources 1 referenced data source(s); see below.
178
+ - fail: data_source_probe_failed 'warehouse-prod'
179
+ Data source 'warehouse-prod' (used by scan config 'prod events', 'checkout funnel') last failed its connection test at 2026-07-29T19:08:09Z: 'FATAL: password authentication failed for user "tripl"'.
180
+ FAIL scans 1 of 2 scheduled scan configs is not collecting.
181
+ - fail: scan_config_failing [prod] 'prod events'
182
+ Scan config 'prod events' (1h) has failed 5 consecutive scheduled runs since 2026-07-31T14:08:09Z. Last error: 'Scan failed due to an internal error.' - that is the backend's generic fallback, not the real cause, so the cause is in the worker log for job job-0.
183
+ - warn: scan_backoff_active [prod] 'prod events'
184
+ The scheduler has deliberately deferred the next attempt to not before 2026-07-31T22:08:09Z (about 4h after the last failure): 3 or more consecutive failures trigger a backoff, so the worker is not stuck.
185
+ WARN drifts 1 event type(s) examined; see below.
186
+ - warn: schema_field_deleted_by_accept [prod] 'app.screen_view'
187
+ Field 'user_id' was deleted from event type 'app.screen_view' on 2026-07-26T19:08:09Z when a missing_field drift was accepted (by user uid-7).
188
+ - warn: schema_drift_open [prod]
189
+ Project 'prod' has 1 untriaged schema drifts (oldest detected 2026-07-28T19:08:09Z): app.screen_view.cart_value (type_changed)
190
+
191
+ 6 checks: 3 pass, 1 warn, 2 fail. Exit 3.
192
+ Re-run with --json for the machine-readable form of every finding.
193
+ ```
194
+
195
+ Output is ASCII only and byte-identical whether stdout is a TTY or a pipe, so
196
+ `tripl doctor | tee incident.log` and the terminal view are the same artifact.
197
+ Two behaviours are worth knowing before you read a report: a **non-200 is never
198
+ treated as an empty list** (it becomes `endpoint_unexpected_status`, because a
199
+ 404 read as "no drifts" is the class of mistake this tool exists to remove), and
200
+ the scheduler's **retry backoff is reported as expected behaviour** rather than
201
+ as a hang.
202
+
203
+ `watch` answers the other question: not *what is broken* at one instant, but
204
+ *what is happening right now*. It polls (there is no daemon and no subscription)
205
+ and prints one line per change — a replay advancing a chunk, a job finishing, a
206
+ signal opening, an alert delivery failing to page anyone. It **reaches no
207
+ verdict**: a completed run exits 0 whatever it saw, and it never exits 3. The
208
+ same ASCII-only, pipe-identical rule applies, so `tripl watch | tee
209
+ incident.log` is the artifact you actually saw.
210
+
211
+ ```text
212
+ 2026-07-31T19:10:41Z watch.started 1 project, 1 scan config, poll 10s.
213
+ 2026-07-31T19:10:51Z job.progress [prod] 'nightly replay' job job-91c2 chunk 4 of 18 (22.2%) collecting 2026-07-05T00:00:00Z..2026-07-06T00:00:00Z, 2m elapsed.
214
+ 2026-07-31T19:11:11Z delivery.failed [prod] 'Checkout drop' -> slack 'oncall' failed: 'channel_not_found'. Nobody was paged; delivery del-4f21.
215
+ 2026-07-31T19:11:21Z watch.stopped stopped (interrupted) after 40s, 5 ticks, 12 requests.
216
+ ```
217
+
218
+ Useful flags beyond the shared three: `--scan NAME_OR_ID` (repeatable, exact
219
+ match, narrows the job lines only), `--interval SECONDS` (default 10),
220
+ `--duration SECONDS` (stop and exit 0; the default is to run until `Ctrl-C`) and
221
+ `--stall-after SECONDS` (default 120, report a running job whose progress has
222
+ not moved).
223
+
224
+ | Exit | Meaning |
225
+ |------|---------|
226
+ | 0 | Every check passed, or only warned and `--strict` was not given. `status`, whenever it completed. `watch`, whenever the run completed — a failed job or a new signal is still 0. The `scans` / `drifts` verbs, whenever every read arrived or the write was accepted (`--dry-run` included). |
227
+ | 1 | The tool itself broke (doctor turns every API failure into a finding), or any other command could not complete a request — unreachable, or the API refused it. For `watch` this includes a key revoked mid-run. For `scans list` / `drifts list` it includes **any** failed read in the fan-out; for `scans run`, a job returned already `failed`; for `scans cancel` / `drifts dismiss`, a declined prompt. |
228
+ | 2 | Usage or configuration error. For `doctor` and `status` that is resolved before any socket opens; `watch` also refuses after reading the listings, when `--scan` matches nothing or more than 24 scan configs are selected. The `scans` / `drifts` verbs add a bare group, a missing or repeated `--project`, an unresolved or ambiguous `<scan>`, and a prompting write on a non-TTY without `--yes`. Either way **no JSON is emitted** and no write is sent. |
229
+ | 3 | `doctor` only: at least one check failed, or `--strict` and at least one warning. Nothing else ever exits 3. |
230
+ | 130 | Interrupted (SIGINT). For `watch` this is the **normal** ending — a run without `--duration` has no other way to stop. |
231
+
232
+ An unreachable instance therefore exits **3** out of `doctor`, not 1 — it
233
+ becomes a finding like everything else doctor reads, which is what makes an exit
234
+ 1 out of `doctor` a meaningful bug signal. **Every other command exits 1** on an
235
+ unreachable instance, because none of them turns a failed read into a verdict.
236
+
237
+ `doctor` and `status` put exactly one JSON document on stdout, and so do the
238
+ `scans` / `drifts` verbs — but only when the command completes: a write the API
239
+ refused, a read that failed outright and a declined prompt all leave stdout
240
+ **empty** and put the reason on stderr, so a consumer checks the exit code
241
+ before it parses. `watch --json`
242
+ puts **JSON Lines**, one object per event, flushed as produced. Within one
243
+ `schema_version`, key names are never removed or retyped, and check `id`s,
244
+ finding `code`s, `status`/`severity` values and `watch` event tokens are never
245
+ renamed or repurposed. New keys, ids, codes and tokens may appear in any
246
+ release. `title`, `summary` and `message` are prose. **Assert on `code` and
247
+ `evidence` — or, for `watch`, on `event` and `data` — never on prose.**
248
+
249
+ Full reference — every check, every finding code with its `evidence` keys, every
250
+ `watch` event token and the JSON Lines envelope, and what an operator should
251
+ actually do about each one:
252
+ <https://vladenisov.github.io/tripl/run/cli> (source:
253
+ [`website/docs/run/cli.md`](../website/docs/run/cli.md)).
254
+
255
+ ## Configuration
256
+
257
+ Resolved **per field**, highest precedence first:
258
+
259
+ 1. command-line flag — `--url` / `--base-url`, `--api-key`
260
+ 2. environment — `TRIPL_BASE_URL`, `TRIPL_API_KEY`
261
+ 3. config file — `base_url`, `api_key`
262
+
263
+ Per field, not per source: `--url https://staging` with the key still coming
264
+ from the config file works.
265
+
266
+ | Variable | Meaning |
267
+ |----------|---------|
268
+ | `TRIPL_BASE_URL` | Base URL of the tripl instance (the same variable `tripl-mcp` reads) |
269
+ | `TRIPL_API_KEY` | API key — `tk_r_` for read-only, `tk_w_` for write |
270
+ | `XDG_CONFIG_HOME` | Overrides the config file location on every platform |
271
+
272
+ There is deliberately **no `TRIPL_URL`**: two supported spellings for one
273
+ setting is how configuration drifts. If it is set and `TRIPL_BASE_URL` is not,
274
+ the error says so by name.
275
+
276
+ ### Config file
277
+
278
+ | Platform | Path |
279
+ |----------|------|
280
+ | Linux / BSD / macOS | `$XDG_CONFIG_HOME/tripl/config.toml`, else `~/.config/tripl/config.toml` |
281
+ | Windows | `%APPDATA%\tripl\config.toml`, else the `~/.config` fallback |
282
+
283
+ ```toml
284
+ # ~/.config/tripl/config.toml
285
+ base_url = "https://tripl.example.com"
286
+ api_key = "tk_r_..."
287
+ ```
288
+
289
+ TOML because `tomllib` is stdlib on the supported Pythons, so the file format
290
+ costs **zero runtime dependencies** — which matters, because `tripl-mcp`
291
+ inherits every dependency of this package. Unknown keys and unknown tables are
292
+ ignored, so an older CLI keeps working against a file written by a newer one.
293
+
294
+ `--config PATH` overrides discovery. A missing *default* file is fine; a missing
295
+ `--config` path is an error. On POSIX, a config file that holds an `api_key` and
296
+ is readable by other users gets one warning on stderr — `chmod 600` it.
297
+
298
+ Create API keys in the tripl app under **Settings → API keys**.
299
+
300
+ ## Development
301
+
302
+ ```bash
303
+ cd cli
304
+ uv sync
305
+ uv run --group dev pytest -q
306
+ uv run --group dev ruff check
307
+ uv run --group dev ruff format --check
308
+ uv run --group dev mypy src
309
+ ```
310
+
311
+ `mcp-server` resolves this package from `../cli` via `[tool.uv.sources]` while
312
+ it is unpublished, so a change here is picked up by `cd mcp-server && uv sync`
313
+ without any install step. Run **both** suites after touching `client.py`.