@kici-dev/compiler 0.1.23 → 0.1.25
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/auth/headless-detect.js +1 -1
- package/dist/cli-banner.js +1 -1
- package/dist/cli.d.ts +18 -0
- package/dist/cli.js +71 -10
- package/dist/commands/approve.js +2 -2
- package/dist/commands/check-mode.js +1 -1
- package/dist/commands/compile.js +1 -1
- package/dist/commands/diagnostics.js +1 -1
- package/dist/commands/docs.js +1 -1
- package/dist/commands/drain-worker.js +1 -1
- package/dist/commands/endpoints.js +1 -1
- package/dist/commands/fixture.js +2 -2
- package/dist/commands/held-run-client.d.ts +1 -1
- package/dist/commands/held-run-client.js +1 -1
- package/dist/commands/hook.js +1 -1
- package/dist/commands/index.d.ts +5 -3
- package/dist/commands/index.js +5 -4
- package/dist/commands/init.js +3 -3
- package/dist/commands/login.js +1 -1
- package/dist/commands/logout.js +1 -1
- package/dist/commands/orchestrators.js +1 -1
- package/dist/commands/org.js +1 -1
- package/dist/commands/pat.d.ts +27 -0
- package/dist/commands/pat.js +76 -0
- package/dist/commands/preview.d.ts +88 -0
- package/dist/commands/{test.js → preview.js} +16 -15
- package/dist/commands/reject.js +2 -2
- package/dist/commands/run-hold-watch.d.ts +10 -1
- package/dist/commands/run-hold-watch.js +13 -12
- package/dist/commands/run.d.ts +20 -1
- package/dist/commands/run.js +62 -12
- package/dist/commands/runs/cancel.js +1 -1
- package/dist/commands/runs/list.js +1 -1
- package/dist/commands/runs/logs.js +1 -1
- package/dist/commands/runs/rerun.js +1 -1
- package/dist/commands/runs/show.js +1 -1
- package/dist/commands/secrets-list.js +1 -1
- package/dist/commands/types.js +1 -1
- package/dist/commands/verify-attestation.d.ts +4 -1
- package/dist/commands/verify-attestation.js +34 -12
- package/dist/commands/watch.js +1 -1
- package/dist/commands/workflows.js +1 -1
- package/dist/errors/capability-gap.js +1 -1
- package/dist/errors/formatter.js +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/execution/executor.d.ts +5 -6
- package/dist/execution/executor.js +6 -7
- package/dist/execution/index.js +1 -1
- package/dist/execution/sdk-alias.d.ts +4 -14
- package/dist/execution/sdk-alias.js +6 -45
- package/dist/execution/ts-loader.js +1 -1
- package/dist/fixtures/compiler.js +1 -1
- package/dist/fixtures/defaults/index.js +1 -1
- package/dist/fixtures/describe-event.d.ts +0 -4
- package/dist/fixtures/describe-event.js +35 -5
- package/dist/fixtures/picker.js +1 -1
- package/dist/format.js +1 -1
- package/dist/generators/secrets-dts.js +3 -1
- package/dist/hooks/detector.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/installer.js +1 -1
- package/dist/hooks/templates.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/llm-context/llms-architecture.txt +4 -4
- package/dist/llm-context/llms-cli.txt +346 -33
- package/dist/llm-context/llms-features.txt +128 -21
- package/dist/llm-context/llms-full.txt +610 -71
- package/dist/llm-context/llms-getting-started.txt +7 -7
- package/dist/llm-context/llms-sdk.txt +125 -6
- package/dist/llm-context/llms.txt +7 -5
- package/dist/local-executor/dag-scheduler.js +1 -1
- package/dist/local-executor/index.js +3 -2
- package/dist/local-executor/job-runner.js +4 -4
- package/dist/local-executor/materializer.js +1 -1
- package/dist/local-executor/output-streamer.js +1 -1
- package/dist/local-executor/payload-generator.js +1 -1
- package/dist/local-executor/picker.js +1 -1
- package/dist/local-executor/runs-on-display.js +1 -1
- package/dist/local-executor/secret-loader.js +1 -1
- package/dist/local-executor/to-event-payload.js +1 -1
- package/dist/local-executor/types.js +1 -1
- package/dist/local-executor/workflow-lock.js +0 -0
- package/dist/lockfile/generator.d.ts +10 -2
- package/dist/lockfile/generator.js +107 -53
- package/dist/lockfile/hash-files.js +1 -1
- package/dist/lockfile/hasher.js +1 -1
- package/dist/lockfile/index.js +1 -1
- package/dist/lockfile/purity-analyzer.js +3 -3
- package/dist/postinstall.js +1 -1
- package/dist/provenance-trust-root.js +1 -1
- package/dist/remote/config.js +1 -1
- package/dist/remote/dashboard-client.js +1 -1
- package/dist/remote/encryption.js +1 -1
- package/dist/remote/history.d.ts +1 -1
- package/dist/remote/history.js +2 -2
- package/dist/remote/local-repo-identity.d.ts +32 -0
- package/dist/remote/local-repo-identity.js +74 -0
- package/dist/remote/oauth.js +1 -1
- package/dist/remote/oidc-discovery.js +1 -1
- package/dist/remote/output/json.js +1 -1
- package/dist/remote/output/junit.js +1 -1
- package/dist/remote/output/streaming.js +1 -1
- package/dist/remote/output/summary.js +1 -1
- package/dist/remote/platform-client.d.ts +2 -0
- package/dist/remote/platform-client.js +1 -1
- package/dist/remote/prod-defaults.d.ts +9 -1
- package/dist/remote/prod-defaults.js +11 -3
- package/dist/remote/render.js +1 -1
- package/dist/remote/secret-upload.js +1 -1
- package/dist/remote/uploader.js +4 -4
- package/dist/{chunk-BTugEXQM.js → rolldown-runtime-ClRpJifh.js} +0 -1
- package/dist/templates/agents-md.d.ts +1 -1
- package/dist/templates/agents-md.js +3 -3
- package/dist/templates/index.js +1 -1
- package/dist/templates/package-json.js +2 -2
- package/dist/templates/tsconfig-json.js +1 -1
- package/dist/templates/workflows/hello-world.js +1 -1
- package/dist/templates/workflows/pr-checks.js +1 -1
- package/dist/test-runner/dry-run.js +1 -1
- package/dist/test-runner/event-types.js +1 -1
- package/dist/test-runner/git-detector.js +1 -1
- package/dist/test-runner/index.js +1 -1
- package/dist/test-runner/job-executor.js +1 -1
- package/dist/test-runner/output-formatter.js +1 -1
- package/dist/test-runner/payload-builder.js +1 -1
- package/dist/test-runner/rule-evaluator.js +1 -1
- package/dist/test-runner/secrets-file.js +1 -1
- package/dist/test-runner/step-context.d.ts +1 -1
- package/dist/test-runner/step-context.js +3 -2
- package/dist/types.d.ts +33 -6
- package/dist/types.js +6 -2
- package/dist/validation/index.js +1 -1
- package/dist/validation/validator.js +1 -1
- package/package.json +4 -7
- package/sbom.spdx.json +35 -35
- package/dist/commands/held-run-resolve.js +0 -53
package/dist/cli-banner.js
CHANGED
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
+
/**
|
|
4
|
+
* Top-level commands that were removed, mapped to their current equivalent.
|
|
5
|
+
* Consulted when the CLI hits an unknown command so the user gets a precise
|
|
6
|
+
* redirect instead of a bare "unknown command" dead end. The redirect text
|
|
7
|
+
* lives here once; every consumer reads it from this map.
|
|
8
|
+
*/
|
|
9
|
+
export declare const RETIRED_COMMANDS: Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Redirect message for a retired top-level command, or undefined if the name is
|
|
12
|
+
* not a known-retired command.
|
|
13
|
+
*/
|
|
14
|
+
export declare function retiredCommandHint(commandName: string | undefined): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Derive the command name a user attempted from the parsed operands, falling
|
|
17
|
+
* back to the first non-option token in the raw argv. Used to look up a retired
|
|
18
|
+
* command after commander rejects an unknown command.
|
|
19
|
+
*/
|
|
20
|
+
export declare function attemptedCommand(program: Command, argv: string[]): string | undefined;
|
|
3
21
|
/**
|
|
4
22
|
* Build the kici Commander program with every command registered. Exported so
|
|
5
23
|
* the surface registry can walk the real command tree without parsing argv (no
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./
|
|
2
|
+
import "./rolldown-runtime-ClRpJifh.js";
|
|
3
3
|
import { shouldSuppressBanner } from "./cli-banner.js";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { resolve } from "node:path";
|
|
@@ -7,7 +7,34 @@ import { realpathSync } from "node:fs";
|
|
|
7
7
|
import { Argument, Command, Option } from "commander";
|
|
8
8
|
import pc from "picocolors";
|
|
9
9
|
//#region src/cli.ts
|
|
10
|
-
const version = "0.1.
|
|
10
|
+
const version = "0.1.25";
|
|
11
|
+
/**
|
|
12
|
+
* Top-level commands that were removed, mapped to their current equivalent.
|
|
13
|
+
* Consulted when the CLI hits an unknown command so the user gets a precise
|
|
14
|
+
* redirect instead of a bare "unknown command" dead end. The redirect text
|
|
15
|
+
* lives here once; every consumer reads it from this map.
|
|
16
|
+
*/
|
|
17
|
+
const RETIRED_COMMANDS = {
|
|
18
|
+
status: "`kici status` is no longer a command. Use `kici runs list` / `kici runs show <run-id>` to inspect runs, or `kici diagnostics` for orchestrator, scaler, and agent health.",
|
|
19
|
+
cancel: "`kici cancel` is no longer a command. Use `kici runs cancel <run-id>`."
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Redirect message for a retired top-level command, or undefined if the name is
|
|
23
|
+
* not a known-retired command.
|
|
24
|
+
*/
|
|
25
|
+
function retiredCommandHint(commandName) {
|
|
26
|
+
return commandName ? RETIRED_COMMANDS[commandName] : void 0;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Derive the command name a user attempted from the parsed operands, falling
|
|
30
|
+
* back to the first non-option token in the raw argv. Used to look up a retired
|
|
31
|
+
* command after commander rejects an unknown command.
|
|
32
|
+
*/
|
|
33
|
+
function attemptedCommand(program, argv) {
|
|
34
|
+
const firstOperand = program.args[0];
|
|
35
|
+
if (firstOperand) return firstOperand;
|
|
36
|
+
return argv.slice(2).find((token) => !token.startsWith("-"));
|
|
37
|
+
}
|
|
11
38
|
/**
|
|
12
39
|
* Build the kici Commander program with every command registered. Exported so
|
|
13
40
|
* the surface registry can walk the real command tree without parsing argv (no
|
|
@@ -23,6 +50,8 @@ function buildProgram() {
|
|
|
23
50
|
program.configureOutput({ outputError: (str, write) => {
|
|
24
51
|
write(pc.red(str));
|
|
25
52
|
} });
|
|
53
|
+
program.showSuggestionAfterError(true);
|
|
54
|
+
program.showHelpAfterError("(run `kici --help` to see all commands)");
|
|
26
55
|
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) => {
|
|
27
56
|
const { compileCommand, watchCommand } = await import("./commands/index.js");
|
|
28
57
|
if (options.watch) await watchCommand({
|
|
@@ -50,7 +79,8 @@ function buildProgram() {
|
|
|
50
79
|
process.exit(2);
|
|
51
80
|
}
|
|
52
81
|
if (!options.pick && !event) {
|
|
53
|
-
|
|
82
|
+
const { printRunLocalUsage } = await import("./commands/index.js");
|
|
83
|
+
printRunLocalUsage();
|
|
54
84
|
process.exit(2);
|
|
55
85
|
}
|
|
56
86
|
const { runLocalCommand } = await import("./commands/index.js");
|
|
@@ -90,7 +120,7 @@ function buildProgram() {
|
|
|
90
120
|
});
|
|
91
121
|
process.exit(success ? 0 : 1);
|
|
92
122
|
});
|
|
93
|
-
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("-p, --pick", "Interactively pick fixtures to run", 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("--org <id>", "Target organization (overrides the active org)").option("--orchestrator <name>", "Target orchestrator cluster (overrides the per-org default)").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], []).option("--check", "Run in check mode: report drift, change nothing", false).option("--fail-on-drift", "In check mode, exit non-zero if any step reports drift", false).option("--target <selector>", "Narrow runsOnAll jobs to hosts matching this label selector (repeatable, AND-combined)", (val, prev) => [...prev, val], []).option("--target-allow-empty", "A --target that narrows a runsOnAll job to zero hosts skips it instead of failing", false).option("--input <KEY=VALUE>", "Typed workflow-dispatch input (repeatable)", (val, prev) => [...prev, val], []).option("--approve-all
|
|
123
|
+
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("-p, --pick", "Interactively pick fixtures to run", 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("--org <id>", "Target organization (overrides the active org)").option("--orchestrator <name>", "Target orchestrator cluster (overrides the per-org default)").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], []).option("--check", "Run in check mode: report drift, change nothing", false).option("--fail-on-drift", "In check mode, exit non-zero if any step reports drift", false).option("--target <selector>", "Narrow runsOnAll jobs to hosts matching this label selector (repeatable, AND-combined)", (val, prev) => [...prev, val], []).option("--target-allow-empty", "A --target that narrows a runsOnAll job to zero hosts skips it instead of failing", false).option("--input <KEY=VALUE>", "Typed workflow-dispatch input (repeatable)", (val, prev) => [...prev, val], []).option("--yes, --approve-all", "Auto-approve every approval gate this run holds on (run-scoped; eligibility still enforced)", false).action(async (fixture, options) => {
|
|
94
124
|
if (options.pick && fixture) {
|
|
95
125
|
console.error("Error: --pick selects fixtures interactively; do not also pass a fixture name.");
|
|
96
126
|
process.exit(2);
|
|
@@ -126,9 +156,9 @@ function buildProgram() {
|
|
|
126
156
|
});
|
|
127
157
|
process.exit(success ? 0 : 1);
|
|
128
158
|
});
|
|
129
|
-
program.command("
|
|
130
|
-
const {
|
|
131
|
-
const success = await
|
|
159
|
+
program.command("preview").argument("[event]", "Event type to preview (e.g., push, pr:open, schedule)").description("Preview which workflows match a trigger event (no execution)").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) => {
|
|
160
|
+
const { previewCommand } = await import("./commands/index.js");
|
|
161
|
+
const success = await previewCommand(event, options);
|
|
132
162
|
process.exit(success ? 0 : 1);
|
|
133
163
|
});
|
|
134
164
|
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) => {
|
|
@@ -199,6 +229,16 @@ Environment variables:
|
|
|
199
229
|
const success = await secretsListCommand();
|
|
200
230
|
process.exit(success ? 0 : 1);
|
|
201
231
|
});
|
|
232
|
+
program.command("pat").description("Manage personal access tokens").command("create").description("Mint a personal access token (use --agent for a coding-agent token)").option("--name <name>", "Token name (defaults to the agent label)").option("--agent", "Mint an agent-kind PAT for the KiCI MCP server", false).option("--expires-in-days <n>", "Custom expiry in days", (v) => parseInt(v, 10)).action(async (options) => {
|
|
233
|
+
const { patCreateCommand } = await import("./commands/index.js");
|
|
234
|
+
const success = await patCreateCommand({
|
|
235
|
+
name: options.name,
|
|
236
|
+
agent: options.agent,
|
|
237
|
+
label: options.name,
|
|
238
|
+
expiresInDays: options.expiresInDays
|
|
239
|
+
});
|
|
240
|
+
process.exit(success ? 0 : 1);
|
|
241
|
+
});
|
|
202
242
|
const runsCommand = program.command("runs").description("Inspect and manage execution runs");
|
|
203
243
|
runsCommand.command("list").description("List execution runs (mirrors the dashboard Runs page)").option("--status <s>", "Filter by status").option("--workflow <w>", "Filter by workflow name").option("--branch <b>", "Filter by branch/ref").option("--repo <r>", "Filter by repository").option("--trigger <t>", "Filter by trigger type").option("--source <routingKey>", "Filter by source routing key").option("--since <ts>", "Only runs since (ISO-8601 or epoch ms)").option("--page <n>", "Page number", (v) => parseInt(v, 10)).option("--json", "Output raw JSON", false).action(async (options) => {
|
|
204
244
|
const { runsListCommand } = await import("./commands/index.js");
|
|
@@ -295,16 +335,37 @@ Environment variables:
|
|
|
295
335
|
const success = await drainWorkerCommand({ url: options.url });
|
|
296
336
|
process.exit(success ? 0 : 1);
|
|
297
337
|
});
|
|
298
|
-
program.command("verify-attestation").argument("[artifact]", "Artifact path to digest-check against the attestation subject (optional)").description("Verify a KiCI provenance attestation bundle offline").option("--bundle <path>", "Path or URL to the attestation bundle JSON").option("--trust-root <url-or-file>", "Trusted issuer URL, or a self-contained { issuer, jwks } file").option("--audience <aud>", "Expected token audience").option("--json", "Output structured JSON result", false).action(async (artifact, options) => {
|
|
338
|
+
program.command("verify-attestation").argument("[artifact]", "Artifact path to digest-check against the attestation subject (optional)").description("Verify a KiCI provenance attestation bundle offline").option("--bundle <path>", "Path or URL to the attestation bundle JSON").option("--trust-root <url-or-file>", "Trusted issuer URL, or a self-contained { issuer, jwks } file (default: hosted KiCI platform)").option("--audience <aud>", "Expected token audience").option("--json", "Output structured JSON result", false).action(async (artifact, options) => {
|
|
299
339
|
const { verifyAttestationCommand } = await import("./commands/index.js");
|
|
300
340
|
const success = await verifyAttestationCommand(artifact, options);
|
|
301
341
|
process.exit(success ? 0 : 1);
|
|
302
342
|
});
|
|
303
343
|
return program;
|
|
304
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* Handle a commander parse exit thrown under `exitOverride`. Help and version
|
|
347
|
+
* requests exit cleanly; an unknown command is augmented with a retired-command
|
|
348
|
+
* redirect when one applies (commander already wrote the generic error,
|
|
349
|
+
* suggestion, and help pointer before throwing); every other parse error keeps
|
|
350
|
+
* commander's own exit code and already-printed message.
|
|
351
|
+
*/
|
|
352
|
+
function handleCliParseExit(err, argv, program) {
|
|
353
|
+
if (err.code === "commander.helpDisplayed" || err.code === "commander.version") process.exit(0);
|
|
354
|
+
if (err.code === "commander.unknownCommand") {
|
|
355
|
+
const hint = retiredCommandHint(attemptedCommand(program, argv));
|
|
356
|
+
if (hint) process.stderr.write(pc.red(`${hint}\n`));
|
|
357
|
+
}
|
|
358
|
+
process.exit(err.exitCode ?? 1);
|
|
359
|
+
}
|
|
305
360
|
/** Build the program and parse argv — the bin-shim entry point. */
|
|
306
361
|
function runCli(argv = process.argv) {
|
|
307
|
-
buildProgram()
|
|
362
|
+
const program = buildProgram();
|
|
363
|
+
program.exitOverride();
|
|
364
|
+
try {
|
|
365
|
+
program.parse(argv);
|
|
366
|
+
} catch (err) {
|
|
367
|
+
handleCliParseExit(err, argv, program);
|
|
368
|
+
}
|
|
308
369
|
}
|
|
309
370
|
/**
|
|
310
371
|
* Decide whether this module is the process entry point, tolerating a
|
|
@@ -330,6 +391,6 @@ function isMainEntryPoint(argv1, importMetaUrl) {
|
|
|
330
391
|
}
|
|
331
392
|
if (isMainEntryPoint(process.argv[1], import.meta.url)) runCli();
|
|
332
393
|
//#endregion
|
|
333
|
-
export { buildProgram, isMainEntryPoint, runCli };
|
|
394
|
+
export { RETIRED_COMMANDS, attemptedCommand, buildProgram, isMainEntryPoint, retiredCommandHint, runCli };
|
|
334
395
|
|
|
335
396
|
//# sourceMappingURL=cli.js.map
|
package/dist/commands/approve.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../
|
|
1
|
+
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
import { listHeldRunsForRun, postApprove, resolveHeldRunContext } from "./held-run-client.js";
|
|
3
|
-
import { resolveHeldRunId } from "./held-run-resolve.js";
|
|
4
3
|
import pc from "picocolors";
|
|
5
4
|
import { logger, toErrorMessage } from "@kici-dev/core";
|
|
5
|
+
import { resolveHeldRunId } from "@kici-dev/engine";
|
|
6
6
|
//#region src/commands/approve.ts
|
|
7
7
|
/**
|
|
8
8
|
* kici approve command
|
package/dist/commands/compile.js
CHANGED
package/dist/commands/docs.js
CHANGED
package/dist/commands/fixture.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../
|
|
1
|
+
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
import { parseEventArg } from "../test-runner/event-types.js";
|
|
3
3
|
import { detectRepoFromGit } from "../test-runner/git-detector.js";
|
|
4
4
|
import { getDefaultFixture } from "../fixtures/defaults/index.js";
|
|
@@ -13,7 +13,7 @@ import { logger } from "@kici-dev/core";
|
|
|
13
13
|
* including internal events (schedule, lifecycle, generic_webhook, kici_event).
|
|
14
14
|
*/
|
|
15
15
|
/** Internal event types that don't have GitHub webhook fixture files */
|
|
16
|
-
const INTERNAL_EVENT_TYPES = new Set([
|
|
16
|
+
const INTERNAL_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
17
17
|
"kici_event",
|
|
18
18
|
"workflow_complete",
|
|
19
19
|
"job_complete",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* exposes thin list / approve / reject helpers against the Platform dashboard
|
|
6
6
|
* API.
|
|
7
7
|
*/
|
|
8
|
-
import type { HeldRunSummary } from '
|
|
8
|
+
import type { HeldRunSummary } from '@kici-dev/engine';
|
|
9
9
|
/** Resolved auth context for a held-run command. */
|
|
10
10
|
export interface HeldRunContext {
|
|
11
11
|
endpoint: string;
|
package/dist/commands/hook.js
CHANGED
package/dist/commands/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export type { CompileOptions } from './compile.js';
|
|
|
3
3
|
export { watchCommand } from './watch.js';
|
|
4
4
|
export { fixtureCommand } from './fixture.js';
|
|
5
5
|
export type { FixtureOptions } from './fixture.js';
|
|
6
|
-
export {
|
|
7
|
-
export type {
|
|
8
|
-
export { runLocalCommand, runRemoteCommand } from './run.js';
|
|
6
|
+
export { previewCommand, previewEvent } from './preview.js';
|
|
7
|
+
export type { PreviewOptions, RemoteRunOptions, RemoteRunResult } from './preview.js';
|
|
8
|
+
export { runLocalCommand, runRemoteCommand, printRunLocalUsage } from './run.js';
|
|
9
9
|
export { initCommand } from './init.js';
|
|
10
10
|
export type { InitOptions } from './init.js';
|
|
11
11
|
export { hookInstallCommand } from './hook.js';
|
|
@@ -14,6 +14,8 @@ export { loginCommand } from './login.js';
|
|
|
14
14
|
export type { LoginOptions } from './login.js';
|
|
15
15
|
export { secretsListCommand } from './secrets-list.js';
|
|
16
16
|
export type { SecretsListOptions } from './secrets-list.js';
|
|
17
|
+
export { patCreateCommand } from './pat.js';
|
|
18
|
+
export type { PatCreateOptions } from './pat.js';
|
|
17
19
|
export { runsListCommand } from './runs/list.js';
|
|
18
20
|
export type { RunsListOptions } from './runs/list.js';
|
|
19
21
|
export { runsShowCommand } from './runs/show.js';
|
package/dist/commands/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../
|
|
1
|
+
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
import { compileCommand } from "./compile.js";
|
|
3
3
|
import { approveCommand } from "./approve.js";
|
|
4
4
|
import { diagnosticsCommand } from "./diagnostics.js";
|
|
@@ -8,11 +8,12 @@ import { endpointsCommand } from "./endpoints.js";
|
|
|
8
8
|
import { fixtureCommand } from "./fixture.js";
|
|
9
9
|
import { hookInstallCommand } from "./hook.js";
|
|
10
10
|
import { watchCommand } from "./watch.js";
|
|
11
|
-
import {
|
|
12
|
-
import { runLocalCommand, runRemoteCommand } from "./run.js";
|
|
11
|
+
import { previewCommand, previewEvent } from "./preview.js";
|
|
12
|
+
import { printRunLocalUsage, runLocalCommand, runRemoteCommand } from "./run.js";
|
|
13
13
|
import { initCommand } from "./init.js";
|
|
14
14
|
import { loginCommand } from "./login.js";
|
|
15
15
|
import { secretsListCommand } from "./secrets-list.js";
|
|
16
|
+
import { patCreateCommand } from "./pat.js";
|
|
16
17
|
import { runsListCommand } from "./runs/list.js";
|
|
17
18
|
import { runsShowCommand } from "./runs/show.js";
|
|
18
19
|
import { runsLogsCommand } from "./runs/logs.js";
|
|
@@ -25,4 +26,4 @@ import { logoutCommand } from "./logout.js";
|
|
|
25
26
|
import { rejectCommand } from "./reject.js";
|
|
26
27
|
import { workflowsListCommand } from "./workflows.js";
|
|
27
28
|
import { verifyAttestationCommand } from "./verify-attestation.js";
|
|
28
|
-
export { approveCommand, compileCommand, diagnosticsCommand, docsCommand, docsLlmCommand, drainWorkerCommand, endpointsCommand, fixtureCommand, hookInstallCommand, initCommand, loginCommand, logoutCommand, orchestratorsListCommand, orchestratorsUseCommand, orgCurrentCommand, orgListCommand, orgUseCommand, rejectCommand, runLocalCommand, runRemoteCommand, runsCancelCommand, runsListCommand, runsLogsCommand, runsRerunCommand, runsShowCommand, secretsListCommand,
|
|
29
|
+
export { approveCommand, compileCommand, diagnosticsCommand, docsCommand, docsLlmCommand, drainWorkerCommand, endpointsCommand, fixtureCommand, hookInstallCommand, initCommand, loginCommand, logoutCommand, orchestratorsListCommand, orchestratorsUseCommand, orgCurrentCommand, orgListCommand, orgUseCommand, patCreateCommand, previewCommand, previewEvent, printRunLocalUsage, rejectCommand, runLocalCommand, runRemoteCommand, runsCancelCommand, runsListCommand, runsLogsCommand, runsRerunCommand, runsShowCommand, secretsListCommand, typesCommand, verifyAttestationCommand, watchCommand, workflowsListCommand };
|
package/dist/commands/init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../
|
|
1
|
+
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
import { agentsMdTemplate } from "../templates/agents-md.js";
|
|
3
3
|
import { tsconfigTemplate } from "../templates/tsconfig-json.js";
|
|
4
4
|
import { generatePackageJson } from "../templates/package-json.js";
|
|
@@ -117,10 +117,10 @@ async function initCommand(options = {}) {
|
|
|
117
117
|
logger.info(pc.gray(" 1. Edit workflows in .kici/workflows/"));
|
|
118
118
|
if (options.mjs || options.skipInstall) {
|
|
119
119
|
logger.info(pc.gray(" 2. Run your package manager install in .kici/ to generate a lockfile"));
|
|
120
|
-
logger.info(pc.gray(" 3.
|
|
120
|
+
logger.info(pc.gray(" 3. Preview matching: kici preview push"));
|
|
121
121
|
logger.info(pc.gray(" 4. Commit .kici/ to your repository\n"));
|
|
122
122
|
} else {
|
|
123
|
-
logger.info(pc.gray(" 2.
|
|
123
|
+
logger.info(pc.gray(" 2. Preview matching: kici preview push"));
|
|
124
124
|
logger.info(pc.gray(" 3. Commit .kici/ to your repository\n"));
|
|
125
125
|
}
|
|
126
126
|
return true;
|
package/dist/commands/login.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../
|
|
1
|
+
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
import { getConfigPath, loadGlobalConfig, mergeGlobalConfig, saveGlobalConfig } from "../remote/config.js";
|
|
3
3
|
import { deviceFlow, exchangeTokenForPat, pkceFlow } from "../remote/oauth.js";
|
|
4
4
|
import "../remote/prod-defaults.js";
|
package/dist/commands/logout.js
CHANGED
package/dist/commands/org.js
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface PatCreateOptions {
|
|
2
|
+
/** Token name shown in the dashboard PAT list. Defaults to the agent label. */
|
|
3
|
+
name?: string;
|
|
4
|
+
/** Mint an agent-kind PAT (the only credential the developer MCP server accepts). */
|
|
5
|
+
agent?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Agent label (required with `--agent`) — the human-set name recorded on every
|
|
8
|
+
* audit row the agent produces. Also used as the token name when `--name` is
|
|
9
|
+
* omitted.
|
|
10
|
+
*/
|
|
11
|
+
label?: string;
|
|
12
|
+
/** Custom expiry in days (server default: 120). */
|
|
13
|
+
expiresInDays?: number;
|
|
14
|
+
/** Injected fetch for tests. Defaults to the global fetch. */
|
|
15
|
+
fetchImpl?: typeof fetch;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Mint a personal access token under the logged-in user's identity.
|
|
19
|
+
*
|
|
20
|
+
* `kici pat create --agent --name <label>` mints an agent-kind PAT: it inherits
|
|
21
|
+
* the user's permissions (provenance only, no authority change), carries its
|
|
22
|
+
* label into every audit row, and is the credential a coding agent points the
|
|
23
|
+
* KiCI developer MCP server at. The token is printed once — there is no way to
|
|
24
|
+
* retrieve it later.
|
|
25
|
+
*/
|
|
26
|
+
export declare function patCreateCommand(options?: PatCreateOptions): Promise<boolean>;
|
|
27
|
+
//# sourceMappingURL=pat.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
|
+
import { loadGlobalConfig } from "../remote/config.js";
|
|
3
|
+
import pc from "picocolors";
|
|
4
|
+
import { toErrorMessage } from "@kici-dev/core";
|
|
5
|
+
import { PatKind } from "@kici-dev/engine";
|
|
6
|
+
//#region src/commands/pat.ts
|
|
7
|
+
/**
|
|
8
|
+
* Mint a personal access token under the logged-in user's identity.
|
|
9
|
+
*
|
|
10
|
+
* `kici pat create --agent --name <label>` mints an agent-kind PAT: it inherits
|
|
11
|
+
* the user's permissions (provenance only, no authority change), carries its
|
|
12
|
+
* label into every audit row, and is the credential a coding agent points the
|
|
13
|
+
* KiCI developer MCP server at. The token is printed once — there is no way to
|
|
14
|
+
* retrieve it later.
|
|
15
|
+
*/
|
|
16
|
+
async function patCreateCommand(options = {}) {
|
|
17
|
+
const doFetch = options.fetchImpl ?? fetch;
|
|
18
|
+
try {
|
|
19
|
+
const config = await loadGlobalConfig();
|
|
20
|
+
const token = config.pat ?? config.token;
|
|
21
|
+
const endpoint = config.platformEndpoint ?? config.endpoint;
|
|
22
|
+
if (!token || !endpoint) {
|
|
23
|
+
console.error(pc.red("Not logged in. Run `kici login` first."));
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const kind = options.agent ? PatKind.enum.agent : PatKind.enum.user;
|
|
27
|
+
const label = options.label;
|
|
28
|
+
if (kind === PatKind.enum.agent && !label) {
|
|
29
|
+
console.error(pc.red("An agent PAT requires a label. Pass --name <label>."));
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const name = options.name ?? label;
|
|
33
|
+
if (!name) {
|
|
34
|
+
console.error(pc.red("A token name is required. Pass --name <name>."));
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const body = {
|
|
38
|
+
name,
|
|
39
|
+
kind
|
|
40
|
+
};
|
|
41
|
+
if (kind === PatKind.enum.agent) body.agentLabel = label;
|
|
42
|
+
if (options.expiresInDays !== void 0) body.expiresInDays = options.expiresInDays;
|
|
43
|
+
const res = await doFetch(`${endpoint.replace(/\/$/, "")}/api/v1/pats`, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: {
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
Authorization: `Bearer ${token}`
|
|
48
|
+
},
|
|
49
|
+
body: JSON.stringify(body)
|
|
50
|
+
});
|
|
51
|
+
if (!res.ok) {
|
|
52
|
+
let detail;
|
|
53
|
+
try {
|
|
54
|
+
detail = (await res.json()).error;
|
|
55
|
+
} catch {}
|
|
56
|
+
console.error(pc.red(`Failed to create token (${res.status}): ${detail ?? "request failed"}`));
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const created = await res.json();
|
|
60
|
+
console.log(pc.bold(kind === PatKind.enum.agent ? "\nAgent PAT created.\n" : "\nPAT created.\n"));
|
|
61
|
+
console.log(`${pc.gray("Name: ")}${created.name}`);
|
|
62
|
+
if (kind === PatKind.enum.agent) console.log(`${pc.gray("Agent: ")}${label}`);
|
|
63
|
+
console.log(`${pc.gray("Expires:")} ${created.expiresAt}`);
|
|
64
|
+
console.log(`\n${pc.gray("Token (shown once — save it now):")}`);
|
|
65
|
+
console.log(pc.cyan(created.token));
|
|
66
|
+
if (kind === PatKind.enum.agent) console.log(pc.gray("\nPoint your coding agent at the KiCI MCP server with this token as the Bearer credential."));
|
|
67
|
+
return true;
|
|
68
|
+
} catch (err) {
|
|
69
|
+
console.error(pc.red(`Failed to create token: ${toErrorMessage(err)}`));
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { patCreateCommand };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=pat.js.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type PayloadOptions } from '../test-runner/payload-builder.js';
|
|
2
|
+
import { type CheckMode } from '@kici-dev/engine';
|
|
3
|
+
/** Options for the kici preview command (dry-run trigger preview) */
|
|
4
|
+
export interface PreviewOptions extends PayloadOptions {
|
|
5
|
+
/** Filter to specific workflow */
|
|
6
|
+
workflow?: string;
|
|
7
|
+
/** Filter to specific job */
|
|
8
|
+
job?: string;
|
|
9
|
+
/** Enable debug output */
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
/** Path to .kici directory (defaults to .kici) */
|
|
12
|
+
kiciDir?: string;
|
|
13
|
+
/** Flat secret overrides: KEY=VALUE */
|
|
14
|
+
secret?: string[];
|
|
15
|
+
/** Context secret overrides: contextName.KEY=VALUE */
|
|
16
|
+
context?: string[];
|
|
17
|
+
}
|
|
18
|
+
/** Options for the kici run remote command */
|
|
19
|
+
export interface RemoteRunOptions extends PreviewOptions {
|
|
20
|
+
/** Run all available fixtures */
|
|
21
|
+
all?: boolean;
|
|
22
|
+
/** Interactively pick fixtures to run (multi-select checkbox). */
|
|
23
|
+
pick?: boolean;
|
|
24
|
+
/** Run matching fixtures concurrently */
|
|
25
|
+
parallel?: boolean;
|
|
26
|
+
/** Fire and forget (print runIds, don't stream) */
|
|
27
|
+
wait?: boolean;
|
|
28
|
+
/** Suppress output except final result */
|
|
29
|
+
quiet?: boolean;
|
|
30
|
+
/** Output structured JSON result */
|
|
31
|
+
json?: boolean;
|
|
32
|
+
/** Output JUnit XML result */
|
|
33
|
+
junit?: string;
|
|
34
|
+
/** Override routing key for this run */
|
|
35
|
+
routingKey?: string;
|
|
36
|
+
/** Show recent run history */
|
|
37
|
+
history?: boolean;
|
|
38
|
+
/** --env KEY=VALUE flag values, uploaded as per-run secrets. */
|
|
39
|
+
envFlags?: string[];
|
|
40
|
+
/** Target organization id (overrides config.activeOrgId). */
|
|
41
|
+
org?: string;
|
|
42
|
+
/** Target orchestrator cluster name (overrides the per-org default). */
|
|
43
|
+
orchestrator?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Run mode resolved from --check / --fail-on-drift, threaded onto the dispatch
|
|
46
|
+
* payload so the orchestrator runs the agent step loop in the requested mode.
|
|
47
|
+
* Defaults to `apply`.
|
|
48
|
+
*/
|
|
49
|
+
checkMode?: CheckMode;
|
|
50
|
+
/** `--target <selector>` values (repeatable), AND-combined into host narrowing. */
|
|
51
|
+
targets?: string[];
|
|
52
|
+
/** `--target-allow-empty`: a target that zeroes a runsOnAll job skips it instead of failing. */
|
|
53
|
+
targetAllowEmpty?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* `--approve-all` (alias `--yes`): auto-approve every approval gate this run
|
|
56
|
+
* holds on (run-scoped only — the run id this invocation dispatched). The
|
|
57
|
+
* operator must still be clause-eligible per hold; an ineligible hold blocks.
|
|
58
|
+
*/
|
|
59
|
+
approveAll?: boolean;
|
|
60
|
+
/** `--input KEY=VALUE` values (repeatable): typed workflow-dispatch inputs. */
|
|
61
|
+
inputs?: string[];
|
|
62
|
+
}
|
|
63
|
+
/** Result of a single remote fixture run */
|
|
64
|
+
export interface RemoteRunResult {
|
|
65
|
+
fixtureId: string;
|
|
66
|
+
runId: string;
|
|
67
|
+
status: 'accepted' | 'rejected' | 'success' | 'failed' | 'cancelled' | 'error';
|
|
68
|
+
reason?: string;
|
|
69
|
+
observeUrl?: string;
|
|
70
|
+
durationMs?: number;
|
|
71
|
+
jobs?: Array<{
|
|
72
|
+
name: string;
|
|
73
|
+
status: string;
|
|
74
|
+
durationMs?: number;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Main preview command entry point.
|
|
79
|
+
*
|
|
80
|
+
* `kici preview <event>` is a dry-run trigger preview only — it executes nothing.
|
|
81
|
+
* If the argument looks like a fixture name (not a known event type), prints a migration message.
|
|
82
|
+
*/
|
|
83
|
+
export declare function previewCommand(event: string | undefined, options: PreviewOptions): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Local-only dry-run mode: compile workflows, match triggers, display what would execute.
|
|
86
|
+
*/
|
|
87
|
+
export declare function previewEvent(event: string, options: PreviewOptions): Promise<boolean>;
|
|
88
|
+
//# sourceMappingURL=preview.d.ts.map
|