@kici-dev/compiler 0.4.0 → 0.6.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 (83) hide show
  1. package/dist/cli.js +37 -7
  2. package/dist/commands/approve.d.ts +12 -0
  3. package/dist/commands/approve.js +5 -2
  4. package/dist/commands/compile.js +5 -15
  5. package/dist/commands/doctor.js +2 -2
  6. package/dist/commands/endpoints.js +4 -6
  7. package/dist/commands/held-run-client.d.ts +21 -1
  8. package/dist/commands/held-run-client.js +34 -15
  9. package/dist/commands/hook.js +22 -20
  10. package/dist/commands/index.d.ts +2 -0
  11. package/dist/commands/index.js +2 -1
  12. package/dist/commands/init.d.ts +9 -2
  13. package/dist/commands/init.js +43 -16
  14. package/dist/commands/login.js +1 -1
  15. package/dist/commands/orchestrators.js +3 -2
  16. package/dist/commands/preview.js +1 -8
  17. package/dist/commands/reject.d.ts +12 -0
  18. package/dist/commands/reject.js +5 -2
  19. package/dist/commands/report/collect.d.ts +82 -0
  20. package/dist/commands/report/collect.js +234 -0
  21. package/dist/commands/report/identity.d.ts +48 -0
  22. package/dist/commands/report/identity.js +49 -0
  23. package/dist/commands/report/index.d.ts +63 -0
  24. package/dist/commands/report/index.js +119 -0
  25. package/dist/commands/report/upload.d.ts +38 -0
  26. package/dist/commands/report/upload.js +64 -0
  27. package/dist/commands/run-hold-watch.js +2 -2
  28. package/dist/commands/run.js +6 -3
  29. package/dist/commands/runs/show.js +80 -1
  30. package/dist/commands/types.js +51 -9
  31. package/dist/errors/formatter.d.ts +2 -4
  32. package/dist/errors/formatter.js +1 -3
  33. package/dist/errors/index.d.ts +1 -1
  34. package/dist/errors/index.js +2 -2
  35. package/dist/execution/sdk-alias.js +4 -2
  36. package/dist/fixtures/compiler.js +2 -1
  37. package/dist/format.js +3 -3
  38. package/dist/generators/secrets-dts.d.ts +8 -3
  39. package/dist/generators/secrets-dts.js +3 -3
  40. package/dist/hooks/installer.js +2 -1
  41. package/dist/llm-context/llms-architecture.txt +59 -23
  42. package/dist/llm-context/llms-cli.txt +168 -34
  43. package/dist/llm-context/llms-features-execution.txt +2017 -0
  44. package/dist/llm-context/llms-features.txt +96 -1100
  45. package/dist/llm-context/llms-full.txt +3131 -1407
  46. package/dist/llm-context/llms-getting-started.txt +164 -31
  47. package/dist/llm-context/llms-patterns.txt +186 -7
  48. package/dist/llm-context/llms-providers.txt +15 -33
  49. package/dist/llm-context/llms-sdk-runtime.txt +62 -40
  50. package/dist/llm-context/llms-sdk.txt +284 -58
  51. package/dist/llm-context/llms.txt +23 -15
  52. package/dist/local-plane/paths.d.ts +15 -0
  53. package/dist/local-plane/paths.js +22 -1
  54. package/dist/local-plane/plane-manager.js +2 -2
  55. package/dist/local-plane/port-holder.js +1 -1
  56. package/dist/local-plane/postgres.d.ts +3 -16
  57. package/dist/local-plane/postgres.js +10 -15
  58. package/dist/lockfile/generator.d.ts +12 -0
  59. package/dist/lockfile/generator.js +182 -54
  60. package/dist/lockfile/index.d.ts +0 -2
  61. package/dist/lockfile/index.js +1 -2
  62. package/dist/postinstall.js +2 -1
  63. package/dist/remote/config.d.ts +2 -15
  64. package/dist/remote/config.js +2 -16
  65. package/dist/remote/dashboard-client.d.ts +39 -0
  66. package/dist/remote/dashboard-client.js +41 -0
  67. package/dist/remote/oauth.js +7 -5
  68. package/dist/remote/uploader.js +2 -2
  69. package/dist/templates/package-json.js +1 -1
  70. package/dist/test-runner/dry-run.d.ts +1 -2
  71. package/dist/test-runner/dry-run.js +5 -20
  72. package/dist/test-runner/git-detector.js +2 -1
  73. package/dist/test-runner/job-executor.js +2 -1
  74. package/dist/test-runner/payload-builder.js +11 -17
  75. package/dist/types.d.ts +64 -10
  76. package/dist/types.js +7 -1
  77. package/dist/validation/validator.js +63 -6
  78. package/package.json +16 -11
  79. package/sbom.spdx.json +957 -900
  80. package/dist/lockfile/purity-analyzer.d.ts +0 -25
  81. package/dist/lockfile/purity-analyzer.js +0 -204
  82. package/dist/lockfile/purity-diagnostics.d.ts +0 -31
  83. package/dist/lockfile/purity-diagnostics.js +0 -52
