@kici-dev/compiler 0.1.13 → 0.1.15

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 (70) hide show
  1. package/README.md +21 -1
  2. package/dist/cli.js +27 -22
  3. package/dist/commands/cancel.js +1 -1
  4. package/dist/commands/compile.js +1 -1
  5. package/dist/commands/docs.js +1 -1
  6. package/dist/commands/drain-worker.js +1 -1
  7. package/dist/commands/endpoints.js +1 -1
  8. package/dist/commands/fixture.js +3 -3
  9. package/dist/commands/hook.js +1 -1
  10. package/dist/commands/index.js +6 -6
  11. package/dist/commands/init.js +9 -7
  12. package/dist/commands/login.js +5 -16
  13. package/dist/commands/run.js +19 -8
  14. package/dist/commands/secrets-list.js +2 -2
  15. package/dist/commands/status.js +4 -4
  16. package/dist/commands/test.d.ts +2 -0
  17. package/dist/commands/test.js +2 -2
  18. package/dist/commands/types.js +1 -1
  19. package/dist/commands/watch.js +1 -1
  20. package/dist/commands/workflows.js +3 -3
  21. package/dist/execution/executor.js +6 -3
  22. package/dist/execution/sdk-alias.js +1 -1
  23. package/dist/execution/ts-loader.d.ts +2 -0
  24. package/dist/execution/ts-loader.js +13 -0
  25. package/dist/fixtures/compiler.d.ts +7 -5
  26. package/dist/fixtures/compiler.js +10 -6
  27. package/dist/llm-context/llms-full.txt +1077 -387
  28. package/dist/llm-context/llms.txt +38 -37
  29. package/dist/local-executor/index.js +6 -5
  30. package/dist/local-executor/job-runner.js +6 -5
  31. package/dist/local-executor/materializer.d.ts +5 -0
  32. package/dist/local-executor/materializer.js +22 -1
  33. package/dist/local-executor/output-streamer.js +1 -1
  34. package/dist/local-executor/picker.js +1 -1
  35. package/dist/local-executor/to-event-payload.d.ts +16 -0
  36. package/dist/local-executor/to-event-payload.js +21 -0
  37. package/dist/local-executor/workflow-lock.d.ts +4 -3
  38. package/dist/local-executor/workflow-lock.js +0 -0
  39. package/dist/lockfile/generator.js +11 -6
  40. package/dist/lockfile/hasher.js +1 -1
  41. package/dist/remote/client.d.ts +4 -0
  42. package/dist/remote/client.js +1 -1
  43. package/dist/remote/encryption.d.ts +1 -1
  44. package/dist/remote/encryption.js +1 -1
  45. package/dist/remote/history.js +2 -2
  46. package/dist/remote/oauth.js +1 -1
  47. package/dist/remote/oidc-discovery.js +1 -1
  48. package/dist/remote/output/streaming.js +1 -1
  49. package/dist/remote/output/summary.js +1 -1
  50. package/dist/remote/prod-defaults.d.ts +18 -0
  51. package/dist/remote/prod-defaults.js +23 -0
  52. package/dist/remote/secret-upload.d.ts +20 -0
  53. package/dist/remote/secret-upload.js +58 -0
  54. package/dist/remote/uploader.js +1 -1
  55. package/dist/templates/index.js +1 -1
  56. package/dist/templates/package-json.js +1 -1
  57. package/dist/templates/workflows/pr-checks.js +3 -2
  58. package/dist/templates/workflows/pr-checks.ts +4 -2
  59. package/dist/test-runner/dry-run.js +1 -1
  60. package/dist/test-runner/index.js +4 -4
  61. package/dist/test-runner/job-executor.js +1 -1
  62. package/dist/test-runner/output-formatter.js +1 -1
  63. package/dist/test-runner/payload-builder.js +2 -2
  64. package/dist/test-runner/rule-evaluator.js +1 -1
  65. package/dist/test-runner/step-context.js +6 -2
  66. package/dist/types.d.ts +17 -1
  67. package/dist/types.js +1 -0
  68. package/dist/workflows/pr-checks.ts +4 -2
  69. package/package.json +13 -9
  70. package/sbom.spdx.json +1328 -8436
@@ -1,9 +1,9 @@
1
1
  import "../chunk-gOLHoazu.js";
2
+ import { agentsMdTemplate } from "./agents-md.js";
2
3
  import { helloWorldWorkflow } from "./workflows/hello-world.js";
3
4
  import { prChecksWorkflow } from "./workflows/pr-checks.js";
4
5
  import { tsconfigTemplate } from "./tsconfig-json.js";
5
6
  import { generatePackageJson } from "./package-json.js";
6
- import { agentsMdTemplate } from "./agents-md.js";
7
7
  import path from "node:path";
