@kici-dev/compiler 0.6.0 → 0.7.0

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 (45) hide show
  1. package/dist/cli.js +10 -2
  2. package/dist/commands/compile.js +5 -1
  3. package/dist/commands/doctor.js +8 -2
  4. package/dist/commands/feedback.d.ts +53 -0
  5. package/dist/commands/feedback.js +142 -0
  6. package/dist/commands/index.d.ts +2 -0
  7. package/dist/commands/index.js +2 -1
  8. package/dist/commands/init.d.ts +9 -0
  9. package/dist/commands/init.js +77 -12
  10. package/dist/commands/preview.js +1 -1
  11. package/dist/commands/report/identity.d.ts +11 -0
  12. package/dist/commands/report/identity.js +7 -2
  13. package/dist/commands/run-routed.js +1 -0
  14. package/dist/commands/types.d.ts +6 -1
  15. package/dist/commands/types.js +2 -1
  16. package/dist/execution/executor.js +7 -1
  17. package/dist/llm-context/llms-architecture.txt +72 -86
  18. package/dist/llm-context/llms-cli-remote.txt +2380 -0
  19. package/dist/llm-context/llms-cli.txt +348 -2615
  20. package/dist/llm-context/llms-features-execution.txt +80 -23
  21. package/dist/llm-context/llms-features.txt +137 -6
  22. package/dist/llm-context/llms-full.txt +2582 -2025
  23. package/dist/llm-context/llms-getting-started.txt +152 -5
  24. package/dist/llm-context/llms-patterns.txt +81 -5
  25. package/dist/llm-context/llms-providers.txt +6 -2
  26. package/dist/llm-context/llms-sdk-runtime.txt +22 -18
  27. package/dist/llm-context/llms-sdk.txt +47 -7
  28. package/dist/llm-context/llms.txt +20 -13
  29. package/dist/local-plane/orchestrator-process.d.ts +0 -8
  30. package/dist/local-plane/orchestrator-process.js +3 -14
  31. package/dist/local-plane/plane-manager.js +2 -2
  32. package/dist/lockfile/generator.js +25 -9
  33. package/dist/lockfile/hasher.d.ts +5 -13
  34. package/dist/lockfile/hasher.js +1 -15
  35. package/dist/lockfile/workspace-siblings.d.ts +46 -0
  36. package/dist/lockfile/workspace-siblings.js +197 -0
  37. package/dist/templates/package-json.js +1 -1
  38. package/dist/test-runner/job-executor.js +1 -1
  39. package/dist/test-runner/rule-evaluator.js +1 -1
  40. package/dist/types.d.ts +6 -1
  41. package/package.json +7 -9
  42. package/sbom.spdx.json +123 -123
  43. package/dist/postinstall.d.ts +0 -9
  44. package/dist/postinstall.js +0 -62
  45. package/hack/postinstall.mjs +0 -105
@@ -1,582 +1,6 @@
1
- # KiCI CLI and authoring
1
+ # KiCI CLI: authoring on your own machine
2
2
 
