@kici-dev/compiler 0.1.16 → 0.1.17

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 (136) hide show
  1. package/dist/auth/headless-detect.js +1 -1
  2. package/dist/cli-banner.js +1 -1
  3. package/dist/cli.js +56 -19
  4. package/dist/commands/approve.js +1 -1
  5. package/dist/commands/compile.js +5 -3
  6. package/dist/commands/diagnostics.d.ts +7 -0
  7. package/dist/commands/diagnostics.js +58 -0
  8. package/dist/commands/docs.js +1 -1
  9. package/dist/commands/drain-worker.js +1 -1
  10. package/dist/commands/endpoints.js +1 -1
  11. package/dist/commands/fixture.js +1 -1
  12. package/dist/commands/held-run-client.js +1 -1
  13. package/dist/commands/held-run-resolve.js +1 -1
  14. package/dist/commands/hook.js +1 -1
  15. package/dist/commands/index.d.ts +16 -4
  16. package/dist/commands/index.js +10 -4
  17. package/dist/commands/init.js +2 -2
  18. package/dist/commands/login.d.ts +0 -2
  19. package/dist/commands/login.js +1 -3
  20. package/dist/commands/logout.js +1 -1
  21. package/dist/commands/orchestrators.d.ts +25 -0
  22. package/dist/commands/orchestrators.js +115 -0
  23. package/dist/commands/org.js +1 -1
  24. package/dist/commands/reject.js +1 -1
  25. package/dist/commands/run.d.ts +2 -9
  26. package/dist/commands/run.js +256 -315
  27. package/dist/commands/runs/cancel.d.ts +6 -0
  28. package/dist/commands/runs/cancel.js +32 -0
  29. package/dist/commands/runs/list.d.ts +6 -0
  30. package/dist/commands/runs/list.js +49 -0
  31. package/dist/commands/runs/logs.d.ts +7 -0
  32. package/dist/commands/runs/logs.js +67 -0
  33. package/dist/commands/runs/rerun.d.ts +5 -0
  34. package/dist/commands/runs/rerun.js +21 -0
  35. package/dist/commands/runs/show.d.ts +5 -0
  36. package/dist/commands/runs/show.js +65 -0
  37. package/dist/commands/secrets-list.d.ts +7 -9
  38. package/dist/commands/secrets-list.js +40 -64
  39. package/dist/commands/test.d.ts +4 -0
  40. package/dist/commands/test.js +1 -1
  41. package/dist/commands/types.d.ts +3 -5
  42. package/dist/commands/types.js +13 -37
  43. package/dist/commands/verify-attestation.d.ts +12 -0
  44. package/dist/commands/verify-attestation.js +69 -0
  45. package/dist/commands/watch.js +1 -1
  46. package/dist/commands/workflows.js +14 -34
  47. package/dist/errors/capability-gap.js +1 -1
  48. package/dist/errors/formatter.js +1 -1
  49. package/dist/errors/index.js +1 -1
  50. package/dist/execution/executor.js +1 -1
  51. package/dist/execution/index.js +1 -1
  52. package/dist/execution/sdk-alias.js +1 -1
  53. package/dist/execution/ts-loader.js +1 -1
  54. package/dist/fixtures/compiler.js +1 -1
  55. package/dist/fixtures/defaults/index.js +1 -1
  56. package/dist/format.js +1 -1
  57. package/dist/generators/secrets-dts.js +2 -2
  58. package/dist/hooks/detector.js +1 -1
  59. package/dist/hooks/index.js +1 -1
  60. package/dist/hooks/installer.js +1 -1
  61. package/dist/hooks/templates.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/llm-context/llms-full.txt +1047 -132
  64. package/dist/llm-context/llms.txt +4 -1
  65. package/dist/local-executor/dag-scheduler.js +1 -1
  66. package/dist/local-executor/index.js +1 -1
  67. package/dist/local-executor/job-runner.js +37 -16
  68. package/dist/local-executor/materializer.js +1 -1
  69. package/dist/local-executor/output-streamer.js +1 -1
  70. package/dist/local-executor/payload-generator.js +1 -1
  71. package/dist/local-executor/picker.js +1 -1
  72. package/dist/local-executor/secret-loader.js +1 -1
  73. package/dist/local-executor/to-event-payload.js +1 -1
  74. package/dist/local-executor/types.js +1 -1
  75. package/dist/local-executor/workflow-lock.js +0 -0
  76. package/dist/lockfile/generator.d.ts +7 -5
  77. package/dist/lockfile/generator.js +21 -18
  78. package/dist/lockfile/hash-files.js +1 -1
  79. package/dist/lockfile/hasher.js +1 -1
  80. package/dist/lockfile/index.js +1 -1
  81. package/dist/lockfile/purity-analyzer.js +1 -1
  82. package/dist/postinstall.js +1 -1
  83. package/dist/provenance-trust-root.d.ts +14 -0
  84. package/dist/provenance-trust-root.js +49 -0
  85. package/dist/remote/config.d.ts +6 -2
  86. package/dist/remote/config.js +7 -4
  87. package/dist/remote/dashboard-client.d.ts +92 -0
  88. package/dist/remote/dashboard-client.js +168 -0
  89. package/dist/remote/encryption.js +3 -4
  90. package/dist/remote/history.js +1 -1
  91. package/dist/remote/oauth.js +1 -1
  92. package/dist/remote/oidc-discovery.js +1 -1
  93. package/dist/remote/output/json.js +1 -1
  94. package/dist/remote/output/junit.js +1 -1
  95. package/dist/remote/output/streaming.js +1 -1
  96. package/dist/remote/output/summary.js +1 -1
  97. package/dist/remote/platform-client.d.ts +142 -0
  98. package/dist/remote/platform-client.js +187 -0
  99. package/dist/remote/prod-defaults.js +1 -1
  100. package/dist/remote/render.d.ts +11 -0
  101. package/dist/remote/render.js +48 -0
  102. package/dist/remote/secret-upload.js +1 -1
  103. package/dist/remote/uploader.d.ts +9 -0
  104. package/dist/remote/uploader.js +51 -4
  105. package/dist/templates/agents-md.d.ts +1 -1
  106. package/dist/templates/agents-md.js +8 -3
  107. package/dist/templates/index.js +1 -1
  108. package/dist/templates/package-json.js +4 -5
  109. package/dist/templates/tsconfig-json.js +1 -1
  110. package/dist/templates/workflows/hello-world.js +2 -2
  111. package/dist/templates/workflows/hello-world.ts +1 -1
  112. package/dist/templates/workflows/pr-checks.js +3 -3
  113. package/dist/templates/workflows/pr-checks.ts +2 -2
  114. package/dist/test-runner/dry-run.js +1 -1
  115. package/dist/test-runner/event-types.js +1 -1
  116. package/dist/test-runner/git-detector.js +1 -1
  117. package/dist/test-runner/index.js +1 -1
  118. package/dist/test-runner/job-executor.js +1 -1
  119. package/dist/test-runner/output-formatter.js +1 -1
  120. package/dist/test-runner/payload-builder.js +1 -1
  121. package/dist/test-runner/rule-evaluator.js +1 -1
  122. package/dist/test-runner/secrets-file.js +1 -1
  123. package/dist/test-runner/step-context.js +10 -6
  124. package/dist/types.d.ts +8 -5
  125. package/dist/types.js +2 -1
  126. package/dist/validation/index.js +1 -1
  127. package/dist/validation/validator.js +1 -1
  128. package/dist/workflows/hello-world.ts +1 -1
  129. package/dist/workflows/pr-checks.ts +2 -2
  130. package/package.json +5 -4
  131. package/sbom.spdx.json +68 -38
  132. package/dist/commands/cancel.js +0 -124
  133. package/dist/commands/status.js +0 -212
  134. package/dist/remote/client.js +0 -203
  135. package/dist/remote/observer.js +0 -174
  136. /package/dist/{chunk-gOLHoazu.js → chunk-BTugEXQM.js} +0 -0
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import { encryptTarball } from "./encryption.js";
3
3
  import path from "node:path";
