@kici-dev/compiler 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cli.js +22 -20
  2. package/dist/commands/cancel.js +1 -1
  3. package/dist/commands/compile.js +1 -1
  4. package/dist/commands/docs.js +1 -1
  5. package/dist/commands/drain-worker.js +1 -1
  6. package/dist/commands/endpoints.js +1 -1
  7. package/dist/commands/fixture.js +3 -3
  8. package/dist/commands/hook.js +1 -1
  9. package/dist/commands/index.js +6 -6
  10. package/dist/commands/init.js +9 -7
  11. package/dist/commands/login.js +1 -1
  12. package/dist/commands/run.js +7 -7
  13. package/dist/commands/secrets-list.js +1 -1
  14. package/dist/commands/status.js +4 -4
  15. package/dist/commands/test.js +2 -2
  16. package/dist/commands/types.js +1 -1
  17. package/dist/commands/watch.js +1 -1
  18. package/dist/commands/workflows.js +3 -3
  19. package/dist/execution/executor.js +6 -3
  20. package/dist/execution/sdk-alias.js +1 -1
  21. package/dist/execution/ts-loader.d.ts +2 -0
  22. package/dist/execution/ts-loader.js +13 -0
  23. package/dist/fixtures/compiler.d.ts +7 -5
  24. package/dist/fixtures/compiler.js +10 -6
  25. package/dist/llm-context/llms-full.txt +83 -51
  26. package/dist/llm-context/llms.txt +37 -37
  27. package/dist/local-executor/index.js +2 -2
  28. package/dist/local-executor/job-runner.js +4 -1
  29. package/dist/local-executor/output-streamer.js +1 -1
  30. package/dist/local-executor/picker.js +1 -1
  31. package/dist/local-executor/workflow-lock.js +0 -0
  32. package/dist/lockfile/generator.js +3 -3
  33. package/dist/lockfile/hasher.js +1 -1
  34. package/dist/remote/client.js +1 -1
  35. package/dist/remote/encryption.d.ts +1 -1
  36. package/dist/remote/encryption.js +1 -1
  37. package/dist/remote/history.js +2 -2
  38. package/dist/remote/oauth.js +1 -1
  39. package/dist/remote/oidc-discovery.js +1 -1
  40. package/dist/remote/output/streaming.js +1 -1
  41. package/dist/remote/output/summary.js +1 -1
  42. package/dist/remote/uploader.js +1 -1
  43. package/dist/templates/index.js +1 -1
  44. package/dist/templates/package-json.js +1 -1
  45. package/dist/test-runner/dry-run.js +1 -1
  46. package/dist/test-runner/index.js +4 -4
  47. package/dist/test-runner/job-executor.js +1 -1
  48. package/dist/test-runner/output-formatter.js +1 -1
  49. package/dist/test-runner/payload-builder.js +2 -2
  50. package/dist/test-runner/rule-evaluator.js +1 -1
  51. package/dist/test-runner/step-context.js +1 -1
  52. package/package.json +4 -4
  53. package/sbom.spdx.json +1328 -8436
package/dist/cli.js CHANGED
@@ -1,29 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import "./chunk-gOLHoazu.js";
3
3
  import { shouldSuppressBanner } from "./cli-banner.js";
4
- import { compileCommand } from "./commands/compile.js";
5
- import { watchCommand } from "./commands/watch.js";
6
- import { fixtureCommand } from "./commands/fixture.js";
7
- import { testCommand } from "./commands/test.js";
8
- import { runLocalCommand, runRemoteCommand } from "./commands/run.js";
9
- import { initCommand } from "./commands/init.js";
10
- import { hookInstallCommand } from "./commands/hook.js";
11
- import { loginCommand } from "./commands/login.js";
12
- import { secretsListCommand } from "./commands/secrets-list.js";
13
- import { statusCommand } from "./commands/status.js";
14
- import { typesCommand } from "./commands/types.js";
15
- import { endpointsCommand } from "./commands/endpoints.js";
16
- import { orgCurrentCommand, orgListCommand, orgUseCommand } from "./commands/org.js";
17
- import { logoutCommand } from "./commands/logout.js";
18
- import { cancelCommand } from "./commands/cancel.js";
19
- import { workflowsListCommand } from "./commands/workflows.js";
20
- import { drainWorkerCommand } from "./commands/drain-worker.js";
21
- import { docsCommand, docsLlmCommand } from "./commands/docs.js";
22
- import "./commands/index.js";
23
4
  import { Argument, Command, Option } from "commander";