8
8
  import { fileURLToPath } from "node:url";
9
9
  //#region src/templates/index.ts
@@ -1,6 +1,6 @@
1
1
  import "../chunk-gOLHoazu.js";
2
2
  //#region src/templates/package-json.ts
3
- const sdkVersion = "0.1.13";
3
+ const sdkVersion = "0.1.15";
4
4
  /**
5
5
  * Generate package.json content for .kici/ directory
6
6
  *
@@ -1,5 +1,5 @@
1
1
  import "../../chunk-gOLHoazu.js";
2
- import { job, pr, rule, skip, step, workflow } from "@kici-dev/sdk";
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", {
5
5
  on: pr({
@@ -7,7 +7,8 @@ const prChecksWorkflow = workflow("pr-checks", {
7
7
  paths: ["src/**"]
8
8
  }),
9
9
  rules: [skip("skip-draft-prs", async (ctx) => {
10
- return ctx.event.pull_request?.draft === true;
10
+ if (!isEventType(ctx.event, "pull_request")) return false;
11
+ return ctx.event.payload.pull_request.draft === true;
11
12
  }), rule("require-src-changes", async (ctx) => {
12
13
  return ctx.changedFiles.some((file) => file.startsWith("src/"));
13
14
  })],
@@ -2,7 +2,7 @@
2
2
  // Docs: https://kici.dev/docs/sdk-reference
3
3
  // Patterns: https://kici.dev/docs/workflow-patterns
4
4
 
5
- import { workflow, job, step, pr, rule, skip } from '@kici-dev/sdk';
5
+ import { workflow, job, step, pr, rule, skip, isEventType } from '@kici-dev/sdk';
6
6
 
7
7
  export const prChecksWorkflow = workflow('pr-checks', {
8
8
  // Trigger: pr() matches pull request events
@@ -13,7 +13,9 @@ export const prChecksWorkflow = workflow('pr-checks', {
13
13
  // skip() = skip if true, rule() = run only if true
14
14
  rules: [
15
15
  skip('skip-draft-prs', async (ctx) => {
16
- return (ctx.event as any).pull_request?.draft === true;
16
+ // Raw provider fields live under `ctx.event.payload`; narrow first for typing.
17
+ if (!isEventType(ctx.event, 'pull_request')) return false;
18
+ return ctx.event.payload.pull_request.draft === true;
17
19
  }),
18
20
 
19
21
  rule('require-src-changes', async (ctx) => {
@@ -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/test-runner/dry-run.ts
5
5
  /**
6
6
  * Display dry-run output showing what would execute.
@@ -1,11 +1,11 @@
1
1
  import "../chunk-gOLHoazu.js";
2
- import { getDefaultFixture, listAvailableEvents } from "../fixtures/defaults/index.js";
3
- import { detectRepoFromGit } from "./git-detector.js";
4
- import { parseEventArg, triggerSummary, triggerToEventArg } from "./event-types.js";
5
- import { buildEventPayload } from "./payload-builder.js";
6
2
  import { displayDryRun } from "./dry-run.js";
3
+ import { parseEventArg, triggerSummary, triggerToEventArg } from "./event-types.js";
4
+ import { detectRepoFromGit } from "./git-detector.js";
7
5
  import { formatter } from "./output-formatter.js";
8
6
  import { createStepContext } from "./step-context.js";
9
7
  import { createRuleContext, evaluateRules as evaluateRulesWithFormatting } from "./rule-evaluator.js";
10
8
  import { executeJob, executeWorkflow } from "./job-executor.js";
9
+ import { getDefaultFixture, listAvailableEvents } from "../fixtures/defaults/index.js";
10
+ import { buildEventPayload } from "./payload-builder.js";
11
11
  export { buildEventPayload, createRuleContext, createStepContext, detectRepoFromGit, displayDryRun, evaluateRulesWithFormatting as evaluateRules, executeJob, executeWorkflow, formatter, getDefaultFixture, listAvailableEvents, parseEventArg, triggerSummary, triggerToEventArg };
@@ -4,9 +4,9 @@ import { createStepContext } from "./step-context.js";
4
4
  import { createRuleContext, evaluateRules as evaluateRulesWithFormatting } from "./rule-evaluator.js";
5
5
  import pc from "picocolors";
6
6
  import path from "node:path";
7
- import { logger } from "@kici-dev/shared";
8
7
  import { pathToFileURL } from "node:url";
9
8
  import { setJobOutputsMap, setStepOutputsMap, setStepRefMap } from "@kici-dev/sdk";
9
+ import { logger } from "@kici-dev/core";
10
10
  //#region src/test-runner/job-executor.ts
11
11
  /**
12
12
  * Resolve SDK output setter functions from the workflow's module instance.
@@ -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/test-runner/output-formatter.ts
5
5
  const JOB_COLORS = [
6
6
  pc.cyan,
@@ -1,7 +1,7 @@
1
1
  import "../chunk-gOLHoazu.js";
2
- import { getDefaultFixture } from "../fixtures/defaults/index.js";
3
- import { detectRepoFromGit } from "./git-detector.js";
4
2
  import { parseEventArg } from "./event-types.js";
3
+ import { detectRepoFromGit } from "./git-detector.js";
4
+ import { getDefaultFixture } from "../fixtures/defaults/index.js";
5
5
  import { readFile } from "node:fs/promises";
6
6
  //#region src/test-runner/payload-builder.ts
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import "../chunk-gOLHoazu.js";
2
2
  import { formatter } from "./output-formatter.js";
3
- import { initZx } from "@kici-dev/shared";
4
3
  import { evaluateRules } from "@kici-dev/sdk";
4
+ import { initZx } from "@kici-dev/core";
5
5
  import { $ } from "zx";
6
6
  //#region src/test-runner/rule-evaluator.ts
7
7
  initZx();
@@ -2,8 +2,8 @@ import "../chunk-gOLHoazu.js";
2
2
  import { formatter } from "./output-formatter.js";
3
3
  import { chmodSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
- import { initZx } from "@kici-dev/shared";
6
5
  import { createStepSecrets, resolveJobOutputs, resolveStepOutputs } from "@kici-dev/sdk";
6
+ import { initZx } from "@kici-dev/core";
7
7
  import { tmpdir } from "node:os";
8
8
  import { $ } from "zx";
9
9
  //#region src/test-runner/step-context.ts
@@ -131,7 +131,11 @@ function createStepContext(workflowInfo, jobInfo, repoRoot, inputs = {}, matrix,
131
131
  kici: { infrastructure: { list: () => Promise.resolve({
132
132
  scalers: [],
133
133
  agents: []
134
- }) } }
134
+ }) } },
135
+ cache: {
136
+ restore: async () => ({ hit: false }),
137
+ save: async () => {}
138
+ }
135
139
  };
136
140
  }
137
141
  //#endregion
package/dist/types.d.ts CHANGED
@@ -9,10 +9,11 @@
9
9
  * v7 adds hook flags, step rules, gracePeriod, and workflow concurrency config.
10
10
  * v8 adds runsOn polymorphic type (string | string[] | selector) and excludeLabels.
11
11
  * v11 adds LockInlineValue type for pure function inline evaluation.
12
+ * v15 adds per-job init config(s).
12
13
  */
