@kici-dev/compiler 0.0.0 ā 0.1.2
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/LICENSE +202 -0
- package/README.md +1 -6
- package/dist/assets/api-TJJVHrjC.json +118 -0
- package/dist/assets/descriptor-BTtjzN9L.json +1382 -0
- package/dist/assets/package-BpQF9kR8.json +74 -0
- package/dist/assets/package-Ceo2h27X.json +89 -0
- package/dist/assets/source_context-D0atuL28.json +20 -0
- package/dist/assets/type-BFqO8SCZ.json +202 -0
- package/dist/auth/headless-detect.d.ts +14 -0
- package/dist/auth/headless-detect.js +25 -0
- package/dist/chunk-gOLHoazu.js +4 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +193 -0
- package/dist/commands/cancel.d.ts +22 -0
- package/dist/commands/cancel.js +124 -0
- package/dist/commands/compile.d.ts +17 -0
- package/dist/commands/compile.js +99 -0
- package/dist/commands/docs.d.ts +26 -0
- package/dist/commands/docs.js +60 -0
- package/dist/commands/drain-worker.d.ts +19 -0
- package/dist/commands/drain-worker.js +45 -0
- package/dist/commands/endpoints.d.ts +53 -0
- package/dist/commands/endpoints.js +185 -0
- package/dist/commands/fixture.d.ts +14 -0
- package/dist/commands/fixture.js +104 -0
- package/dist/commands/hook.d.ts +20 -0
- package/dist/commands/hook.js +97 -0
- package/dist/commands/index.d.ts +33 -0
- package/dist/commands/index.js +20 -0
- package/dist/commands/init.d.ts +35 -0
- package/dist/commands/init.js +393 -0
- package/dist/commands/login.d.ts +23 -0
- package/dist/commands/login.js +144 -0
- package/dist/commands/logout.d.ts +18 -0
- package/dist/commands/logout.js +55 -0
- package/dist/commands/org.d.ts +27 -0
- package/dist/commands/org.js +126 -0
- package/dist/commands/run.d.ts +21 -0
- package/dist/commands/run.js +562 -0
- package/dist/commands/secrets-list.d.ts +16 -0
- package/dist/commands/secrets-list.js +85 -0
- package/dist/commands/status.d.ts +30 -0
- package/dist/commands/status.js +210 -0
- package/dist/commands/test.d.ts +61 -0
- package/dist/commands/test.js +220 -0
- package/dist/commands/types.d.ts +18 -0
- package/dist/commands/types.js +74 -0
- package/dist/commands/watch.d.ts +14 -0
- package/dist/commands/watch.js +97 -0
- package/dist/commands/workflows.d.ts +28 -0
- package/dist/commands/workflows.js +154 -0
- package/dist/comment-created.json +30 -0
- package/dist/create-branch.json +17 -0
- package/dist/delete-branch.json +15 -0
- package/dist/dispatch.json +15 -0
- package/dist/errors/capability-gap.d.ts +50 -0
- package/dist/errors/capability-gap.js +54 -0
- package/dist/errors/codes.d.ts +25 -0
- package/dist/errors/formatter.d.ts +32 -0
- package/dist/errors/formatter.js +35 -0
- package/dist/errors/index.d.ts +5 -0
- package/dist/errors/index.js +4 -0
- package/dist/execution/executor.d.ts +61 -0
- package/dist/execution/executor.js +230 -0
- package/dist/execution/index.d.ts +4 -0
- package/dist/execution/index.js +3 -0
- package/dist/execution/sdk-alias.d.ts +33 -0
- package/dist/execution/sdk-alias.js +102 -0
- package/dist/fixtures/compiler.d.ts +47 -0
- package/dist/fixtures/compiler.js +177 -0
- package/dist/fixtures/defaults/comment-created.json +30 -0
- package/dist/fixtures/defaults/create-branch.json +17 -0
- package/dist/fixtures/defaults/delete-branch.json +15 -0
- package/dist/fixtures/defaults/dispatch.json +15 -0
- package/dist/fixtures/defaults/fork.json +19 -0
- package/dist/fixtures/defaults/index.d.ts +16 -0
- package/dist/fixtures/defaults/index.js +105 -0
- package/dist/fixtures/defaults/index.ts +145 -0
- package/dist/fixtures/defaults/pr-closed.json +28 -0
- package/dist/fixtures/defaults/pr-opened.json +27 -0
- package/dist/fixtures/defaults/pr-reopened.json +27 -0
- package/dist/fixtures/defaults/pr-synchronize.json +27 -0
- package/dist/fixtures/defaults/push.json +16 -0
- package/dist/fixtures/defaults/release-published.json +23 -0
- package/dist/fixtures/defaults/review-comment-created.json +36 -0
- package/dist/fixtures/defaults/review-submitted.json +35 -0
- package/dist/fixtures/defaults/star-created.json +15 -0
- package/dist/fixtures/defaults/status.json +26 -0
- package/dist/fixtures/defaults/tag-push.json +20 -0
- package/dist/fixtures/defaults/watch-started.json +15 -0
- package/dist/fixtures/defaults/workflow-run-completed.json +23 -0
- package/dist/fork.json +19 -0
- package/dist/format.d.ts +5 -0
- package/dist/format.js +20 -0
- package/dist/generators/secrets-dts.d.ts +29 -0
- package/dist/generators/secrets-dts.js +67 -0
- package/dist/hooks/detector.d.ts +39 -0
- package/dist/hooks/detector.js +133 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/installer.d.ts +24 -0
- package/dist/hooks/installer.js +328 -0
- package/dist/hooks/templates.d.ts +26 -0
- package/dist/hooks/templates.js +63 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/llm-context/llms-full.txt +9974 -0
- package/dist/llm-context/llms.txt +61 -0
- package/dist/local-executor/dag-scheduler.d.ts +44 -0
- package/dist/local-executor/dag-scheduler.js +183 -0
- package/dist/local-executor/index.d.ts +23 -0
- package/dist/local-executor/index.js +309 -0
- package/dist/local-executor/job-runner.d.ts +40 -0
- package/dist/local-executor/job-runner.js +307 -0
- package/dist/local-executor/output-streamer.d.ts +31 -0
- package/dist/local-executor/output-streamer.js +166 -0
- package/dist/local-executor/payload-generator.d.ts +16 -0
- package/dist/local-executor/payload-generator.js +138 -0
- package/dist/local-executor/picker.d.ts +33 -0
- package/dist/local-executor/picker.js +109 -0
- package/dist/local-executor/secret-loader.d.ts +18 -0
- package/dist/local-executor/secret-loader.js +105 -0
- package/dist/local-executor/types.d.ts +80 -0
- package/dist/local-executor/types.js +2 -0
- package/dist/local-executor/workflow-lock.d.ts +81 -0
- package/dist/local-executor/workflow-lock.js +0 -0
- package/dist/lockfile/generator.d.ts +39 -0
- package/dist/lockfile/generator.js +688 -0
- package/dist/lockfile/hash-files.d.ts +14 -0
- package/dist/lockfile/hash-files.js +50 -0
- package/dist/lockfile/hasher.d.ts +36 -0
- package/dist/lockfile/hasher.js +46 -0
- package/dist/lockfile/index.d.ts +3 -0
- package/dist/lockfile/index.js +4 -0
- package/dist/lockfile/purity-analyzer.d.ts +25 -0
- package/dist/lockfile/purity-analyzer.js +204 -0
- package/dist/package-F7UXSDHW.json +74 -0
- package/dist/postinstall.d.ts +9 -0
- package/dist/postinstall.js +60 -0
- package/dist/pr-closed.json +28 -0
- package/dist/pr-opened.json +27 -0
- package/dist/pr-reopened.json +27 -0
- package/dist/pr-synchronize.json +27 -0
- package/dist/push.json +16 -0
- package/dist/release-published.json +23 -0
- package/dist/remote/client.d.ts +204 -0
- package/dist/remote/client.js +203 -0
- package/dist/remote/config.d.ts +54 -0
- package/dist/remote/config.js +92 -0
- package/dist/remote/encryption.d.ts +35 -0
- package/dist/remote/encryption.js +87 -0
- package/dist/remote/history.d.ts +91 -0
- package/dist/remote/history.js +146 -0
- package/dist/remote/oauth.d.ts +65 -0
- package/dist/remote/oauth.js +302 -0
- package/dist/remote/observer.d.ts +81 -0
- package/dist/remote/observer.js +174 -0
- package/dist/remote/output/json.d.ts +13 -0
- package/dist/remote/output/json.js +36 -0
- package/dist/remote/output/junit.d.ts +18 -0
- package/dist/remote/output/junit.js +50 -0
- package/dist/remote/output/streaming.d.ts +57 -0
- package/dist/remote/output/streaming.js +124 -0
- package/dist/remote/output/summary.d.ts +39 -0
- package/dist/remote/output/summary.js +99 -0
- package/dist/remote/uploader.d.ts +87 -0
- package/dist/remote/uploader.js +197 -0
- package/dist/review-comment-created.json +36 -0
- package/dist/review-submitted.json +35 -0
- package/dist/star-created.json +15 -0
- package/dist/status.json +26 -0
- package/dist/tag-push.json +20 -0
- package/dist/templates/agents-md.d.ts +8 -0
- package/dist/templates/agents-md.js +130 -0
- package/dist/templates/index.d.ts +43 -0
- package/dist/templates/index.js +48 -0
- package/dist/templates/package-json.d.ts +18 -0
- package/dist/templates/package-json.js +34 -0
- package/dist/templates/tsconfig-json.d.ts +9 -0
- package/dist/templates/tsconfig-json.js +26 -0
- package/dist/templates/workflows/hello-world.d.ts +2 -0
- package/dist/templates/workflows/hello-world.js +16 -0
- package/dist/templates/workflows/hello-world.ts +21 -0
- package/dist/templates/workflows/pr-checks.d.ts +2 -0
- package/dist/templates/workflows/pr-checks.js +40 -0
- package/dist/templates/workflows/pr-checks.ts +57 -0
- package/dist/test-runner/dry-run.d.ts +12 -0
- package/dist/test-runner/dry-run.js +66 -0
- package/dist/test-runner/event-types.d.ts +86 -0
- package/dist/test-runner/event-types.js +330 -0
- package/dist/test-runner/git-detector.d.ts +15 -0
- package/dist/test-runner/git-detector.js +30 -0
- package/dist/test-runner/index.d.ts +13 -0
- package/dist/test-runner/index.js +11 -0
- package/dist/test-runner/job-executor.d.ts +48 -0
- package/dist/test-runner/job-executor.js +245 -0
- package/dist/test-runner/output-formatter.d.ts +47 -0
- package/dist/test-runner/output-formatter.js +92 -0
- package/dist/test-runner/payload-builder.d.ts +20 -0
- package/dist/test-runner/payload-builder.js +216 -0
- package/dist/test-runner/rule-evaluator.d.ts +14 -0
- package/dist/test-runner/rule-evaluator.js +31 -0
- package/dist/test-runner/secrets-file.d.ts +24 -0
- package/dist/test-runner/secrets-file.js +62 -0
- package/dist/test-runner/step-context.d.ts +15 -0
- package/dist/test-runner/step-context.js +140 -0
- package/dist/test-runner/summary.d.ts +7 -0
- package/dist/types.d.ts +525 -0
- package/dist/types.js +33 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.js +3 -0
- package/dist/validation/validator.d.ts +26 -0
- package/dist/validation/validator.js +164 -0
- package/dist/watch-started.json +15 -0
- package/dist/workflow-run-completed.json +23 -0
- package/dist/workflows/hello-world.ts +21 -0
- package/dist/workflows/pr-checks.ts +57 -0
- package/hack/postinstall.mjs +105 -0
- package/package.json +60 -6
- package/sbom.spdx.json +10997 -0
- package/index.js +0 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "../chunk-gOLHoazu.js";
|
|
2
|
+
//#region src/templates/package-json.ts
|
|
3
|
+
/**
|
|
4
|
+
* Package.json template generator for kici init command
|
|
5
|
+
*
|
|
6
|
+
* Generates package.json for .kici/ directory in TypeScript mode.
|
|
7
|
+
* SDK is a devDependency resolved from the npm registry
|
|
8
|
+
* (or a private Verdaccio instance when .npmrc scopes the registry).
|
|
9
|
+
* The compiler is invoked via npx (not installed as a dependency).
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Generate package.json content for .kici/ directory
|
|
13
|
+
*
|
|
14
|
+
* @param devMode - When true, uses a prerelease-compatible version range
|
|
15
|
+
* (`>=0.0.1-0`) so npm resolves Verdaccio's prerelease builds (e.g. 0.0.1-2856).
|
|
16
|
+
* Semver `^0.0.1` does NOT match prereleases, causing 404s on Verdaccio.
|
|
17
|
+
* @returns JSON string with proper formatting (2-space indent, trailing newline)
|
|
18
|
+
*/
|
|
19
|
+
function generatePackageJson(devMode = false) {
|
|
20
|
+
return JSON.stringify({
|
|
21
|
+
name: "@kici-dev/workflows",
|
|
22
|
+
private: true,
|
|
23
|
+
type: "module",
|
|
24
|
+
scripts: {
|
|
25
|
+
compile: "npx --yes kici@latest compile",
|
|
26
|
+
typecheck: "tsc --noEmit"
|
|
27
|
+
},
|
|
28
|
+
devDependencies: { "@kici-dev/sdk": devMode ? ">=0.0.1-0" : "^0.0.1" }
|
|
29
|
+
}, null, 2) + "\n";
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { generatePackageJson };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=package-json.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tsconfig.json template for kici init command
|
|
3
|
+
*
|
|
4
|
+
* Exported as a JSON string that matches examples/tsconfig.json exactly.
|
|
5
|
+
* These settings enable proper TypeScript type checking for workflow files
|
|
6
|
+
* with NodeNext module resolution.
|
|
7
|
+
*/
|
|
8
|
+
export declare const tsconfigTemplate: string;
|
|
9
|
+
//# sourceMappingURL=tsconfig-json.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "../chunk-gOLHoazu.js";
|
|
2
|
+
//#region src/templates/tsconfig-json.ts
|
|
3
|
+
/**
|
|
4
|
+
* tsconfig.json template for kici init command
|
|
5
|
+
*
|
|
6
|
+
* Exported as a JSON string that matches examples/tsconfig.json exactly.
|
|
7
|
+
* These settings enable proper TypeScript type checking for workflow files
|
|
8
|
+
* with NodeNext module resolution.
|
|
9
|
+
*/
|
|
10
|
+
const tsconfigTemplate = JSON.stringify({
|
|
11
|
+
compilerOptions: {
|
|
12
|
+
target: "ES2024",
|
|
13
|
+
module: "NodeNext",
|
|
14
|
+
moduleResolution: "NodeNext",
|
|
15
|
+
strict: true,
|
|
16
|
+
noEmit: true,
|
|
17
|
+
esModuleInterop: true,
|
|
18
|
+
skipLibCheck: true,
|
|
19
|
+
forceConsistentCasingInFileNames: true
|
|
20
|
+
},
|
|
21
|
+
include: ["workflows/**/*", "types/**/*.d.ts"]
|
|
22
|
+
}, null, 2) + "\n";
|
|
23
|
+
//#endregion
|
|
24
|
+
export { tsconfigTemplate };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=tsconfig-json.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "../../chunk-gOLHoazu.js";
|
|
2
|
+
import { job, push, step, workflow } from "@kici-dev/sdk";
|
|
3
|
+
//#region src/templates/workflows/hello-world.ts
|
|
4
|
+
const helloWorldWorkflow = workflow("hello-world", {
|
|
5
|
+
on: push(),
|
|
6
|
+
jobs: [job("greet", {
|
|
7
|
+
runsOn: "ubuntu-latest",
|
|
8
|
+
steps: [step("say-hello", async ({ $ }) => {
|
|
9
|
+
await $`echo "Hello, World!"`;
|
|
10
|
+
})]
|
|
11
|
+
})]
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { helloWorldWorkflow };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=hello-world.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Hello World -- minimal push workflow
|
|
2
|
+
// Docs: https://kici.dev/docs/sdk-reference
|
|
3
|
+
|
|
4
|
+
import { workflow, job, step, push } from '@kici-dev/sdk';
|
|
5
|
+
|
|
6
|
+
export const helloWorldWorkflow = workflow('hello-world', {
|
|
7
|
+
// Trigger: push() matches any push event
|
|
8
|
+
// Options: branches, tags, paths, description (config-style; use !-prefix for exclusions)
|
|
9
|
+
on: push(),
|
|
10
|
+
|
|
11
|
+
jobs: [
|
|
12
|
+
job('greet', {
|
|
13
|
+
runsOn: 'ubuntu-latest',
|
|
14
|
+
steps: [
|
|
15
|
+
step('say-hello', async ({ $ }) => {
|
|
16
|
+
await $`echo "Hello, World!"`;
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
}),
|
|
20
|
+
],
|
|
21
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "../../chunk-gOLHoazu.js";
|
|
2
|
+
import { job, pr, rule, skip, step, workflow } from "@kici-dev/sdk";
|
|
3
|
+
//#region src/templates/workflows/pr-checks.ts
|
|
4
|
+
const prChecksWorkflow = workflow("pr-checks", {
|
|
5
|
+
on: pr({
|
|
6
|
+
target: "main",
|
|
7
|
+
paths: ["src/**"]
|
|
8
|
+
}),
|
|
9
|
+
rules: [skip("skip-draft-prs", async (ctx) => {
|
|
10
|
+
return ctx.event.pull_request?.draft === true;
|
|
11
|
+
}), rule("require-src-changes", async (ctx) => {
|
|
12
|
+
return ctx.changedFiles.some((file) => file.startsWith("src/"));
|
|
13
|
+
})],
|
|
14
|
+
jobs: [job("lint", {
|
|
15
|
+
runsOn: "ubuntu-latest",
|
|
16
|
+
steps: [step("checkout", async ({ $ }) => {
|
|
17
|
+
await $`echo "Checking out code..."`;
|
|
18
|
+
}), step("run-linter", async ({ $ }) => {
|
|
19
|
+
await $`echo "Running linter..."`;
|
|
20
|
+
})]
|
|
21
|
+
}), job("test", {
|
|
22
|
+
runsOn: "ubuntu-latest",
|
|
23
|
+
needs: ["lint"],
|
|
24
|
+
steps: [
|
|
25
|
+
step("checkout", async ({ $ }) => {
|
|
26
|
+
await $`echo "Checking out code..."`;
|
|
27
|
+
}),
|
|
28
|
+
step("install-deps", async ({ $ }) => {
|
|
29
|
+
await $`echo "Installing dependencies..."`;
|
|
30
|
+
}),
|
|
31
|
+
step("run-tests", async ({ $ }) => {
|
|
32
|
+
await $`echo "Running tests..."`;
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
38
|
+
export { prChecksWorkflow };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=pr-checks.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// PR Checks -- workflow with rules, dependencies, and multiple jobs
|
|
2
|
+
// Docs: https://kici.dev/docs/sdk-reference
|
|
3
|
+
// Patterns: https://kici.dev/docs/workflow-patterns
|
|
4
|
+
|
|
5
|
+
import { workflow, job, step, pr, rule, skip } from '@kici-dev/sdk';
|
|
6
|
+
|
|
7
|
+
export const prChecksWorkflow = workflow('pr-checks', {
|
|
8
|
+
// Trigger: pr() matches pull request events
|
|
9
|
+
// Options: target, paths, events (config-style)
|
|
10
|
+
on: pr({ target: 'main', paths: ['src/**'] }),
|
|
11
|
+
|
|
12
|
+
// Rules: evaluated before workflow runs
|
|
13
|
+
// skip() = skip if true, rule() = run only if true
|
|
14
|
+
rules: [
|
|
15
|
+
skip('skip-draft-prs', async (ctx) => {
|
|
16
|
+
return (ctx.event as any).pull_request?.draft === true;
|
|
17
|
+
}),
|
|
18
|
+
|
|
19
|
+
rule('require-src-changes', async (ctx) => {
|
|
20
|
+
return ctx.changedFiles.some((file) => file.startsWith('src/'));
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
|
|
24
|
+
// Jobs: run in parallel unless connected via `needs`
|
|
25
|
+
jobs: [
|
|
26
|
+
job('lint', {
|
|
27
|
+
runsOn: 'ubuntu-latest',
|
|
28
|
+
steps: [
|
|
29
|
+
step('checkout', async ({ $ }) => {
|
|
30
|
+
await $`echo "Checking out code..."`;
|
|
31
|
+
}),
|
|
32
|
+
step('run-linter', async ({ $ }) => {
|
|
33
|
+
// Replace with your linter: eslint, biome, cargo clippy, etc.
|
|
34
|
+
await $`echo "Running linter..."`;
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
}),
|
|
38
|
+
|
|
39
|
+
job('test', {
|
|
40
|
+
runsOn: 'ubuntu-latest',
|
|
41
|
+
needs: ['lint'], // Waits for lint to pass
|
|
42
|
+
steps: [
|
|
43
|
+
step('checkout', async ({ $ }) => {
|
|
44
|
+
await $`echo "Checking out code..."`;
|
|
45
|
+
}),
|
|
46
|
+
step('install-deps', async ({ $ }) => {
|
|
47
|
+
// Replace with: npm ci, etc.
|
|
48
|
+
await $`echo "Installing dependencies..."`;
|
|
49
|
+
}),
|
|
50
|
+
step('run-tests', async ({ $ }) => {
|
|
51
|
+
// Replace with: npm test, vitest run, cargo test, etc.
|
|
52
|
+
await $`echo "Running tests..."`;
|
|
53
|
+
}),
|
|
54
|
+
],
|
|
55
|
+
}),
|
|
56
|
+
],
|
|
57
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LockWorkflow } from '../types.js';
|
|
2
|
+
import type { WorkflowDecision } from '@kici-dev/engine';
|
|
3
|
+
interface DryRunOptions {
|
|
4
|
+
workflow?: string;
|
|
5
|
+
job?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Display dry-run output showing what would execute.
|
|
9
|
+
*/
|
|
10
|
+
export declare function displayDryRun(workflows: readonly LockWorkflow[], decisions: WorkflowDecision[], options: DryRunOptions): void;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=dry-run.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import "../chunk-gOLHoazu.js";
|
|
2
|
+
import pc from "picocolors";
|
|
3
|
+
import { logger } from "@kici-dev/shared";
|
|
4
|
+
//#region src/test-runner/dry-run.ts
|
|
5
|
+
/**
|
|
6
|
+
* Display dry-run output showing what would execute.
|
|
7
|
+
*/
|
|
8
|
+
function displayDryRun(workflows, decisions, options) {
|
|
9
|
+
logger.info(pc.bold("\nš DRY RUN - No commands will be executed\n"));
|
|
10
|
+
const matchedWorkflows = decisions.filter((d) => d.matched);
|
|
11
|
+
if (matchedWorkflows.length === 0) {
|
|
12
|
+
logger.info(pc.yellow("No workflows matched the event.\n"));
|
|
13
|
+
displayDecisionSummary(decisions);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
for (const decision of matchedWorkflows) {
|
|
17
|
+
if (options.workflow && decision.workflowName !== options.workflow) continue;
|
|
18
|
+
const workflow = workflows.find((w) => w.name === decision.workflowName);
|
|
19
|
+
logger.info(pc.cyan(`Workflow: ${workflow.name}`));
|
|
20
|
+
if (workflow.description) logger.info(pc.gray(` ${workflow.description}`));
|
|
21
|
+
logger.info(pc.yellow(` Triggers:`));
|
|
22
|
+
for (const trigger of workflow.triggers) logger.info(` - ${trigger._type}`);
|
|
23
|
+
if (decision.matchedTrigger !== void 0) logger.info(pc.green(` ā Matched trigger ${decision.matchedTrigger + 1}`));
|
|
24
|
+
const staticJobs = workflow.jobs.filter((j) => j._type === "static");
|
|
25
|
+
logger.info(pc.yellow(` Jobs (${staticJobs.length}):`));
|
|
26
|
+
for (const job of staticJobs) {
|
|
27
|
+
if (options.job && job.name !== options.job) continue;
|
|
28
|
+
logger.info(` ${pc.bold(job.name)}`);
|
|
29
|
+
logger.info(pc.gray(` runs-on: ${job.runsOn}`));
|
|
30
|
+
if (job.needs.length > 0) logger.info(pc.gray(` needs: ${job.needs.join(", ")}`));
|
|
31
|
+
if (job.rules && job.rules.length > 0) logger.info(pc.gray(` rules: ${job.rules.map((r) => r.label).join(", ")}`));
|
|
32
|
+
if (job.matrix) if (job.matrix._type === "static" && job.matrix.values) logger.info(pc.gray(` matrix: ${JSON.stringify(job.matrix.values)}`));
|
|
33
|
+
else logger.info(pc.gray(` matrix: [dynamic]`));
|
|
34
|
+
logger.info(pc.gray(` steps (${job.steps.length}):`));
|
|
35
|
+
for (const step of job.steps) logger.info(pc.gray(` - ${step.name}`));
|
|
36
|
+
}
|
|
37
|
+
const dynamicJobs = workflow.jobs.filter((j) => j._type === "dynamic");
|
|
38
|
+
if (dynamicJobs.length > 0) {
|
|
39
|
+
logger.info(pc.yellow(` Dynamic job generators (${dynamicJobs.length}):`));
|
|
40
|
+
for (const _job of dynamicJobs) logger.info(pc.gray(` - [dynamic job generator]`));
|
|
41
|
+
}
|
|
42
|
+
logger.info("");
|
|
43
|
+
}
|
|
44
|
+
displayDecisionSummary(decisions);
|
|
45
|
+
logger.info(pc.green("ā Dry run complete\n"));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Display decision trace summary.
|
|
49
|
+
*/
|
|
50
|
+
function displayDecisionSummary(decisions) {
|
|
51
|
+
logger.info(pc.bold("\nDecision Summary:\n"));
|
|
52
|
+
for (const decision of decisions) {
|
|
53
|
+
const status = decision.matched ? pc.green("ā matched") : pc.gray("ā skipped");
|
|
54
|
+
logger.info(` ${decision.workflowName}: ${status}`);
|
|
55
|
+
logger.info(pc.gray(` ${decision.summary}`));
|
|
56
|
+
if (decision.checks.length > 0 && !decision.matched) {
|
|
57
|
+
const failedCheck = decision.checks.find((c) => !c.passed);
|
|
58
|
+
if (failedCheck) logger.info(pc.gray(` Failed: ${failedCheck.check} - ${failedCheck.pattern} vs ${failedCheck.value}`));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
logger.info("");
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { displayDryRun };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=dry-run.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event type mapping system for webhook events.
|
|
3
|
+
* Supports all 22 trigger types defined in the SDK:
|
|
4
|
+
* 15 GitHub event types + 7 internal/generic types.
|
|
5
|
+
*/
|
|
6
|
+
import type { LockTrigger } from '../types.js';
|
|
7
|
+
export type EventType = {
|
|
8
|
+
type: 'pull_request';
|
|
9
|
+
action: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'push';
|
|
12
|
+
} | {
|
|
13
|
+
type: 'tag';
|
|
14
|
+
} | {
|
|
15
|
+
type: 'comment';
|
|
16
|
+
action: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'review';
|
|
19
|
+
action: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'review_comment';
|
|
22
|
+
action: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'release';
|
|
25
|
+
action: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'dispatch';
|
|
28
|
+
} | {
|
|
29
|
+
type: 'create';
|
|
30
|
+
refType?: string;
|
|
31
|
+
} | {
|
|
32
|
+
type: 'delete';
|
|
33
|
+
refType?: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'status';
|
|
36
|
+
} | {
|
|
37
|
+
type: 'workflow_run';
|
|
38
|
+
action: string;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'fork';
|
|
41
|
+
} | {
|
|
42
|
+
type: 'star';
|
|
43
|
+
action: string;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'watch';
|
|
46
|
+
action: string;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'kici_event';
|
|
49
|
+
eventName: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'workflow_complete';
|
|
52
|
+
workflowName: string;
|
|
53
|
+
status: string;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'job_complete';
|
|
56
|
+
workflowName: string;
|
|
57
|
+
jobName: string;
|
|
58
|
+
status: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'generic_webhook';
|
|
61
|
+
source?: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'schedule';
|
|
64
|
+
cronExpression?: string;
|
|
65
|
+
timezone?: string;
|
|
66
|
+
} | {
|
|
67
|
+
type: 'lifecycle';
|
|
68
|
+
lifecycleEvent: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Parse CLI event argument to EventType.
|
|
72
|
+
* Supports all trigger types and common action shortcuts.
|
|
73
|
+
*/
|
|
74
|
+
export declare function parseEventArg(arg: string): EventType;
|
|
75
|
+
/**
|
|
76
|
+
* Derive an event-arg string from a `LockTrigger` that `parseEventArg` can accept.
|
|
77
|
+
* Inverse of `parseEventArg` for picker-driven flows: pick a trigger, feed the
|
|
78
|
+
* derived event arg back through the standard pipeline.
|
|
79
|
+
*/
|
|
80
|
+
export declare function triggerToEventArg(trigger: LockTrigger): string;
|
|
81
|
+
/**
|
|
82
|
+
* One-line label for a `LockTrigger`, suitable for interactive picker rows.
|
|
83
|
+
* Keeps output compact and human-readable.
|
|
84
|
+
*/
|
|
85
|
+
export declare function triggerSummary(trigger: LockTrigger): string;
|
|
86
|
+
//# sourceMappingURL=event-types.d.ts.map
|