4
4
  import fs from "node:fs/promises";
@@ -30,6 +30,41 @@ function gitLines(cmd, cwd) {
30
30
  return [];
31
31
  }
32
32
  }
33
+ /** True for repo-relative paths inside the `.git` directory. */
34
+ function isGitDirPath(relPath) {
35
+ return relPath === ".git" || relPath.startsWith(".git/");
36
+ }
37
+ /**
38
+ * Recursively enumerate every file under `<repoRoot>/.git`, returning paths
39
+ * relative to `repoRoot` (so they keep the `.git/...` prefix in the tarball
40
+ * and extract back in place).
41
+ *
42
+ * `git ls-files` never lists `.git` contents, so for `kici run remote` — which
43
+ * uploads the developer's working tree as a self-contained overlay with NO
44
+ * clone on the agent — we enumerate the directory explicitly. Including the
45
+ * whole `.git` directory (objects, refs, HEAD, index, config, packed-refs)
46
+ * makes the extracted overlay a real git repository, so workflow steps that
47
+ * shell out to git work exactly as they do under `kici run local`.
48
+ */
49
+ async function collectGitDirFiles(repoRoot) {
50
+ const gitRoot = path.join(repoRoot, ".git");
51
+ const out = [];
52
+ async function walk(absDir) {
53
+ let entries;
54
+ try {
55
+ entries = await fs.readdir(absDir, { withFileTypes: true });
56
+ } catch {
57
+ return;
58
+ }
59
+ await Promise.all(entries.map(async (entry) => {
60
+ const abs = path.join(absDir, entry.name);
61
+ if (entry.isDirectory()) await walk(abs);
62
+ else if (entry.isFile() || entry.isSymbolicLink()) out.push(path.relative(repoRoot, abs));
63
+ }));
64
+ }
65
+ await walk(gitRoot);
66
+ return out;
67
+ }
33
68
  /**
34
69
  * Load .kiciignore patterns from a file.
35
70
  * Returns a picomatch matcher function or null if file doesn't exist.
@@ -56,6 +91,13 @@ async function loadKiciIgnore(kiciIgnorePath) {
56
91
  * files like `.kici/.env.local` — are excluded by `--exclude-standard` and
57
92
  * never appear in the selection.
58
93
  *
94
+ * When `fullWorkingTree` is set (the `kici run remote` path), the entire
95
+ * `.git` directory is additively included so the extracted overlay is a real
96
+ * git repository on the agent — workflow steps that shell out to git then work
97
+ * exactly as they do under `kici run local`. The `.git` files are added after
98
+ * `.kiciignore` filtering (git internals are never subject to working-tree
99
+ * ignore globs).
100
+ *
59
101
  * @param repoRoot - Path to the git repository root
60
102
  * @param options - Optional configuration
61
103
  * @returns HEAD SHA, remote flag, and the existing/deleted file partition
@@ -67,7 +109,7 @@ async function selectOverlayFiles(repoRoot, options) {
67
109
  }).trim();
68
110
  const hasRemote = gitLines("git remote", repoRoot).length > 0;
69
111
  let allFiles;
70
- if (hasRemote) {
112
+ if (hasRemote && !options?.fullWorkingTree) {
71
113
  const unstaged = gitLines("git diff --name-only HEAD", repoRoot);
72
114
  const staged = gitLines("git diff --name-only --cached HEAD", repoRoot);
73
115
  const untracked = gitLines("git ls-files --others --exclude-standard", repoRoot);
@@ -83,6 +125,10 @@ async function selectOverlayFiles(repoRoot, options) {
83
125
  }
84
126
  const kiciIgnore = await loadKiciIgnore(options?.kiciIgnorePath ?? path.join(repoRoot, ".kiciignore"));
85
127
  if (kiciIgnore) allFiles = allFiles.filter((f) => !kiciIgnore(f));
128
+ if (options?.fullWorkingTree) {
129
+ const gitFiles = await collectGitDirFiles(repoRoot);
130
+ allFiles = [...new Set([...allFiles, ...gitFiles])];
131
+ }
86
132
  const existingFiles = [];
87
133
  const deletedFiles = [];
88
134
  await Promise.all(allFiles.map(async (file) => {
@@ -117,8 +163,9 @@ async function selectOverlayFiles(repoRoot, options) {
117
163
  async function createOverlayTarball(repoRoot, options) {
118
164
  const { sha, hasRemote, existingFiles, deletedFiles } = await selectOverlayFiles(repoRoot, options);
119
165
  const untrackedSet = new Set(gitLines("git ls-files --others --exclude-standard", repoRoot));
120
- const newFiles = existingFiles.filter((f) => untrackedSet.has(f));
121
- const modifiedFiles = existingFiles.filter((f) => !untrackedSet.has(f));
166
+ const workingTreeFiles = existingFiles.filter((f) => !isGitDirPath(f));
167
+ const newFiles = workingTreeFiles.filter((f) => untrackedSet.has(f));
168
+ const modifiedFiles = workingTreeFiles.filter((f) => !untrackedSet.has(f));
122
169
  const checksums = {};
123
170
  await Promise.all(existingFiles.map(async (file) => {
124
171
  checksums[file] = await sha256File(path.join(repoRoot, file));
@@ -4,5 +4,5 @@
4
4
  * picked up by Claude Code, Cursor, Aider, and other coding agents that scan
5
5
  * the working tree for an authoring context file.
6
6
  */