13
14
  import type { ResourceRequest } from '@kici-dev/engine';
14
15
  /** Schema version - re-exported from engine as single source of truth */
15
- export declare const SCHEMA_VERSION: 12;
16
+ export declare const SCHEMA_VERSION: 15;
16
17
  /**
17
18
  * Source file reference with meaningful path.
18
19
  * Format: file is relative path from git root, export uses hash syntax.
@@ -307,6 +308,8 @@ export interface LockStep {
307
308
  readonly continueOnError?: boolean;
308
309
  /** Step-level timeout in milliseconds. */
309
310
  readonly timeout?: number;
311
+ /** Declarative cache specs (normalized to an array). Restored before / saved after the step. */
312
+ readonly cache?: readonly import('@kici-dev/sdk').CacheSpec[];
310
313
  /** Source location of the step() call in the original TypeScript file (for annotations). */
311
314
  readonly sourceLocation?: {
312
315
  readonly file: string;
@@ -369,6 +372,8 @@ export interface LockJob {
369
372
  readonly description?: string;
370
373
  /** When false, agent skips git clone (default: true). */
371
374
  readonly checkout?: boolean;
375
+ /** Declarative cache specs (normalized to an array). Restored before steps / saved after the job. */
376
+ readonly cache?: readonly import('@kici-dev/sdk').CacheSpec[];
372
377
  /** Docker image for job execution. All steps run inside the container. */
373
378
  readonly container?: string | {
374
379
  image: string;
@@ -400,12 +405,20 @@ export interface LockJob {
400
405
  readonly hasAfterStep?: boolean;
401
406
  /** Seconds before SIGKILL after SIGTERM during cancellation. */
402
407
  readonly gracePeriod?: number;
408
+ /** Total job wall-clock timeout in milliseconds (init + all steps + hooks). Agent reads this from jobConfig to arm a job-level deadline. */
409
+ readonly timeout?: number;
403
410
  /**
404
411
  * Resource request and limit for this job.
405
412
  * Threaded from SDK `Job.resources` to the orchestrator scaler for cap accounting
406
413
  * (`requests`) and kernel-side enforcement (`limits`) on the spawned agent.
407
414
  */
408
415
  readonly resources?: ResourceRequest;
416
+ /**
417
+ * Per-job init config(s) run after clone, before steps. `false` is an explicit
418
+ * opt-out. Threaded verbatim from the SDK `Job.init` -- the agent reads it from
419
+ * the loaded module, the lock copy is for orchestrator/dashboard visibility.
420
+ */
421
+ readonly init?: import('@kici-dev/sdk').GenericInitConfig | readonly import('@kici-dev/sdk').GenericInitConfig[] | false;
409
422
  }
410
423
  /**
411
424
  * Dynamic job generator reference.
@@ -480,6 +493,8 @@ export interface LockWorkflow {
480
493
  readonly cancelInProgress?: boolean;
481
494
  readonly max?: number;
482
495
  };
496
+ /** Whole-run wall-clock timeout in milliseconds. Orchestrator reads this at run creation to set the run deadline. */
497
+ readonly timeout?: number;
483
498
  }
484
499
  /**
485
500
  * Complete lock file structure.
@@ -492,6 +507,7 @@ export interface LockWorkflow {
492
507
  * v7 adds hook flags, step rules, gracePeriod, and workflow concurrency config.
493
508
  * v8 adds runsOn polymorphic type (string | string[] | selector) and excludeLabels.
494
509
  * v11 adds LockInlineValue type for pure function inline evaluation.
510
+ * v13 adds job-level and workflow-level timeout.
495
511
  */
496
512
  export interface LockFile {
497
513
  readonly schemaVersion: typeof SCHEMA_VERSION;
package/dist/types.js CHANGED
@@ -12,6 +12,7 @@ import { SCHEMA_VERSION as SCHEMA_VERSION$1 } from "@kici-dev/engine";
12
12
  * v7 adds hook flags, step rules, gracePeriod, and workflow concurrency config.
13
13
  * v8 adds runsOn polymorphic type (string | string[] | selector) and excludeLabels.
14
14
  * v11 adds LockInlineValue type for pure function inline evaluation.
15
+ * v15 adds per-job init config(s).
15
16
  */
16
17
  /** Schema version - re-exported from engine as single source of truth */
17
18
  const SCHEMA_VERSION = SCHEMA_VERSION$1;
@@ -2,7 +2,7 @@
2
2
  // Docs: https://kici.dev/docs/sdk-reference
3
3
  // Patterns: https://kici.dev/docs/workflow-patterns
4
4
 
5
- import { workflow, job, step, pr, rule, skip } from '@kici-dev/sdk';
5
+ import { workflow, job, step, pr, rule, skip, isEventType } from '@kici-dev/sdk';
6
6
 
7
7
  export const prChecksWorkflow = workflow('pr-checks', {
8
8
  // Trigger: pr() matches pull request events
@@ -13,7 +13,9 @@ export const prChecksWorkflow = workflow('pr-checks', {
13
13
  // skip() = skip if true, rule() = run only if true
14
14
  rules: [
15
15
  skip('skip-draft-prs', async (ctx) => {
16
- return (ctx.event as any).pull_request?.draft === true;
16
+ // Raw provider fields live under `ctx.event.payload`; narrow first for typing.
17
+ if (!isEventType(ctx.event, 'pull_request')) return false;
18
+ return ctx.event.payload.pull_request.draft === true;
17
19
  }),
18
20
 
19
21
  rule('require-src-changes', async (ctx) => {
package/package.json CHANGED
@@ -1,18 +1,22 @@
1
1
  {
2
2
  "name": "@kici-dev/compiler",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
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
- "kici",
7
6
  "ci",
8
- "cd",
9
- "ci-cd",
7
+ "cicd",
8
+ "continuous-integration",
10
9
  "typescript",
11
- "workflows",
12
- "devops",
10
+ "workflow",
13
11
  "cli",
14
12
  "compiler"
15
13
  ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/kici-dev/kici-public.git",
17
+ "directory": "packages/compiler"
18
+ },
19
+ "bugs": "https://github.com/kici-dev/kici-public/issues",
16
20
  "homepage": "https://kici.dev",
17
21
  "author": {
18
22
  "name": "KiCI",
@@ -58,11 +62,11 @@
58
62
  "ws": "^8.20.0",
59
63
  "yaml": "^2.8.3",
60
64
  "zx": "^8.8.5",
61
- "@kici-dev/engine": "0.1.13",
62
- "@kici-dev/shared": "0.1.13"
65
+ "@kici-dev/core": "0.1.15",
66
+ "@kici-dev/engine": "0.1.15"
63
67
  },
64
68
  "peerDependencies": {
65
- "@kici-dev/sdk": "0.1.13"
69
+ "@kici-dev/sdk": "0.1.15"
66
70
  },
67
71
  "devDependencies": {
68
72
  "@types/proper-lockfile": "^4.1.4"