@brunyee-studio/onus-cli 2.29.0 → 2.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  cliVersion,
4
4
  createApiClient,
5
5
  loginWithOAuth
6
- } from "./chunk-HJQGUY5T.js";
6
+ } from "./chunk-NQJIFUZV.js";
7
7
  import {
8
8
  clearConfig,
9
9
  getConfigDirectory,
@@ -2250,7 +2250,7 @@ function registerWatchCommand(program2) {
2250
2250
  const opts = this.opts();
2251
2251
  let teamId = opts.team;
2252
2252
  if (teamId) {
2253
- const { createApiClient: createApiClient2 } = await import("./client-QNEDGCP7.js");
2253
+ const { createApiClient: createApiClient2 } = await import("./client-CBLKSKYG.js");
2254
2254
  const client = createApiClient2({ token, apiUrl });
2255
2255
  teamId = await resolveTeamId(client, teamId);
2256
2256
  }
@@ -3585,8 +3585,11 @@ function createApiClient(options = {}) {
3585
3585
  const baseFetch = options.fetchApi || fetch;
3586
3586
  const response = await baseFetch(url, init);
3587
3587
  if (response.status === 401 && !url.toString().includes("/oauth/token")) {
3588
+ const hasExplicitToken = Boolean(
3589
+ options.token || process.env.ONUS_TOKEN || process.env.ONUS_API_KEY
3590
+ );
3588
3591
  const activeConfig = loadConfig();
3589
- if (activeConfig.refreshToken) {
3592
+ if (activeConfig.refreshToken && !hasExplicitToken) {
3590
3593
  try {
3591
3594
  const baseUrl = getOAuthBaseUrl(basePath);
3592
3595
  const refreshed = await refreshAccessToken({
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createApiClient
4
- } from "./chunk-HJQGUY5T.js";
4
+ } from "./chunk-NQJIFUZV.js";
5
5
  import "./chunk-HE2HTZ3Y.js";
6
6
  export {
7
7
  createApiClient
package/dist/index.js CHANGED
@@ -7450,8 +7450,11 @@ function createApiClient(options = {}) {
7450
7450
  const baseFetch = options.fetchApi || fetch;
7451
7451
  const response = await baseFetch(url, init);
7452
7452
  if (response.status === 401 && !url.toString().includes("/oauth/token")) {
7453
+ const hasExplicitToken = Boolean(
7454
+ options.token || process.env.ONUS_TOKEN || process.env.ONUS_API_KEY
7455
+ );
7453
7456
  const activeConfig = loadConfig();
7454
- if (activeConfig.refreshToken) {
7457
+ if (activeConfig.refreshToken && !hasExplicitToken) {
7455
7458
  try {
7456
7459
  const baseUrl = getOAuthBaseUrl(basePath);
7457
7460
  const refreshed = await refreshAccessToken({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brunyee-studio/onus-cli",
3
- "version": "2.29.0",
3
+ "version": "2.30.1",
4
4
  "description": "Official CLI and TypeScript SDK for Onus issue tracking platform",
5
5
  "keywords": [
6
6
  "agent",
@@ -16,8 +16,14 @@ onus auth status # check current auth state
16
16
  ONUS_TOKEN=<token> onus me --json # or auth via env var (ONUS_TOKEN / ONUS_API_KEY)
17
17
  onus --token <token> me --json # or per-invocation override
18
18
  onus --api-url <url> … # custom API base URL
19
+ onus auth logout # clear stored credentials
19
20
  ```
20
21
 
22
+ Explicit token overrides (`--token` or `ONUS_TOKEN` / `ONUS_API_KEY`) take
23
+ precedence over stored credentials and **fail hard with exit 3** when the API
24
+ rejects them — they are never silently rescued by the stored session.
25
+ Transparent refresh on 401 applies only to the stored config-file session.
26
+
21
27
  ## Golden rules
22
28
 
23
29
  - **Starting work on an issue: transition it to `in_progress` immediately.** As soon as you pick up an issue to implement it — before writing any code — run `onus issue update <ref> --status in_progress --json`. No update needed if `onus issue get <ref> --json` already shows the status is `in_progress` or `done`.
@@ -82,6 +88,38 @@ onus issue update ENG-42 --remove-label <labelId> --assignee <userId> --json
82
88
  onus issue delete ENG-42 --yes # skip confirmation
83
89
  ```
84
90
 
91
+ ## Templates
92
+
93
+ Per-team reusable issue templates; `--default` marks a team's default:
94
+
95
+ ```bash
96
+ onus template list --team ONUS --json
97
+ onus template create --team ONUS --name "Bug report" --priority high --default --json
98
+ onus template get <id> --json
99
+ onus template update <id> --title "New title" --add-label <labelId> --json # alias: template edit
100
+ onus template delete <id> --yes
101
+ ```
102
+
103
+ `onus issue create --template <nameOrId>` fills omitted fields from the template.
104
+
105
+ ## Bulk operations
106
+
107
+ `issue bulk-update` / `issue bulk-comment` apply to many issues with per-item partial success:
108
+
109
+ ```bash
110
+ onus issue bulk-update ENG-42 ENG-43 --status done --json
111
+ onus issue bulk-comment ENG-42 ENG-43 --body "Deployed in v2.31" --idempotency-key run-17 --json
112
+ onus issue bulk-update --file ./items.json --json # per-item payloads; see --help for the format
113
+ ```
114
+
115
+ ## Create projects
116
+
117
+ ```bash
118
+ onus project create --name "Mobile app" --team ONUS --lead <userId> \
119
+ --description-file ./brief.md --agent-context-file AGENTS.md --json
120
+ onus project attachment list <projectId> --json
121
+ ```
122
+
85
123
  ## Long text via file input
86
124
 
87
125
  Multi-line values (issue and project descriptions, comment bodies, project
@@ -125,14 +163,28 @@ onus analytics events --team ONUS --limit 25 --json
125
163
  onus analytics query --team ONUS --query '{"type":"trends","series":[{"event":"signup"}]}' --json
126
164
  ```
127
165
 
166
+ ## Watch (live events)
167
+
168
+ ```bash
169
+ onus watch --team ONUS --type issue.status_changed,error_group.regressed --json
170
+ ```
171
+
172
+ Streams live issue/comment/error events over SSE with automatic resume.
173
+
128
174
  ## Relations, attachments, subscriptions
129
175
 
130
176
  ```bash
131
177
  onus issue relation add ENG-42 --with ENG-43 --type blocks --json # types: blocks|duplicate|related|similar
132
178
  onus issue attachment upload ENG-42 --file ./notes.md --json
179
+ onus issue relation remove ENG-42 --relation <relationId> --json
180
+ onus issue attachment upload ENG-42 --file ./notes.md --json
133
181
  onus issue attachment list ENG-42 --json
182
+ onus issue attachment download ENG-42 --attachment <attachmentId> --output ./notes.md --json
183
+ onus issue attachment delete ENG-42 --attachment <attachmentId> --json
134
184
  onus issue subscribe ENG-42 --json
185
+ onus issue unsubscribe ENG-42 --json
135
186
  onus issue link-pr ENG-42 --repo owner/repo --pr 42 --json # link a GitHub pull request
187
+ onus issue unlink-pr ENG-42 --pr-link <linkId> --json # remove a linked pull request
136
188
  ```
137
189
 
138
190
  ## Errors and ingest keys (DSN)
@@ -140,30 +192,59 @@ onus issue link-pr ENG-42 --repo owner/repo --pr 42 --json # link a GitHub pu
140
192
  ```bash
141
193
  onus dsn list --team ONUS --json # masked ingest keys for a team
142
194
  onus dsn create --team ONUS --label ci # prints the full secret exactly once
195
+ onus dsn rotate <keyId> --grace-seconds 86400 --json # old secret stays valid during the grace window
196
+ onus dsn disable <keyId> --json # reversible
197
+ onus dsn enable <keyId> --json # re-enable a disabled key
198
+ onus dsn revoke <keyId> --json # terminal
143
199
  ```
144
200
 
145
201
  ## Pull requests and issues
146
202
 
147
203
  Linking a PR to an issue means **the issue is auto-closed when the PR merges** —
148
- there is no "related" link type. How links are created:
149
-
150
- - **Auto-linking is GitHub-style.** The integration scans the PR title, body,
151
- and branch name for `KEY-123` refs introduced by a closing keyword —
152
- `Fixes` / `Closes` / `Resolves` (case-insensitive, optional colon, comma/
153
- `and` lists). A plain prose mention of an issue ID does NOT link and never
154
- auto-closes, so avoid writing bare issue IDs in PR text: use the issue's
155
- name or its Onus URL instead.
156
- - **Manual linking is deliberate.** `onus issue link-pr` creates a bot link
157
- that survives body edits and closes on merge — use it when the PR fully
158
- resolves an issue but its text has no closing keyword.
159
- - **Only link PRs that actually fix/close the issue.** If a PR merely touches
160
- related code, discusses the issue, or implements part of it without completing
161
- it, do NOT link it (no keyword in the PR text, no `link-pr`). Use a relation
162
- (`onus issue relation add … --type related`) or a comment mention instead.
163
- - Never guess or assume: before linking, verify the PR's changes fully resolve
164
- the issue (e.g. you implemented the fix in that PR, or the PR description
165
- says "Fixes ONUS-42").
204
+ there is no "related" link type.
205
+
206
+ **Always link manually with `onus issue link-pr`. Never rely on the fix
207
+ keyword.** The integration also scans the PR title, body, and branch name for
208
+ `KEY-123` refs introduced by a closing keyword (`Fixes` / `Closes` /
209
+ `Resolves` — case-insensitive, optional colon, comma/`and` lists), but agents
210
+ must never depend on that scan and must never write a closing keyword before
211
+ an Onus issue ref in PR text or a branch name. Reference issues in PR text by
212
+ name or their Onus URL, never as bare issue IDs.
213
+
214
+ Required PR flow, in order:
215
+
216
+ 1. **Create the PR** (push the branch, open the PR with `gh`).
217
+ 2. **Determine whether the PR closes the issue.** It closes the issue only if
218
+ the PR fully resolves it — you implemented the whole fix in that PR. A PR
219
+ that merely touches related code, discusses the issue, or implements part
220
+ of it without completing it does not close it.
221
+ 3. **Link it.** If (and only if) step 2 says yes, run:
222
+
223
+ ```bash
224
+ onus issue link-pr <ref> --repo owner/repo --pr <number> --json
225
+ ```
226
+
227
+ The bot link survives PR-body edits and closes the issue on merge. If the
228
+ PR does not close the issue, leave it unlinked — use a relation
229
+ (`onus issue relation add … --type related`) or a comment mention instead.
230
+
231
+ - Never guess or assume: link only issues you know the PR fully resolves.
166
232
  - Link at most once per PR per issue; don't spam links across partially-related
167
233
  issues.
168
234
 
235
+ ## Skill management
236
+
237
+ The CLI bundles this skill and can install/update it for detected AI agents:
238
+
239
+ ```bash
240
+ onus skill install --agent claude-code codex # or --global / --copy; see --help
241
+ onus skill update # refresh installed copies to the bundled version
242
+ onus skill remove --global # alias: skill rm
243
+ ```
244
+
245
+ ## Command aliases
246
+
247
+ `issue get` = `issue view`, `issue update` = `issue edit`, `template update` = `template edit`,
248
+ `skill remove` = `skill rm`.
249
+
169
250
  Run any command with `--help` for its exact flags — e.g. `onus issue relation add --help`.