@kici-dev/compiler 0.1.12 → 0.1.14

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 (53) hide show
  1. package/dist/cli.js +22 -20
  2. package/dist/commands/cancel.js +1 -1
  3. package/dist/commands/compile.js +9 -7
  4. package/dist/commands/docs.js +1 -1
  5. package/dist/commands/drain-worker.js +1 -1
  6. package/dist/commands/endpoints.js +1 -1
  7. package/dist/commands/fixture.js +3 -3
  8. package/dist/commands/hook.js +1 -1
  9. package/dist/commands/index.js +6 -6
  10. package/dist/commands/init.js +9 -7
  11. package/dist/commands/login.js +1 -1
  12. package/dist/commands/run.js +7 -7
  13. package/dist/commands/secrets-list.js +1 -1
  14. package/dist/commands/status.js +4 -4
  15. package/dist/commands/test.js +2 -2
  16. package/dist/commands/types.js +1 -1
  17. package/dist/commands/watch.js +1 -1
  18. package/dist/commands/workflows.js +3 -3
  19. package/dist/execution/executor.js +6 -3
  20. package/dist/execution/sdk-alias.js +1 -1
  21. package/dist/execution/ts-loader.d.ts +2 -0
  22. package/dist/execution/ts-loader.js +13 -0
  23. package/dist/fixtures/compiler.d.ts +7 -5
  24. package/dist/fixtures/compiler.js +10 -6
  25. package/dist/llm-context/llms-full.txt +83 -51
  26. package/dist/llm-context/llms.txt +37 -37
  27. package/dist/local-executor/index.js +2 -2
  28. package/dist/local-executor/job-runner.js +4 -1
  29. package/dist/local-executor/output-streamer.js +1 -1
  30. package/dist/local-executor/picker.js +1 -1
  31. package/dist/local-executor/workflow-lock.js +0 -0
  32. package/dist/lockfile/generator.js +3 -3
  33. package/dist/lockfile/hasher.js +1 -1
  34. package/dist/remote/client.js +1 -1
  35. package/dist/remote/encryption.d.ts +1 -1
  36. package/dist/remote/encryption.js +1 -1
  37. package/dist/remote/history.js +2 -2
  38. package/dist/remote/oauth.js +1 -1
  39. package/dist/remote/oidc-discovery.js +1 -1
  40. package/dist/remote/output/streaming.js +1 -1
  41. package/dist/remote/output/summary.js +1 -1
  42. package/dist/remote/uploader.js +1 -1
  43. package/dist/templates/index.js +1 -1
  44. package/dist/templates/package-json.js +1 -1
  45. package/dist/test-runner/dry-run.js +1 -1
  46. package/dist/test-runner/index.js +4 -4
  47. package/dist/test-runner/job-executor.js +1 -1
  48. package/dist/test-runner/output-formatter.js +1 -1
  49. package/dist/test-runner/payload-builder.js +2 -2
  50. package/dist/test-runner/rule-evaluator.js +1 -1
  51. package/dist/test-runner/step-context.js +1 -1
  52. package/package.json +4 -4
  53. package/sbom.spdx.json +1328 -8436
@@ -6,7 +6,7 @@ This file is the concatenated markdown of every KiCI documentation page intended
6
6
 
7
7
  ## User guide
8
8
 
9
- Source: https://kici.dev/docs/user/
9
+ Source: https://docs.kici.dev/user/
10
10
 
11
11
  Documentation for workflow authors -- people writing CI/CD pipelines in TypeScript using the KiCI SDK and compiler. If you are defining workflows, running local tests, or learning the SDK API, start here.
12
12
 
@@ -88,7 +88,7 @@ Cross-repo workflows that let a single workflow repo define jobs which run on ev
88
88
 
89
89
  ## Getting started with KiCI
90
90
 
91
- Source: https://kici.dev/docs/user/getting-started/
91
+ Source: https://docs.kici.dev/user/getting-started/
92
92
 
93
93
  KiCI lets you define CI/CD workflows in TypeScript instead of YAML. You get full language power -- type safety, autocompletion, loops, conditionals, and async/await -- for your build pipelines.
94
94
 
@@ -480,7 +480,7 @@ The lock file approach means the orchestrator stays git-agnostic -- it only need
480
480
 
481
481
  ## 5-minute quickstart
482
482
 
483
- Source: https://kici.dev/docs/user/quickstart/
483
+ Source: https://docs.kici.dev/user/quickstart/
484
484
 
485
485
  KiCI offers two equally-supported quickstart paths. Pick the one that fits your machine — both end with the same working pipeline (orchestrator + agent + your first workflow run visible in the dashboard).
486
486
 
@@ -517,7 +517,7 @@ Both quickstarts deploy a real orchestrator + agent. If you only want to write a
517
517
 
518
518
  ## Basic workflow patterns
519
519
 
520
- Source: https://kici.dev/docs/user/patterns/basic/
520
+ Source: https://docs.kici.dev/user/patterns/basic/
521
521
 
522
522
  A standard lint-then-test pipeline using job dependencies (`needs`):
523
523
 
@@ -767,7 +767,7 @@ Leave `dispatch()` unfiltered while you drive it from `kici run local`. The CLI
767
767
 
768
768
  ## Conditionals & matrix patterns
769
769
 
770
- Source: https://kici.dev/docs/user/patterns/conditionals-matrix/
770
+ Source: https://docs.kici.dev/user/patterns/conditionals-matrix/
771
771
 
772
772
  Rules control whether a workflow or job runs. Use `rule()` for conditions that must pass, and `skip()` for conditions that should skip execution.
773
773
 
@@ -1098,7 +1098,7 @@ This workflow:
1098
1098
 
1099
1099
  ## Integration patterns
1100
1100
 
1101
- Source: https://kici.dev/docs/user/patterns/integrations/
1101
+ Source: https://docs.kici.dev/user/patterns/integrations/
1102
1102
 
1103
1103
  Use internal event triggers to chain workflows together. Workflow A completes, emits an event (or the system auto-emits a completion event), and Workflow B triggers in response.
1104
1104
 
