@kici-dev/compiler 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +20 -6
- package/dist/commands/compile.d.ts +6 -0
- package/dist/commands/compile.js +6 -3
- package/dist/commands/docs.d.ts +8 -8
- package/dist/commands/docs.js +35 -16
- package/dist/commands/org.js +2 -2
- package/dist/commands/run.d.ts +16 -1
- package/dist/commands/run.js +86 -14
- package/dist/commands/test.d.ts +4 -0
- package/dist/commands/types.d.ts +2 -0
- package/dist/commands/types.js +1 -1
- package/dist/fixtures/describe-event.d.ts +6 -0
- package/dist/fixtures/describe-event.js +18 -0
- package/dist/fixtures/picker.d.ts +19 -0
- package/dist/fixtures/picker.js +64 -0
- package/dist/llm-context/llms-architecture.txt +1440 -0
- package/dist/llm-context/llms-cli.txt +2386 -0
- package/dist/llm-context/llms-features.txt +2389 -0
- package/dist/llm-context/llms-full.txt +976 -317
- package/dist/llm-context/llms-getting-started.txt +519 -0
- package/dist/llm-context/llms-patterns.txt +1324 -0
- package/dist/llm-context/llms-providers.txt +805 -0
- package/dist/llm-context/llms-sdk.txt +3725 -0
- package/dist/llm-context/llms.txt +13 -0
- package/dist/local-executor/index.js +40 -3
- package/dist/local-executor/job-runner.d.ts +2 -0
- package/dist/local-executor/job-runner.js +36 -4
- package/dist/local-executor/types.d.ts +2 -0
- package/dist/lockfile/generator.js +13 -4
- package/dist/remote/platform-client.d.ts +6 -0
- package/dist/remote/uploader.js +1 -0
- package/dist/templates/package-json.js +1 -1
- package/dist/test-runner/rule-evaluator.d.ts +1 -1
- package/dist/test-runner/rule-evaluator.js +2 -1
- package/dist/test-runner/step-context.d.ts +1 -1
- package/dist/test-runner/step-context.js +7 -2
- package/dist/types.d.ts +6 -2
- package/package.json +4 -4
- package/sbom.spdx.json +35 -35
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
# KiCI Getting started
|
|
2
|
+
|
|
3
|
+
This bundle covers: Install the SDK, write your first workflow, compile and test locally.
|
|
4
|
+
|
|
5
|
+
## User guide
|
|
6
|
+
|
|
7
|
+
Source: https://docs.kici.dev/user/
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
## Pages
|
|
12
|
+
|
|
13
|
+
### [Getting started with KiCI](https://docs.kici.dev/user/getting-started/)
|
|
14
|
+
|
|
15
|
+
Install the SDK and compiler, write your first workflow, compile it to a lock file, and test it locally with simulated events. Covers prerequisites (Node.js 24+, pnpm), the `kici init` command for scaffolding, and the relationship between workflows, the lock file, and the three-tier runtime.
|
|
16
|
+
|
|
17
|
+
### [SDK reference](https://docs.kici.dev/user/sdk-reference/)
|
|
18
|
+
|
|
19
|
+
Complete API reference for `@kici-dev/sdk`. Covers all factory functions (`workflow()`, `job()`, `step()`), trigger builders (`pr()`, `push()`), rule functions (`rule()`, `skip()`), matrix configuration (static arrays, static objects, dynamic functions, include/exclude), and the `StepContext` interface that steps receive at runtime.
|
|
20
|
+
|
|
21
|
+
### [Lock file and workflow drift](https://docs.kici.dev/user/lock-file-and-drift/)
|
|
22
|
+
|
|
23
|
+
Why the lock file must stay in sync with workflow source, how to commit both together, using pre-commit and CI to catch drift early, and the agent-side hash verification when compiling from source.
|
|
24
|
+
|
|
25
|
+
### [CLI reference](https://docs.kici.dev/user/cli-reference/)
|
|
26
|
+
|
|
27
|
+
All CLI commands provided by `@kici-dev/compiler`: `kici compile` (with watch mode and check mode), `kici run` (local and remote execution), `kici test` (event simulation with dry-run, filtering, debug output, and custom payloads), `kici login`/`logout`/`org` (authentication and org management), `kici diagnostics` (infrastructure tree) and `kici runs` (`list`/`show`/`logs`/`rerun`/`cancel` — run management), `kici secrets` (secret listing), `kici types` (type generation), `kici fixture` (generate test payloads), `kici init` (interactive project scaffolding), `kici hook` (pre-commit hook installation), `kici endpoints` (webhook entrypoints), and `kici workflows` (workflow listing). Includes environment variables and exit codes.
|
|
28
|
+
|
|
29
|
+
### [Workflow patterns](https://docs.kici.dev/user/workflow-patterns/)
|
|
30
|
+
|
|
31
|
+
Common patterns for building real-world CI/CD workflows. Includes examples for basic CI pipelines with job dependencies, monorepo path-based triggering, conditional jobs with rules, matrix builds across Node versions, dynamic jobs generated at runtime, Docker-based step execution, and parallel test splitting.
|
|
32
|
+
|
|
33
|
+
### [Dashboard](https://docs.kici.dev/user/dashboard/)
|
|
34
|
+
|
|
35
|
+
Guide to the KiCI web dashboard. Covers navigation (sidebar, org switcher, mobile bottom tabs), run list (table columns, filters, pagination, empty states), run detail (resizable two-panel layout, job tree, step selection, metadata tabs), log viewer (ANSI color rendering, search, permalink, copy), settings page (tabbed layout), theme toggle, keyboard shortcuts, and error pages.
|
|
36
|
+
|
|
37
|
+
### [Testing guide](https://docs.kici.dev/user/testing-guide/)
|
|
38
|
+
|
|
39
|
+
How to run and write tests for KiCI workflows, including remote test execution with `kici run remote`, fixture-based testing, and overlay mode for uncommitted changes.
|
|
40
|
+
|
|
41
|
+
### [Environments](https://docs.kici.dev/user/environments/)
|
|
42
|
+
|
|
43
|
+
Configure deployment environments (staging, production, review/\*) with variables, scoped secrets, and protection rules. Covers the SDK API (`environment`, `env`, `concurrencyGroup` on jobs), the 8-layer variable merge precedence, protection rules (branch restrictions, required reviewers, wait timers, concurrency), dashboard management, type generation, and migration from the legacy contexts system.
|
|
44
|
+
|
|
45
|
+
### [Environment variables](https://docs.kici.dev/user/env-vars/)
|
|
46
|
+
|
|
47
|
+
Reference for all `KICI_*` environment variables supported by the CLI. Covers authentication overrides (OIDC issuer, client ID, project ID), browser behavior (custom browser command, fixed callback port), development mode, and usage examples for CI/CD, self-hosted, and headless environments.
|
|
48
|
+
|
|
49
|
+
### [CLI authentication](https://docs.kici.dev/user/cli-auth/)
|
|
50
|
+
|
|
51
|
+
Authenticate the KiCI CLI with browser-based OAuth (default), device authorization flow (for headless environments), or API key paste (for CI/CD pipelines). Covers org management and PATs.
|
|
52
|
+
|
|
53
|
+
### [Event system](https://docs.kici.dev/user/events/)
|
|
54
|
+
|
|
55
|
+
Event model concepts: event types, the registration model, event matching, and circuit breaker protection. Understanding this distinction is key to working with non-git triggers like schedules, custom events, and generic webhooks.
|
|
56
|
+
|
|
57
|
+
### [Lifecycle hooks](https://docs.kici.dev/user/hooks/)
|
|
58
|
+
|
|
59
|
+
SDK hook API for cancel, cleanup, success, failure, and step-level callbacks. Hooks run at specific points in the execution lifecycle to react to outcomes and perform cleanup.
|
|
60
|
+
|
|
61
|
+
### [Concurrency groups](https://docs.kici.dev/user/concurrency/)
|
|
62
|
+
|
|
63
|
+
Control parallel execution with auto-cancel and queue modes. Prevent multiple workflow runs from executing in parallel when they target the same resource.
|
|
64
|
+
|
|
65
|
+
### [Dynamic values](https://docs.kici.dev/user/dynamic-values/)
|
|
66
|
+
|
|
67
|
+
Compute `environment`, `env`, and `concurrencyGroup` at runtime based on the incoming event payload. Instead of hardcoding static strings, pass a function that receives the webhook event and returns the resolved value.
|
|
68
|
+
|
|
69
|
+
### [Secrets](https://docs.kici.dev/user/secrets/)
|
|
70
|
+
|
|
71
|
+
Access encrypted secrets in workflow steps via the explicit secrets API. Secrets are never auto-injected into `process.env` -- you must explicitly request each secret by name.
|
|
72
|
+
|
|
73
|
+
### [GitHub App provider](https://docs.kici.dev/user/providers/github/)
|
|
74
|
+
|
|
75
|
+
The flagship source. Covers creating the GitHub App on GitHub's side (permissions, webhook URL, private key), registering it with the orchestrator via `kici-admin source add github`, routing keys (`github:<appId>`), global-workflow policy, enriched Check runs on pull requests, private-key and webhook-secret rotation, and troubleshooting.
|
|
76
|
+
|
|
77
|
+
### [Universal-git provider](https://docs.kici.dev/user/providers/universal-git/)
|
|
78
|
+
|
|
79
|
+
Connect a non-GitHub-App forge (Forgejo, Gitea, Gogs, GitLab, plain GitHub) to KiCI via its webhook. Covers preset selection, PAT and SSH credential wiring, credential rotation, global workflow policy against `generic:<orgId>:<sourceId>` routing keys, and troubleshooting.
|
|
80
|
+
|
|
81
|
+
### [Global workflows](https://docs.kici.dev/user/global-workflows/)
|
|
82
|
+
|
|
83
|
+
Cross-repo workflows that let a single workflow repo define jobs which run on events from many source repos in the same org. Covers the mental model (workflow repo vs. source repo, authoring axis vs. source axis), SDK syntax for declaring globals via `repos:` patterns, the dashboard opt-in flow and per-setting semantics (master toggle, author allow-list, source deny-list, elevated-access list), the security model, and troubleshooting skipped dispatches.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Getting started with workflows
|
|
88
|
+
|
|
89
|
+
Source: https://docs.kici.dev/user/getting-started/
|
|
90
|
+
|
|
91
|
+
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.
|
|
92
|
+
|
|
93
|
+
## Prerequisites
|
|
94
|
+
|
|
95
|
+
- **Node.js 24+** (LTS recommended)
|
|
96
|
+
- **pnpm** (or npm/yarn -- examples use pnpm)
|
|
97
|
+
- Familiarity with TypeScript
|
|
98
|
+
|
|
99
|
+
## Quick start with kici init
|
|
100
|
+
|
|
101
|
+
The recommended way to start a new project is `kici init`. It scaffolds the directory structure, lets you pick a starter template, and installs dependencies for you:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx kici init
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
This will:
|
|
108
|
+
|
|
109
|
+
1. Create `.kici/` directory with `workflows/`, `tests/`, `types/`, `package.json`, and `tsconfig.json`
|
|
110
|
+
2. Create a `.kiciignore` file with sensible defaults
|
|
111
|
+
3. Let you choose from starter workflow templates (hello-world, pr-checks)
|
|
112
|
+
4. Install dependencies using the package manager detected for your repo (npm, pnpm, or yarn)
|
|
113
|
+
5. Update `.gitignore` to exclude `.kici/node_modules/`
|
|
114
|
+
6. Optionally install a pre-commit hook to auto-compile workflows
|
|
115
|
+
|
|
116
|
+
The package manager is detected from your repo's `packageManager` field, lockfile, or the manager that invoked `kici`, defaulting to npm. Pass `--package-manager <npm|pnpm|yarn>` to override it.
|
|
117
|
+
|
|
118
|
+
### Options
|
|
119
|
+
|
|
120
|
+
| Flag | Description |
|
|
121
|
+
| ------------------------------------- | ------------------------------------------------------------ |
|
|
122
|
+
| `--force` | Overwrite existing `.kici/` directory |
|
|
123
|
+
| `--skip-install` | Create files without installing dependencies |
|
|
124
|
+
| `--package-manager <npm\|pnpm\|yarn>` | Force a package manager for the install step (default: auto) |
|
|
125
|
+
| `--mjs` | JavaScript-only mode (no TypeScript, no deps) |
|
|
126
|
+
|
|
127
|
+
### MJS mode
|
|
128
|
+
|
|
129
|
+
If you prefer plain JavaScript without TypeScript compilation:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npx kici init --mjs
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This creates `.mjs` workflow files that run directly without a build step.
|
|
136
|
+
|
|
137
|
+
After running `kici init`, jump straight to [Compile the workflow](https://docs.kici.dev/user/getting-started/#compile-the-workflow) below to compile and preview the scaffolded workflow.
|
|
138
|
+
|
|
139
|
+
## Manual setup
|
|
140
|
+
|
|
141
|
+
If you'd rather wire things up by hand instead of using `kici init`, install the SDK (runtime definitions) and the compiler (CLI tooling) yourself, then create your first workflow.
|
|
142
|
+
|
|
143
|
+
### Install the SDK and compiler
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
pnpm add @kici-dev/sdk
|
|
147
|
+
pnpm add -D @kici-dev/compiler
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The examples use pnpm, but npm and yarn work too. With npm:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm install @kici-dev/sdk
|
|
154
|
+
npm install -D @kici-dev/compiler
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
With yarn:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
yarn add @kici-dev/sdk
|
|
161
|
+
yarn add -D @kici-dev/compiler
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Create the workflow directory
|
|
165
|
+
|
|
166
|
+
KiCI looks for workflows in `.kici/workflows/`:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
mkdir -p .kici/workflows
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Write a workflow
|
|
173
|
+
|
|
174
|
+
Create `.kici/workflows/ci.ts`:
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
import { workflow, job, step, pr } from '@kici-dev/sdk';
|
|
178
|
+
|
|
179
|
+
const lint = job('lint', {
|
|
180
|
+
runsOn: 'linux',
|
|
181
|
+
steps: [
|
|
182
|
+
step('install', async ({ $ }) => {
|
|
183
|
+
await $`pnpm install --frozen-lockfile`;
|
|
184
|
+
}),
|
|
185
|
+
step('lint', async ({ $ }) => {
|
|
186
|
+
await $`pnpm lint`;
|
|
187
|
+
}),
|
|
188
|
+
],
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
const test = job('test', {
|
|
192
|
+
runsOn: 'linux',
|
|
193
|
+
needs: [lint],
|
|
194
|
+
steps: [
|
|
195
|
+
step('install', async ({ $ }) => {
|
|
196
|
+
await $`pnpm install --frozen-lockfile`;
|
|
197
|
+
}),
|
|
198
|
+
step('run-tests', async ({ $ }) => {
|
|
199
|
+
await $`pnpm test`;
|
|
200
|
+
}),
|
|
201
|
+
],
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
export default workflow('ci', {
|
|
205
|
+
on: pr({ target: 'main' }),
|
|
206
|
+
jobs: [lint, test],
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
This workflow:
|
|
211
|
+
|
|
212
|
+
- Triggers on pull requests targeting `main`
|
|
213
|
+
- Runs a `lint` job first
|
|
214
|
+
- Runs a `test` job after lint succeeds (`needs: [lint]`)
|
|
215
|
+
|
|
216
|
+
`runsOn` selects which agents may run a job. Every agent self-reports `kici:os:<platform>`, `kici:arch:<cpu>`, and `kici:host:<hostname>`, so `runsOn: 'kici:os:linux'` targets any connected Linux agent with zero configuration — `kici init` scaffolds workflows with exactly that. Use a custom label such as `'linux'` or `'gpu'` (defined in your scaler's `labelSet`) to target a specific pool instead. See the [runsOn forms](https://docs.kici.dev/user/sdk/core/#runson-forms) reference for the full label model.
|
|
217
|
+
|
|
218
|
+
**Single-step shortcut.** If a job only has one step, pass `run` directly to `job()` instead of building a `steps: [step(...)]` array:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
const deploy = job('deploy', {
|
|
222
|
+
runsOn: 'default',
|
|
223
|
+
run: async ({ $, log }) => {
|
|
224
|
+
await $`./scripts/deploy.sh`;
|
|
225
|
+
log.info('Deployed');
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
`run` and `steps` are mutually exclusive. The shorthand is ideal for deploy/notify/smoke-test jobs. See [Single-step job shorthand](https://docs.kici.dev/user/sdk/core/#single-step-job-shorthand) in the SDK reference for details (output access on the resulting `job.result` is flat -- no step-name nesting).
|
|
231
|
+
|
|
232
|
+
## Compile the workflow
|
|
233
|
+
|
|
234
|
+
The compiler validates your workflow and generates a lock file:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npx kici compile
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Expected output:
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
✓ Compiled workflows → .kici/kici.lock.json (1 workflow)
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
The lock file (`kici.lock.json`) is a JSON representation of your workflow that the KiCI agent uses for execution. Commit this file alongside your workflow source. See [Lock file and workflow drift](https://docs.kici.dev/user/lock-file-and-drift/) for why and how to keep them in sync.
|
|
247
|
+
|
|
248
|
+
## Preview trigger matching
|
|
249
|
+
|
|
250
|
+
Use `kici test` to preview which workflows match a trigger event (dry-run, no execution):
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
npx kici test pr:open
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Expected output (simplified):
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
🔍 DRY RUN - No commands will be executed
|
|
260
|
+
|
|
261
|
+
Workflow: ci
|
|
262
|
+
Triggers:
|
|
263
|
+
- pr
|
|
264
|
+
✓ Matched trigger 1
|
|
265
|
+
Jobs (2):
|
|
266
|
+
lint
|
|
267
|
+
runs-on: linux
|
|
268
|
+
test
|
|
269
|
+
runs-on: linux
|
|
270
|
+
|
|
271
|
+
Decision Summary:
|
|
272
|
+
|
|
273
|
+
ci: ✓ matched
|
|
274
|
+
|
|
275
|
+
✓ Dry run complete
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Run locally
|
|
279
|
+
|
|
280
|
+
Execute matched workflows locally with `kici run local`:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
npx kici run local pr:open
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
This compiles, matches triggers, and runs all matched jobs with DAG-based parallel scheduling.
|
|
287
|
+
|
|
288
|
+
If you do not want to remember the event arg, pass `--pick` (or `-p`) and pick from a list of workflows instead:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
npx kici run local --pick
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
The picker lists each workflow with a summary of its declared triggers, derives the event arg for the one you choose, and runs it through the same pipeline.
|
|
295
|
+
|
|
296
|
+
## Workflow dependencies
|
|
297
|
+
|
|
298
|
+
KiCI workflows can use any npm package. Dependencies are declared in `.kici/package.json`, which `kici init` generates automatically.
|
|
299
|
+
|
|
300
|
+
### Adding dependencies
|
|
301
|
+
|
|
302
|
+
To add a package to your workflows:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
cd .kici
|
|
306
|
+
npm install lodash
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
This updates `.kici/package.json` and generates (or updates) `package-lock.json`.
|
|
310
|
+
|
|
311
|
+
### Dependency resolution contract
|
|
312
|
+
|
|
313
|
+
Every `.kici/` dependency must be resolvable from the **single cloned repository**. When a job runs, the agent clones only this repository and installs `.kici/` dependencies with your repo's package manager — npm, pnpm, yarn classic (v1), and yarn berry (v2+). A dependency that points outside the cloned repo cannot be resolved.
|
|
314
|
+
|
|
315
|
+
In practice:
|
|
316
|
+
|
|
317
|
+
- **From a registry** — the common case. Pin a published version (a private registry works — see [Private registries](https://docs.kici.dev/user/private-registries/)). Available for any package manager.
|
|
318
|
+
- **From an in-repo workspace sibling** — if your `.kici/` is a member of a **pnpm workspace** or a **yarn berry workspace** (a `workspaces` array in the repo-root `package.json`), it can depend on a sibling package in the same repo via `workspace:*` (yarn berry also accepts `portal:`). The whole repo is cloned, so the sibling is present and resolves; the agent also builds your `.kici/` dependency closure after install, so a sibling's build output exists before the workflow that imports it loads. A `file:`/`link:`/`portal:` path is allowed only when it stays inside the repository.
|
|
319
|
+
|
|
320
|
+
What fails fast (with an actionable error naming the dependency, not a raw package-manager error): a `workspace:` dependency in an **npm** project (npm has no workspace protocol — pin a published version or switch to pnpm), a `workspace:`/`portal:` dependency in a **yarn classic** project (v1 has neither — use a version range, pnpm, or yarn berry), a `workspace:` dependency in a **yarn berry** project whose repo-root `package.json` has no `workspaces` array, and any `file:`/`link:`/`portal:` path that points outside the cloned repo.
|
|
321
|
+
|
|
322
|
+
Then use the package in your workflow:
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
import { workflow, job, step, push } from '@kici-dev/sdk';
|
|
326
|
+
import _ from 'lodash';
|
|
327
|
+
|
|
328
|
+
export default workflow('deploy', {
|
|
329
|
+
on: push({ branches: 'main' }),
|
|
330
|
+
jobs: [
|
|
331
|
+
job('process', {
|
|
332
|
+
runsOn: 'default',
|
|
333
|
+
steps: [
|
|
334
|
+
step('transform', async ({ log }) => {
|
|
335
|
+
const data = _.merge({ a: 1 }, { b: 2 });
|
|
336
|
+
log.info(`Merged: ${JSON.stringify(data)}`);
|
|
337
|
+
}),
|
|
338
|
+
],
|
|
339
|
+
}),
|
|
340
|
+
],
|
|
341
|
+
});
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### How dependencies are cached
|
|
345
|
+
|
|
346
|
+
When the KiCI agent runs your workflow, dependencies are handled automatically:
|
|
347
|
+
|
|
348
|
+
1. **First run (cache miss):** A build agent installs dependencies from `.kici/package.json`, packs the resolved dependency tree into a tarball, and uploads it to cache storage. For a pnpm workspace this closure includes the shared store and any in-repo workspace siblings `.kici` resolves.
|
|
349
|
+
2. **Subsequent runs (cache hit):** The execution agent downloads the cached tarball and extracts it -- no install needed.
|
|
350
|
+
3. **Lockfile changes:** When your lockfile changes (`.kici/package-lock.json` for npm, or the repo-root `pnpm-lock.yaml` for a pnpm workspace), the cache is invalidated and a fresh build runs.
|
|
351
|
+
|
|
352
|
+
This means the first run after a dependency change is slower (build + execution), but all subsequent runs are fast.
|
|
353
|
+
|
|
354
|
+
### The .kici/package.json file
|
|
355
|
+
|
|
356
|
+
Every KiCI project needs a `.kici/package.json`. This file:
|
|
357
|
+
|
|
358
|
+
- Declares workflow dependencies (including `@kici-dev/sdk`)
|
|
359
|
+
- Signals the agent to run the dependency cache step
|
|
360
|
+
- Is generated automatically by `kici init`
|
|
361
|
+
|
|
362
|
+
If you are setting up a project manually (without `kici init`), create a minimal `.kici/package.json`:
|
|
363
|
+
|
|
364
|
+
```json
|
|
365
|
+
{
|
|
366
|
+
"name": "@kici-dev/workflows",
|
|
367
|
+
"private": true,
|
|
368
|
+
"type": "module",
|
|
369
|
+
"devDependencies": {
|
|
370
|
+
"@kici-dev/sdk": "^0.0.1"
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
Then run `npm install` in `.kici/` to generate the lockfile. Commit both `package.json` and `package-lock.json` to your repository.
|
|
376
|
+
|
|
377
|
+
## Development mode
|
|
378
|
+
|
|
379
|
+
When developing the KiCI SDK itself (or testing against a local fork), enable development mode.
|
|
380
|
+
|
|
381
|
+
### sdkPath in .kici/package.json
|
|
382
|
+
|
|
383
|
+
Point to a local SDK checkout for IDE autocompletion:
|
|
384
|
+
|
|
385
|
+
```json
|
|
386
|
+
{
|
|
387
|
+
"name": "my-project-kici",
|
|
388
|
+
"devDependencies": {
|
|
389
|
+
"@kici-dev/sdk": ">=0.0.1-0"
|
|
390
|
+
},
|
|
391
|
+
"kici": {
|
|
392
|
+
"sdkPath": "../../packages/sdk"
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
The `sdkPath` field tells the compiler where to resolve TypeScript path mappings for `@kici-dev/sdk`.
|
|
398
|
+
|
|
399
|
+
### KICI_DEV environment variable
|
|
400
|
+
|
|
401
|
+
Set `KICI_DEV=true` to use a prerelease-compatible version range (`>=0.0.1-0`) in generated files, which resolves prerelease builds from a local Verdaccio registry:
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
KICI_DEV=true npx kici init
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Or add the flag to your root `package.json`:
|
|
408
|
+
|
|
409
|
+
```json
|
|
410
|
+
{
|
|
411
|
+
"kici": {
|
|
412
|
+
"development": true
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## Authoring KiCI workflows with LLM coding agents
|
|
418
|
+
|
|
419
|
+
KiCI is LLM-ready by design. Because workflows are real, typed TypeScript, coding agents reason over the SDK's `.d.ts` signatures instead of guessing a bespoke YAML DSL — and they verify their own pipelines with the same `kici test` and `kici run local` loop you use, so there's no push-to-find-out round-trip. First-class agent context ships in the box, so an agent is briefed the moment it opens the project.
|
|
420
|
+
|
|
421
|
+
KiCI ships first-class context for LLM coding agents (Claude Code, Cursor, Aider, etc.). When you scaffold a project with `kici init`, the CLI writes `.kici/AGENTS.md`, a one-page briefing that tells the agent:
|
|
422
|
+
|
|
423
|
+
- where the SDK type declarations live (`node_modules/@kici-dev/sdk/dist/index.d.ts`)
|
|
424
|
+
- the five canonical authoring patterns with runnable examples
|
|
425
|
+
- the anti-patterns that catch agents off-guard (no YAML, no `/dist/...` imports, no top-level `await`)
|
|
426
|
+
- the local commands the agent should drive (`kici compile --check`, `kici test`, `kici run local`, `kici docs llm`)
|
|
427
|
+
|
|
428
|
+
If you don't want the file, pass `--no-agents-md` to `kici init`, or delete the file afterwards — KiCI never reads it at runtime.
|
|
429
|
+
|
|
430
|
+
For coding agents that want the entire documentation set up front, KiCI follows the [llms.txt convention](https://llmstxt.org/):
|
|
431
|
+
|
|
432
|
+
- `https://kici.dev/llms.txt` — curated link index grouped by SDK / patterns / CLI / architecture.
|
|
433
|
+
- `https://kici.dev/llms-full.txt` — concatenated markdown of every page indexed above.
|
|
434
|
+
- `kici docs llm` — print the same `llms-full.txt` bundle to stdout, offline, straight from the installed `@kici-dev/compiler` package. Add `--index` to print the curated `llms.txt` index instead. The agent can pipe the output into its own context buffer with no network call.
|
|
435
|
+
- `kici docs` — open the docs site in your browser.
|
|
436
|
+
|
|
437
|
+
The offline bundle is regenerated from `docs/` every time the package is built, so it always matches the version of KiCI you've installed.
|
|
438
|
+
|
|
439
|
+
## Watch mode
|
|
440
|
+
|
|
441
|
+
During development, run the compiler in watch mode to recompile automatically when workflows change:
|
|
442
|
+
|
|
443
|
+
```bash
|
|
444
|
+
npx kici compile --watch
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
The compiler watches `.kici/workflows/*.ts` and recompiles on every save.
|
|
448
|
+
|
|
449
|
+
## Next steps
|
|
450
|
+
|
|
451
|
+
- **[5-minute quickstart](https://docs.kici.dev/user/quickstart/)** -- ready to run your workflow on real infrastructure? Stand up an orchestrator + agent (Docker / Podman or bare metal)
|
|
452
|
+
- **[SDK reference](https://docs.kici.dev/user/sdk-reference/)** -- complete API for workflows, jobs, steps, triggers, rules, and matrix
|
|
453
|
+
- **[CLI reference](https://docs.kici.dev/user/cli-reference/)** -- all CLI commands with options and examples
|
|
454
|
+
- **[Workflow patterns](https://docs.kici.dev/user/workflow-patterns/)** -- common patterns for real-world CI/CD workflows
|
|
455
|
+
|
|
456
|
+
## How KiCI works
|
|
457
|
+
|
|
458
|
+
KiCI uses a three-layer architecture:
|
|
459
|
+
|
|
460
|
+
```
|
|
461
|
+
SDK (define) -> Compiler (validate) -> Lock file -> Agent (execute)
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
1. **SDK**: You write workflows in TypeScript using factory functions (`workflow()`, `job()`, `step()`). The SDK provides type-safe definitions with full IDE support.
|
|
465
|
+
|
|
466
|
+
2. **Compiler**: The `kici compile` command loads your TypeScript workflows, validates the dependency graph (no cycles, no missing references), and generates `kici.lock.json`.
|
|
467
|
+
|
|
468
|
+
3. **Lock file**: A portable JSON file containing all workflow metadata. The lock file enables the orchestrator to evaluate triggers without cloning your repository.
|
|
469
|
+
|
|
470
|
+
4. **Agent**: The agent receives dispatch instructions, clones your repository, and executes the steps defined in your workflows. Agents are self-hosted and label-routed.
|
|
471
|
+
|
|
472
|
+
The lock file approach means the orchestrator stays git-agnostic -- it only needs the lock file to decide which jobs to run. The agent handles the actual code checkout and step execution.
|
|
473
|
+
|
|
474
|
+
## See also
|
|
475
|
+
|
|
476
|
+
- [SDK reference](https://docs.kici.dev/user/sdk-reference/) -- complete API for workflows, jobs, steps, triggers, rules, and matrix
|
|
477
|
+
- [CLI reference](https://docs.kici.dev/user/cli-reference/) -- all CLI commands with options and examples
|
|
478
|
+
- [Workflow patterns](https://docs.kici.dev/user/workflow-patterns/) -- common patterns for real-world CI/CD workflows
|
|
479
|
+
- [Architecture overview](https://docs.kici.dev/architecture/overview/) -- how the three-tier runtime executes your workflows
|
|
480
|
+
|
|
481
|
+
---
|
|
482
|
+
|
|
483
|
+
## 5-minute quickstart
|
|
484
|
+
|
|
485
|
+
Source: https://docs.kici.dev/user/quickstart/
|
|
486
|
+
|
|
487
|
+
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).
|
|
488
|
+
|
|
489
|
+
Each guide is split into two parts. **Part 1** gets you a green run against your own orchestrator with `kici run remote` — no GitHub App needed, just sign up, bring up the stack, and run. **Part 2** then wires up real GitHub pushes so your team's commits trigger runs automatically. You can stop after Part 1 and come back to Part 2 whenever you're ready.
|
|
490
|
+
|
|
491
|
+
## Option A — Docker / Podman (recommended)
|
|
492
|
+
|
|
493
|
+
Two containers brought up with `docker compose up -d` (orchestrator + PostgreSQL), plus one short-lived agent container spawned per job by the container scaler. Minimal host setup, perfect for a laptop, home server, or a tiny VM. No need to install PostgreSQL or any other system service.
|
|
494
|
+
|
|
495
|
+
[Start with the Docker / Podman quickstart →](https://docs.kici.dev/user/quickstart/compose/)
|
|
496
|
+
|
|
497
|
+
## Option B — Bare-metal install
|
|
498
|
+
|
|
499
|
+
Native systemd services managed by `kici-admin orchestrator install` / `kici-admin agent install` — the orchestrator and agents run as native processes. The backing PostgreSQL runs as a single container by default (one `docker compose up -d`), or you can install it natively if you'd rather not run a container runtime at all. Best for a long-lived Linux host.
|
|
500
|
+
|
|
501
|
+
[Start with the bare-metal quickstart →](https://docs.kici.dev/user/quickstart/bare-metal/)
|
|
502
|
+
|
|
503
|
+
## Which should I pick?
|
|
504
|
+
|
|
505
|
+
| | Docker / Podman | Bare metal |
|
|
506
|
+
| ------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
507
|
+
| Host requirements | `docker` or `podman` with compose v2.20+ | systemd, Node.js 24+, PostgreSQL 18 (container — needs `docker`/`podman` — or native) |
|
|
508
|
+
| First local run (Part 1) | ~5 minutes | ~10 minutes |
|
|
509
|
+
| First GitHub run (Part 2) | + ~10 minutes | + ~10 minutes |
|
|
510
|
+
| Upgrades | `docker compose pull` + restart | `kici-admin orchestrator restart` after `npm install -g kici-admin@latest` |
|
|
511
|
+
| Best for | Quick evaluation, ephemeral hosts | Long-lived production hosts |
|
|
512
|
+
|
|
513
|
+
If you're not sure, pick Docker / Podman.
|
|
514
|
+
|
|
515
|
+
## Looking for the laptop-only path?
|
|
516
|
+
|
|
517
|
+
Both quickstarts deploy a real orchestrator + agent. If you only want to write a workflow and dry-run it on your laptop with no infrastructure, [Getting started](https://docs.kici.dev/user/getting-started/) covers `kici test` and `kici run local` instead.
|
|
518
|
+
|
|
519
|
+
---
|