7
- export declare const agentsMdTemplate = "# KiCI workflow authoring guide\n\nThis project uses KiCI \u2014 a TypeScript-native CI/CD workflow engine \u2014 instead\nof YAML-based CI. Workflows live in `.kici/workflows/*.ts`, are compiled\ninto a portable lock file, and executed by self-hosted agents.\n\n## Where the API surface lives\n\n- Public SDK types: `node_modules/@kici-dev/sdk/dist/index.d.ts` \u2014 read this\n for the canonical signatures of `workflow`, `job`, `step`, `pr`,\n `push`, `schedule`, `matrix`, `rule`, `dynamicJob`, etc.\n- Bundled offline reference for coding agents: `kici docs llm` prints the\n full markdown documentation bundle to stdout. `kici docs llm --index`\n prints just the curated link index (llms.txt format).\n- Online docs:\n - <https://kici.dev/docs/> \u2014 published docs site.\n - <https://kici.dev/llms.txt> \u2014 curated index for LLM consumers.\n - <https://kici.dev/llms-full.txt> \u2014 full markdown bundle.\n - Key pages: `user/sdk-reference`, `user/workflow-patterns`,\n `user/testing-guide`, `user/hooks`, `user/secrets`.\n\n## The five core patterns\n\n1. **Push trigger** \u2014 `on: push({ branches: 'main' })`. Pair with `paths`\n to scope to subtrees.\n\n ```ts\n import { workflow, job, step, push } from '@kici-dev/sdk';\n\n export default workflow('build', {\n on: push({ branches: 'main' }),\n jobs: [\n job('build', {\n runsOn: 'ubuntu-latest',\n steps: [step('install', async ({ $ }) => { await $`pnpm install`; })],\n }),\n ],\n });\n ```\n\n2. **PR + matrix** \u2014 `pr({ target: 'main' })` plus a matrix over node\n versions. The matrix expands at dispatch time.\n\n ```ts\n import { workflow, job, step, pr, matrix } from '@kici-dev/sdk';\n\n export default workflow('test-matrix', {\n on: pr({ target: 'main' }),\n jobs: [\n job('test', {\n runsOn: 'ubuntu-latest',\n strategy: { matrix: matrix({ node: ['20', '22', '24'] }) },\n steps: [\n step('test', async ({ $, matrix }) => {\n await $`node --version`;\n await $`pnpm install`;\n await $`pnpm test`;\n return { node: matrix.node };\n }),\n ],\n }),\n ],\n });\n ```\n\n3. **Lifecycle hooks** \u2014 `onFailure` / `onSuccess` / `onCancel` on a\n job or workflow run after the main steps in their own scope.\n\n4. **Secrets** \u2014 declared scopes resolve at dispatch:\n\n ```ts\n step('deploy', async ({ $, secrets }) => {\n await $`./scripts/deploy.sh`.env({ DEPLOY_TOKEN: secrets.production.DEPLOY_TOKEN });\n });\n ```\n\n Run `kici secrets list` to enumerate the contexts available for testing.\n\n5. **Dynamic jobs** \u2014 `dynamicJob` and `dynamicGroup` build the DAG at\n runtime from a step's outputs. Don't try to compute job names at top level;\n the lock file would be wrong.\n\n## Anti-patterns\n\n- **Do NOT write `.yml` / `.yaml` CI files** \u2014 KiCI replaces that entire\n layer. There is no compatibility shim.\n- **Do NOT `import` from any `@kici-dev/*` package's `/dist/...`\n subpath** \u2014 those are not part of the public API and break across versions.\n Import from the package root.\n- **Do NOT `await` outside step bodies.** The top-level workflow file is\n loaded by the compiler synchronously; async I/O at module scope means the\n lock file emits before it resolves and the workflow appears empty.\n- **Do NOT mutate shared variables between jobs.** Each job runs in its own\n agent process. Use `needs` + step outputs to thread values.\n- **Do NOT hand-edit `kici.lock.json`.** Regenerate it via `kici compile`.\n\n## Local commands a coding agent should run\n\n| Command | Purpose |\n| ------------------------------- | ------------------------------------------- |\n| `pnpm kici compile --check` | Validate workflow source without writing. |\n| `pnpm kici test pr:open --debug`| Preview which workflows match an event. |\n| `pnpm kici run local push` | Execute workflows locally with no orchestrator. |\n| `pnpm kici docs llm` | Print the full LLM documentation bundle. |\n| `pnpm kici docs llm --index` | Print the curated link index. |\n\nIf `pnpm kici` isn't in scripts, fall back to `npx kici`.\n\n## Loop\n\n1. Read the SDK types from `node_modules/@kici-dev/sdk/dist/index.d.ts`.\n2. Pipe `kici docs llm` into the agent's context if it doesn't already have\n the full bundle.\n3. Edit a workflow under `.kici/workflows/`.\n4. Run `kici compile --check` (zero exit means valid).\n5. Run `kici test <event>` to preview matching.\n6. Run `kici run local <event>` to execute locally before pushing.\n";
7
+ export declare const agentsMdTemplate = "# KiCI workflow authoring guide\n\nThis project uses KiCI \u2014 a TypeScript-native CI/CD workflow engine \u2014 instead\nof YAML-based CI. Workflows live in `.kici/workflows/*.ts`, are compiled\ninto a portable lock file, and executed by self-hosted agents.\n\n## Where the API surface lives\n\n- Public SDK types: `node_modules/@kici-dev/sdk/dist/index.d.ts` \u2014 read this\n for the canonical signatures of `workflow`, `job`, `step`, `pr`,\n `push`, `schedule`, `matrix`, `rule`, `dynamicJob`, etc.\n- Bundled offline reference for coding agents: `kici docs llm` prints the\n full markdown documentation bundle to stdout. `kici docs llm --index`\n prints just the curated link index (llms.txt format).\n- Online docs:\n - <https://kici.dev/docs/> \u2014 published docs site.\n - <https://kici.dev/llms.txt> \u2014 curated index for LLM consumers.\n - <https://kici.dev/llms-full.txt> \u2014 full markdown bundle.\n - Key pages: `user/sdk-reference`, `user/workflow-patterns`,\n `user/testing-guide`, `user/hooks`, `user/secrets`.\n\n## The five core patterns\n\n1. **Push trigger** \u2014 `on: push({ branches: 'main' })`. Pair with `paths`\n to scope to subtrees.\n\n ```ts\n import { workflow, job, step, push } from '@kici-dev/sdk';\n\n export default workflow('build', {\n on: push({ branches: 'main' }),\n jobs: [\n job('build', {\n runsOn: 'kici:os:linux',\n steps: [step('install', async ({ $ }) => { await $`pnpm install`; })],\n }),\n ],\n });\n ```\n\n `kici:os:linux` targets any agent reporting that OS \u2014 every agent\n self-reports `kici:os:` / `kici:arch:` / `kici:host:`. Use a custom label\n (e.g. `'gpu'`, `'prod-pool'`) to target a specific agent pool your scaler\n defines.\n\n2. **PR + matrix** \u2014 `pr({ target: 'main' })` plus a matrix over node\n versions. The matrix expands at dispatch time.\n\n ```ts\n import { workflow, job, step, pr, matrix } from '@kici-dev/sdk';\n\n export default workflow('test-matrix', {\n on: pr({ target: 'main' }),\n jobs: [\n job('test', {\n runsOn: 'kici:os:linux',\n strategy: { matrix: matrix({ node: ['20', '22', '24'] }) },\n steps: [\n step('test', async ({ $, matrix }) => {\n await $`node --version`;\n await $`pnpm install`;\n await $`pnpm test`;\n return { node: matrix.node };\n }),\n ],\n }),\n ],\n });\n ```\n\n3. **Lifecycle hooks** \u2014 `onFailure` / `onSuccess` / `onCancel` on a\n job or workflow run after the main steps in their own scope.\n\n4. **Secrets** \u2014 declared scopes resolve at dispatch:\n\n ```ts\n step('deploy', async ({ $, secrets }) => {\n await $`./scripts/deploy.sh`.env({ DEPLOY_TOKEN: secrets.production.DEPLOY_TOKEN });\n });\n ```\n\n Run `kici secrets list` to enumerate the contexts available for testing.\n\n5. **Dynamic jobs** \u2014 `dynamicJob` and `dynamicGroup` build the DAG at\n runtime from a step's outputs. Don't try to compute job names at top level;\n the lock file would be wrong.\n\n## Anti-patterns\n\n- **Do NOT write `.yml` / `.yaml` CI files** \u2014 KiCI replaces that entire\n layer. There is no compatibility shim.\n- **Do NOT `import` from any `@kici-dev/*` package's `/dist/...`\n subpath** \u2014 those are not part of the public API and break across versions.\n Import from the package root.\n- **Do NOT `await` outside step bodies.** The top-level workflow file is\n loaded by the compiler synchronously; async I/O at module scope means the\n lock file emits before it resolves and the workflow appears empty.\n- **Do NOT mutate shared variables between jobs.** Each job runs in its own\n agent process. Use `needs` + step outputs to thread values.\n- **Do NOT hand-edit `kici.lock.json`.** Regenerate it via `kici compile`.\n\n## Local commands a coding agent should run\n\n| Command | Purpose |\n| ------------------------------- | ------------------------------------------- |\n| `pnpm kici compile --check` | Validate workflow source without writing. |\n| `pnpm kici test pr:open --debug`| Preview which workflows match an event. |\n| `pnpm kici run local push` | Execute workflows locally with no orchestrator. |\n| `pnpm kici docs llm` | Print the full LLM documentation bundle. |\n| `pnpm kici docs llm --index` | Print the curated link index. |\n\nIf `pnpm kici` isn't in scripts, fall back to `npx kici`.\n\n## Loop\n\n1. Read the SDK types from `node_modules/@kici-dev/sdk/dist/index.d.ts`.\n2. Pipe `kici docs llm` into the agent's context if it doesn't already have\n the full bundle.\n3. Edit a workflow under `.kici/workflows/`.\n4. Run `kici compile --check` (zero exit means valid).\n5. Run `kici test <event>` to preview matching.\n6. Run `kici run local <event>` to execute locally before pushing.\n";
8
8
  //# sourceMappingURL=agents-md.d.ts.map
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  //#region src/templates/agents-md.ts
3
3
  /**
4
4
  * Template body for .kici/AGENTS.md, written by `kici init` (unless opted out
@@ -39,13 +39,18 @@ into a portable lock file, and executed by self-hosted agents.
39
39
  on: push({ branches: 'main' }),
40
40
  jobs: [
41
41
  job('build', {
42
- runsOn: 'ubuntu-latest',
42
+ runsOn: 'kici:os:linux',
43
43
  steps: [step('install', async ({ $ }) => { await $\`pnpm install\`; })],
44
44
  }),
45
45
  ],
46
46
  });
47
47
  \`\`\`
48
48
 
49
+ \`kici:os:linux\` targets any agent reporting that OS — every agent
50
+ self-reports \`kici:os:\` / \`kici:arch:\` / \`kici:host:\`. Use a custom label
51
+ (e.g. \`'gpu'\`, \`'prod-pool'\`) to target a specific agent pool your scaler
52
+ defines.
53
+
49
54
  2. **PR + matrix** — \`pr({ target: 'main' })\` plus a matrix over node
50
55
  versions. The matrix expands at dispatch time.
51
56
 
@@ -56,7 +61,7 @@ into a portable lock file, and executed by self-hosted agents.
56
61
  on: pr({ target: 'main' }),
57
62
  jobs: [
58
63
  job('test', {
59
- runsOn: 'ubuntu-latest',
64
+ runsOn: 'kici:os:linux',
60
65
  strategy: { matrix: matrix({ node: ['20', '22', '24'] }) },
61
66
  steps: [
62
67
  step('test', async ({ $, matrix }) => {
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import { agentsMdTemplate } from "./agents-md.js";
3
3
  import { helloWorldWorkflow } from "./workflows/hello-world.js";
4
4
  import { prChecksWorkflow } from "./workflows/pr-checks.js";
@@ -1,6 +1,6 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  //#region src/templates/package-json.ts
3
- const sdkVersion = "0.1.16";
3
+ const sdkVersion = "0.1.17";
4
4
  /**
5
5
  * Generate package.json content for .kici/ directory
6
6
  *
@@ -10,7 +10,7 @@ const sdkVersion = "0.1.16";
10
10
  * @returns JSON string with proper formatting (2-space indent, trailing newline)
11
11
  */