@@ -1412,7 +1412,7 @@ export default workflow('on-github-repo-push', {
1412
1412
 
1413
1413
  ## Pattern reference
1414
1414
 
1415
- Source: https://kici.dev/docs/user/patterns/reference/
1415
+ Source: https://docs.kici.dev/user/patterns/reference/
1416
1416
 
1417
1417
  Every step receives a `StepContext` with these properties:
1418
1418
 
@@ -1490,7 +1490,7 @@ pnpm kici compile # Regenerates kici.lock.json with source locations
1490
1490
 
1491
1491
  ## Scheduling & event patterns
1492
1492
 
1493
- Source: https://kici.dev/docs/user/patterns/scheduling-and-events/
1493
+ Source: https://docs.kici.dev/user/patterns/scheduling-and-events/
1494
1494
 
1495
1495
  Run a full build and test suite on a schedule using `schedule()`. Schedule triggers are evaluated by the orchestrator's Raft leader in clustered deployments.
1496
1496
 
@@ -1684,7 +1684,7 @@ export const autoDeploy = workflow('auto-deploy', {
1684
1684
 
1685
1685
  ## SDK reference: core
1686
1686
 
1687
- Source: https://kici.dev/docs/user/sdk/core/
1687
+ Source: https://docs.kici.dev/user/sdk/core/
1688
1688
 
1689
1689
  ## Factory functions
1690
1690
 
@@ -2171,7 +2171,7 @@ These IDs are stable as long as the order of unnamed entries does not change. Ad
2171
2171
 
2172
2172
  ## SDK reference: idempotent
2173
2173
 
2174
- Source: https://kici.dev/docs/user/sdk/idempotent/
2174
+ Source: https://docs.kici.dev/user/sdk/idempotent/
2175
2175
 
2176
2176
  The SDK exposes two idempotency helpers — a generic function `idempotent()` and a step factory `idempotentStep()` — for the common case where a workflow step should:
2177
2177
 
@@ -2321,7 +2321,7 @@ The caller never has to branch on outcome — `result.result` is always a `Bucke
2321
2321
 
2322
2322
  ## SDK reference: rules, matrix, dynamic jobs
2323
2323
 
2324
- Source: https://kici.dev/docs/user/sdk/rules-matrix-dynamic/
2324
+ Source: https://docs.kici.dev/user/sdk/rules-matrix-dynamic/
2325
2325
 
2326
2326
  ## Rules
2327
2327
 
@@ -2644,7 +2644,7 @@ for (const item of workflow.jobs) {
2644
2644
 
2645
2645
  ## SDK reference: runtime
2646
2646
 
2647
- Source: https://kici.dev/docs/user/sdk/runtime/
2647
+ Source: https://docs.kici.dev/user/sdk/runtime/
2648
2648
 
2649
2649
  ## Types
2650
2650
 
@@ -3110,7 +3110,7 @@ Options can also be provided as an async factory function for dynamic fixture ge
3110
3110
 
3111
3111
  ## SDK reference: triggers
3112
3112
 
3113
- Source: https://kici.dev/docs/user/sdk/triggers/
3113
+ Source: https://docs.kici.dev/user/sdk/triggers/
3114
3114
 
3115
3115
  ## Triggers
3116
3116
 
@@ -3611,7 +3611,7 @@ Glob patterns use micromatch syntax. Regex patterns use standard JavaScript `Reg
3611
3611
 
3612
3612
  ## SDK reference: validation & events
3613
3613
 
3614
- Source: https://kici.dev/docs/user/sdk/validation-events/
3614
+ Source: https://docs.kici.dev/user/sdk/validation-events/
3615
3615
 
3616
3616
  ## Validation
3617
3617
 
@@ -3774,7 +3774,7 @@ The orchestrator automatically emits system events for workflow and job completi
3774
3774
 
3775
3775
  ## SDK reference: waitFor
3776
3776
 
3777
- Source: https://kici.dev/docs/user/sdk/wait-for/
3777
+ Source: https://docs.kici.dev/user/sdk/wait-for/
3778
3778
 
3779
3779
  The SDK exposes two wait-for helpers — a generic function `waitFor()` and a step factory `waitForStep()` — for the common case where a workflow step should:
3780
3780
 
@@ -3890,7 +3890,7 @@ If `check()` throws while polling, the error is logged and polling continues —
3890
3890
 
3891
3891
  ## SDK reference
3892
3892
 
3893
- Source: https://kici.dev/docs/user/sdk-reference/
3893
+ Source: https://docs.kici.dev/user/sdk-reference/
3894
3894
 
3895
3895
  Reference documentation for `@kici-dev/sdk`. The reference is split across five pages by topic.
3896
3896
 
@@ -3927,7 +3927,7 @@ For the complete list of every named export (factory functions, triggers, rules,
3927
3927
 
3928
3928
  ## CLI authentication
3929
3929
 
3930
- Source: https://kici.dev/docs/user/cli-auth/
3930
+ Source: https://docs.kici.dev/user/cli-auth/
3931
3931
 
3932
3932
  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).
3933
3933
 
@@ -4188,7 +4188,7 @@ If the CLI can't reach the server:
4188
4188
 
4189
4189
  ## CLI reference
4190
4190
 
4191
- Source: https://kici.dev/docs/user/cli-reference/
4191
+ Source: https://docs.kici.dev/user/cli-reference/
4192
4192
 
4193
4193
  The `@kici-dev/compiler` package provides the `kici` CLI for compiling, testing, and managing workflows.
4194
4194
 
@@ -4561,15 +4561,14 @@ kici login [options]
4561
4561
 
4562
4562
  **Environment variables:**
4563
4563
 
4564
- | Variable | Default | Description |
4565
- | ---------------------- | ------------------------- | ---------------------------------------------------------------------- |
4566
- | `KICI_PLATFORM_URL` | none (required for OAuth) | Platform API base URL |
4567
- | `KICI_OIDC_ISSUER` | none (required for OAuth) | OIDC issuer URL |
4568
- | `KICI_OIDC_CLIENT_ID` | none (required for OAuth) | OIDC client ID |
4569
- | `KICI_OIDC_PROJECT_ID` | none | OIDC project ID |
4570
- | `KICI_BROWSER_CMD` | uses `open` package | Custom browser command with `{url}` placeholder, or `none` to suppress |
4571
- | `KICI_CALLBACK_PORT` | random | Fixed port for OAuth PKCE callback server |
4572
- | `KICI_CONFIG_DIR` | `~/.kici` | Override config directory |
4564
+ | Variable | Default | Description |
4565
+ | --------------------- | ------------------------- | ---------------------------------------------------------------------- |
4566
+ | `KICI_PLATFORM_URL` | none (required for OAuth) | Platform API base URL |
4567
+ | `KICI_OIDC_ISSUER` | none (required for OAuth) | OIDC issuer URL |
4568
+ | `KICI_OIDC_CLIENT_ID` | none (required for OAuth) | OIDC client ID |
4569
+ | `KICI_BROWSER_CMD` | uses `open` package | Custom browser command with `{url}` placeholder, or `none` to suppress |
4570
+ | `KICI_CALLBACK_PORT` | random | Fixed port for OAuth PKCE callback server |
4571
+ | `KICI_CONFIG_DIR` | `~/.kici` | Override config directory |
4573
4572
 
4574
4573
  **Examples:**
4575
4574
 
@@ -5162,7 +5161,7 @@ Set `KICI_DEBUG=true` for additional internal debug output across all commands.
5162
5161
 
5163
5162
  ## Lifecycle hooks
5164
5163
 
5165
- Source: https://kici.dev/docs/user/hooks/
5164
+ Source: https://docs.kici.dev/user/hooks/
5166
5165
 
5167
5166
  Hooks are callbacks that run at specific points in the execution lifecycle. They let you react to outcomes (cancellation, success, failure) and perform cleanup without affecting the execution flow.
5168
5167
 
@@ -5402,7 +5401,7 @@ _Source: `packages/sdk/src/hooks/`, `packages/sdk/src/types.ts`_
5402
5401
 
5403
5402
  ## Lock file and workflow drift
5404
5403
 
5405
- Source: https://kici.dev/docs/user/lock-file-and-drift/
5404
+ Source: https://docs.kici.dev/user/lock-file-and-drift/
5406
5405
 
5407
5406
  KiCI uses a **two-artifact model**: TypeScript workflows are the source of truth; the lock file (`kici.lock.json`) is the execution contract. The orchestrator reads only the lock file to match triggers and decide cache vs build. Keeping these in sync is important.
5408
5407
 
@@ -5525,7 +5524,7 @@ So even without a pre-commit or CI check, a stale lock file will cause the run t
5525
5524
 
5526
5525
  ## Testing guide
5527
5526
 
5528
- Source: https://kici.dev/docs/user/testing-guide/
5527
+ Source: https://docs.kici.dev/user/testing-guide/
5529
5528
 
5530
5529
  Test your workflows remotely against the full CI pipeline from your local machine. `kici run remote` uploads your current repo state (including uncommitted changes), triggers the pipeline, and streams execution logs back in real time.
5531
5530
 
@@ -5898,7 +5897,7 @@ export const pushMain = fixture('push-main', {
5898
5897
 
5899
5898
  ## Workflow patterns
5900
5899
 
5901
- Source: https://kici.dev/docs/user/workflow-patterns/
5900
+ Source: https://docs.kici.dev/user/workflow-patterns/
5902
5901
 
5903
5902
  Practical patterns for building real-world KiCI workflows in TypeScript. The patterns are organised across five pages -- start with [Basic CI](./patterns/basic.md) if you're new, or jump to [Integrations](./patterns/integrations.md) if you're wiring up a non-GitHub forge or a generic webhook.
5904
5903
 
@@ -5925,7 +5924,7 @@ Practical patterns for building real-world KiCI workflows in TypeScript. The pat
5925
5924
 
5926
5925
  ## Concurrency groups
5927
5926
 
5928
- Source: https://kici.dev/docs/user/concurrency/
5927
+ Source: https://docs.kici.dev/user/concurrency/
5929
5928
 
5930
5929
  Concurrency groups prevent multiple workflow runs from executing in parallel when they target the same resource. Common use cases include preventing parallel deploys to the same environment or serializing database migrations.
5931
5930
 
@@ -6150,10 +6149,34 @@ _Source: `packages/sdk/src/types.ts` (WorkflowOptions.concurrency, JobOptions.co
6150
6149
 
6151
6150
  ## Dashboard
6152
6151
 
6153
- Source: https://kici.dev/docs/user/dashboard/
6152
+ Source: https://docs.kici.dev/user/dashboard/
6154
6153
 
6155
6154
  The KiCI dashboard is a web-based interface for monitoring workflow runs, inspecting job and step details, and reading log output. It is a browser single-page application that authenticates via OIDC and communicates with the Platform tier through REST API endpoints.
6156
6155
 
6156
+ ## Getting started
6157
+
6158
+ <!-- help:getting-started-overview#getting-started -->
6159
+
6160
+ The getting-started page is a six-step checklist that takes you from zero to your first workflow run.
6161
+
6162
+ - **Self-checked steps** -- install the CLI, scaffold a workflow, and run it locally. These run on your own machine, so you tick them off yourself; the dashboard remembers your choices in the browser.
6163
+ - **Auto-detected steps** -- connect an orchestrator, add a webhook source, and trigger your first run. These tick automatically as the dashboard observes the matching activity in your organization.
6164
+
6165
+ Each step links to the relevant settings page or documentation. A progress bar tracks overall completion, and the sidebar entry shows a `done/total` badge until you finish or dismiss reminders.
6166
+
6167
+ <!-- /help:getting-started-overview -->
6168
+
6169
+ When you first sign in to a brand-new organization with no orchestrator, no webhook source, and no runs, the dashboard opens this page automatically. Once your organization has any activity, the run list becomes your landing page instead. The **Getting started** sidebar entry stays available so you can return to the checklist at any time.
6170
+
6171
+ The six steps are:
6172
+
6173
+ 1. **Install the kici CLI** -- `npm install -g kici`.
6174
+ 2. **Create a workflow** -- `kici init` scaffolds a `.kici/` directory in your repository.
6175
+ 3. **Run a workflow locally** -- `kici test pr:open --dry-run` executes a workflow on your machine with no orchestrator required.
6176
+ 4. **Connect an orchestrator** -- deploy an orchestrator and connect it with a join token from **Settings → Orchestrator keys**.
6177
+ 5. **Add a webhook source** -- register a source under **Settings → Sources** so pushes and pull requests trigger runs.
6178
+ 6. **Trigger your first run** -- push to your repository to produce your first run through the relay.
6179
+
6157
6180
  ## Navigation
6158
6181
 
6159
6182
  ### Sidebar
@@ -6161,6 +6184,7 @@ The KiCI dashboard is a web-based interface for monitoring workflow runs, inspec
6161
6184
  The left sidebar provides persistent navigation across all org-scoped pages:
6162
6185
 
6163
6186
  - **Org switcher** -- dropdown at the top to switch between organizations
6187
+ - **Getting started** -- onboarding checklist (shows a `done/total` badge until complete or dismissed)
6164
6188
  - **Runs** -- the default landing page, showing your workflow run history
6165
6189
  - **Workflows** -- permanently registered workflows listening for events
6166
6190
  - **Diagnostics** -- infrastructure health, execution metrics, and recent errors
@@ -7107,7 +7131,7 @@ The dashboard shows informative error pages instead of blank screens:
7107
7131
 
7108
7132
  ## Dynamic values
7109
7133
 
7110
- Source: https://kici.dev/docs/user/dynamic-values/
7134
+ Source: https://docs.kici.dev/user/dynamic-values/
7111
7135
 
7112
7136
  Dynamic values let you compute `environment`, `env`, and `concurrencyGroup` at runtime based on the incoming event. Instead of hardcoding static strings, you pass a function that receives the webhook event payload and returns the resolved value.
7113
7137
 
@@ -7214,7 +7238,7 @@ env: async (event) => {
7214
7238
 
7215
7239
  ## Environment variables
7216
7240
 
7217
- Source: https://kici.dev/docs/user/env-vars/
7241
+ Source: https://docs.kici.dev/user/env-vars/
7218
7242
 
7219
7243
  The KiCI CLI reads the following environment variables to customize its behavior. OAuth login (`kici login` without `--token`) requires `KICI_PLATFORM_URL`, `KICI_OIDC_ISSUER`, and `KICI_OIDC_CLIENT_ID` to be set — the CLI does not ship defaults for them.
7220
7244
 
@@ -7295,7 +7319,7 @@ kici login
7295
7319
 
7296
7320
  ## Environments
7297
7321
 
7298
- Source: https://kici.dev/docs/user/environments/
7322
+ Source: https://docs.kici.dev/user/environments/
7299
7323
 
7300
7324
  <!-- help:environments-list#overview -->
7301
7325
 
@@ -7584,7 +7608,7 @@ interface EnvironmentSecrets {
7584
7608
 
7585
7609
  ## Event system
7586
7610
 
7587
- Source: https://kici.dev/docs/user/events/
7611
+ Source: https://docs.kici.dev/user/events/
7588
7612
 
7589
7613
  KiCI supports two broad categories of workflow triggers: **git-based triggers** that work immediately, and **event-based triggers** that use a registration model. Understanding this distinction is key to working effectively with non-git triggers like schedules, custom events, and generic webhooks.
7590
7614
 
@@ -7959,7 +7983,7 @@ Custom events are delivered immediately when emitted (mid-workflow, not queued u
7959
7983
 
7960
7984
  ## Global workflows
7961
7985
 
7962
- Source: https://kici.dev/docs/user/global-workflows/
7986
+ Source: https://docs.kici.dev/user/global-workflows/
7963
7987
 
7964
7988
  Global workflows let one **workflow repo** define jobs that run on events from many **source repos** in the same org. They're the answer to "I want one CI policy / release pipeline / security scan to fire on every repo without copy-pasting `.kici/` folders everywhere."
7965
7989
 
@@ -8081,7 +8105,7 @@ Non-push triggers work too — `pr()`, `tag()`, `comment()`, `release()`, `workf
8081
8105
 
8082
8106
  ## Private npm registries
8083
8107
 
8084
- Source: https://kici.dev/docs/user/private-registries/
8108
+ Source: https://docs.kici.dev/user/private-registries/
8085
8109
 
8086
8110
  A workflow's `.kici/package.json` may depend on packages published to a private registry — your org's internal CodeArtifact, a GitHub Packages scope, a self-hosted Verdaccio, JFrog, Cloudsmith, GitLab, etc. KiCI ships two ways to authenticate `npm install` against those registries from inside a job, plus an escape hatch for short-lived tokens.
8087
8111
 
@@ -8329,7 +8353,7 @@ The dashboard JSON lives at `infra/terraform/modules/grafana/dashboards/install-
8329
8353
 
8330
8354
  ## Secrets
8331
8355
 
8332
- Source: https://kici.dev/docs/user/secrets/
8356
+ Source: https://docs.kici.dev/user/secrets/
8333
8357
 
8334
8358
  KiCI provides an explicit secrets API that gives workflow steps controlled access to secrets stored in the orchestrator's secret store. Secrets are never auto-injected into `process.env` -- you must explicitly request each secret by name.
8335
8359
 
@@ -8595,7 +8619,7 @@ See [CLI reference](/user/cli) for the `kici types` command.
8595
8619
 
8596
8620
  ## GitHub App provider
8597
8621
 
8598
- Source: https://kici.dev/docs/user/providers/github/
8622
+ Source: https://docs.kici.dev/user/providers/github/
8599
8623
 
8600
8624
  The **GitHub App** is KiCI's flagship source. A single App:
8601
8625
 
@@ -8911,7 +8935,7 @@ and confirm the App is installed on that repo.
8911
8935
 
8912
8936
  ## Universal-git provider
8913
8937
 
8914
- Source: https://kici.dev/docs/user/providers/universal-git/
8938
+ Source: https://docs.kici.dev/user/providers/universal-git/
8915
8939
 
8916
8940
  The **universal-git** provider lets KiCI treat any git forge that speaks a
8917
8941
  GitHub-shaped webhook payload as a first-class source. That covers Forgejo,
@@ -9152,7 +9176,7 @@ with the right PEM.
9152
9176
 
9153
9177
  ## Data flows
9154
9178
 
9155
- Source: https://kici.dev/docs/architecture/data-flows/
9179
+ Source: https://docs.kici.dev/architecture/data-flows/
9156
9180
 
9157
9181
  This document describes the key data flows through the KiCI architecture: webhook delivery, job execution, dependency caching, re-run and cancel, trace ID propagation, internal event routing, and generic webhook ingestion.
9158
9182
 
@@ -9917,7 +9941,7 @@ The Platform tier exposes a `/ws/browser` WebSocket endpoint for dashboard clien
9917
9941
 
9918
9942
  ## Design decisions
9919
9943
 
9920
- Source: https://kici.dev/docs/architecture/design-decisions/
9944
+ Source: https://docs.kici.dev/architecture/design-decisions/
9921
9945
 
9922
9946
  This page explains the rationale behind KiCI's major architectural choices. Each section describes the decision, why it was made, and what alternatives were considered.
9923
9947
 
@@ -10052,7 +10076,7 @@ The orchestrator evaluates static triggers from the lock file -- branch patterns
10052
10076
 
10053
10077
  ## Architecture overview
10054
10078
 
10055
- Source: https://kici.dev/docs/architecture/overview/
10079
+ Source: https://docs.kici.dev/architecture/overview/
10056
10080
 
10057
10081
  KiCI uses a three-tier relay model that separates webhook routing from code execution. Customer code never leaves customer infrastructure -- the Platform tier handles only webhook verification and routing, while the orchestrator and agent tiers run on customer-managed servers.
10058
10082
 
@@ -10137,7 +10161,7 @@ Shared business logic used by all three tiers. Single source of truth for cross-
10137
10161
  - Audit policy and retention (per-action access-log sampling, warm-retention windows for cold-store eligibility, federated activity row schema)
10138
10162
  - Scaler backend type enum (`container`, `bare-metal`, `firecracker`, `kubernetes`)
10139
10163
  - Registration trigger type enum (registerable trigger discriminator)
10140
- - Bundler config (shared bundler configuration consumed by `e2e/helpers/service-deploy.ts`; the agent runtime uses the shared `@kici-dev/shared/ts-loader-hook` to transform TypeScript on import, with no runtime bundler step)
10164
+ - Bundler config (shared bundler configuration consumed by `e2e/helpers/service-deploy.ts`; the agent runtime uses the `@kici-dev/core/ts-loader-hook` to transform TypeScript on import, with no runtime bundler step)
10141
10165
 
10142
10166
  > Source: `packages/engine/src/`
10143
10167
 
@@ -10153,9 +10177,15 @@ CLI tooling for workflow authors. Compiles `.kici/workflows/*.ts` to `.kici/kici
10153
10177
 
10154
10178
  > Source: `packages/compiler/src/`
10155
10179
 
10180
+ ### `@kici-dev/core`
10181
+
10182
+ Light shared utilities with no server-side dependencies — JSON-structured logging, error helpers, human-readable formatting (`formatBytes`/`formatDuration`/`formatUptime`), cryptographic helpers (`sha256`/`sha256File`/`deriveSharedSecret`), zx initialization (`initZx()`), and the TypeScript loader hook that transforms TypeScript on import. It is the dependency-light core that the SDK, compiler, and `kici` CLI consume directly so they stay free of heavier server-only dependencies. `@kici-dev/shared` re-exports it, so existing `@kici-dev/shared` import paths keep working.
10183
+
10184
+ > Source: `packages/core/src/`
10185
+
10156
10186
  ### `@kici-dev/shared`
10157
10187
 
10158
- Shared utilities used across packages. Provides `initZx()` for zx initialization, `createLogger()` for JSON-structured logging with TTY-aware formatting, `createPool()`/`createDb()` for typed PostgreSQL connections, `createMetricsRoutes()`/`createHealthRoutes()` for HTTP route factories (Prometheus metrics and health endpoints), `RingBuffer` for bounded collections, `requestContext`/`getRequestContext()`/`enrichRequestContext()` for async local storage request context, `getReconnectDelay()` for exponential backoff, `formatBytes`/`formatDuration`/`formatUptime` for human-readable formatting, `sha256`/`sha256File`/`deriveSharedSecret` for cryptographic utilities, `initTelemetry`/`createMeter` for OpenTelemetry integration, and `setupGracefulShutdown` for coordinated service shutdown with ordered steps.
10188
+ Shared utilities used across packages, including everything from `@kici-dev/core` (re-exported) plus server-side helpers. Provides `initZx()` for zx initialization, `createLogger()` for JSON-structured logging with TTY-aware formatting, `createPool()`/`createDb()` for typed PostgreSQL connections, `createMetricsRoutes()`/`createHealthRoutes()` for HTTP route factories (Prometheus metrics and health endpoints), `RingBuffer` for bounded collections, `requestContext`/`getRequestContext()`/`enrichRequestContext()` for async local storage request context, `getReconnectDelay()` for exponential backoff, `formatBytes`/`formatDuration`/`formatUptime` for human-readable formatting, `sha256`/`sha256File`/`deriveSharedSecret` for cryptographic utilities, `initTelemetry`/`createMeter` for OpenTelemetry integration, and `setupGracefulShutdown` for coordinated service shutdown with ordered steps.
10159
10189
 
10160
10190
  > Source: `packages/shared/src/`
10161
10191
 
@@ -10181,6 +10211,7 @@ The following diagram shows how `@kici` packages depend on each other. Solid arr
10181
10211
 
10182
10212
  ```mermaid
10183
10213
  flowchart TD
10214
+ CORE["@kici-dev/core"]
10184
10215
  SDK["@kici-dev/sdk"]
10185
10216
  COMPILER["@kici-dev/compiler"]
10186
10217
  SHARED["@kici-dev/shared"]
@@ -10192,10 +10223,11 @@ flowchart TD
10192
10223
 
10193
10224
  DASH --> ENGINE
10194
10225
  DASH -.->|dev| PLATFORM
10226
+ SHARED --> CORE
10195
10227
  SDK --> ENGINE
10196
- SDK --> SHARED
10228
+ SDK --> CORE
10197
10229
  COMPILER --> ENGINE
10198
- COMPILER --> SHARED
10230
+ COMPILER --> CORE
10199
10231
  COMPILER -.->|peer| SDK
10200
10232
  PLATFORM --> ENGINE
10201
10233
  PLATFORM --> SHARED
@@ -10206,12 +10238,12 @@ flowchart TD
10206
10238
  AGENT --> SHARED
10207
10239
  KICI["kici (wrapper)"]
10208
10240
  KICI --> COMPILER
10209
- KICI --> SHARED
10241
+ KICI --> CORE
10210
10242
  KICIADMIN["kici-admin (admin CLI)"]
10211
10243
  KICIADMIN --> ORCH
10212
10244
  ```
10213
10245
 
10214
- **Leaf packages** (no `@kici` dependencies): `@kici-dev/shared` and `@kici-dev/engine`. These can be tested and built independently. The dashboard depends on `@kici-dev/engine` for shared types (protocol schemas, state machine) and imports the Platform's API type definitions as a dev dependency, but communicates with backend services at runtime via HTTP/WebSocket, not at compile time.
10246
+ **Leaf packages** (no `@kici` dependencies): `@kici-dev/core` and `@kici-dev/engine`. These can be tested and built independently. `@kici-dev/shared` builds on `@kici-dev/core` and re-exports it. The dashboard depends on `@kici-dev/engine` for shared types (protocol schemas, state machine) and imports the Platform's API type definitions as a dev dependency, but communicates with backend services at runtime via HTTP/WebSocket, not at compile time.
10215
10247
 
10216
10248
  **Runtime tiers** (Platform, orchestrator, agent) all depend on `@kici-dev/engine` for shared business logic and `@kici-dev/shared` for utilities. Only the agent depends on `@kici-dev/sdk` (it loads workflow definitions at runtime).
10217
10249
 
@@ -2,61 +2,61 @@
2
2
 
3
3
  > KiCI is a TypeScript-native CI/CD workflow engine. Workflows are defined in TypeScript (not YAML), compiled into a portable lock file, and executed by self-hosted agents. The docs below cover the SDK, the CLI, workflow patterns, and the runtime architecture an LLM coding agent needs in order to author and test KiCI workflows.
4
4
 
5
- The full markdown bundle of every page indexed here is available at https://kici.dev/llms-full.txt.
5
+ The full markdown bundle of every page indexed here is available at https://docs.kici.dev/llms-full.txt.
6
6
 
7
7
  ## Getting started
8
8
 
9
- - [User guide](https://kici.dev/docs/user/): Writing and testing CI/CD workflows in TypeScript
10
- - [Getting started with KiCI](https://kici.dev/docs/user/getting-started/): Install the SDK, write your first workflow, compile and test locally
11
- - [5-minute quickstart](https://kici.dev/docs/user/quickstart/): Stand up a KiCI orchestrator + agent and run your first workflow
9
+ - [User guide](https://docs.kici.dev/user/): Writing and testing CI/CD workflows in TypeScript
10
+ - [Getting started with KiCI](https://docs.kici.dev/user/getting-started/): Install the SDK, write your first workflow, compile and test locally
11
+ - [5-minute quickstart](https://docs.kici.dev/user/quickstart/): Stand up a KiCI orchestrator + agent and run your first workflow
12
12
 
13
13
  ## Workflow patterns
14
14
 
15
- - [Basic workflow patterns](https://kici.dev/docs/user/patterns/basic/): Basic CI, PR-only / push-only filters, multiple triggers, manual-only workflows
16
- - [Conditionals & matrix patterns](https://kici.dev/docs/user/patterns/conditionals-matrix/): Conditional execution with rules, matrix builds (static + dynamic), dynamic job generation
17
- - [Integration patterns](https://kici.dev/docs/user/patterns/integrations/): Workflow chaining, generic webhooks, Stripe, self-hosted git forges, plain GitHub repos
18
- - [Pattern reference](https://kici.dev/docs/user/patterns/reference/): Step context, examples repository, GitHub check run output — cross-cutting reference for all patterns
19
- - [Scheduling & event patterns](https://kici.dev/docs/user/patterns/scheduling-and-events/): Nightly cron, workflow-complete-triggered deploys, custom event chaining
15
+ - [Basic workflow patterns](https://docs.kici.dev/user/patterns/basic/): Basic CI, PR-only / push-only filters, multiple triggers, manual-only workflows
16
+ - [Conditionals & matrix patterns](https://docs.kici.dev/user/patterns/conditionals-matrix/): Conditional execution with rules, matrix builds (static + dynamic), dynamic job generation
17
+ - [Integration patterns](https://docs.kici.dev/user/patterns/integrations/): Workflow chaining, generic webhooks, Stripe, self-hosted git forges, plain GitHub repos
18
+ - [Pattern reference](https://docs.kici.dev/user/patterns/reference/): Step context, examples repository, GitHub check run output — cross-cutting reference for all patterns
19
+ - [Scheduling & event patterns](https://docs.kici.dev/user/patterns/scheduling-and-events/): Nightly cron, workflow-complete-triggered deploys, custom event chaining
20
20
 
21
21
  ## SDK reference
22
22
 
23
- - [SDK reference: core](https://kici.dev/docs/user/sdk/core/): Factory functions (workflow, job, step) and authoring patterns: needs, output chaining, dynamic groups
24
- - [SDK reference: idempotent](https://kici.dev/docs/user/sdk/idempotent/): Idempotent helpers for declarative check / apply patterns inside workflow steps
25
- - [SDK reference: rules, matrix, dynamic jobs](https://kici.dev/docs/user/sdk/rules-matrix-dynamic/): rule(), skip(), matrix builds (static + dynamic), and dynamicJob / dynamicGroup
26
- - [SDK reference: runtime](https://kici.dev/docs/user/sdk/runtime/): Types index, StepContext, secrets, fixtures
27
- - [SDK reference: triggers](https://kici.dev/docs/user/sdk/triggers/): GitHub event triggers, kiciEvent, workflowComplete, jobComplete, genericWebhook, schedule, lifecycle
28
- - [SDK reference: validation & events](https://kici.dev/docs/user/sdk/validation-events/): validateDag(), event definitions, and event emission
29
- - [SDK reference: waitFor](https://kici.dev/docs/user/sdk/wait-for/): Polling helpers for steps that pause until an external condition becomes true
30
- - [SDK reference](https://kici.dev/docs/user/sdk-reference/): Complete API reference for @kici-dev/sdk -- workflows, jobs, steps, triggers, rules, matrix, validation, runtime
23
+ - [SDK reference: core](https://docs.kici.dev/user/sdk/core/): Factory functions (workflow, job, step) and authoring patterns: needs, output chaining, dynamic groups
24
+ - [SDK reference: idempotent](https://docs.kici.dev/user/sdk/idempotent/): Idempotent helpers for declarative check / apply patterns inside workflow steps
25
+ - [SDK reference: rules, matrix, dynamic jobs](https://docs.kici.dev/user/sdk/rules-matrix-dynamic/): rule(), skip(), matrix builds (static + dynamic), and dynamicJob / dynamicGroup
26
+ - [SDK reference: runtime](https://docs.kici.dev/user/sdk/runtime/): Types index, StepContext, secrets, fixtures
27
+ - [SDK reference: triggers](https://docs.kici.dev/user/sdk/triggers/): GitHub event triggers, kiciEvent, workflowComplete, jobComplete, genericWebhook, schedule, lifecycle
28
+ - [SDK reference: validation & events](https://docs.kici.dev/user/sdk/validation-events/): validateDag(), event definitions, and event emission
29
+ - [SDK reference: waitFor](https://docs.kici.dev/user/sdk/wait-for/): Polling helpers for steps that pause until an external condition becomes true
30
+ - [SDK reference](https://docs.kici.dev/user/sdk-reference/): Complete API reference for @kici-dev/sdk -- workflows, jobs, steps, triggers, rules, matrix, validation, runtime
31
31
 
32
32
  ## CLI and authoring
33
33
 
34
- - [CLI authentication](https://kici.dev/docs/user/cli-auth/): Authenticate the KiCI CLI with browser OAuth, device flow, or API key paste
35
- - [CLI reference](https://kici.dev/docs/user/cli-reference/): All CLI commands: compile, run (local/remote), test, login, logout, org, status, cancel, secrets, types, fixture, init, hook, endpoints, workflows, docs, admin
36
- - [Lifecycle hooks](https://kici.dev/docs/user/hooks/): SDK hook API for cancel, cleanup, success, failure, and step-level callbacks
37
- - [Lock file and workflow drift](https://kici.dev/docs/user/lock-file-and-drift/): Keep the lock file in sync with your workflow source and avoid drift
38
- - [Testing guide](https://kici.dev/docs/user/testing-guide/): Running remote test fixtures with kici run remote
39
- - [Workflow patterns](https://kici.dev/docs/user/workflow-patterns/): Common patterns: monorepo builds, conditional jobs, dynamic matrices, generic webhooks, scheduling
34
+ - [CLI authentication](https://docs.kici.dev/user/cli-auth/): Authenticate the KiCI CLI with browser OAuth, device flow, or API key paste
35
+ - [CLI reference](https://docs.kici.dev/user/cli-reference/): All CLI commands: compile, run (local/remote), test, login, logout, org, status, cancel, secrets, types, fixture, init, hook, endpoints, workflows, docs, admin
36
+ - [Lifecycle hooks](https://docs.kici.dev/user/hooks/): SDK hook API for cancel, cleanup, success, failure, and step-level callbacks
37
+ - [Lock file and workflow drift](https://docs.kici.dev/user/lock-file-and-drift/): Keep the lock file in sync with your workflow source and avoid drift
38
+ - [Testing guide](https://docs.kici.dev/user/testing-guide/): Running remote test fixtures with kici run remote
39
+ - [Workflow patterns](https://docs.kici.dev/user/workflow-patterns/): Common patterns: monorepo builds, conditional jobs, dynamic matrices, generic webhooks, scheduling
40
40
 
41
41
  ## Workflow features
42
42
 
43
- - [Concurrency groups](https://kici.dev/docs/user/concurrency/): Control parallel execution with auto-cancel and queue modes
44
- - [Dashboard](https://kici.dev/docs/user/dashboard/)
45
- - [Dynamic values](https://kici.dev/docs/user/dynamic-values/)
46
- - [Environment variables](https://kici.dev/docs/user/env-vars/): KICI_* environment variable reference for the CLI
47
- - [Environments](https://kici.dev/docs/user/environments/): Configure deployment environments with variables, secrets, and protection rules
48
- - [Event system](https://kici.dev/docs/user/events/): How KiCI's event model works -- event types, the registration model, event matching, and circuit breaker protection
49
- - [Global workflows](https://kici.dev/docs/user/global-workflows/): Cross-repo workflows that run on events from any repo in the same org
50
- - [Private npm registries](https://kici.dev/docs/user/private-registries/): Authenticate `npm install` against private registries (CodeArtifact, GitHub Packages, Verdaccio, …) from a workflow's `.kici/package.json`
51
- - [Secrets](https://kici.dev/docs/user/secrets/): How to access secrets in KiCI workflow steps
43
+ - [Concurrency groups](https://docs.kici.dev/user/concurrency/): Control parallel execution with auto-cancel and queue modes
44
+ - [Dashboard](https://docs.kici.dev/user/dashboard/)
45
+ - [Dynamic values](https://docs.kici.dev/user/dynamic-values/)
46
+ - [Environment variables](https://docs.kici.dev/user/env-vars/): KICI_* environment variable reference for the CLI
47
+ - [Environments](https://docs.kici.dev/user/environments/): Configure deployment environments with variables, secrets, and protection rules
48
+ - [Event system](https://docs.kici.dev/user/events/): How KiCI's event model works -- event types, the registration model, event matching, and circuit breaker protection
49
+ - [Global workflows](https://docs.kici.dev/user/global-workflows/): Cross-repo workflows that run on events from any repo in the same org
50
+ - [Private npm registries](https://docs.kici.dev/user/private-registries/): Authenticate `npm install` against private registries (CodeArtifact, GitHub Packages, Verdaccio, …) from a workflow's `.kici/package.json`
51
+ - [Secrets](https://docs.kici.dev/user/secrets/): How to access secrets in KiCI workflow steps
52
52
 
53
53
  ## Providers
54
54
 
55
- - [GitHub App provider](https://kici.dev/docs/user/providers/github/): Connect KiCI to GitHub via a GitHub App — full Checks API, installation-token clones, and cross-org dispatch
56
- - [Universal-git provider](https://kici.dev/docs/user/providers/universal-git/): Connect Forgejo, Gitea, Gogs, GitLab, or plain GitHub via webhook + PAT or SSH deploy key
55
+ - [GitHub App provider](https://docs.kici.dev/user/providers/github/): Connect KiCI to GitHub via a GitHub App — full Checks API, installation-token clones, and cross-org dispatch
56
+ - [Universal-git provider](https://docs.kici.dev/user/providers/universal-git/): Connect Forgejo, Gitea, Gogs, GitLab, or plain GitHub via webhook + PAT or SSH deploy key
57
57
 
58
58
  ## Architecture overview
59
59
 
60
- - [Data flows](https://kici.dev/docs/architecture/data-flows/): End-to-end data flows through the KiCI three-tier architecture
61
- - [Design decisions](https://kici.dev/docs/architecture/design-decisions/): Why KiCI's architecture is shaped the way it is
62
- - [Architecture overview](https://kici.dev/docs/architecture/overview/): Three-tier relay model, package structure, and component responsibilities
60
+ - [Data flows](https://docs.kici.dev/architecture/data-flows/): End-to-end data flows through the KiCI three-tier architecture
61
+ - [Design decisions](https://docs.kici.dev/architecture/design-decisions/): Why KiCI's architecture is shaped the way it is
62
+ - [Architecture overview](https://docs.kici.dev/architecture/overview/): Three-tier relay model, package structure, and component responsibilities
@@ -2,8 +2,8 @@ import "../chunk-gOLHoazu.js";
2
2
  import { discoverWorkflows, resolveKiciDir } from "../execution/executor.js";
3
3
  import "../execution/index.js";
4
4
  import { transformTriggers } from "../lockfile/generator.js";
5
- import { compileCommand } from "../commands/compile.js";
6
5
  import { executeDag, resolveJobFilter } from "./dag-scheduler.js";
6
+ import { compileCommand } from "../commands/compile.js";
7
7
  import { loadLocalSecrets } from "./secret-loader.js";
8
8
  import { generateEventPayload } from "./payload-generator.js";
9
9
  import { executeResolvedJob, resolveJobs } from "./job-runner.js";
@@ -14,7 +14,7 @@ import { ConcurrencyKeyEvaluationError, acquireWorkflowLock } from "./workflow-l
14
14
  import pc from "picocolors";
15
15
  import { writeFile } from "node:fs/promises";
16
16
  import path from "node:path";
17
- import { logger } from "@kici-dev/shared";
17
+ import { logger } from "@kici-dev/core";
18
18
  import { matchAllWorkflows } from "@kici-dev/engine";
19
19
  import os from "node:os";
20
20
  //#region src/local-executor/index.ts
@@ -1,4 +1,5 @@
1
1
  import "../chunk-gOLHoazu.js";
2
+ import { ensureTsLoaderHook } from "../execution/ts-loader.js";
2
3
  import { formatter } from "../test-runner/output-formatter.js";
3
4
  import { createStepContext } from "../test-runner/step-context.js";
4
5
  import { createRuleContext, evaluateRules as evaluateRulesWithFormatting } from "../test-runner/rule-evaluator.js";
@@ -21,7 +22,9 @@ import { applyIncludeExclude, expandMatrix, isDynamicJobFn, setJobOutputsMap, se
21
22
  */
22
23
  async function resolveSdkSetters(kiciDir) {
23
24
  if (kiciDir) try {
24
- const sdk = await import(pathToFileURL(path.join(kiciDir, "node_modules", "@kici-dev", "sdk", "dist", "index.js")).href);
25
+ const sdkUrl = pathToFileURL(path.join(kiciDir, "node_modules", "@kici-dev", "sdk", "dist", "index.js")).href;
26
+ ensureTsLoaderHook();
27
+ const sdk = await import(sdkUrl);
25
28
  return {
26
29
  setStepOutputsMap: sdk.setStepOutputsMap,
27
30
  setStepRefMap: sdk.setStepRefMap,
@@ -1,6 +1,6 @@
1
1
  import "../chunk-gOLHoazu.js";
2
2
  import pc from "picocolors";
3
- import { logger } from "@kici-dev/shared";
3
+ import { logger } from "@kici-dev/core";
4
4
  //#region src/local-executor/output-streamer.ts
5
5
  /**
6
6
  * Output formatting for local execution: tree summary, JSON, JUnit XML.
@@ -2,7 +2,7 @@ import "../chunk-gOLHoazu.js";
2
2
  import { transformTriggers } from "../lockfile/generator.js";
3
3
  import { parseEventArg, triggerSummary, triggerToEventArg } from "../test-runner/event-types.js";
4
4
  import pc from "picocolors";
5
- import { logger } from "@kici-dev/shared";
5
+ import { logger } from "@kici-dev/core";
6
6
  import { select } from "@inquirer/prompts";
7
7
  //#region src/local-executor/picker.ts
8
8
  /**
@@ -5,11 +5,11 @@ import { resolveHashFiles } from "./hash-files.js";
5
5
  import { analyzePurity } from "./purity-analyzer.js";
6
6
  import { readFileSync } from "node:fs";
7
7
  import path from "node:path";
8
- import { execSync } from "node:child_process";
9
- import { sha256 } from "@kici-dev/shared";
10
8
  import { getDynamicJobGroup, isDynamicFunction, isDynamicGroupRef, isDynamicJobFn, isStaticArray, isStaticObject } from "@kici-dev/sdk";
11
- import { PackageManager, detectPackageManagerSync } from "@kici-dev/shared/package-manager";
9
+ import { sha256 } from "@kici-dev/core";
10
+ import { PackageManager, detectPackageManagerSync } from "@kici-dev/core/package-manager";
12
11
  import { validateResourceRequest } from "@kici-dev/engine";
12
+ import { execSync } from "node:child_process";
13
13
  //#region src/lockfile/generator.ts
14
14
  /**
15
15
  * Detect git repository root by running `git rev-parse --show-toplevel`.
@@ -1,5 +1,5 @@
1
1
  import "../chunk-gOLHoazu.js";
2
- import { normalizeLineEndings, sha256 } from "@kici-dev/shared";
2
+ import { normalizeLineEndings, sha256 } from "@kici-dev/core";
3
3
  //#region src/lockfile/hasher.ts
4
4
  /**
5
5
  * Compile schema version -- bump when compilation approach changes
@@ -1,5 +1,5 @@
1
1
  import "../chunk-gOLHoazu.js";
2
- import { toErrorMessage } from "@kici-dev/shared";
2
+ import { toErrorMessage } from "@kici-dev/core";
3
3
  //#region src/remote/client.ts
4
4
  /**
5
5
  * REST client for communicating with the KiCI orchestrator.