@kici-dev/compiler 0.1.26 → 0.2.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.
Files changed (199) hide show
  1. package/dist/auth/headless-detect.d.ts +14 -5
  2. package/dist/auth/headless-detect.js +50 -9
  3. package/dist/cli-banner.d.ts +6 -3
  4. package/dist/cli-banner.js +13 -5
  5. package/dist/cli.js +180 -48
  6. package/dist/commands/check-mode.d.ts +1 -1
  7. package/dist/commands/compile.js +31 -7
  8. package/dist/commands/diagnostics.js +14 -2
  9. package/dist/commands/doctor.d.ts +64 -0
  10. package/dist/commands/doctor.js +413 -0
  11. package/dist/commands/endpoints.js +6 -0
  12. package/dist/commands/fixture.js +13 -0
  13. package/dist/commands/hook.js +3 -2
  14. package/dist/commands/index.d.ts +13 -1
  15. package/dist/commands/index.js +10 -3
  16. package/dist/commands/init-host-os.d.ts +34 -0
  17. package/dist/commands/init-host-os.js +44 -0
  18. package/dist/commands/init.d.ts +4 -0
  19. package/dist/commands/init.js +160 -37
  20. package/dist/commands/local-trust-root.d.ts +6 -0
  21. package/dist/commands/local-trust-root.js +52 -0
  22. package/dist/commands/local.d.ts +65 -0
  23. package/dist/commands/local.js +206 -0
  24. package/dist/commands/login.d.ts +2 -0
  25. package/dist/commands/login.js +41 -1
  26. package/dist/commands/logout.js +7 -0
  27. package/dist/commands/notifications.d.ts +61 -0
  28. package/dist/commands/notifications.js +274 -0
  29. package/dist/commands/preview.js +9 -2
  30. package/dist/commands/run-banner.d.ts +31 -0
  31. package/dist/commands/run-banner.js +25 -0
  32. package/dist/commands/run-routed.d.ts +53 -0
  33. package/dist/commands/run-routed.js +185 -0
  34. package/dist/commands/run.d.ts +0 -17
  35. package/dist/commands/run.js +44 -58
  36. package/dist/commands/runs/artifacts/download.d.ts +24 -0
  37. package/dist/commands/runs/artifacts/download.js +154 -0
  38. package/dist/commands/runs/artifacts/list.d.ts +5 -0
  39. package/dist/commands/runs/artifacts/list.js +47 -0
  40. package/dist/commands/runs/cancel.js +2 -2
  41. package/dist/commands/runs/list.js +8 -2
  42. package/dist/commands/secrets-list.d.ts +2 -2
  43. package/dist/commands/secrets-list.js +4 -4
  44. package/dist/commands/types.d.ts +3 -3
  45. package/dist/commands/types.js +4 -4
  46. package/dist/commands/verify-attestation.d.ts +3 -1
  47. package/dist/commands/verify-attestation.js +18 -7
  48. package/dist/errors/formatter.d.ts +14 -1
  49. package/dist/errors/formatter.js +13 -3
  50. package/dist/errors/index.d.ts +2 -1
  51. package/dist/errors/index.js +3 -2
  52. package/dist/errors/source-location.d.ts +20 -0
  53. package/dist/errors/source-location.js +45 -0
  54. package/dist/execution/executor.js +32 -12
  55. package/dist/fixtures/defaults/index.js +2 -1
  56. package/dist/generators/secrets-dts.d.ts +9 -9
  57. package/dist/generators/secrets-dts.js +12 -12
  58. package/dist/llm-context/llms-architecture.txt +50 -21
  59. package/dist/llm-context/llms-cli.txt +2667 -1454
  60. package/dist/llm-context/llms-features.txt +484 -414
  61. package/dist/llm-context/llms-full.txt +6703 -4687
  62. package/dist/llm-context/llms-getting-started.txt +311 -55
  63. package/dist/llm-context/llms-patterns.txt +17 -29
  64. package/dist/llm-context/llms-providers.txt +10 -1
  65. package/dist/llm-context/llms-sdk-runtime.txt +2013 -0
  66. package/dist/llm-context/llms-sdk.txt +596 -2157
  67. package/dist/llm-context/llms.txt +31 -17
  68. package/dist/local-plane/orchestrator-process.d.ts +70 -0
  69. package/dist/local-plane/orchestrator-process.js +129 -0
  70. package/dist/local-plane/os-mismatch-hint.d.ts +16 -0
  71. package/dist/local-plane/os-mismatch-hint.js +34 -0
  72. package/dist/local-plane/paths.d.ts +39 -0
  73. package/dist/local-plane/paths.js +54 -0
  74. package/dist/local-plane/plane-liveness.d.ts +68 -0
  75. package/dist/local-plane/plane-liveness.js +145 -0
  76. package/dist/local-plane/plane-manager.d.ts +193 -0
  77. package/dist/local-plane/plane-manager.js +480 -0
  78. package/dist/local-plane/plane-seed.d.ts +76 -0
  79. package/dist/local-plane/plane-seed.js +59 -0
  80. package/dist/local-plane/plane-trigger.d.ts +71 -0
  81. package/dist/local-plane/plane-trigger.js +110 -0
  82. package/dist/local-plane/platform-attach.d.ts +53 -0
  83. package/dist/local-plane/platform-attach.js +107 -0
  84. package/dist/local-plane/port-holder.d.ts +78 -0
  85. package/dist/local-plane/port-holder.js +227 -0
  86. package/dist/local-plane/postgres.d.ts +56 -0
  87. package/dist/local-plane/postgres.js +187 -0
  88. package/dist/local-plane/resolve-plane.d.ts +37 -0
  89. package/dist/local-plane/resolve-plane.js +76 -0
  90. package/dist/local-plane/run-follow.d.ts +61 -0
  91. package/dist/local-plane/run-follow.js +151 -0
  92. package/dist/local-plane/scaler-config.d.ts +68 -0
  93. package/dist/local-plane/scaler-config.js +132 -0
  94. package/dist/local-plane/secret-seed.d.ts +59 -0
  95. package/dist/local-plane/secret-seed.js +112 -0
  96. package/dist/local-plane/source-provider.d.ts +43 -0
  97. package/dist/local-plane/source-provider.js +159 -0
  98. package/dist/local-plane/trusted-routing.d.ts +32 -0
  99. package/dist/local-plane/trusted-routing.js +47 -0
  100. package/dist/lockfile/generator.d.ts +14 -1
  101. package/dist/lockfile/generator.js +103 -37
  102. package/dist/lockfile/index.d.ts +3 -1
  103. package/dist/lockfile/index.js +3 -2
  104. package/dist/lockfile/purity-diagnostics.d.ts +31 -0
  105. package/dist/lockfile/purity-diagnostics.js +52 -0
  106. package/dist/postinstall.js +2 -1
  107. package/dist/remote/artifact-extract.d.ts +8 -0
  108. package/dist/remote/artifact-extract.js +58 -0
  109. package/dist/remote/config.d.ts +21 -3
  110. package/dist/remote/config.js +24 -5
  111. package/dist/remote/dashboard-client.d.ts +46 -9
  112. package/dist/remote/dashboard-client.js +54 -11
  113. package/dist/remote/fs-case.d.ts +21 -0
  114. package/dist/remote/fs-case.js +45 -0
  115. package/dist/remote/history.d.ts +9 -3
  116. package/dist/remote/history.js +79 -10
  117. package/dist/remote/local-repo-identity.d.ts +1 -1
  118. package/dist/remote/local-repo-identity.js +2 -1
  119. package/dist/remote/notifications-client.d.ts +149 -0
  120. package/dist/remote/notifications-client.js +103 -0
  121. package/dist/remote/oauth.d.ts +13 -0
  122. package/dist/remote/oauth.js +31 -5
  123. package/dist/remote/output/summary.js +76 -14
  124. package/dist/remote/platform-client.d.ts +1 -1
  125. package/dist/remote/render.js +30 -9
  126. package/dist/{local-executor → remote}/secret-loader.d.ts +1 -1
  127. package/dist/{local-executor → remote}/secret-loader.js +4 -4
  128. package/dist/remote/secret-upload.d.ts +1 -1
  129. package/dist/remote/secret-upload.js +2 -2
  130. package/dist/remote/uploader.d.ts +1 -1
  131. package/dist/remote/uploader.js +7 -6
  132. package/dist/templates/agents-md.d.ts +1 -1
  133. package/dist/templates/agents-md.js +8 -8
  134. package/dist/templates/index.d.ts +1 -1
  135. package/dist/templates/index.js +2 -2
  136. package/dist/templates/package-json.d.ts +15 -0
  137. package/dist/templates/package-json.js +26 -5
  138. package/dist/test-runner/dry-run.d.ts +2 -1
  139. package/dist/test-runner/dry-run.js +18 -1
  140. package/dist/test-runner/event-types.d.ts +2 -0
  141. package/dist/test-runner/event-types.js +3 -0
  142. package/dist/test-runner/job-executor.d.ts +1 -0
  143. package/dist/test-runner/job-executor.js +82 -44
  144. package/dist/test-runner/output-formatter.d.ts +5 -2
  145. package/dist/test-runner/output-formatter.js +6 -4
  146. package/dist/test-runner/payload-builder.d.ts +7 -1
  147. package/dist/test-runner/payload-builder.js +11 -2
  148. package/dist/test-runner/rule-evaluator.d.ts +7 -3
  149. package/dist/test-runner/rule-evaluator.js +13 -12
  150. package/dist/{local-executor → test-runner}/runs-on-display.js +1 -1
  151. package/dist/test-runner/step-context.d.ts +23 -5
  152. package/dist/test-runner/step-context.js +29 -119
  153. package/dist/types.d.ts +26 -7
  154. package/dist/types.js +4 -2
  155. package/dist/validation/index.d.ts +2 -0
  156. package/dist/validation/index.js +2 -1
  157. package/dist/validation/typecheck.d.ts +28 -0
  158. package/dist/validation/typecheck.js +110 -0
  159. package/dist/validation/validator.d.ts +9 -4
  160. package/dist/validation/validator.js +38 -44
  161. package/package.json +13 -13
  162. package/sbom.spdx.json +9311 -1528
  163. package/dist/assets/api-TJJVHrjC.json +0 -118
  164. package/dist/assets/descriptor-BTtjzN9L.json +0 -1382
  165. package/dist/assets/package-BpQF9kR8.json +0 -74
  166. package/dist/assets/package-Ceo2h27X.json +0 -89
  167. package/dist/assets/source_context-D0atuL28.json +0 -20
  168. package/dist/assets/type-BFqO8SCZ.json +0 -202
  169. package/dist/commands/cancel.d.ts +0 -22
  170. package/dist/commands/detect-package-manager.d.ts +0 -42
  171. package/dist/commands/held-run-resolve.d.ts +0 -50
  172. package/dist/commands/status.d.ts +0 -34
  173. package/dist/commands/test.d.ts +0 -88
  174. package/dist/errors/codes.d.ts +0 -25
  175. package/dist/local-executor/dag-scheduler.d.ts +0 -44
  176. package/dist/local-executor/dag-scheduler.js +0 -183
  177. package/dist/local-executor/index.d.ts +0 -23
  178. package/dist/local-executor/index.js +0 -378
  179. package/dist/local-executor/job-runner.d.ts +0 -47
  180. package/dist/local-executor/job-runner.js +0 -411
  181. package/dist/local-executor/materializer.d.ts +0 -44
  182. package/dist/local-executor/materializer.js +0 -132
  183. package/dist/local-executor/output-streamer.d.ts +0 -31
  184. package/dist/local-executor/output-streamer.js +0 -168
  185. package/dist/local-executor/payload-generator.d.ts +0 -16
  186. package/dist/local-executor/payload-generator.js +0 -138
  187. package/dist/local-executor/picker.d.ts +0 -33
  188. package/dist/local-executor/picker.js +0 -109
  189. package/dist/local-executor/to-event-payload.d.ts +0 -16
  190. package/dist/local-executor/to-event-payload.js +0 -21
  191. package/dist/local-executor/types.d.ts +0 -93
  192. package/dist/local-executor/types.js +0 -2
  193. package/dist/local-executor/workflow-lock.d.ts +0 -82
  194. package/dist/local-executor/workflow-lock.js +0 -0
  195. package/dist/package-F7UXSDHW.json +0 -74
  196. package/dist/remote/client.d.ts +0 -210
  197. package/dist/remote/observer.d.ts +0 -81
  198. package/dist/test-runner/summary.d.ts +0 -7
  199. /package/dist/{local-executor → test-runner}/runs-on-display.d.ts +0 -0