12
12
  function generatePackageJson(devMode = false) {
13
- const pkg = {
13
+ return JSON.stringify({
14
14
  name: "@kici-dev/workflows",
15
15
  private: true,
16
16
  type: "module",
@@ -19,8 +19,7 @@ function generatePackageJson(devMode = false) {
19
19
  typecheck: "tsc --noEmit"
20
20
  },
21
21
  devDependencies: { "@kici-dev/sdk": devMode ? ">=0.0.1-0" : `^${sdkVersion}` }
22
- };
23
- return JSON.stringify(pkg, null, 2) + "\n";
22
+ }, null, 2) + "\n";
24
23
  }
25
24
  //#endregion
26
25
  export { generatePackageJson };
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  //#region src/templates/tsconfig-json.ts
3
3
  /**
4
4
  * tsconfig.json template for kici init command
@@ -1,10 +1,10 @@
1
- import "../../chunk-gOLHoazu.js";
1
+ import "../../chunk-BTugEXQM.js";
2
2
  import { job, push, step, workflow } from "@kici-dev/sdk";
3
3
  //#region src/templates/workflows/hello-world.ts
4
4
  const helloWorldWorkflow = workflow("hello-world", {
5
5
  on: push(),
6
6
  jobs: [job("greet", {
7
- runsOn: "ubuntu-latest",
7
+ runsOn: "kici:os:linux",
8
8
  steps: [step("say-hello", async ({ $ }) => {
9
9
  await $`echo "Hello, World!"`;
10
10
  })]
@@ -10,7 +10,7 @@ export const helloWorldWorkflow = workflow('hello-world', {
10
10
 
11
11
  jobs: [
12
12
  job('greet', {
13
- runsOn: 'ubuntu-latest',
13
+ runsOn: 'kici:os:linux',
14
14
  steps: [
15
15
  step('say-hello', async ({ $ }) => {
16
16
  await $`echo "Hello, World!"`;
@@ -1,4 +1,4 @@
1
- import "../../chunk-gOLHoazu.js";
1
+ import "../../chunk-BTugEXQM.js";
2
2
  import { isEventType, job, pr, rule, skip, step, workflow } from "@kici-dev/sdk";
3
3
  //#region src/templates/workflows/pr-checks.ts
4
4
  const prChecksWorkflow = workflow("pr-checks", {
@@ -13,14 +13,14 @@ const prChecksWorkflow = workflow("pr-checks", {
13
13
  return ctx.changedFiles.some((file) => file.startsWith("src/"));
14
14
  })],
15
15
  jobs: [job("lint", {
16
- runsOn: "ubuntu-latest",
16
+ runsOn: "kici:os:linux",
17
17
  steps: [step("checkout", async ({ $ }) => {
18
18
  await $`echo "Checking out code..."`;
19
19
  }), step("run-linter", async ({ $ }) => {
20
20
  await $`echo "Running linter..."`;
21
21
  })]
22
22
  }), job("test", {
23
- runsOn: "ubuntu-latest",
23
+ runsOn: "kici:os:linux",
24
24
  needs: ["lint"],
25
25
  steps: [
26
26
  step("checkout", async ({ $ }) => {
@@ -26,7 +26,7 @@ export const prChecksWorkflow = workflow('pr-checks', {
26
26
  // Jobs: run in parallel unless connected via `needs`
27
27
  jobs: [
28
28
  job('lint', {
29
- runsOn: 'ubuntu-latest',
29
+ runsOn: 'kici:os:linux',
30
30
  steps: [
31
31
  step('checkout', async ({ $ }) => {
32
32
  await $`echo "Checking out code..."`;
@@ -39,7 +39,7 @@ export const prChecksWorkflow = workflow('pr-checks', {
39
39
  }),
40
40
 
41
41
  job('test', {
42
- runsOn: 'ubuntu-latest',
42
+ runsOn: 'kici:os:linux',
43
43
  needs: ['lint'], // Waits for lint to pass
44
44
  steps: [
45
45
  step('checkout', async ({ $ }) => {
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import pc from "picocolors";
3
3
  import { logger } from "@kici-dev/core";
4
4
  //#region src/test-runner/dry-run.ts
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  //#region src/test-runner/event-types.ts
3
3
  /**
4
4
  * Parse CLI event argument to EventType.
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import path from "node:path";
3
3
  import { readFile } from "node:fs/promises";
4
4
  //#region src/test-runner/git-detector.ts
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import { displayDryRun } from "./dry-run.js";
3
3
  import { parseEventArg, triggerSummary, triggerToEventArg } from "./event-types.js";
4
4
  import { detectRepoFromGit } from "./git-detector.js";
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import { formatter } from "./output-formatter.js";
3
3
  import { createStepContext } from "./step-context.js";
4
4
  import { createRuleContext, evaluateRules as evaluateRulesWithFormatting } from "./rule-evaluator.js";
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import pc from "picocolors";
3
3
  import { logger } from "@kici-dev/core";
4
4
  //#region src/test-runner/output-formatter.ts
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import { parseEventArg } from "./event-types.js";
3
3
  import { detectRepoFromGit } from "./git-detector.js";
4
4
  import { getDefaultFixture } from "../fixtures/defaults/index.js";
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import { formatter } from "./output-formatter.js";
3
3
  import { evaluateRules } from "@kici-dev/sdk";
4
4
  import { initZx } from "@kici-dev/core";
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import path from "node:path";
3
3
  import { readFile } from "node:fs/promises";
4
4
  //#region src/test-runner/secrets-file.ts
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import { formatter } from "./output-formatter.js";
3
3
  import { join } from "node:path";
4
4
  import { chmodSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
@@ -128,14 +128,18 @@ function createStepContext(workflowInfo, jobInfo, repoRoot, inputs = {}, matrix,
128
128
  return resolveJobOutputs(ref);
129
129
  },
130
130
  setSecretOutput: () => {},
131
- kici: { infrastructure: { list: () => Promise.resolve({
132
- scalers: [],
133
- agents: []
134
- }) } },
131
+ kici: {
132
+ infrastructure: { list: () => Promise.resolve({
133
+ scalers: [],
134
+ agents: []
135
+ }) },
136
+ oidc: { token: () => Promise.reject(/* @__PURE__ */ new Error("ctx.kici.oidc.token() is not available in the local test runner")) }
137
+ },
135
138
  cache: {
136
139
  restore: async () => ({ hit: false }),
137
140
  save: async () => {}
138
- }
141
+ },
142
+ attestProvenance: () => Promise.reject(/* @__PURE__ */ new Error("ctx.attestProvenance() is not available in the local test runner"))
139
143
  };