24
5
  import pc from "picocolors";
25
6
  //#region src/cli.ts
26
- const version = "0.1.13";
7
+ const version = "0.1.14";
27
8
  const program = new Command();
28
9
  program.name("kici").description("KiCI workflow compiler").version(version);
29
10
  program.hook("preAction", (_thisCommand, actionCommand) => {
@@ -34,6 +15,7 @@ program.configureOutput({ outputError: (str, write) => {
34
15
  write(pc.red(str));
35
16
  } });
36
17
  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) => {
18
+ const { compileCommand, watchCommand } = await import("./commands/index.js");
37
19
  if (options.watch) await watchCommand({
38
20
  kiciDir: options.kiciDir,
39
21
  verbose: options.verbose
@@ -49,6 +31,7 @@ program.command("compile").description("Compile workflows from .kici/workflows/
49
31
  });
50
32
  const fixtureEventArg = new Argument("<event>", "Event to generate fixture for (e.g., pr:open, push, schedule, lifecycle:workflow_complete)");
51
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");
52
35
  await fixtureCommand(event, options);
53
36
  });
54
37
  const runCommand = program.command("run").description("Execute workflows locally or remotely");
@@ -61,6 +44,7 @@ runCommand.command("local").argument("[event]", "Event type (e.g., push, pr:open
61
44
  console.error("Error: missing event argument. Pass an event or use --pick.");
62
45
  process.exit(2);
63
46
  }
47
+ const { runLocalCommand } = await import("./commands/index.js");
64
48
  const success = await runLocalCommand({
65
49
  event,
66
50
  pick: options.pick,
@@ -85,14 +69,17 @@ runCommand.command("local").argument("[event]", "Event type (e.g., push, pr:open
85
69
  process.exit(success ? 0 : 1);
86
70
  });
87
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("--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 (fixture, options) => {
72
+ const { runRemoteCommand } = await import("./commands/index.js");
88
73
  const success = await runRemoteCommand(fixture, options);
89
74
  process.exit(success ? 0 : 1);
90
75
  });
91
76
  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) => {
77
+ const { testCommand } = await import("./commands/index.js");
92
78
  const success = await testCommand(event, options);
93
79
  process.exit(success ? 0 : 1);
94
80
  });
95
81
  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) => {
82
+ const { initCommand } = await import("./commands/index.js");
96
83
  const success = await initCommand({
97
84
  ...options,
98
85
  noAgentsMd: options.agentsMd === false
@@ -100,6 +87,7 @@ program.command("init").description("Initialize .kici/ directory with default wo
100
87
  process.exit(success ? 0 : 1);
101
88
  });
102
89
  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) => {
90
+ const { hookInstallCommand } = await import("./commands/index.js");
103
91
  const success = await hookInstallCommand({ git: options.git });
104
92
  process.exit(success ? 0 : 1);
105
93
  });
@@ -111,6 +99,7 @@ Environment variables:
111
99
  KICI_OIDC_ISSUER Override OIDC issuer URL
112
100
  KICI_OIDC_CLIENT_ID Override OIDC client ID