@@ -109,7 +109,7 @@ An orchestrator enforces a few limits, each surfaced as a clear step error when
109
109
  - A **per-org storage quota** (20 GiB by default) across all non-expired artifacts.
110
110
  - An **expiry** (30 days by default) after which an artifact is no longer downloadable or listed.
111
111
 
112
- Operators can raise or lower the quota and expiry per organization; see the [orchestrator storage layout](https://docs.kici.dev/operator/orchestrator/storage-layout/#artifacts) for the operator-facing knobs.
112
+ Each of the four is a cluster-wide default an operator can raise or lower per organization; see the [orchestrator storage layout](https://docs.kici.dev/operator/orchestrator/storage-layout/#artifacts) for the operator-facing knobs.
113
113
 
114
114
  When an upload or download fails for a reason that is **not** one of these limits — the orchestrator has no artifact storage configured, or it could not service the request — the step error says exactly that, instead of reporting a quota rejection or a missing artifact. So an error that names a limit really is a limit you can act on, and an error that names an orchestrator problem is one to take to whoever runs it.
115
115
 
@@ -266,7 +266,7 @@ Source: https://docs.kici.dev/user/sdk/event-payloads/
266
266
 
267
267
  ## The envelope
268
268
 
269
- The normalized event envelope is the single event contract in KiCI. Rules receive it as `ctx.event`, and every dynamic function — `environment:`, `env:`, and `concurrencyGroup:` resolvers, generated jobs, and a workflow's `concurrency.group` — receives the same envelope as its argument.
269
+ The normalized event envelope is the single event contract in KiCI. Rules receive it as `ctx.event`, and every dynamic function — `context:`, `env:`, and `concurrencyGroup:` resolvers, generated jobs, and a workflow's `concurrency.group` — receives the same envelope as its argument.
270
270
 
271
271
  Narrow on the `type` field to branch per trigger kind (`if (event.type === 'push')`). The raw provider webhook body is nested at `payload`; the typed variants below describe its shape per event type.
272
272
 
@@ -712,7 +712,7 @@ export const setup = job('setup', {
712
712
 
713
713
  ## `checkStep(name, options)`
714
714
 
715
- The check-mode-aware sibling of `idempotentStep()`. It takes the **same option shape**, but behaves differently when a run is started in check mode (`kici run --check`):
715
+ The check-mode-aware sibling of `idempotentStep()`. It takes a closely related option shape, but behaves differently when a run is started in check mode (`kici run --check`):
716
716
 
717
717
  | Factory | Behavior under `kici run --check` |
718
718
  | ---------------- | ----------------------------------------- |
@@ -730,10 +730,16 @@ Use `checkStep()` for deploy-style steps where you want a dry-run preview of pen
730
730
  | `apply` | `(ctx, drift: TDrift) => Promise<TApplied>` | Yes | Brings the system to the desired state. Runs only in apply mode (skipped under `kici run --check`). |
731
731
  | `summarize` | `(drift: TDrift) => string` | Yes | Human-readable summary of what `apply()` would do; shown in check-mode drift output. |
732
732
  | `whenInSync` | `(ctx) => Promise<TInSync>` | No | Runs when `check()` returned `null` (already in sync). |
733
+ | `outputs` | `OutputSchema` | No | Zod schema validating the step's outputs at runtime. |
733
734
  | `continueOnError` | `boolean` | No | When true, the job proceeds even if this step fails. |
734
735
  | `timeout` | `number` | No | Step-level timeout in milliseconds. |
736
+ | `retry` | `number \| RetryConfig` | No | Retry policy for the step; `retry: N` is shorthand for `{ maxAttempts: N }`. |
737
+ | `cache` | `CacheInput` | No | Declarative cache restored before the step and saved after it succeeds. |
738
+ | `rules` | `Rule[]` | No | Step-level conditional rules, evaluated agent-side. |
735
739
 
736
- The one signature difference from `idempotentStep`: `apply` and `whenInSync` receive `ctx` as their first argument, so the apply logic has access to `ctx.$`, `ctx.log`, and `ctx.secrets`.
740
+ Everything from `outputs` down is a plain [`step()` option](https://docs.kici.dev/user/sdk/core/) forwarded to the underlying step. The three step options `checkStep` does **not** accept are `onCancel`, `cleanup`, and `approval`.
741
+
742
+ There are two signature differences from `idempotentStep`. First, `apply` and `whenInSync` receive `ctx` as their first argument, so the apply logic has access to `ctx.$`, `ctx.log`, and `ctx.secrets`. Second, `summarize` is **required** here, because it is what check mode prints; `idempotentStep` defaults it to a JSON dump of the drift. `idempotentStep` also takes none of the step-option passthroughs above.
737
743
 
738
744
  ### Result
739
745
 
@@ -841,6 +847,21 @@ const patch = job('patch', {
841
847
  });
842
848
  ```
843
849
 
850
+ ### Which hosts are targets
851
+
852
+ `runsOnAll` targets the hosts you declare as members of your fleet. A host becomes
853
+ a target when it registers with the orchestrator under a stable agent identity, or
854
+ when an operator declares it with `kici-admin host declare`.
855
+
856
+ Agents that an auto-scaler starts are **not** targets, even when their labels match
857
+ the predicate. An auto-scaler starts an agent at the fixed shape of its pool, so a
858
+ pinned child would run at that shape and not at its own. Auto-scaler agents stay
859
+ available to `runsOn` and to the queue, and `ctx.kici.inventory` continues to list
860
+ them.
861
+
862
+ The fleet preview and the host detail page in the web UI apply the same rule, so
863
+ they show the hosts a run targets.
864
+
844
865
  ### Input forms
845
866
 
846
867
  `runsOnAll` accepts three shapes:
@@ -1130,7 +1151,7 @@ When `--target` narrows a `runsOnAll` job to zero hosts, the run **fails** by de
1130
1151
  (a mistyped selector should be loud, not silently no-op). Pass `--target-allow-empty`
1131
1152
  to **skip** the zeroed job instead — it records a `skipped` status, and downstream jobs
1132
1153
  gated with `when: 'on-skip'` (or `when: 'always'`) still run, exactly as for an
1133
- `onUnreachable: 'skip'` zero-host fan-out. See the [CLI reference](https://docs.kici.dev/user/cli-reference/#host-narrowing-with---target)
1154
+ `onUnreachable: 'skip'` zero-host fan-out. See the [CLI reference](https://docs.kici.dev/user/cli/runs-and-approvals/#host-narrowing-with---target)
1134
1155
  for the full flag behavior and the [`needs` gating model](https://docs.kici.dev/user/sdk/core/#job-dependencies-needs)
1135
1156
  for how a skipped upstream propagates.
1136
1157
 
@@ -1174,41 +1195,42 @@ All types are exported from `@kici-dev/sdk` as type-only imports.
1174
1195
 
1175
1196
  ### Trigger types
1176
1197
 
1177
- | Type | Description |
1178
- | ------------------------------- | --------------------------------------------------------------------- |
1179
- | `Trigger` | Trigger definition (trigger config + source location) |
1180
- | `TriggerConfig` | Union of all 23 trigger config types |
1181
- | `PrTriggerConfig` | PR trigger configuration (from `pr()`) |
1182
- | `PushTriggerConfig` | Push trigger configuration (from `push()`) |
1183
- | `TagTriggerConfig` | Tag trigger configuration (from `tag()`) |
1184
- | `CommentTriggerConfig` | Comment trigger configuration (from `comment()`) |
1185
- | `ReviewTriggerConfig` | Review trigger configuration (from `review()`) |
1186
- | `ReviewCommentTriggerConfig` | Review comment trigger configuration (from `reviewComment()`) |
1187
- | `ReleaseTriggerConfig` | Release trigger configuration (from `release()`) |
1188
- | `DispatchTriggerConfig` | Repository dispatch trigger configuration (from `dispatch()`) |
1189
- | `CreateTriggerConfig` | Ref creation trigger configuration (from `create()`) |
1190
- | `DeleteTriggerConfig` | Ref deletion trigger configuration (from `delete()`) |
1191
- | `StatusTriggerConfig` | Commit status trigger configuration (from `status()`) |
1192
- | `WorkflowRunTriggerConfig` | Workflow run trigger configuration (from `workflowRun()`) |
1193
- | `ForkTriggerConfig` | Fork trigger configuration (from `fork()`) |
1194
- | `StarTriggerConfig` | Star trigger configuration (from `star()`) |
1195
- | `WatchTriggerConfig` | Watch trigger configuration (from `watch()`) |
1196
- | `WebhookTriggerConfig` | Catch-all webhook trigger configuration (from `webhook()`) |
1197
- | `KiciEventTriggerConfig` | Custom event trigger configuration (from `kiciEvent()`) |
1198
- | `WorkflowCompleteTriggerConfig` | Workflow completion trigger configuration (from `workflowComplete()`) |
1199
- | `JobCompleteTriggerConfig` | Job completion trigger configuration (from `jobComplete()`) |
1200
- | `GenericWebhookTriggerConfig` | Generic webhook trigger configuration (from `genericWebhook()`) |
1201
- | `ScheduleTriggerConfig` | Schedule trigger configuration (from `schedule()`) |
1202
- | `LifecycleTriggerConfig` | Lifecycle trigger configuration (from `lifecycle()`) |
1203
- | `PrConfigInput` | Config object for `pr()` factory |
1204
- | `PushConfigInput` | Config object for `push()` factory |
1205
- | `BranchPattern` | `{ type: 'glob', pattern } \| { type: 'regex', pattern, flags? }` |
1206
- | `PrEvent` | PR event string literal union (17 event types) |
1207
- | `GenericWebhookConfigInput` | Config object for `genericWebhook()` factory |
1208
- | `GenericWebhookAuth` | Union of generic webhook auth types (HMAC or API key) |
1209
- | `GenericWebhookHmacAuth` | HMAC-SHA256 auth configuration for generic webhooks |
1210
- | `GenericWebhookApiKeyAuth` | API key auth configuration for generic webhooks |
1211
- | `GenericWebhookAuthMethod` | Auth method string literal (`'hmac-sha256' \| 'api-key'`) |
1198
+ | Type | Description |
1199
+ | ----------------------------------- | ------------------------------------------------------------------------------ |
1200
+ | `Trigger` | Trigger definition (trigger config + source location) |
1201
+ | `TriggerConfig` | Union of all 23 trigger config types |
1202
+ | `PrTriggerConfig` | PR trigger configuration (from `pr()`) |
1203
+ | `PushTriggerConfig` | Push trigger configuration (from `push()`) |
1204
+ | `TagTriggerConfig` | Tag trigger configuration (from `tag()`) |
1205
+ | `CommentTriggerConfig` | Comment trigger configuration (from `comment()`) |
1206
+ | `ReviewTriggerConfig` | Review trigger configuration (from `review()`) |
1207
+ | `ReviewCommentTriggerConfig` | Review comment trigger configuration (from `reviewComment()`) |
1208
+ | `ReleaseTriggerConfig` | Release trigger configuration (from `release()`) |
1209
+ | `DispatchTriggerConfig` | Repository dispatch trigger configuration (from `dispatch()`) |
1210
+ | `CreateTriggerConfig` | Ref creation trigger configuration (from `create()`) |
1211
+ | `DeleteTriggerConfig` | Ref deletion trigger configuration (from `delete()`) |
1212
+ | `StatusTriggerConfig` | Commit status trigger configuration (from `status()`) |
1213
+ | `WorkflowRunTriggerConfig` | Workflow run trigger configuration (from `workflowRun()`) |
1214
+ | `ForkTriggerConfig` | Fork trigger configuration (from `fork()`) |
1215
+ | `StarTriggerConfig` | Star trigger configuration (from `star()`) |
1216
+ | `WatchTriggerConfig` | Watch trigger configuration (from `watch()`) |
1217
+ | `WebhookTriggerConfig` | Catch-all webhook trigger configuration (from `webhook()`) |
1218
+ | `KiciEventTriggerConfig` | Custom event trigger configuration (from `kiciEvent()`) |
1219
+ | `WorkflowCompleteTriggerConfig` | Workflow completion trigger configuration (from `workflowComplete()`) |
1220
+ | `WorkflowsFailedBatchTriggerConfig` | Batched workflow-failure trigger configuration (from `workflowsFailedBatch()`) |
1221
+ | `JobCompleteTriggerConfig` | Job completion trigger configuration (from `jobComplete()`) |
1222
+ | `GenericWebhookTriggerConfig` | Generic webhook trigger configuration (from `genericWebhook()`) |
1223
+ | `ScheduleTriggerConfig` | Schedule trigger configuration (from `schedule()`) |
1224
+ | `LifecycleTriggerConfig` | Lifecycle trigger configuration (from `lifecycle()`) |
1225
+ | `PrConfigInput` | Config object for `pr()` factory |
1226
+ | `PushConfigInput` | Config object for `push()` factory |
1227
+ | `BranchPattern` | `{ type: 'glob', pattern } \| { type: 'regex', pattern, flags? }` |
1228
+ | `PrEvent` | PR event string literal union (17 event types) |
1229
+ | `GenericWebhookConfigInput` | Config object for `genericWebhook()` factory |
1230
+ | `GenericWebhookAuth` | Union of generic webhook auth types (HMAC or API key) |
1231
+ | `GenericWebhookHmacAuth` | HMAC-SHA256 auth configuration for generic webhooks |
1232
+ | `GenericWebhookApiKeyAuth` | API key auth configuration for generic webhooks |
1233
+ | `GenericWebhookAuthMethod` | Auth method string literal (`'hmac-sha256' \| 'api-key'`) |
1212
1234
 
1213
1235
  ### Rule types
1214
1236