trimrig 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.
- trimrig-0.1.0/PKG-INFO +207 -0
- trimrig-0.1.0/README.md +186 -0
- trimrig-0.1.0/pyproject.toml +40 -0
- trimrig-0.1.0/setup.cfg +4 -0
- trimrig-0.1.0/src/trimrig.egg-info/PKG-INFO +207 -0
- trimrig-0.1.0/src/trimrig.egg-info/SOURCES.txt +15 -0
- trimrig-0.1.0/src/trimrig.egg-info/dependency_links.txt +1 -0
- trimrig-0.1.0/src/trimrig.egg-info/entry_points.txt +2 -0
- trimrig-0.1.0/src/trimrig.egg-info/requires.txt +6 -0
- trimrig-0.1.0/src/trimrig.egg-info/top_level.txt +1 -0
- trimrig-0.1.0/src/trimrig_cli/__init__.py +3 -0
- trimrig-0.1.0/src/trimrig_cli/client.py +101 -0
- trimrig-0.1.0/src/trimrig_cli/config.py +100 -0
- trimrig-0.1.0/src/trimrig_cli/main.py +698 -0
- trimrig-0.1.0/tests/test_cli.py +108 -0
- trimrig-0.1.0/tests/test_frame.py +69 -0
- trimrig-0.1.0/tests/test_runs.py +102 -0
trimrig-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: trimrig
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Trimrig command line: workstreams, Blueprints, runs and shipping, from your terminal or CI.
|
|
5
|
+
Author: Nyvix
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Project-URL: Homepage, https://trimrig.com
|
|
8
|
+
Project-URL: Documentation, https://trimrig.com/#/help
|
|
9
|
+
Keywords: trimrig,ai evaluation,benchmarks,tasks,cli
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: typer>=0.12
|
|
17
|
+
Requires-Dist: httpx>=0.27
|
|
18
|
+
Requires-Dist: keyring>=25
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
21
|
+
|
|
22
|
+
# trimrig
|
|
23
|
+
|
|
24
|
+
The command line for [Trimrig](https://trimrig.com): manage workstreams from your terminal or CI. It is a client of Trimrig's public REST API and follows the same rules as the web app, roles included.
|
|
25
|
+
|
|
26
|
+
> Status: v0.1. Commands: `login`, `logout`, `whoami`, `workspace list|use`, `workstream list|archive|restore|delete`, `frame show|export|import|approve`, `run`, `status`, `ship`.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pip install trimrig # or: pipx install trimrig
|
|
32
|
+
trimrig --version
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Python 3.10 or newer. Upgrade with `pip install -U trimrig`.
|
|
36
|
+
|
|
37
|
+
## Sign in
|
|
38
|
+
|
|
39
|
+
On your own computer:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
trimrig login
|
|
43
|
+
# Your code: BCDF-GHJK
|
|
44
|
+
# Approve it at https://trimrig.com/#/cli/approve/BCDF-GHJK
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Your browser opens; check that the code matches, pick the organization, and click **Approve**. The CLI receives a token and keeps it in your system keychain (Keychain on macOS, Credential Manager on Windows, Secret Service on Linux), never in a plain file.
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
trimrig whoami # Ada Lovelace · Acme · admin (token from keychain)
|
|
51
|
+
trimrig logout # removes it from this computer
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`logout` only forgets the token on this computer. To switch it off everywhere, revoke it in **Settings → API tokens**.
|
|
55
|
+
|
|
56
|
+
### In CI
|
|
57
|
+
|
|
58
|
+
Create a token in **Settings → API tokens** (it's shown once) and set it as a secret:
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
# GitHub Actions
|
|
62
|
+
env:
|
|
63
|
+
TRIMRIG_TOKEN: ${{ secrets.TRIMRIG_TOKEN }}
|
|
64
|
+
steps:
|
|
65
|
+
- run: pip install trimrig
|
|
66
|
+
- run: trimrig workstream list --json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`TRIMRIG_TOKEN` always wins over a saved sign-in. A token acts as the person who created it, in that organization, with their current role.
|
|
70
|
+
|
|
71
|
+
## Workstreams
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
trimrig workstream list # active ones
|
|
75
|
+
trimrig workstream list --archived
|
|
76
|
+
trimrig workstream list --deleted # Admins: deleted in the last 30 days
|
|
77
|
+
|
|
78
|
+
trimrig workstream archive "Invoice Recon" # hide it; nothing is deleted
|
|
79
|
+
trimrig workstream restore "Invoice Recon" # from archived, or from deleted within 30 days (Admins)
|
|
80
|
+
|
|
81
|
+
trimrig workstream delete "Invoice Recon" # Admins
|
|
82
|
+
# This removes 2 runs, 5 tasks, 12 trials, 1 Blueprint versions, 3 sources and 17 stored files from Invoice Recon.
|
|
83
|
+
# It can be restored for 30 days (Settings → Deleted, or `trimrig workstream restore`).
|
|
84
|
+
# Type Invoice Recon to confirm: Invoice Recon
|
|
85
|
+
# Deleted Invoice Recon. Restorable until 2026-12-18.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
A workstream can be named by its exact name (any case), its id, or the first 8+ characters of its id. Delete is refused while a run is queued or running.
|
|
89
|
+
|
|
90
|
+
## Blueprints (`frame`)
|
|
91
|
+
|
|
92
|
+
A workstream's Blueprint says what every task must look like: the folder structure, the rules, and the difficulty test. Runs are always built from an approved version.
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
trimrig frame show "Invoice Recon" # the latest approved version
|
|
96
|
+
trimrig frame show "Invoice Recon" --draft # the draft being edited, with its open questions
|
|
97
|
+
trimrig frame show "Invoice Recon" -v 1.0 # a specific version
|
|
98
|
+
|
|
99
|
+
trimrig frame export "Invoice Recon" -o invoice-recon.json # keep it in git
|
|
100
|
+
trimrig frame import "Invoice Recon" invoice-recon.json # replace the draft with a file
|
|
101
|
+
trimrig frame import "Invoice Recon EU" invoice-recon.json --create # a new workstream from it
|
|
102
|
+
|
|
103
|
+
trimrig frame approve "Invoice Recon"
|
|
104
|
+
# 1 question to answer before approving:
|
|
105
|
+
# Q1 Which Python?
|
|
106
|
+
# 1. Python 3.12
|
|
107
|
+
# 2. Python 3.11
|
|
108
|
+
# Your answer (a number or your own words): 1
|
|
109
|
+
# Approved Invoice Recon Blueprint v2.0.
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
In CI, answer open questions up front: `trimrig frame approve "Invoice Recon" --answer Q1="Python 3.12" --answer C1="Omit it"`. Without them `approve` exits with code 2 and lists what's open. An exported file keeps its answers, so importing it and approving again doesn't ask them twice.
|
|
113
|
+
|
|
114
|
+
## Runs
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
trimrig run --blueprint "Invoice Recon@1.0" --n 20 # @version optional: the latest approved
|
|
118
|
+
# Started run #3 of Invoice Recon from Blueprint v1.0: 20 tasks.
|
|
119
|
+
|
|
120
|
+
trimrig status # the run you just started
|
|
121
|
+
trimrig status "Invoice Recon#3" # or any run, by workstream and number (or its id)
|
|
122
|
+
trimrig status --watch # follow it until it ends
|
|
123
|
+
# Run #3 of Invoice Recon · Blueprint v1.0 · running · 12 building
|
|
124
|
+
# Run #3 of Invoice Recon · Blueprint v1.0 · finished · 17 ready, 3 review
|
|
125
|
+
# INV-014 in Review: Too easy for Route A: harden and re-test.
|
|
126
|
+
|
|
127
|
+
trimrig ship # the ready tasks as a ZIP, shipped as batch 1
|
|
128
|
+
# Saved invoice-recon-run3-batch1.zip (842 KB).
|
|
129
|
+
# Shipped batch 1: marked 17 tasks as shipped.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`run` options: `--difficulty Easy|Medium|Hard|Mixed`, `--diversity Focused|Balanced|Wide`, `--repairs 0-5` (attempts before a task goes to Review), `--no-difficulty-test`, and `--watch` to start and follow in one go.
|
|
133
|
+
|
|
134
|
+
`status --watch` (and `run --watch`) exits 0 when the run finishes and 1 if it fails or stops (for example when a budget runs out), so CI can wait on it:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
trimrig run -b "Invoice Recon" --n 50 --watch && trimrig ship -o tasks.zip
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The ZIP has one folder per task (named by its code; `INV-014-r2` for a later revision) plus `manifest.json`: the Blueprint name and version, the run and batch, who shipped it and when, and for each task its revision, a SHA-256 per file and a content hash, its check results, and the difficulty verdict with each route's pass rate.
|
|
141
|
+
|
|
142
|
+
`ship` needs an Admin or Builder. It ships only what's ready and not yet shipped, as the run's next batch, and marks those tasks **Shipped** (one audit entry per batch). If two people ship at once, one gets the batch and the other is told there's nothing new. Shipped tasks never change: editing or re-proving one makes a new revision, which ships in a later batch.
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
trimrig ship --again latest # the last batch again, byte for byte as shipped
|
|
146
|
+
trimrig ship --again 1 # batch 1
|
|
147
|
+
trimrig ship --again all # every shipped batch in one ZIP
|
|
148
|
+
trimrig ship --no-mark # a copy of what's ready now; marks nothing
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`--again` and `--no-mark` mark nothing, and anyone who can see the run may use them. The web app's Ship page (Run → **Ship N ready** / **Ship N new**) does the same.
|
|
152
|
+
|
|
153
|
+
## Workspaces
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
trimrig workspace list
|
|
157
|
+
trimrig workspace use Finance # the default for every command
|
|
158
|
+
trimrig workspace use none # clear it
|
|
159
|
+
trimrig workstream list -w Biology # or per command
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Flags on every command
|
|
163
|
+
|
|
164
|
+
| Flag | What it does |
|
|
165
|
+
|---|---|
|
|
166
|
+
| `--workspace NAME`, `-w` | Work in one workspace (name or id) |
|
|
167
|
+
| `--json` | Print JSON, for scripts; errors become `{"error": "...", "code": n}` |
|
|
168
|
+
| `--yes`, `-y` | Skip confirmation prompts (needed for `delete` outside a terminal) |
|
|
169
|
+
|
|
170
|
+
They work before or after the command: `trimrig --json workstream list` and `trimrig workstream list --json` are the same.
|
|
171
|
+
|
|
172
|
+
## Exit codes
|
|
173
|
+
|
|
174
|
+
| Code | Meaning |
|
|
175
|
+
|---|---|
|
|
176
|
+
| 0 | OK |
|
|
177
|
+
| 1 | Error (for example a run is still active, or Trimrig couldn't be reached) |
|
|
178
|
+
| 2 | Bad input (a malformed request, a confirmation name that doesn't match, an ambiguous name) |
|
|
179
|
+
| 3 | Not found, or no permission (including not signed in, or a revoked token) |
|
|
180
|
+
|
|
181
|
+
## Configuration
|
|
182
|
+
|
|
183
|
+
| Variable | Default |
|
|
184
|
+
|---|---|
|
|
185
|
+
| `TRIMRIG_TOKEN` | the token saved by `trimrig login` |
|
|
186
|
+
| `TRIMRIG_API_URL` | `https://api.trimrig.com` |
|
|
187
|
+
| `TRIMRIG_CONFIG_DIR` | your user config folder (`%APPDATA%\trimrig`, `~/.config/trimrig`) |
|
|
188
|
+
|
|
189
|
+
The config folder holds only preferences (organization name, default workspace), no secrets.
|
|
190
|
+
|
|
191
|
+
## Development
|
|
192
|
+
|
|
193
|
+
```sh
|
|
194
|
+
pip install -e "cli[dev]" # plus the backend's requirements, for the local API
|
|
195
|
+
python -m pytest cli/tests -q
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The tests start Trimrig's real API locally (with in-memory stand-ins for the database) and drive the CLI against it over HTTP.
|
|
199
|
+
|
|
200
|
+
## Releasing
|
|
201
|
+
|
|
202
|
+
Publishing to PyPI is done by GitHub Actions (`.github/workflows/publish-cli.yml`) when a tag
|
|
203
|
+
like `cli-v0.1.1` is pushed. PyPI trusts that workflow directly, so no PyPI token is stored.
|
|
204
|
+
|
|
205
|
+
1. Raise the version in `pyproject.toml` and `src/trimrig_cli/__init__.py` (they must match).
|
|
206
|
+
2. Commit, then tag and push: `git tag cli-v0.1.1; git push origin cli-v0.1.1`.
|
|
207
|
+
3. The workflow checks the tag matches the version, runs the tests, builds and publishes.
|
trimrig-0.1.0/README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# trimrig
|
|
2
|
+
|
|
3
|
+
The command line for [Trimrig](https://trimrig.com): manage workstreams from your terminal or CI. It is a client of Trimrig's public REST API and follows the same rules as the web app, roles included.
|
|
4
|
+
|
|
5
|
+
> Status: v0.1. Commands: `login`, `logout`, `whoami`, `workspace list|use`, `workstream list|archive|restore|delete`, `frame show|export|import|approve`, `run`, `status`, `ship`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pip install trimrig # or: pipx install trimrig
|
|
11
|
+
trimrig --version
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Python 3.10 or newer. Upgrade with `pip install -U trimrig`.
|
|
15
|
+
|
|
16
|
+
## Sign in
|
|
17
|
+
|
|
18
|
+
On your own computer:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
trimrig login
|
|
22
|
+
# Your code: BCDF-GHJK
|
|
23
|
+
# Approve it at https://trimrig.com/#/cli/approve/BCDF-GHJK
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Your browser opens; check that the code matches, pick the organization, and click **Approve**. The CLI receives a token and keeps it in your system keychain (Keychain on macOS, Credential Manager on Windows, Secret Service on Linux), never in a plain file.
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
trimrig whoami # Ada Lovelace · Acme · admin (token from keychain)
|
|
30
|
+
trimrig logout # removes it from this computer
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`logout` only forgets the token on this computer. To switch it off everywhere, revoke it in **Settings → API tokens**.
|
|
34
|
+
|
|
35
|
+
### In CI
|
|
36
|
+
|
|
37
|
+
Create a token in **Settings → API tokens** (it's shown once) and set it as a secret:
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
# GitHub Actions
|
|
41
|
+
env:
|
|
42
|
+
TRIMRIG_TOKEN: ${{ secrets.TRIMRIG_TOKEN }}
|
|
43
|
+
steps:
|
|
44
|
+
- run: pip install trimrig
|
|
45
|
+
- run: trimrig workstream list --json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`TRIMRIG_TOKEN` always wins over a saved sign-in. A token acts as the person who created it, in that organization, with their current role.
|
|
49
|
+
|
|
50
|
+
## Workstreams
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
trimrig workstream list # active ones
|
|
54
|
+
trimrig workstream list --archived
|
|
55
|
+
trimrig workstream list --deleted # Admins: deleted in the last 30 days
|
|
56
|
+
|
|
57
|
+
trimrig workstream archive "Invoice Recon" # hide it; nothing is deleted
|
|
58
|
+
trimrig workstream restore "Invoice Recon" # from archived, or from deleted within 30 days (Admins)
|
|
59
|
+
|
|
60
|
+
trimrig workstream delete "Invoice Recon" # Admins
|
|
61
|
+
# This removes 2 runs, 5 tasks, 12 trials, 1 Blueprint versions, 3 sources and 17 stored files from Invoice Recon.
|
|
62
|
+
# It can be restored for 30 days (Settings → Deleted, or `trimrig workstream restore`).
|
|
63
|
+
# Type Invoice Recon to confirm: Invoice Recon
|
|
64
|
+
# Deleted Invoice Recon. Restorable until 2026-12-18.
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
A workstream can be named by its exact name (any case), its id, or the first 8+ characters of its id. Delete is refused while a run is queued or running.
|
|
68
|
+
|
|
69
|
+
## Blueprints (`frame`)
|
|
70
|
+
|
|
71
|
+
A workstream's Blueprint says what every task must look like: the folder structure, the rules, and the difficulty test. Runs are always built from an approved version.
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
trimrig frame show "Invoice Recon" # the latest approved version
|
|
75
|
+
trimrig frame show "Invoice Recon" --draft # the draft being edited, with its open questions
|
|
76
|
+
trimrig frame show "Invoice Recon" -v 1.0 # a specific version
|
|
77
|
+
|
|
78
|
+
trimrig frame export "Invoice Recon" -o invoice-recon.json # keep it in git
|
|
79
|
+
trimrig frame import "Invoice Recon" invoice-recon.json # replace the draft with a file
|
|
80
|
+
trimrig frame import "Invoice Recon EU" invoice-recon.json --create # a new workstream from it
|
|
81
|
+
|
|
82
|
+
trimrig frame approve "Invoice Recon"
|
|
83
|
+
# 1 question to answer before approving:
|
|
84
|
+
# Q1 Which Python?
|
|
85
|
+
# 1. Python 3.12
|
|
86
|
+
# 2. Python 3.11
|
|
87
|
+
# Your answer (a number or your own words): 1
|
|
88
|
+
# Approved Invoice Recon Blueprint v2.0.
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
In CI, answer open questions up front: `trimrig frame approve "Invoice Recon" --answer Q1="Python 3.12" --answer C1="Omit it"`. Without them `approve` exits with code 2 and lists what's open. An exported file keeps its answers, so importing it and approving again doesn't ask them twice.
|
|
92
|
+
|
|
93
|
+
## Runs
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
trimrig run --blueprint "Invoice Recon@1.0" --n 20 # @version optional: the latest approved
|
|
97
|
+
# Started run #3 of Invoice Recon from Blueprint v1.0: 20 tasks.
|
|
98
|
+
|
|
99
|
+
trimrig status # the run you just started
|
|
100
|
+
trimrig status "Invoice Recon#3" # or any run, by workstream and number (or its id)
|
|
101
|
+
trimrig status --watch # follow it until it ends
|
|
102
|
+
# Run #3 of Invoice Recon · Blueprint v1.0 · running · 12 building
|
|
103
|
+
# Run #3 of Invoice Recon · Blueprint v1.0 · finished · 17 ready, 3 review
|
|
104
|
+
# INV-014 in Review: Too easy for Route A: harden and re-test.
|
|
105
|
+
|
|
106
|
+
trimrig ship # the ready tasks as a ZIP, shipped as batch 1
|
|
107
|
+
# Saved invoice-recon-run3-batch1.zip (842 KB).
|
|
108
|
+
# Shipped batch 1: marked 17 tasks as shipped.
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`run` options: `--difficulty Easy|Medium|Hard|Mixed`, `--diversity Focused|Balanced|Wide`, `--repairs 0-5` (attempts before a task goes to Review), `--no-difficulty-test`, and `--watch` to start and follow in one go.
|
|
112
|
+
|
|
113
|
+
`status --watch` (and `run --watch`) exits 0 when the run finishes and 1 if it fails or stops (for example when a budget runs out), so CI can wait on it:
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
trimrig run -b "Invoice Recon" --n 50 --watch && trimrig ship -o tasks.zip
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The ZIP has one folder per task (named by its code; `INV-014-r2` for a later revision) plus `manifest.json`: the Blueprint name and version, the run and batch, who shipped it and when, and for each task its revision, a SHA-256 per file and a content hash, its check results, and the difficulty verdict with each route's pass rate.
|
|
120
|
+
|
|
121
|
+
`ship` needs an Admin or Builder. It ships only what's ready and not yet shipped, as the run's next batch, and marks those tasks **Shipped** (one audit entry per batch). If two people ship at once, one gets the batch and the other is told there's nothing new. Shipped tasks never change: editing or re-proving one makes a new revision, which ships in a later batch.
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
trimrig ship --again latest # the last batch again, byte for byte as shipped
|
|
125
|
+
trimrig ship --again 1 # batch 1
|
|
126
|
+
trimrig ship --again all # every shipped batch in one ZIP
|
|
127
|
+
trimrig ship --no-mark # a copy of what's ready now; marks nothing
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
`--again` and `--no-mark` mark nothing, and anyone who can see the run may use them. The web app's Ship page (Run → **Ship N ready** / **Ship N new**) does the same.
|
|
131
|
+
|
|
132
|
+
## Workspaces
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
trimrig workspace list
|
|
136
|
+
trimrig workspace use Finance # the default for every command
|
|
137
|
+
trimrig workspace use none # clear it
|
|
138
|
+
trimrig workstream list -w Biology # or per command
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Flags on every command
|
|
142
|
+
|
|
143
|
+
| Flag | What it does |
|
|
144
|
+
|---|---|
|
|
145
|
+
| `--workspace NAME`, `-w` | Work in one workspace (name or id) |
|
|
146
|
+
| `--json` | Print JSON, for scripts; errors become `{"error": "...", "code": n}` |
|
|
147
|
+
| `--yes`, `-y` | Skip confirmation prompts (needed for `delete` outside a terminal) |
|
|
148
|
+
|
|
149
|
+
They work before or after the command: `trimrig --json workstream list` and `trimrig workstream list --json` are the same.
|
|
150
|
+
|
|
151
|
+
## Exit codes
|
|
152
|
+
|
|
153
|
+
| Code | Meaning |
|
|
154
|
+
|---|---|
|
|
155
|
+
| 0 | OK |
|
|
156
|
+
| 1 | Error (for example a run is still active, or Trimrig couldn't be reached) |
|
|
157
|
+
| 2 | Bad input (a malformed request, a confirmation name that doesn't match, an ambiguous name) |
|
|
158
|
+
| 3 | Not found, or no permission (including not signed in, or a revoked token) |
|
|
159
|
+
|
|
160
|
+
## Configuration
|
|
161
|
+
|
|
162
|
+
| Variable | Default |
|
|
163
|
+
|---|---|
|
|
164
|
+
| `TRIMRIG_TOKEN` | the token saved by `trimrig login` |
|
|
165
|
+
| `TRIMRIG_API_URL` | `https://api.trimrig.com` |
|
|
166
|
+
| `TRIMRIG_CONFIG_DIR` | your user config folder (`%APPDATA%\trimrig`, `~/.config/trimrig`) |
|
|
167
|
+
|
|
168
|
+
The config folder holds only preferences (organization name, default workspace), no secrets.
|
|
169
|
+
|
|
170
|
+
## Development
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
pip install -e "cli[dev]" # plus the backend's requirements, for the local API
|
|
174
|
+
python -m pytest cli/tests -q
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The tests start Trimrig's real API locally (with in-memory stand-ins for the database) and drive the CLI against it over HTTP.
|
|
178
|
+
|
|
179
|
+
## Releasing
|
|
180
|
+
|
|
181
|
+
Publishing to PyPI is done by GitHub Actions (`.github/workflows/publish-cli.yml`) when a tag
|
|
182
|
+
like `cli-v0.1.1` is pushed. PyPI trusts that workflow directly, so no PyPI token is stored.
|
|
183
|
+
|
|
184
|
+
1. Raise the version in `pyproject.toml` and `src/trimrig_cli/__init__.py` (they must match).
|
|
185
|
+
2. Commit, then tag and push: `git tag cli-v0.1.1; git push origin cli-v0.1.1`.
|
|
186
|
+
3. The workflow checks the tag matches the version, runs the tests, builds and publishes.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "trimrig"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "The Trimrig command line: workstreams, Blueprints, runs and shipping, from your terminal or CI."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [{ name = "Nyvix" }]
|
|
7
|
+
requires-python = ">=3.10"
|
|
8
|
+
license = "LicenseRef-Proprietary"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Programming Language :: Python :: 3",
|
|
11
|
+
"Environment :: Console",
|
|
12
|
+
"Operating System :: OS Independent",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
]
|
|
15
|
+
keywords = ["trimrig", "ai evaluation", "benchmarks", "tasks", "cli"]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"typer>=0.12",
|
|
18
|
+
"httpx>=0.27",
|
|
19
|
+
"keyring>=25",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://trimrig.com"
|
|
24
|
+
Documentation = "https://trimrig.com/#/help"
|
|
25
|
+
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
dev = ["pytest>=8"]
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
trimrig = "trimrig_cli.main:run"
|
|
31
|
+
|
|
32
|
+
[build-system]
|
|
33
|
+
requires = ["setuptools>=77"]
|
|
34
|
+
build-backend = "setuptools.build_meta"
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.packages.find]
|
|
37
|
+
where = ["src"]
|
|
38
|
+
|
|
39
|
+
[tool.pytest.ini_options]
|
|
40
|
+
testpaths = ["tests"]
|
trimrig-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: trimrig
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Trimrig command line: workstreams, Blueprints, runs and shipping, from your terminal or CI.
|
|
5
|
+
Author: Nyvix
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Project-URL: Homepage, https://trimrig.com
|
|
8
|
+
Project-URL: Documentation, https://trimrig.com/#/help
|
|
9
|
+
Keywords: trimrig,ai evaluation,benchmarks,tasks,cli
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: typer>=0.12
|
|
17
|
+
Requires-Dist: httpx>=0.27
|
|
18
|
+
Requires-Dist: keyring>=25
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
21
|
+
|
|
22
|
+
# trimrig
|
|
23
|
+
|
|
24
|
+
The command line for [Trimrig](https://trimrig.com): manage workstreams from your terminal or CI. It is a client of Trimrig's public REST API and follows the same rules as the web app, roles included.
|
|
25
|
+
|
|
26
|
+
> Status: v0.1. Commands: `login`, `logout`, `whoami`, `workspace list|use`, `workstream list|archive|restore|delete`, `frame show|export|import|approve`, `run`, `status`, `ship`.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pip install trimrig # or: pipx install trimrig
|
|
32
|
+
trimrig --version
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Python 3.10 or newer. Upgrade with `pip install -U trimrig`.
|
|
36
|
+
|
|
37
|
+
## Sign in
|
|
38
|
+
|
|
39
|
+
On your own computer:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
trimrig login
|
|
43
|
+
# Your code: BCDF-GHJK
|
|
44
|
+
# Approve it at https://trimrig.com/#/cli/approve/BCDF-GHJK
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Your browser opens; check that the code matches, pick the organization, and click **Approve**. The CLI receives a token and keeps it in your system keychain (Keychain on macOS, Credential Manager on Windows, Secret Service on Linux), never in a plain file.
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
trimrig whoami # Ada Lovelace · Acme · admin (token from keychain)
|
|
51
|
+
trimrig logout # removes it from this computer
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`logout` only forgets the token on this computer. To switch it off everywhere, revoke it in **Settings → API tokens**.
|
|
55
|
+
|
|
56
|
+
### In CI
|
|
57
|
+
|
|
58
|
+
Create a token in **Settings → API tokens** (it's shown once) and set it as a secret:
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
# GitHub Actions
|
|
62
|
+
env:
|
|
63
|
+
TRIMRIG_TOKEN: ${{ secrets.TRIMRIG_TOKEN }}
|
|
64
|
+
steps:
|
|
65
|
+
- run: pip install trimrig
|
|
66
|
+
- run: trimrig workstream list --json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`TRIMRIG_TOKEN` always wins over a saved sign-in. A token acts as the person who created it, in that organization, with their current role.
|
|
70
|
+
|
|
71
|
+
## Workstreams
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
trimrig workstream list # active ones
|
|
75
|
+
trimrig workstream list --archived
|
|
76
|
+
trimrig workstream list --deleted # Admins: deleted in the last 30 days
|
|
77
|
+
|
|
78
|
+
trimrig workstream archive "Invoice Recon" # hide it; nothing is deleted
|
|
79
|
+
trimrig workstream restore "Invoice Recon" # from archived, or from deleted within 30 days (Admins)
|
|
80
|
+
|
|
81
|
+
trimrig workstream delete "Invoice Recon" # Admins
|
|
82
|
+
# This removes 2 runs, 5 tasks, 12 trials, 1 Blueprint versions, 3 sources and 17 stored files from Invoice Recon.
|
|
83
|
+
# It can be restored for 30 days (Settings → Deleted, or `trimrig workstream restore`).
|
|
84
|
+
# Type Invoice Recon to confirm: Invoice Recon
|
|
85
|
+
# Deleted Invoice Recon. Restorable until 2026-12-18.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
A workstream can be named by its exact name (any case), its id, or the first 8+ characters of its id. Delete is refused while a run is queued or running.
|
|
89
|
+
|
|
90
|
+
## Blueprints (`frame`)
|
|
91
|
+
|
|
92
|
+
A workstream's Blueprint says what every task must look like: the folder structure, the rules, and the difficulty test. Runs are always built from an approved version.
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
trimrig frame show "Invoice Recon" # the latest approved version
|
|
96
|
+
trimrig frame show "Invoice Recon" --draft # the draft being edited, with its open questions
|
|
97
|
+
trimrig frame show "Invoice Recon" -v 1.0 # a specific version
|
|
98
|
+
|
|
99
|
+
trimrig frame export "Invoice Recon" -o invoice-recon.json # keep it in git
|
|
100
|
+
trimrig frame import "Invoice Recon" invoice-recon.json # replace the draft with a file
|
|
101
|
+
trimrig frame import "Invoice Recon EU" invoice-recon.json --create # a new workstream from it
|
|
102
|
+
|
|
103
|
+
trimrig frame approve "Invoice Recon"
|
|
104
|
+
# 1 question to answer before approving:
|
|
105
|
+
# Q1 Which Python?
|
|
106
|
+
# 1. Python 3.12
|
|
107
|
+
# 2. Python 3.11
|
|
108
|
+
# Your answer (a number or your own words): 1
|
|
109
|
+
# Approved Invoice Recon Blueprint v2.0.
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
In CI, answer open questions up front: `trimrig frame approve "Invoice Recon" --answer Q1="Python 3.12" --answer C1="Omit it"`. Without them `approve` exits with code 2 and lists what's open. An exported file keeps its answers, so importing it and approving again doesn't ask them twice.
|
|
113
|
+
|
|
114
|
+
## Runs
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
trimrig run --blueprint "Invoice Recon@1.0" --n 20 # @version optional: the latest approved
|
|
118
|
+
# Started run #3 of Invoice Recon from Blueprint v1.0: 20 tasks.
|
|
119
|
+
|
|
120
|
+
trimrig status # the run you just started
|
|
121
|
+
trimrig status "Invoice Recon#3" # or any run, by workstream and number (or its id)
|
|
122
|
+
trimrig status --watch # follow it until it ends
|
|
123
|
+
# Run #3 of Invoice Recon · Blueprint v1.0 · running · 12 building
|
|
124
|
+
# Run #3 of Invoice Recon · Blueprint v1.0 · finished · 17 ready, 3 review
|
|
125
|
+
# INV-014 in Review: Too easy for Route A: harden and re-test.
|
|
126
|
+
|
|
127
|
+
trimrig ship # the ready tasks as a ZIP, shipped as batch 1
|
|
128
|
+
# Saved invoice-recon-run3-batch1.zip (842 KB).
|
|
129
|
+
# Shipped batch 1: marked 17 tasks as shipped.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`run` options: `--difficulty Easy|Medium|Hard|Mixed`, `--diversity Focused|Balanced|Wide`, `--repairs 0-5` (attempts before a task goes to Review), `--no-difficulty-test`, and `--watch` to start and follow in one go.
|
|
133
|
+
|
|
134
|
+
`status --watch` (and `run --watch`) exits 0 when the run finishes and 1 if it fails or stops (for example when a budget runs out), so CI can wait on it:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
trimrig run -b "Invoice Recon" --n 50 --watch && trimrig ship -o tasks.zip
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The ZIP has one folder per task (named by its code; `INV-014-r2` for a later revision) plus `manifest.json`: the Blueprint name and version, the run and batch, who shipped it and when, and for each task its revision, a SHA-256 per file and a content hash, its check results, and the difficulty verdict with each route's pass rate.
|
|
141
|
+
|
|
142
|
+
`ship` needs an Admin or Builder. It ships only what's ready and not yet shipped, as the run's next batch, and marks those tasks **Shipped** (one audit entry per batch). If two people ship at once, one gets the batch and the other is told there's nothing new. Shipped tasks never change: editing or re-proving one makes a new revision, which ships in a later batch.
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
trimrig ship --again latest # the last batch again, byte for byte as shipped
|
|
146
|
+
trimrig ship --again 1 # batch 1
|
|
147
|
+
trimrig ship --again all # every shipped batch in one ZIP
|
|
148
|
+
trimrig ship --no-mark # a copy of what's ready now; marks nothing
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`--again` and `--no-mark` mark nothing, and anyone who can see the run may use them. The web app's Ship page (Run → **Ship N ready** / **Ship N new**) does the same.
|
|
152
|
+
|
|
153
|
+
## Workspaces
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
trimrig workspace list
|
|
157
|
+
trimrig workspace use Finance # the default for every command
|
|
158
|
+
trimrig workspace use none # clear it
|
|
159
|
+
trimrig workstream list -w Biology # or per command
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Flags on every command
|
|
163
|
+
|
|
164
|
+
| Flag | What it does |
|
|
165
|
+
|---|---|
|
|
166
|
+
| `--workspace NAME`, `-w` | Work in one workspace (name or id) |
|
|
167
|
+
| `--json` | Print JSON, for scripts; errors become `{"error": "...", "code": n}` |
|
|
168
|
+
| `--yes`, `-y` | Skip confirmation prompts (needed for `delete` outside a terminal) |
|
|
169
|
+
|
|
170
|
+
They work before or after the command: `trimrig --json workstream list` and `trimrig workstream list --json` are the same.
|
|
171
|
+
|
|
172
|
+
## Exit codes
|
|
173
|
+
|
|
174
|
+
| Code | Meaning |
|
|
175
|
+
|---|---|
|
|
176
|
+
| 0 | OK |
|
|
177
|
+
| 1 | Error (for example a run is still active, or Trimrig couldn't be reached) |
|
|
178
|
+
| 2 | Bad input (a malformed request, a confirmation name that doesn't match, an ambiguous name) |
|
|
179
|
+
| 3 | Not found, or no permission (including not signed in, or a revoked token) |
|
|
180
|
+
|
|
181
|
+
## Configuration
|
|
182
|
+
|
|
183
|
+
| Variable | Default |
|
|
184
|
+
|---|---|
|
|
185
|
+
| `TRIMRIG_TOKEN` | the token saved by `trimrig login` |
|
|
186
|
+
| `TRIMRIG_API_URL` | `https://api.trimrig.com` |
|
|
187
|
+
| `TRIMRIG_CONFIG_DIR` | your user config folder (`%APPDATA%\trimrig`, `~/.config/trimrig`) |
|
|
188
|
+
|
|
189
|
+
The config folder holds only preferences (organization name, default workspace), no secrets.
|
|
190
|
+
|
|
191
|
+
## Development
|
|
192
|
+
|
|
193
|
+
```sh
|
|
194
|
+
pip install -e "cli[dev]" # plus the backend's requirements, for the local API
|
|
195
|
+
python -m pytest cli/tests -q
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The tests start Trimrig's real API locally (with in-memory stand-ins for the database) and drive the CLI against it over HTTP.
|
|
199
|
+
|
|
200
|
+
## Releasing
|
|
201
|
+
|
|
202
|
+
Publishing to PyPI is done by GitHub Actions (`.github/workflows/publish-cli.yml`) when a tag
|
|
203
|
+
like `cli-v0.1.1` is pushed. PyPI trusts that workflow directly, so no PyPI token is stored.
|
|
204
|
+
|
|
205
|
+
1. Raise the version in `pyproject.toml` and `src/trimrig_cli/__init__.py` (they must match).
|
|
206
|
+
2. Commit, then tag and push: `git tag cli-v0.1.1; git push origin cli-v0.1.1`.
|
|
207
|
+
3. The workflow checks the tag matches the version, runs the tests, builds and publishes.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/trimrig.egg-info/PKG-INFO
|
|
4
|
+
src/trimrig.egg-info/SOURCES.txt
|
|
5
|
+
src/trimrig.egg-info/dependency_links.txt
|
|
6
|
+
src/trimrig.egg-info/entry_points.txt
|
|
7
|
+
src/trimrig.egg-info/requires.txt
|
|
8
|
+
src/trimrig.egg-info/top_level.txt
|
|
9
|
+
src/trimrig_cli/__init__.py
|
|
10
|
+
src/trimrig_cli/client.py
|
|
11
|
+
src/trimrig_cli/config.py
|
|
12
|
+
src/trimrig_cli/main.py
|
|
13
|
+
tests/test_cli.py
|
|
14
|
+
tests/test_frame.py
|
|
15
|
+
tests/test_runs.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
trimrig_cli
|