113
101
  `).action(async (options) => {
102
+ const { loginCommand } = await import("./commands/index.js");
114
103
  const success = await loginCommand({
115
104
  token: options.token,
116
105
  device: options.device,
@@ -121,27 +110,33 @@ Environment variables:
121
110
  process.exit(success ? 0 : 1);
122
111
  });
123
112
  program.command("logout").description("Revoke PAT and clear local credentials").action(async () => {
113
+ const { logoutCommand } = await import("./commands/index.js");
124
114
  const success = await logoutCommand();
125
115
  process.exit(success ? 0 : 1);
126
116
  });
127
117
  const orgCommand = program.command("org").description("Manage organizations");
128
118
  orgCommand.command("list").description("List organizations you belong to").action(async () => {
119
+ const { orgListCommand } = await import("./commands/index.js");
129
120
  const success = await orgListCommand();
130
121
  process.exit(success ? 0 : 1);
131
122
  });
132
123
  orgCommand.command("use").argument("<name>", "Organization name or ID").description("Switch active organization").action(async (name) => {
124
+ const { orgUseCommand } = await import("./commands/index.js");
133
125
  const success = await orgUseCommand(name);
134
126
  process.exit(success ? 0 : 1);
135
127
  });
136
128
  orgCommand.command("current").description("Show current active organization").action(async () => {
129
+ const { orgCurrentCommand } = await import("./commands/index.js");
137
130
  const success = await orgCurrentCommand();
138
131
  process.exit(success ? 0 : 1);
139
132
  });
140
133
  program.command("secrets").description("Manage secrets").command("list").description("List test-available secret contexts").option("--endpoint <url>", "Orchestrator URL override").action(async (options) => {
134
+ const { secretsListCommand } = await import("./commands/index.js");
141
135
  const success = await secretsListCommand({ endpoint: options.endpoint });
142
136
  process.exit(success ? 0 : 1);
143
137
  });
144
138
  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) => {
139
+ const { statusCommand } = await import("./commands/index.js");
145
140
  const success = await statusCommand(runId, {
146
141
  logs: options.logs,
147
142
  job: options.job,
@@ -150,6 +145,7 @@ program.command("status").argument("<run-id>", "Run ID to inspect").description(
150
145
  process.exit(success ? 0 : 1);
151
146
  });
152
147
  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) => {
148
+ const { cancelCommand } = await import("./commands/index.js");
153
149
  const success = await cancelCommand(runId, {
154
150
  force: options.force,
155
151
  branch: options.branch
@@ -157,6 +153,7 @@ program.command("cancel").argument("[run-id]", "Run ID to cancel").description("
157
153
  process.exit(success ? 0 : 1);
158
154
  });
159
155
  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) => {
156
+ const { typesCommand } = await import("./commands/index.js");
160
157
  const success = await typesCommand({
161
158
  kiciDir: options.kiciDir,
162
159
  endpoint: options.endpoint
@@ -164,10 +161,12 @@ program.command("types").description("Generate TypeScript declarations for secre
164
161
  process.exit(success ? 0 : 1);
165
162
  });
166
163
  program.command("endpoints").description("List all webhook entrypoints for the current project").option("--kici-dir <path>", "Path to .kici directory", ".kici").action(async (options) => {
164
+ const { endpointsCommand } = await import("./commands/index.js");
167
165
  const success = await endpointsCommand({ kiciDir: options.kiciDir });
168
166
  process.exit(success ? 0 : 1);
169
167
  });
170
168
  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) => {
169
+ const { workflowsListCommand } = await import("./commands/index.js");
171
170
  const success = await workflowsListCommand({
172
171
  json: options.json,
173
172
  stale: options.stale,
@@ -177,9 +176,11 @@ program.command("workflows").description("Manage workflow registrations").comman
177
176
  process.exit(success ? 0 : 1);
178
177
  });
179
178
  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) => {
179
+ const { docsCommand } = await import("./commands/index.js");
180
180
  const success = await docsCommand({ open: options.open });
181
181
  process.exit(success ? 0 : 1);
182
182
  }).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) => {
183
+ const { docsLlmCommand } = await import("./commands/index.js");
183
184
  const success = await docsLlmCommand({
184
185
  index: options.index,
185
186
  out: options.out
@@ -187,6 +188,7 @@ program.command("docs").description("Open the KiCI documentation site in the def
187
188
  process.exit(success ? 0 : 1);
188
189
  });
189
190
  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) => {
191
+ const { drainWorkerCommand } = await import("./commands/index.js");
190
192
  const success = await drainWorkerCommand({ url: options.url });
191
193
  process.exit(success ? 0 : 1);
192
194
  });
@@ -1,7 +1,7 @@
1
1
  import "../chunk-gOLHoazu.js";
2
2
  import { loadGlobalConfig } from "../remote/config.js";
3
3
  import pc from "picocolors";
4
- import { logger, toErrorMessage } from "@kici-dev/shared";
4
+ import { logger, toErrorMessage } from "@kici-dev/core";
5
5
  //#region src/commands/cancel.ts
6
6
  /**
7
7
  * kici cancel command
@@ -11,8 +11,8 @@ import pc from "picocolors";
11
11
  import { existsSync } from "node:fs";
12
12
  import fs from "node:fs/promises";
13
13
  import path from "node:path";
14
+ import { logger, toErrorMessage } from "@kici-dev/core";
14
15
  import { execSync } from "node:child_process";
15
- import { logger, toErrorMessage } from "@kici-dev/shared";
16
16
  //#region src/commands/compile.ts
17
17
  /**
18
18
  * Read the existing lock file and return its lockfileHash, if present.
@@ -2,8 +2,8 @@ import "../chunk-gOLHoazu.js";
2
2
  import pc from "picocolors";
3
3
  import { readFile, writeFile } from "node:fs/promises";
4
4
  import path from "node:path";
5
- import { logger, toErrorMessage } from "@kici-dev/shared";
6
5
  import { fileURLToPath } from "node:url";
6
+ import { logger, toErrorMessage } from "@kici-dev/core";
7
7
  import open from "open";
8
8
  //#region src/commands/docs.ts
9
9
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -1,6 +1,6 @@
1
1
  import "../chunk-gOLHoazu.js";
2
2
  import pc from "picocolors";
3
- import { logger, toErrorMessage } from "@kici-dev/shared";
3
+ import { logger, toErrorMessage } from "@kici-dev/core";
4
4
  //#region src/commands/drain-worker.ts
5
5
  /**
6
6
  * kici admin drain-worker command
@@ -5,7 +5,7 @@ import { loadGlobalConfig } from "../remote/config.js";
5
5
  import pc from "picocolors";
6
6
  import { readFile } from "node:fs/promises";
7
7
  import path from "node:path";
8
- import { logger, toErrorMessage } from "@kici-dev/shared";
8
+ import { logger, toErrorMessage } from "@kici-dev/core";
9
9
  //#region src/commands/endpoints.ts
10
10
  /**
11
11
  * kici endpoints command
@@ -1,10 +1,10 @@
1
1
  import "../chunk-gOLHoazu.js";
2
- import { getDefaultFixture } from "../fixtures/defaults/index.js";
3
- import { detectRepoFromGit } from "../test-runner/git-detector.js";
4
2
  import { parseEventArg } from "../test-runner/event-types.js";
3
+ import { detectRepoFromGit } from "../test-runner/git-detector.js";
4
+ import { getDefaultFixture } from "../fixtures/defaults/index.js";
5
5
  import pc from "picocolors";
6
6
  import { writeFile } from "node:fs/promises";
7
- import { logger } from "@kici-dev/shared";
7
+ import { logger } from "@kici-dev/core";
8
8
  //#region src/commands/fixture.ts
9
9
  /**
10
10
  * Fixture generation command
@@ -5,7 +5,7 @@ import "../hooks/index.js";
5
5
  import pc from "picocolors";
6
6
  import { readFile } from "node:fs/promises";
7
7
  import path from "node:path";
8
- import { logger, toErrorMessage } from "@kici-dev/shared";
8
+ import { logger, toErrorMessage } from "@kici-dev/core";
9
9
  import { select } from "@inquirer/prompts";
10
10
  //#region src/commands/hook.ts
11
11
  /**
@@ -1,20 +1,20 @@
1
1
  import "../chunk-gOLHoazu.js";
2
2
  import { compileCommand } from "./compile.js";
3
- import { watchCommand } from "./watch.js";
3
+ import { cancelCommand } from "./cancel.js";
4
+ import { docsCommand, docsLlmCommand } from "./docs.js";
5
+ import { drainWorkerCommand } from "./drain-worker.js";
6
+ import { endpointsCommand } from "./endpoints.js";
4
7
  import { fixtureCommand } from "./fixture.js";
8
+ import { hookInstallCommand } from "./hook.js";
9
+ import { watchCommand } from "./watch.js";
5
10
  import { testCommand, testDryRun } from "./test.js";
6
11
  import { runLocalCommand, runRemoteCommand } from "./run.js";
7
12
  import { initCommand } from "./init.js";
8
- import { hookInstallCommand } from "./hook.js";
9
13
  import { loginCommand } from "./login.js";
10
14
  import { secretsListCommand } from "./secrets-list.js";
11
15
  import { statusCommand } from "./status.js";
12
16
  import { typesCommand } from "./types.js";
13
- import { endpointsCommand } from "./endpoints.js";
14
17
  import { orgCurrentCommand, orgListCommand, orgUseCommand } from "./org.js";
15
18
  import { logoutCommand } from "./logout.js";
16
- import { cancelCommand } from "./cancel.js";
17
19
  import { workflowsListCommand } from "./workflows.js";
18
- import { drainWorkerCommand } from "./drain-worker.js";
19
- import { docsCommand, docsLlmCommand } from "./docs.js";
20
20
  export { cancelCommand, compileCommand, docsCommand, docsLlmCommand, drainWorkerCommand, endpointsCommand, fixtureCommand, hookInstallCommand, initCommand, loginCommand, logoutCommand, orgCurrentCommand, orgListCommand, orgUseCommand, runLocalCommand, runRemoteCommand, secretsListCommand, statusCommand, testCommand, testDryRun, typesCommand, watchCommand, workflowsListCommand };
@@ -1,19 +1,19 @@
1
1
  import "../chunk-gOLHoazu.js";
2
+ import { agentsMdTemplate } from "../templates/agents-md.js";
2
3
  import { tsconfigTemplate } from "../templates/tsconfig-json.js";
3
4
  import { generatePackageJson } from "../templates/package-json.js";
4
- import { agentsMdTemplate } from "../templates/agents-md.js";
5
5
  import { workflowPaths } from "../templates/index.js";
6
- import { getTypeScriptPaths } from "../execution/sdk-alias.js";
7
6
  import { detectHookTools, findGitDir } from "../hooks/detector.js";
8
7
  import { installHook } from "../hooks/installer.js";
9
8
  import "../hooks/index.js";
9
+ import { getTypeScriptPaths } from "../execution/sdk-alias.js";
10
10
  import pc from "picocolors";
11
11
  import { access, mkdir, readFile, rm, writeFile } from "node:fs/promises";
12
12
  import path from "node:path";
13
- import { initZx, logger, toErrorMessage } from "@kici-dev/shared";
14
- import { detectPackageManager, installCommand, parsePackageManager } from "@kici-dev/shared/package-manager";
15
- import { $ } from "zx";
13
+ import { initZx, logger, toErrorMessage } from "@kici-dev/core";
14
+ import { detectPackageManager, installBuildPolicyArgs, installCommand, parsePackageManager } from "@kici-dev/core/package-manager";
16
15
  import { checkbox, confirm, select } from "@inquirer/prompts";
16
+ import { $ } from "zx";
17
17
  //#region src/commands/init.ts
18
18
  /**
19
19
  * kici init command
@@ -94,9 +94,11 @@ async function initCommand(options = {}) {
94
94
  await mkdir(path.join(kiciDir, "types"), { recursive: true });
95
95
  logger.info(pc.gray("Created .kici/types/ for generated type declarations"));
96
96
  if (!options.skipInstall) {
97
- const [bin, action] = installCommand(await resolvePackageManager(options.packageManager));
97
+ const pm = await resolvePackageManager(options.packageManager);
98
+ const [bin, action] = installCommand(pm);
99
+ const buildPolicyArgs = installBuildPolicyArgs(pm);
98
100
  logger.info(pc.gray(`Running ${bin} ${action}...`));
99
- await $`cd ${kiciDir} && ${bin} ${action}`;
101
+ await $`cd ${kiciDir} && ${bin} ${action} ${buildPolicyArgs}`;
100
102
  }
101
103
  }
102
104
  if (options.privateRegistry) await writePrivateRegistryScaffold(kiciDir, {
@@ -3,7 +3,7 @@ import { getConfigPath, mergeGlobalConfig } from "../remote/config.js";
3
3
  import { deviceFlow, exchangeTokenForPat, pkceFlow } from "../remote/oauth.js";
4
4
  import { isHeadless } from "../auth/headless-detect.js";
5
5
  import pc from "picocolors";
6
- import { toErrorMessage } from "@kici-dev/shared";
6
+ import { toErrorMessage } from "@kici-dev/core";
7
7
  import os from "node:os";
8
8
  import { createInterface } from "node:readline";
9
9
  //#region src/commands/login.ts
@@ -1,20 +1,20 @@
1
1
  import "../chunk-gOLHoazu.js";
2
2
  import { resolveKiciDir } from "../execution/executor.js";
3
3
  import "../execution/index.js";
4
- import { loadGlobalConfig } from "../remote/config.js";
5
4
  import { AuthenticationError, ConnectionError, OrchestratorClient } from "../remote/client.js";
6
- import { compileFixtures, filterFixtures } from "../fixtures/compiler.js";
7
- import { createOverlayTarball, getSizeWarning, uploadTarball } from "../remote/uploader.js";
5
+ import { loadGlobalConfig } from "../remote/config.js";
6
+ import { RunHistory } from "../remote/history.js";
8
7
  import { ObserverClient } from "../remote/observer.js";
9
- import { StreamingFormatter } from "../remote/output/streaming.js";
10
- import { formatErrorHighlight, formatMultiFixtureSummary, formatSummary } from "../remote/output/summary.js";
8
+ import { createOverlayTarball, getSizeWarning, uploadTarball } from "../remote/uploader.js";
11
9
  import { formatJsonResult } from "../remote/output/json.js";
12
10
  import { formatJunitResult } from "../remote/output/junit.js";
13
- import { RunHistory } from "../remote/history.js";
11
+ import { StreamingFormatter } from "../remote/output/streaming.js";
12
+ import { formatErrorHighlight, formatMultiFixtureSummary, formatSummary } from "../remote/output/summary.js";
13
+ import { compileFixtures, filterFixtures } from "../fixtures/compiler.js";
14
14
  import pc from "picocolors";
15
15
  import { readFile, writeFile } from "node:fs/promises";
16
16
  import path from "node:path";
17
- import { formatBytes, logger, toErrorMessage } from "@kici-dev/shared";
17
+ import { formatBytes, logger, toErrorMessage } from "@kici-dev/core";
18
18
  //#region src/commands/run.ts
19
19
  /**
20
20
  * Run a workflow locally using the local executor.
@@ -1,7 +1,7 @@
1
1
  import "../chunk-gOLHoazu.js";
2
2
  import { loadGlobalConfig } from "../remote/config.js";
3
3
  import pc from "picocolors";
4
- import { toErrorMessage } from "@kici-dev/shared";
4
+ import { toErrorMessage } from "@kici-dev/core";
5
5
  //#region src/commands/secrets-list.ts
6
6
  /**
7
7
  * List test-available secret contexts from the orchestrator.
@@ -1,12 +1,12 @@
1
1
  import "../chunk-gOLHoazu.js";
2
2
  import { formatCapabilityGapError } from "../errors/capability-gap.js";
3
- import { loadGlobalConfig } from "../remote/config.js";
4
3
  import { AuthenticationError, ConnectionError, NotFoundError, OrchestratorClient } from "../remote/client.js";
5
- import { StreamingFormatter } from "../remote/output/streaming.js";
4
+ import { loadGlobalConfig } from "../remote/config.js";
6
5
  import { RunHistory } from "../remote/history.js";
6
+ import { StreamingFormatter } from "../remote/output/streaming.js";
7
7
  import { observeCompletion } from "./run.js";
8
8
  import pc from "picocolors";
9
- import { formatDuration, logger, toErrorMessage } from "@kici-dev/shared";
9
+ import { formatDuration, logger, toErrorMessage } from "@kici-dev/core";
10
10
  //#region src/commands/status.ts
11
11
  /**
12
12
  * kici status command
@@ -15,7 +15,7 @@ import { formatDuration, logger, toErrorMessage } from "@kici-dev/shared";
15
15
  * Looks up local history first, then fetches from the orchestrator for
16
16
  * up-to-date status and logs.
17
17
  */
18
- const CLI_VERSION = "0.1.13";
18
+ const CLI_VERSION = "0.1.14";
19
19
  /**
20
20
  * Show status and details of a test run.
21
21
  *
@@ -2,14 +2,14 @@ import "../chunk-gOLHoazu.js";
2
2
  import { discoverWorkflows, resolveKiciDir } from "../execution/executor.js";
3
3
  import "../execution/index.js";
4
4
  import { transformTriggers } from "../lockfile/generator.js";
5
+ import { displayDryRun } from "../test-runner/dry-run.js";
5
6
  import { parseEventArg } from "../test-runner/event-types.js";
6
7
  import { buildEventPayload } from "../test-runner/payload-builder.js";
7
- import { displayDryRun } from "../test-runner/dry-run.js";
8
8
  import { loadSecretsFile } from "../test-runner/secrets-file.js";
9
9
  import pc from "picocolors";
10
10
  import { readFile } from "node:fs/promises";
11
11
  import path from "node:path";
12
- import { logger, toErrorMessage } from "@kici-dev/shared";
12
+ import { logger, toErrorMessage } from "@kici-dev/core";
13
13
  import { matchAllWorkflows, normalizeRunsOn } from "@kici-dev/engine";
14
14
  //#region src/commands/test.ts
15
15
  /**
@@ -4,7 +4,7 @@ import { generateSecretsDts } from "../generators/secrets-dts.js";
4
4
  import pc from "picocolors";
5
5
  import fs from "node:fs/promises";
6
6
  import path from "node:path";
7
- import { toErrorMessage } from "@kici-dev/shared";
7
+ import { toErrorMessage } from "@kici-dev/core";
8
8
  //#region src/commands/types.ts
9
9
  /**
10
10
  * Generate TypeScript declarations for environment secrets.
@@ -4,7 +4,7 @@ import "../execution/index.js";
4
4
  import { compileCommand } from "./compile.js";
5
5
  import pc from "picocolors";
6
6
  import path from "node:path";
7
- import { logger, toErrorMessage } from "@kici-dev/shared";
7
+ import { logger, toErrorMessage } from "@kici-dev/core";
8
8
  import chokidar from "chokidar";
9
9
  //#region src/commands/watch.ts
10
10
  /** Debounce delay in milliseconds */
@@ -1,9 +1,9 @@
1
1
  import "../chunk-gOLHoazu.js";
2
- import { loadGlobalConfig } from "../remote/config.js";
3
- import { AuthenticationError, ConnectionError, OrchestratorClient, ServerError } from "../remote/client.js";
4
2
  import { formatRelativeTime } from "../format.js";
3
+ import { AuthenticationError, ConnectionError, OrchestratorClient, ServerError } from "../remote/client.js";
4
+ import { loadGlobalConfig } from "../remote/config.js";
5
5
  import pc from "picocolors";
6
- import { toErrorMessage } from "@kici-dev/shared";
6
+ import { toErrorMessage } from "@kici-dev/core";
7
7
  //#region src/commands/workflows.ts
8
8
  /**
9
9
  * kici workflows list command
@@ -1,6 +1,7 @@
1
1
  import "../chunk-gOLHoazu.js";
2
2
  import { compilerError } from "../errors/formatter.js";
3
3
  import "../errors/index.js";
4
+ import { ensureTsLoaderHook } from "./ts-loader.js";
4
5
  import { existsSync } from "node:fs";
5
6
  import fs from "node:fs/promises";
6
7
  import path from "node:path";
@@ -9,9 +10,10 @@ import { pathToFileURL } from "node:url";
9
10
  /**
10
11
  * Load a TypeScript workflow/config module by direct dynamic import.
11
12
  *
12
- * Relies on the shared `@kici-dev/shared/ts-loader-hook` ESM loader hook
13
- * registered by `packages/kici/bin/kici.js` (the same hook the agent registers
14
- * in its sandbox process). No Rolldown bundling: host-repo imports and
13
+ * Relies on the `@kici-dev/core/ts-loader-hook` ESM loader hook, registered
14
+ * lazily via `ensureTsLoaderHook()` just before the dynamic import (the same
15
+ * hook the agent registers in its sandbox process). No Rolldown bundling:
16
+ * host-repo imports and
15
17
  * transitive deps with dynamic import() resolve via Node's normal ESM loader
16
18
  * against the workspace's node_modules — the same module graph any other
17
19
  * `pnpm exec tsx` invocation would see. This keeps ops-style workflows (which
@@ -24,6 +26,7 @@ async function loadModule(entryPoint, errorContext) {
24
26
  hashBundleSource = await fs.readFile(entryPoint, "utf-8");
25
27
  } catch {}
26
28
  try {
29
+ ensureTsLoaderHook();
27
30
  return {
28
31
  module: await import(pathToFileURL(entryPoint).href + `?t=${Date.now()}`),
29
32
  hashBundleSource
@@ -2,7 +2,7 @@ import "../chunk-gOLHoazu.js";
2
2
  import { existsSync } from "node:fs";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import path from "node:path";
5
- import { logger } from "@kici-dev/shared";
5
+ import { logger } from "@kici-dev/core";
6
6
  //#region src/execution/sdk-alias.ts
7
7
  /**
8
8
  * SDK aliasing for development mode
@@ -0,0 +1,2 @@
1
+ export declare function ensureTsLoaderHook(): void;
2
+ //# sourceMappingURL=ts-loader.d.ts.map
@@ -0,0 +1,13 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { register } from "node:module";
3
+ //#region src/execution/ts-loader.ts
4
+ let registered = false;
5
+ function ensureTsLoaderHook() {
6
+ if (registered) return;
7
+ registered = true;
8
+ register("@kici-dev/core/ts-loader-hook", import.meta.url);
9
+ }
10
+ //#endregion
11
+ export { ensureTsLoaderHook };
12
+
13
+ //# sourceMappingURL=ts-loader.js.map
@@ -2,9 +2,10 @@
2
2
  * Fixture auto-compilation pipeline.
3
3
  *
4
4
  * Discovers and dynamic-imports Fixture exports from `.kici/tests/*.ts` files.
5
- * TypeScript transformation is handled by the shared oxc-transform ESM loader
6
- * hook registered by the kici CLI bin (`@kici-dev/shared/ts-loader-hook`),
7
- * which is the same hook the agent registers. Fixture files are imported in
5
+ * TypeScript transformation is handled by the `@kici-dev/core/ts-loader-hook`
6
+ * oxc-transform ESM loader hook, registered lazily via `ensureTsLoaderHook()`
7
+ * before the dynamic import (the same hook the agent registers). Fixture files
8
+ * are imported in
8
9
  * place so Node resolves `@kici-dev/sdk` from the customer's
9
10
  * `.kici/node_modules/` — no temp files, no Rolldown bundle step.
10
11
  */