140
144
  }
141
145
  //#endregion
package/dist/types.d.ts CHANGED
@@ -10,6 +10,7 @@
10
10
  * v8 adds runsOn polymorphic type (string | string[] | selector) and excludeLabels.
11
11
  * v11 adds LockInlineValue type for pure function inline evaluation.
12
12
  * v15 adds per-job init config(s).
13
+ * v17 widens per-job init to typed presets ('mise' / { mise }) and 'auto' detection.
13
14
  */
14
15
  import type { ResourceRequest, ApproverClause } from '@kici-dev/engine';
15
16
  /**
@@ -22,7 +23,7 @@ export interface LockApproval {
22
23
  readonly timeoutSeconds?: number;
23
24
  }
24
25
  /** Schema version - re-exported from engine as single source of truth */
25
- export declare const SCHEMA_VERSION: 16;
26
+ export declare const SCHEMA_VERSION: 17;
26
27
  /**
27
28
  * Source file reference with meaningful path.
28
29
  * Format: file is relative path from git root, export uses hash syntax.
@@ -425,11 +426,13 @@ export interface LockJob {
425
426
  */
426
427
  readonly resources?: ResourceRequest;
427
428
  /**
428
- * Per-job init config(s) run after clone, before steps. `false` is an explicit
429
- * opt-out. Threaded verbatim from the SDK `Job.init` -- the agent reads it from
430
- * the loaded module, the lock copy is for orchestrator/dashboard visibility.
429
+ * Per-job init config(s) run after clone, before steps. A generic config,
430
+ * a typed preset (`'mise'` / `{ mise }`), an ordered array, `'auto'`
431
+ * (detect from committed files), or `false` (opt-out). Threaded verbatim from
432
+ * the SDK `Job.init` -- the agent reads it from the loaded module, the lock
433
+ * copy is for orchestrator/dashboard visibility.
431
434
  */
