@kici-dev/compiler 0.1.15 → 0.1.16
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.d.ts +9 -1
- package/dist/cli.js +213 -182
- package/dist/commands/approve.d.ts +23 -0
- package/dist/commands/approve.js +46 -0
- package/dist/commands/compile.js +1 -1
- package/dist/commands/docs.js +2 -2
- package/dist/commands/endpoints.js +1 -1
- package/dist/commands/held-run-client.d.ts +26 -0
- package/dist/commands/held-run-client.js +98 -0
- package/dist/commands/held-run-resolve.d.ts +45 -0
- package/dist/commands/held-run-resolve.js +53 -0
- package/dist/commands/hook.js +1 -1
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.js +3 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/reject.d.ts +25 -0
- package/dist/commands/reject.js +49 -0
- package/dist/commands/run.js +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/test.js +1 -1
- package/dist/commands/types.js +1 -1
- package/dist/commands/watch.js +1 -1
- package/dist/execution/executor.js +2 -2
- package/dist/execution/sdk-alias.js +1 -1
- package/dist/fixtures/compiler.js +2 -2
- package/dist/fixtures/defaults/index.js +2 -2
- package/dist/hooks/detector.js +1 -1
- package/dist/hooks/installer.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/llm-context/llms-full.txt +137 -3
- package/dist/llm-context/llms.txt +2 -1
- package/dist/local-executor/index.js +1 -1
- package/dist/local-executor/job-runner.js +1 -1
- package/dist/local-executor/materializer.js +1 -1
- package/dist/local-executor/secret-loader.js +1 -1
- package/dist/local-executor/workflow-lock.js +0 -0
- package/dist/lockfile/generator.js +17 -5
- package/dist/lockfile/hash-files.js +1 -1
- package/dist/postinstall.js +1 -1
- package/dist/remote/config.js +1 -1
- package/dist/remote/history.js +1 -1
- package/dist/remote/uploader.js +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/templates/package-json.js +1 -1
- package/dist/test-runner/git-detector.js +1 -1
- package/dist/test-runner/job-executor.js +2 -2
- package/dist/test-runner/secrets-file.js +1 -1
- package/dist/test-runner/step-context.js +1 -1
- package/dist/types.d.ts +17 -2
- package/package.json +4 -4
- package/sbom.spdx.json +34 -34
package/dist/cli.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
/**
|
|
4
|
+
* Build the kici Commander program with every command registered. Exported so
|
|
5
|
+
* the surface registry can walk the real command tree without parsing argv (no
|
|
6
|
+
* action runs during a tree walk).
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildProgram(): Command;
|
|
9
|
+
/** Build the program and parse argv — the bin-shim entry point. */
|
|
10
|
+
export declare function runCli(argv?: string[]): void;
|
|
3
11
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.js
CHANGED
|
@@ -1,100 +1,108 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "./chunk-gOLHoazu.js";
|
|
3
3
|
import { shouldSuppressBanner } from "./cli-banner.js";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { resolve } from "node:path";
|
|
4
6
|
import { Argument, Command, Option } from "commander";
|
|
5
7
|
import pc from "picocolors";
|
|
6
8
|
//#region src/cli.ts
|
|
7
|
-
const version = "0.1.
|
|
8
|
-
|
|
9
|
-
program.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
program
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const
|
|
9
|
+
const version = "0.1.16";
|
|
10
|
+
/**
|
|
11
|
+
* Build the kici Commander program with every command registered. Exported so
|
|
12
|
+
* the surface registry can walk the real command tree without parsing argv (no
|
|
13
|
+
* action runs during a tree walk).
|
|
14
|
+
*/
|
|
15
|
+
function buildProgram() {
|
|
16
|
+
const program = new Command();
|
|
17
|
+
program.name("kici").description("KiCI workflow compiler").version(version);
|
|
18
|
+
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
19
|
+
if (shouldSuppressBanner(actionCommand)) return;
|
|
20
|
+
console.log(pc.gray(`kici v${version}`));
|
|
21
|
+
});
|
|
22
|
+
program.configureOutput({ outputError: (str, write) => {
|
|
23
|
+
write(pc.red(str));
|
|
24
|
+
} });
|
|
25
|
+
program.command("compile").description("Compile workflows from .kici/workflows/ to kici.lock.json").option("--check", "Validate workflows without writing lock file", false).option("--kici-dir <path>", "Path to .kici directory", ".kici").option("--verbose", "Detailed output", false).option("--watch", "Watch for changes and recompile", false).action(async (options) => {
|
|
26
|
+
const { compileCommand, watchCommand } = await import("./commands/index.js");
|
|
27
|
+
if (options.watch) await watchCommand({
|
|
25
28
|
kiciDir: options.kiciDir,
|
|
26
|
-
check: options.check,
|
|
27
29
|
verbose: options.verbose
|
|
28
30
|
});
|
|
31
|
+
else {
|
|
32
|
+
const success = await compileCommand({
|
|
33
|
+
kiciDir: options.kiciDir,
|
|
34
|
+
check: options.check,
|
|
35
|
+
verbose: options.verbose
|
|
36
|
+
});
|
|
37
|
+
process.exit(success ? 0 : 1);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const fixtureEventArg = new Argument("<event>", "Event to generate fixture for (e.g., pr:open, push, schedule, lifecycle:workflow_complete)");
|
|
41
|
+
program.command("fixture").addArgument(fixtureEventArg).description("Generate fixture template for event type").option("--output <path>", "Write to file instead of stdout").action(async (event, options) => {
|
|
42
|
+
const { fixtureCommand } = await import("./commands/index.js");
|
|
43
|
+
await fixtureCommand(event, options);
|
|
44
|
+
});
|
|
45
|
+
const runCommand = program.command("run").description("Execute workflows locally or remotely");
|
|
46
|
+
runCommand.command("local").argument("[event]", "Event type (e.g., push, pr:open, schedule) — optional with --pick").description("Execute workflows locally without orchestrator infrastructure").option("-p, --pick", "Interactively pick a workflow and trigger to simulate", false).option("--workflow <name>", "Run only the specified workflow").option("--job <name>", "Run only the specified job (and its dependencies)").option("--branch <name>", "Override detected git branch").option("--sha <hash>", "Override detected git SHA").option("--payload <path>", "Path to explicit event payload JSON file").option("--concurrency <n>", "Max parallel jobs (default: CPU cores)", parseInt).option("--keep-going", "Continue after job failure", false).option("--container", "Use Podman container isolation", false).option("--env <KEY=VALUE>", "Environment variable override (repeatable)", (val, prev) => [...prev, val], []).option("--quiet", "Suppress streaming output", false).option("--json", "Output structured JSON result", false).option("--junit <path>", "Output JUnit XML result").option("--files <path>", "Override changed file paths (repeatable, default: git diff)", (val, prev) => [...prev, val], []).option("--debug", "Verbose internals", false).option("--kici-dir <path>", "Path to .kici directory", ".kici").option("--in-place", "Run against the real working directory instead of an isolated tmp checkout", false).option("--keep", "Always retain the isolated tmp checkout (default: keep only on failure)", false).action(async (event, options) => {
|
|
47
|
+
if (options.pick && options.workflow) {
|
|
48
|
+
console.error("Error: --pick is mutually exclusive with --workflow.");
|
|
49
|
+
process.exit(2);
|
|
50
|
+
}
|
|
51
|
+
if (!options.pick && !event) {
|
|
52
|
+
console.error("Error: missing event argument. Pass an event or use --pick.");
|
|
53
|
+
process.exit(2);
|
|
54
|
+
}
|
|
55
|
+
const { runLocalCommand } = await import("./commands/index.js");
|
|
56
|
+
const success = await runLocalCommand({
|
|
57
|
+
event,
|
|
58
|
+
pick: options.pick,
|
|
59
|
+
workflow: options.workflow,
|
|
60
|
+
job: options.job,
|
|
61
|
+
branch: options.branch,
|
|
62
|
+
sha: options.sha,
|
|
63
|
+
payload: options.payload,
|
|
64
|
+
concurrency: options.concurrency,
|
|
65
|
+
keepGoing: options.keepGoing,
|
|
66
|
+
container: options.container,
|
|
67
|
+
env: options.env,
|
|
68
|
+
quiet: options.quiet,
|
|
69
|
+
json: options.json,
|
|
70
|
+
junit: options.junit,
|
|
71
|
+
files: options.files,
|
|
72
|
+
debug: options.debug,
|
|
73
|
+
kiciDir: options.kiciDir,
|
|
74
|
+
inPlace: options.inPlace,
|
|
75
|
+
keep: options.keep
|
|
76
|
+
});
|
|
77
|
+
process.exit(success ? 0 : 1);
|
|
78
|
+
});
|
|
79
|
+
runCommand.command("remote").argument("[fixture]", "Fixture name or glob pattern (omit to list available)").description("Execute fixtures remotely via orchestrator").option("--workflow <name>", "Run a specific workflow directly (bypass triggers)").option("--all", "Run all available fixtures", false).option("--parallel", "Run matching fixtures concurrently", false).option("--no-wait", "Fire and forget (print runIds, don't stream)").option("--quiet", "Suppress output except final result", false).option("--json", "Output structured JSON result", false).option("--junit <path>", "Output JUnit XML result").option("--history", "Show recent run history", false).option("--routing-key <key>", "Override routing key for this run").option("--debug", "Verbose internals", false).option("--kici-dir <path>", "Path to .kici directory", ".kici").option("--context <ctx.key=value>", "Inject a namespaced context secret, uploaded encrypted to the orchestrator (repeatable)", (val, prev) => [...prev, val], []).option("--env <KEY=VALUE>", "Provide a per-run secret (repeatable); uploaded encrypted to the orchestrator", (val, prev) => [...prev, val], []).action(async (fixture, options) => {
|
|
80
|
+
const { runRemoteCommand } = await import("./commands/index.js");
|
|
81
|
+
const success = await runRemoteCommand(fixture, {
|
|
82
|
+
...options,
|
|
83
|
+
envFlags: options.env
|
|
84
|
+
});
|
|
85
|
+
process.exit(success ? 0 : 1);
|
|
86
|
+
});
|
|
87
|
+
program.command("test").argument("[event]", "Event type to preview (e.g., push, pr:open, schedule)").description("Preview which workflows match a trigger event (dry-run)").option("--branch <name>", "Override target branch for trigger matching (default: main)").option("--sha <hash>", "Override commit SHA").option("--workflow <name>", "Filter to specific workflow in display").option("--job <name>", "Filter to specific job in display").option("--debug", "Verbose internals", false).option("--kici-dir <path>", "Path to .kici directory", ".kici").option("--files <path>", "Simulate changed file path for trigger matching (repeatable)", (val, prev) => [...prev, val], []).option("--secret <key=value>", "Inject flat secret (repeatable)", (val, prev) => [...prev, val], []).option("--context <ctx.key=value>", "Inject context secret (repeatable)", (val, prev) => [...prev, val], []).action(async (event, options) => {
|
|
88
|
+
const { testCommand } = await import("./commands/index.js");
|
|
89
|
+
const success = await testCommand(event, options);
|
|
90
|
+
process.exit(success ? 0 : 1);
|
|
91
|
+
});
|
|
92
|
+
program.command("init").description("Initialize .kici/ directory with default workflows").option("--force", "Overwrite existing .kici/ directory", false).option("--skip-install", "Create files without installing dependencies", false).option("--package-manager <npm|pnpm|yarn>", "Force a package manager for the install step (default: auto-detect)").option("--mjs", "JavaScript-only mode (no TypeScript, no dependencies)", false).option("--no-agents-md", "Skip writing .kici/AGENTS.md (LLM authoring context)").option("--private-registry <url>", "Scaffold a workflow registries: entry pointing at <url>").option("--private-registry-scope <scope>", "Optional npm package scope (e.g. @my-org) for the private registry").option("--private-registry-secret <ref>", "Qualified secret reference (env:NAME) the private registry token comes from", "production:NPM_TOKEN").addOption(new Option("--use-verdaccio-local").default(false).hideHelp()).action(async (options) => {
|
|
93
|
+
const { initCommand } = await import("./commands/index.js");
|
|
94
|
+
const success = await initCommand({
|
|
95
|
+
...options,
|
|
96
|
+
noAgentsMd: options.agentsMd === false
|
|
97
|
+
});
|
|
98
|
+
process.exit(success ? 0 : 1);
|
|
99
|
+
});
|
|
100
|
+
program.command("hook").description("Manage pre-commit hooks").command("install").description("Install kici compile pre-commit hook").option("--git", "Use raw git hook (.git/hooks/pre-commit)", false).action(async (options) => {
|
|
101
|
+
const { hookInstallCommand } = await import("./commands/index.js");
|
|
102
|
+
const success = await hookInstallCommand({ git: options.git });
|
|
29
103
|
process.exit(success ? 0 : 1);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const fixtureEventArg = new Argument("<event>", "Event to generate fixture for (e.g., pr:open, push, schedule, lifecycle:workflow_complete)");
|
|
33
|
-
program.command("fixture").addArgument(fixtureEventArg).description("Generate fixture template for event type").option("--output <path>", "Write to file instead of stdout").action(async (event, options) => {
|
|
34
|
-
const { fixtureCommand } = await import("./commands/index.js");
|
|
35
|
-
await fixtureCommand(event, options);
|
|
36
|
-
});
|
|
37
|
-
const runCommand = program.command("run").description("Execute workflows locally or remotely");
|
|
38
|
-
runCommand.command("local").argument("[event]", "Event type (e.g., push, pr:open, schedule) — optional with --pick").description("Execute workflows locally without orchestrator infrastructure").option("-p, --pick", "Interactively pick a workflow and trigger to simulate", false).option("--workflow <name>", "Run only the specified workflow").option("--job <name>", "Run only the specified job (and its dependencies)").option("--branch <name>", "Override detected git branch").option("--sha <hash>", "Override detected git SHA").option("--payload <path>", "Path to explicit event payload JSON file").option("--concurrency <n>", "Max parallel jobs (default: CPU cores)", parseInt).option("--keep-going", "Continue after job failure", false).option("--container", "Use Podman container isolation", false).option("--env <KEY=VALUE>", "Environment variable override (repeatable)", (val, prev) => [...prev, val], []).option("--quiet", "Suppress streaming output", false).option("--json", "Output structured JSON result", false).option("--junit <path>", "Output JUnit XML result").option("--files <path>", "Override changed file paths (repeatable, default: git diff)", (val, prev) => [...prev, val], []).option("--debug", "Verbose internals", false).option("--kici-dir <path>", "Path to .kici directory", ".kici").option("--in-place", "Run against the real working directory instead of an isolated tmp checkout", false).option("--keep", "Always retain the isolated tmp checkout (default: keep only on failure)", false).action(async (event, options) => {
|
|
39
|
-
if (options.pick && options.workflow) {
|
|
40
|
-
console.error("Error: --pick is mutually exclusive with --workflow.");
|
|
41
|
-
process.exit(2);
|
|
42
|
-
}
|
|
43
|
-
if (!options.pick && !event) {
|
|
44
|
-
console.error("Error: missing event argument. Pass an event or use --pick.");
|
|
45
|
-
process.exit(2);
|
|
46
|
-
}
|
|
47
|
-
const { runLocalCommand } = await import("./commands/index.js");
|
|
48
|
-
const success = await runLocalCommand({
|
|
49
|
-
event,
|
|
50
|
-
pick: options.pick,
|
|
51
|
-
workflow: options.workflow,
|
|
52
|
-
job: options.job,
|
|
53
|
-
branch: options.branch,
|
|
54
|
-
sha: options.sha,
|
|
55
|
-
payload: options.payload,
|
|
56
|
-
concurrency: options.concurrency,
|
|
57
|
-
keepGoing: options.keepGoing,
|
|
58
|
-
container: options.container,
|
|
59
|
-
env: options.env,
|
|
60
|
-
quiet: options.quiet,
|
|
61
|
-
json: options.json,
|
|
62
|
-
junit: options.junit,
|
|
63
|
-
files: options.files,
|
|
64
|
-
debug: options.debug,
|
|
65
|
-
kiciDir: options.kiciDir,
|
|
66
|
-
inPlace: options.inPlace,
|
|
67
|
-
keep: options.keep
|
|
68
|
-
});
|
|
69
|
-
process.exit(success ? 0 : 1);
|
|
70
|
-
});
|
|
71
|
-
runCommand.command("remote").argument("[fixture]", "Fixture name or glob pattern (omit to list available)").description("Execute fixtures remotely via orchestrator").option("--workflow <name>", "Run a specific workflow directly (bypass triggers)").option("--all", "Run all available fixtures", false).option("--parallel", "Run matching fixtures concurrently", false).option("--no-wait", "Fire and forget (print runIds, don't stream)").option("--quiet", "Suppress output except final result", false).option("--json", "Output structured JSON result", false).option("--junit <path>", "Output JUnit XML result").option("--history", "Show recent run history", false).option("--routing-key <key>", "Override routing key for this run").option("--debug", "Verbose internals", false).option("--kici-dir <path>", "Path to .kici directory", ".kici").option("--context <ctx.key=value>", "Inject a namespaced context secret, uploaded encrypted to the orchestrator (repeatable)", (val, prev) => [...prev, val], []).option("--env <KEY=VALUE>", "Provide a per-run secret (repeatable); uploaded encrypted to the orchestrator", (val, prev) => [...prev, val], []).action(async (fixture, options) => {
|
|
72
|
-
const { runRemoteCommand } = await import("./commands/index.js");
|
|
73
|
-
const success = await runRemoteCommand(fixture, {
|
|
74
|
-
...options,
|
|
75
|
-
envFlags: options.env
|
|
76
|
-
});
|
|
77
|
-
process.exit(success ? 0 : 1);
|
|
78
|
-
});
|
|
79
|
-
program.command("test").argument("[event]", "Event type to preview (e.g., push, pr:open, schedule)").description("Preview which workflows match a trigger event (dry-run)").option("--branch <name>", "Override target branch for trigger matching (default: main)").option("--sha <hash>", "Override commit SHA").option("--workflow <name>", "Filter to specific workflow in display").option("--job <name>", "Filter to specific job in display").option("--debug", "Verbose internals", false).option("--kici-dir <path>", "Path to .kici directory", ".kici").option("--files <path>", "Simulate changed file path for trigger matching (repeatable)", (val, prev) => [...prev, val], []).option("--secret <key=value>", "Inject flat secret (repeatable)", (val, prev) => [...prev, val], []).option("--context <ctx.key=value>", "Inject context secret (repeatable)", (val, prev) => [...prev, val], []).action(async (event, options) => {
|
|
80
|
-
const { testCommand } = await import("./commands/index.js");
|
|
81
|
-
const success = await testCommand(event, options);
|
|
82
|
-
process.exit(success ? 0 : 1);
|
|
83
|
-
});
|
|
84
|
-
program.command("init").description("Initialize .kici/ directory with default workflows").option("--force", "Overwrite existing .kici/ directory", false).option("--skip-install", "Create files without installing dependencies", false).option("--package-manager <npm|pnpm|yarn>", "Force a package manager for the install step (default: auto-detect)").option("--mjs", "JavaScript-only mode (no TypeScript, no dependencies)", false).option("--no-agents-md", "Skip writing .kici/AGENTS.md (LLM authoring context)").option("--private-registry <url>", "Scaffold a workflow registries: entry pointing at <url>").option("--private-registry-scope <scope>", "Optional npm package scope (e.g. @my-org) for the private registry").option("--private-registry-secret <ref>", "Qualified secret reference (env:NAME) the private registry token comes from", "production:NPM_TOKEN").addOption(new Option("--use-verdaccio-local").default(false).hideHelp()).action(async (options) => {
|
|
85
|
-
const { initCommand } = await import("./commands/index.js");
|
|
86
|
-
const success = await initCommand({
|
|
87
|
-
...options,
|
|
88
|
-
noAgentsMd: options.agentsMd === false
|
|
89
|
-
});
|
|
90
|
-
process.exit(success ? 0 : 1);
|
|
91
|
-
});
|
|
92
|
-
program.command("hook").description("Manage pre-commit hooks").command("install").description("Install kici compile pre-commit hook").option("--git", "Use raw git hook (.git/hooks/pre-commit)", false).action(async (options) => {
|
|
93
|
-
const { hookInstallCommand } = await import("./commands/index.js");
|
|
94
|
-
const success = await hookInstallCommand({ git: options.git });
|
|
95
|
-
process.exit(success ? 0 : 1);
|
|
96
|
-
});
|
|
97
|
-
program.command("login").description("Authenticate with KiCI via browser OAuth (default) or API key (--token)").option("--token <key>", "API key for direct authentication (legacy)").option("--device", "Force device authorization flow (for headless/SSH environments)").option("--endpoint <url>", "Orchestrator URL for direct connection").option("--platform-endpoint <url>", "Platform relay URL").option("--routing-key <key>", "Routing key for webhook source identification").addHelpText("after", `
|
|
104
|
+
});
|
|
105
|
+
program.command("login").description("Authenticate with KiCI via browser OAuth (default) or API key (--token)").option("--token <key>", "API key for direct authentication (legacy)").option("--device", "Force device authorization flow (for headless/SSH environments)").option("--endpoint <url>", "Orchestrator URL for direct connection").option("--platform-endpoint <url>", "Platform relay URL").option("--routing-key <key>", "Routing key for webhook source identification").addHelpText("after", `
|
|
98
106
|
Environment variables:
|
|
99
107
|
KICI_BROWSER_CMD Custom browser command (use {url} placeholder, or 'none' to suppress)
|
|
100
108
|
KICI_CALLBACK_PORT Fixed port for OAuth PKCE callback server (default: random)
|
|
@@ -102,101 +110,124 @@ Environment variables:
|
|
|
102
110
|
KICI_OIDC_ISSUER Override OIDC issuer URL
|
|
103
111
|
KICI_OIDC_CLIENT_ID Override OIDC client ID
|
|
104
112
|
`).action(async (options) => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
});
|
|
115
|
-
program.command("logout").description("Revoke PAT and clear local credentials").action(async () => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
120
|
-
const orgCommand = program.command("org").description("Manage organizations");
|
|
121
|
-
orgCommand.command("list").description("List organizations you belong to").action(async () => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
orgCommand.command("use").argument("<name>", "Organization name or ID").description("Switch active organization").action(async (name) => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
});
|
|
131
|
-
orgCommand.command("current").description("Show current active organization").action(async () => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
program.command("secrets").description("Manage secrets").command("list").description("List test-available secret contexts").option("--endpoint <url>", "Orchestrator URL override").action(async (options) => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
});
|
|
141
|
-
program.command("status").argument("<run-id>", "Run ID to inspect").description("Show status and details of a test run").option("--logs", "Stream full log replay", false).option("--job <name>", "Filter logs to specific job").option("--json", "Output raw JSON", false).action(async (runId, options) => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
});
|
|
150
|
-
program.command("cancel").argument("[run-id]", "Run ID to cancel").description("Cancel a running workflow or all runs on a branch").option("--force", "Force cancel (kill immediately, skip hooks)", false).option("--branch <name>", "Cancel all in-progress runs on this branch").action(async (runId, options) => {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
});
|
|
158
|
-
program.command("
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
});
|
|
166
|
-
program.command("
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
});
|
|
198
|
-
program.
|
|
113
|
+
const { loginCommand } = await import("./commands/index.js");
|
|
114
|
+
const success = await loginCommand({
|
|
115
|
+
token: options.token,
|
|
116
|
+
device: options.device,
|
|
117
|
+
endpoint: options.endpoint,
|
|
118
|
+
platformEndpoint: options.platformEndpoint,
|
|
119
|
+
routingKey: options.routingKey
|
|
120
|
+
});
|
|
121
|
+
process.exit(success ? 0 : 1);
|
|
122
|
+
});
|
|
123
|
+
program.command("logout").description("Revoke PAT and clear local credentials").action(async () => {
|
|
124
|
+
const { logoutCommand } = await import("./commands/index.js");
|
|
125
|
+
const success = await logoutCommand();
|
|
126
|
+
process.exit(success ? 0 : 1);
|
|
127
|
+
});
|
|
128
|
+
const orgCommand = program.command("org").description("Manage organizations");
|
|
129
|
+
orgCommand.command("list").description("List organizations you belong to").action(async () => {
|
|
130
|
+
const { orgListCommand } = await import("./commands/index.js");
|
|
131
|
+
const success = await orgListCommand();
|
|
132
|
+
process.exit(success ? 0 : 1);
|
|
133
|
+
});
|
|
134
|
+
orgCommand.command("use").argument("<name>", "Organization name or ID").description("Switch active organization").action(async (name) => {
|
|
135
|
+
const { orgUseCommand } = await import("./commands/index.js");
|
|
136
|
+
const success = await orgUseCommand(name);
|
|
137
|
+
process.exit(success ? 0 : 1);
|
|
138
|
+
});
|
|
139
|
+
orgCommand.command("current").description("Show current active organization").action(async () => {
|
|
140
|
+
const { orgCurrentCommand } = await import("./commands/index.js");
|
|
141
|
+
const success = await orgCurrentCommand();
|
|
142
|
+
process.exit(success ? 0 : 1);
|
|
143
|
+
});
|
|
144
|
+
program.command("secrets").description("Manage secrets").command("list").description("List test-available secret contexts").option("--endpoint <url>", "Orchestrator URL override").action(async (options) => {
|
|
145
|
+
const { secretsListCommand } = await import("./commands/index.js");
|
|
146
|
+
const success = await secretsListCommand({ endpoint: options.endpoint });
|
|
147
|
+
process.exit(success ? 0 : 1);
|
|
148
|
+
});
|
|
149
|
+
program.command("status").argument("<run-id>", "Run ID to inspect").description("Show status and details of a test run").option("--logs", "Stream full log replay", false).option("--job <name>", "Filter logs to specific job").option("--json", "Output raw JSON", false).action(async (runId, options) => {
|
|
150
|
+
const { statusCommand } = await import("./commands/index.js");
|
|
151
|
+
const success = await statusCommand(runId, {
|
|
152
|
+
logs: options.logs,
|
|
153
|
+
job: options.job,
|
|
154
|
+
json: options.json
|
|
155
|
+
});
|
|
156
|
+
process.exit(success ? 0 : 1);
|
|
157
|
+
});
|
|
158
|
+
program.command("cancel").argument("[run-id]", "Run ID to cancel").description("Cancel a running workflow or all runs on a branch").option("--force", "Force cancel (kill immediately, skip hooks)", false).option("--branch <name>", "Cancel all in-progress runs on this branch").action(async (runId, options) => {
|
|
159
|
+
const { cancelCommand } = await import("./commands/index.js");
|
|
160
|
+
const success = await cancelCommand(runId, {
|
|
161
|
+
force: options.force,
|
|
162
|
+
branch: options.branch
|
|
163
|
+
});
|
|
164
|
+
process.exit(success ? 0 : 1);
|
|
165
|
+
});
|
|
166
|
+
program.command("approve").argument("<run-id>", "Run ID whose approval gate to approve").description("Approve a held approval gate for a run").option("--job <name>", "Approve the hold for a specific job").option("--step <index>", "Approve a step-scoped hold (requires --job)").action(async (runId, options) => {
|
|
167
|
+
const { approveCommand } = await import("./commands/index.js");
|
|
168
|
+
const success = await approveCommand(runId, {
|
|
169
|
+
job: options.job,
|
|
170
|
+
step: options.step
|
|
171
|
+
});
|
|
172
|
+
process.exit(success ? 0 : 1);
|
|
173
|
+
});
|
|
174
|
+
program.command("reject").argument("<run-id>", "Run ID whose approval gate to reject").description("Reject a held approval gate for a run").option("--job <name>", "Reject the hold for a specific job").option("--step <index>", "Reject a step-scoped hold (requires --job)").requiredOption("--reason <text>", "Reason for the rejection").action(async (runId, options) => {
|
|
175
|
+
const { rejectCommand } = await import("./commands/index.js");
|
|
176
|
+
const success = await rejectCommand(runId, {
|
|
177
|
+
job: options.job,
|
|
178
|
+
step: options.step,
|
|
179
|
+
reason: options.reason
|
|
180
|
+
});
|
|
181
|
+
process.exit(success ? 0 : 1);
|
|
182
|
+
});
|
|
183
|
+
program.command("types").description("Generate TypeScript declarations for secret contexts").option("--kici-dir <path>", "Path to .kici directory", ".kici").option("--endpoint <url>", "Orchestrator URL override").action(async (options) => {
|
|
184
|
+
const { typesCommand } = await import("./commands/index.js");
|
|
185
|
+
const success = await typesCommand({
|
|
186
|
+
kiciDir: options.kiciDir,
|
|
187
|
+
endpoint: options.endpoint
|
|
188
|
+
});
|
|
189
|
+
process.exit(success ? 0 : 1);
|
|
190
|
+
});
|
|
191
|
+
program.command("endpoints").description("List all webhook entrypoints for the current project").option("--kici-dir <path>", "Path to .kici directory", ".kici").action(async (options) => {
|
|
192
|
+
const { endpointsCommand } = await import("./commands/index.js");
|
|
193
|
+
const success = await endpointsCommand({ kiciDir: options.kiciDir });
|
|
194
|
+
process.exit(success ? 0 : 1);
|
|
195
|
+
});
|
|
196
|
+
program.command("workflows").description("Manage workflow registrations").command("list").description("List permanently registered workflows").option("--json", "Output as JSON", false).option("--stale <duration>", "Filter stale registrations (e.g., 30d, 7d)").option("--trigger-type <type>", "Filter by trigger type").option("--repo <repo>", "Filter by repository").action(async (options) => {
|
|
197
|
+
const { workflowsListCommand } = await import("./commands/index.js");
|
|
198
|
+
const success = await workflowsListCommand({
|
|
199
|
+
json: options.json,
|
|
200
|
+
stale: options.stale,
|
|
201
|
+
triggerType: options.triggerType,
|
|
202
|
+
repo: options.repo
|
|
203
|
+
});
|
|
204
|
+
process.exit(success ? 0 : 1);
|
|
205
|
+
});
|
|
206
|
+
program.command("docs").description("Open the KiCI documentation site in the default browser").option("--no-open", "Print the docs URL instead of opening a browser").action(async (options) => {
|
|
207
|
+
const { docsCommand } = await import("./commands/index.js");
|
|
208
|
+
const success = await docsCommand({ open: options.open });
|
|
209
|
+
process.exit(success ? 0 : 1);
|
|
210
|
+
}).command("llm").description("Print the bundled LLM context (llms-full.txt) to stdout").option("--index", "Print the curated llms.txt index instead of the full bundle", false).option("--out <path>", "Write the bundle to a file instead of stdout").action(async (options) => {
|
|
211
|
+
const { docsLlmCommand } = await import("./commands/index.js");
|
|
212
|
+
const success = await docsLlmCommand({
|
|
213
|
+
index: options.index,
|
|
214
|
+
out: options.out
|
|
215
|
+
});
|
|
216
|
+
process.exit(success ? 0 : 1);
|
|
217
|
+
});
|
|
218
|
+
program.command("admin").description("Operator-facing commands for running instances").command("drain-worker").description("Trigger graceful drain on a worker instance").requiredOption("--url <url>", "Worker URL (e.g., http://worker-host:<port>)").action(async (options) => {
|
|
219
|
+
const { drainWorkerCommand } = await import("./commands/index.js");
|
|
220
|
+
const success = await drainWorkerCommand({ url: options.url });
|
|
221
|
+
process.exit(success ? 0 : 1);
|
|
222
|
+
});
|
|
223
|
+
return program;
|
|
224
|
+
}
|
|
225
|
+
/** Build the program and parse argv — the bin-shim entry point. */
|
|
226
|
+
function runCli(argv = process.argv) {
|
|
227
|
+
buildProgram().parse(argv);
|
|
228
|
+
}
|
|
229
|
+
if (resolve(process.argv[1] ?? "") === fileURLToPath(import.meta.url)) runCli();
|
|
199
230
|
//#endregion
|
|
200
|
-
export {};
|
|
231
|
+
export { buildProgram, runCli };
|
|
201
232
|
|
|
202
233
|
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kici approve command
|
|
3
|
+
*
|
|
4
|
+
* Approves a held approval gate for a run. Resolves the held element by
|
|
5
|
+
* `--job` / `--step` (or the sole pending hold), then records the approval via
|
|
6
|
+
* the Platform dashboard API (PAT auth).
|
|
7
|
+
*/
|
|
8
|
+
/** Options for the approve command. */
|
|
9
|
+
export interface ApproveOptions {
|
|
10
|
+
/** Match a hold by its job name. */
|
|
11
|
+
job?: string;
|
|
12
|
+
/** Match a step-scoped hold by its step index. */
|
|
13
|
+
step?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Approve a held approval gate.
|
|
17
|
+
*
|
|
18
|
+
* @param runId - The run whose hold to approve.
|
|
19
|
+
* @param options - Job/step filters to disambiguate the held element.
|
|
20
|
+
* @returns true on success, false on error.
|
|
21
|
+
*/
|
|
22
|
+
export declare function approveCommand(runId: string, options?: ApproveOptions): Promise<boolean>;
|
|
23
|
+
//# sourceMappingURL=approve.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import "../chunk-gOLHoazu.js";
|
|
2
|
+
import { listHeldRunsForRun, postApprove, resolveHeldRunContext } from "./held-run-client.js";
|
|
3
|
+
import { resolveHeldRunId } from "./held-run-resolve.js";
|
|
4
|
+
import pc from "picocolors";
|
|
5
|
+
import { logger, toErrorMessage } from "@kici-dev/core";
|
|
6
|
+
//#region src/commands/approve.ts
|
|
7
|
+
/**
|
|
8
|
+
* kici approve command
|
|
9
|
+
*
|
|
10
|
+
* Approves a held approval gate for a run. Resolves the held element by
|
|
11
|
+
* `--job` / `--step` (or the sole pending hold), then records the approval via
|
|
12
|
+
* the Platform dashboard API (PAT auth).
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Approve a held approval gate.
|
|
16
|
+
*
|
|
17
|
+
* @param runId - The run whose hold to approve.
|
|
18
|
+
* @param options - Job/step filters to disambiguate the held element.
|
|
19
|
+
* @returns true on success, false on error.
|
|
20
|
+
*/
|
|
21
|
+
async function approveCommand(runId, options = {}) {
|
|
22
|
+
try {
|
|
23
|
+
const ctx = await resolveHeldRunContext();
|
|
24
|
+
if (!ctx) return false;
|
|
25
|
+
const resolution = resolveHeldRunId(await listHeldRunsForRun(ctx, runId), {
|
|
26
|
+
job: options.job,
|
|
27
|
+
step: options.step
|
|
28
|
+
});
|
|
29
|
+
if (!resolution.ok) {
|
|
30
|
+
logger.error(pc.red(resolution.error));
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
logger.info(`Approving held run ${pc.cyan(resolution.heldRunId)} for run ${pc.cyan(runId)}...`);
|
|
34
|
+
if (!await postApprove(ctx, resolution.heldRunId)) return false;
|
|
35
|
+
logger.info(pc.green("Approval recorded."));
|
|
36
|
+
logger.info(pc.dim("If the requirement still has unsatisfied clauses, the run stays held until they are."));
|
|
37
|
+
return true;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
logger.error(pc.red(`Error: ${toErrorMessage(error)}`));
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { approveCommand };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=approve.js.map
|
package/dist/commands/compile.js
CHANGED
|
@@ -7,10 +7,10 @@ import { validateConfig } from "../validation/validator.js";
|
|
|
7
7
|
import "../validation/index.js";
|
|
8
8
|
import { computeLockfileHash, detectGitRoot, generateLockFile, serializeLockFile } from "../lockfile/generator.js";
|
|
9
9
|
import "../lockfile/index.js";
|
|
10
|
+
import path from "node:path";
|
|
10
11
|
import pc from "picocolors";
|
|
11
12
|
import { existsSync } from "node:fs";
|
|
12
13
|
import fs from "node:fs/promises";
|
|
13
|
-
import path from "node:path";
|
|
14
14
|
import { logger, toErrorMessage } from "@kici-dev/core";
|
|
15
15
|
import { execSync } from "node:child_process";
|
|
16
16
|
//#region src/commands/compile.ts
|
package/dist/commands/docs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../chunk-gOLHoazu.js";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import path from "node:path";
|
|
2
4
|
import pc from "picocolors";
|
|
3
5
|
import { readFile, writeFile } from "node:fs/promises";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { logger, toErrorMessage } from "@kici-dev/core";
|
|
7
7
|
import open from "open";
|
|
8
8
|
//#region src/commands/docs.ts
|
|
@@ -2,9 +2,9 @@ import "../chunk-gOLHoazu.js";
|
|
|
2
2
|
import { resolveKiciDir } from "../execution/executor.js";
|
|
3
3
|
import "../execution/index.js";
|
|
4
4
|
import { loadGlobalConfig } from "../remote/config.js";
|
|
5
|
+
import path from "node:path";
|
|
5
6
|
import pc from "picocolors";
|
|
6
7
|
import { readFile } from "node:fs/promises";
|
|
7
|
-
import path from "node:path";
|
|
8
8
|
import { logger, toErrorMessage } from "@kici-dev/core";
|
|
9
9
|
//#region src/commands/endpoints.ts
|
|
10
10
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared HTTP plumbing for the `kici approve` / `kici reject` held-run
|
|
3
|
+
* commands. Resolves auth + endpoint from the global config (PAT preferred,
|
|
4
|
+
* API key fallback; Platform endpoint preferred, orchestrator fallback) and
|
|
5
|
+
* exposes thin list / approve / reject helpers against the Platform dashboard
|
|
6
|
+
* API.
|
|
7
|
+
*/
|
|
8
|
+
import type { HeldRunSummary } from './held-run-resolve.js';
|
|
9
|
+
/** Resolved auth context for a held-run command. */
|
|
10
|
+
export interface HeldRunContext {
|
|
11
|
+
endpoint: string;
|
|
12
|
+
token: string;
|
|
13
|
+
orgId: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the auth context, printing a clear error and returning null when the
|
|
17
|
+
* CLI is not authenticated / no active org is set.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveHeldRunContext(): Promise<HeldRunContext | null>;
|
|
20
|
+
/** List the held runs for a single run id. */
|
|
21
|
+
export declare function listHeldRunsForRun(ctx: HeldRunContext, runId: string): Promise<HeldRunSummary[]>;
|
|
22
|
+
/** POST an approve decision for a held run. Returns true on success. */
|
|
23
|
+
export declare function postApprove(ctx: HeldRunContext, heldRunId: string): Promise<boolean>;
|
|
24
|
+
/** POST a reject decision (with reason) for a held run. Returns true on success. */
|
|
25
|
+
export declare function postReject(ctx: HeldRunContext, heldRunId: string, reason: string): Promise<boolean>;
|
|
26
|
+
//# sourceMappingURL=held-run-client.d.ts.map
|