@kici-dev/compiler 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/dist/commands/compile.js +5 -1
- package/dist/commands/doctor.js +8 -2
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.js +77 -12
- package/dist/commands/local.d.ts +9 -2
- package/dist/commands/local.js +14 -4
- package/dist/commands/preview.js +1 -1
- package/dist/commands/report/identity.d.ts +11 -0
- package/dist/commands/report/identity.js +7 -2
- package/dist/commands/run-routed.js +4 -0
- package/dist/commands/run.js +5 -2
- package/dist/commands/runs/logs.js +3 -2
- package/dist/commands/types.d.ts +6 -1
- package/dist/commands/types.js +2 -1
- package/dist/execution/executor.js +7 -1
- package/dist/llm-context/llms-architecture.txt +73 -87
- package/dist/llm-context/llms-cli-remote.txt +53 -8
- package/dist/llm-context/llms-cli.txt +71 -36
- package/dist/llm-context/llms-features-execution.txt +52 -6
- package/dist/llm-context/llms-features.txt +137 -6
- package/dist/llm-context/llms-full.txt +558 -180
- package/dist/llm-context/llms-getting-started.txt +5 -5
- package/dist/llm-context/llms-patterns.txt +81 -5
- package/dist/llm-context/llms-providers.txt +6 -2
- package/dist/llm-context/llms-sdk-runtime.txt +33 -18
- package/dist/llm-context/llms-sdk.txt +47 -7
- package/dist/llm-context/llms.txt +8 -8
- package/dist/local-plane/orchestrator-process.d.ts +0 -8
- package/dist/local-plane/orchestrator-process.js +6 -14
- package/dist/local-plane/paths.d.ts +1 -0
- package/dist/local-plane/paths.js +1 -0
- package/dist/local-plane/plane-log.d.ts +27 -0
- package/dist/local-plane/plane-log.js +39 -0
- package/dist/local-plane/plane-manager.js +2 -2
- package/dist/local-plane/plane-trigger.d.ts +28 -0
- package/dist/local-plane/plane-trigger.js +57 -2
- package/dist/local-plane/postgres.js +9 -6
- package/dist/local-plane/run-follow.js +2 -1
- package/dist/lockfile/generator.js +25 -9
- package/dist/lockfile/hasher.d.ts +5 -13
- package/dist/lockfile/hasher.js +1 -15
- package/dist/lockfile/workspace-siblings.d.ts +46 -0
- package/dist/lockfile/workspace-siblings.js +197 -0
- package/dist/remote/output/streaming.d.ts +12 -0
- package/dist/remote/output/streaming.js +20 -1
- package/dist/remote/platform-client.d.ts +2 -0
- package/dist/templates/package-json.d.ts +9 -7
- package/dist/templates/package-json.js +11 -9
- package/dist/test-runner/job-executor.js +1 -1
- package/dist/test-runner/rule-evaluator.js +1 -1
- package/dist/types.d.ts +6 -1
- package/package.json +7 -9
- package/sbom.spdx.json +123 -123
- package/dist/postinstall.d.ts +0 -9
- package/dist/postinstall.js +0 -62
- package/hack/postinstall.mjs +0 -105
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import { realpathSync } from "node:fs";
|
|
|
7
7
|
import { Argument, Command } from "commander";
|
|
8
8
|
import pc from "picocolors";
|
|
9
9
|
//#region src/cli.ts
|
|
10
|
-
const version = "0.
|
|
10
|
+
const version = "0.8.0";
|
|
11
11
|
/**
|
|
12
12
|
* Top-level commands that were removed, mapped to their current equivalent.
|
|
13
13
|
* Consulted when the CLI hits an unknown command so the user gets a precise
|
|
@@ -312,7 +312,7 @@ Environment variables:
|
|
|
312
312
|
],
|
|
313
313
|
[
|
|
314
314
|
"logs",
|
|
315
|
-
"Print the local dev plane
|
|
315
|
+
"Print the local dev plane log paths and rotation policy",
|
|
316
316
|
"localLogsCommand"
|
|
317
317
|
],
|
|
318
318
|
[
|
package/dist/commands/compile.js
CHANGED
|
@@ -13,6 +13,7 @@ import path from "node:path";
|
|
|
13
13
|
import { existsSync } from "node:fs";
|
|
14
14
|
import pc from "picocolors";
|
|
15
15
|
import fs$1 from "node:fs/promises";
|
|
16
|
+
import { findDigestReproducibilityWarnings, loadKiciIgnoreRules } from "@kici-dev/core/kici-source-digest";
|
|
16
17
|
import { logger, toErrorMessage } from "@kici-dev/core";
|
|
17
18
|
import { PackageManager, detectPackageManagerSync } from "@kici-dev/core/package-manager";
|
|
18
19
|
import { execSync } from "node:child_process";
|
|
@@ -80,6 +81,9 @@ async function compileCommand(options) {
|
|
|
80
81
|
const lockJson = serializeLockFile(lockFile);
|
|
81
82
|
const windowWarning = schemaWindowWarning(BREAKING_FLOOR, SCHEMA_VERSION);
|
|
82
83
|
if (windowWarning) logger.warn(pc.yellow(windowWarning));
|
|
84
|
+
const ignoreRules = await loadKiciIgnoreRules(absoluteKiciDir);
|
|
85
|
+
for (const warning of ignoreRules.warnings) logger.warn(pc.yellow(warning));
|
|
86
|
+
for (const warning of await findDigestReproducibilityWarnings(absoluteKiciDir, ignoreRules)) logger.warn(pc.yellow(warning));
|
|
83
87
|
if (!options.check) {
|
|
84
88
|
await fs$1.writeFile(lockPath, lockJson, "utf-8");
|
|
85
89
|
if (!options.quiet) logger.info(pc.green("✓") + ` Compiled workflows → .kici/kici.lock.json` + pc.dim(` (${workflowsWithSource.length} workflow${workflowsWithSource.length !== 1 ? "s" : ""})`));
|
|
@@ -91,7 +95,7 @@ async function compileCommand(options) {
|
|
|
91
95
|
if (hasToken && hasEndpoint && config.activeOrgId) {
|
|
92
96
|
const { typesCommand } = await import("./types.js");
|
|
93
97
|
await typesCommand({
|
|
94
|
-
kiciDir,
|
|
98
|
+
kiciDir: absoluteKiciDir,
|
|
95
99
|
quiet: options.quiet
|
|
96
100
|
});
|
|
97
101
|
}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -8,7 +8,7 @@ import path from "node:path";
|
|
|
8
8
|
import pc from "picocolors";
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
10
|
import { deriveDiagnoseOverall, diagnoseExitCode, toErrorMessage } from "@kici-dev/core";
|
|
11
|
-
import { matcherSatisfiedBy } from "@kici-dev/engine";
|
|
11
|
+
import { canonicalizeLabelSet, canonicalizeMatcher, matcherSatisfiedBy } from "@kici-dev/engine";
|
|
12
12
|
import { execFile } from "node:child_process";
|
|
13
13
|
import { promisify } from "node:util";
|
|
14
14
|
//#region src/commands/doctor.ts
|
|
@@ -157,9 +157,15 @@ function checkLockFile(state) {
|
|
|
157
157
|
* A label group satisfies a requirement only when it matches EVERY runsOn
|
|
158
158
|
* matcher AND matches NONE of the excludeLabels — the same authority the
|
|
159
159
|
* orchestrator's job queue applies (`runsOn.every` && `!exclude.some`).
|
|
160
|
+
*
|
|
161
|
+
* Both sides are folded first, and both arms of the check get the fold: the
|
|
162
|
+
* probe reports canonical agent labels while lock matchers carry whatever case
|
|
163
|
+
* the workflow author wrote, so comparing them raw would report a dispatchable
|
|
164
|
+
* job unreachable and would let an excluded label slip past on case alone.
|
|
160
165
|
*/
|
|
161
166
|
function requirementSatisfiedBy(req, labels) {
|
|
162
|
-
|
|
167
|
+
const canonical = canonicalizeLabelSet([...labels]);
|
|
168
|
+
return req.runsOn.every((m) => matcherSatisfiedBy(canonicalizeMatcher(m), canonical)) && !req.exclude.some((m) => matcherSatisfiedBy(canonicalizeMatcher(m), canonical));
|
|
163
169
|
}
|
|
164
170
|
function describeMatcher(m) {
|
|
165
171
|
return m.kind === "regex" ? `/${m.source}/${m.flags}` : m.value;
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -48,4 +48,13 @@ export declare function initCommand(options?: InitOptions): Promise<boolean>;
|
|
|
48
48
|
* @param kiciDir - The resolved `.kici` directory path.
|
|
49
49
|
*/
|
|
50
50
|
export declare function writeKiciGitignore(kiciDir: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Scaffold `.kici/.kiciignore` with the default exclusion set. Never overwrites
|
|
53
|
+
* an existing file — the customer may have tuned it — and never runs from
|
|
54
|
+
* `kici compile`: a compile that wrote into the tree it is hashing is the exact
|
|
55
|
+
* hazard the exclusion set exists to close.
|
|
56
|
+
*
|
|
57
|
+
* @param kiciDir - The resolved `.kici` directory path.
|
|
58
|
+
*/
|
|
59
|
+
export declare function writeKiciIgnore(kiciDir: string): Promise<void>;
|
|
51
60
|
//# sourceMappingURL=init.d.ts.map
|
package/dist/commands/init.js
CHANGED
|
@@ -11,12 +11,13 @@ import { rewriteRunsOnForHost, shouldOfferFirstRun } from "./init-host-os.js";
|
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import pc from "picocolors";
|
|
13
13
|
import { access, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
14
|
+
import { KICI_DIGEST_DEFAULT_EXCLUSIONS, KICI_IGNORE_FILENAME } from "@kici-dev/core/kici-source-digest";
|
|
14
15
|
import { $ } from "zx";
|
|
15
16
|
import { initZx, logger, toErrorMessage } from "@kici-dev/core";
|
|
16
17
|
import { detectPackageManager, detectWorkspaceRoot, installBuildPolicyArgs, installCommand, parsePackageManager } from "@kici-dev/core/package-manager";
|
|
18
|
+
import os from "node:os";
|
|
17
19
|
import { checkbox, confirm, select } from "@inquirer/prompts";
|
|
18
20
|
import { isCiEnvironment } from "@kici-dev/core/ci-env";
|
|
19
|
-
import os from "node:os";
|
|
20
21
|
//#region src/commands/init.ts
|
|
21
22
|
/**
|
|
22
23
|
* kici init command
|
|
@@ -77,6 +78,7 @@ async function initCommand(options = {}) {
|
|
|
77
78
|
await writeFile(kiciIgnorePath, kiciIgnoreTemplate, "utf-8");
|
|
78
79
|
}
|
|
79
80
|
await writeKiciGitignore(kiciDir);
|
|
81
|
+
await writeKiciIgnore(kiciDir);
|
|
80
82
|
const devMode = await detectDevelopmentMode();
|
|
81
83
|
const mode = await resolveScaffoldMode(options);
|
|
82
84
|
const useVerdaccio = devMode;
|
|
@@ -230,8 +232,21 @@ async function resolvePackageManager(override, dir = process.cwd()) {
|
|
|
230
232
|
}
|
|
231
233
|
return detectPackageManager(dir);
|
|
232
234
|
}
|
|
233
|
-
/**
|
|
234
|
-
|
|
235
|
+
/**
|
|
236
|
+
* The `@kici-dev` scope → local registry line written in dev mode, or `null`
|
|
237
|
+
* when no dev registry is configured.
|
|
238
|
+
*
|
|
239
|
+
* The registry URL comes from `KICI_DEV_REGISTRY` rather than a literal in this
|
|
240
|
+
* file. `init.ts` ships in the published `@kici-dev/compiler` source and
|
|
241
|
+
* bundle, so a hard-coded internal hostname is published to every customer who
|
|
242
|
+
* unpacks the tarball — a disclosure, not a reachable path (every write site is
|
|
243
|
+
* behind the dev-mode gate), but an avoidable one. With dev mode on and the
|
|
244
|
+
* variable unset there is nothing to point at, so no `.npmrc` is written.
|
|
245
|
+
*/
|
|
246
|
+
function devRegistryNpmrc() {
|
|
247
|
+
const registry = process.env.KICI_DEV_REGISTRY?.trim();
|
|
248
|
+
return registry ? `@kici-dev:registry=${registry}\n` : null;
|
|
249
|
+
}
|
|
235
250
|
/** Write .kici/tsconfig.json + the empty types/ dir (TypeScript mode only). */
|
|
236
251
|
async function writeTsConfigAndTypesDir(kiciDir) {
|
|
237
252
|
logger.info(pc.gray("Writing .kici/tsconfig.json"));
|
|
@@ -254,13 +269,15 @@ async function runInstall(pm, dir) {
|
|
|
254
269
|
async function wireStandaloneDeps(kiciDir, devMode, options) {
|
|
255
270
|
logger.info(pc.gray("Writing .kici/package.json"));
|
|
256
271
|
await writeFile(path.join(kiciDir, "package.json"), generatePackageJson(devMode), "utf-8");
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
272
|
+
const devNpmrc = devMode ? devRegistryNpmrc() : null;
|
|
273
|
+
if (devMode && !devNpmrc) logger.info(pc.yellow("Dev mode: KICI_DEV_REGISTRY is unset, writing no .npmrc."));
|
|
274
|
+
if (devNpmrc) {
|
|
275
|
+
logger.info(pc.yellow("Pointing @kici-dev to the dev registry."));
|
|
276
|
+
await writeFile(path.join(kiciDir, ".npmrc"), devNpmrc, "utf-8");
|
|
260
277
|
const rootNpmrc = path.resolve(".npmrc");
|
|
261
278
|
if (!await checkExists(rootNpmrc)) {
|
|
262
|
-
logger.info(pc.gray("Writing .npmrc (
|
|
263
|
-
await writeFile(rootNpmrc,
|
|
279
|
+
logger.info(pc.gray("Writing .npmrc (dev registry scope)"));
|
|
280
|
+
await writeFile(rootNpmrc, devNpmrc, "utf-8");
|
|
264
281
|
}
|
|
265
282
|
}
|
|
266
283
|
if (!options.mjs) {
|
|
@@ -276,11 +293,13 @@ async function wireStandaloneDeps(kiciDir, devMode, options) {
|
|
|
276
293
|
*/
|
|
277
294
|
async function wireIntegrateDeps(kiciDir, workspaceRoot, devMode, options) {
|
|
278
295
|
await addSdkToRootManifest(workspaceRoot, devMode);
|
|
279
|
-
|
|
296
|
+
const devNpmrc = devMode ? devRegistryNpmrc() : null;
|
|
297
|
+
if (devMode && !devNpmrc) logger.info(pc.yellow("Dev mode: KICI_DEV_REGISTRY is unset, writing no .npmrc."));
|
|
298
|
+
if (devNpmrc) {
|
|
280
299
|
const rootNpmrc = path.join(workspaceRoot, ".npmrc");
|
|
281
300
|
if (!await checkExists(rootNpmrc)) {
|
|
282
|
-
logger.info(pc.gray("Writing workspace-root .npmrc (
|
|
283
|
-
await writeFile(rootNpmrc,
|
|
301
|
+
logger.info(pc.gray("Writing workspace-root .npmrc (dev registry scope)"));
|
|
302
|
+
await writeFile(rootNpmrc, devNpmrc, "utf-8");
|
|
284
303
|
}
|
|
285
304
|
}
|
|
286
305
|
if (!options.mjs) await writeTsConfigAndTypesDir(kiciDir);
|
|
@@ -389,6 +408,52 @@ async function writeKiciGitignore(kiciDir) {
|
|
|
389
408
|
await writeFile(gitignorePath, KICI_GITIGNORE_TEMPLATE, "utf-8");
|
|
390
409
|
}
|
|
391
410
|
/**
|
|
411
|
+
* Build the `.kici/.kiciignore` scaffold: the default exclusion set, annotated.
|
|
412
|
+
*
|
|
413
|
+
* Rendered from `KICI_DIGEST_DEFAULT_EXCLUSIONS` rather than a hand-typed list,
|
|
414
|
+
* so a new default cannot ship with the seeded file silently short of it — the
|
|
415
|
+
* file replaces the defaults rather than merging with them, which makes a stale
|
|
416
|
+
* template an unstable hash rather than a cosmetic drift.
|
|
417
|
+
*/
|
|
418
|
+
function buildKiciIgnoreTemplate() {
|
|
419
|
+
return [
|
|
420
|
+
"# Paths the workflow source digest does NOT cover.",
|
|
421
|
+
"#",
|
|
422
|
+
"# This file IS the exclusion list: it replaces the built-in defaults rather",
|
|
423
|
+
"# than adding to them. The entries below are those defaults. Removing one",
|
|
424
|
+
"# re-includes that path in the hash — and node_modules/, .npmrc and",
|
|
425
|
+
"# package-lock.json are rewritten during a run, so dropping one makes the",
|
|
426
|
+
"# hash change on every run and the drift gate reject it. `kici compile`",
|
|
427
|
+
"# warns when that happens.",
|
|
428
|
+
"#",
|
|
429
|
+
"# Patterns are gitignore-style, relative to .kici/. Unrelated to the",
|
|
430
|
+
"# repo-root .kiciignore, which selects what `kici run --remote` uploads.",
|
|
431
|
+
"#",
|
|
432
|
+
"# This file is itself hashed: which files define a workflow identity is",
|
|
433
|
+
"# part of that identity, so editing it forces a recompile.",
|
|
434
|
+
"",
|
|
435
|
+
...KICI_DIGEST_DEFAULT_EXCLUSIONS,
|
|
436
|
+
""
|
|
437
|
+
].join("\n");
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Scaffold `.kici/.kiciignore` with the default exclusion set. Never overwrites
|
|
441
|
+
* an existing file — the customer may have tuned it — and never runs from
|
|
442
|
+
* `kici compile`: a compile that wrote into the tree it is hashing is the exact
|
|
443
|
+
* hazard the exclusion set exists to close.
|
|
444
|
+
*
|
|
445
|
+
* @param kiciDir - The resolved `.kici` directory path.
|
|
446
|
+
*/
|
|
447
|
+
async function writeKiciIgnore(kiciDir) {
|
|
448
|
+
const kiciIgnorePath = path.join(kiciDir, KICI_IGNORE_FILENAME);
|
|
449
|
+
if (await checkExists(kiciIgnorePath)) {
|
|
450
|
+
logger.info(pc.gray(`Skipping .kici/${KICI_IGNORE_FILENAME} (already exists)`));
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
logger.info(pc.gray(`Writing .kici/${KICI_IGNORE_FILENAME}`));
|
|
454
|
+
await writeFile(kiciIgnorePath, buildKiciIgnoreTemplate(), "utf-8");
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
392
457
|
* Update .gitignore with .kici/ entries
|
|
393
458
|
*
|
|
394
459
|
* Safely appends to .gitignore, checking for existing entries to avoid duplicates.
|
|
@@ -560,6 +625,6 @@ async function offerHookInstallation(useVerdaccio) {
|
|
|
560
625
|
} else logger.warn(pc.yellow(`Warning: ${result.message}`));
|
|
561
626
|
}
|
|
562
627
|
//#endregion
|
|
563
|
-
export { initCommand, writeKiciGitignore };
|
|
628
|
+
export { initCommand, writeKiciGitignore, writeKiciIgnore };
|
|
564
629
|
|
|
565
630
|
//# sourceMappingURL=init.js.map
|
package/dist/commands/local.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* orchestrator plus a local Postgres (embedded, with a podman fallback) that
|
|
6
6
|
* `kici run --local` dispatches through. `up` boots or reuses the plane,
|
|
7
7
|
* `status` reports it plus the control commands, `down` stops it, and `logs`
|
|
8
|
-
* prints the
|
|
8
|
+
* prints the plane log paths and rotation policy.
|
|
9
9
|
*/
|
|
10
10
|
import type { PlaneStatus, PlaneMode } from '../local-plane/plane-manager.js';
|
|
11
11
|
import type { PlaneState } from '../local-plane/plane-liveness.js';
|
|
@@ -52,7 +52,14 @@ export declare function localStatusCommand(options?: {
|
|
|
52
52
|
}): Promise<boolean>;
|
|
53
53
|
/** Stop the local dev plane, reporting success only once the port is released. */
|
|
54
54
|
export declare function localDownCommand(): Promise<boolean>;
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Print the local dev plane orchestrator log path, plus the rotation policy.
|
|
57
|
+
*
|
|
58
|
+
* The path is the only line this command writes to stdout — the policy note
|
|
59
|
+
* goes to stderr — so a caller reading stdout never has to strip prose from
|
|
60
|
+
* it. The CLI version banner still precedes it, as for every command, so
|
|
61
|
+
* `$(kici local logs)` is NOT a bare path: read the last stdout line.
|
|
62
|
+
*/
|
|
56
63
|
export declare function localLogsCommand(): Promise<boolean>;
|
|
57
64
|
/**
|
|
58
65
|
* Attach the local dev plane to the hosted Platform so `kici run --local` uses
|
package/dist/commands/local.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
import { loadGlobalConfig } from "../remote/config.js";
|
|
3
|
+
import "../local-plane/plane-log.js";
|
|
3
4
|
import { attachPlane, detachPlane, planeDown, planeLogPath, planeStatus } from "../local-plane/plane-manager.js";
|
|
4
5
|
import { resolvePlaneForRun } from "../local-plane/resolve-plane.js";
|
|
5
6
|
import pc from "picocolors";
|
|
@@ -12,14 +13,14 @@ import { toErrorMessage } from "@kici-dev/core";
|
|
|
12
13
|
* orchestrator plus a local Postgres (embedded, with a podman fallback) that
|
|
13
14
|
* `kici run --local` dispatches through. `up` boots or reuses the plane,
|
|
14
15
|
* `status` reports it plus the control commands, `down` stops it, and `logs`
|
|
15
|
-
* prints the
|
|
16
|
+
* prints the plane log paths and rotation policy.
|
|
16
17
|
*/
|
|
17
18
|
/** Print the control commands a user needs once the plane is running. */
|
|
18
19
|
function printControlHints() {
|
|
19
20
|
console.log("");
|
|
20
21
|
console.log(pc.dim("Control commands:"));
|
|
21
22
|
console.log(` ${pc.cyan("kici local status")} Show plane status`);
|
|
22
|
-
console.log(` ${pc.cyan("kici local logs")} Print the
|
|
23
|
+
console.log(` ${pc.cyan("kici local logs")} Print the plane log paths and rotation policy`);
|
|
23
24
|
console.log(` ${pc.cyan("kici local down")} Stop the plane`);
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
@@ -147,9 +148,18 @@ async function localDownCommand() {
|
|
|
147
148
|
console.log(pc.green("✓") + " Local dev plane stopped.");
|
|
148
149
|
return true;
|
|
149
150
|
}
|
|
150
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Print the local dev plane orchestrator log path, plus the rotation policy.
|
|
153
|
+
*
|
|
154
|
+
* The path is the only line this command writes to stdout — the policy note
|
|
155
|
+
* goes to stderr — so a caller reading stdout never has to strip prose from
|
|
156
|
+
* it. The CLI version banner still precedes it, as for every command, so
|
|
157
|
+
* `$(kici local logs)` is NOT a bare path: read the last stdout line.
|
|
158
|
+
*/
|
|
151
159
|
async function localLogsCommand() {
|
|
152
|
-
|
|
160
|
+
const logFile = planeLogPath();
|
|
161
|
+
console.log(logFile);
|
|
162
|
+
console.error(pc.dim(`Rotated to ${logFile}.1 when it reaches 50 MB, at the next plane start. When the plane runs embedded PostgreSQL, its log sits beside it at ${logFile}.pg and rotates the same way.`));
|
|
153
163
|
return true;
|
|
154
164
|
}
|
|
155
165
|
/**
|
package/dist/commands/preview.js
CHANGED
|
@@ -9,10 +9,10 @@ import { loadSecretsFile } from "../test-runner/secrets-file.js";
|
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import pc from "picocolors";
|
|
11
11
|
import { readFile } from "node:fs/promises";
|
|
12
|
-
import { flattenStepInputs } from "@kici-dev/sdk";
|
|
13
12
|
import { logger, toErrorMessage } from "@kici-dev/core";
|
|
14
13
|
import { matchAllWorkflows } from "@kici-dev/engine";
|
|
15
14
|
import { normalizeRunsOnToMatchers } from "@kici-dev/engine/labels/compile";
|
|
15
|
+
import { flattenStepInputs } from "@kici-dev/sdk/internal";
|
|
16
16
|
//#region src/commands/preview.ts
|
|
17
17
|
/**
|
|
18
18
|
* Main preview command entry point.
|
|
@@ -13,6 +13,17 @@ export interface OrchestratorIdentity {
|
|
|
13
13
|
version: string | null;
|
|
14
14
|
mode: string | null;
|
|
15
15
|
connected: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Where this orchestrator's config files live on its host. Recorded so a
|
|
18
|
+
* support bundle names the files whoever reads it should ask for. Paths
|
|
19
|
+
* only — the bundle never carries their contents. Each is null when the
|
|
20
|
+
* orchestrator did not report it.
|
|
21
|
+
*/
|
|
22
|
+
configPaths: {
|
|
23
|
+
envFile: string | null;
|
|
24
|
+
scalerConfig: string | null;
|
|
25
|
+
composeFile: string | null;
|
|
26
|
+
};
|
|
16
27
|
}
|
|
17
28
|
export interface ReportIdentity {
|
|
18
29
|
kiciCliVersion: string;
|
|
@@ -19,7 +19,7 @@ import { PROTOCOL_VERSION } from "@kici-dev/engine";
|
|
|
19
19
|
*/
|
|
20
20
|
function collectIdentity(probe) {
|
|
21
21
|
const identity = {
|
|
22
|
-
kiciCliVersion: "0.
|
|
22
|
+
kiciCliVersion: "0.8.0",
|
|
23
23
|
nodeVersion: process.version,
|
|
24
24
|
platform: process.platform,
|
|
25
25
|
arch: process.arch,
|
|
@@ -38,7 +38,12 @@ function collectIdentity(probe) {
|
|
|
38
38
|
clusterName: o.clusterName ?? "(unnamed)",
|
|
39
39
|
version: o.version ?? null,
|
|
40
40
|
mode: o.mode ?? null,
|
|
41
|
-
connected: o.connected
|
|
41
|
+
connected: o.connected,
|
|
42
|
+
configPaths: {
|
|
43
|
+
envFile: o.configPaths?.envFile ?? null,
|
|
44
|
+
scalerConfig: o.configPaths?.scalerConfig ?? null,
|
|
45
|
+
composeFile: o.configPaths?.composeFile ?? null
|
|
46
|
+
}
|
|
42
47
|
}));
|
|
43
48
|
if (probe.infra.latestVersion) identity.latestKnownVersion = probe.infra.latestVersion;
|
|
44
49
|
return identity;
|
|
@@ -129,6 +129,7 @@ async function runRouted(options) {
|
|
|
129
129
|
}
|
|
130
130
|
const seeded = await ensureLocalSource(plane.url, plane.adminToken, {
|
|
131
131
|
repoDir: workdir.dir,
|
|
132
|
+
...resolved.kind === "attached" && { orgId: resolved.orgId },
|
|
132
133
|
inPlace: Boolean(options.inPlace)
|
|
133
134
|
});
|
|
134
135
|
const seededSecrets = await seedLocalSecrets(plane.url, plane.adminToken, {
|
|
@@ -150,6 +151,9 @@ async function runRouted(options) {
|
|
|
150
151
|
action: dispatch.action,
|
|
151
152
|
clientPayload: dispatch.clientPayload
|
|
152
153
|
}
|
|
154
|
+
}, {
|
|
155
|
+
repoBasePath: workdir.dir,
|
|
156
|
+
logPath: planeLogPath()
|
|
153
157
|
});
|
|
154
158
|
if (!quiet) logger.info(pc.green(`Run started: ${runId}`));
|
|
155
159
|
const outcome = await followRun(plane.url, plane.adminToken, runId, {
|
package/dist/commands/run.js
CHANGED
|
@@ -9,6 +9,7 @@ import { buildEncryptedSecrets } from "../remote/secret-upload.js";
|
|
|
9
9
|
import { createOverlayTarball, getSizeWarning, uploadTarball } from "../remote/uploader.js";
|
|
10
10
|
import { formatJsonResult } from "../remote/output/json.js";
|
|
11
11
|
import { formatJunitResult } from "../remote/output/junit.js";
|
|
12
|
+
import { unwrapStoredLogLine } from "../remote/output/streaming.js";
|
|
12
13
|
import { formatErrorHighlight, formatMultiFixtureSummary, formatSummary } from "../remote/output/summary.js";
|
|
13
14
|
import { compileFixtures, filterFixtures } from "../fixtures/compiler.js";
|
|
14
15
|
import { describeEvent } from "../fixtures/describe-event.js";
|
|
@@ -500,7 +501,8 @@ async function pollRunToCompletion(ctx, runId, fixtureId, options) {
|
|
|
500
501
|
throw err;
|
|
501
502
|
}
|
|
502
503
|
runSeen = true;
|
|
503
|
-
for (const
|
|
504
|
+
for (const raw of logs.lines) {
|
|
505
|
+
const line = unwrapStoredLogLine(raw);
|
|
504
506
|
if (!options.quiet) process.stdout.write(line + "\n");
|
|
505
507
|
tailLines.push(line);
|
|
506
508
|
while (tailLines.length > MAX_TAIL) tailLines.shift();
|
|
@@ -585,7 +587,8 @@ function jobsFromStatus(status) {
|
|
|
585
587
|
if (!status) return [];
|
|
586
588
|
return status.jobs.map((j) => ({
|
|
587
589
|
name: j.jobName,
|
|
588
|
-
status: j.status
|
|
590
|
+
status: j.status,
|
|
591
|
+
...typeof j.durationMs === "number" && { durationMs: j.durationMs }
|
|
589
592
|
}));
|
|
590
593
|
}
|
|
591
594
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "../../rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
import { DashboardClient, DashboardClientError } from "../../remote/dashboard-client.js";
|
|
3
3
|
import { colorStatus } from "../../remote/render.js";
|
|
4
|
+
import { unwrapStoredLogLine } from "../../remote/output/streaming.js";
|
|
4
5
|
import pc from "picocolors";
|
|
5
6
|
import { logger, toErrorMessage } from "@kici-dev/core";
|
|
6
7
|
import { TERMINAL_RUN_STATES } from "@kici-dev/engine";
|
|
@@ -31,7 +32,7 @@ async function printAllLogs(client, runId, jobs, jobFilter) {
|
|
|
31
32
|
for (const j of selectJobs(jobs, jobFilter)) for (const s of j.steps ?? []) {
|
|
32
33
|
console.log(pc.bold(`\n=== ${j.jobName} › ${s.stepName} `) + colorStatus(s.status) + pc.bold(" ==="));
|
|
33
34
|
const logs = await client.getStepLogs(runId, j.jobId, s.stepIndex);
|
|
34
|
-
for (const line of logs.lines) console.log(line);
|
|
35
|
+
for (const line of logs.lines) console.log(unwrapStoredLogLine(line));
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
async function collectAllLogs(client, runId, jobs, jobFilter) {
|
|
@@ -50,7 +51,7 @@ async function followLogs(client, runId, jobFilter) {
|
|
|
50
51
|
const seen = printed[key] ?? 0;
|
|
51
52
|
if (logs.lines.length > seen) {
|
|
52
53
|
if (seen === 0) console.log(pc.bold(`\n=== ${j.jobName} › ${s.stepName} ===`));
|
|
53
|
-
for (const line of logs.lines.slice(seen)) console.log(line);
|
|
54
|
+
for (const line of logs.lines.slice(seen)) console.log(unwrapStoredLogLine(line));
|
|
54
55
|
printed[key] = logs.lines.length;
|
|
55
56
|
}
|
|
56
57
|
}
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export interface TypesOptions {
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Path to the `.kici` directory (defaults to `.kici`). Resolved through
|
|
4
|
+
* `resolveKiciDir`, the same resolver every other command uses, so a
|
|
5
|
+
* relative value is interpreted against the project rather than against
|
|
6
|
+
* whatever directory the CLI happened to be invoked from.
|
|
7
|
+
*/
|
|
3
8
|
kiciDir?: string;
|
|
4
9
|
/** Suppress the success line on stdout (so machine-readable output stays pure). */
|
|
5
10
|
quiet?: boolean;
|
package/dist/commands/types.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
|
+
import { resolveKiciDir } from "../execution/executor.js";
|
|
2
3
|
import { loadGlobalConfig } from "../remote/config.js";
|
|
3
4
|
import { DashboardClient, DashboardClientError } from "../remote/dashboard-client.js";
|
|
4
5
|
import { generateSecretsDts } from "../generators/secrets-dts.js";
|
|
@@ -44,7 +45,7 @@ async function fileExists(p) {
|
|
|
44
45
|
* @returns true on success, false on error
|
|
45
46
|
*/
|
|
46
47
|
async function typesCommand(options = {}) {
|
|
47
|
-
const kiciDir = options.kiciDir
|
|
48
|
+
const kiciDir = resolveKiciDir(options.kiciDir);
|
|
48
49
|
const typesDir = path.join(kiciDir, "types");
|
|
49
50
|
const outputPath = path.join(typesDir, "secrets.d.ts");
|
|
50
51
|
try {
|
|
@@ -6,6 +6,7 @@ import { pathToFileURL } from "node:url";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import fs$1 from "node:fs/promises";
|
|
9
|
+
import { findKiciDir, hashKiciSourceTree } from "@kici-dev/core/kici-source-digest";
|
|
9
10
|
//#region src/execution/executor.ts
|
|
10
11
|
/**
|
|
11
12
|
* Map a caught runtime error's stack to a `SourceLocation` in the entry file.
|
|
@@ -46,7 +47,12 @@ function locateInEntry(stack, entryPoint) {
|
|
|
46
47
|
*/
|
|
47
48
|
async function loadModule(entryPoint, errorContext) {
|
|
48
49
|
let hashBundleSource;
|
|
49
|
-
|
|
50
|
+
const kiciDir = findKiciDir(entryPoint);
|
|
51
|
+
if (kiciDir) {
|
|
52
|
+
const digest = await hashKiciSourceTree(kiciDir);
|
|
53
|
+
if (digest) hashBundleSource = digest;
|
|
54
|
+
}
|
|
55
|
+
if (hashBundleSource === void 0) try {
|
|
50
56
|
hashBundleSource = await fs$1.readFile(entryPoint, "utf-8");
|
|
51
57
|
} catch {}
|
|
52
58
|
try {
|