@@ -30,8 +31,9 @@ export declare function discoverFixtureFiles(testsDir: string): Promise<string[]
30
31
  *
31
32
  * Process:
32
33
  * 1. Discover fixture files.
33
- * 2. Dynamic-import each `.ts` file (transformed on the fly by the shared
34
- * oxc-transform ESM loader hook registered by the kici CLI bin).
34
+ * 2. Dynamic-import each `.ts` file (transformed on the fly by the
35
+ * `@kici-dev/core/ts-loader-hook` oxc-transform ESM loader hook, registered
36
+ * lazily via `ensureTsLoaderHook()`).
35
37
  * 3. Extract Fixture exports.
36
38
  * 4. Resolve async factory fixtures.
37
39
  * 5. Validate no duplicate fixture IDs.
@@ -1,4 +1,5 @@
1
1
  import "../chunk-gOLHoazu.js";
2
+ import { ensureTsLoaderHook } from "../execution/ts-loader.js";
2
3
  import fs from "node:fs/promises";
3
4
  import path from "node:path";
4
5
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -8,9 +9,10 @@ import picomatch from "picomatch";
8
9
  * Fixture auto-compilation pipeline.
9
10
  *
10
11
  * Discovers and dynamic-imports Fixture exports from `.kici/tests/*.ts` files.