@@ -1,5 +1,6 @@
1
1
  import "../rolldown-runtime-ClRpJifh.js";
2
2
  import { compilerError } from "../errors/formatter.js";
3
+ import { locationForJob, locationForWorkflow } from "../errors/source-location.js";
3
4
  import "../errors/index.js";
4
5
  import { getDynamicJobGroup, isDynamicGroupRef, isDynamicJobFn, isStaticArray, isStaticObject, validateDag } from "@kici-dev/sdk";
5
6
  //#region src/validation/validator.ts
@@ -14,28 +15,26 @@ const MAX_STATIC_MATRIX_JOBS = 256;
14
15
  * 3. Job dependencies are valid (exist, no cycles, no self-refs)
15
16
  * 4. Static matrix expansions stay under 256 job limit
16
17
  *
17
- * @param workflows - Array of workflows from config
18
- * @param configPath - Path for error location reporting
18
+ * Each error carries the most precise `file:line:column` the data allows: a
19
+ * job-scoped error anchors to the offending job's first step location (real
20
+ * file + real line), falling back to the workflow's source file at line 1 when
21
+ * no step exists; a workflow-scoped error uses the workflow source file (line 1,
22
+ * since `workflow()` captures no call-site).
23
+ *
24
+ * @param workflows - Source-carrying workflows from discovery
19
25
  * @returns Validation result with errors if any
