@kici-dev/compiler 0.5.0 → 0.6.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 +37 -7
- package/dist/commands/approve.d.ts +12 -0
- package/dist/commands/approve.js +5 -2
- package/dist/commands/compile.js +4 -2
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/endpoints.js +4 -6
- package/dist/commands/held-run-client.d.ts +21 -1
- package/dist/commands/held-run-client.js +34 -15
- package/dist/commands/hook.js +22 -20
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.js +2 -1
- package/dist/commands/init.d.ts +9 -2
- package/dist/commands/init.js +43 -16
- package/dist/commands/login.js +1 -1
- package/dist/commands/orchestrators.js +3 -2
- package/dist/commands/reject.d.ts +12 -0
- package/dist/commands/reject.js +5 -2
- package/dist/commands/report/collect.d.ts +82 -0
- package/dist/commands/report/collect.js +234 -0
- package/dist/commands/report/identity.d.ts +48 -0
- package/dist/commands/report/identity.js +49 -0
- package/dist/commands/report/index.d.ts +63 -0
- package/dist/commands/report/index.js +119 -0
- package/dist/commands/report/upload.d.ts +38 -0
- package/dist/commands/report/upload.js +64 -0
- package/dist/commands/run-hold-watch.js +2 -2
- package/dist/commands/run.js +6 -3
- package/dist/commands/runs/show.js +80 -1
- package/dist/commands/types.js +51 -8
- package/dist/execution/sdk-alias.js +4 -2
- package/dist/fixtures/compiler.js +2 -1
- package/dist/format.js +3 -3
- package/dist/generators/secrets-dts.d.ts +8 -2
- package/dist/generators/secrets-dts.js +3 -2
- package/dist/hooks/installer.js +2 -1
- package/dist/llm-context/llms-architecture.txt +35 -13
- package/dist/llm-context/llms-cli.txt +142 -28
- package/dist/llm-context/llms-features-execution.txt +2017 -0
- package/dist/llm-context/llms-features.txt +298 -1483
- package/dist/llm-context/llms-full.txt +3008 -1698
- package/dist/llm-context/llms-getting-started.txt +145 -12
- package/dist/llm-context/llms-patterns.txt +176 -1
- package/dist/llm-context/llms-providers.txt +11 -27
- package/dist/llm-context/llms-sdk-runtime.txt +25 -4
- package/dist/llm-context/llms-sdk.txt +31 -1
- package/dist/llm-context/llms.txt +22 -14
- package/dist/local-plane/paths.d.ts +15 -0
- package/dist/local-plane/paths.js +22 -1
- package/dist/local-plane/plane-manager.js +2 -2
- package/dist/local-plane/port-holder.js +1 -1
- package/dist/local-plane/postgres.d.ts +3 -16
- package/dist/local-plane/postgres.js +10 -15
- package/dist/lockfile/generator.d.ts +12 -0
- package/dist/lockfile/generator.js +47 -14
- package/dist/postinstall.js +2 -1
- package/dist/remote/config.d.ts +2 -15
- package/dist/remote/config.js +2 -16
- package/dist/remote/dashboard-client.d.ts +39 -0
- package/dist/remote/dashboard-client.js +41 -0
- package/dist/remote/oauth.js +7 -5
- package/dist/remote/uploader.js +2 -2
- package/dist/templates/package-json.js +1 -1
- package/dist/test-runner/dry-run.js +4 -2
- package/dist/test-runner/git-detector.js +2 -1
- package/dist/test-runner/job-executor.js +2 -1
- package/dist/test-runner/payload-builder.js +11 -17
- package/dist/types.d.ts +33 -3
- package/dist/validation/validator.js +23 -6
- package/package.json +16 -11
- package/sbom.spdx.json +953 -901
|
@@ -29,8 +29,10 @@ function displayDryRun(workflows, decisions, options) {
|
|
|
29
29
|
logger.info(pc.gray(` runs-on: ${job.runsOn}`));
|
|
30
30
|
if (job.needs.length > 0) logger.info(pc.gray(` needs: ${job.needs.join(", ")}`));
|
|
31
31
|
if (job.rules && job.rules.length > 0) logger.info(pc.gray(` rules: ${job.rules.map((r) => r.label).join(", ")}`));
|
|
32
|
-
if (job.matrix)
|
|
33
|
-
|
|
32
|
+
if (job.matrix) {
|
|
33
|
+
if (job.matrix._type === "static" && job.matrix.values) logger.info(pc.gray(` matrix: ${JSON.stringify(job.matrix.values)}`));
|
|
34
|
+
else logger.info(pc.gray(` matrix: [dynamic]`));
|
|
35
|
+
}
|
|
34
36
|
logger.info(pc.gray(` steps (${job.steps.length}):`));
|
|
35
37
|
for (const step of job.steps) logger.info(pc.gray(` - ${step.name}`));
|
|
36
38
|
}
|
|
@@ -12,7 +12,8 @@ import { readFile } from "node:fs/promises";
|
|
|
12
12
|
*/
|
|
13
13
|
async function detectRepoFromGit(cwd = process.cwd()) {
|
|
14
14
|
try {
|
|
15
|
-
const
|
|
15
|
+
const gitConfigPath = path.join(cwd, ".git", "config");
|
|
16
|
+
const remoteMatch = (await readFile(gitConfigPath, "utf-8")).match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);
|
|
16
17
|
if (!remoteMatch) return null;
|
|
17
18
|
const match = remoteMatch[1].trim().match(/github\.com[:/]([^/]+)\/([^/\s]+?)(\.git)?$/);
|
|
18
19
|
if (!match) return null;
|
|
@@ -18,7 +18,8 @@ import { logger } from "@kici-dev/core";
|
|
|
18
18
|
*/
|
|
19
19
|
async function resolveSdkSetters(kiciDir) {
|
|
20
20
|
if (kiciDir) try {
|
|
21
|
-
const
|
|
21
|
+
const sdkPath = path.join(kiciDir, "node_modules", "@kici-dev", "sdk", "dist", "index.js");
|
|
22
|
+
const sdk = await import(pathToFileURL(sdkPath).href);
|
|
22
23
|
return {
|
|
23
24
|
setStepOutputsMap: sdk.setStepOutputsMap,
|
|
24
25
|
setStepRefMap: sdk.setStepRefMap,
|
|
@@ -9,8 +9,10 @@ import { readFile } from "node:fs/promises";
|
|
|
9
9
|
*/
|
|
10
10
|
function deepMerge(base, overrides) {
|
|
11
11
|
const result = { ...base };
|
|
12
|
-
for (const [key, value] of Object.entries(overrides)) if (value !== void 0 && value !== null)
|
|
13
|
-
|
|
12
|
+
for (const [key, value] of Object.entries(overrides)) if (value !== void 0 && value !== null) {
|
|
13
|
+
if (typeof value === "object" && !Array.isArray(value) && result[key] && typeof result[key] === "object") result[key] = deepMerge(result[key], value);
|
|
14
|
+
else result[key] = value;
|
|
15
|
+
}
|
|
14
16
|
return result;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
@@ -51,9 +53,7 @@ async function buildEventPayload(eventArg, options) {
|
|
|
51
53
|
case "review_comment":
|
|
52
54
|
overrides.pull_request = { head: { sha: options.sha } };
|
|
53
55
|
break;
|
|
54
|
-
case "workflow_run":
|
|
55
|
-
overrides.workflow_run = { head_sha: options.sha };
|
|
56
|
-
break;
|
|
56
|
+
case "workflow_run": overrides.workflow_run = { head_sha: options.sha };
|
|
57
57
|
}
|
|
58
58
|
if (options.branch) switch (eventType.type) {
|
|
59
59
|
case "push":
|
|
@@ -77,12 +77,10 @@ async function buildEventPayload(eventArg, options) {
|
|
|
77
77
|
case "delete":
|
|
78
78
|
overrides.ref = options.branch;
|
|
79
79
|
break;
|
|
80
|
-
case "workflow_run":
|
|
81
|
-
overrides.workflow_run
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
};
|
|
85
|
-
break;
|
|
80
|
+
case "workflow_run": overrides.workflow_run = {
|
|
81
|
+
...overrides.workflow_run ?? {},
|
|
82
|
+
head_branch: options.branch
|
|
83
|
+
};
|
|
86
84
|
}
|
|
87
85
|
if (options.pr && (eventType.type === "pull_request" || eventType.type === "review" || eventType.type === "review_comment")) {
|
|
88
86
|
overrides.number = options.pr;
|
|
@@ -137,9 +135,7 @@ async function buildEventPayload(eventArg, options) {
|
|
|
137
135
|
break;
|
|
138
136
|
case "fork":
|
|
139
137
|
case "star":
|
|
140
|
-
case "watch":
|
|
141
|
-
targetBranch = defaultBranch;
|
|
142
|
-
break;
|
|
138
|
+
case "watch": targetBranch = defaultBranch;
|
|
143
139
|
}
|
|
144
140
|
return {
|
|
145
141
|
type: eventType.type,
|
|
@@ -206,9 +202,7 @@ async function buildInternalEventPayload(eventType, options) {
|
|
|
206
202
|
timezone: eventType.timezone ?? "UTC"
|
|
207
203
|
};
|
|
208
204
|
break;
|
|
209
|
-
case "lifecycle":
|
|
210
|
-
payload = { lifecycleEvent: eventType.lifecycleEvent };
|
|
211
|
-
break;
|
|
205
|
+
case "lifecycle": payload = { lifecycleEvent: eventType.lifecycleEvent };
|
|
212
206
|
}
|
|
213
207
|
return {
|
|
214
208
|
type: eventType.type,
|
package/dist/types.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface LockApproval {
|
|
|
28
28
|
readonly when: 'always' | 'drift';
|
|
29
29
|
}
|
|
30
30
|
/** Schema version - re-exported from engine as single source of truth */
|
|
31
|
-
export declare const SCHEMA_VERSION:
|
|
31
|
+
export declare const SCHEMA_VERSION: 39;
|
|
32
32
|
/** Lock compatibility-window floor - re-exported from engine as single source of truth */
|
|
33
33
|
export declare const BREAKING_FLOOR: 30;
|
|
34
34
|
/**
|
|
@@ -464,10 +464,40 @@ export interface LockJob {
|
|
|
464
464
|
readonly checkout?: boolean;
|
|
465
465
|
/** Declarative cache specs (normalized to an array). Restored before steps / saved after the job. */
|
|
466
466
|
readonly cache?: readonly import('@kici-dev/sdk').CacheSpec[];
|
|
467
|
-
/**
|
|
467
|
+
/**
|
|
468
|
+
* Container for job execution. All steps run inside it.
|
|
469
|
+
*
|
|
470
|
+
* A bare image string, or an object naming exactly one image source: a
|
|
471
|
+
* finalized `image`, or a `dockerfile` the agent builds from the cloned tree
|
|
472
|
+
* before the job starts.
|
|
473
|
+
*
|
|
474
|
+
* Kept in step with `LockJob.container` in `@kici-dev/engine` and
|
|
475
|
+
* `ContainerConfig` in `@kici-dev/sdk` — three mirrors of one shape, and a
|
|
476
|
+
* field added to one has to be added to all three or the generator stops
|
|
477
|
+
* typechecking.
|
|
478
|
+
*/
|
|
468
479
|
readonly container?: string | {
|
|
469
|
-
image
|
|
480
|
+
/** Finalized image to pull. Exactly one of `image` / `dockerfile` is set. */
|
|
481
|
+
image?: string;
|
|
482
|
+
/** Repo-relative Dockerfile the agent builds before the job runs. */
|
|
483
|
+
dockerfile?: string;
|
|
484
|
+
/** Repo-relative build context. Defaults to the repository root. */
|
|
485
|
+
context?: string;
|
|
486
|
+
/** Build stage to stop at. */
|
|
487
|
+
target?: string;
|
|
488
|
+
/** Build arguments. Plain strings — never secret references. */
|
|
489
|
+
args?: Record<string, string>;
|
|
470
490
|
env?: Record<string, string>;
|
|
491
|
+
/** Private-registry credentials for pulling the image (flattened Sourced pairs). */
|
|
492
|
+
auth?: {
|
|
493
|
+
username?: string;
|
|
494
|
+
usernameSecret?: string;
|
|
495
|
+
usernameValue?: string;
|
|
496
|
+
tokenSecret?: string;
|
|
497
|
+
tokenValue?: string;
|
|
498
|
+
/** Registry host. Required when `dockerfile` is set. */
|
|
499
|
+
registry?: string;
|
|
500
|
+
};
|
|
471
501
|
};
|
|
472
502
|
/**
|
|
473
503
|
* Bound contexts in merge order. Each entry is a static name or inline
|
|
@@ -75,9 +75,28 @@ function validateWorkflow(workflow, workflowFile) {
|
|
|
75
75
|
const matrixErrors = validateStaticMatrix(job, workflow.name, workflowFile);
|
|
76
76
|
errors.push(...matrixErrors);
|
|
77
77
|
}
|
|
78
|
+
for (const job of staticJobs) errors.push(...validateInvokeJob(job, jobLoc(job.name)));
|
|
78
79
|
errors.push(...validateGlobalApproval(workflow, staticJobs, workflowFile));
|
|
79
80
|
return errors;
|
|
80
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Validate an invoke-gate job. A gate is mutually exclusive with step code and
|
|
84
|
+
* must name a non-empty event. Defense-in-depth: the SDK `job()` factory already
|
|
85
|
+
* enforces these, but a generated job could reach the compiler carrying them.
|
|
86
|
+
*/
|
|
87
|
+
function validateInvokeJob(job, location) {
|
|
88
|
+
if (!job.invoke) return [];
|
|
89
|
+
const errors = [];
|
|
90
|
+
if ((job.steps?.length ?? 0) > 0) errors.push(compilerError("E125", `job '${job.name}': 'invoke' cannot be combined with 'steps'`, {
|
|
91
|
+
location,
|
|
92
|
+
suggestion: "An invoke gate never runs steps — remove `steps`/`run`, or drop `invoke`."
|
|
93
|
+
}));
|
|
94
|
+
if (typeof job.invoke.event !== "string" || job.invoke.event.trim().length === 0) errors.push(compilerError("E126", `job '${job.name}': invoke.event must be a non-empty event name`, {
|
|
95
|
+
location,
|
|
96
|
+
suggestion: "Pass a kici event name to invokeSource(), e.g. invokeSource(\"myorg.repo-tests\")."
|
|
97
|
+
}));
|
|
98
|
+
return errors;
|
|
99
|
+
}
|
|
81
100
|
/** True when any trigger carries `repos:`, which is what makes a workflow global. */
|
|
82
101
|
function isGlobalWorkflow(workflow) {
|
|
83
102
|
return (Array.isArray(workflow.on) ? workflow.on : workflow.on ? [workflow.on] : []).some((trigger) => {
|
|
@@ -152,12 +171,10 @@ function validateJobDag(jobs, workflowName, jobLoc, dynamicGroupNames) {
|
|
|
152
171
|
suggestion: "Remove the self-dependency"
|
|
153
172
|
}));
|
|
154
173
|
break;
|
|
155
|
-
case "missing-dependency":
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}));
|
|
160
|
-
break;
|
|
174
|
+
case "missing-dependency": errors.push(compilerError("E101", `Job "${result.nodeId}" in workflow "${workflowName}" depends on non-existent job "${result.missingDep}"`, {
|
|
175
|
+
location: dagNodeLocation(result.nodeId, jobLoc),
|
|
176
|
+
suggestion: `Create a job named "${result.missingDep}" or fix the dependency name`
|
|
177
|
+
}));
|
|
161
178
|
}
|
|
162
179
|
return errors;
|
|
163
180
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kici-dev/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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",
|
|
@@ -46,28 +46,33 @@
|
|
|
46
46
|
"./cli": "./dist/cli.js"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@inquirer/prompts": "^8.
|
|
49
|
+
"@inquirer/prompts": "^8.7.0",
|
|
50
|
+
"archiver": "^8.0.0",
|
|
50
51
|
"chokidar": "^5.0.0",
|
|
51
52
|
"commander": "^15.0.0",
|
|
52
53
|
"embedded-postgres": "18.4.0-beta.17",
|
|
53
54
|
"fast-glob": "^3.3.3",
|
|
54
|
-
"open": "
|
|
55
|
+
"open": "11.0.0",
|
|
55
56
|
"picocolors": "^1.1.1",
|
|
56
|
-
"picomatch": "^4.0.
|
|
57
|
-
"tar": "^7.5.
|
|
57
|
+
"picomatch": "^4.0.7",
|
|
58
|
+
"tar": "^7.5.22",
|
|
58
59
|
"typescript": "^6.0.3",
|
|
59
|
-
"ws": "^8.21.
|
|
60
|
+
"ws": "^8.21.3",
|
|
60
61
|
"wsl-utils": "^0.3.0",
|
|
61
62
|
"yaml": "^2.9.0",
|
|
62
63
|
"zod": "^4.4.3",
|
|
63
64
|
"zx": "^8.8.5",
|
|
64
|
-
"@kici-dev/agent": "0.
|
|
65
|
-
"@kici-dev/core": "0.
|
|
66
|
-
"@kici-dev/engine": "0.
|
|
67
|
-
"@kici-dev/orchestrator": "0.
|
|
65
|
+
"@kici-dev/agent": "0.6.0",
|
|
66
|
+
"@kici-dev/core": "0.6.0",
|
|
67
|
+
"@kici-dev/engine": "0.6.0",
|
|
68
|
+
"@kici-dev/orchestrator": "0.6.0"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@types/archiver": "^8.0.0",
|
|
72
|
+
"jszip": "^3.10.1"
|
|
68
73
|
},
|
|
69
74
|
"peerDependencies": {
|
|
70
|
-
"@kici-dev/sdk": "0.
|
|
75
|
+
"@kici-dev/sdk": "0.6.0"
|
|
71
76
|
},
|
|
72
77
|
"scripts": {
|
|
73
78
|
"build": "node ../../scripts/build-ts.mjs && tsgo --emitDeclarationOnly",
|