@kici-dev/compiler 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/commands/compile.js +5 -1
- package/dist/commands/doctor.js +8 -2
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.js +77 -12
- package/dist/commands/preview.js +1 -1
- package/dist/commands/report/identity.d.ts +11 -0
- package/dist/commands/report/identity.js +7 -2
- package/dist/commands/run-routed.js +1 -0
- package/dist/commands/types.d.ts +6 -1
- package/dist/commands/types.js +2 -1
- package/dist/execution/executor.js +7 -1
- package/dist/llm-context/llms-architecture.txt +72 -86
- package/dist/llm-context/llms-cli-remote.txt +40 -7
- package/dist/llm-context/llms-cli.txt +67 -34
- package/dist/llm-context/llms-features-execution.txt +52 -6
- package/dist/llm-context/llms-features.txt +137 -6
- package/dist/llm-context/llms-full.txt +527 -174
- package/dist/llm-context/llms-getting-started.txt +3 -3
- package/dist/llm-context/llms-patterns.txt +81 -5
- package/dist/llm-context/llms-providers.txt +6 -2
- package/dist/llm-context/llms-sdk-runtime.txt +22 -18
- package/dist/llm-context/llms-sdk.txt +47 -7
- package/dist/llm-context/llms.txt +8 -8
- package/dist/local-plane/orchestrator-process.d.ts +0 -8
- package/dist/local-plane/orchestrator-process.js +3 -14
- package/dist/local-plane/plane-manager.js +2 -2
- package/dist/lockfile/generator.js +25 -9
- package/dist/lockfile/hasher.d.ts +5 -13
- package/dist/lockfile/hasher.js +1 -15
- package/dist/lockfile/workspace-siblings.d.ts +46 -0
- package/dist/lockfile/workspace-siblings.js +197 -0
- package/dist/templates/package-json.js +1 -1
- package/dist/test-runner/job-executor.js +1 -1
- package/dist/test-runner/rule-evaluator.js +1 -1
- package/dist/types.d.ts +6 -1
- package/package.json +7 -9
- package/sbom.spdx.json +123 -123
- package/dist/postinstall.d.ts +0 -9
- package/dist/postinstall.js +0 -62
- package/hack/postinstall.mjs +0 -105
|
@@ -66,7 +66,7 @@ You declare a gate in your workflow with `approval`. It is available at three le
|
|
|
66
66
|
- **Job** — hold the job before any of its steps run.
|
|
67
67
|
- **Workflow** — hold the whole run before any job is dispatched.
|
|
68
68
|
|
|
69
|
-
A step-level gate can also fire **only when a check/apply step finds drift** — Terraform's plan→apply, per step. See [Drift gates](https://docs.kici.dev/user/approvals/#drift-gates-
|
|
69
|
+
A step-level gate can also fire **only when a check/apply step finds drift** — Terraform's plan→apply, per step. See [Drift gates](https://docs.kici.dev/user/approvals/#drift-gates-when-drift) below.
|
|
70
70
|
|
|
71
71
|
Approvers are named as **teams** and **users**. A team is an operator-defined group of org members; your workflow code may name a team but can never change its membership, which is what makes a team clause a real gate rather than a suggestion. See [Approval gates (operator guide)](https://docs.kici.dev/operator/approvals/) for how operators define teams, the approval queue, and expiry; see [the architecture overview](https://docs.kici.dev/architecture/approvals/) for how a hold is evaluated and resumed.
|
|
72
72
|
|
|
@@ -137,7 +137,7 @@ approval: {
|
|
|
137
137
|
|
|
138
138
|
| Field | Type | Description |
|
|
139
139
|
| ----------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
140
|
-
| `when` | `'always' \| 'drift'` | When the gate fires. `'always'` (default) gates before the element; `'drift'` gates a check/apply step only when it finds drift. See [Drift gates](https://docs.kici.dev/user/approvals/#drift-gates-
|
|
140
|
+
| `when` | `'always' \| 'drift'` | When the gate fires. `'always'` (default) gates before the element; `'drift'` gates a check/apply step only when it finds drift. See [Drift gates](https://docs.kici.dev/user/approvals/#drift-gates-when-drift). |
|
|
141
141
|
| `approvers` | `ApproverClause[]` | The AND list of `{ team }` / `{ user }` clauses. An empty list means "any approval-capable member". |
|
|
142
142
|
| `reason` | `string` | A human-readable label shown in the dashboard queue and the held-for-approval status check. |
|
|
143
143
|
| `timeout` | `number` | Per-gate expiry in **seconds**, overriding the org default. Must be a **positive integer** number of seconds; a non-positive or non-finite value is rejected at compile time. On expiry the element is rejected. |
|
|
@@ -316,7 +316,7 @@ Available rules:
|
|
|
316
316
|
- **Branch restrictions** — only allow specific branches to deploy.
|
|
317
317
|
- **Required reviewer approvals** — gate the run on human sign-off.
|
|
318
318
|
- **Wait timers** — delay execution for a fixed period.
|
|
319
|
-
- **Concurrency limits** —
|
|
319
|
+
- **Concurrency limits** — cap how many jobs run against the context at once.
|
|
320
320
|
|
|
321
321
|
<!-- /help:contexts-protection -->
|
|
322
322
|
|
|
@@ -405,7 +405,7 @@ job('deploy', {
|
|
|
405
405
|
|
|
406
406
|
**Skip-on-test (allow-and-warn).** On a test or local run (`kici run remote`, `kici run <event> --local`), a bound context never rejects the run. Any bound context that disallows local execution (`allowLocalExecution: false`) — or that is not configured — is **skipped**: its variables and secrets are omitted from the merge and its gates are not evaluated. The run proceeds, and a user-visible warning naming the skipped context(s) is shown both on the `kici run remote` CLI output and on the dashboard run view. This makes the test-only-variables pattern work: with `contexts: ['staging', 'my-testing']` where only `my-testing` allows local execution, a test run resolves just `my-testing`'s variables and warns that `staging` was skipped. If every bound context is skipped, the job runs with no environment variables. This is intentionally different from a fixture `secrets:` mapping, which is fail-closed — see the [testing guide](https://docs.kici.dev/user/testing-guide/).
|
|
407
407
|
|
|
408
|
-
**Unconfigured contexts contribute nothing at dispatch.** At dispatch time a bound context name with no matching configured context (and no matching glob context)
|
|
408
|
+
**Unconfigured contexts contribute nothing at dispatch.** At dispatch time a bound context name with no matching configured context (and no matching glob context) adds no variables, secrets, or protection rules — the job still runs, exactly as a single dynamic context resolving to an as-yet-unconfigured name does today.
|
|
409
409
|
|
|
410
410
|
**Registration rejects a provably-unsatisfiable binding.** When a workflow is registered, KiCI statically checks every multi-context binding: a bound context that does not exist, a disabled one, or two contexts with mutually-exclusive fixed branch / trigger-type / repository restrictions (no value can satisfy both) makes the binding provably unsatisfiable, and the registration is rejected with a precise message naming the job, the contexts, and the rule — for example `unsatisfiable context binding: job 'deploy' binds contexts [staging, my-testing] with mutually exclusive branch restrictions (no value satisfies all bound contexts)`. Bindings whose restrictions use globs are undecidable at registration and fall through to the dispatch-time gate check instead.
|
|
411
411
|
|
|
@@ -608,6 +608,36 @@ The children of a matrix job count individually against the limit. A three-child
|
|
|
608
608
|
matrix bound to a context with a limit of two dispatches two children and applies
|
|
609
609
|
the strategy above to the third.
|
|
610
610
|
|
|
611
|
+
A job counts against the limit from the moment it is dispatched until it
|
|
612
|
+
finishes. It does not have to reach an agent first.
|
|
613
|
+
|
|
614
|
+
#### What the limit does and does not guarantee
|
|
615
|
+
|
|
616
|
+
A context concurrency limit is a **throughput control**. Treat it as a cap on
|
|
617
|
+
how much work runs at once, not as a lock.
|
|
618
|
+
|
|
619
|
+
Two events that arrive in the same instant read the limit before either job is
|
|
620
|
+
recorded, so each can be admitted. The window is short — the time between one
|
|
621
|
+
read and one write — but it is real, and it grows with the number of
|
|
622
|
+
orchestrator processes serving the context.
|
|
623
|
+
|
|
624
|
+
When a job must never run beside another copy of itself — a production deploy,
|
|
625
|
+
a database migration — declare a workflow-level
|
|
626
|
+
[concurrency group](https://docs.kici.dev/user/concurrency/) as well:
|
|
627
|
+
|
|
628
|
+
```typescript
|
|
629
|
+
export default workflow('deploy', {
|
|
630
|
+
on: push({ branches: ['main'] }),
|
|
631
|
+
concurrency: { group: () => 'deploy-prod', max: 1 },
|
|
632
|
+
jobs: [/* ... */],
|
|
633
|
+
});
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
That mechanism claims its slot inside a single database transaction, so two
|
|
637
|
+
runs arriving together cannot both take it. The two are complementary: the
|
|
638
|
+
context limit caps throughput across every workflow bound to the context, and
|
|
639
|
+
the concurrency group serializes one workflow against itself.
|
|
640
|
+
|
|
611
641
|
## Dashboard management
|
|
612
642
|
|
|
613
643
|
### Creating contexts
|
|
@@ -914,7 +944,7 @@ registries: [
|
|
|
914
944
|
## Security model
|
|
915
945
|
|
|
916
946
|
- **Per-context scoping.** Every `tokenSecret` and `installEnv` entry is qualified with a context name. The orchestrator runs the same protection-rule pipeline (branch / trust / concurrency / reviewer / wait-timer) against each named context **before** resolving any secret, so a workflow that wants a `production` token from a feature branch is rejected exactly like a job that tries to deploy to `production` from a feature branch. A reviewer-gated install context **pauses** the whole workflow dispatch as a workflow-scoped held run instead of resolving the token — see [Reviewer-gated installs](https://docs.kici.dev/user/private-registries/#reviewer-gated-installs) below.
|
|
917
|
-
- **Untrusted refs get no tokens.** When the trust resolution returns anything other than `trusted` — every fork pull request does — the orchestrator strips
|
|
947
|
+
- **Untrusted refs get no tokens.** When the trust resolution returns anything other than `trusted` — every fork pull request does — the orchestrator strips `npmRegistries`, `installEnvSecrets`, and a container job's [registry credentials](https://docs.kici.dev/user/container-jobs/#private-images) out of the dispatch. The install runs without auth and fails naturally on the first private dep, and a private base image fails to pull. A fork pull request cannot observe a registry token, even if a context lacks an explicit [minimum trust](https://docs.kici.dev/user/contexts/#minimum-trust) rule.
|
|
918
948
|
- **Lifecycle scripts disabled.** Whenever a private registry is in scope, the agent runs the install with `--ignore-scripts` (npm, pnpm, and yarn classic alike; yarn berry gets the equivalent `enableScripts: false`). A malicious `preinstall` / `postinstall` hook in committed `package.json` cannot read the synthesized token env vars, even though they exist in the install subprocess. For a pnpm or yarn workspace, the agent builds your in-repo dependency closure as a separate step **after** the install's auth is torn down, so build scripts never see the tokens either.
|
|
919
949
|
- **Stderr is redacted.** If the install fails, the agent masks every token literal out of the surfaced stderr / stdout chunks before logging.
|
|
920
950
|
- **Job-scoped env-var names.** The synthesized auth env var is `KICI_NPM_TOKEN_<jobIdShort>_<i>` where `jobIdShort` is the first 8 chars of the dispatched job id. The name is unguessable from outside the install subprocess and not reused across jobs.
|
|
@@ -950,7 +980,7 @@ The dashboard JSON lives at `infra/terraform/modules/grafana/dashboards/install-
|
|
|
950
980
|
## See also
|
|
951
981
|
|
|
952
982
|
- [Secrets](https://docs.kici.dev/user/secrets/) — how to seed the `<context>:<secret-name>` values referenced by `tokenSecret` / `installEnv`.
|
|
953
|
-
- [Contexts](https://docs.kici.dev/user/contexts/) — protection rules (
|
|
983
|
+
- [Contexts](https://docs.kici.dev/user/contexts/) — protection rules (branch restrictions, required reviewers, minimum trust) that the install gate inherits.
|
|
954
984
|
- [Operator: `kici-admin org-settings`](https://docs.kici.dev/operator/orchestrator/kici-admin/org-settings/#org-settings----org-level-security-policy) — the `allow_http_npm_registries` toggle and other org-scoped knobs.
|
|
955
985
|
|
|
956
986
|
---
|
|
@@ -1068,6 +1098,107 @@ and the step never holds signing credentials — the orchestrator mints and sign
|
|
|
1068
1098
|
the token on the step's behalf from its own run records. Like `attestProvenance`,
|
|
1069
1099
|
it is only available inside a running job step.
|
|
1070
1100
|
|
|
1101
|
+
## ID-token claims and cloud trust policies
|
|
1102
|
+
|
|
1103
|
+
A cloud provider's OIDC trust policy decides which builds may assume a role. The
|
|
1104
|
+
token below is what your policy matches on, so read this section before you
|
|
1105
|
+
write one.
|
|
1106
|
+
|
|
1107
|
+
### The claim set
|
|
1108
|
+
|
|
1109
|
+
| Claim | Value |
|
|
1110
|
+
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
1111
|
+
| `iss` | Your orchestrator's provenance issuer |
|
|
1112
|
+
| `aud` | The audience you asked for |
|
|
1113
|
+
| `sub` | The build identity — see the two shapes below |
|
|
1114
|
+
| `repository` | `owner/repo` the run acted on |
|
|
1115
|
+
| `ref` | The branch or tag the run PRESENTS. For a pull request this is the **base** branch, not the contributor's branch |
|
|
1116
|
+
| `base_ref` | The same value as `ref`, named the way GitHub Actions names it |
|
|
1117
|
+
| `head_ref` | The pull request's HEAD branch; `''` for a non-PR run |
|
|
1118
|
+
| `head_repository` | `owner/repo` of the pull-request HEAD — the contributor's fork for a fork PR; `''` for a non-PR run |
|
|
1119
|
+
| `is_fork` | `'true'`, `'false'`, or `'unresolved'` |
|
|
1120
|
+
| `event_name` | The event that started the run (`push`, `pull_request:opened`, `schedule`, …) |
|
|
1121
|
+
| `trust_tier` | The resolved trust tier of the triggering actor, or `'unresolved'` |
|
|
1122
|
+
| `actor` | Provider login of the triggering actor |
|
|
1123
|
+
| `sha` | The run's commit |
|
|
1124
|
+
| `workflow_ref` | `<workflow name>@<sha>` |
|
|
1125
|
+
| `kici_run_id` / `kici_job_id` | The run and job this token was minted for |
|
|
1126
|
+
| `org_id` | Your organization id |
|
|
1127
|
+
|
|
1128
|
+
Every claim in the table is **always present**. A value the run did not resolve
|
|
1129
|
+
is `''` or `'unresolved'`, never omitted and never guessed. That matters: an
|
|
1130
|
+
absent claim makes a `StringEquals` condition pass, which would silently remove
|
|
1131
|
+
a constraint you wrote expecting it to be enforced.
|
|
1132
|
+
|
|
1133
|
+
### The two `sub` shapes
|
|
1134
|
+
|
|
1135
|
+
```
|
|
1136
|
+
push, tag, schedule, … repo:<owner/repo>:ref:<ref>:workflow:<workflow name>
|
|
1137
|
+
pull request, review repo:<owner/repo>:pull_request
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
The pull-request shape carries **no ref segment**, mirroring GitHub Actions. A
|
|
1141
|
+
pull request's `ref` is its base branch. So a ref-bearing subject would be
|
|
1142
|
+
identical for a fork pull request targeting `main` and a trusted push to `main`.
|
|
1143
|
+
A policy pinning that subject would hand your cloud role to any contributor who
|
|
1144
|
+
opened a pull request running the same workflow.
|
|
1145
|
+
|
|
1146
|
+
**A re-run keeps the shape of the run it repeats.** Re-running a pull-request
|
|
1147
|
+
run presents `repo:<owner/repo>:pull_request`, because it rebuilds the same
|
|
1148
|
+
commit from the same source. Its `event_name` claim still reads `rerun` — that
|
|
1149
|
+
claim says what started the run, while `sub` says which identity the run
|
|
1150
|
+
presents. A policy that pins the branch-shaped subject therefore does not match
|
|
1151
|
+
a re-run of a pull request, which is the same protection the first run gets.
|
|
1152
|
+
|
|
1153
|
+
### A worked AWS trust policy
|
|
1154
|
+
|
|
1155
|
+
Pin `sub`, and pin the fork context too. `sub` alone tells you a pull request
|
|
1156
|
+
ran; it does not tell you whose code ran.
|
|
1157
|
+
|
|
1158
|
+
```json
|
|
1159
|
+
{
|
|
1160
|
+
"Version": "2012-10-17",
|
|
1161
|
+
"Statement": [
|
|
1162
|
+
{
|
|
1163
|
+
"Effect": "Allow",
|
|
1164
|
+
"Principal": { "Federated": "arn:aws:iam::123456789012:oidc-provider/orch.example.com" },
|
|
1165
|
+
"Action": "sts:AssumeRoleWithWebIdentity",
|
|
1166
|
+
"Condition": {
|
|
1167
|
+
"StringEquals": {
|
|
1168
|
+
"orch.example.com:aud": "sts.amazonaws.com",
|
|
1169
|
+
"orch.example.com:sub": "repo:acme/app:ref:main:workflow:deploy",
|
|
1170
|
+
"orch.example.com:is_fork": "false",
|
|
1171
|
+
"orch.example.com:head_repository": "acme/app",
|
|
1172
|
+
"orch.example.com:trust_tier": "trusted"
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
]
|
|
1177
|
+
}
|
|
1178
|
+
```
|
|
1179
|
+
|
|
1180
|
+
This grants the role only to a run on `main` in `acme/app`, from code in that
|
|
1181
|
+
same repository, triggered by an actor your orchestrator resolved as trusted.
|
|
1182
|
+
A fork pull request fails on all three of the extra conditions, and a run whose
|
|
1183
|
+
context did not resolve fails too — `'unresolved'` matches none of them, so the
|
|
1184
|
+
policy fails closed.
|
|
1185
|
+
|
|
1186
|
+
To let a same-repo pull request assume the role, add a second statement pinning
|
|
1187
|
+
`"sub": "repo:acme/app:pull_request"` alongside `"is_fork": "false"` and
|
|
1188
|
+
`"head_repository": "acme/app"`.
|
|
1189
|
+
|
|
1190
|
+
### Migrating an existing policy
|
|
1191
|
+
|
|
1192
|
+
If you already pin a ref-bearing `sub` for pull-request runs, that policy stops
|
|
1193
|
+
matching once you upgrade — which is the fix, because it was matching runs it
|
|
1194
|
+
should not have. Move it to `repo:<owner/repo>:pull_request` plus the fork
|
|
1195
|
+
conditions above. The same move covers a re-run of a pull request, which
|
|
1196
|
+
presents the pull-request subject too.
|
|
1197
|
+
|
|
1198
|
+
While you migrate, `KICI_OIDC_LEGACY_PR_SUB=1` on the orchestrator restores the
|
|
1199
|
+
old subject. It restores the collision with it, so treat it as a short bridge,
|
|
1200
|
+
not a setting. See [deprecations](https://docs.kici.dev/user/deprecations/).
|
|
1201
|
+
|
|
1071
1202
|
## Verifying an attestation
|
|
1072
1203
|
|
|
1073
1204
|
Verify a bundle with the `kici verify-attestation` command. It establishes the
|