20
26
  */
21
- function validateConfig(workflows, configPath) {
27
+ function validateConfig(workflows) {
22
28
  const errors = [];
23
29
  const workflowNames = /* @__PURE__ */ new Set();
24
- for (const workflow of workflows) {
30
+ for (const { workflow, source } of workflows) {
25
31
  if (workflowNames.has(workflow.name)) errors.push(compilerError("E107", `Duplicate workflow name: "${workflow.name}"`, {
26
- location: {
27
- file: configPath,
28
- line: 1,
29
- column: 1
30
- },
32
+ location: locationForWorkflow(source.file),
31
33
  suggestion: "Each workflow must have a unique name"
32
34
  }));
33
35
  workflowNames.add(workflow.name);
34
36
  }
35
- for (const workflow of workflows) {
36
- const workflowErrors = validateWorkflow(workflow, configPath);
37
- errors.push(...workflowErrors);
38
- }
37
+ for (const { workflow, source } of workflows) errors.push(...validateWorkflow(workflow, source.file));
39
38
  if (errors.length > 0) return {
40
39
  valid: false,
41
40
  errors
@@ -45,18 +44,22 @@ function validateConfig(workflows, configPath) {
45
44
  /**
46
45
  * Validate a single workflow.
47
46
  */
48
- function validateWorkflow(workflow, configPath) {
47
+ function validateWorkflow(workflow, workflowFile) {
49
48
  const errors = [];
50
49
  const staticJobs = [];
51
50
  for (const jobOrFactory of workflow.jobs) if (!isDynamicJobFn(jobOrFactory)) staticJobs.push(jobOrFactory);
51
+ const jobLoc = (name) => {
52
+ const j = staticJobs.find((s) => s.name === name);
53
+ return j ? locationForJob(j, workflowFile) : {
54
+ file: workflowFile,
55
+ line: 1,
56
+ column: 1
57
+ };
58
+ };
52
59
  const jobNames = /* @__PURE__ */ new Set();
53
60
  for (const job of staticJobs) {
54
61
  if (jobNames.has(job.name)) errors.push(compilerError("E106", `Duplicate job name "${job.name}" in workflow "${workflow.name}"`, {
55
- location: {
56
- file: configPath,
57
- line: 1,
58
- column: 1
59
- },
62
+ location: locationForJob(job, workflowFile),
60
63
  suggestion: "Each job in a workflow must have a unique name"
61
64
  }));
62
65
  jobNames.add(job.name);
@@ -66,19 +69,26 @@ function validateWorkflow(workflow, configPath) {
66
69
  const groupName = getDynamicJobGroup(jobOrFactory);
67
70
  if (groupName) dynamicGroupNames.add(groupName);
68
71
  }
69
- const dagErrors = validateJobDag(staticJobs, workflow.name, configPath, dynamicGroupNames);
72
+ const dagErrors = validateJobDag(staticJobs, workflow.name, jobLoc, dynamicGroupNames);
70
73
  errors.push(...dagErrors);
71
74
  for (const job of staticJobs) {
72
- const matrixErrors = validateStaticMatrix(job, workflow.name, configPath);
75
+ const matrixErrors = validateStaticMatrix(job, workflow.name, workflowFile);
73
76
  errors.push(...matrixErrors);
74
77
  }
75
78
  return errors;
76
79
  }
77
80
  /**
81
+ * Best location for a DAG node id: strip the synthetic `__group:` prefix (which
82
+ * has no backing Job) and resolve via the job-location lookup.
83
+ */
84
+ function dagNodeLocation(nodeId, jobLoc) {
85
+ return jobLoc(nodeId.startsWith("__group:") ? nodeId.slice(8) : nodeId);
86
+ }
87
+ /**
78
88
  * Validate job dependency DAG.
79
89
  * Includes synthetic __group: nodes for tagged dynamic job functions ( Layer 1).
80
90
  */
81
- function validateJobDag(jobs, workflowName, configPath, dynamicGroupNames) {
91
+ function validateJobDag(jobs, workflowName, jobLoc, dynamicGroupNames) {
82
92
  const errors = [];
83
93
  const dagNodes = jobs.map((job) => ({
84
94
  id: job.name,
@@ -91,32 +101,20 @@ function validateJobDag(jobs, workflowName, configPath, dynamicGroupNames) {
91
101
  const result = validateDag(dagNodes);
92
102
  if (!result.valid) switch (result.error) {
93
103
  case "cycle":
94
- errors.push(compilerError("E102", `Circular dependency in workflow "${workflowName}": ${result.nodesInCycle.join(" -> ")}`, {
95
- location: {
96
- file: configPath,
97
- line: 1,
98
- column: 1
99
- },
104
+ errors.push(compilerError("E102", `Circular dependency in workflow "${workflowName}": ${result.nodesInCycle.join(", ")}`, {
105
+ location: dagNodeLocation(result.nodesInCycle[0] ?? "", jobLoc),
100
106
  suggestion: "Break the cycle by removing one of the dependencies"
101
107
  }));
102
108
  break;
103
109
  case "self-reference":
104
110
  errors.push(compilerError("E103", `Job "${result.nodeId}" in workflow "${workflowName}" depends on itself`, {
105
- location: {
106
- file: configPath,
107
- line: 1,
108
- column: 1
109
- },
111
+ location: dagNodeLocation(result.nodeId, jobLoc),
110
112
  suggestion: "Remove the self-dependency"
111
113
  }));
112
114
  break;
113
115
  case "missing-dependency":
114
116
  errors.push(compilerError("E101", `Job "${result.nodeId}" in workflow "${workflowName}" depends on non-existent job "${result.missingDep}"`, {
115
- location: {
116
- file: configPath,
117
- line: 1,
118
- column: 1
119
- },
117
+ location: dagNodeLocation(result.nodeId, jobLoc),
120
118
  suggestion: `Create a job named "${result.missingDep}" or fix the dependency name`
121
119
  }));
122
120
  break;
@@ -140,7 +138,7 @@ function resolveNeeds(needs) {
140
138
  /**
141
139
  * Validate static matrix doesn't exceed job limit.
142
140
  */
143
- function validateStaticMatrix(job, workflowName, configPath) {
141
+ function validateStaticMatrix(job, workflowName, workflowFile) {
144
142
  const errors = [];
145
143
  if (!job.matrix) return errors;
146
144
  if (typeof job.matrix === "function") return errors;
@@ -149,11 +147,7 @@ function validateStaticMatrix(job, workflowName, configPath) {
149
147
  else if (isStaticObject(job.matrix)) expansionCount = Object.values(job.matrix).reduce((acc, dimension) => acc * dimension.length, 1);
150
148
  if (job.include) expansionCount += job.include.length;
151
149
  if (expansionCount > MAX_STATIC_MATRIX_JOBS) errors.push(compilerError("E104", `Static matrix for job "${job.name}" in workflow "${workflowName}" would generate ${expansionCount} jobs (max: ${MAX_STATIC_MATRIX_JOBS})`, {
152
- location: {
153
- file: configPath,
154
- line: 1,
155
- column: 1
156
- },
150
+ location: locationForJob(job, workflowFile),
157
151
  suggestion: "Reduce matrix dimensions or use exclude patterns to limit combinations"
158
152
  }));
159
153
  return errors;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kici-dev/compiler",
3
- "version": "0.1.26",
3
+ "version": "0.2.0",
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",
@@ -49,30 +49,30 @@
49
49
  "@inquirer/prompts": "^8.5.2",
50
50
  "chokidar": "^5.0.0",
51
51
  "commander": "^15.0.0",
52
+ "embedded-postgres": "18.4.0-beta.17",
52
53
  "fast-glob": "^3.3.3",
53
54
  "open": "^11.0.0",
54
55
  "picocolors": "^1.1.1",
55
- "picomatch": "^4.0.4",
56
- "proper-lockfile": "^4.1.2",
57
- "tar": "^7.5.16",
56
+ "picomatch": "^4.0.5",
57
+ "tar": "^7.5.20",
58
58
  "typescript": "^6.0.3",
59
- "ws": "^8.21.0",
59
+ "ws": "^8.21.1",
60
+ "wsl-utils": "^0.3.0",
60
61
  "yaml": "^2.9.0",
61
62
  "zod": "^4.4.3",
62
63
  "zx": "^8.8.5",
63
- "@kici-dev/core": "0.1.26",
64
- "@kici-dev/engine": "0.1.26"
64
+ "@kici-dev/agent": "0.2.0",
65
+ "@kici-dev/engine": "0.2.0",
66
+ "@kici-dev/orchestrator": "0.2.0",
67
+ "@kici-dev/core": "0.2.0"
65
68
  },
66
69
  "peerDependencies": {
67
- "@kici-dev/sdk": "0.1.26"
68
- },
69
- "devDependencies": {
70
- "@types/proper-lockfile": "^4.1.4"
70
+ "@kici-dev/sdk": "0.2.0"
71
71
  },
72
72
  "scripts": {
73
- "build": "node ../../scripts/build-ts.mjs && tsc --emitDeclarationOnly",
73
+ "build": "node ../../scripts/build-ts.mjs && tsgo --emitDeclarationOnly",
74
74
  "postbuild": "zx hack/postbuild.mjs",
75
- "typecheck": "tsc --noEmit",
75
+ "typecheck": "tsgo --noEmit",
76
76
  "test": "vitest run",
77
77
  "test:watch": "vitest",
78
78
  "postinstall": "node hack/postinstall.mjs"