3
- This bundle covers: Running the CLI: compile, test, run local/remote, auth, hooks, lock-file drift.
4
-
5
- ## Drive KiCI from your coding agent
6
-
7
- Source: https://docs.kici.dev/user/ai-agents/
8
-
9
- KiCI ships a hosted **MCP server** so a coding agent (Claude Code, or any MCP
10
- client) can drive your CI directly: trigger runs, read a structured result,
11
- fetch the failing step's logs, cancel, and re-run — all under an agent identity
12
- you control, org-scoped, and audited. There are no per-tool tokens to configure:
13
- point the agent at one URL with one credential and it's done.
14
-
15
- The MCP exposes only what you can already do yourself through the `kici` CLI and
16
- the dashboard. It is not a new privileged surface — every tool maps to an
17
- existing user-facing operation and is gated by the same permissions your role
18
- grants.
19
-
20
- ## 1. Mint an agent credential
21
-
22
- The MCP accepts an **agent-kind credential** — and only an agent-kind one. It
23
- can be either of two kinds:
24
-
25
- - An **agent personal access token (PAT)** that you own — it acts as you, with
26
- your provenance. The token is `kici_pat_…`.
27
- - An **agent org API key** that belongs to your organization — a
28
- provenance-carrying service account, independent of any one person. The key is
29
- `kici_sk_…`.
30
-
31
- Both drive the MCP identically. A non-agent token of either kind (a plain user
32
- PAT, a plain org API key) is refused at the door.
33
-
34
- **Option A — an agent PAT.** Mint one with the `kici` CLI (log in first with
35
- `kici login`):
36
-
37
- ```bash
38
- kici pat create --agent --name "claude-code"
39
- ```
40
-
41
- The `--name` value is the **agent label**. It is recorded on every action the
42
- agent takes, so your audit log shows exactly which agent did what (and on whose
43
- behalf). The token is printed once — save it now; it cannot be retrieved later.
44
-
45
- **Option B — an agent org API key.** Create one from the dashboard's
46
- **Settings → API keys** tab: set the key's kind to **Agent** and give it an
47
- agent name (the agent label). The same key can also be minted with
48
- `kici-platform-admin user api-key create --org <id> --agent --agent-label <label>`.
49
- Reach for an org agent key when the agent should act as a shared service account
50
- rather than as a single user — for example, a long-lived CI bot that outlives any
51
- individual's membership.
52
-
53
- Whichever you pick, the credential carries provenance, not extra authority. Its
54
- effective permissions are the matrix it was minted with, and that matrix can
55
- never exceed the permissions of the person who created it — so you can scope an
56
- agent credential **below** your own access (for example, read-only) and the agent
57
- is held to that smaller set. Powerful operator capabilities (secret rotation,
58
- agent and peer management, draining) are intentionally **not** exposed here. See
59
- [the agent safety model](https://docs.kici.dev/user/ai-agents/#6-the-agent-safety-model) for how scoping and
60
- confinement work.
61
-
62
- ## 2. Point your coding agent at the MCP server
63
-
64
- KiCI's hosted MCP server lives at one fixed URL:
65
-
66
- ```
67
- https://api.kici.dev/api/v1/mcp
68
- ```
69
-
70
- Configure your MCP client with that URL and your agent credential (the agent PAT
71
- or the agent org key) as a Bearer credential. For Claude Code:
72
-
73
- ```bash
74
- claude mcp add --transport http kici https://api.kici.dev/api/v1/mcp \
75
- --header "Authorization: Bearer <your-agent-credential>"
76
- ```
77
-
78
- That's the entire setup. The agent can now call the tools below.
79
-
80
- ## 3. What the agent can do
81
-
82
- **Read**
83
-
84
- - `list_runs` — recent runs in your organization.
85
- - `get_run` — the structured, provenance-tagged result of a run: the typed job
86
- graph, per-step statuses and exit codes, durations, and a derived failure
87
- category.
88
- - `get_step_logs` — the log lines for a specific step.
89
- - `list_workflows` — your registered workflows, optionally filtered by
90
- `triggerType`, `repo`, or `stale` (only those not triggered within a duration
91
- like `30d`).
92
- - `list_orgs` — the organizations you belong to. Use it to discover the `orgId`
93
- to pass to the other tools when you're a member of more than one.
94
- - `list_secrets` — the secret scopes in your organization and the **key names**
95
- each holds. Secret values are never returned — only the names.
96
- - `list_orchestrators` — the connected orchestrator clusters your runs execute
97
- on (cluster name, routing keys, version, scaler backends, health).
98
- - `get_diagnostics` — your organization's execution metrics over the last 24
99
- hours (run count, success rate, average duration, queued and running jobs)
100
- plus per-orchestrator connection health.
101
-
102
- **Drive**
103
-
104
- - `trigger_run` — run a registered workflow ("run now").
105
- - `rerun_run` — re-run a completed run.
106
- - `cancel_run` — cancel an in-progress run.
107
- - `approve_run` — approve a held approval gate for a run (name the run, plus
108
- `job`/`step` to disambiguate when it has multiple holds). Requires
109
- `runs:write` **and** the permission matching the hold's type — `ci_trust:write`
110
- for a security hold, `contexts:admin` for a wait-timer hold, `contexts:write`
111
- otherwise. That is the same rule the dashboard and the `kici` CLI answer to,
112
- so an agent cannot release a hold a person with the same grants could not.
113
- Grant agent credentials accordingly.
114
- - `reject_run` — reject a held approval gate; a `reason` is required. Gated
115
- identically to `approve_run`.
116
- - `cancel_runs_by_branch` — cancel all in-progress runs on a branch (bounded —
117
- up to 100 per call; a `truncated` flag tells the agent to re-invoke).
118
-
119
- The tools cover the same developer operations you can drive yourself with the
120
- `kici` CLI. Operations that are purely local to your machine (scaffolding,
121
- compiling, running a workflow locally) or that mint credentials are
122
- intentionally not exposed — the agent works against your deployed CI, not your
123
- filesystem.
124
-
125
- If you belong to a single organization, the org is resolved automatically. If
126
- you belong to several, pass an `orgId` argument to any tool (use `list_orgs` to
127
- find it).
128
-
129
- ### Limits and pagination
130
-
131
- The MCP server applies a few bounds so an agent loop can't overwhelm the shared
132
- infrastructure. They are agent-visible — your agent gets a clear tool error and
133
- should back off or page, never a silent truncation:
134
-
135
- - **Per-token request limits.** Each agent token has its own ceiling, refreshed
136
- every minute: **120 reads/minute** (listing and fetching runs, step logs, and
137
- workflows) and **20 run actions/minute** (cancel, re-run, trigger, approve,
138
- reject, cancel-by-branch). The two
139
- budgets are independent. An over-limit call returns a tool error telling the
140
- agent which kind of operation was throttled and how many seconds to wait
141
- before retrying.
142
- - **Paginated step logs.** `get_step_logs` returns log lines in pages. Pass a
143
- `limit` to bound a page (capped server-side) and follow the returned
144
- `nextCursor` (as `cursor` on the next call) to read more. A large step log is
145
- paged, never silently cut off — when `nextCursor` is null you've reached the
146
- end.
147
- - **Bounded run results.** `get_run` returns the structured run result, which is
148
- naturally bounded by workflow size. For a pathologically large run it returns a
149
- tool error directing the agent to inspect specific steps with `get_step_logs`
150
- instead.
151
-
152
- ## 4. Why the structured result is agent-safe
153
-
154
- Every tool returns a machine-first shape designed for an agent to reason over
155
- without being misled by repository content. Each field that comes from your repo,
156
- a contributor, or a process's output — workflow and job names, refs, error
157
- messages, log lines, job outputs — is delivered **fenced** as untrusted data:
158
- wrapped in a per-response, randomly-named delimiter (`⟦u:<nonce>⟧…⟦/u:<nonce>⟧`),
159
- with the result prefixed by a notice that fenced text is data, never instructions.
160
- KiCI-generated values (ids, statuses, exit codes, durations, the derived failure
161
- category) are left plain. So an agent can keep user-controlled content out of its
162
- instruction channel by treating anything inside a fence as data only. See
163
- [Untrusted content and prompt injection](https://docs.kici.dev/user/ai-agents/#7-untrusted-content-and-prompt-injection)
164
- for the full model.
165
-
166
- Secret values are never returned — only the names of the secret keys a step
167
- accessed.
168
-
169
- ## 5. The audit guarantee
170
-
171
- Because the MCP accepts only an agent-kind credential, **every action that flows
172
- through it is agent-attributed by construction** — there is no path that produces
173
- an untagged, human-looking action. Each read and each drive operation is recorded
174
- in your orchestrator's access log under the acting identity plus the agent label,
175
- so you always have a complete trail of what your agent did.
176
-
177
- Inspect that trail with `kici-admin access-log list --json` (or
178
- `kici-admin access-log show <id>` for one entry). The acting identity depends on
179
- which credential you used:
180
-
181
- - An **agent PAT** keeps `actor_type` as `user` and `actor_id` as your own
182
- identity — the agent provenance rides in the actor metadata as `agentLabel`
183
- (the `--name` you minted the PAT with) and `agentPatId`.
184
- - An **agent org key** keeps `actor_type` as `api_key` and `actor_id` as the key
185
- — the same `agentLabel` provenance rides in its actor metadata.
186
-
187
- Either way the label is stored in a dedicated `agent_label` column on every such
188
- row, so you can filter the access log down to just agent activity:
189
-
190
- ```bash
191
- # Every action a specific agent took, by its label:
192
- kici-admin access-log list --agent-label "claude-code"
193
-
194
- # Every agent-attributed action, across all agents:
195
- kici-admin access-log list --agent-only
196
- ```
197
-
198
- In the dashboard, agent-driven activity is visually distinguished: the
199
- [Activity](https://docs.kici.dev/user/dashboard/activity-and-dlq/#activity) log renders an **agent badge**
200
- on every agent-attributed row, and a run's **Triggered by** shows the same badge
201
- when an agent triggered or cancelled it — so an agent's footprint is obvious at a
202
- glance, not buried in metadata.
203
-
204
- ## 6. The agent safety model
205
-
206
- KiCI treats a coding agent as a **least-privilege principal with its own token**,
207
- not as an unscoped extension of you. Three properties make the agent
208
- "confined and audited by construction":
209
-
210
- **Least-privilege, capped at the creator.** An agent token is scoped when you
211
- mint it. Leave the scope open and it inherits your role; narrow it and the agent
212
- is held to that smaller set — its effective permissions are always the
213
- **minimum** of your role and the token's scope. A token can never grant more than
214
- you hold, so an agent cannot escalate beyond its creator.
215
-
216
- **Repository scope comes along too.** If your role is restricted to a set of
217
- repositories, an agent token you mint is restricted to the same set. Runs
218
- outside it are simply not there: they are filtered out of `list_runs`,
219
- `cancel_runs_by_branch` skips them, and naming one directly answers "not found"
220
- — the same answer a run id that does not exist gets, so an agent cannot use the
221
- tools to discover which repositories it is missing. Your organization's audit
222
- log records the real reason. One thing to know when you choose which credential
223
- to give an agent: this inheritance applies to a **personal** agent token. An
224
- **organization** agent API key has no minting user's role to inherit from, so it
225
- reaches every repository in the organization within its permission level — reach
226
- for a personal agent token when repository scoping is what you want.
227
-
228
- **Fail-closed denial, on every surface the token is used.** The scope is enforced
229
- wherever the token acts — the MCP tools the agent drives **and** any direct API
230
- call made with the raw token. When the agent attempts something outside its
231
- scope (driving a run with a read-only token, reading members it wasn't granted),
232
- the action is **refused fail-closed**: it does not run, nothing is changed, and a
233
- clear "insufficient permission" error comes back. There is no fallback path that
234
- quietly lets a denied action through.
235
-
236
- **Every decision is audited — allowed and denied alike.** Allowed actions are
237
- recorded in your access log under your identity plus the agent label, exactly as
238
- described in [the audit guarantee](https://docs.kici.dev/user/ai-agents/#5-the-audit-guarantee). **Denials are audited
239
- too:** each refused action lands a row in your organization's audit log carrying
240
- the agent label and the permission that was required, so a confined agent's
241
- attempts are as visible as its successes. You can see both what your agent did
242
- and what it was stopped from doing.
243
-
244
- **Execution stays confined.** Beyond authorization, the workloads an agent
245
- triggers run under the same execution guardrails as any other run — label-based
246
- routing decides where a job runs, and privileged (root) execution is gated and
247
- verified, refused fail-closed when the guarantee can't be met.
248
-
249
- Together these mean you can hand an agent a deliberately narrow token, point it
250
- at KiCI, and trust that it can do exactly what you granted — no more — with a
251
- complete, tamper-evident trail of every allow and every deny.
252
-
253
- ## 7. Untrusted content and prompt injection
254
-
255
- A run carries content KiCI does not vouch for — log lines, workflow and repository
256
- names, error text, contributor names. An agent reading a run must treat that content
257
- as **data**, never as instructions, or a crafted log line ("ignore previous
258
- instructions and …") could hijack the agent.
259
-
260
- KiCI defends this structurally:
261
-
262
- - **Provenance tagging.** Every user- or process-controlled value is marked untrusted
263
- at the API boundary; KiCI's own values (run ids, statuses, exit codes, commit hashes)
264
- are trusted.
265
- - **Fencing at the agent boundary.** When the MCP server returns a result, every
266
- untrusted value is wrapped in a per-response, randomly-named fence
267
- (`⟦u:<nonce>⟧…⟦/u:<nonce>⟧`) and the result is prefixed with a notice that fenced
268
- text is data, never instructions. The fence name is random per response, so injected
269
- content cannot forge a closing fence to break out.
270
- - **No mutation.** KiCI never rewrites your log content — it fences and labels it. The
271
- agent sees the true bytes inside the fence.
272
-
273
- ### Safe integration pattern
274
-
275
- An agent (or harness) consuming KiCI reads should treat anything inside a fence as
276
- opaque data: quote it, summarize it, search it — but never execute it, follow it, or
277
- let it redirect a tool call. Any action taken off the back of a read (re-run, cancel,
278
- trigger) should be a deliberate decision from the trusted skeleton (statuses, exit
279
- codes, the failure category), not from fenced content.
280
-
281
- ### Sandboxing actions
282
-
283
- Actions an agent drives through KiCI run under the agent's own least-privilege identity
284
- and are audited; combine the fencing contract with that confinement so that even if a
285
- log line tries to provoke an action, the action is bounded by the agent token's scope.
286
-
287
- ---
288
-
289
- ## CLI authentication
290
-
291
- Source: https://docs.kici.dev/user/cli-auth/
292
-
293
- The KiCI CLI supports three authentication methods: browser-based OAuth (default), device authorization flow (for headless environments), and API key paste (for CI/CD pipelines).
294
-
295
- ## Authentication methods
296
-
297
- ### Browser OAuth (default)
298
-
299
- The default `kici login` flow:
300
-
301
- 1. Opens your default browser to the KiCI identity provider
302
- 2. You authenticate in the browser
303
- 3. The CLI receives a token via localhost callback
304
- 4. A personal access token (PAT) is created and stored locally
305
-
306
- ```bash
307
- kici login
308
- ```
309
-
310
- The CLI auto-detects headless environments (SSH sessions, CI runners, containers) and switches to device flow automatically. On WSL, `kici login` opens your Windows browser when Windows interop is reachable; if it is not (interop disabled, or the Windows drive not mounted), the CLI falls back to the device flow rather than waiting for a browser that cannot open.
311
-
312
- ### Device flow (headless)
313
-
314
- For environments without a browser (SSH, remote servers):
315
-
316
- ```bash
317
- kici login --device
318
- ```
319
-
320
- This displays a URL and a code. Open the URL on any device, enter the code, and authenticate. The CLI polls for completion.
321
-
322
- ### API key paste
323
-
324
- For CI/CD pipelines and automated environments, paste an API key directly:
325
-
326
- ```bash
327
- kici login --token kici_sk_abc123...
328
- ```
329
-
330
- The API key (starts with `kici_sk_`) is passed directly as the flag value and stored in your local config file.
331
-
332
- ## kici logout
333
-
334
- Revoke your PAT and clear local authentication:
335
-
336
- ```bash
337
- kici logout
338
- ```
339
-
340
- This:
341
-
342
- 1. Revokes the PAT on the server (preventing further use)
343
- 2. Detaches the local dev plane if it is attached, so a logged-out user is not left with a hybrid plane holding an orphaned orchestrator key
344
- 3. Clears the auth fields from the local config file — the PAT, its id and expiry, your email, and the active organization
345
- 4. Preserves the connection settings (per-org default clusters, Platform endpoint, orchestrator endpoint, OIDC issuer, routing key)
346
-
347
- Server revocation is best-effort: if the network call fails, the local config is still cleared.
348
-
349
- ## Organization management
350
-
351
- ### List organizations
352
-
353
- ```bash
354
- kici org list
355
- ```
356
-
357
- Shows all organizations you belong to, with your role in each. The active organization is marked with an asterisk.
358
-
359
- ### Switch active organization
360
-
361
- ```bash
362
- kici org use <name-or-id>
363
- ```
364
-
365
- Name matching is case-insensitive. You can also use the organization ID directly.
366
-
367
- The active organization is both the scope for org-scoped commands (`kici runs list`, `kici diagnostics`, `kici secrets list`, …) **and** the default target for `kici run remote`. After `kici login` and `kici org use <org>`, `kici run remote` dispatches to that org through the Platform — that is the complete path to a remote run. Override the target for a single run with `kici run remote --org <id>`.
368
-
369
- If an organization has more than one connected orchestrator cluster, set its default cluster once with `kici orchestrators use <name>` (list them with `kici orchestrators list`). `kici run remote` then targets that cluster unless you pass `--orchestrator <name>`. With a single connected orchestrator the cluster is selected automatically.
370
-
371
- ### Show current organization
372
-
373
- ```bash
374
- kici org current
375
- ```
376
-
377
- Displays the currently active organization name and ID.
378
-
379
- ## Auth status
380
-
381
- `kici org current` shows your current login state and active organization:
382
-
383
- ```bash
384
- kici org current
385
- ```
386
-
387
- It reports whether you are logged in and which organization is active. PAT
388
- expiry and the full list of your tokens are managed from the dashboard (see
389
- "Dashboard management" below).
390
-
391
- ## Personal access tokens
392
-
393
- Personal access tokens (PATs) are created automatically when you log in via OAuth. You can also create and manage PATs through the dashboard.
394
-
395
- ### How PATs work
396
-
397
- - **User-scoped**: PATs work across all organizations you belong to
398
- - **120-day default expiry**: Configurable when creating from the dashboard
399
- - **Named per machine**: Each login creates a PAT named after the machine hostname
400
- - **Permission inheritance**: PATs inherit your effective role permissions in each org
401
-
402
- ### PATs vs API keys
403
-
404
- | | Personal access tokens | API keys |
405
- | ---------- | ---------------------- | --------------- |
406
- | Scope | User (cross-org) | Organization |
407
- | Prefix | `kici_pat_` | `kici_sk_` |
408
- | Created by | CLI login or dashboard | Dashboard |
409
- | Expiry | 120 days (default) | No expiry |
410
- | Use case | Developer CLI access | CI/CD pipelines |
411
-
412
- ### Dashboard management
413
-
414
- Create, view, and revoke PATs from the dashboard:
415
-
416
- 1. Click your avatar in the sidebar
417
- 2. Select **Account settings**
418
- 3. Navigate to the **Personal access tokens** tab
419
-
420
- From here you can:
421
-
422
- - Create PATs with custom names and expiry periods
423
- - View active PATs with their prefixes and expiry dates
424
- - Revoke PATs that are no longer needed
425
-
426
- ## Reaching the Platform API directly
427
-
428
- The Platform exposes a versioned REST API under `/api/v1/*`. The same endpoints back the dashboard SPA, the `kici` CLI, and any third-party automation. There is no separate "public" surface — the dashboard's API is the API.
429
-
430
- ### Base URL
431
-
432
- | Deployment | Base URL pattern |
433
- | ----------- | ------------------------------------------------------------------------- |
434
- | KiCI Cloud | `https://<your-platform-host>/api/v1/` |
435
- | Self-hosted | `https://<orchestrator-host>/<deployment-slug>/api/v1/` (slug is optional |
436
- | | — `KICI_BASE_PATH` may add a prefix when the Platform is reverse-proxied) |
437
-
438
- `/api/v1/*` requires authentication (see below). `/health`, `/metrics`, and `/ws` (WebSocket) sit outside that prefix and have their own access posture (`/metrics` is meant for Prometheus scrape, not public exposure).
439
-
440
- ### Authentication
441
-
442
- Every request to `/api/v1/*` carries an `Authorization: Bearer <token>` header. The Platform routes on the prefix:
443
-
444
- | Prefix | Token type | Created via | Scope |
445
- | ----------- | ----------------------------- | --------------------------------------- | ---------------- |
446
- | `kici_pat_` | Personal access token | `kici login` or dashboard | User (cross-org) |
447
- | `kici_sk_` | User API key | Dashboard → Settings → API keys | Org |
448
- | `kici_sa_` | Service account key | Dashboard → Settings → Service accounts | Org |
449
- | (other) | OIDC JWT or opaque OIDC token | OIDC login (browser SPA) | User (cross-org) |
450
-
451
- JWT and opaque OIDC tokens are validated against the configured OIDC issuer (JWKS for JWTs, the issuer's UserInfo endpoint for opaque ones). All `kici_*` tokens are validated by SHA-256 hash lookup against the Platform DB. See [RBAC: authentication methods](https://docs.kici.dev/architecture/security/rbac/#authentication-methods) for the full model.
452
-
453
- > **Note:** `kici_ok_` keys are **not** for the HTTP API — they authenticate orchestrator-to-Platform WebSocket connections only. Use `kici_sk_` (or `kici_pat_`) for HTTP calls.
454
-
455
- ### Permissions
456
-
457
- Tokens authenticate; RBAC authorizes. Every org-scoped route runs `orgContextMiddleware` (verifies you are a member of the target org) followed by `requirePermission(resource, level)`. The 18 resources and 5 levels are documented in [RBAC](https://docs.kici.dev/architecture/security/rbac/#permission-model). User API keys carry their own permission matrix bounded above by the creator's effective permissions; PATs inherit the user's role permissions (or are capped further by their `scopes` field).
458
-
459
- ### Configurable surfaces
460
-
461
- The dashboard is a browser SPA on top of the same `/api/v1/*` surface, so anything you can configure in the dashboard you can configure over HTTP. The mounted route groups include:
462
-
463
- - **Auth & identity:** `/cli/exchange-token`, `/pats`, `/user`, `/identity-links`, `/github-oauth`, `/invites`, `/invites/pending`, `/invites/:inviteId/{accept,decline}`
464
- - **Org & membership:** `/orgs`, `/orgs/:customerId`, `/orgs/:customerId/{members,roles,api-keys,orchestrator-keys,service-accounts,billing,trust-policies}`
465
- - **Workflows & runs:** `/orgs/:customerId/{runs,registrations,workflows,held-runs,contexts,secrets,global-workflows}`
466
- - **Webhooks & event log:** `/orgs/:customerId/{sources,webhook-endpoints,event-log}`
467
- - **Diagnostics & activity:** `/orgs/:customerId/{diagnostics,activity,access-log}`
468
-
469
- The full route tree is the source of truth — every method, request schema, and response schema is enumerated server-side. There is currently no auto-generated OpenAPI spec; the typed `DashboardApiType` export is the canonical contract for TypeScript clients.
470
-
471
- ### Calling the API
472
-
473
- Two short examples — adapt the base URL and token to your deployment.
474
-
475
- **curl (PAT or API key):**
476
-
477
- ```bash
478
- TOKEN="$(grep -E '^pat=' ~/.kici/config | cut -d= -f2)" # or paste a kici_sk_…
479
- ORG="<your-org-id>"
480
- curl -sS \
481
- -H "Authorization: Bearer $TOKEN" \
482
- "https://<orchestrator-host>/<deployment-slug>/api/v1/orgs/$ORG/runs?limit=5" | jq
483
- ```
484
-
485
- **Browser console (after dashboard login):**
486
-
487
- ```js
488
- const ns = Object.keys(localStorage).find((k) => k.startsWith('oidc.user:'));
489
- const { access_token } = JSON.parse(localStorage.getItem(ns));
490
- const res = await fetch('/<deployment-slug>/api/v1/orgs/<your-org-id>/runs?limit=5', {
491
- headers: { Authorization: `Bearer ${access_token}` },
492
- });
493
- console.log(await res.json());
494
- ```
495
-
496
- ### Rate limits and body size
497
-
498
- There is currently no per-token rate limit on `/api/v1/*`. A single global body-size cap applies to webhook ingress and dashboard API requests alike.
499
-
500
- ### Audit trail
501
-
502
- Every `/api/v1/*` mutation that touches tenant-plane data is recorded in the upstream tenant-plane audit log, stamped with the actor (user, API key, service account, or upstream operator on a break-glass support read). Reads on customer data go through the orchestrator over the WebSocket proxy and land in the orchestrator's `access_log` table. See [Audit log](https://docs.kici.dev/operator/security/audit-log/) for the orchestrator schema and the dashboard's "Activity" page for the federated view.
503
-
504
- ## Token storage
505
-
506
- The CLI stores authentication data in `~/.kici/config` with `0600` permissions (owner read/write only). The config file contains:
507
-
508
- - PAT token, its server-side id, and its expiry date
509
- - The email address from your OIDC token
510
- - Active organization ID
511
- - Per-org default orchestrator clusters
512
- - Platform endpoint URL, orchestrator endpoint URL, and the OIDC issuer the PAT was minted against
513
- - Routing key for webhook source identification
514
- - API key, when you logged in with `--token`
515
-
516
- ## Troubleshooting
517
-
518
- ### Browser doesn't open
519
-
520
- If `kici login` can't open a browser:
521
-
522
- - Copy the authorization URL the CLI prints under `If it does not open, visit:` and open it in any browser — the CLI keeps waiting for the callback for up to 5 minutes (see [Browser callback never arrives](https://docs.kici.dev/user/cli-auth/#browser-callback-never-arrives) if it never lands)
523
- - Use `kici login --device` for the device flow
524
- - Or set the `KICI_BROWSER_CMD` environment variable to your browser command (e.g., `KICI_BROWSER_CMD='firefox {url}'`)
525
-
526
- ### Browser callback never arrives
527
-
528
- If the browser opens and you complete sign-in, but `kici login` keeps waiting:
529
-
530
- - The CLI is waiting on a callback to `127.0.0.1`. A corporate firewall, an unusual loopback policy, or a WSL `portproxy` rule can block it.
531
- - After 90 seconds of waiting the CLI prints a reminder that `kici login --device` needs no callback. It is safe to ignore if you are still signing in. After 5 minutes it gives up with `Authentication timed out after 5 minutes`.
532
- - Retry with `kici login --device` — the device flow needs no local callback.
533
- - If you must keep the browser flow, set `KICI_CALLBACK_PORT` to a fixed port your firewall allows.
534
-
535
- ### Callback port already in use
536
-
537
- If `KICI_CALLBACK_PORT` names a port something else is already listening on, `kici login` stops immediately and names the port instead of hanging or crashing.
538
-
539
- It deliberately does **not** pick another port for you. A fixed port is something you set on purpose — usually because a firewall rule or a WSL `portproxy` entry allows exactly that one — so binding somewhere else would hand the browser a callback URL nothing can reach, and you would wait out the full 5-minute timeout instead of seeing a clear error.
540
-
541
- Two ways forward:
542
-
543
- - Free the port (stop whatever holds it) or point `KICI_CALLBACK_PORT` at a different free port your firewall allows.
544
- - Run `kici login --device` — the device flow needs no local callback at all.
545
-
546
- A port below 1024 fails the same way, with a permissions message rather than an "in use" one: those ports need elevated privileges. Pick a port above 1024. A value that is not a port number at all — non-numeric, negative, or above 65535 — is rejected before the login starts, naming the value you set.
547
-
548
- ### Device code expired
549
-
550
- This is the device flow's own expiry, not the browser flow's callback timeout above.
551
-
552
- The device code is issued by the identity provider, which also sets how long it lives. The CLI prints the lifetime with the code (`Code expires in N minutes`) and polls until you approve or the code expires. On expiry it stops with `Device code expired`. If that happens:
553
-
554
- - Run `kici login --device` again to get a new code
555
- - Ensure you're using the correct URL displayed by the CLI
556
-
557
- ### Expired PAT
558
-
559
- If you see "Personal access token has expired":
560
-
561
- - Run `kici login` to create a new PAT
562
- - The old expired PAT is automatically superseded
563
-
564
- ### "Not a member" errors
565
-
566
- If authenticated commands return 403:
567
-
568
- - Check your active org: `kici org current`
569
- - List available orgs: `kici org list`
570
- - Switch to the correct org: `kici org use <name>`
571
-
572
- ### Connection refused
573
-
574
- If the CLI can't reach the server:
575
-
576
- - Verify the endpoint: check `~/.kici/config` for the correct URL
577
- - Test connectivity: `curl <your-platform-url>/health`
578
-
579
- ---
3
+ This bundle covers: Running the CLI locally: compile, test, run local, hooks, lock-file drift, common failures.
580
4
 
581
5
  ## CLI reference
582
6
 
@@ -610,7 +34,7 @@ The full command reference is split by area:
610
34
  - [Authoring & local dev](https://docs.kici.dev/user/cli/authoring-and-local/) — `compile`, `preview`, `local`, `fixture`, `types`, `workflows`, `hook`, `docs`
611
35
  - [Runs & approvals](https://docs.kici.dev/user/cli/runs-and-approvals/) — `run`, `runs`, `reject`, `approve`
612
36
  - [Account & org](https://docs.kici.dev/user/cli/account-and-org/) — `login`, `logout`, `init`, `org`, `pat`, `secrets`, `admin`, `orchestrators`, `endpoints`
613
- - [Notifications & diagnostics](https://docs.kici.dev/user/cli/notifications-and-diagnostics/) — `notifications`, `verify-attestation`, `diagnostics`, `doctor`, `report`
37
+ - [Notifications & diagnostics](https://docs.kici.dev/user/cli/notifications-and-diagnostics/) — `notifications`, `verify-attestation`, `diagnostics`, `doctor`, `report`, `feedback`
614
38
 
615
39
  Each area page carries a `## Guide` section (worked examples and command-by-command narrative) and a `## Reference` section (the always-current generated signature list for that area's commands).
616
40
 
@@ -808,7 +232,7 @@ triggered, or the repo had no lock file at that commit.
808
232
  source-registration mismatch).
809
233
  2. **Did anything match?** Run `kici preview push --branch <your-branch>`
810
234
  against your workflow. If it reports no matching workflow, your triggers don't
811
- cover that event/branch — the push was delivered and simply matched nothing.
235
+ cover that event/branch — the push was delivered and matched nothing.
812
236
  3. **Was there a lock file?** A repository with **no** `kici.lock.json` at the
813
237
  pushed commit produces no run and is not an error. Confirm the lock file is
814
238
  committed and current (see [Lock-file drift](https://docs.kici.dev/user/common-failures/#lock-file-drift)).
@@ -1127,7 +551,7 @@ KiCI uses a **two-artifact model**: TypeScript workflows are the source of truth
1127
551
  ## Why the lock file matters
1128
552
 
1129
553
  - **Orchestrator** fetches the lock file at the commit SHA and uses it to evaluate triggers and to look up the cached `.kici/` source tarball + `node_modules` tarball. It never runs your TypeScript.
1130
- - **Agents** download the cached source tarball (or, on cold cache, the build agent clones + packs it), register the shared TypeScript loader hook, and dynamic-`import()` the workflow `.ts` directly. The lock file's per-workflow `contentHash` identifies the expected raw-source bytes and is verified against the extracted source before any step runs.
554
+ - **Agents** download the cached source tarball (or, on cold cache, the build agent clones + packs it), register the shared TypeScript loader hook, and dynamic-`import()` the workflow `.ts` directly. The lock file's per-workflow `contentHash` identifies the expected contents of the whole `.kici/` directory and is verified against the extracted source before any step runs. The tarball's own bytes are verified against the digest the orchestrator dispatched, and the restored tree **replaces** `.kici/` rather than being unpacked over it, so a file you deleted does not survive a cache hit.
1131
555
 
1132
556
  If you change a workflow file (`.ts`) but do **not** regenerate and commit the lock file, the repo at that commit has **drift**: the lock file no longer matches the source. Triggers and cache keys can be wrong, and runs can fail with a clear “stale lock file” error once the agent verifies the hash.
1133
557
 
@@ -1135,37 +559,38 @@ If you change a workflow file (`.ts`) but do **not** regenerate and commit the l
1135
559
 
1136
560
  The lock file (`kici.lock.json`) is a JSON file with the following top-level fields:
1137
561
 
1138
- | Field | Description |
1139
- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1140
- | `schemaVersion` | Lock file schema version, stamped by the compiler that produced the lock. Incremented on every format change. The orchestrator accepts a range of versions — see [schema compatibility window](https://docs.kici.dev/user/lock-file-and-drift/#schema-compatibility-window) — rather than requiring an exact match. |
1141
- | `minReaderVersion` | The oldest orchestrator schema version that can read this lock (the newest breaking version at compile time). An orchestrator whose own schema is below this rejects the lock and asks you to upgrade it. Omitted on locks compiled before the compatibility window existed. See [schema compatibility window](https://docs.kici.dev/user/lock-file-and-drift/#schema-compatibility-window). |
1142
- | `source` | Reference to the source file and export (e.g., `{ file: '.kici/workflows/ci.ts', export: '#default' }`). |
1143
- | `contentHash` | SHA-256 of the serialized lock file content (excluding itself). Changes when any workflow, trigger, or job changes. |
1144
- | `lockfileHash` | SHA-256 of the detected package manager's lockfile, used as the dependency cache key. The lockfile is `.kici/package-lock.json` for npm, or the repo-root `pnpm-lock.yaml` / `yarn.lock` for a pnpm/yarn workspace; the hash input is prefixed with the manager name so a manager change is a guaranteed cache miss. Omitted when no lockfile exists. |
1145
- | `workflows` | Array of workflow entries, each with its own `contentHash`, `compileSchemaVersion`, triggers, and jobs. |
562
+ | Field | Description |
563
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
564
+ | `schemaVersion` | Lock file schema version, stamped by the compiler that produced the lock. Incremented on every format change. The orchestrator accepts a range of versions — see [schema compatibility window](https://docs.kici.dev/user/lock-file-and-drift/#schema-compatibility-window) — rather than requiring an exact match. |
565
+ | `minReaderVersion` | The oldest orchestrator schema version that can read this lock (the newest breaking version at compile time). An orchestrator whose own schema is below this rejects the lock and asks you to upgrade it. Omitted on locks compiled before the compatibility window existed. See [schema compatibility window](https://docs.kici.dev/user/lock-file-and-drift/#schema-compatibility-window). |
566
+ | `source` | Reference to the source file and export (e.g., `{ file: '.kici/workflows/ci.ts', export: '#default' }`). |
567
+ | `contentHash` | SHA-256 of the serialized lock file content (excluding itself). Changes when any workflow, trigger, or job changes. |
568
+ | `lockfileHash` | SHA-256 of the detected package manager's lockfile, used as the dependency cache key. The lockfile is `.kici/package-lock.json` for npm, or the repo-root `pnpm-lock.yaml` / `yarn.lock` for a pnpm/yarn workspace; the hash input is prefixed with the manager name so a manager change is a guaranteed cache miss. Omitted when no lockfile exists. |
569
+ | `siblingsDigest` | SHA-256 over the git-tracked source of every in-repo `workspace:` / `file:` / `link:` / `portal:` sibling package `.kici` depends on, transitively. Part of the dependency cache key alongside `lockfileHash`, because editing a sibling's source moves no package manager lockfile. Omitted when `.kici` depends on no in-repo package, which is the common case. |
570
+ | `workflows` | Array of workflow entries, each with its own `contentHash`, `compileSchemaVersion`, triggers, and jobs. |
1146
571
 
1147
572
  Each workflow entry includes:
1148
573
 
1149
- | Field | Description |
1150
- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1151
- | `name` | Workflow name. |
1152
- | `source` | Per-workflow source file and export reference. |
1153
- | `contentHash` | SHA-256 of the raw workflow source mixed with `compileSchemaVersion` (and an `assetDigest` of declared `hashFiles` when present): `SHA-256(compileSchemaVersion + ":" + rawSource [+ "\0" + assetDigest])`. The orchestrator uses this as the source-tarball cache key and the agent re-computes it against the extracted source to detect drift. |
1154
- | `compileSchemaVersion` | Compiler schema version used when computing `contentHash` (currently `5`). The hash input is line-ending-normalized (CRLF → LF) so a lock file produced on Linux matches the agent's hash on Windows where Git's `core.autocrlf=true` rewrites checked-out text to CRLF. Bumping the schema version invalidates every existing source cache entry even if source is unchanged, which is the correct behavior when the compile-time or runtime contract changes. |
1155
- | `triggers` | Trigger definitions extracted from the workflow (used by the orchestrator for event matching). |
1156
- | `jobs` | Job definitions with scheduling metadata (runsOn, needs, matrix, contexts, concurrency, container, checkout, gracePeriod, label routing, dynamic fields, etc.). |
1157
- | `rules` | Workflow-level conditional rules (optional). Stored as dynamic references since rule functions cannot be serialized. |
1158
- | `description` | Optional workflow description. |
1159
- | `hashFiles` | Declared glob patterns for extra files included in the content hash (optional). See [extra files in the content hash](https://docs.kici.dev/user/lock-file-and-drift/#extra-files-in-the-content-hash-hashfiles). |
1160
- | `resolvedHashFiles` | Resolved file paths from `hashFiles` at compile time (optional). Recorded so the agent can verify without re-discovering. |
1161
- | `contexts` | Secret contexts declared by the workflow (optional). The orchestrator validates access to each context before dispatch. |
1162
- | `registries` | Private npm registry declarations the agent authenticates against before install (optional): `url`, `scope`, `tokenSecret` reference, `alwaysAuth`. Resolved token bytes never appear in the lock file. See [private registries](https://docs.kici.dev/user/private-registries/). |
1163
- | `installEnv` | Extra qualified secret refs (`<context>:<secret-name>`) projected as env vars on the install subprocess for use with a committed `.kici/.npmrc` (optional). See [private registries](https://docs.kici.dev/user/private-registries/). |
1164
- | `concurrency` | Workflow-level concurrency config: `hasGroup`, `cancelInProgress`, `max` (optional). See [concurrency groups](https://docs.kici.dev/user/concurrency/). |
1165
- | `timeout` | Whole-run wall-clock timeout in milliseconds (optional). The orchestrator reads this at run creation to set the run deadline. |
1166
- | `approval` | Normalized approval gate (optional): `clauses`, `reason`, `timeoutSeconds`, `when`. When present the whole run is held before any job is dispatched. Job and step entries carry the same normalized block for job- and step-level gates. See [approval gates](https://docs.kici.dev/user/approvals/). |
1167
- | `hasFilter` | `true` when the workflow declares a workflow-level `filter` predicate (optional; omitted rather than `false`). The predicate itself is never serialized — the flag tells the orchestrator an agent must evaluate the workflow before any of its jobs is dispatched. See [global workflows](https://docs.kici.dev/user/global-workflows/#narrowing-with-a-filter). |
1168
- | Hook flags | Boolean flags (`hasOnCancel`, `hasCleanup`, `hasOnSuccess`, `hasOnFailure`) indicating which lifecycle hooks are defined. Job entries additionally have `hasBeforeStep` and `hasAfterStep`. |
574
+ | Field | Description |
575
+ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
576
+ | `name` | Workflow name. |
577
+ | `source` | Per-workflow source file and export reference. |
578
+ | `contentHash` | SHA-256 of a digest over the whole `.kici/` directory mixed with `compileSchemaVersion` (and an `assetDigest` of declared `hashFiles` when present): `SHA-256(compileSchemaVersion + ":" + treeDigest [+ "\0" + assetDigest])`. The tree digest covers every file under `.kici/` except the paths declared in `.kici/.kiciignore` — see [files the content hash skips](https://docs.kici.dev/user/lock-file-and-drift/#files-the-content-hash-skips-kicikiciignore). Paths are sorted and line endings normalized. The orchestrator uses this as the source-tarball cache key and the agent re-computes it against the extracted tree to detect drift. |
579
+ | `compileSchemaVersion` | Compiler schema version used when computing `contentHash` (currently `7`). The hash input is line-ending-normalized (CRLF → LF) so a lock file produced on Linux matches the agent's hash on Windows where Git's `core.autocrlf=true` rewrites checked-out text to CRLF. Bumping the schema version invalidates every existing source cache entry even if source is unchanged, which is the correct behavior when the compile-time or runtime contract changes. |
580
+ | `triggers` | Trigger definitions extracted from the workflow (used by the orchestrator for event matching). |
581
+ | `jobs` | Job definitions with scheduling metadata (runsOn, needs, matrix, contexts, concurrency, container, checkout, gracePeriod, label routing, dynamic fields, etc.). |
582
+ | `rules` | Workflow-level conditional rules (optional). Stored as dynamic references since rule functions cannot be serialized. |
583
+ | `description` | Optional workflow description. |
584
+ | `hashFiles` | Declared glob patterns for extra files included in the content hash (optional). See [extra files in the content hash](https://docs.kici.dev/user/lock-file-and-drift/#extra-files-in-the-content-hash-hashfiles). |
585
+ | `resolvedHashFiles` | Resolved file paths from `hashFiles` at compile time (optional). Recorded so the agent can verify without re-discovering. |
586
+ | `contexts` | Secret contexts declared by the workflow (optional). The orchestrator validates access to each context before dispatch. |
587
+ | `registries` | Private npm registry declarations the agent authenticates against before install (optional): `url`, `scope`, `tokenSecret` reference, `alwaysAuth`. Resolved token bytes never appear in the lock file. See [private registries](https://docs.kici.dev/user/private-registries/). |
588
+ | `installEnv` | Extra qualified secret refs (`<context>:<secret-name>`) projected as env vars on the install subprocess for use with a committed `.kici/.npmrc` (optional). See [private registries](https://docs.kici.dev/user/private-registries/). |
589
+ | `concurrency` | Workflow-level concurrency config: `hasGroup`, `cancelInProgress`, `max` (optional). See [concurrency groups](https://docs.kici.dev/user/concurrency/). |
590
+ | `timeout` | Whole-run wall-clock timeout in milliseconds (optional). The orchestrator reads this at run creation to set the run deadline. |
591
+ | `approval` | Normalized approval gate (optional): `clauses`, `reason`, `timeoutSeconds`, `when`. When present the whole run is held before any job is dispatched. Job and step entries carry the same normalized block for job- and step-level gates. See [approval gates](https://docs.kici.dev/user/approvals/). |
592
+ | `hasFilter` | `true` when the workflow declares a workflow-level `filter` predicate (optional; omitted rather than `false`). The predicate itself is never serialized — the flag tells the orchestrator an agent must evaluate the workflow before any of its jobs is dispatched. See [global workflows](https://docs.kici.dev/user/global-workflows/#narrowing-with-a-filter). |
593
+ | Hook flags | Boolean flags (`hasOnCancel`, `hasCleanup`, `hasOnSuccess`, `hasOnFailure`) indicating which lifecycle hooks are defined. Job entries additionally have `hasBeforeStep` and `hasAfterStep`. |
1169
594
 
1170
595
  Step entries carry their own capability flags, so the orchestrator can reason about a step without loading your TypeScript:
1171
596
 
@@ -1246,9 +671,40 @@ kici compile --check
1246
671
 
1247
672
  This validates all workflows and generates the lock file in memory without writing it. If any workflow has syntax errors or invalid configuration, the command exits non-zero. Pair this with the agent-side hash verification (below) for full drift detection -- `--check` catches broken source, while the agent catches source-lock-file mismatches at run time.
1248
673
 
674
+ ## Files the content hash skips (`.kici/.kiciignore`)
675
+
676
+ The per-workflow content hash covers everything under `.kici/` except the paths declared in `.kici/.kiciignore`. `kici init` writes that file for you with this default set:
677
+
678
+ ```
679
+ node_modules/
680
+ types/
681
+ .npmrc
682
+ package-lock.json
683
+ pnpm-lock.yaml
684
+ kici.lock.json
685
+ ```
686
+
687
+ Every entry except `kici.lock.json` names something KiCI itself regenerates. The agent installs your workflow's dependencies before it re-checks the hash, and that install rewrites `package-lock.json`, `pnpm-lock.yaml`, `.npmrc` and `node_modules/`; `kici compile` refreshes `types/` after it has already hashed the tree. Hashing any of them would make the hash change on every run, and the drift gate would reject work that never changed.
688
+
689
+ `kici.lock.json` is different: the hash is written **into** that file, so hashing it would make it an input to itself. It stays excluded whatever your `.kiciignore` says.
690
+
691
+ Patterns are gitignore-style and are matched relative to `.kici/`. A trailing `/` matches a directory and everything beneath it, a bare name matches at any depth, and a pattern containing a slash is anchored at `.kici/`.
692
+
693
+ One rule differs from `git`: **a symlink to a directory counts as a directory**. So `node_modules/` covers a `.kici/node_modules` that is a symlink into a shared dependency tree, where `git` would treat that link as a file. The exclusion means "skip the dependency tree, whatever shape it takes on disk". Hashing the link instead produced a hash your build agent could not reproduce, because its own dependency install always writes a real directory there.
694
+
695
+ A symlink the exclusions do **not** cover is still hashed — as its link target, not as the bytes behind it. The source tarball has to carry that link unchanged for the agent to agree. So `kici compile` warns about a link it cannot carry: one whose target is absolute (extraction strips the leading `/`), or whose target points outside `.kici/`'s parent (extraction drops the link). Point the link inside `.kici/`, replace it with the files it names, or list it in `.kiciignore`.
696
+
697
+ :::caution[The file replaces the defaults — it does not add to them]
698
+ When `.kici/.kiciignore` exists, it **is** the exclusion list. A one-line file excludes one path and re-includes everything else, `package-lock.json` included. `kici compile` warns when your file omits a path a run rewrites, and names both the path and the instability it causes. Delete the file to fall back to the defaults.
699
+ :::
700
+
701
+ `.kiciignore` is itself covered by the hash. Which files define a workflow's identity is part of that identity, so editing the file forces a recompile — and nobody can change what a lock file attests to without changing the lock file.
702
+
703
+ > **Not the repo-root `.kiciignore`.** A `.kiciignore` at the root of your repository is a separate, unrelated file: it selects which working-tree files `kici run remote` uploads. Only the one inside `.kici/` affects the content hash.
704
+
1249
705
  ## Extra files in the content hash (`hashFiles`)
1250
706
 
1251
- By default, the per-workflow content hash is `SHA-256(compileSchemaVersion + ":" + rawSource)` where `rawSource` is the TypeScript text of the workflow entry file. If your workflow depends on files outside `.kici/workflows/` -- configuration files, scripts, Dockerfiles, etc. -- changes to those files will **not** invalidate the cache unless you declare them.
707
+ A helper the workflow imports from `.kici/lib/` is already covered, so editing it invalidates the cache on its own. If your workflow depends on files **outside** `.kici/` -- configuration files, scripts, Dockerfiles, etc. -- changes to those files will **not** invalidate the cache unless you declare them.
1252
708
 
1253
709
  Use the `hashFiles` option on a workflow to include additional paths or glob patterns (relative to the repo root) in the content hash:
1254
710
 
@@ -1259,14 +715,14 @@ export default workflow('deploy', {
1259
715
  });
1260
716
  ```
1261
717
 
1262
- When any of the matched files change, the content hash formula becomes `SHA-256(compileSchemaVersion + ":" + rawSource + "\0" + assetDigest)` where `assetDigest` is a deterministic encoding of the resolved file paths and their contents. This busts the source-tarball cache and forces the build agent to pack and upload a fresh `source/{contentHash}.tar.gz`. The resolved file paths are recorded in the lock file under `resolvedHashFiles` so the agent can verify without re-discovering the workflow.
718
+ When any of the matched files change, the content hash formula becomes `SHA-256(compileSchemaVersion + ":" + treeDigest + "\0" + assetDigest)` where `assetDigest` is a deterministic encoding of the resolved file paths and their contents. This busts the source-tarball cache and forces the build agent to pack and upload a fresh tarball. The resolved file paths are recorded in the lock file under `resolvedHashFiles` so the agent can verify without re-discovering the workflow.
1263
719
 
1264
720
  ## Agent-side safety net
1265
721
 
1266
722
  If drift still occurs (e.g. someone committed only the `.ts` change), the agent detects it at run time before any step runs:
1267
723
 
1268
- - After extracting the `.kici/` source tarball (or loading source from a `git clone` on the build path), the agent reads the workflow entry file and re-computes `contentHash = SHA-256(compileSchemaVersion + ":" + rawSource [+ "\0" + assetDigest])` using the same formula as the compiler.
1269
- - If the orchestrator sent a `contentHash` (from the lock file) and the computed hash does **not** match, the agent fails the run with an error like: **lock file is out of date** (workflow source changed without regenerating the lock file). The error includes the baked agent `@kici-dev/sdk` version + bundle hash so operators can debug cross-host compile mismatches.
724
+ - After extracting the `.kici/` source tarball (or loading source from a `git clone` on the build path), the agent walks the whole extracted `.kici/` tree and re-computes `contentHash = SHA-256(compileSchemaVersion + ":" + treeDigest [+ "\0" + assetDigest])` using the same implementation as the compiler. Because it covers the tree, an edit to any file the workflow imports is caught, not just an edit to the entry file.
725
+ - If the orchestrator sent a `contentHash` (from the lock file) and the computed hash does **not** match, the agent fails the run with an error like: **lock file is out of date** (workflow source changed without regenerating the lock file). The error includes the baked agent `@kici-dev/sdk` version + bundle hash so operators can debug cross-host compile mismatches. When the hashed tree carries symlinks, the error names them too — recompiling cannot reconcile a link the tarball omits or extraction rewrites, so the usual remedy would loop.
1270
726
 
1271
727
  So even without a pre-commit or CI check, a stale lock file will cause the run to fail with a clear message instead of running with the wrong workflow.
1272
728
 
@@ -1278,6 +734,7 @@ So even without a pre-commit or CI check, a stale lock file will cause the run t
1278
734
  | Catch drift before commit | Install a pre-commit hook with `kici hook install`. |
1279
735
  | Catch broken source in CI | Run `kici compile --check` in CI. |
1280
736
  | Bust cache on external files | Add `hashFiles: ['config.json']` to include non-workflow files in the content hash. |
737
+ | Skip a path inside `.kici/` | List it in `.kici/.kiciignore` — remember the file replaces the defaults. |
1281
738
  | Fail fast when drift remains | Rely on the agent’s hash verification when it compiles from source. |
1282
739
 
1283
740
  ## See also
@@ -1816,2231 +1273,507 @@ Practical patterns for building real-world KiCI workflows in TypeScript. The pat
1816
1273
 
1817
1274
  ---
1818
1275
 
1819
- ## kici: account & org
1276
+ ## kici: authoring & local dev
1820
1277
 
1821
- Source: https://docs.kici.dev/user/cli/account-and-org/
1278
+ Source: https://docs.kici.dev/user/cli/authoring-and-local/
1822
1279
 
1823
1280
  ## Guide
1824
1281
 
1825
- ### kici login
1826
-
1827
- Authenticate with KiCI via browser-based OAuth (default) or API key (`--token`).
1828
-
1829
- By default, `kici login` opens your browser for OIDC authentication using PKCE. In headless environments (SSH, CI, containers), it automatically switches to the RFC 8628 device authorization flow where you visit a URL and enter a code.
1830
-
1831
- The browser flow completes by receiving a callback on `127.0.0.1`. If that callback is blocked, pass `--device` to use the device flow instead — it needs no local callback. See [CLI authentication](https://docs.kici.dev/user/cli-auth/#browser-callback-never-arrives) for the full troubleshooting steps.
1832
-
1833
- After OAuth, the CLI exchanges the OIDC token for a personal access token (PAT) stored in the config directory (`~/.kici/config` by default, overridable with `KICI_CONFIG_DIR`).
1282
+ ### kici compile
1834
1283
 
1835
- `kici login` targets the hosted KiCI Platform by default. To authenticate against another KiCI environment (staging, or a testing OIDC provider, for example), pass `--platform-endpoint` / `--oidc-issuer` or set `KICI_PLATFORM_URL` / `KICI_OIDC_ISSUER`. Login persists the platform endpoint and OIDC issuer it authenticated against alongside the PAT, so a saved PAT always matches its endpoint. Because the config describes one environment at a time, **switching the endpoint resets the active organization and default clusters** — re-run `kici org use <name>` after switching environments.
1284
+ Compile workflows from `.kici/workflows/` to `kici.lock.json`.
1836
1285
 
1837
1286
  ```bash
1838
- kici login [options]
1287
+ kici compile [options]
1839
1288
  ```
1840
1289
 
1841
- **Environment variables:**
1842
-
1843
- | Variable | Default | Description |
1844
- | --------------------- | -------------------------------------------- | ---------------------------------------------------------------------- |
1845
- | `KICI_PLATFORM_URL` | `https://api.kici.dev` | Platform API base URL (override to target another KiCI environment) |
1846
- | `KICI_OIDC_ISSUER` | `https://auth.kici.dev/realms/kici-internal` | OIDC issuer URL (override to target another KiCI environment) |
1847
- | `KICI_OIDC_CLIENT_ID` | `kici-cli` | OIDC client ID (override to target another KiCI environment) |
1848
- | `KICI_BROWSER_CMD` | uses `open` package | Custom browser command with `{url}` placeholder, or `none` to suppress |
1849
- | `KICI_CALLBACK_PORT` | random | Fixed port for OAuth PKCE callback server |
1850
- | `KICI_CONFIG_DIR` | `~/.kici` | Override config directory |
1851
-
1852
1290
  **Examples:**
1853
1291
 
1854
1292
  ```bash
1855
- # Browser-based OAuth login (default)
1856
- kici login
1857
-
1858
- # Force device flow (for SSH/headless)
1859
- kici login --device
1860
-
1861
- # Legacy API key login
1862
- kici login --token kici_sk_abc123...
1293
+ # Compile all workflows
1294
+ kici compile
1863
1295
 
1864
- # Log in against another KiCI environment (e.g. a testing instance)
1865
- kici login --platform-endpoint https://platform.example.com \
1866
- --oidc-issuer https://auth.example.com/realms/kici-internal
1296
+ # Validate and type-check (CI-friendly, no file writes)
1297
+ kici compile --check
1867
1298
 
1868
- # Suppress browser opening (print authorize URL to stdout)
1869
- KICI_BROWSER_CMD=none kici login
1299
+ # Watch mode for development
1300
+ kici compile --watch
1870
1301
 
1871
- # Use custom browser command
1872
- KICI_BROWSER_CMD='firefox {url}' kici login
1302
+ # Custom .kici directory location
1303
+ kici compile --kici-dir packages/app/.kici
1873
1304
 
1874
- # Fixed callback port and custom config directory
1875
- KICI_CALLBACK_PORT=19876 KICI_CONFIG_DIR=/tmp/kici-test kici login
1305
+ # Verbose output for debugging
1306
+ kici compile --verbose
1876
1307
  ```
1877
1308
 
1878
- **Headless detection:** The CLI checks, in order:
1879
-
1880
- 1. SSH session — `SSH_CONNECTION`, `SSH_CLIENT`, or `SSH_TTY` set.
1881
- 2. CI — `CI`, `GITHUB_ACTIONS`, or `GITLAB_CI` set to anything other than the explicit opt-outs `0` and `false` (any case), so exporting `CI=0` on a desktop keeps the browser flow. An opt-out cancels that one marker only — `CI=false GITHUB_ACTIONS=true` still selects the device flow, and `GITHUB_ACTIONS=false` opts that marker out without affecting `CI`. See [Environment variables](https://docs.kici.dev/user/env-vars/#how-ci-is-interpreted) for the full convention.
1882
- 3. Container — `container` or `DOCKER_CONTAINER` set, or the `/run/.containerenv` / `/.dockerenv` sentinel files present.
1883
- 4. WSL — an interactive desktop, so **not** headless, but only when Windows interop is reachable: the browser flow opens your Windows browser and the localhost callback is normally reachable through WSL's localhost forwarding (a `portproxy` rule or firewall policy can still block it — pass `--device` if it does). When interop is unreachable (it is disabled, or the Windows drive is not mounted) no Windows browser can be launched, so WSL counts as headless and the device flow is used. The same applies when the interop check does not answer within a couple of seconds — the signature of a hung Windows drive mount — so a wedged mount falls back to the device flow instead of stalling the login.
1884
- 5. Linux without a display server — neither `DISPLAY` nor `WAYLAND_DISPLAY` set.
1885
-
1886
- The first match wins, so an SSH session into WSL, or a container running on a WSL host, stays on the device flow.
1887
-
1888
- ### kici logout
1309
+ **Exit codes:**
1889
1310
 
1890
- Revoke your personal access token on the server and clear local credentials.
1311
+ | Code | Meaning |
1312
+ | ---- | --------------------------- |
1313
+ | 0 | Compilation successful |
1314
+ | 1 | Compilation failed (errors) |
1891
1315
 
1892
- If the server is unreachable, local credentials are still cleared (the PAT will expire automatically). Non-auth config fields (active org, default clusters, etc.) are preserved.
1316
+ The `--check` flag is useful in CI pipelines and pre-commit hooks. It validates that workflows are syntactically and semantically correct **and** runs a `tsc --noEmit` type-check over `.kici/workflows/**`, so type-broken workflows are caught at compile time instead of shipping silently. No lock file or other files are written.
1893
1317
 
1894
- ```bash
1895
- kici logout
1896
- ```
1318
+ The type-check requires `.kici/tsconfig.json` and a `typescript` dependency — both are scaffolded by `kici init`. In a JavaScript-only workspace (`kici init --mjs`, which has no `tsconfig.json`), the type-check is skipped with a notice and validation still runs. When the type-check finds errors, `kici compile --check` prints each one in `file:line:column error [E120]: message` form and exits non-zero.
1897
1319
 
1898
- **Examples:**
1320
+ Compile and validation errors carry the real `file:line:column` of the offending job or step (anchored to the job's first step location), so you can jump straight to the source instead of a generic line 1.
1899
1321
 
1900
- ```bash
1901
- # Log out and revoke PAT
1902
- kici logout
1903
- ```
1322
+ **Auto-type regeneration:** When authenticated (via `kici login`), `kici compile` automatically refreshes `.kici/types/secrets.d.ts` after each successful compilation. This keeps type declarations in sync with your orchestrator's secret contexts. The type regeneration is non-blocking -- if the orchestrator is unreachable, compilation still succeeds with a warning. The `--check` flag skips type regeneration since no files are written.
1904
1323
 
1905
- ### kici init
1324
+ ### kici preview
1906
1325
 
1907
- Initialize a `.kici/` directory with default workflow templates.
1326
+ Preview which workflows match a trigger event (dry-run, no execution). Useful for verifying trigger configurations during development.
1908
1327
 
1909
1328
  ```bash
1910
- kici init [options]
1329
+ kici preview [event] [options]
1911
1330
  ```
1912
1331
 
1913
1332
  **Examples:**
1914
1333
 
1915
1334
  ```bash
1916
- # Interactive initialization
1917
- kici init
1335
+ # Preview which workflows match a push event
1336
+ kici preview push
1918
1337
 
1919
- # Overwrite existing setup
1920
- kici init --force
1338
+ # Preview PR trigger matching
1339
+ kici preview pr:open
1921
1340
 
1922
- # Skip dependency install (faster, install manually later)
1923
- kici init --skip-install
1341
+ # Preview with branch override
1342
+ kici preview push --branch develop
1924
1343
 
1925
- # Force a specific package manager (default: detect from your repo)
1926
- kici init --package-manager pnpm
1344
+ # Filter to specific workflow
1345
+ kici preview push --workflow ci
1927
1346
 
1928
- # JavaScript mode (no TypeScript)
1929
- kici init --mjs
1347
+ # Simulate changed files for path-filtered triggers
1348
+ kici preview push --files src/index.ts --files README.md
1349
+ ```
1930
1350
 
1931
- # Integrate into the surrounding workspace (workflows can import sibling packages)
1932
- kici init --workspace
1351
+ **Exit codes:**
1933
1352
 
1934
- # Force a self-contained .kici/ even inside a workspace
1935
- kici init --standalone
1353
+ | Code | Meaning |
1354
+ | ---- | ------------------------------------------ |
1355
+ | 0 | Preview completed (including zero matches) |
1356
+ | 1 | Error |
1936
1357
 
1937
- # Skip writing the AGENTS.md LLM authoring context file
1938
- kici init --no-agents-md
1358
+ **Migration from the old `test` command:** The dry-run preview command was renamed from `test` to `preview`. If you were using the old `test` command with a fixture name for remote fixture execution, use `kici run remote <fixture-name>` instead. For local workflow execution, use `kici run <event> --local`.
1939
1359
 
1940
- # Scaffold a workflow registries entry for a private npm registry
1941
- kici init --private-registry https://npm.pkg.github.com/ \
1942
- --private-registry-scope @my-org \
1943
- --private-registry-secret production:GITHUB_PACKAGES_TOKEN
1944
- ```
1360
+ ### kici local
1945
1361
 
1946
- **What it creates:**
1362
+ Manage the **local dev plane** — the warm, per-user orchestrator (plus its own local PostgreSQL) that [`kici run <event> --local`](https://docs.kici.dev/user/cli/runs-and-approvals/#kici-run-event---local) dispatches through. You rarely need these commands directly: a local run boots the plane on demand and reuses it afterwards. Reach for them to inspect the plane, stop it, read its log, or switch it between offline and Platform-connected mode.
1947
1363
 
1948
- ```
1949
- .kici/
1950
- workflows/
1951
- hello-world.ts # Minimal push workflow
1952
- pr-checks.ts # Comprehensive PR workflow
1953
- tests/
1954
- push-test.ts # Sample test fixture
1955
- types/ # Directory for generated type declarations (kici types)
1956
- package.json # Dependencies (@kici-dev/sdk)
1957
- tsconfig.json # TypeScript configuration (includes types/**/*.d.ts)
1958
- AGENTS.md # LLM authoring context (skip with --no-agents-md)
1959
- .kiciignore # Default exclusion patterns for test uploads
1364
+ ```bash
1365
+ kici local up [--offline | --connected] # Start, or reuse an already-running plane
1366
+ kici local status [--json] # Port, pid, PostgreSQL backend, attachment mode, readiness
1367
+ kici local down # Stop the orchestrator and its PostgreSQL, verifying the port is freed
1368
+ kici local logs # Print the orchestrator log file path
1369
+ kici local attach # Attach to the Platform (hybrid mode)
1370
+ kici local detach # Return the plane to offline (independent) mode
1371
+ kici local trust-root <file> # Export the dev-signed trust root for offline verification
1960
1372
  ```
1961
1373
 
1962
- `AGENTS.md` is written by default (the interactive prompt defaults to yes, and CI / non-interactive runs write it). An existing `.kici/AGENTS.md` is never overwritten, so hand edits survive a re-run.
1374
+ The plane runs in one of two modes:
1963
1375
 
1964
- In interactive mode (TTY), `kici init` prompts you to:
1376
+ - **Independent (offline)** the default for a plane that has never been attached. Identity tokens and attestations are signed by a local dev key under the clearly non-production issuer `kici-local`.
1377
+ - **Hybrid (attached)** — `kici local attach` mints an org-scoped key with your logged-in credentials and reboots the plane connected to the Platform, so local runs get real Platform-minted identity and attestation. `kici local up` honors a durable attachment record: an attached plane comes back up hybrid, and falls back to offline with a warning when the Platform is unreachable.
1965
1378
 
1966
- 1. Select which workflow templates to include
1967
- 2. Optionally install a pre-commit hook
1379
+ `--offline` forces an independent boot without clearing the attachment record (only `detach` clears it); `--connected` requires an attached, reachable Platform and fails otherwise.
1968
1380
 
1969
- **Host-OS runsOn:** the scaffolded workflows target `kici:os:<your OS>` `kici init` detects the host operating system (like it detects the default branch) and writes `kici:os:linux`, `kici:os:macos`, or `kici:os:windows` so your very first `kici run push --local` dispatches on this machine. A workflow authored on one OS and run locally on another prints a hint naming the OS it wants versus the host it found.
1381
+ `kici local down` reports success only once the plane port is verified free. If a process still holds it including a plane left behind by an interrupted boot the command exits non-zero and names the holder, so a failed teardown is never mistaken for a clean one. A holder that does not identify as a KiCI plane orchestrator is reported and left alone, never stopped.
1970
1382
 
1971
- **First run:** in interactive mode, after setup `kici init` offers to run the scaffolded workflow immediately (`kici run push --local`), defaulting to No. It is skipped in CI, non-interactive shells, `--mjs`, and `--skip-install` (where dependencies are not installed yet).
1383
+ `kici local status` reports a plane whose process is alive but whose readiness probe fails — for example when its PostgreSQL has stopped — as running but not ready, together with its readiness checks, rather than as not running. When the holder is a KiCI plane orchestrator that this config directory did not start — a plane belonging to another `KICI_CONFIG_DIR`, or one whose record here was lost — status names it as such rather than as not ready, since its readiness is never probed, and points at `kici local down`, which does reclaim it. When the port is held by a process that is not a KiCI plane orchestrator, `kici local status` names that holder instead and points at `KICI_LOCAL_ORCH_PORT`, because `kici local down` will not stop it.
1972
1384
 
1973
- **Package manager:** the dependency install step uses the package manager detected for your repo — the `packageManager` field in the nearest `package.json` (Corepack convention), then a lockfile in the project root (`pnpm-lock.yaml` → pnpm, `yarn.lock` yarn, `package-lock.json` npm), then the package manager that invoked `kici` (`pnpm dlx` / `yarn dlx` / `npx`), defaulting to npm. Pass `--package-manager <npm|pnpm|yarn>` to override detection, or `--skip-install` to set up the files and install later yourself.
1974
-
1975
- **Standalone vs workspace integration:** by default `kici init` scaffolds a self-contained `.kici/` with its own `package.json`. When run inside a pnpm, npm, or yarn workspace, it offers an **integrate** option (or pass `--workspace`): `.kici/` joins the workspace, `@kici-dev/sdk` is added to your workspace-root `package.json`, and your workflows can `import` your other workspace packages (e.g. shared build or deploy utilities). In this mode there is no `.kici/package.json` — the workspace root manages dependencies, and the root install resolves the SDK. Your workflows resolve sibling packages through the workspace-root `node_modules`: under npm and yarn every workspace member is hoisted there automatically, while pnpm links only your root's declared dependencies, so under pnpm add the package you want to import to your workspace-root `dependencies` (this is how KiCI's own repository imports its packages from workflows). Pass `--standalone` to force the self-contained layout even inside a workspace. In CI / non-interactive runs the default is standalone; use `--workspace` to opt in explicitly. `--workspace` and `--standalone` are mutually exclusive, and `--workspace` errors if no workspace is found at or above the current directory.
1976
-
1977
- **Development mode:** When `KICI_DEV=true` or `package.json` has `"kici": { "development": true }`, the generated `package.json` uses prerelease-compatible version ranges (`>=0.0.1-0`) so npm resolves Verdaccio's prerelease builds.
1978
-
1979
- ### kici org
1980
-
1981
- Manage organization context. Requires a PAT (run `kici login` first).
1982
-
1983
- #### kici org list
1984
-
1985
- List organizations you belong to. The active org is marked with a star (`*`).
1986
-
1987
- ```bash
1988
- kici org list
1989
- ```
1990
-
1991
- **Example output:**
1992
-
1993
- ```
1994
- Organizations:
1995
-
1996
- * Personal (owner) abc123def456
1997
- My team (admin) xyz789ghi012
1998
- ```
1999
-
2000
- #### kici org use
2001
-
2002
- Switch the active organization by name (case-insensitive) or ID.
2003
-
2004
- ```bash
2005
- kici org use <name>
2006
- ```
2007
-
2008
- **Examples:**
2009
-
2010
- ```bash
2011
- # Switch by name
2012
- kici org use "My team"
2013
-
2014
- # Switch by ID
2015
- kici org use xyz789ghi012
2016
- ```
2017
-
2018
- #### kici org current
2019
-
2020
- Show the current active organization.
2021
-
2022
- ```bash
2023
- kici org current
2024
- ```
2025
-
2026
- ### kici pat create
2027
-
2028
- Mint a personal access token under your own identity. Pass `--agent` to mint an
2029
- **agent-kind** PAT — the credential a coding agent points the KiCI MCP server at.
2030
-
2031
- ```bash
2032
- kici pat create --agent --name "claude-code"
2033
- ```
2034
-
2035
- - `--agent` marks the token as agent-kind. An agent PAT inherits your
2036
- permissions unchanged (it carries provenance, not extra authority) and is the
2037
- **only** credential the MCP server accepts.
2038
- - `--name <label>` sets the token name. For an agent PAT this is the **agent
2039
- label** recorded on every action the agent takes — required with `--agent`.
2040
- - `--expires-in-days <n>` overrides the default expiry.
2041
-
2042
- The token is printed once — save it immediately; it cannot be retrieved later.
2043
- See [Drive KiCI from your coding agent](https://docs.kici.dev/user/ai-agents/) for the full setup.
2044
-
2045
- **Prerequisites:** authenticate via `kici login` first.
2046
-
2047
- ### kici secrets list
2048
-
2049
- List secret contexts available for test runs. Shows context names and key names (not values).
2050
-
2051
- ```bash
2052
- kici secrets list
2053
- ```
2054
-
2055
- Each context corresponds to a context configured on the orchestrator. The output lists every context whose `allowLocalExecution` flag is `true` (the gate that lets CLI-initiated test runs resolve secrets through that context), along with the secret key names reachable from the context's bound scopes.
2056
-
2057
- Only key names are shown — secret values are never returned over this endpoint.
2058
-
2059
- **Prerequisites:** authenticate via `kici login` and select an active organization with `kici org use <name>`.
2060
-
2061
- ### kici admin
2062
-
2063
- Operator-facing commands for running instances.
2064
-
2065
- #### kici admin drain-worker
2066
-
2067
- Trigger graceful drain on a worker instance. Sends a POST request to the worker's `/drain` endpoint.
2068
-
2069
- ```bash
2070
- kici admin drain-worker [options]
2071
- ```
2072
-
2073
- **Examples:**
2074
-
2075
- ```bash
2076
- # Drain a local worker
2077
- kici admin drain-worker --url http://localhost:10143
2078
-
2079
- # Drain a remote worker
2080
- kici admin drain-worker --url http://worker-2.internal:10143
2081
- ```
2082
-
2083
- **Exit codes:**
2084
-
2085
- | Code | Meaning |
2086
- | ---- | ----------------------------------- |
2087
- | 0 | Drain request accepted |
2088
- | 1 | Error (unreachable or request fail) |
2089
-
2090
- ### kici endpoints
2091
-
2092
- List all webhook entrypoints for the current project. Reads the compiled lock file and displays webhook URLs grouped by type (git provider, generic webhooks, scheduled, event-driven).
2093
-
2094
- ```bash
2095
- kici endpoints [options]
2096
- ```
2097
-
2098
- **Prerequisites:** Run `kici compile` first to generate the lock file.
2099
-
2100
- **Examples:**
2101
-
2102
- ```bash
2103
- # List all webhook entrypoints
2104
- kici endpoints
2105
-
2106
- # Custom .kici directory
2107
- kici endpoints --kici-dir packages/app/.kici
2108
- ```
2109
-
2110
- ## Reference
2111
-
2112
- <!-- BEGIN GENERATED: kici-account-and-org (do not edit; run the doc generator) -->
2113
-
2114
- ### `kici admin`
2115
-
2116
- Operator-facing commands for running instances
2117
-
2118
- Synopsis: `kici admin`
2119
-
2120
- ### `kici admin drain-worker`
2121
-
2122
- Trigger graceful drain on a worker instance
2123
-
2124
- Synopsis: `kici admin drain-worker [options]`
2125
-
2126
- **Options**
2127
-
2128
- | Option | Default | Description |
2129
- | ------------- | ------- | -------------------------------------------- |
2130
- | `--url <url>` | | Worker URL (e.g., http://worker-host:<port>) |
2131
-
2132
- ### `kici endpoints`
2133
-
2134
- List all webhook entrypoints for the current project
2135
-
2136
- Synopsis: `kici endpoints [options]`
2137
-
2138
- **Options**
2139
-
2140
- | Option | Default | Description |
2141
- | ------------------- | ------- | ----------------------- |
2142
- | `--kici-dir <path>` | `.kici` | Path to .kici directory |
2143
-
2144
- ### `kici init`
2145
-
2146
- Initialize .kici/ directory with default workflows
2147
-
2148
- Synopsis: `kici init [options]`
2149
-
2150
- **Options**
2151
-
2152
- | Option | Default | Description |
2153
- | ---------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------------- |
2154
- | `--force` | `false` | Overwrite existing .kici/ directory |
2155
- | `--skip-install` | `false` | Create files without installing dependencies |
2156
- | `--package-manager <npm | pnpm | yarn>` | | Force a package manager for the install step (default: auto-detect) |
2157
- | `--mjs` | `false` | JavaScript-only mode (no TypeScript, no dependencies) |
2158
- | `--workspace` | `false` | Integrate .kici/ into the detected pnpm/npm/yarn workspace so workflows can import sibling packages |
2159
- | `--standalone` | `false` | Force a self-contained .kici/ even inside a workspace |
2160
- | `--no-agents-md` | | Skip writing .kici/AGENTS.md (LLM authoring context) |
2161
- | `--private-registry <url>` | | Scaffold a workflow registries: entry pointing at <url> |
2162
- | `--private-registry-scope <scope>` | | Optional npm package scope (e.g. @my-org) for the private registry |
2163
- | `--private-registry-secret <ref>` | `production:NPM_TOKEN` | Qualified secret reference (env:NAME) the private registry token comes from |
2164
-
2165
- ### `kici login`
2166
-
2167
- Authenticate with KiCI via browser OAuth (default) or API key (--token)
2168
-
2169
- Synopsis: `kici login [options]`
2170
-
2171
- **Options**
2172
-
2173
- | Option | Default | Description |
2174
- | --------------------------- | ------- | ----------------------------------------------------------------------------------- |
2175
- | `--token <key>` | | API key for direct authentication (legacy) |
2176
- | `--device` | | Force device authorization flow (for headless/SSH environments) |
2177
- | `--platform-endpoint <url>` | | Platform relay URL |
2178
- | `--oidc-issuer <url>` | | OIDC issuer URL (defaults to the hosted KiCI IdP unless a flag/env selects another) |
2179
- | `--routing-key <key>` | | Routing key for webhook source identification |
2180
- | `--no-attach` | | Skip the post-login prompt to attach the local dev plane |
2181
-
2182
- ### `kici logout`
2183
-
2184
- Revoke PAT and clear local credentials
2185
-
2186
- Synopsis: `kici logout`
2187
-
2188
- ### `kici orchestrators`
2189
-
2190
- Inspect the org's orchestrator clusters and pick a default for run remote
2191
-
2192
- Synopsis: `kici orchestrators`
2193
-
2194
- ### `kici orchestrators list`
2195
-
2196
- List the connected orchestrator clusters for the active org
2197
-
2198
- Synopsis: `kici orchestrators list [options]`
2199
-
2200
- **Options**
2201
-
2202
- | Option | Default | Description |
2203
- | ------------ | ------- | ---------------------------------------------- |
2204
- | `--org <id>` | | Target organization (overrides the active org) |
2205
-
2206
- ### `kici orchestrators use`
2207
-
2208
- Set the per-org default orchestrator cluster for run remote
2209
-
2210
- Synopsis: `kici orchestrators use <name> [options]`
2211
-
2212
- **Arguments**
2213
-
2214
- | Argument | Required | Variadic | Description |
2215
- | -------- | -------- | -------- | ------------------------- |
2216
- | `name` | yes | no | Orchestrator cluster name |
2217
-
2218
- **Options**
2219
-
2220
- | Option | Default | Description |
2221
- | ------------ | ------- | ---------------------------------------------- |
2222
- | `--org <id>` | | Target organization (overrides the active org) |
2223
-
2224
- ### `kici org`
2225
-
2226
- Manage organizations
2227
-
2228
- Synopsis: `kici org`
2229
-
2230
- ### `kici org current`
2231
-
2232
- Show current active organization
2233
-
2234
- Synopsis: `kici org current`
2235
-
2236
- ### `kici org list`
2237
-
2238
- List organizations you belong to
2239
-
2240
- Synopsis: `kici org list`
2241
-
2242
- ### `kici org use`
2243
-
2244
- Switch active organization
2245
-
2246
- Synopsis: `kici org use <name>`
2247
-
2248
- **Arguments**
2249
-
2250
- | Argument | Required | Variadic | Description |
2251
- | -------- | -------- | -------- | ----------------------- |
2252
- | `name` | yes | no | Organization name or ID |
2253
-
2254
- ### `kici pat`
2255
-
2256
- Manage personal access tokens
2257
-
2258
- Synopsis: `kici pat`
2259
-
2260
- ### `kici pat create`
2261
-
2262
- Mint a personal access token (use --agent for a coding-agent token)
2263
-
2264
- Synopsis: `kici pat create [options]`
2265
-
2266
- **Options**
2267
-
2268
- | Option | Default | Description |
2269
- | ----------------------- | ------- | ---------------------------------------------- |
2270
- | `--name <name>` | | Token name (defaults to the agent label) |
2271
- | `--agent` | `false` | Mint an agent-kind PAT for the KiCI MCP server |
2272
- | `--expires-in-days <n>` | | Custom expiry in days |
2273
-
2274
- ### `kici secrets`
2275
-
2276
- Manage secrets
2277
-
2278
- Synopsis: `kici secrets`
2279
-
2280
- ### `kici secrets list`
2281
-
2282
- List test-available secret contexts
2283
-
2284
- Synopsis: `kici secrets list`
2285
- <!-- END GENERATED: kici-account-and-org -->
2286
-
2287
- ---
2288
-
2289
- ## kici: authoring & local dev
2290
-
2291
- Source: https://docs.kici.dev/user/cli/authoring-and-local/
2292
-
2293
- ## Guide
2294
-
2295
- ### kici compile
2296
-
2297
- Compile workflows from `.kici/workflows/` to `kici.lock.json`.
2298
-
2299
- ```bash
2300
- kici compile [options]
2301
- ```
2302
-
2303
- **Examples:**
2304
-
2305
- ```bash
2306
- # Compile all workflows
2307
- kici compile
2308
-
2309
- # Validate and type-check (CI-friendly, no file writes)
2310
- kici compile --check
2311
-
2312
- # Watch mode for development
2313
- kici compile --watch
2314
-
2315
- # Custom .kici directory location
2316
- kici compile --kici-dir packages/app/.kici
2317
-
2318
- # Verbose output for debugging
2319
- kici compile --verbose
2320
- ```
2321
-
2322
- **Exit codes:**
2323
-
2324
- | Code | Meaning |
2325
- | ---- | --------------------------- |
2326
- | 0 | Compilation successful |
2327
- | 1 | Compilation failed (errors) |
2328
-
2329
- The `--check` flag is useful in CI pipelines and pre-commit hooks. It validates that workflows are syntactically and semantically correct **and** runs a `tsc --noEmit` type-check over `.kici/workflows/**`, so type-broken workflows are caught at compile time instead of shipping silently. No lock file or other files are written.
2330
-
2331
- The type-check requires `.kici/tsconfig.json` and a `typescript` dependency — both are scaffolded by `kici init`. In a JavaScript-only workspace (`kici init --mjs`, which has no `tsconfig.json`), the type-check is skipped with a notice and validation still runs. When the type-check finds errors, `kici compile --check` prints each one in `file:line:column error [E120]: message` form and exits non-zero.
2332
-
2333
- Compile and validation errors carry the real `file:line:column` of the offending job or step (anchored to the job's first step location), so you can jump straight to the source instead of a generic line 1.
2334
-
2335
- **Auto-type regeneration:** When authenticated (via `kici login`), `kici compile` automatically refreshes `.kici/types/secrets.d.ts` after each successful compilation. This keeps type declarations in sync with your orchestrator's secret contexts. The type regeneration is non-blocking -- if the orchestrator is unreachable, compilation still succeeds with a warning. The `--check` flag skips type regeneration since no files are written.
2336
-
2337
- ### kici preview
2338
-
2339
- Preview which workflows match a trigger event (dry-run, no execution). Useful for verifying trigger configurations during development.
2340
-
2341
- ```bash
2342
- kici preview [event] [options]
2343
- ```
2344
-
2345
- **Examples:**
2346
-
2347
- ```bash
2348
- # Preview which workflows match a push event
2349
- kici preview push
2350
-
2351
- # Preview PR trigger matching
2352
- kici preview pr:open
2353
-
2354
- # Preview with branch override
2355
- kici preview push --branch develop
2356
-
2357
- # Filter to specific workflow
2358
- kici preview push --workflow ci
2359
-
2360
- # Simulate changed files for path-filtered triggers
2361
- kici preview push --files src/index.ts --files README.md
2362
- ```
2363
-
2364
- **Exit codes:**
2365
-
2366
- | Code | Meaning |
2367
- | ---- | ------------------------------------------ |
2368
- | 0 | Preview completed (including zero matches) |
2369
- | 1 | Error |
2370
-
2371
- **Migration from the old `test` command:** The dry-run preview command was renamed from `test` to `preview`. If you were using the old `test` command with a fixture name for remote fixture execution, use `kici run remote <fixture-name>` instead. For local workflow execution, use `kici run <event> --local`.
2372
-
2373
- ### kici local
2374
-
2375
- Manage the **local dev plane** — the warm, per-user orchestrator (plus its own local PostgreSQL) that [`kici run <event> --local`](https://docs.kici.dev/user/cli/runs-and-approvals/#kici-run-event---local) dispatches through. You rarely need these commands directly: a local run boots the plane on demand and reuses it afterwards. Reach for them to inspect the plane, stop it, read its log, or switch it between offline and Platform-connected mode.
2376
-
2377
- ```bash
2378
- kici local up [--offline | --connected] # Start, or reuse an already-running plane
2379
- kici local status [--json] # Port, pid, PostgreSQL backend, attachment mode, readiness
2380
- kici local down # Stop the orchestrator and its PostgreSQL, verifying the port is freed
2381
- kici local logs # Print the orchestrator log file path
2382
- kici local attach # Attach to the Platform (hybrid mode)
2383
- kici local detach # Return the plane to offline (independent) mode
2384
- kici local trust-root <file> # Export the dev-signed trust root for offline verification
2385
- ```
2386
-
2387
- The plane runs in one of two modes:
2388
-
2389
- - **Independent (offline)** — the default for a plane that has never been attached. Identity tokens and attestations are signed by a local dev key under the clearly non-production issuer `kici-local`.
2390
- - **Hybrid (attached)** — `kici local attach` mints an org-scoped key with your logged-in credentials and reboots the plane connected to the Platform, so local runs get real Platform-minted identity and attestation. `kici local up` honors a durable attachment record: an attached plane comes back up hybrid, and falls back to offline with a warning when the Platform is unreachable.
2391
-
2392
- `--offline` forces an independent boot without clearing the attachment record (only `detach` clears it); `--connected` requires an attached, reachable Platform and fails otherwise.
2393
-
2394
- `kici local down` reports success only once the plane port is verified free. If a process still holds it — including a plane left behind by an interrupted boot — the command exits non-zero and names the holder, so a failed teardown is never mistaken for a clean one. A holder that does not identify as a KiCI plane orchestrator is reported and left alone, never stopped.
2395
-
2396
- `kici local status` reports a plane whose process is alive but whose readiness probe fails — for example when its PostgreSQL has stopped — as running but not ready, together with its readiness checks, rather than as not running. When the holder is a KiCI plane orchestrator that this config directory did not start — a plane belonging to another `KICI_CONFIG_DIR`, or one whose record here was lost — status names it as such rather than as not ready, since its readiness is never probed, and points at `kici local down`, which does reclaim it. When the port is held by a process that is not a KiCI plane orchestrator, `kici local status` names that holder instead and points at `KICI_LOCAL_ORCH_PORT`, because `kici local down` will not stop it.
2397
-
2398
- Pass `--json` for machine-readable output. It prints one object and exits 0 for
2399
- every state, including when the plane is stopped — the state is in the payload,
2400
- not the exit code:
2401
-
2402
- ```bash
2403
- $ kici local status --json
2404
- {"state":"ready","running":true,"pid":3768093,"port":4319,
2405
- "url":"http://127.0.0.1:4319","pgKind":"embedded","stampVersion":3,
2406
- "mode":"independent"}
2407
- ```
2408
-
2409
- `state` is one of `stopped`, `ready`, `unready`, `foreign-kici`,
2410
- `foreign-unknown`. The key set is fixed: the plane's admin token is never part
2411
- of it, so the output is safe to log. Every key is always present, but only
2412
- `state`, `running` and `mode` always carry a value — the rest are `null`
2413
- whenever the plane cannot supply them (for `stopped` that is all of them, and
2414
- `stampVersion` is populated only for `ready`), so read them defensively
2415
- (`jq -r '.pid // empty'`).
2416
-
2417
- A local run also fails fast when no agent claims it: if no scaler label set matches the job's `runsOn`, or the agent cannot start, the run gives up within a short acceptance window (2 minutes by default, overridable with `KICI_LOCAL_ACCEPTANCE_TIMEOUT_MS`) and names the plane log instead of waiting out the full no-progress timeout.
2418
-
2419
- **Verifying an offline-signed bundle:** export the plane's trust root, then pass it to the verifier:
2420
-
2421
- ```bash
2422
- kici local trust-root ./local-trust-root.json
2423
- kici verify-attestation ./dist/app.tgz \
2424
- --bundle ./app.tgz.kici.json \
2425
- --trust-root ./local-trust-root.json
2426
- ```
2427
-
2428
- For the plane's on-disk layout, port selection, PostgreSQL backends, and reset behavior, see [Local dev plane](https://docs.kici.dev/operator/orchestrator/local-dev-plane/).
2429
-
2430
- ### kici fixture
2431
-
2432
- Generate a fixture template for an event type. Useful for creating custom test payloads.
2433
-
2434
- ```bash
2435
- kici fixture <event> [options]
2436
- ```
2437
-
2438
- **Valid events:** `pr:open`, `pr:sync`, `pr:close`, `pr:reopen`, `push`, `tag`, `comment`, `review`, `review_comment`, `release`, `dispatch`, `create`, `delete`, `status`, `workflow_run`, `fork`, `star`, `watch`, `kici_event`, `workflow_complete`, `workflows_failed_batch`, `job_complete`, `generic_webhook`, `schedule`, `lifecycle` (many support `:action` suffixes, e.g. `comment:edited`, `release:published`, `lifecycle:workflow_complete`). `webhook:<source>` is a shorthand alias for `generic_webhook:<source>`.
2439
-
2440
- **Examples:**
2441
-
2442
- ```bash
2443
- # Print fixture to stdout
2444
- kici fixture pr:open
2445
-
2446
- # Write fixture to file
2447
- kici fixture pr:open --output fixtures/pr-open.json
2448
-
2449
- # Generate push fixture
2450
- kici fixture push --output fixtures/push.json
2451
- ```
2452
-
2453
- Use generated fixtures as reference when writing test fixture files in `.kici/tests/`:
2454
-
2455
- ```bash
2456
- kici fixture pr:open --output fixtures/pr-open-reference.json
2457
- # Use the generated JSON as reference when writing .kici/tests/pr-open.ts
2458
- ```
2459
-
2460
- ### kici types
2461
-
2462
- Generate TypeScript declaration files from orchestrator environment metadata. The generated `.d.ts` file augments the SDK's `KnownSecretKeys` and `ContextSecrets` interfaces, providing compile-time autocomplete and type checking for secret key names.
2463
-
2464
- ```bash
2465
- kici types [options]
2466
- ```
2467
-
2468
- **Prerequisites:** Authenticate via `kici login` to fetch the real key set. Without it, `kici types` writes an empty stub (see "Offline behavior" below).
2469
-
2470
- **Output:** `.kici/types/secrets.d.ts`
2471
-
2472
- **Examples:**
2473
-
2474
- ```bash
2475
- # Generate types from orchestrator
2476
- kici types
2477
-
2478
- # Use custom .kici directory
2479
- kici types --kici-dir packages/app/.kici
2480
- ```
2481
-
2482
- **How it works:**
2483
-
2484
- 1. Fetches all environment metadata (environment names and secret key names) from the orchestrator
2485
- 2. Generates a `.d.ts` file that augments `@kici-dev/sdk`'s `KnownSecretKeys` and `ContextSecrets` interfaces
2486
- 3. Writes the file to `.kici/types/secrets.d.ts`
2487
-
2488
- After generating types, `ctx.secrets.get('MY_KEY')` and `ctx.secrets.expose('DB_HOST')` gain autocomplete and type checking in your IDE.
2489
-
2490
- **Git workflow:** `.kici/types/secrets.d.ts` is a local development aid, not source — its content is a snapshot of one org's secret keys fetched from the Platform. `kici init` gitignores `.kici/types/`, so the file stays out of version control. Each team member runs `kici types` (or an authenticated `kici compile`) to generate their own copy. Do not commit it: a stale committed copy would type-check against secret keys that no longer exist.
2491
-
2492
- **Offline behavior:** When the Platform cannot be reached — not logged in, no active org, or offline — `kici types` never fails. If a `secrets.d.ts` already exists, `kici types` keeps it untouched, so a transient outage does not wipe your real key set. If the file is absent (a fresh clone or unauthenticated CI), `kici types` writes a valid empty stub. Type checking then degrades to "no known keys" (any key name is accepted) rather than breaking with "module has no exported member". Run `kici types` again once authenticated to refresh it.
2493
-
2494
- **Auto-regeneration:** `kici compile` automatically runs `kici types` after successful compilation when authenticated. See the [kici compile](https://docs.kici.dev/user/cli/authoring-and-local/#kici-compile) section for details.
2495
-
2496
- **Escape hatch:** For dynamic keys not in the generated types, use a cast: `(ctx.secrets as any).DYNAMIC_KEY`.
2497
-
2498
- ### kici workflows list
2499
-
2500
- List permanently registered workflows on the orchestrator.
2501
-
2502
- ```bash
2503
- kici workflows list [options]
2504
- ```
2505
-
2506
- **Examples:**
2507
-
2508
- ```bash
2509
- # List all registered workflows
2510
- kici workflows list
2511
-
2512
- # JSON output for scripting
2513
- kici workflows list --json
2514
-
2515
- # Show workflows not updated in 30 days
2516
- kici workflows list --stale 30d
2517
-
2518
- # Filter by trigger type
2519
- kici workflows list --trigger-type push
2520
-
2521
- # Filter by repository
2522
- kici workflows list --repo my-org/my-repo
2523
- ```
2524
-
2525
- ### kici hook install
2526
-
2527
- Install a pre-commit hook that runs `kici compile` before each commit.
2528
-
2529
- ```bash
2530
- kici hook install [options]
2531
- ```
2532
-
2533
- **Examples:**
2534
-
2535
- ```bash
2536
- # Auto-detect hook tool (husky, lint-staged, etc.)
2537
- kici hook install
2538
-
2539
- # Force raw git hook
2540
- kici hook install --git
2541
- ```
2542
-
2543
- The command auto-detects existing hook tools in your project:
2544
-
2545
- - **Husky**: Adds to `.husky/pre-commit`
2546
- - **lint-staged**: Adds to lint-staged configuration
2547
- - **Raw git**: Writes `.git/hooks/pre-commit`
2548
-
2549
- If multiple tools are detected, you are prompted to choose.
2550
-
2551
- ### kici docs
2552
-
2553
- Open the KiCI documentation site in the default browser. With the `llm` subcommand, print the LLM-friendly documentation bundle that ships with `@kici-dev/compiler` — pipe it into a coding agent's context buffer to brief the agent on authoring conventions without an internet round-trip.
2554
-
2555
- ```bash
2556
- kici docs # open https://kici.dev/docs/
2557
- kici docs --no-open # print the URL instead of opening a browser
2558
- kici docs llm # print the llms.txt index (a router over the task bundles)
2559
- kici docs llm sdk # print the SDK task bundle
2560
- kici docs llm full # print llms-full.txt (every page in one file)
2561
- kici docs llm sdk --out sdk-context.md # write a bundle to a file
2562
- ```
2563
-
2564
- **Examples:**
2565
-
2566
- ```bash
2567
- # Open the docs site in your browser
2568
- kici docs
2569
-
2570
- # Pipe just the SDK bundle into a coding agent (small, task-scoped context)
2571
- kici docs llm sdk | claude -- "Read this and help me author a deploy workflow"
2572
-
2573
- # Save the router index for offline reference
2574
- kici docs llm --out kici-llms-index.txt
2575
- ```
2576
-
2577
- Bundles are regenerated from `docs/` every time `@kici-dev/compiler` is built, so they always match your installed CLI version. The index lists each task bundle — `getting-started`, `sdk`, `sdk-runtime`, `cli`, `patterns`, `features`, `features-execution`, `providers`, `architecture` — with its size and a one-line purpose; pass the bundle id as the topic. Every cross-reference link inside a bundle is an absolute `docs.kici.dev` URL. The same files are published online following the [llms.txt convention](https://llmstxt.org/).
2578
-
2579
- ## Reference
2580
-
2581
- <!-- BEGIN GENERATED: kici-authoring-and-local (do not edit; run the doc generator) -->
2582
-
2583
- ### `kici compile`
2584
-
2585
- Compile workflows from .kici/workflows/ to kici.lock.json
2586
-
2587
- Synopsis: `kici compile [options]`
2588
-
2589
- **Options**
2590
-
2591
- | Option | Default | Description |
2592
- | ------------------- | ------- | ---------------------------------------------------------------------------------- |
2593
- | `--check` | `false` | Validate workflows and type-check sources (tsc --noEmit) without writing lock file |
2594
- | `--kici-dir <path>` | `.kici` | Path to .kici directory |
2595
- | `--verbose` | `false` | Detailed output |
2596
- | `--watch` | `false` | Watch for changes and recompile |
2597
-
2598
- ### `kici docs`
2599
-
2600
- Open the KiCI documentation site in the default browser
2601
-
2602
- Synopsis: `kici docs [options]`
2603
-
2604
- **Options**
2605
-
2606
- | Option | Default | Description |
2607
- | ----------- | ------- | ----------------------------------------------- |
2608
- | `--no-open` | | Print the docs URL instead of opening a browser |
2609
-
2610
- ### `kici docs llm`
2611
-
2612
- Print KiCI LLM docs bundles. No topic prints the llms.txt index; <topic> prints a task bundle (e.g. sdk, cli, patterns, features, providers, architecture, getting-started); "full" prints the complete bundle.
2613
-
2614
- Synopsis: `kici docs llm [topic] [options]`
2615
-
2616
- **Arguments**
2617
-
2618
- | Argument | Required | Variadic | Description |
2619
- | -------- | -------- | -------- | ----------- |
2620
- | `topic` | no | no | |
2621
-
2622
- **Options**
2623
-
2624
- | Option | Default | Description |
2625
- | -------------- | ------- | -------------------------------------------- |
2626
- | `--out <path>` | | Write the bundle to a file instead of stdout |
2627
-
2628
- ### `kici fixture`
2629
-
2630
- Generate fixture template for event type
2631
-
2632
- Synopsis: `kici fixture <event> [options]`
2633
-
2634
- **Arguments**
2635
-
2636
- | Argument | Required | Variadic | Description |
2637
- | -------- | -------- | -------- | ------------------------------------------------------------------------------------------ |
2638
- | `event` | yes | no | Event to generate fixture for (e.g., pr:open, push, schedule, lifecycle:workflow_complete) |
2639
-
2640
- **Options**
2641
-
2642
- | Option | Default | Description |
2643
- | ----------------- | ------- | ------------------------------- |
2644
- | `--output <path>` | | Write to file instead of stdout |
2645
-
2646
- ### `kici hook`
2647
-
2648
- Manage pre-commit hooks
2649
-
2650
- Synopsis: `kici hook`
2651
-
2652
- ### `kici hook install`
2653
-
2654
- Install kici compile pre-commit hook
2655
-
2656
- Synopsis: `kici hook install [options]`
2657
-
2658
- **Options**
2659
-
2660
- | Option | Default | Description |
2661
- | ------- | ------- | ---------------------------------------- |
2662
- | `--git` | `false` | Use raw git hook (.git/hooks/pre-commit) |
2663
-
2664
- ### `kici local`
2665
-
2666
- Manage the local dev orchestrator plane
2667
-
2668
- Synopsis: `kici local`
2669
-
2670
- ### `kici local attach`
2671
-
2672
- Attach the local dev plane to the Platform (hybrid)
2673
-
2674
- Synopsis: `kici local attach`
2675
-
2676
- ### `kici local detach`
2677
-
2678
- Detach the local dev plane from the Platform (offline)
2679
-
2680
- Synopsis: `kici local detach`
2681
-
2682
- ### `kici local down`
2683
-
2684
- Stop the local dev plane
2685
-
2686
- Synopsis: `kici local down`
2687
-
2688
- ### `kici local logs`
2689
-
2690
- Print the local dev plane orchestrator log path
2691
-
2692
- Synopsis: `kici local logs`
2693
-
2694
- ### `kici local status`
2695
-
2696
- Show local dev plane status and control commands
2697
-
2698
- Synopsis: `kici local status [options]`
2699
-
2700
- **Options**
2701
-
2702
- | Option | Default | Description |
2703
- | -------- | ------- | ---------------------------------------------------- |
2704
- | `--json` | `false` | Emit machine-readable JSON (exits 0 for every state) |
2705
-
2706
- ### `kici local trust-root`
2707
-
2708
- Export the offline dev-signed identity trust root ({ issuer, jwks }) to a file
2709
-
2710
- Synopsis: `kici local trust-root <file>`
2711
-
2712
- **Arguments**
2713
-
2714
- | Argument | Required | Variadic | Description |
2715
- | -------- | -------- | -------- | ---------------------------------------------------- |
2716
- | `file` | yes | no | Output path for the { issuer, jwks } trust-root JSON |
2717
-
2718
- ### `kici local up`
2719
-
2720
- Start (or reuse) the local dev plane
2721
-
2722
- Synopsis: `kici local up [options]`
2723
-
2724
- **Options**
2725
-
2726
- | Option | Default | Description |
2727
- | ------------- | ------- | ---------------------------------------------------------------------------- |
2728
- | `--offline` | `false` | Force the independent (offline) plane (does not clear the attachment record) |
2729
- | `--connected` | `false` | Force the connected/hybrid plane (requires an attached, reachable Platform) |
2730
-
2731
- ### `kici preview`
2732
-
2733
- Preview which workflows match a trigger event (no execution)
2734
-
2735
- Synopsis: `kici preview [event] [options]`
2736
-
2737
- **Arguments**
2738
-
2739
- | Argument | Required | Variadic | Description |
2740
- | -------- | -------- | -------- | ----------------------------------------------------- |
2741
- | `event` | no | no | Event type to preview (e.g., push, pr:open, schedule) |
2742
-
2743
- **Options**
2744
-
2745
- | Option | Default | Description |
2746
- | --------------------------- | ------- | ------------------------------------------------------------ |
2747
- | `--branch <name>` | | Override target branch for trigger matching (default: main) |
2748
- | `--sha <hash>` | | Override commit SHA |
2749
- | `--workflow <name>` | | Filter to specific workflow in display |
2750
- | `--job <name>` | | Filter to specific job in display |
2751
- | `--debug` | `false` | Verbose internals |
2752
- | `--kici-dir <path>` | `.kici` | Path to .kici directory |
2753
- | `--files <path>` | | Simulate changed file path for trigger matching (repeatable) |
2754
- | `--secret <key=value>` | | Inject flat secret (repeatable) |
2755
- | `--context <ctx.key=value>` | | Inject context secret (repeatable) |
2756
-
2757
- ### `kici types`
2758
-
2759
- Generate TypeScript declarations for secret contexts
2760
-
2761
- Synopsis: `kici types [options]`
2762
-
2763
- **Options**
2764
-
2765
- | Option | Default | Description |
2766
- | ------------------- | ------- | ----------------------- |
2767
- | `--kici-dir <path>` | `.kici` | Path to .kici directory |
2768
-
2769
- ### `kici workflows`
2770
-
2771
- Manage workflow registrations
2772
-
2773
- Synopsis: `kici workflows`
2774
-
2775
- ### `kici workflows list`
2776
-
2777
- List permanently registered workflows
2778
-
2779
- Synopsis: `kici workflows list [options]`
2780
-
2781
- **Options**
2782
-
2783
- | Option | Default | Description |
2784
- | ----------------------- | ------- | ------------------------------------------ |
2785
- | `--json` | `false` | Output as JSON |
2786
- | `--stale <duration>` | | Filter stale registrations (e.g., 30d, 7d) |
2787
- | `--trigger-type <type>` | | Filter by trigger type |
2788
- | `--repo <repo>` | | Filter by repository |
2789
-
2790
- <!-- END GENERATED: kici-authoring-and-local -->
2791
-
2792
- ---
2793
-
2794
- ## kici: notifications & diagnostics
2795
-
2796
- Source: https://docs.kici.dev/user/cli/notifications-and-diagnostics/
2797
-
2798
- ## Guide
2799
-
2800
- ### kici notifications
2801
-
2802
- Manage your organization's notification configuration — channels, subscriptions, and the Slack-identity roster — programmatically, under your PAT against the hosted Platform's org-scoped API. Requires a PAT (run `kici login` first) and an active org (`kici org use <name>`, or pass `--org <id>` to any subcommand). These are the same operations the dashboard Notifications tab performs.
2803
-
2804
- Every `list` supports `--json` for machine-readable output.
2805
-
2806
- #### kici notifications channels
2807
-
2808
- Manage the destinations a notification is delivered to (Slack or email).
2809
-
2810
- ```bash
2811
- # List channels
2812
- kici notifications channels list
2813
- kici notifications channels list --json
2814
-
2815
- # Add a Slack channel
2816
- kici notifications channels add --type slack --name "alerts" \
2817
- --connection <connectionId> --slack-channel <slackChannelId>
2818
-
2819
- # Add an email channel
2820
- kici notifications channels add --type email --name "email" \
2821
- --from-name "KiCI CI" --reply-to ci@example.com
2822
-
2823
- # Remove a channel
2824
- kici notifications channels remove <channelId>
2825
- ```
2826
-
2827
- #### kici notifications subscriptions
2828
-
2829
- Manage which runs notify which channel, with optional literal `--mentions` and digest accumulation.
2830
-
2831
- ```bash
2832
- # List subscriptions
2833
- kici notifications subscriptions list
2834
-
2835
- # Notify a channel on any failure across the org
2836
- kici notifications subscriptions add --channel <channelId> --on-status failed
2837
-
2838
- # Scope to a repo, mention people, and accumulate a digest over 30s
2839
- kici notifications subscriptions add --channel <channelId> \
2840
- --on-status failed --repo-glob 'my-org/*' \
2841
- --mentions U012ABCDEF,U345GHIJKL --accumulate-for 30000
2842
-
2843
- # Remove a subscription
2844
- kici notifications subscriptions remove <subscriptionId>
2845
- ```
2846
-
2847
- Key options for `add`: `--level <run|job>` (default `run`), `--scope <org|team|user|actor>` (default `org`; `--scope-id` is required for `team`/`user`), `--on-status <csv>` (required), `--repo-glob` / `--workflow-glob` / `--job-glob`, `--mentions <csv>`, `--recipient-override <csv>`, `--on-failure-class <csv>`, `--accumulate-for <ms>`.
2848
-
2849
- #### kici notifications roster
2850
-
2851
- Manage the Slack-identity roster used for best-effort actor tagging — mapping the person who triggered a run to a Slack member id.
2852
-
2853
- `roster add` requires the `notifications:admin` permission — it is the admin editor for the shared roster. To connect **your own** Slack account (no admin needed), use **Connect Slack** on the dashboard's personal Notifications tab, which runs Sign in with Slack; there is no CLI equivalent because the flow is browser-based.
2854
-
2855
- ```bash
2856
- # List roster entries
2857
- kici notifications roster list
2858
-
2859
- # Admin: map a contributor to their Slack member id (by id, email, or @handle)
2860
- kici notifications roster add --connection <connectionId> \
2861
- --subject-kind git_login --subject octocat \
2862
- --input-form email --value octocat@example.com
2863
-
2864
- # Remove a roster entry (admins; or your own connected entry)
2865
- kici notifications roster remove <entryId>
2866
- ```
2867
-
2868
- ### kici verify-attestation
2869
-
2870
- Verify a KiCI build-provenance attestation bundle offline. A bundle is the signed package a workflow step produces via `ctx.attestProvenance(...)`: a DSSE-wrapped SLSA in-toto statement, the ephemeral public key that signed it, and the KiCI identity token that anchors the build context. For the end-to-end attest → verify → view journey, see the [build provenance guide](https://docs.kici.dev/user/provenance/). Verification establishes the full chain — the identity token verifies against the trusted issuer's JWKS, the DSSE signature verifies against the bundled key, and the statement's build context must match the token's claims (a mismatch is a hard failure). When an `[artifact]` is given, its SHA-256 digest is also matched against the attestation subject.
2871
-
2872
- On success the output prints the **origin org** (the customer's public org id — the authoritative "who built this" the platform vouches for) and a **source marker**. A `kici run remote` attestation is flagged unmistakably: its `repository`/`ref`/`sha` are caller-supplied from a local working-tree overlay, not a triggered VCS commit, so a verifier must treat those coordinates as org-asserted rather than VCS-verified. A normal triggered run carries the ordinary `triggered` source marker. See the [build provenance guide](https://docs.kici.dev/user/provenance/) for the full trust model.
2873
-
2874
- ```bash
2875
- kici verify-attestation [artifact] --bundle <path-or-url> [--trust-root <url-or-file>] [options]
2876
- ```
2877
-
2878
- **Trust root:** `--trust-root` defaults to your **configured orchestrator** — the orchestrator you `kici login` against, which owns the provenance signing key and publishes its own JWKS (see [Which trust root do I use?](https://docs.kici.dev/user/provenance/#which-trust-root-do-i-use)), so the common case needs no flag. When no orchestrator is configured, the default falls back to the hosted KiCI platform's provenance issuer so historical platform-signed bundles still verify. The verifier never trusts the issuer named inside the token; supplying it out-of-band is what prevents a forged bundle from self-attesting. To override the default, pass `--trust-root` in one of two forms:
2879
-
2880
- - **Online — an HTTPS issuer URL.** The verifier fetches `<url>/.well-known/openid-configuration`, reads its `issuer` and `jwks_uri`, and fetches the JWKS. The token's `iss` is pinned to the discovery document's `issuer`.
2881
- - **Offline — a self-contained trust-root file.** A local JSON file with the issuer and JWKS inlined, so no network access is needed (air-gapped verification):
2882
-
2883
- ```json
2884
- {
2885
- "issuer": "https://platform.example/issuer",
2886
- "jwks": {
2887
- "keys": [
2888
- { "kty": "EC", "crv": "P-256", "x": "...", "y": "...", "alg": "ES256", "kid": "..." }
2889
- ]
2890
- }
2891
- }
2892
- ```
2893
-
2894
- **Examples:**
2895
-
2896
- ```bash
2897
- # Default: verify against your configured orchestrator (no --trust-root needed)
2898
- kici verify-attestation ./dist/app.tgz --bundle ./app.tgz.kici.json
2899
-
2900
- # Override: verify a bundle against a specific issuer, digest-checking the artifact
2901
- kici verify-attestation ./dist/app.tgz \
2902
- --bundle ./app.tgz.kici.json \
2903
- --trust-root https://platform.example/issuer
2904
-
2905
- # Offline / air-gapped: verify against a self-contained trust-root file
2906
- kici verify-attestation ./dist/app.tgz \
2907
- --bundle ./app.tgz.kici.json \
2908
- --trust-root ./kici-trust-root.json
2909
-
2910
- # Machine-readable result for scripting
2911
- kici verify-attestation --bundle ./app.tgz.kici.json \
2912
- --trust-root https://platform.example/issuer --json
2913
- ```
2914
-
2915
- **Attestation origin marker.** On a PASS, the command surfaces when the identity
2916
- token was minted relative to the build. A normal attestation prints no marker
2917
- (the token was minted live). A **deferred** attestation prints an `ATTESTATION:
2918
- deferred` line — the build facts were sealed at build time and the token was
2919
- minted later, after a transient platform outage, bound to the frozen statement
2920
- by its hash. An **offline-backfill** attestation prints an `ATTESTATION:
2921
- offline-backfill` line — the run was ingested while the platform was down, so its
2922
- run/job rows were backfilled before the token was minted. Both still verify
2923
- (PASS); the marker discloses the temporal gap, and the organization id remains
2924
- the authoritative anchor.
2925
-
2926
- **Exit codes:**
2927
-
2928
- | Code | Meaning |
2929
- | ---- | ----------------------------------------------------------------------------------------- |
2930
- | 0 | Verified — signature, identity, build context (and digest, if checked) all pass |
2931
- | 1 | Not verified, or an error (missing `--bundle`, unreadable bundle, unreachable trust root) |
2932
-
2933
- ### kici diagnostics
2934
-
2935
- Show the orchestrators, scalers, and agents serving your organization — the
2936
- terminal equivalent of the dashboard Infrastructure page. Reads the same
2937
- org-scoped data the dashboard does, so it needs `kici login` and an active org
2938
- (`kici org use <name>`).
2939
-
2940
- The output has three parts: a one-line header (runs in the last 24h, success
2941
- rate, average duration, queued/running job counts), any infrastructure alerts
2942
- (only shown when present), and a tree of each orchestrator with its scalers and
2943
- agents. Each agent line shows its labels, platform/architecture, active/maximum
2944
- concurrency, and heartbeat age.
2945
-
2946
- Alert lines are colored by severity — yellow for `warning`, red for `critical`.
2947
- A severity this build does not recognize is colored red, so an alert from a
2948
- newer Platform is never shown as less urgent than it might be.
2949
-
2950
- ```bash
2951
- kici diagnostics [options]
2952
- ```
2953
-
2954
- **Examples:**
2955
-
2956
- ```bash
2957
- # Show the full infrastructure tree
2958
- kici diagnostics
2959
-
2960
- # Extended per-agent detail
2961
- kici diagnostics --verbose
2962
-
2963
- # Only one orchestrator's scalers and agents
2964
- kici diagnostics --orchestrator conn-abc123
2965
-
2966
- # Machine-readable output
2967
- kici diagnostics --json
2968
- ```
2969
-
2970
- ### kici doctor
2971
-
2972
- Walk your KiCI setup end to end and print the exact next command for each
2973
- problem found. Where `kici diagnostics` shows the org's infrastructure, `kici
2974
- doctor` checks **your own setup**: it runs six checks in onboarding order —
2975
- login (stored, unexpired credentials), active organization, a present, fresh,
2976
- and committed lock file, a live token probe against the platform, a connected
2977
- orchestrator for the org, and whether every workflow's `runsOn` labels are
2978
- satisfiable by a connected agent or scaler. Each check reports pass/warn/fail
2979
- with the fix command (e.g. `kici login`, `kici org use <name>`,
2980
- `kici compile`), so the first failing row tells you exactly what to run next.
2981
-
2982
- ```bash
2983
- kici doctor [options]
2984
- ```
2985
-
2986
- **Examples:**
2987
-
2988
- ```bash
2989
- # Diagnose the full setup
2990
- kici doctor
2991
-
2992
- # Machine-readable result for scripting
2993
- kici doctor --json
2994
- ```
2995
-
2996
- The command exits `0` when every check passes, `1` when any check warns, and
2997
- `2` when any check fails, so it also works as a CI preflight.
2998
-
2999
- ### kici report
3000
-
3001
- Gather a diagnostic bundle to share when you report a problem. `kici doctor`
3002
- tells you what is wrong; `kici report` packages the context somebody else needs
3003
- to see it. The bundle holds your CLI, Node and orchestrator versions, your
3004
- redacted configuration, and your project's workflow and lock-file state. With
3005
- `--run` it also holds the failing run's detail and logs.
3006
-
3007
- ```bash
3008
- kici report [options]
3009
- ```
3010
-
3011
- The command writes a ZIP and prints its path and `sha256`. It does not send
3012
- anything. Open the file and read it before you share it.
3013
-
3014
- ```bash
3015
- # Bundle your setup
3016
- kici report
3017
-
3018
- # Scope it to the run that failed, and say what went wrong
3019
- kici report --run 8f3c1d2e --message "matrix job hangs on macOS"
3020
-
3021
- # Choose the output path and attach your own metadata
3022
- kici report -o /tmp/bug.zip --metadata ticket=1234 --metadata severity=high
3023
- ```
3024
-
3025
- **Redaction.** KiCI removes known secret shapes — API keys, tokens, `Authorization`
3026
- headers, private keys, passwords in connection URLs — from configuration and
3027
- from log text. This is best effort. A secret in a format KiCI does not
3028
- recognize can survive, so review the bundle before you share it. `--no-redact`
3029
- turns redaction off and prints a warning; use it only on a bundle you keep.
3030
-
3031
- **Sending it privately.** Add `--upload` to send the bundle to KiCI over a
3032
- one-time upload link. The bundle goes straight to KiCI storage, and the command
3033
- prints a reference id to quote:
3034
-
3035
- ```bash
3036
- kici report --run 8f3c1d2e --upload --message "matrix job hangs on macOS"
3037
- ```
3038
-
3039
- Uploads are private, are kept for 90 days, and are yours to withdraw:
3040
-
3041
- ```bash
3042
- # See what you have sent
3043
- kici report list
3044
-
3045
- # Delete an uploaded bundle
3046
- kici report withdraw <ref>
3047
- ```
3048
-
3049
- Anyone in your organization can upload a report. By default you see and
3050
- withdraw your own; a member with the `support:admin` permission can manage
3051
- every report in the organization.
3052
-
3053
- ## Reference
3054
-
3055
- <!-- BEGIN GENERATED: kici-notifications-and-diagnostics (do not edit; run the doc generator) -->
3056
-
3057
- ### `kici diagnostics`
3058
-
3059
- Show orchestrators, scalers, and agents (mirrors the dashboard Infrastructure page)
3060
-
3061
- Synopsis: `kici diagnostics [options]`
3062
-
3063
- **Options**
3064
-
3065
- | Option | Default | Description |
3066
- | --------------------- | ------- | ----------------------------------- |
3067
- | `--json` | `false` | Output raw JSON |
3068
- | `--verbose` | `false` | Show extended per-agent fields |
3069
- | `--orchestrator <id>` | | Scope the tree to one connection id |
3070
-
3071
- ### `kici doctor`
3072
-
3073
- Diagnose your KiCI setup and print the exact next command for each problem
3074
-
3075
- Synopsis: `kici doctor [options]`
3076
-
3077
- **Options**
3078
-
3079
- | Option | Default | Description |
3080
- | ------------------- | ------- | ---------------------------------- |
3081
- | `--json` | `false` | Output raw JSON instead of a table |
3082
- | `--kici-dir <path>` | `.kici` | Path to the .kici directory |
3083
-
3084
- ### `kici notifications`
3085
-
3086
- Manage the org's notification channels, subscriptions, and Slack roster
3087
-
3088
- Synopsis: `kici notifications`
3089
-
3090
- ### `kici notifications channels`
3091
-
3092
- Manage notification channels (Slack / email)
3093
-
3094
- Synopsis: `kici notifications channels`
3095
-
3096
- ### `kici notifications channels add`
3097
-
3098
- Add a notification channel
3099
-
3100
- Synopsis: `kici notifications channels add [options]`
3101
-
3102
- **Options**
3103
-
3104
- | Option | Default | Description |
3105
- | ---------------------- | ------- | ---------------------------------------------- |
3106
- | `--type <slack | email>` | | Channel transport type |
3107
- | `--name <name>` | | Channel display name |
3108
- | `--connection <id>` | | Slack connection id (slack channels) |
3109
- | `--slack-channel <id>` | | Slack channel id (slack channels) |
3110
- | `--from-name <name>` | | Sender name (email channels) |
3111
- | `--reply-to <email>` | | Reply-to address (email channels) |
3112
- | `--org <id>` | | Target organization (overrides the active org) |
3113
-
3114
- ### `kici notifications channels list`
3115
-
3116
- List notification channels
3117
-
3118
- Synopsis: `kici notifications channels list [options]`
3119
-
3120
- **Options**
3121
-
3122
- | Option | Default | Description |
3123
- | ------------ | ------- | ---------------------------------------------- |
3124
- | `--org <id>` | | Target organization (overrides the active org) |
3125
- | `--json` | | Output as JSON |
3126
-
3127
- ### `kici notifications channels remove`
3128
-
3129
- Remove a notification channel
3130
-
3131
- Synopsis: `kici notifications channels remove <id> [options]`
3132
-
3133
- **Arguments**
3134
-
3135
- | Argument | Required | Variadic | Description |
3136
- | -------- | -------- | -------- | ----------- |
3137
- | `id` | yes | no | Channel id |
3138
-
3139
- **Options**
3140
-
3141
- | Option | Default | Description |
3142
- | ------------ | ------- | ---------------------------------------------- |
3143
- | `--org <id>` | | Target organization (overrides the active org) |
3144
-
3145
- ### `kici notifications roster`
3146
-
3147
- Manage the Layer 1 Slack-identity roster (actor tagging)
3148
-
3149
- Synopsis: `kici notifications roster`
3150
-
3151
- ### `kici notifications roster add`
3152
-
3153
- Add a Slack-identity roster entry
3154
-
3155
- Synopsis: `kici notifications roster add [options]`
3156
-
3157
- **Options**
3158
-
3159
- | Option | Default | Description |
3160
- | -------------------------------- | --------- | ---------------------------------------------- |
3161
- | `--connection <id>` | | Slack connection id |
3162
- | `--subject-kind <kici_user | git_login | email>` | | What the subject keys on |
3163
- | `--subject <value>` | | The KiCI user sub, git login, or email |
3164
- | `--value <slackIdEmailOrHandle>` | | Slack member id, email, or @handle |
3165
- | `--input-form <id | username | email>` | `id` | How --value should be resolved |
3166
- | `--org <id>` | | Target organization (overrides the active org) |
3167
-
3168
- ### `kici notifications roster list`
3169
-
3170
- List Slack-identity roster entries
3171
-
3172
- Synopsis: `kici notifications roster list [options]`
3173
-
3174
- **Options**
3175
-
3176
- | Option | Default | Description |
3177
- | ------------ | ------- | ---------------------------------------------- |
3178
- | `--org <id>` | | Target organization (overrides the active org) |
3179
- | `--json` | | Output as JSON |
3180
-
3181
- ### `kici notifications roster remove`
3182
-
3183
- Remove a Slack-identity roster entry
3184
-
3185
- Synopsis: `kici notifications roster remove <id> [options]`
3186
-
3187
- **Arguments**
3188
-
3189
- | Argument | Required | Variadic | Description |
3190
- | -------- | -------- | -------- | --------------- |
3191
- | `id` | yes | no | Roster entry id |
3192
-
3193
- **Options**
3194
-
3195
- | Option | Default | Description |
3196
- | ------------ | ------- | ---------------------------------------------- |
3197
- | `--org <id>` | | Target organization (overrides the active org) |
3198
-
3199
- ### `kici notifications subscriptions`
3200
-
3201
- Manage notification subscriptions
3202
-
3203
- Synopsis: `kici notifications subscriptions`
3204
-
3205
- ### `kici notifications subscriptions add`
3206
-
3207
- Add a notification subscription
3208
-
3209
- Synopsis: `kici notifications subscriptions add [options]`
3210
-
3211
- **Options**
3212
-
3213
- | Option | Default | Description |
3214
- | ---------------------------- | ------- | --------------------------------------------------- |
3215
- | `--channel <id>` | | Target channel id |
3216
- | `--on-status <csv>` | | Statuses to notify on (e.g. failed,success) |
3217
- | `--level <run | job>` | `run` | Subscription granularity |
3218
- | `--scope <org | team | user | actor>` | `org` | Subscription scope |
3219
- | `--scope-id <id>` | | Scope id (required for team/user scope) |
3220
- | `--repo-glob <glob>` | | Match runs whose repo matches this glob |
3221
- | `--workflow-glob <glob>` | | Match runs whose workflow matches this glob |
3222
- | `--job-glob <glob>` | | Match jobs matching this glob (job level) |
3223
- | `--mentions <csv>` | | Literal Slack member/group ids or emails to mention |
3224
- | `--recipient-override <csv>` | | Override the email recipient set |
3225
- | `--on-failure-class <csv>` | | Only match these failure classes |
3226
- | `--accumulate-for <ms>` | | Digest accumulation window in milliseconds |
3227
- | `--org <id>` | | Target organization (overrides the active org) |
3228
-
3229
- ### `kici notifications subscriptions list`
3230
-
3231
- List notification subscriptions
3232
-
3233
- Synopsis: `kici notifications subscriptions list [options]`
3234
-
3235
- **Options**
3236
-
3237
- | Option | Default | Description |
3238
- | ------------ | ------- | ---------------------------------------------- |
3239
- | `--org <id>` | | Target organization (overrides the active org) |
3240
- | `--json` | | Output as JSON |
3241
-
3242
- ### `kici notifications subscriptions remove`
3243
-
3244
- Remove a notification subscription
3245
-
3246
- Synopsis: `kici notifications subscriptions remove <id> [options]`
3247
-
3248
- **Arguments**
3249
-
3250
- | Argument | Required | Variadic | Description |
3251
- | -------- | -------- | -------- | --------------- |
3252
- | `id` | yes | no | Subscription id |
3253
-
3254
- **Options**
3255
-
3256
- | Option | Default | Description |
3257
- | ------------ | ------- | ---------------------------------------------- |
3258
- | `--org <id>` | | Target organization (overrides the active org) |
3259
-
3260
- ### `kici report`
3261
-
3262
- Gather a redacted diagnostic bundle to share when reporting an issue
3263
-
3264
- Synopsis: `kici report [options]`
3265
-
3266
- **Options**
3267
-
3268
- | Option | Default | Description |
3269
- | ------------------------ | ------- | ------------------------------------------------------------ |
3270
- | `--run <id>` | | Scope the bundle to a failing run |
3271
- | `-o, --output <path>` | | Where to write the bundle ZIP |
3272
- | `--metadata <key=value>` | | Attach metadata (repeatable) |
3273
- | `--no-redact` | | Do NOT redact secrets (prints a loud warning) |
3274
- | `--upload` | | Upload the bundle privately to KiCI and print a reference id |
3275
- | `--message <text>` | | Describe the problem (sent with --upload) |
3276
- | `--email <address>` | | Contact address for follow-up (sent with --upload) |
3277
- | `--kici-dir <path>` | `.kici` | Path to the .kici directory |
3278
-
3279
- ### `kici report list`
3280
-
3281
- List the issue reports you have uploaded
3282
-
3283
- Synopsis: `kici report list [options]`
3284
-
3285
- **Options**
3286
-
3287
- | Option | Default | Description |
3288
- | -------- | ------- | --------------- |
3289
- | `--json` | `false` | Output raw JSON |
3290
-
3291
- ### `kici report withdraw`
3292
-
3293
- Withdraw an uploaded report and delete its bundle
3294
-
3295
- Synopsis: `kici report withdraw <ref>`
3296
-
3297
- **Arguments**
3298
-
3299
- | Argument | Required | Variadic | Description |
3300
- | -------- | -------- | -------- | -------------------------------------- |
3301
- | `ref` | yes | no | Reference id of the report to withdraw |
3302
-
3303
- ### `kici verify-attestation`
3304
-
3305
- Verify a KiCI provenance attestation bundle offline
3306
-
3307
- Synopsis: `kici verify-attestation [artifact] [options]`
3308
-
3309
- **Arguments**
3310
-
3311
- | Argument | Required | Variadic | Description |
3312
- | ---------- | -------- | -------- | ------------------------------------------------------------------------ |
3313
- | `artifact` | no | no | Artifact path to digest-check against the attestation subject (optional) |
3314
-
3315
- **Options**
3316
-
3317
- | Option | Default | Description |
3318
- | ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
3319
- | `--bundle <path>` | | Path or URL to the attestation bundle JSON |
3320
- | `--trust-root <url-or-file>` | | Trusted issuer URL, or a self-contained { issuer, jwks } file (default: your configured orchestrator, else the hosted KiCI platform) |
3321
- | `--audience <aud>` | | Expected token audience |
3322
- | `--json` | `false` | Output structured JSON result |
3323
-
3324
- <!-- END GENERATED: kici-notifications-and-diagnostics -->
3325
-
3326
- ---
3327
-
3328
- ## kici: runs & approvals
3329
-
3330
- Source: https://docs.kici.dev/user/cli/runs-and-approvals/
3331
-
3332
- ## Guide
3333
-
3334
- ### kici run
3335
-
3336
- Execute workflows locally or remotely. A bare `kici run [event]` performs a real routed run with this machine as the ephemeral agent; the `remote` subcommand runs fixtures through an orchestrator.
3337
-
3338
- #### kici run <event> --local
3339
-
3340
- Run a workflow on this machine as a real routed dispatch. `kici run <event> --local` compiles your workflows, matches triggers against the specified event, expands matrices, and executes the matched jobs — this machine joins as an ephemeral agent through the warm local dev plane. No orchestrator deployment is required.
3341
-
3342
- `kici run local` (the old direct-execution subcommand) is retired: every run is now a real routed dispatch. Invoking `kici run local <event>` prints a hint pointing at `kici run <event> --local` and exits without running.
3343
-
3344
- ```bash
3345
- kici run [event] --local [options]
3346
- ```
3347
-
3348
- **Concurrency enforcement:**
3349
-
3350
- A local run is a real routed dispatch, so a workflow's `concurrency` block is enforced by the local dev plane's own orchestrator — the same machinery a deployed orchestrator uses:
3351
-
3352
- - The `group` callback is evaluated agent-side against the simulated event (the same `{ branch, event }` context the agent sees), and the resulting key is reported back to the plane's orchestrator before steps execute.
3353
- - `cancelInProgress: true` supersedes the older run in the group; `false` queues the newer run behind it.
3354
-
3355
- Coordination is scoped to that plane, whose state lives under `~/.kici/local/` — so enforcement is per-machine and per-user, and running the same workflow on two different machines does not serialize across them. That requires a deployed orchestrator.
3356
-
3357
- **Execution isolation:**
3358
-
3359
- By default, `kici run <event> --local` executes steps inside an **isolated tmp checkout** rather than against your real working directory. Any file a step writes, builds, or deletes — and any `git` mutation a step performs — lands in that throwaway copy, so casual local runs never touch your tree.
3360
-
3361
- What gets materialized into the isolated checkout has full parity with what `kici run remote` reconstructs: your current working tree minus gitignored files, with `.kiciignore` applied to local changes, over a real `.git` directory. Concretely, the checkout is built from a clone pinned to your current `HEAD`, with your local overlay (modified, staged, and untracked-but-not-ignored files) copied on top and locally-deleted files removed. Workflows that read git metadata work because the `.git` directory is present and pinned to your `HEAD`.
3362
-
3363
- The checkout is a fresh temp directory named `kici-local-run-<random>` under the system temp directory (for example, `/tmp/kici-local-run-ab12cd`).
3364
-
3365
- Cleanup policy:
3366
-
3367
- - The isolated checkout is removed when the run finishes, whether it succeeded or failed.
3368
- - A hard process death (SIGKILL, OOM kill) skips that cleanup. Leftovers older than a day are swept by the agent's own startup garbage collection, which every `kici run <event> --local` invocation triggers.
3369
-
3370
- Set the `KICI_TMPDIR` environment variable to place the isolated checkout (and every other KiCI-created temp directory) under a base directory other than the system temp directory.
3371
-
3372
- Secrets are always sourced from your real `.kici/` directory, not from the isolated checkout. Gitignored secret files (such as `.kici/.env.local` and `.kici/secrets.yaml`) are never copied into the checkout, so a step that reads a secret still gets it from the original location.
3373
-
3374
- Pass `--in-place` to run against the real working directory instead — useful when you explicitly want in-tree execution. `--in-place` requires no git repository; the default isolated mode does, and fails with an actionable error pointing at `--in-place` when the directory is not a git repository.
3375
-
3376
- **Examples:**
3377
-
3378
- ```bash
3379
- # Run workflows matching a push event on this machine
3380
- kici run push --local
3381
-
3382
- # Run a pull-request-open workflow locally
3383
- kici run pr:open --local
3384
-
3385
- # Reuse the working tree instead of an isolated clone
3386
- kici run push --local --in-place
3387
-
3388
- # Force the throwaway/offline plane
3389
- kici run push --local --offline
3390
-
3391
- # Environment variable overrides
3392
- kici run push --local --env NODE_ENV=test --env CI=true
3393
-
3394
- # Quiet mode (summary only, no streaming)
3395
- kici run push --local --quiet
3396
- ```
3397
-
3398
- **Exit codes:**
3399
-
3400
- | Code | Meaning |
3401
- | ---- | ----------------------- |
3402
- | 0 | All workflows succeeded |
3403
- | 1 | One or more jobs failed |
3404
-
3405
- #### kici run remote
3406
-
3407
- Execute fixtures remotely through the full CI pipeline. Fixtures are defined in `.kici/tests/*.ts` using the `fixture()` factory function. Without arguments, lists available fixtures.
3408
-
3409
- Remote runs route through the Platform. Authenticate with a personal access token (`kici login`), then target an organization with `kici org use <org>` or the `--org` flag. The Platform relays the run to the org's orchestrator, while your working-tree overlay uploads directly to object storage — see [How the run is routed](https://docs.kici.dev/user/cli/runs-and-approvals/#how-the-run-is-routed) and [The two planes](https://docs.kici.dev/user/cli/runs-and-approvals/#the-two-planes) below.
3410
-
3411
- Like `kici run <event> --local`, `kici run remote` recompiles your workflows (`.kici/workflows` → `kici.lock.json`) before dispatching, so the orchestrator matches and dispatches against your current workflow definitions — a brand-new or edited workflow takes effect without a separate `kici compile`. A compile or validation error aborts the run before anything is uploaded.
3412
-
3413
- The orchestrator must have **cache storage configured** (`KICI_STORAGE_TYPE` = `s3` or `filesystem`) with a dev-reachable upload endpoint so the CLI's direct upload succeeds; see the [testing guide](https://docs.kici.dev/user/testing-guide/) and [Storage layout](https://docs.kici.dev/operator/orchestrator/storage-layout/) for setup.
3414
-
3415
- ```bash
3416
- kici run remote [fixture] [options]
3417
- ```
3418
-
3419
- `--approve-all` works in `--json` / `--quiet` mode: the run still auto-approves each gate it holds on, and the auto-approve diagnostics are written to stderr so stdout stays a pure JSON (or summary-only) payload. Without `--approve-all`, a `--json` / `--quiet` run that hits a gate stays held and prints a one-line "run held; approve via the dashboard or `kici approve <run-id>`" notice to stderr per hold.
3420
-
3421
- **Examples:**
1385
+ Pass `--json` for machine-readable output. It prints one object and exits 0 for
1386
+ every state, including when the plane is stopped — the state is in the payload,
1387
+ not the exit code:
3422
1388
 
3423
1389
  ```bash
3424
- # List available fixtures
3425
- kici run remote
3426
-
3427
- # Run a single fixture against the active org
3428
- kici run remote push-main
3429
-
3430
- # Target a specific org for this run
3431
- kici run remote push-main --org xyz789ghi012
3432
-
3433
- # Target a specific orchestrator cluster within the org
3434
- kici run remote push-main --orchestrator us-east
3435
-
3436
- # Run all push-related fixtures
3437
- kici run remote 'push-*'
3438
-
3439
- # Run everything
3440
- kici run remote --all
3441
-
3442
- # Run a specific workflow directly (bypass trigger matching)
3443
- kici run remote --workflow ci
3444
-
3445
- # Quiet mode -- just pass/fail
3446
- kici run remote push-main --quiet
3447
-
3448
- # JSON output for scripting
3449
- kici run remote push-main --json
3450
-
3451
- # Fire and forget
3452
- kici run remote push-main --no-wait
3453
-
3454
- # View recent test run history
3455
- kici run remote --history
3456
-
3457
- # Interactively pick which fixtures to run (multi-select)
3458
- kici run remote --pick
3459
-
3460
- # Narrow runsOnAll jobs to a subset of the host roster
3461
- kici run remote deploy --target role:web
3462
-
3463
- # AND-combine repeated --target values (hosts must match every selector)
3464
- kici run remote deploy --target role:web --target dc:eu
3465
-
3466
- # Skip a runsOnAll job instead of failing it when the target matches no host
3467
- kici run remote deploy --target role:gpu --target-allow-empty
3468
- ```
3469
-
3470
- **Interactive fixture selection (`--pick` / `-p`):**
3471
-
3472
- Pass `--pick` (or `-p`) to open an interactive checkbox menu of the available
3473
- fixtures. Toggle one or more with space, confirm with enter, and the selected
3474
- fixtures run through the normal remote pipeline (honoring `--parallel`,
3475
- `--no-wait`, and the other run flags). Notes:
3476
-
3477
- - `--pick` is mutually exclusive with a fixture argument, `--all`, and
3478
- `--workflow`. Passing any together exits with code 2.
3479
- - When `stdin` is not a TTY, `--pick` prints the available fixtures and exits
3480
- without running anything — pass a fixture name (or `--all`) in scripts.
3481
-
3482
- #### Host narrowing with `--target`
3483
-
3484
- `--target <selector>` is a runtime narrowing for `runsOnAll` jobs, analogous to
3485
- Ansible's `--limit`. A `runsOnAll` job normally fans out to **every** roster host
3486
- matching its predicate, one pinned execution per host. `--target` intersects that
3487
- matched roster with a label selector, so the effective host set is
3488
- `runsOnAll ∩ target`:
3489
-
3490
- - **Narrow-only.** `--target` can only _remove_ hosts from the matched set, never
3491
- add them. The widening dimension (OR across host groups) lives in the workflow's
3492
- `runsOnAll`; `--target` only subtracts.
3493
- - **Run-global, `runsOnAll`-only.** A single `--target` applies to every
3494
- `runsOnAll` job in the run. Jobs pinned to a single host with `runsOn` are
3495
- untouched.
3496
- - **Repeatable and AND-combined.** Each `--target` value is its own selector; a
3497
- host must satisfy **all** of them to survive the narrowing. Use a single value
3498
- for an OR-style match within one selector and repeated values for AND.
3499
- - **Selector syntax** matches `runsOn`: an exact label (`role:web`), a glob
3500
- (`role:*`), or a regex (`/^box-0[1-3]$/`).
3501
-
3502
- When `--target` narrows a `runsOnAll` job to zero hosts, the default is to **fail**
3503
- the run (fail-loud — a typo in the selector shouldn't silently skip work). Pass
3504
- `--target-allow-empty` to **skip** the zeroed job instead; the job records a
3505
- `skipped` status, and any downstream job that needs it with `when: 'on-skip'` (or
3506
- `when: 'always'`) still runs. See [Job dependencies](https://docs.kici.dev/user/sdk/core/#job-dependencies-needs)
3507
- for the `when` gating model.
3508
-
3509
- **Exit codes:**
3510
-
3511
- | Code | Meaning |
3512
- | ---- | ---------------------------- |
3513
- | 0 | All matched workflows passed |
3514
- | 1 | One or more workflows failed |
3515
-
3516
- #### How the run is routed
3517
-
3518
- A remote run is dispatched to your **active organization** — the one set with `kici org use <org>`, or overridden per-run with `--org <id>`. The org is resolved in this order:
3519
-
3520
- 1. The `--org <id>` flag, if provided.
3521
- 2. Otherwise the active org saved in your global config by `kici org use <org>`.
3522
- 3. If neither is set, the command errors and asks you to select an org with `kici org use` or pass `--org`.
3523
-
3524
- The orchestrator anchors the org without any manual webhook source: it auto-provisions a system-managed **remote source** (routing key `remote:<orgId>`) that maps to its bound organization, so even a zero-source org is immediately routable for remote runs. You never set a routing key for a remote run — selecting the org is enough.
3525
-
3526
- When an org has more than one connected orchestrator cluster, the CLI picks the target cluster in this order:
3527
-
3528
- 1. The `--orchestrator <name>` flag, if provided.
3529
- 2. Otherwise the per-org default cluster, set with `kici orchestrators use <name>`.
3530
- 3. If the org has exactly **one** connected orchestrator, it is auto-selected.
3531
- 4. Otherwise the run errors with the list of connected clusters, and you pass `--orchestrator <name>` to choose one. Run `kici orchestrators list` to see the available cluster names.
3532
-
3533
- #### The two planes
3534
-
3535
- `kici run remote` uses two independent paths:
3536
-
3537
- - **Control plane** — run initiation, trigger, status, log retrieval, and cancellation flow from your machine through the Platform, which relays them over a WebSocket connection to the org's orchestrator. Logs are delivered by the CLI polling the Platform for log chunks (tracked by a monotonic line cursor) and run status until the run reaches a terminal state; there is no direct streaming socket to the orchestrator.
3538
- - **Data plane** — your working-tree overlay tarball uploads **directly** from your machine to the orchestrator's object store via a presigned PUT URL. The overlay never passes through the Platform. This is why the orchestrator's object-store upload endpoint must be reachable from your machine; see [Storage layout](https://docs.kici.dev/operator/orchestrator/storage-layout/).
3539
-
3540
- An orchestrator with no Platform connection cannot serve remote runs — the Platform is the service that offers them. For executing workflow steps on your own machine without an orchestrator (no scaler, agents, or environments), use [`kici run <event> --local`](https://docs.kici.dev/user/cli/runs-and-approvals/#kici-run-event---local).
1390
+ $ kici local status --json
1391
+ {"state":"ready","running":true,"pid":3768093,"port":4319,
1392
+ "url":"http://127.0.0.1:4319","pgKind":"embedded","stampVersion":3,
1393
+ "mode":"independent"}
1394
+ ```
3541
1395
 
3542
- #### Fresh repos (no GitHub remote)
1396
+ `state` is one of `stopped`, `ready`, `unready`, `foreign-kici`,
1397
+ `foreign-unknown`. The key set is fixed: the plane's admin token is never part
1398
+ of it, so the output is safe to log. Every key is always present, but only
1399
+ `state`, `running` and `mode` always carry a value — the rest are `null`
1400
+ whenever the plane cannot supply them (for `stopped` that is all of them, and
1401
+ `stampVersion` is populated only for `ready`), so read them defensively
1402
+ (`jq -r '.pid // empty'`).
3543
1403
 
3544
- `kici run remote` works even if the repo has never been pushed to GitHub. When no remote is detected:
1404
+ A local run also fails fast when no agent claims it: if no scaler label set matches the job's `runsOn`, or the agent cannot start, the run gives up within a short acceptance window (2 minutes by default, overridable with `KICI_LOCAL_ACCEPTANCE_TIMEOUT_MS`) and names the plane log instead of waiting out the full no-progress timeout.
3545
1405
 
3546
- - The entire repo content is uploaded (not just a diff overlay)
3547
- - The lock file is sent inline (no GitHub API fetch)
3548
- - Steps that use git commands will fail (no `.git` directory in the remote workspace)
3549
- - Build cache (`__build__` jobs) is skipped for local repos
3550
- - Environments must have `allowLocalExecution: true` to be accessible from local runs (default is `false`)
1406
+ **Verifying an offline-signed bundle:** export the plane's trust root, then pass it to the verifier:
3551
1407
 
3552
- Destination routing is unchanged for fresh repos: the run still goes to your active org through the Platform.
1408
+ ```bash
1409
+ kici local trust-root ./local-trust-root.json
1410
+ kici verify-attestation ./dist/app.tgz \
1411
+ --bundle ./app.tgz.kici.json \
1412
+ --trust-root ./local-trust-root.json
1413
+ ```
3553
1414
 
3554
- For a detailed guide on writing fixtures, configuring secrets, and understanding the upload flow, see [Testing guide](https://docs.kici.dev/user/testing-guide/).
1415
+ For the plane's on-disk layout, port selection, PostgreSQL backends, and reset behavior, see [Local dev plane](https://docs.kici.dev/operator/orchestrator/local-dev-plane/).
3555
1416
 
3556
- #### kici orchestrators
1417
+ ### kici fixture
3557
1418
 
3558
- List the orchestrator clusters connected to an organization, and set the per-org default cluster used by `kici run remote`. Requires `kici login` and an active org (or pass `--org`).
1419
+ Generate a fixture template for an event type. Useful for creating custom test payloads.
3559
1420
 
3560
1421
  ```bash
3561
- kici orchestrators list [--org <id>]
3562
- kici orchestrators use <clusterName> [--org <id>]
1422
+ kici fixture <event> [options]
3563
1423
  ```
3564
1424
 
3565
- **`kici orchestrators list`** prints the org's connected orchestrator clusters, so you know what to pass to `--orchestrator` (or to `kici orchestrators use`).
3566
-
3567
- **`kici orchestrators use <clusterName>`** sets the default orchestrator cluster for the org, stored per-org in your global config. Subsequent `kici run remote` invocations target that cluster unless overridden with `--orchestrator`.
1425
+ **Valid events:** `pr:open`, `pr:sync`, `pr:close`, `pr:reopen`, `push`, `tag`, `comment`, `review`, `review_comment`, `release`, `dispatch`, `create`, `delete`, `status`, `workflow_run`, `fork`, `star`, `watch`, `kici_event`, `workflow_complete`, `workflows_failed_batch`, `job_complete`, `generic_webhook`, `schedule`, `lifecycle` (many support `:action` suffixes, e.g. `comment:edited`, `release:published`, `lifecycle:workflow_complete`). `webhook:<source>` is a shorthand alias for `generic_webhook:<source>`.
3568
1426
 
3569
1427
  **Examples:**
3570
1428
 
3571
1429
  ```bash
3572
- # List the active org's connected clusters
3573
- kici orchestrators list
3574
-
3575
- # List a specific org's clusters
3576
- kici orchestrators list --org xyz789ghi012
1430
+ # Print fixture to stdout
1431
+ kici fixture pr:open
3577
1432
 
3578
- # Set the default cluster for the active org
3579
- kici orchestrators use us-east
1433
+ # Write fixture to file
1434
+ kici fixture pr:open --output fixtures/pr-open.json
3580
1435
 
3581
- # Set the default cluster for a specific org
3582
- kici orchestrators use us-east --org xyz789ghi012
1436
+ # Generate push fixture
1437
+ kici fixture push --output fixtures/push.json
3583
1438
  ```
3584
1439
 
3585
- ### kici runs
3586
-
3587
- Inspect and manage execution runs from the terminal — the equivalent of the
3588
- dashboard Runs page. All `kici runs` subcommands read/write the same org-scoped
3589
- data as the dashboard, so they require `kici login` and an active org
3590
- (`kici org use <name>`).
1440
+ Use generated fixtures as reference when writing test fixture files in `.kici/tests/`:
3591
1441
 
3592
- #### kici runs list
1442
+ ```bash
1443
+ kici fixture pr:open --output fixtures/pr-open-reference.json
1444
+ # Use the generated JSON as reference when writing .kici/tests/pr-open.ts
1445
+ ```
3593
1446
 
3594
- List runs with optional filters. Output is a table (run id, workflow, status,
3595
- branch, trigger, started, duration); pagination is reported at the bottom.
1447
+ ### kici types
3596
1448
 
3597
- When no runs match, `kici runs list` checks whether any webhooks arrived
3598
- recently. If deliveries came in but nothing produced a run, it prints a
3599
- one-line summary ("3 webhooks received in the last hour, 0 matched") and
3600
- suggests `kici preview push` to test your triggers locally — the fast way to
3601
- find a misconfigured trigger. When nothing arrived it prints "No runs found."
3602
- as before.
1449
+ Generate TypeScript declaration files from orchestrator environment metadata. The generated `.d.ts` file augments the SDK's `KnownSecretKeys` and `ContextSecrets` interfaces, providing compile-time autocomplete and type checking for secret key names.
3603
1450
 
3604
1451
  ```bash
3605
- kici runs list [options]
1452
+ kici types [options]
3606
1453
  ```
3607
1454
 
3608
- ```bash
3609
- kici runs list
3610
- kici runs list --status running
3611
- kici runs list --workflow ci --branch main
3612
- kici runs list --json | jq '.runs[].runId'
3613
- ```
1455
+ **Prerequisites:** Authenticate via `kici login` to fetch the real key set. Without it, `kici types` writes an empty stub (see "Offline behavior" below).
3614
1456
 
3615
- #### kici runs show
1457
+ **Output:** `.kici/types/secrets.d.ts`
3616
1458
 
3617
- Show a run's summary header plus its jobs-and-steps tree (name, status,
3618
- duration, exit code). A run that never started a step also prints why: the
3619
- run-level failure, and per job the reason it did not run — a job a
3620
- [context](https://docs.kici.dev/user/contexts/#protection-rules) rejected names the context and the
3621
- rule. Any approval hold on the run is listed too, with its context, hold type,
3622
- status and reason. If the run id is not on the Platform but exists in your
3623
- local run history (from `kici run <event> --local`), the local record is shown instead.
1459
+ **Examples:**
3624
1460
 
3625
1461
  ```bash
3626
- kici runs show <run-id> [options]
3627
- ```
1462
+ # Generate types from orchestrator
1463
+ kici types
3628
1464
 
3629
- ```bash
3630
- kici runs show abc123
3631
- kici runs show abc123 --json
1465
+ # Use custom .kici directory
1466
+ kici types --kici-dir packages/app/.kici
3632
1467
  ```
3633
1468
 
3634
- #### kici runs logs
3635
-
3636
- Print each job/step's log lines in order, with headers.
1469
+ **How it works:**
3637
1470
 
3638
- ```bash
3639
- kici runs logs <run-id> [options]
3640
- ```
1471
+ 1. Fetches all environment metadata (environment names and secret key names) from the orchestrator
1472
+ 2. Generates a `.d.ts` file that augments `@kici-dev/sdk`'s `KnownSecretKeys` and `ContextSecrets` interfaces
1473
+ 3. Writes the file to `.kici/types/secrets.d.ts`
3641
1474
 
3642
- ```bash
3643
- kici runs logs abc123
3644
- kici runs logs abc123 --job build
3645
- kici runs logs abc123 --follow
3646
- ```
1475
+ After generating types, `ctx.secrets.get('MY_KEY')` and `ctx.secrets.expose('DB_HOST')` gain autocomplete and type checking in your IDE.
3647
1476
 
3648
- #### kici runs rerun
1477
+ **Git workflow:** `.kici/types/secrets.d.ts` is a local development aid, not source — its content is a snapshot of one org's secret keys fetched from the Platform. `kici init` gitignores `.kici/types/`, so the file stays out of version control. Each team member runs `kici types` (or an authenticated `kici compile`) to generate their own copy. Do not commit it: a stale committed copy would type-check against secret keys that no longer exist.
3649
1478
 
3650
- Re-trigger a completed run. Prints the new run id. The server enforces a short
3651
- cooldown between reruns of the same run.
1479
+ **Offline behavior:** When the Platform cannot be reached — not logged in, no active org, or offline — `kici types` never fails. If a `secrets.d.ts` already exists, `kici types` keeps it untouched, so a transient outage does not wipe your real key set. If the file is absent (a fresh clone or unauthenticated CI), `kici types` writes a valid empty stub. Type checking then degrades to "no known keys" (any key name is accepted) rather than breaking with "module has no exported member". Run `kici types` again once authenticated to refresh it.
3652
1480
 
3653
- ```bash
3654
- kici runs rerun <run-id> [options]
3655
- ```
1481
+ **Auto-regeneration:** `kici compile` automatically runs `kici types` after successful compilation when authenticated. See the [kici compile](https://docs.kici.dev/user/cli/authoring-and-local/#kici-compile) section for details.
3656
1482
 
3657
- ```bash
3658
- kici runs rerun abc123
3659
- ```
1483
+ **Escape hatch:** For dynamic keys not in the generated types, use a cast: `(ctx.secrets as any).DYNAMIC_KEY`.
3660
1484
 
3661
- #### kici runs cancel
1485
+ ### kici workflows list
3662
1486
 
3663
- Cancel a single run, or all in-progress runs on a branch.
1487
+ List permanently registered workflows on the orchestrator.
3664
1488
 
3665
1489
  ```bash
3666
- kici runs cancel [run-id] [options]
1490
+ kici workflows list [options]
3667
1491
  ```
3668
1492
 
1493
+ **Examples:**
1494
+
3669
1495
  ```bash
3670
- kici runs cancel abc123
3671
- kici runs cancel abc123 --force
3672
- kici runs cancel --branch feature/wip
3673
- ```
1496
+ # List all registered workflows
1497
+ kici workflows list
3674
1498
 
3675
- #### kici runs artifacts list
1499
+ # JSON output for scripting
1500
+ kici workflows list --json
3676
1501
 
3677
- List the [artifacts](https://docs.kici.dev/user/sdk/artifacts/) a run uploaded name, producing job,
3678
- size, content hash, and creation time. An artifact whose stored object can no
3679
- longer be reached is flagged `unavailable`.
1502
+ # Show workflows not updated in 30 days
1503
+ kici workflows list --stale 30d
3680
1504
 
3681
- ```bash
3682
- kici runs artifacts list <run-id> [options]
3683
- ```
1505
+ # Filter by trigger type
1506
+ kici workflows list --trigger-type push
3684
1507
 
3685
- ```bash
3686
- kici runs artifacts list abc123
3687
- kici runs artifacts list abc123 --json
1508
+ # Filter by repository
1509
+ kici workflows list --repo my-org/my-repo
3688
1510
  ```
3689
1511
 
3690
- #### kici runs artifacts download
1512
+ ### kici hook install
3691
1513
 
3692
- Download a run's artifacts. Name one to fetch just that artifact; omit the name
3693
- to download every artifact of the run. Each artifact extracts into its own
3694
- `<name>/` directory by default.
1514
+ Install a pre-commit hook that runs `kici compile` before each commit.
3695
1515
 
3696
1516
  ```bash
3697
- kici runs artifacts download <run-id> [name] [options]
1517
+ kici hook install [options]
3698
1518
  ```
3699
1519
 
3700
- - `--archive` — save the raw `.tar.gz` as `<name>.tar.gz` instead of extracting.
3701
- - `-o, --output <dir>` — write into `<dir>` instead of the current directory.
1520
+ **Examples:**
3702
1521
 
3703
1522
  ```bash
3704
- kici runs artifacts download abc123 bundle
3705
- kici runs artifacts download abc123 bundle -o ./out
3706
- kici runs artifacts download abc123 --archive
3707
- kici runs artifacts download abc123
3708
- ```
3709
-
3710
- The download streams directly from object storage over a short-lived signed URL
3711
- — the artifact bytes never pass through the KiCI Platform — and the content hash
3712
- is verified end to end, so a corrupted or truncated transfer fails loudly rather
3713
- than leaving a bad file on disk.
3714
-
3715
- Artifacts expire after the orchestrator's configured retention. When you name a
3716
- single artifact whose stored object is already gone, the command fails. When you
3717
- download the whole run, such an artifact is reported as a warning and skipped so
3718
- the remaining artifacts still land — the command fails only if every artifact of
3719
- the run was unreachable. Any other failure (a rejected signed URL, a content-hash
3720
- mismatch) stops the command immediately rather than continuing with the rest.
3721
-
3722
- Artifact names are case-sensitive, so a single run can hold both `bundle` and
3723
- `Bundle`. On a filesystem that ignores case in path lookups — macOS and Windows
3724
- default to this, Linux does not — both would land on the same path, so
3725
- downloading the whole run refuses before writing anything and names the pair.
3726
- Fetch them one at a time into separate directories instead:
1523
+ # Auto-detect hook tool (husky, lint-staged, etc.)
1524
+ kici hook install
3727
1525
 
3728
- ```bash
3729
- kici runs artifacts download abc123 bundle -o ./bundle-lower
3730
- kici runs artifacts download abc123 Bundle -o ./bundle-upper
1526
+ # Force raw git hook
1527
+ kici hook install --git
3731
1528
  ```
3732
1529
 
3733
- Naming a single artifact is never affected, and on a case-sensitive filesystem
3734
- downloading the whole run still writes both.
1530
+ The command auto-detects existing hook tools in your project:
3735
1531
 
3736
- Artifacts are packed relative to two roots: paths inside your repository and
3737
- paths under the home directory. Repository-relative files land directly under
3738
- `<name>/`; home-relative files land under `<name>/~home/`, so the two can never
3739
- overwrite each other and nothing is ever written outside the output directory.
1532
+ - **Husky**: Adds to `.husky/pre-commit`
1533
+ - **lint-staged**: Adds to lint-staged configuration
1534
+ - **Raw git**: Writes `.git/hooks/pre-commit`
3740
1535
 
3741
- When `--json` is set on any of these commands, `kici` emits only the JSON
3742
- document on stdout — the `kici v<version>` banner is suppressed — so the output
3743
- is safe to pipe into `jq` or `JSON.parse`. The same holds for the other
3744
- `--json` commands (`kici run remote --json`, `kici workflows list --json`) and
3745
- for `--quiet`.
1536
+ If multiple tools are detected, you are prompted to choose.
3746
1537
 
3747
- ### kici reject
1538
+ ### kici docs
3748
1539
 
3749
- Reject a held [approval gate](https://docs.kici.dev/user/approvals/). A rejection fails the held element and the run. A reason is required.
1540
+ Open the KiCI documentation site in the default browser. With the `llm` subcommand, print the LLM-friendly documentation bundle that ships with `@kici-dev/compiler` pipe it into a coding agent's context buffer to brief the agent on authoring conventions without an internet round-trip.
3750
1541
 
3751
1542
  ```bash
3752
- kici reject <run-id> --reason <text> [options]
1543
+ kici docs # open https://kici.dev/docs/
1544
+ kici docs --no-open # print the URL instead of opening a browser
1545
+ kici docs llm # print the llms.txt index (a router over the task bundles)
1546
+ kici docs llm sdk # print the SDK task bundle
1547
+ kici docs llm full # print llms-full.txt (every page in one file)
1548
+ kici docs llm sdk --out sdk-context.md # write a bundle to a file
3753
1549
  ```
3754
1550
 
3755
1551
  **Examples:**
3756
1552
 
3757
1553
  ```bash
3758
- # Reject a held job with a reason
3759
- kici reject abc123 --job deploy-production --reason "Wrong release branch"
3760
- ```
3761
-
3762
- ### kici approve
1554
+ # Open the docs site in your browser
1555
+ kici docs
3763
1556
 
3764
- Approve a held [approval gate](https://docs.kici.dev/user/approvals/) so the run resumes. Identify the held element by run ID, optionally narrowed to a job and step.
1557
+ # Pipe just the SDK bundle into a coding agent (small, task-scoped context)
1558
+ kici docs llm sdk | claude -- "Read this and help me author a deploy workflow"
3765
1559
 
3766
- ```bash
3767
- kici approve <run-id> [options]
1560
+ # Save the router index for offline reference
1561
+ kici docs llm --out kici-llms-index.txt
3768
1562
  ```
3769
1563
 
3770
- **Examples:**
3771
-
3772
- ```bash
3773
- # Approve a workflow-level hold
3774
- kici approve abc123
1564
+ Bundles are regenerated from `docs/` every time `@kici-dev/compiler` is built, so they always match your installed CLI version. The index lists each task bundle — `getting-started`, `sdk`, `sdk-runtime`, `cli`, `cli-remote`, `patterns`, `features`, `features-execution`, `providers`, `architecture` — with its size and a one-line purpose; pass the bundle id as the topic. Every cross-reference link inside a bundle is an absolute `docs.kici.dev` URL. The same files are published online following the [llms.txt convention](https://llmstxt.org/).
3775
1565
 
3776
- # Approve a held job
3777
- kici approve abc123 --job deploy-production
1566
+ ## Reference
3778
1567
 
3779
- # Approve a held step (steps are addressed by index)
3780
- kici approve abc123 --job migrate-and-deploy --step 1
3781
- ```
1568
+ <!-- BEGIN GENERATED: kici-authoring-and-local (do not edit; run the doc generator) -->
3782
1569
 
3783
- You must be eligible for at least one unsatisfied clause (a member of a named team, or a named user) and hold the permission that matches the hold's type — `ci_trust:write` for a **security** hold, `contexts:admin` for a **wait-timer** hold, `contexts:write` for every other hold. The server enforces this, so the same rule applies to the dashboard and to an AI agent's tools. The command reports whether the element was released, how many clauses remain, or that it was rejected.
1570
+ ### `kici compile`
3784
1571
 
3785
- ## Reference
1572
+ Compile workflows from .kici/workflows/ to kici.lock.json
3786
1573
 
3787
- <!-- BEGIN GENERATED: kici-runs-and-approvals (do not edit; run the doc generator) -->
1574
+ Synopsis: `kici compile [options]`
3788
1575
 
3789
- ### `kici approve`
1576
+ **Options**
3790
1577
 
3791
- Approve a held approval gate for a run
1578
+ | Option | Default | Description |
1579
+ | ------------------- | ------- | ---------------------------------------------------------------------------------- |
1580
+ | `--check` | `false` | Validate workflows and type-check sources (tsc --noEmit) without writing lock file |
1581
+ | `--kici-dir <path>` | `.kici` | Path to .kici directory |
1582
+ | `--verbose` | `false` | Detailed output |
1583
+ | `--watch` | `false` | Watch for changes and recompile |
3792
1584
 
3793
- Synopsis: `kici approve <run-id> [options]`
1585
+ ### `kici docs`
3794
1586
 
3795
- **Arguments**
1587
+ Open the KiCI documentation site in the default browser
3796
1588
 
3797
- | Argument | Required | Variadic | Description |
3798
- | -------- | -------- | -------- | ------------------------------------- |
3799
- | `run-id` | yes | no | Run ID whose approval gate to approve |
1589
+ Synopsis: `kici docs [options]`
3800
1590
 
3801
1591
  **Options**
3802
1592
 
3803
- | Option | Default | Description |
3804
- | -------------------- | ------- | -------------------------------------------------------------------------------------------- |
3805
- | `--job <name>` | | Approve the hold for a specific job |
3806
- | `--step <index>` | | Approve a step-scoped hold (requires --job) |
3807
- | `--hold-type <type>` | | Approve the hold of this type (reviewer, timer, concurrency, security) — a job can carry two |
3808
- | `--hold <id>` | | Approve one hold by its id, as listed when nothing else separates them |
1593
+ | Option | Default | Description |
1594
+ | ----------- | ------- | ----------------------------------------------- |
1595
+ | `--no-open` | | Print the docs URL instead of opening a browser |
3809
1596
 
3810
- ### `kici reject`
1597
+ ### `kici docs llm`
3811
1598
 
3812
- Reject a held approval gate for a run
1599
+ Print KiCI LLM docs bundles. No topic prints the llms.txt index; <topic> prints a task bundle (e.g. sdk, cli, cli-remote, patterns, features, providers, architecture, getting-started); "full" prints the complete bundle.
3813
1600
 
3814
- Synopsis: `kici reject <run-id> [options]`
1601
+ Synopsis: `kici docs llm [topic] [options]`
3815
1602
 
3816
1603
  **Arguments**
3817
1604
 
3818
- | Argument | Required | Variadic | Description |
3819
- | -------- | -------- | -------- | ------------------------------------ |
3820
- | `run-id` | yes | no | Run ID whose approval gate to reject |
1605
+ | Argument | Required | Variadic | Description |
1606
+ | -------- | -------- | -------- | ----------- |
1607
+ | `topic` | no | no | |
3821
1608
 
3822
1609
  **Options**
3823
1610
 
3824
- | Option | Default | Description |
3825
- | -------------------- | ------- | ------------------------------------------------------------------------------------------- |
3826
- | `--job <name>` | | Reject the hold for a specific job |
3827
- | `--step <index>` | | Reject a step-scoped hold (requires --job) |
3828
- | `--hold-type <type>` | | Reject the hold of this type (reviewer, timer, concurrency, security) — a job can carry two |
3829
- | `--hold <id>` | | Reject one hold by its id, as listed when nothing else separates them |
3830
- | `--reason <text>` | | Reason for the rejection |
1611
+ | Option | Default | Description |
1612
+ | -------------- | ------- | -------------------------------------------- |
1613
+ | `--out <path>` | | Write the bundle to a file instead of stdout |
3831
1614
 
3832
- ### `kici run`
1615
+ ### `kici fixture`
3833
1616
 
3834
- Execute workflows locally or remotely
1617
+ Generate fixture template for event type
3835
1618
 
3836
- Synopsis: `kici run [event] [options]`
1619
+ Synopsis: `kici fixture <event> [options]`
3837
1620
 
3838
1621
  **Arguments**
3839
1622
 
3840
- | Argument | Required | Variadic | Description |
3841
- | -------- | -------- | -------- | ------------------------------------------------------ |
3842
- | `event` | no | no | Event type for a routed local run (e.g. push, pr:open) |
1623
+ | Argument | Required | Variadic | Description |
1624
+ | -------- | -------- | -------- | ------------------------------------------------------------------------------------------ |
1625
+ | `event` | yes | no | Event to generate fixture for (e.g., pr:open, push, schedule, lifecycle:workflow_complete) |
3843
1626
 
3844
1627
  **Options**
3845
1628
 
3846
- | Option | Default | Description |
3847
- | ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------ |
3848
- | `--local` | `false` | Route the run with this machine as the ephemeral agent |
3849
- | `--offline` | `false` | Force the throwaway/independent plane (offline) |
3850
- | `--connected` | `false` | Force the connected/hybrid plane (requires attachment) |
3851
- | `--in-place` | `false` | Reuse the working tree directly instead of an isolated clone |
3852
- | `--trusted` | `false` | Route to the trusted fleet agent profile: steps see the ambient host env (minus the agent identity). Alias: --no-sandbox |
3853
- | `--no-sandbox` | | Alias for --trusted (the bwrap sandbox is already off by default) |
3854
- | `--env <KEY=VALUE>` | | Per-run secret (repeatable) |
3855
- | `--payload <path>` | | Dispatch payload JSON { action?, client_payload? } for a routed dispatch run |
3856
- | `--kici-dir <path>` | `.kici` | Path to .kici directory |
3857
- | `--quiet` | `false` | Suppress the banner + streaming output |
3858
- | `--debug` | `false` | Verbose internals |
1629
+ | Option | Default | Description |
1630
+ | ----------------- | ------- | ------------------------------- |
1631
+ | `--output <path>` | | Write to file instead of stdout |
1632
+
1633
+ ### `kici hook`
3859
1634
 
3860
- ### `kici run remote`
1635
+ Manage pre-commit hooks
3861
1636
 
3862
- Execute fixtures remotely via orchestrator
1637
+ Synopsis: `kici hook`
3863
1638
 
3864
- Synopsis: `kici run remote [fixture] [options]`
1639
+ ### `kici hook install`
3865
1640
 
3866
- **Arguments**
1641
+ Install kici compile pre-commit hook
3867
1642
 
3868
- | Argument | Required | Variadic | Description |
3869
- | --------- | -------- | -------- | ----------------------------------------------------- |
3870
- | `fixture` | no | no | Fixture name or glob pattern (omit to list available) |
1643
+ Synopsis: `kici hook install [options]`
3871
1644
 
3872
1645
  **Options**
3873
1646
 
3874
- | Option | Default | Description |
3875
- | --------------------------- | ------- | ------------------------------------------------------------------------------------------- |
3876
- | `--workflow <name>` | | Run a specific workflow directly (bypass triggers) |
3877
- | `--all` | `false` | Run all available fixtures |
3878
- | `-p, --pick` | `false` | Interactively pick fixtures to run |
3879
- | `--parallel` | `false` | Run matching fixtures concurrently |
3880
- | `--no-wait` | | Fire and forget (print runIds, don't stream) |
3881
- | `--quiet` | `false` | Suppress output except final result |
3882
- | `--json` | `false` | Output structured JSON result |
3883
- | `--junit <path>` | | Output JUnit XML result |
3884
- | `--history` | `false` | Show recent run history |
3885
- | `--routing-key <key>` | | Override routing key for this run |
3886
- | `--org <id>` | | Target organization (overrides the active org) |
3887
- | `--orchestrator <name>` | | Target orchestrator cluster (overrides the per-org default) |
3888
- | `--debug` | `false` | Verbose internals |
3889
- | `--kici-dir <path>` | `.kici` | Path to .kici directory |
3890
- | `--context <ctx.key=value>` | | Inject a namespaced context secret, uploaded encrypted to the orchestrator (repeatable) |
3891
- | `--env <KEY=VALUE>` | | Provide a per-run secret (repeatable); uploaded encrypted to the orchestrator |
3892
- | `--check` | `false` | Run in check mode: report drift, change nothing |
3893
- | `--fail-on-drift` | `false` | In check mode, exit non-zero if any step reports drift |
3894
- | `--target <selector>` | | Narrow runsOnAll jobs to hosts matching this label selector (repeatable, AND-combined) |
3895
- | `--target-allow-empty` | `false` | A --target that narrows a runsOnAll job to zero hosts skips it instead of failing |
3896
- | `--input <KEY=VALUE>` | | Typed workflow-dispatch input (repeatable) |
3897
- | `--yes, --approve-all` | `false` | Auto-approve every approval gate this run holds on (run-scoped; eligibility still enforced) |
1647
+ | Option | Default | Description |
1648
+ | ------- | ------- | ---------------------------------------- |
1649
+ | `--git` | `false` | Use raw git hook (.git/hooks/pre-commit) |
3898
1650
 
3899
- ### `kici runs`
1651
+ ### `kici local`
3900
1652
 
3901
- Inspect and manage execution runs
1653
+ Manage the local dev orchestrator plane
3902
1654
 
3903
- Synopsis: `kici runs`
1655
+ Synopsis: `kici local`
3904
1656
 
3905
- ### `kici runs artifacts`
1657
+ ### `kici local attach`
3906
1658
 
3907
- List and download a run's artifacts
1659
+ Attach the local dev plane to the Platform (hybrid)
3908
1660
 
3909
- Synopsis: `kici runs artifacts`
1661
+ Synopsis: `kici local attach`
3910
1662
 
3911
- ### `kici runs artifacts download`
1663
+ ### `kici local detach`
3912
1664
 
3913
- Download one artifact, or all of them extracts by default
1665
+ Detach the local dev plane from the Platform (offline)
3914
1666
 
3915
- Synopsis: `kici runs artifacts download <run-id> [name] [options]`
1667
+ Synopsis: `kici local detach`
3916
1668
 
3917
- **Arguments**
1669
+ ### `kici local down`
3918
1670
 
3919
- | Argument | Required | Variadic | Description |
3920
- | -------- | -------- | -------- | ---------------------------------------------------------- |
3921
- | `run-id` | yes | no | Run ID whose artifacts to download |
3922
- | `name` | no | no | Artifact name (omit to download every artifact of the run) |
1671
+ Stop the local dev plane
3923
1672
 
3924
- **Options**
1673
+ Synopsis: `kici local down`
3925
1674
 
3926
- | Option | Default | Description |
3927
- | -------------------- | ------- | --------------------------------------------- |
3928
- | `--archive` | `false` | Save the raw .tar.gz instead of extracting |
3929
- | `-o, --output <dir>` | | Output directory (default: current directory) |
1675
+ ### `kici local logs`
3930
1676
 
3931
- ### `kici runs artifacts list`
1677
+ Print the local dev plane orchestrator log path
3932
1678
 
3933
- List the artifacts a run uploaded
1679
+ Synopsis: `kici local logs`
3934
1680
 
3935
- Synopsis: `kici runs artifacts list <run-id> [options]`
1681
+ ### `kici local status`
3936
1682
 
3937
- **Arguments**
1683
+ Show local dev plane status and control commands
3938
1684
 
3939
- | Argument | Required | Variadic | Description |
3940
- | -------- | -------- | -------- | ------------------------------ |
3941
- | `run-id` | yes | no | Run ID whose artifacts to list |
1685
+ Synopsis: `kici local status [options]`
3942
1686
 
3943
1687
  **Options**
3944
1688
 
3945
- | Option | Default | Description |
3946
- | -------- | ------- | --------------- |
3947
- | `--json` | `false` | Output raw JSON |
1689
+ | Option | Default | Description |
1690
+ | -------- | ------- | ---------------------------------------------------- |
1691
+ | `--json` | `false` | Emit machine-readable JSON (exits 0 for every state) |
3948
1692
 
3949
- ### `kici runs cancel`
1693
+ ### `kici local trust-root`
3950
1694
 
3951
- Cancel a run, or all in-progress runs on a branch
1695
+ Export the offline dev-signed identity trust root ({ issuer, jwks }) to a file
3952
1696
 
3953
- Synopsis: `kici runs cancel [run-id] [options]`
1697
+ Synopsis: `kici local trust-root <file>`
3954
1698
 
3955
1699
  **Arguments**
3956
1700
 
3957
- | Argument | Required | Variadic | Description |
3958
- | -------- | -------- | -------- | ---------------- |
3959
- | `run-id` | no | no | Run ID to cancel |
3960
-
3961
- **Options**
3962
-
3963
- | Option | Default | Description |
3964
- | ----------------- | ------- | ------------------------------------------- |
3965
- | `--force` | `false` | Force cancel (kill immediately, skip hooks) |
3966
- | `--branch <name>` | | Cancel all in-progress runs on this branch |
1701
+ | Argument | Required | Variadic | Description |
1702
+ | -------- | -------- | -------- | ---------------------------------------------------- |
1703
+ | `file` | yes | no | Output path for the { issuer, jwks } trust-root JSON |
3967
1704
 
3968
- ### `kici runs list`
1705
+ ### `kici local up`
3969
1706
 
3970
- List execution runs (mirrors the dashboard Runs page)
1707
+ Start (or reuse) the local dev plane
3971
1708
 
3972
- Synopsis: `kici runs list [options]`
1709
+ Synopsis: `kici local up [options]`
3973
1710
 
3974
1711
  **Options**
3975
1712
 
3976
- | Option | Default | Description |
3977
- | ----------------------- | ------- | --------------------------------------------------------- |
3978
- | `--status <s>` | | Filter by status |
3979
- | `--workflow <w>` | | Filter by workflow name |
3980
- | `--branch <b>` | | Filter by branch/ref |
3981
- | `--repo <r>` | | Filter by repository |
3982
- | `--trigger <t>` | | Filter by trigger type |
3983
- | `--source <routingKey>` | | Filter by source routing key |
3984
- | `--since <ts>` | | Only runs since (ISO-8601 or epoch ms) |
3985
- | `--cursor <cursor>` | | Keyset cursor for the next page (from a prior nextCursor) |
3986
- | `--json` | `false` | Output raw JSON |
1713
+ | Option | Default | Description |
1714
+ | ------------- | ------- | ---------------------------------------------------------------------------- |
1715
+ | `--offline` | `false` | Force the independent (offline) plane (does not clear the attachment record) |
1716
+ | `--connected` | `false` | Force the connected/hybrid plane (requires an attached, reachable Platform) |
3987
1717
 
3988
- ### `kici runs logs`
1718
+ ### `kici preview`
3989
1719
 
3990
- Print step logs for a run
1720
+ Preview which workflows match a trigger event (no execution)
3991
1721
 
3992
- Synopsis: `kici runs logs <run-id> [options]`
1722
+ Synopsis: `kici preview [event] [options]`
3993
1723
 
3994
1724
  **Arguments**
3995
1725
 
3996
- | Argument | Required | Variadic | Description |
3997
- | -------- | -------- | -------- | ----------- |
3998
- | `run-id` | yes | no | Run ID |
1726
+ | Argument | Required | Variadic | Description |
1727
+ | -------- | -------- | -------- | ----------------------------------------------------- |
1728
+ | `event` | no | no | Event type to preview (e.g., push, pr:open, schedule) |
3999
1729
 
4000
1730
  **Options**
4001
1731
 
4002
- | Option | Default | Description |
4003
- | -------------- | ------- | ------------------------ |
4004
- | `--job <name>` | | Only logs for this job |
4005
- | `-f, --follow` | `false` | Tail logs for a live run |
4006
- | `--json` | `false` | Output raw JSON |
4007
-
4008
- ### `kici runs rerun`
4009
-
4010
- Re-trigger a run
1732
+ | Option | Default | Description |
1733
+ | --------------------------- | ------- | ------------------------------------------------------------ |
1734
+ | `--branch <name>` | | Override target branch for trigger matching (default: main) |
1735
+ | `--sha <hash>` | | Override commit SHA |
1736
+ | `--workflow <name>` | | Filter to specific workflow in display |
1737
+ | `--job <name>` | | Filter to specific job in display |
1738
+ | `--debug` | `false` | Verbose internals |
1739
+ | `--kici-dir <path>` | `.kici` | Path to .kici directory |
1740
+ | `--files <path>` | | Simulate changed file path for trigger matching (repeatable) |
1741
+ | `--secret <key=value>` | | Inject flat secret (repeatable) |
1742
+ | `--context <ctx.key=value>` | | Inject context secret (repeatable) |
4011
1743
 
4012
- Synopsis: `kici runs rerun <run-id> [options]`
1744
+ ### `kici types`
4013
1745
 
4014
- **Arguments**
1746
+ Generate TypeScript declarations for secret contexts
4015
1747
 
4016
- | Argument | Required | Variadic | Description |
4017
- | -------- | -------- | -------- | --------------- |
4018
- | `run-id` | yes | no | Run ID to rerun |
1748
+ Synopsis: `kici types [options]`
4019
1749
 
4020
1750
  **Options**
4021
1751
 
4022
- | Option | Default | Description |
4023
- | -------- | ------- | --------------- |
4024
- | `--json` | `false` | Output raw JSON |
1752
+ | Option | Default | Description |
1753
+ | ------------------- | ------- | ----------------------- |
1754
+ | `--kici-dir <path>` | `.kici` | Path to .kici directory |
1755
+
1756
+ ### `kici workflows`
4025
1757
 
4026
- ### `kici runs show`
1758
+ Manage workflow registrations
4027
1759
 
4028
- Show a run summary with its jobs and steps, why a job did not run, and any approval hold
1760
+ Synopsis: `kici workflows`
4029
1761
 
4030
- Synopsis: `kici runs show <run-id> [options]`
1762
+ ### `kici workflows list`
4031
1763
 
4032
- **Arguments**
1764
+ List permanently registered workflows
4033
1765
 
4034
- | Argument | Required | Variadic | Description |
4035
- | -------- | -------- | -------- | ----------------- |
4036
- | `run-id` | yes | no | Run ID to inspect |
1766
+ Synopsis: `kici workflows list [options]`
4037
1767
 
4038
1768
  **Options**
4039
1769
 
4040
- | Option | Default | Description |
4041
- | -------- | ------- | --------------- |
4042
- | `--json` | `false` | Output raw JSON |
1770
+ | Option | Default | Description |
1771
+ | ----------------------- | ------- | ------------------------------------------ |
1772
+ | `--json` | `false` | Output as JSON |
1773
+ | `--stale <duration>` | | Filter stale registrations (e.g., 30d, 7d) |
1774
+ | `--trigger-type <type>` | | Filter by trigger type |
1775
+ | `--repo <repo>` | | Filter by repository |
4043
1776
 
4044
- <!-- END GENERATED: kici-runs-and-approvals -->
1777
+ <!-- END GENERATED: kici-authoring-and-local -->
4045
1778
 
4046
1779
  ---