11
- * TypeScript transformation is handled by the shared oxc-transform ESM loader
12
- * hook registered by the kici CLI bin (`@kici-dev/shared/ts-loader-hook`),
13
- * which is the same hook the agent registers. Fixture files are imported in
12
+ * TypeScript transformation is handled by the `@kici-dev/core/ts-loader-hook`
13
+ * oxc-transform ESM loader hook, registered lazily via `ensureTsLoaderHook()`
14
+ * before the dynamic import (the same hook the agent registers). Fixture files
15
+ * are imported in
14
16
  * place so Node resolves `@kici-dev/sdk` from the customer's
15
17
  * `.kici/node_modules/` — no temp files, no Rolldown bundle step.
16
18
  */
@@ -46,8 +48,9 @@ async function scanDirectory(dir) {
46
48
  *
47
49
  * Process:
48
50
  * 1. Discover fixture files.
49
- * 2. Dynamic-import each `.ts` file (transformed on the fly by the shared
50
- * oxc-transform ESM loader hook registered by the kici CLI bin).
51
+ * 2. Dynamic-import each `.ts` file (transformed on the fly by the
52
+ * `@kici-dev/core/ts-loader-hook` oxc-transform ESM loader hook, registered
53
+ * lazily via `ensureTsLoaderHook()`).
51
54
  * 3. Extract Fixture exports.
52
55
  * 4. Resolve async factory fixtures.
53
56
  * 5. Validate no duplicate fixture IDs.
@@ -72,6 +75,7 @@ async function loadFixtureFile(filePath) {
72
75
  const createdLinks = await ensureRuntimeSymlinks(filePath);
73
76
  let mod;
74
77
  try {
78
+ ensureTsLoaderHook();
75
79
  mod = await import(pathToFileURL(filePath).href + `?t=${Date.now()}`);
76
80
  } catch (err) {
77
81
  throw new Error(`Failed to load fixture module ${filePath}: ${err.message}`);
@@ -98,7 +102,7 @@ async function loadFixtureFile(filePath) {
98
102
  const RUNTIME_PACKAGES = [
99
103
  "@kici-dev/sdk",
100
104
  "zx",
101
- "@kici-dev/shared"
105
+ "@kici-dev/core"
102
106
  ];
103
107
  async function ensureRuntimeSymlinks(filePath) {
104
108
  const created = [];