432
- readonly init?: import('@kici-dev/sdk').GenericInitConfig | readonly import('@kici-dev/sdk').GenericInitConfig[] | false;
435
+ readonly init?: import('@kici-dev/sdk').InitConfig;
433
436
  /** Normalized approval gate; when set the job is held before dispatch. */
434
437
  readonly approval?: LockApproval;
435
438
  }
package/dist/types.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./chunk-gOLHoazu.js";
1
+ import "./chunk-BTugEXQM.js";
2
2
  import { SCHEMA_VERSION as SCHEMA_VERSION$1 } from "@kici-dev/engine";
3
3
  //#region src/types.ts
4
4
  /**
@@ -13,6 +13,7 @@ import { SCHEMA_VERSION as SCHEMA_VERSION$1 } from "@kici-dev/engine";
13
13
  * v8 adds runsOn polymorphic type (string | string[] | selector) and excludeLabels.
14
14
  * v11 adds LockInlineValue type for pure function inline evaluation.
15
15
  * v15 adds per-job init config(s).
16
+ * v17 widens per-job init to typed presets ('mise' / { mise }) and 'auto' detection.
16
17
  */
17
18
  /** Schema version - re-exported from engine as single source of truth */
18
19
  const SCHEMA_VERSION = SCHEMA_VERSION$1;
@@ -1,3 +1,3 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import { validateConfig } from "./validator.js";
3
3
  export { validateConfig };
@@ -1,4 +1,4 @@
1
- import "../chunk-gOLHoazu.js";
1
+ import "../chunk-BTugEXQM.js";
2
2
  import { compilerError } from "../errors/formatter.js";
3
3
  import "../errors/index.js";
4
4
  import { getDynamicJobGroup, isDynamicGroupRef, isDynamicJobFn, isStaticArray, isStaticObject, validateDag } from "@kici-dev/sdk";
@@ -10,7 +10,7 @@ export const helloWorldWorkflow = workflow('hello-world', {
10
10
 
11
11
  jobs: [
12
12
  job('greet', {
13
- runsOn: 'ubuntu-latest',
13
+ runsOn: 'kici:os:linux',
14
14
  steps: [
15
15
  step('say-hello', async ({ $ }) => {
16
16
  await $`echo "Hello, World!"`;
@@ -26,7 +26,7 @@ export const prChecksWorkflow = workflow('pr-checks', {
26
26
  // Jobs: run in parallel unless connected via `needs`
27
27
  jobs: [
28
28
  job('lint', {
29
- runsOn: 'ubuntu-latest',
29
+ runsOn: 'kici:os:linux',
30
30
  steps: [
31
31
  step('checkout', async ({ $ }) => {
32
32
  await $`echo "Checking out code..."`;
@@ -39,7 +39,7 @@ export const prChecksWorkflow = workflow('pr-checks', {
39
39
  }),
40
40
 
41
41
  job('test', {
42
- runsOn: 'ubuntu-latest',
42
+ runsOn: 'kici:os:linux',
43
43
  needs: ['lint'], // Waits for lint to pass
44
44
  steps: [
45
45
  step('checkout', async ({ $ }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kici-dev/compiler",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Compiler and CLI for KiCI workflows. Compiles `.kici/workflows/*.ts` to a `kici.lock.json` file consumed by the orchestrator and agents, and runs workflows locally or against a remote orchestrator.",
5
5
  "keywords": [
6
6
  "ci",
@@ -61,12 +61,13 @@
61
61
  "typescript": "^6.0.3",
62
62
  "ws": "^8.20.0",
63
63
  "yaml": "^2.8.3",
64
+ "zod": "^4.3.6",
64
65
  "zx": "^8.8.5",
65
- "@kici-dev/core": "0.1.16",
66
- "@kici-dev/engine": "0.1.16"
66
+ "@kici-dev/core": "0.1.17",
67
+ "@kici-dev/engine": "0.1.17"
67
68
  },
68
69
  "peerDependencies": {
69
- "@kici-dev/sdk": "0.1.16"
70
+ "@kici-dev/sdk": "0.1.17"
70
71
  },
71
72
  "devDependencies": {
72
73
  "@types/proper-lockfile": "^4.1.4"